<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>I am Pradyumna and You can read my Rubyish Resume (once it is done) to know more about me!
</description><title>RubyDubee</title><generator>Tumblr (3.0; @rubydubee)</generator><link>http://blog.rubydubee.com/</link><item><title>Tiny MVC for J2EE</title><description>&lt;p&gt;I know, you already know how to write MVC pattern using Servlet/JSP. But I didn&amp;#8217;t and I know many of you still don&amp;#8217;t know it! People use frameworks even if they don&amp;#8217;t want that much complicated setup. For smaller webapps, you don&amp;#8217;t need frameworks, they make your app heavy. So mind it and let&amp;#8217;s start writing our own MVC pattern using Servlet/JSP. YaY!!&lt;/p&gt;
&lt;p&gt;First of all, you need a Controller, yes only one! Let&amp;#8217;s call it a FrontController(because some frameworks do). All the requests should come to this controller and it will then delegate these requests to individual Action(again!). Actions take care of processing a request and dispatching it to the JSP, which acts as a view.&lt;/p&gt;
&lt;p&gt;Let&amp;#8217;s add our FrontController in web.xml&lt;/p&gt;
&lt;script src="https://gist.github.com/2424756.js?file=web.xml" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;and now lets write our FrontController, Action and a sample AccountAction which will display user&amp;#8217;s name through account.jsp.&lt;/p&gt;
&lt;script src="https://gist.github.com/2424756.js?file=FrontController.java" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Here we map a request to its corresponding action, I have done this using requestURI(), you can use different techniques as well, like sending hidden parameter &amp;#8220;action&amp;#8221;. But this way looks much cooler to me.&lt;/p&gt;
&lt;script src="https://gist.github.com/2424756.js?file=Action.java" type="text/javascript"&gt;&lt;/script&gt;&lt;script src="https://gist.github.com/2424756.js?file=AccountAction.java" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;AccountAction process your business logic, it will communicate with your Database layer and create a bean of your data(or may be multiple beans). The request will now be dispatched to the jsp file(your View) and along with it goes your data(bean) which is set on the request through setAttribute(..)&lt;/p&gt;
&lt;script src="https://gist.github.com/2424756.js?file=account.jsp" type="text/javascript"&gt;&lt;/script&gt;&lt;p&gt;Try this! Extending this application is very easy and maintaining it will be even more easier! Happy Coding!&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/21405709364</link><guid>http://blog.rubydubee.com/post/21405709364</guid><pubDate>Thu, 19 Apr 2012 19:42:00 -0400</pubDate><category>Java</category><category>MVC</category><category>Design Patterns</category></item><item><title>Observer and Ducks</title><description>&lt;p&gt;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 &amp;#8216;update&amp;#8217; kind of method should be overridden in order to propagate the observations.Basically taking advantage of inheritance.&lt;/p&gt;
&lt;p&gt;Here comes a duck type language like Ruby, as there are no types to be declared you can pass in any object to the observable and let it call the update method, you don&amp;#8217;t need any parent Observer class. If the method is available in the object it will be called and the observation will be accomplished.&lt;/p&gt;
&lt;p&gt;Now we can extend this more, The observable object will call any method it wants and ruby&amp;#8217;s method_missing will take care of the methods that the individual observers don&amp;#8217;t want to define. Cool eh? Check out this simple example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1426455.js"&gt; &lt;/script&gt;&lt;p&gt;So I quote this again &amp;#8220;If it walks like a duck and quacks like a duck, it must be a duck.&amp;#8221;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/13671793160</link><guid>http://blog.rubydubee.com/post/13671793160</guid><pubDate>Sat, 03 Dec 2011 03:29:00 -0500</pubDate><category>ruby</category><category>design patterns</category></item><item><title>QR Code!</title><description>&lt;img src="http://25.media.tumblr.com/tumblr_lv4tf13gXc1qm9xsgo1_400.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;QR Code!&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/13218846104</link><guid>http://blog.rubydubee.com/post/13218846104</guid><pubDate>Wed, 23 Nov 2011 16:09:01 -0500</pubDate></item><item><title>Game of life in Ruby</title><description>&lt;p&gt;Here is the code, I think this needs to be written in more stylish way. If you have any suggestions please comment.&lt;/p&gt;

