April 2012
1 post
3 tags
Tiny MVC for J2EE
I know, you already know how to write MVC pattern using Servlet/JSP. But I didn’t and I know many of you still don’t know it! People use frameworks even if they don’t want that much complicated setup. For smaller webapps, you don’t need frameworks, they make your app heavy. So mind it and let’s start writing our own MVC pattern using Servlet/JSP. YaY!! First of all,...
Apr 19th
December 2011
1 post
2 tags
Observer and Ducks
If you have implemented Observer pattern in any statically typed language, you know that you need an explicit Observer class/interface for the pattern, which will be extended by the actual concrete classes and some ‘update’ kind of method should be overridden in order to propagate the observations.Basically taking advantage of inheritance. Here comes a duck type language like Ruby, as...
Dec 3rd
1 note
November 2011
1 post
Nov 23rd
September 2011
2 posts
3 tags
Game of life in Ruby
Here is the code, I think this needs to be written in more stylish way. If you have any suggestions please comment.
Sep 6th
13 notes
3 tags
Drupal 7 + mod_sec
While developing one of my friend’s website in Drupal 7(this was the first time I have installed Drupal 7 on shared host), My IP Address was being continuously blocked by Mod_Security. So I asked for the logs and found that some rule in Mod_Security (id=950004) is blocking jquery.cookie.js. I googled it and found that many people are having the same issue. So here is the solution that worked...
Sep 5th
2 notes
June 2011
1 post
3 tags
Your new Remote Control : NaradMuni
Hello all, Its been a hectic month for me, many things happened, good and bad(especially about home loan, I am going to write a blog post about that in Vartool.). One of the good things that happened is that I met few Ruby enthusiasts and I have decided to write some cool Ruby program again! So without wasting anymore time, lets go… Scenario : I am working on my computer(A) and my...
Jun 25th
7 notes
December 2010
1 post
5 tags
Start to End : Twitter client in Shoes
Prerequisites : I hope you have Shoes installed on your machine, operating system does not matter :) oauth gem (gem install oauth will do the trick or sudo if you have to!) json gem as well(to parse the response) (gem install json) Let’s start : Step 1 : Register your application at Twitter (HERE), give some cool name like “Rubydubee”(not this x-( ). Step...
Dec 6th
10 notes
October 2010
1 post
1 tag
Just another problem with Chrome
Writing this post cuz i thought it would be useful for some web UI designers out there who deal with percent level details e.g Statistic Apps, graphs, Maps… Chrome has one serious problem with calculating number of pixels in one percent. I was designing some UI in which i needed to divide some area in 50 parts, so i used 2% width for each part. now consider following scenario : If the...
Oct 5th
1 note
September 2010
1 post
Standard KT session
Sep 20th
August 2010
1 post
3 tags
Ruby GUI - Web to Desktop
Hello! to all those good looking(:p) unhealthy smart creatures out there, A very very good morning(its 2:35 AM here :D ). You might have made some guesses about this post from the title, and if you are excited to read the whole post then let me tell you that you are the right kind of person to do this. Please go on —- There are thousands of web developer who are master at designing a web...
Aug 6th
1 note
March 2010
2 posts
3 tags
Minesweeper board generator.
Have you ever played Minesweeper? This cute little game comes with a certain operating system whose name we can’t remember. The goal of the game is to find where all the mines are located within a M × N field. The game shows a number in a square which tells you how many mines there are adjacent to that square. Each square has at most eight adjacent squares. The 4 × 4 field on the left contains...
Mar 30th
1 note
1 tag
Started a new SVN repository
Hello all, I have started writing some crappy Ruby code in my new SVN repository. If you don’t know what is SVN, you are just impossible 8-) let me help you (->) . This repository is called “Ganimi”. The name has nothing to do with anything(Just random historical marathi word). It is hosted on Google project hosting( click here if you don’t know about this too). To start...
Mar 27th
6 notes
January 2010
1 post
1 tag
Short and sweet profiling
I never used profiling for any kind of application before, so just thought i should learn how to use it. And what better than in ruby?But i have never thought it will be so easy. Here it starts:The one and only thing you need to do is require “profile”.That’s it!!!run your program with -rprofile option and see which are the culprit methods that must be improved.here is the...
Jan 9th
September 2009
2 posts
2 tags
Shoes example like Adidas or NIKE
As i already told Shoes is like designing web GUI, 100.times {very.easy}. But ofcourse you need to start somewhere… if you haven’t yet tried this before… you must give it try. Simple to install and start(especially if you are on windows ! you know its like you can anytime climb on windows with your shoes on! ;) ). So tie your shoe laces tightly… we gotta roll on...
Sep 5th
3 tags
Shoes and Chappals!
Nobody Knows Shoes? Haha are you kidding? No! but you must read that!(what? dont know?) . Its the only official document available for Shoes. Shoes Intro: Shoes is a very tiny Goeey(uh oh GUI) framework for Ruby. Have you listen to it? I’ve said very TINY !! Because it only has 10 things to show!….. i.e you can only draw 10 things and thus only have to remember 10 things. Para...
Sep 5th
August 2009
5 posts
1 tag
Extract part of an Array
Ruby provides lots of methods to extract a part of an Array. The simple method is a legendary [] method. i.e use array[index] to get teh value at the index in an array. The more faster way of doing the same thing is array.at(index): This does exactly the same thing but in less time. Third method is array.slice(index) : again similar, a ruby way of doing things in various manner. Next is...
Aug 23rd
1 tag
Sorting
Array#sort is a very basic method for sorting arrays naturally. for example: but you also have a cool method where you can sort with your preferences, for example: There is one more interesting way… using <=> comparison operator, say you want to sort array of integers in ascending order but you dont want to include number 6 in it, then this is the solution, for example: Want to...
Aug 23rd
1 tag
Some more Array features
Array#uniq To remove duplicates you can also use Set instead of an array. Or you can convert an array into set, very easy, for example: puts a.to_set             #[1,2,4,5] Array#delete(x) You can delete all the occurence of a specific element in an array by using delete, for example: Or you can use Array#compact to remove all the nil elements in an array. More to come! Thanks for stopping by!
Aug 23rd
1 tag
Assignment Operator Magic
A simple but very effective magic of Ruby: Haha! This is the power of ruby assignment operator. here is another example : Here comes another very effective thing: Again the right hand side of the assignment operator can almost arbitrarily complicated, for example:
Aug 23rd
3 tags
Iterators for Ruby Arrays
Arrays: Arrays are very interesting and very easy in ruby. How to iterate over arrays? For? while? do-while? Although these methods are there for common developers, stylish ones use different things in Ruby: And the methods are each and collect. ex: That’s it! or Got the difference? exactly the collect method creates a different array and each just iterate! there is another method...
Aug 23rd
22 notes