Category Archives: Programming

Understanding and Applying Artificial Neural Networks : Engineering Perspective

Lasts week (15th November to 19th November), NITTTR (National Institute of Technical Teachers Training and Research) had organized a course on Artificial Neural Networks at Government College Of Engineering – Farmagudi, Goa. I was appointed as course faculty for this event. Personally, I do not believe in concept of teaching. Humans are smart and intelligent [...]

Just Released: Maya Programming Language

Around one year ago, I had started experimenting with concepts of creating programming languages. I first started with building few DSLs (Domain Specific Languages) using Ruby and Boo. It was quite interesting to work on development of DSLs. While doing this, I learnt a lot about how the programming languages are developed. Eventually, I thought [...]

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 [...]

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: method_returning_true?.should be_true or method_returning_false?should be_false 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 [...]

Simple equivalent of “With” statement in C#

Consider the following class in C# public class Person { private string name; private int age; public string Name{ get {return name;} set { name = value; } } public int Age{ get {return age;} set { age = value; } } } If I want to set the value of Name and Age property [...]

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 [...]

Be careful while using ‘replaceAll’ and ‘replaceFirst’ methods of String class in Java

Most of the time, while trying to replace a substring in a given string, either all its occurrences or just the first one, java programmers tend to use ‘replaceAll’ and ‘replaceFirst’ methods provided by String class in Java. Java programmers like to use these methods to replace substrings as compared to ‘replace’ method of String [...]

Taking a close look at inheritance and closures in Javascript

Let’s play with inheritance and closures in Javascript. Take a look at the following javascript code: function BaseClass(){ var id=200; this.Id=function(){ return id; } } function ChildClass(){ var id=500; } ChildClass.prototype = new BaseClass(); var childObject=new ChildClass(); In Javascript, inheritance is achieved using prototype. When we try to access any member on Javascript object, it [...]

Is JavaScript more object-oriented than other programming languages?

Like this post? Publish It On Your Own Blog I started my career as a web developer before the dot.com crash. I learnt all about HTML, IIS, ASP, SQL Server and JavaScript. Equipped with the knowledge I built a few dynamic websites and carried my laptop with me to all my interviews and walked out [...]

Binding HTML Form Fields To Javascript Objects

Consider that I have a object called ‘person’ with a property called ‘Name’ which returns me the name of a particular person. I want to assign this object property to a form element such that: The form element will display the value of object property (In our case, the value of person.Name) If I change [...]