&lt;script src="https://gist.github.com/1198926.js?file=game_of_life.rb"&gt;&lt;/script&gt;</description><link>http://blog.rubydubee.com/post/9889076099</link><guid>http://blog.rubydubee.com/post/9889076099</guid><pubDate>Tue, 06 Sep 2011 17:09:44 -0400</pubDate><category>game</category><category>algorithm</category><category>Ruby</category></item><item><title>Drupal 7 + mod_sec</title><description>&lt;p&gt;While developing one of my friend&amp;#8217;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.&lt;br/&gt;So here is the solution that worked for me(Use this if you don&amp;#8217;t want to waste your time fighting with your shared webhost.)&amp;#160;:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Rename your jquery.cookie.js to something like jquery-c.js.&lt;/li&gt;
&lt;li&gt;You will also need to change the mapping in system.module - find &amp;#8220;jquery.cookie&amp;#8221; and replace with &amp;#8220;jquery-c&amp;#8221;.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Hope that will help.&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/9828926913</link><guid>http://blog.rubydubee.com/post/9828926913</guid><pubDate>Mon, 05 Sep 2011 05:46:00 -0400</pubDate><category>Drupal</category><category>mod_sec</category><category>Jquery</category></item><item><title>Your new Remote Control : NaradMuni</title><description>&lt;p&gt;Hello all,&lt;br/&gt;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&amp;#8230;&lt;br/&gt;&lt;br/&gt;Scenario&amp;#160;: I am working on my computer(A) and my teammate is working on a shared computer(B), Now i have some urgent work on computer B, lets say i have to read some code i have written yesterday. Now I can&amp;#8217;t go to the machine and copy that code(because the machine is remotely located .. geographically) and i can&amp;#8217;t remotely access it through remote desktop because i don&amp;#8217;t want to disturb him. What should I do?&lt;br/&gt;&lt;br/&gt;Well don&amp;#8217;t worry, NaradMuni is here.&lt;br/&gt;&lt;br/&gt;What is NaradMuni&amp;#160;: NaradMuni is very small (tiny) ruby application which will let you run a terminal command on another machine from your machine.&lt;br/&gt;&lt;br/&gt;How&amp;#160;: Using DRb. Well, I have written a DRb server and client, you run the server on the shared machine(Computer B from the scenario) and client on your machine. The client will accept the commands you want to run on the server and send it to the server using DRb. Server then runs the command using IO.popen and return the result to the client. Simple!&lt;br/&gt;&lt;br/&gt;Here is an output, Server is running on my machine(pdandwate) and client on another(kalea, thanks to Kale for letting me use his machine ;) )&amp;#160;:&lt;br/&gt;&lt;/p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br/&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-bUM3WwgbtsA/Tgd3225_9AI/AAAAAAAAAHs/L8ngM1cqQxM/s1600/padd_drb.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="116" src="http://2.bp.blogspot.com/-bUM3WwgbtsA/Tgd3225_9AI/AAAAAAAAAHs/L8ngM1cqQxM/s400/padd_drb.PNG" width="400"/&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br/&gt;&lt;/div&gt;I will be committing the code soon, till then Cya, bye!&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7488824320314285279-3857673567160361906?l=blog.rubydubee.com" alt=""/&gt;&lt;/div&gt;</description><link>http://blog.rubydubee.com/post/7090965901</link><guid>http://blog.rubydubee.com/post/7090965901</guid><pubDate>Sat, 25 Jun 2011 10:31:00 -0400</pubDate><category>network</category><category>drb</category><category>Ruby</category></item><item><title>Start to End : Twitter client in Shoes</title><description>&lt;p&gt;Prerequisites&amp;#160;:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;I hope you have &lt;a href="https://github.com/shoes/shoes/downloads"&gt;Shoes&lt;/a&gt; installed on your machine, operating system does not matter :) &lt;/li&gt;
&lt;li&gt;oauth gem (&lt;span&gt;gem install oauth&lt;/span&gt; will do the trick or &lt;span&gt;sudo&lt;/span&gt; if you have to!)&lt;/li&gt;
&lt;li&gt;json gem as well(to parse the response) (&lt;span&gt;gem install json&lt;/span&gt;)&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Let&amp;#8217;s start&amp;#160;:&lt;br/&gt;Step 1&amp;#160;: Register your application at Twitter (&lt;a href="http://dev.twitter.com/"&gt;HERE&lt;/a&gt;), give some cool name like &amp;#8220;Rubydubee&amp;#8221;(not this x-( ).&lt;br/&gt;&lt;br/&gt;Step 2&amp;#160;: Lets first write our own library(ehh? don&amp;#8217;t worry you can just copy the code &lt;a href="https://docs.google.com/leaf?id=0B_dcX9AtkwUwMDg4YjYxZjEtOWMyNi00ZWEzLTk5NjItNTgwZjg4MWE3ZGQz&amp;amp;hl=en&amp;amp;authkey=CK_R5Sw"&gt;here&lt;/a&gt; :) ), But you can try to understand that&amp;#8230; very small &amp;amp; simple if you know the OAuth protocol.(the oauth gem does all the magic.)&lt;br/&gt;&lt;br/&gt;Step 3&amp;#160;: Let&amp;#8217;s write our Application&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1057047.js"&gt; &lt;/script&gt;&lt;p&gt;&lt;br/&gt;The code is intuitive! isn&amp;#8217;t it? if you need any help plz comment! &lt;br/&gt;After you run this &amp;#8220;shoes main.rb&amp;#8221; it will look somewhat like this&amp;#160;:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_Jw_2S7Krs4k/TP0Zg2GKhxI/AAAAAAAAAF4/eyh-_QyPcMY/s1600/upload1.gif"&gt;&lt;img src="http://1.bp.blogspot.com/_Jw_2S7Krs4k/TP0Zg2GKhxI/AAAAAAAAAF4/eyh-_QyPcMY/s1600/upload1.gif" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://3.bp.blogspot.com/_Jw_2S7Krs4k/TP0aPezKGHI/AAAAAAAAAF8/SOFCp9Plg7U/s1600/updatedstatus.gif"&gt;&lt;img src="http://3.bp.blogspot.com/_Jw_2S7Krs4k/TP0aPezKGHI/AAAAAAAAAF8/SOFCp9Plg7U/s400/updatedstatus.gif" height="67" width="400" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks for reading this post!&lt;br/&gt;Next post will bring following points&amp;#160;:&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Error handling&lt;/li&gt;
&lt;li&gt;Sophisticated architectural design and UI&lt;/li&gt;
&lt;li&gt;More features&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;Keep reading!!! :)&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-5967198574174500602?l=blog.rubydubee.com" height="1" width="1"/&gt;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090965117</link><guid>http://blog.rubydubee.com/post/7090965117</guid><pubDate>Mon, 06 Dec 2010 12:16:00 -0500</pubDate><category>Shoes</category><category>Twitter</category><category>Json</category><category>Oauth</category><category>Ruby</category></item><item><title>Just another problem with Chrome</title><description>&lt;p&gt;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&amp;#8230;&lt;br/&gt;&lt;br/&gt;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&amp;#160;:&lt;br/&gt;&lt;br/&gt;If the total width of the area is 625px, 4% = 25px, so if you are using 1%=6px then in every 4 percent you should add 1px, Now firefox will do exactly the same. But this is not the case with Chrome, Chrome will allocate 13px to first 25 parts, and 12px to remaining 25 parts which is weird. Now if you are designing some statistics app which uses percent scale, then you are completely screwed up.&lt;br/&gt;&lt;br/&gt;Beware, Bye.&lt;/p&gt;
&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-6653489115126761957?l=blog.rubydubee.com" height="1" width="1"/&gt;</description><link>http://blog.rubydubee.com/post/7090964367</link><guid>http://blog.rubydubee.com/post/7090964367</guid><pubDate>Tue, 05 Oct 2010 17:04:00 -0400</pubDate><category>html</category></item><item><title>Standard KT session</title><description>&lt;p&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_Jw_2S7Krs4k/TJfkUwUkVPI/AAAAAAAAAFc/-DMDzZj8ULM/s1600/standard-kt.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="233" src="http://1.bp.blogspot.com/_Jw_2S7Krs4k/TJfkUwUkVPI/AAAAAAAAAFc/-DMDzZj8ULM/s400/standard-kt.gif" width="400"/&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7488824320314285279-6660294256674255742?l=blog.rubydubee.com" alt=""/&gt;&lt;/div&gt;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090963688</link><guid>http://blog.rubydubee.com/post/7090963688</guid><pubDate>Mon, 20 Sep 2010 18:46:00 -0400</pubDate></item><item><title>Ruby GUI - Web to Desktop</title><description>&lt;p&gt;Hello! to all those good looking(:p) unhealthy smart creatures out there, A very very good morning(its 2:35 AM here :D ).&lt;br/&gt;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 &amp;#8212;-&lt;br/&gt;&lt;br/&gt;There are thousands of web developer who are master at designing a web gui. but when it comes to designing the similar kind of gui for desktop application, it becomes very very tough for them to get the same look and feel.Hence for those i propose a very very simple way to port the web gui to desktop application. &lt;br/&gt;&lt;br/&gt;I have started a project (&lt;a href="https://code.google.com/p/webtodesktop/"&gt;webtodesktop&lt;/a&gt;) which will convert an HTML file into a desktop application along with the same styling.&lt;br/&gt;&lt;br/&gt;See the demo &amp;#8230; Check &lt;a href="https://code.google.com/p/webtodesktop/wiki/README"&gt;README&lt;/a&gt;.&lt;br/&gt;&lt;br/&gt;Will soon be writing more HowTos on that&amp;#8230;Cya!!!&lt;/p&gt;
&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-5793034517155126080?l=blog.rubydubee.com" height="1" width="1"/&gt;</description><link>http://blog.rubydubee.com/post/7090963060</link><guid>http://blog.rubydubee.com/post/7090963060</guid><pubDate>Fri, 06 Aug 2010 16:43:00 -0400</pubDate><category>html</category><category>Shoes</category><category>Ruby</category></item><item><title>Minesweeper board generator.</title><description>&lt;p&gt;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.&lt;/p&gt;
&lt;p&gt;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 two mines, each represented by a “*” character. If we represent the same field by the hint numbers described above, we end up with the field on the right:&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;&lt;br/&gt;&lt;span&gt;* . . .       * 1 0 0&lt;/span&gt;&lt;br/&gt;&lt;span&gt;. . . .       2 2 1 0&lt;/span&gt;&lt;br/&gt;&lt;span&gt;. * . .       1 * 1 0&lt;/span&gt;&lt;br/&gt;&lt;span&gt;. . . .       1 1 1 0&lt;/span&gt;&lt;/span&gt;&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;p&gt;Solved this Problem check it out &lt;a href="http://code.google.com/p/internal-ganimi/source/browse/#svn/trunk/Minesweeper"&gt;here&lt;/a&gt;.All you have to do is &lt;a href="http://code.google.com/p/internal-ganimi/source/checkout"&gt;checkout&lt;/a&gt; the Minesweeper folder and ruby the &lt;span&gt;main.rb&lt;/span&gt; file.&lt;/p&gt;
&lt;p&gt;See ya!!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-5542810948139961316?l=blog.rubydubee.com" height="1" width="1"/&gt;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090962326</link><guid>http://blog.rubydubee.com/post/7090962326</guid><pubDate>Tue, 30 Mar 2010 12:01:00 -0400</pubDate><category>algorithm</category><category>game</category><category>Ruby</category></item><item><title>Started a new SVN repository</title><description>&lt;p&gt;Hello all,&lt;br/&gt;I have started writing some crappy Ruby code in my new SVN repository. If you don&amp;#8217;t know what is SVN, you are just impossible 8-) let me help you &lt;a href="http://en.wikipedia.org/wiki/Subversion_%28software%29"&gt;(-&amp;gt;)&lt;/a&gt; .&lt;br/&gt;This repository is called &amp;#8220;Ganimi&amp;#8221;. The name has nothing to do with anything(Just random historical &lt;span&gt;marathi&lt;/span&gt; word). It is hosted on Google project hosting( click &lt;a href="http://code.google.com/projecthosting/"&gt;here&lt;/a&gt; if you don&amp;#8217;t know about this too).&lt;br/&gt;To start with something, I have written one new number system(NS) converter, this class will help you to convert a number in decimal(base-10) NS to any other base-n NS. So you can convert a decimal to binary / Hexadecimal / Octal /&amp;#8230;  number.&lt;br/&gt;You can checkout my BaseConverter class &lt;a href="http://code.google.com/p/internal-ganimi/source/browse/trunk/base_converter.rb"&gt;here&lt;/a&gt; and then try this&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1057463.js?file=baseconverter_example.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Savvy?&lt;br/&gt;But there is more&amp;#160;: &lt;br/&gt;&lt;br/&gt;Ruby has a very easy way(Rubyish) of doing this. Check this out&amp;#160;:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057466.js?file=rubyish_bc.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Happy coding.&lt;br/&gt;Will see you again.&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090961643</link><guid>http://blog.rubydubee.com/post/7090961643</guid><pubDate>Sat, 27 Mar 2010 17:04:00 -0400</pubDate><category>svn</category></item><item><title>Short and sweet profiling</title><description>&lt;p&gt;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?&lt;/p&gt;&lt;div&gt;But i have never thought it will be so easy. &lt;/div&gt;&lt;div&gt;Here it starts:&lt;/div&gt;&lt;div&gt;The one and only thing you need to do is require &amp;#8220;profile&amp;#8221;.&lt;/div&gt;&lt;div&gt;That&amp;#8217;s it!!!&lt;/div&gt;&lt;div&gt;run your program with -rprofile option and see which are the culprit methods that must be improved.&lt;/div&gt;&lt;div&gt;&lt;a href="http://ruby.about.com/od/advancedruby/a/profile.htm"&gt;here&lt;/a&gt; is the complete HowTo&lt;/div&gt;&lt;div&gt;Enjoy!!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/7488824320314285279-6044588738065335304?l=blog.rubydubee.com" alt=""/&gt;&lt;/div&gt;</description><link>http://blog.rubydubee.com/post/7090960987</link><guid>http://blog.rubydubee.com/post/7090960987</guid><pubDate>Sat, 09 Jan 2010 14:20:00 -0500</pubDate><category>Ruby</category></item><item><title>Shoes example like Adidas or NIKE</title><description>&lt;p&gt;As i already told Shoes is like designing web GUI,  100.times {very.easy}. But ofcourse you need to start somewhere&amp;#8230; if you haven&amp;#8217;t yet tried this before&amp;#8230; you must give it try. Simple to install and start(especially if you are on windows&amp;#160;! you know its like you can anytime climb on windows with your shoes on! ;) ).&lt;br/&gt;&lt;br/&gt;So tie your shoe laces tightly&amp;#8230; we gotta roll on &amp;#8230;&lt;br/&gt;&lt;br/&gt;1.install &amp;#8230; like do anything i don&amp;#8217;t care about this&lt;br/&gt;&lt;br/&gt;2.start writing! that&amp;#8217;s it&amp;#8230; How?&amp;#8230;Read shoes manual that comes bundled with it &amp;#8230;. its easier than ever starting point for beginners.&lt;/p&gt;
Thanks&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-4040550453188870704?l=blog.rubydubee.com" height="1" width="1"/&gt;</description><link>http://blog.rubydubee.com/post/7090960365</link><guid>http://blog.rubydubee.com/post/7090960365</guid><pubDate>Sat, 05 Sep 2009 18:54:00 -0400</pubDate><category>Shoes</category><category>Ruby</category></item><item><title>Shoes and Chappals!</title><description>&lt;p&gt;&lt;a title="NKS.PDF" target="_blank" href="http://cloud.github.com/downloads/whymirror/shoes/nks.pdf"&gt;Nobody Knows Shoes?&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Haha are you kidding?&lt;br/&gt;&lt;br/&gt;No! but you must read that!(what? dont know?) . Its the only official document available for Shoes.&lt;br/&gt;&lt;br/&gt;Shoes Intro:&lt;br/&gt;&lt;br/&gt;Shoes is a very tiny Goeey(uh oh GUI) framework for Ruby. Have you listen to it? I&amp;#8217;ve said very TINY&amp;#160;!! Because it only has 10 things to show!&amp;#8230;.. i.e you can only draw 10 things and thus only have to remember 10 things.&lt;br/&gt;&lt;br/&gt;Para &amp;#8230; Buttons &amp;#8230; Links &amp;#8230; Flows &amp;#8230; Stacks &amp;#8230; Images &amp;#8230; eh etc.. etc .. anyways i dont like to use anymore &amp;#8230;&lt;br/&gt;&lt;br/&gt;What do you use on WEB&amp;#160;? JLabel? or JSomething? or Just DIVs?&lt;br/&gt;&lt;br/&gt;Stacks, Flows in Shoes are like DIVs .Paras are Ps, Links are As, Images are IMGs, Buttons are BUTTONs, and so on&amp;#8230;&lt;br/&gt;&lt;br/&gt;So the best thing is that you can imagine the Goeey on web and then just use the appropriate brother for it to create your desktop application.  Howzzat!&lt;br/&gt;&lt;br/&gt;More Drawings and Painting later&amp;#160;! thanks for stopping by!&lt;/p&gt;
&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-2016910851260980231?l=blog.rubydubee.com" height="1" width="1"/&gt;</description><link>http://blog.rubydubee.com/post/7090959642</link><guid>http://blog.rubydubee.com/post/7090959642</guid><pubDate>Sat, 05 Sep 2009 17:02:00 -0400</pubDate><category>Shoes</category><category>_why</category><category>Ruby</category></item><item><title>Extract part of an Array</title><description>&lt;p&gt;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.&lt;br/&gt;&lt;br/&gt;The more faster way of doing the same thing is array.at(index): This does exactly the same thing but in less time.&lt;br/&gt;&lt;br/&gt;Third method is array.slice(index)&amp;#160;: again similar, a ruby way of doing things in various manner.&lt;br/&gt;&lt;br/&gt;Next is somewhat new to some programmer i.e array[range]:  getting values at the given range. for example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057370.js?file=array_range.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Another form is array[start_index,length].&lt;br/&gt;&lt;br/&gt;We also have different ways to call array.slice(): array.slice(range) , array.slice(start_index,length).&lt;br/&gt;&lt;br/&gt;When we use array.slice!() method the elements that are extracted are removed from the original array.&lt;br/&gt;&lt;br/&gt;Again there are some methods:&lt;/p&gt;
&lt;ul&gt;&lt;br/&gt;&lt;li&gt;Values_at(list of indexes): gives the value at all of those indexes&lt;/li&gt;
&lt;br/&gt;&lt;li&gt;find_all(): returns element that satisfy the condition given in the block&lt;/li&gt;
&lt;br/&gt;&lt;li&gt;reject()&amp;#160;: returns the element that do not satisfy the given condition in the block&lt;/li&gt;
&lt;br/&gt;&lt;li&gt;grep /some regex/&amp;#160;: returns elements that satisfy the given Regular expression&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Set Operations on Array:&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;Set operations can be easiliy performed on arrays by using overloaded arithmatic and logical operators.&lt;/p&gt;
&lt;script src="https://gist.github.com/1057374.js?file=set_operations.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;And we can always convert an array into a set using Array#to_set method.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-6344318459857761792?l=blog.rubydubee.com" height="1" width="1"/&gt;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090958942</link><guid>http://blog.rubydubee.com/post/7090958942</guid><pubDate>Sun, 23 Aug 2009 14:06:00 -0400</pubDate><category>Ruby</category></item><item><title>Sorting</title><description>&lt;p&gt;&lt;br/&gt;Array#sort is a very basic method for sorting arrays naturally. for example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057405.js?file=sort1.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;but you also have a cool method where you can sort with your preferences, for example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057406.js?file=sort2.rb"&gt;&lt;/script&gt;&lt;p&gt;There is one more interesting way&amp;#8230; using &amp;lt;=&amp;gt; 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:&lt;/p&gt;


