Saturday, March 21, 2009
Tuesday, December 16, 2008
Pitfalls to avoid for Ruby-on-Rails start-ups
Friday, October 31, 2008
Ruby on rails Interview questions
Saturday, October 25, 2008
Include V/s Require in Ruby
Michael Morin (The ruby guide of About .com) has been generous to answer me thru email. Here is the answer:
——————————————————-
The include and require methods do very different things. The require method does what include does in most other languages, run another file. It also tracks what you’re required in the past and won’t require the same file twice. To run another file without this added functionality, you can use the load method.
——————————————————-
Thanks Micheal, I think thats an excellent answer.
Friday, July 25, 2008
Top ten resources to build RoR based enterprise solution
1. Agile web development with rails - book by Dave Thomas. The ultimate source for everything you need in the first year with RoR. It’s got everything from the basic rhymes to the most complex enterprise application formulae. You won’t think it was costly after reading it. Together with The Ruby CookBook. it equips you with complete armor.
2. Try Ruby online - very basic ruby hands-on guide to showcase the power of ruby.
3. Simplest ruby ebook : The first steps to learning. Just read it and you should find yourself comfortable with ruby code in less than a day.
4. Another refreshing Rails guide to deal with initial learning curve… all this is obviously good only if you are not reading reference number 1.
5. Screencasts and self learning videos should sharpen your learning curves and teach you those fine tit-bits and caveats.
6. Ruby on Rails official documentation. The best technical help you will get while learning and working all by yourself. You will need this on every step.
7. The ruby on rails link library. All the best online resources for ruby on rails are listed and categorized into better heads like introduction, promotion, performance, security.
8. Plugins Directory:- A nice directory of all the available plug-ins that you will want to use for your application. It lists the plugins with their user ratings.
9. Rails Performance Issues and improvement :- Stefan Kaes is great when he talks about ruby and rails performance issues. There are more website that will deal with different issues in different ways, so you can help yourself, or refer rails library. And don’t forget this nice compilation somewhere down on this page.
10.Security issues in ruby on rails based apps are best dealt here. So if you have reached the stage where you need to think about saving your web product from cross-site scripting attacks, just go through this website and you find answers to all your concerns. If not send me a note.
This top-ten is not listed according to priority, they are sorted according how you will need them one by one during your course of constructing a RoR based application.
Saturday, July 5, 2008
Whats the heck Ruby on rails anyway?
I have had nightmares of mobs hitting me with paper rockets and asking questions like what is open source, what are communities after all. So Ruby (not language) came to my dreams and inspired me to write this post, to enlighten the souls living in dark jungle of licenced software. No hard feelings.
Open Source
Here is how I would describe open source. Think about a library, (Stop thinking about DLLs and code libraries), think about a huge building with a massive collection of Books, newpapers, pamphlets, manuscripts, photos, photo-albums etcetera. Every one can freely visit that library. Read anything, copy anything, write his own manuscripts and publish his own books. There are big encyclopedias which can be edited by anyone and every visitor is free to access it and add to it. There are loads of Software available for you to use. You can use them directly or tweak their source code to suit your needs and then use, distribute, sell them. You can put in your own manuscripts, profile, photo-albums, software and showcase it so that someone on the other side of the world can benefiit from what you created the other night.
Communities
People realized the potential of such a great resource and found that working in teams would help improve this resource. So they formed Groups called Communities. It smells communist but is capitalist. So now the little guys can stand the monopolist bullies. People with similiar interest and aim joined those communities and contributed to their common aim. Since everything is (most of the time) public, it is scrutinized by many and tends to get better and better with the help of ever increasing community. There are teams which built products which can be used by anybody. Many versions of Linux (for example) were developed by such communities.
So this is about open source and communities. It has its own rules and standards. Find out more. So far so good, but i know you will have concerns.
Show me the money!!!
The biggest concern about free software is the word free. Free stands for freedom, freedom of creation, sharing and use. But, that doesnt mean there is no money involved. Hmmm the easiest way you would be able to accept the phenomenon is to think (or find out) about Google. All the services it provides you are best in class and free of cost. Worth mentioning is that it may also help you earn (Adsense) without any investment. Google is still a multi-billion dollar company. Interesting! hope that triggers you to do some sole searching, just to find out where you stand.
Agreed! So what is this Ruby on rails stuff?
Ruby ..the old stuff (Old is gold)
Per Wiki “Ruby is a dynamic, reflective, general purpose object-oriented programming language that combines syntax inspired by Perl with Smalltalk-like features. Ruby originated in Japan during the mid-1990s and was initially developed and designed by Yukihiro “Matz” Matsumoto. Ruby supports multiple programming paradigms, including functional, object oriented, imperative and reflection. It also has a dynamic type system and automatic memory management; it is therefore similar in varying respects to Python, Perl, Lisp, Dylan, and CLU.” I dont think I can add more jargons to this description. IMHO its a wonderful to learn, fantastic to use scripting language.
Here are some of my experience which state why I talk about ruby so much.
High level readability: After a sharp learning curve you can start reading the code just like newspaper headlines.
Developer’s bliss: It is perfect for newbie (inexperienced) and lethargic coders like me to take up a language in which you can do in one line what I used to do in at least 10 lines in VC++. (Yes! I used to work in VC++, MFC and was trained in .Net).
Fast developement: Less number of lines of code means faster development and easier maintenance.
Powerful: So there is nothing that can be done in Java and .Net and cannot be done in RoR.
Rails..the new thing (simple and sexy)
Ruby on Rails was extracted by David Heinemeier Hansson from his work on Basecamp, a project management tool by the web design (now web application) company 37signals. It was first released to the public in July 2004. Simply put, Rails is a full-stack framework for developing database-backed web applications according to the Model-View-Control pattern. It is conceptualized on the principles of ‘DRY’ and ‘CoC’. DRY says Dont repeat yourself, and puts a clean check on redundancy. ‘CoC’ (Convention over configuration) says you can follow a few simple conventions and avert a whole lot of configurations. This means lesser and cleaner code and more smiles.
I hope after reading this you wont, at least, drop your jaws next time you hear some developer say “I m doin Ruby these days”. Of course, to ruby or not-to-ruby is your decision afterall.
Tuesday, June 17, 2008
Walking with Ruby… on Rails!!!
The title induces fantacies and I know what you are imagining. Believe me, developing in Ruby is as fantastic as what you were thinking just now. J Jokes apart, if you are in to web development and RoR has not crossed your radar yet, I can aver that you are significantly out-of-date. Fortunately though, if you keep reading this, you will certainly get a glimpse of the revolution in web development that open source communities have brought.
What Ruby and Rails can do for an organization? What can any language-framework pair do for an organization? If there are answers popping up in your mind, be kind enough to consider the same for Ruby on Rails. RoR can do all that in a much easier, faster and cost effective way. On the other hand if you don’t know the answers yet, here is a glimpse of what RoR can do:
· Build customer centric small/medium websites
· Deploy a web product with advanced (web 2.0-ish) features in a very limited time.
· Create automated testing frameworks
· Legacy Application extension, integration and migration
Why only ruby on rails?
Well if you are on the initial stages of paranoia you may like to consider other languages and frameworks, develop a few projects and find out the difference. If you are confident enough to rely on what the open source community has to say, hear this:
· Productivity gains: exponential savings because of smaller teams, more productivity, improved time to market.
· Easy development, easy maintenance : Lesser lines of code (10 times less than Java) , makes development faster and maintenance easier
· Agility: Rails is Agile, no matter how confused you are on your business concept, rails will help you visualize. It adapts to your changing requirements quickly and easily.
· Free: Its free and open source, can’t talk more on cost effectiveness.
· Powerful: Its can be simply put as what you SEEK is what you get.
For a more technical soul here is how ruby on rails score over others
· Support for Representational State Transfer (REST) architecture
· SOA-like integration with enterprise systems
· Convention over configuration framework simplifies data management
· Don’t Repeat Yourself or DRY model based on Ruby’s inherent ability to provide Domain specific languages
· MVC (model view controller) design pattern
· Built in testing at every level
· Capistrano / ActiveRecord migration
· Ajax support in any framework; runs on any Unix open source platform
What RoR has done already? Testimonials: Some live projects singing the success story for ruby on rails.
Ø Amazon.com: Yes! The same Amazon.com
Ø Basecamp: project management tool by 37 signals
Ø Bixee: An upcoming Indian job portal
Ø BharathRentals: India ’s car rental service
Ø Dimewise: personal finance management
Ø HBO Asia : HBO’s Asian broadcast online
Ø Scribd : online document sharing and publishing
Ø Shopify: e-commerce
Ø simplifyMD: digital chart room for small hospitals
Ø Twitter: Online community, social networking and microblogging
Ø Google: With Gears on rails google has brought online documents mangement offline
Wednesday, May 7, 2008
Performance issues in Ruby on Rails based Apps
Always bear in mind that Ruby is slow (Pankaj). Still fortunately enough, there is a lot you can do about it.
“”Server related:”" Webrick v/s Mongrel v/s NGinx
”’DB related:”’ See that all the table columns used in the rails queries are indexed. Primary and Foriegn keys are automatically indexed so dont worry about them as much. To find out what columns are indexed use ’show index from ‘. Just as an experience I can say that you ‘d find most of the queries on ‘name’ and ‘type’ columns in your table. It would be good to take a few cautions before going on an indexing drive on an existing database.
“”OS Related: “” 64 Bit OS is considerably faster than 32 bit, of course if hardware is not a limitation.
Friday, March 21, 2008
Aptana (IDE) CheatSheet
As a developer with some experience on VC++ and MFC, Visual Studio had already spoilt me a great deal. When i started I just could not believe that an entire application be developed on text editors like notepad or Scite. Here is more about other editors: http://www.devx.com/RubySpecialReport/Article/34454/ because I chose Aptana-radrails and most of this blog will talk about that.
If you are very used to Visual Studio and likes here is one editor that comes close (somewhat) when you wanna develop a Rails or pure Ruby Application. Good thing is its quite integrated (many features in one) and its VS like.
Here is a quick set of hotkeys that i found really useful:
- ctrl+q = open last closed tab
- ctrl+w = close current tab
- ctrl+e = opens the list of all open tabs so you can run thru them
- ctrl+l = Goto line number
- ctrl+ m = Maximize/Minimize
- ctrl+n=New (file/project etc.)
- ctrl+h = Search in Workspace
- ctrl+f = Find/replace
So its handy!
And Also like VS when you wanna find the definition of one function or variable its easy. Just ctrl+click on the variable or function name and flash!!!! there you are…