Spammers have grown up

Getting spam in your e-mail or via comments on your blog is not a new thing. I do it all the time and mine is not even a popular blog and in my case Akismet has caught 20,268 up till today. Imagine GigaOm for that matter, they must be bombarded with spam all day long. However, the spam messages have improved over the years and they are no more “Viagara”, or “Enlarge your …” but they are carefully selected and polite. For instance, see below the last couple of spam messages I ‘ve received on this blog:


“How long has this blog been around? I have been searching for this kind of information for the past week and a half.”

That rss feature on your website here is brilliant, you should tell more folks about it in your next post. I haven’t noted it a first, now I’m using it each morning to check on any updates.

They are so soft and nice and I am actually tempted to just accept them just to show how popular my blog is. So, spammers have grown up and gone are the days of nasty spam messages. There might be a few odd ones that fall through Akismet’s trap but the nice once always come through. I have no idea about this shift in the trend but I don’t mind it because it is better to read a nice message before you reject it then a nasty one.

Update: Yet another nice message from the spammers who found this blog. But the contents of the message are legit and polite. Here it is:


“This is truly a greatwebsite. I’ve a few myself. I truly love your format. I understand this is off subject however,did you make this design your self,or buy from a social networking site?”

Posted in Rant | Tagged | Leave a comment

Kernighan’s law

As per Kernighan’s law:

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”

What that means for me?
Either don’t write smart code or stop fixing my bugs because I will never be able to. Perfect!

Posted in Programming | Tagged | Leave a comment

Install mysql, pg gems with bundler 0.9.x

If you use ruby on rails, at some point you have to install mysql and pg gems (no offences to sqlite) and for some reason I keep forgetting the whole install procedure. Silly me! This post is dedicated to the loss of build_options.yml in bundler 0.9.x and my subsequent struggle and frustration to install mysql and pg gems and the occurence of eureka moment proving why I am still a n00b.

Let us cut to the chase. Bundler is the new gem dependency superhero. If you didn’t know it perhaps you need to wake up and start using that thing they call the feed reader and subscribe to some ruby and rails feeds. The fun of working with open source is that one day you wake up do a git pull and everything stops working. It is quite like your life, everything is going swimmingly and then the most unexpected thing hits you.

Bundler 0.9.x leaves no stone unturned in frustrating you, if you had accustomed to the comfortable 0.8 api. However, after a a while you do realise the benefits of the changes. In 0.8 there was a way to specify build_options (via build_options.yml) to install gems like mysql and pg. That has disappeared in 0.9. I added an issue and you can see how it has taken shape in last few weeks. But what now? I can’t run rails test on my machine now. I was so looking forward to refactor the hell out of active-record’s relation class. I spent quite sometime wondering how the hell can I install mysql and pg gems using bundler.

It is quite simple if you think about it. mysql and pg gems need to know the location of mysql and pg on your machine. It should have been added to the PATH when they are installed but for some reason it did not. So, what you gotta do is simple. Add them to the PATH so when bundler installs them it can resolve the dependencies. Here are the commands:

export PATH=/usr/local/pgsql/bin:${PATH}
export PATH=/usr/local/mysql/bin:${PATH}

And then just run bundler’s install command. Voila!

I am so glad to have figured this out as now I can go back hacking into rails.

Posted in Rails | Tagged , , , | Leave a comment

Quote of the day

I was reading this article and I had to put this quote on my blog.

Robert A. Heinlein says:

“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”

Posted in Quote | Tagged | Leave a comment

iPad alternative

iPad has been released and does not live up to the expectations. Some call it is going backwards since it is not a multi-tasker. Anyways, I found this company via Reddit which can create a device from your Mac, similar to iPad but a lot better than it. Check it out.

Posted in Apple, Mac | Tagged | 1 Comment

Rails3

Rails3 pre has been out for a while and a beta version is due soon. A lot has changed in Rails3. The structure, the way the plugins(yes activerecord is sort of a plugin now) work. To cut to the chase, Rails3 is modularised and exposes much more of the framework to the developers. The first thing I have jumped into is the Rails Generators. A majority of the gems and plugins rely on the generators and this section has been totally revamped in Rails3. It basically extends Thor now, written by Yehuda Katz so you see the connection. It is quite extensive to start with but with time it gets easier. I have written generators for Haml Controller, and Clearance…so if you fancy you can have a look and see how it has been done. I was going to do an extensive post on the Rails3 generators but I guess there are lof of them out there already and are much better than what I can ever write.

