Error in ruby on rails documentation for ActionController::UrlWriter

In Ruby on rails, methods that generate urls from named routes are not globally accessible. For example, you can’t access them from console (script/console). If you want to use these methods from such places, then the rails documentation for ActionController::UrlWriter suggests two ways of doing it. According to this documentation, you can: Include ActionController::UrlWriter in [...]

Continue reading...

RSpec Matchers: Be careful while testing boolean values

While testing methods that return boolean values in ruby (the ones that end in ‘?’), try to avoid following matchers: or This is because, ‘be_true’ and ‘be_false’ matchers considers ‘nil’ to be false and anything other than ‘nil’ to be true. When we write methods in ruby which end with question mark (‘?’), intent is [...]

Continue reading...

Simplicity is the best policy

Few days ago I came across a story here. In this story, an assembly line worker suggests a simple, low-cost but highly effective solution to the problem for which engineers had developed a complex and expensive solution. Why am I referring to this story today? Because, I notice lot of people having a misconception that [...]

Continue reading...

Search Google Visually

Veesual

Today I came across an online tool that allows you to see the screenshot of pages in the google search result. You can give it a try at “Veesual.com” While I found the concept to be interesting, I was wondering what could be the use of looking at screenshots of pages in search result. What [...]

Continue reading...

Simple equivalent of “With” statement in C#

Consider the following class in C# If I want to set the value of Name and Age property on the instance of Person class, I’ll need to refer to that instance for every property I need to set in the code. For example: It would have been great if C# had an equivalent of VB’s [...]

Continue reading...

Fixing SyntaxHighligher plugin in WordPress Blass2 theme

Yesterday I installed and activated Blass2 theme for this blog. I liked this theme as it was very simple and free from any extra graphics. After installing the theme, I discovered that “SyntaxHighlighter Evolved” plugin which I use to display code segments, was not working. I searched for other themes which are similar to blass2 [...]

Continue reading...

After file and photo sharing, it’s time for “code sharing”

If we want to share a file or photos while chatting with our friends on internet using IM tools like GTalk, we use file sharing services available online. These services allow us to upload a file to their servers and give us a link which we can share with our friends. But what if you [...]

Continue reading...

C# 3.5 in Ubuntu

MonoDevelop running C# 3.5 code

Today, I managed to install Mono 2.4 in Ubuntu 9.04 without affecting Ubuntu’s default mono installation. Thanks to the instructions here (Building Mono 2.4 from source on Ubuntu 8.10), I was able to install latest mono/monodevelop in a parallel environment. Now I can work on C# 3.5 code in Linux as well. Here is the [...]

Continue reading...

Y-Combinator in C#

For last few days, I was trying to use lambda feature of C# to implement Y-Combinator. After few trial and errors, I was able to implement it in C# 3.5. I’m currently posting the code here and in my next blog, I’ll explain how I derived it. In this code, Y-Combinator function, is used to [...]

Continue reading...

Missing attachment detector in Gmail

It is really embarrassing to send an email with an attachment and actually forgetting to attach the file you were supposed to mail along, isn’t it? In my case, I often forget to attach files to emails if I’m typing it in hurry. Sometimes, I even end up receiving replies from recipients of those emails [...]

Continue reading...