&lt;script src="https://gist.github.com/1057410.js?file=sort3.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Want to sort your Objects see this:&lt;/p&gt;

&lt;script src="https://gist.github.com/1057416.js?file=sort4.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;This example tells everything you need to know about how to sort objects.&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090958287</link><guid>http://blog.rubydubee.com/post/7090958287</guid><pubDate>Sun, 23 Aug 2009 09:38:00 -0400</pubDate><category>Ruby</category></item><item><title>Some more Array features</title><description>&lt;p&gt;&lt;strong&gt;Array#uniq&lt;/strong&gt;&lt;/p&gt;
&lt;script src="https://gist.github.com/1057426.js?file=array_uniq.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;To remove duplicates you can also use Set instead of an array. Or you can convert an array into set, very easy, for example:&lt;/p&gt;
&lt;blockquote&gt;puts a.to_set             #[1,2,4,5]&lt;/blockquote&gt;
&lt;p&gt;&lt;br/&gt;&lt;strong&gt;Array#delete(x)&lt;/strong&gt;&lt;br/&gt;&lt;br/&gt;You can delete all the occurence of a specific element in an array by using delete, for example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057428.js?file=array_delete.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Or you can use &lt;strong&gt;Array#compact &lt;/strong&gt;to remove all the &lt;em&gt;nil &lt;/em&gt;elements in an array.&lt;br/&gt;&lt;br/&gt;More to come! Thanks for stopping by!&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090957432</link><guid>http://blog.rubydubee.com/post/7090957432</guid><pubDate>Sun, 23 Aug 2009 09:15:00 -0400</pubDate><category>Ruby</category></item><item><title>Assignment Operator Magic</title><description>&lt;p&gt;A simple but very effective magic of Ruby:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057439.js?file=assign1.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Haha!&lt;br/&gt;&lt;br/&gt;This is the power of ruby assignment operator.&lt;br/&gt;&lt;br/&gt;here is another example&amp;#160;:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057443.js?file=assign2.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Here comes another very effective thing:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057446.js?file=assign3.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;Again the right hand side of the assignment operator can almost arbitrarily complicated, for example:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057451.js?file=assign4.rb"&gt;&lt;/script&gt;</description><link>http://blog.rubydubee.com/post/7090956728</link><guid>http://blog.rubydubee.com/post/7090956728</guid><pubDate>Sun, 23 Aug 2009 07:39:00 -0400</pubDate><category>Ruby</category></item><item><title>Iterators for Ruby Arrays</title><description>&lt;p&gt;&lt;strong&gt;Arrays:&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;br/&gt;Arrays are very interesting and very easy in ruby.&lt;br/&gt;How to iterate over arrays?&lt;br/&gt;For? while? do-while?&lt;br/&gt;&lt;br/&gt;Although these methods are there for common developers, stylish ones use different things in Ruby:&lt;br/&gt;&lt;br/&gt;And the methods are each and collect.&lt;br/&gt;ex:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057307.js?file=array_example1.rb"&gt;&lt;/script&gt;&lt;p&gt;That&amp;#8217;s it!&lt;br/&gt;or&lt;/p&gt;
&lt;script src="https://gist.github.com/1057315.js?file=array_example2.rb"&gt;&lt;/script&gt;&lt;p&gt;Got the difference?&lt;br/&gt;&lt;br/&gt;exactly the collect method creates a different array and each just iterate!&lt;br/&gt;there is another method collect! if you want to change your source array&lt;br/&gt;eg:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057330.js?file=array_example3.rb"&gt;&lt;/script&gt;&lt;p&gt;will change the array a itself(this can be useful too!).&lt;br/&gt;Want more?&lt;br/&gt;there is another method each_with_index which also gives array indexes!&lt;br/&gt;ex:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057339.js?file=array_indexes.rb"&gt;&lt;/script&gt;&lt;p&gt;There are again&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;Array#map&lt;/li&gt;
&lt;br/&gt;&lt;li&gt;Range#step&lt;/li&gt;
&lt;br/&gt;&lt;li&gt;Integer#upto&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;to do different things for different problems&lt;br/&gt;Here are the examples:&lt;/p&gt;
&lt;script src="https://gist.github.com/1057352.js?file=array_example4.rb"&gt;&lt;/script&gt;&lt;p&gt;&lt;br/&gt;That was pretty big on Iterator&amp;#8230;. and java says it has a powerful iterator! uff!&lt;/p&gt;
&lt;p&gt;&lt;img src="https://blogger.googleusercontent.com/tracker/7488824320314285279-3376258053463368619?l=blog.rubydubee.com" height="1" width="1"/&gt;&lt;/p&gt;</description><link>http://blog.rubydubee.com/post/7090955975</link><guid>http://blog.rubydubee.com/post/7090955975</guid><pubDate>Sun, 23 Aug 2009 06:55:00 -0400</pubDate><category>Block</category><category>Iterators</category><category>Ruby</category></item></channel></rss>