Posted in Rails | Tagged | Leave a comment

Gemcutter

Well, if you work with ruby and rails and you do not know what Gemcutter is then its time for you to come out of the rock you have been living under. It is the awesome gem hosting service that has in time replaced rubyforge for good.

And, now I am an official contributor to such a incredible application. Yes, I added a feature in and it has been merged into the main production branch due for release very soon. And, I am now sitting along the likes of Jim Weirich in the contributors list. Awesome.

Posted in ruby | Tagged , , , , | Leave a comment

Virtues of a programmer

  • Laziness – The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer. Also hence, this book. See also impatience and hubris.
  • Impatience – The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to. Hence, the second great virtue of a programmer. See also laziness and hubris.
  • Hubris – Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer. See also laziness and impatience.

* Taken from the book Programming Perl

Posted in Programming | Tagged , | Leave a comment

Facebook, Facebooker gem and ssh-tunnel

Well, it was long hours of endless frustration and little fun, I tell you. That is how I spent most of my saturday trying to follow the instructions to create a ssh-tunnel so that I could test facebook application as I developed it. Putting an application up on facebook is a walk in the park. You create a new application, give it a callback url, where it can find what to display in your application and you are done. As far as your callback url is legitimate your application will work like a charm. If you are interested, please go ahead and check the request-response artchitecture.

I am using the facebooker gem which gives a you a lot of functionality out of the box and one thing it does is gives you rake tasks to start a ssh-tunnel. The purpose of ssh-tunnel is simple port-forwarding. So, any requests to a publicaly available domain at a certain port should be forwarded to the local server where I am doing facebook application development. The latest version of the gem sits on github and you can install it as a plugin, just do:

script/plugin install git://github.com/mmangino/facebooker.git

There are several tutorials that describe how you can set it up, just google it.

And I will go straight into the ssh-tunnel part of the problem so I assume that you have facebooker gem installed and you have made necessary changes to the facebooker.yml file by adding your public host name and ports where you want to achieve port forwarding. For example: any publicly available domain that you have ssh access to can be used as a port-forwarder. For the sake of this post let us say:

public_host :andhapp.com
remote_port: 4007
username :andhapp
localhost :localhost
local_port :3000

As per the above details, when I run the facebooker rake task to start the tunnel I will basically be doing this: Any requests to andhapp.com on port 4007 should be forwarded to my localhost on port 3000 (which is where your dev facebook app is running).

Once it is all set-up you can use facebooker’s nifty rake command to start the tunnel, like this:

rake facebooker:tunnel:start

This would prompt you for your password for sshing to your public host. To check the ssh-tunnel status, just do:

rake facebooker:tunnel:status

If this command comes back with “Seems, ok” you know the ssh-tunnel is up and fine. But when you access http://andhapp.com:4007 (or whatever domain you have used) it just gives you a browser error – “the connection could not be made”. It took me a long time to figure out what exactly the problem is. The ssh-tunnel is fine its the way ssh is configured. To fix the issue, just uncomment the line:

GatewayPorts no

in your ssh config file on your server, most probably found in: /etc/ssh/sshd_config and change it to:

GatewayPorts yes

Restart ssh, and restart the tunnel and it will start working. What the hell? Why do we need to do that for? Here’s an explanation.

Posted in Programming, Rails | Tagged , , | Leave a comment

BitBucket

I recently read this article comparing BitBucket and GitHub and did mention in in a previous post on Git. Apart from well defined differences like BitBucket is a social repository for Mercurial writting in Python whereas GitHub is obviously for Git written in Ruby with bits written in Erlang.

So, I decided to try BitBucket out and I must say although the UI is quite similar to GitHub but it is still not as intuitive and can be improved massively in terms of overall navigation and organisation. But, hold your thoughts, if you are going to write Mercurial off on the basis of BitBucket then atleast check this article out by Geoffrey Grosenbach before you do so.

Posted in Git, Mercurial | Tagged , , , | 1 Comment