Vijay Krishna's Notes http://vijaykrishna.posterous.com Most of my notes as a student of computer software and everything around it. posterous.com Sat, 26 Mar 2011 07:22:47 -0700 Code Formatter for Blogger http://vijaykrishna.posterous.com/code-formatter-for-blogger http://vijaykrishna.posterous.com/code-formatter-for-blogger This was something that my friend was asking me the other day, after he got a pang of envy looking at my code formatting in my wordpress blog (this blog). Ofcourse, there is no inbuilt method for formatting code in blogger. There are roundabout manners by which you can do it, but its too much trouble to ask for. So, instead of explaining all the weird methods in the world, i decided to Google for an online solution and hit upon this: http://alexgorbatchev.com/SyntaxHighlighter/ This uses different syntaxfiles (JS files) to support the syntax of different languages. Here is a list of all the languages that it supports: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ Also, the whole thing won't work for Blogger by default. You will have to activate the Blogger Mode by setting the configuration. The clear instructions for which are given here: http://alexgorbatchev.com/SyntaxHighlighter/manual/brushes/ Now, there are some sites which do some amazing formatting for a few given languages. Here is one for c# (and other related languages): http://www.manoli.net/csharpformat/ . But the issue comes about when you have to take care of all or more popular languages like Ruby or Scala. So, with that in mind i feel that Syntaxhighlighter is not half as bad a solution. Try it. I found it ok. However, if you do have any better suggestions to make, you are most welcome.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Wed, 23 Mar 2011 06:07:38 -0700 My Ruby Notes http://vijaykrishna.posterous.com/my-ruby-notes http://vijaykrishna.posterous.com/my-ruby-notes [This post will be my Ruby Notes which i will keep updating. It is more like a personal Ruby manual.] Numbers: [sourcecode language="ruby"] population = 12_000_000_000 # means the same thing as population = 12000000000 [/sourcecode] Variables: begins with a small letter => normal variable begins with a capital letter => Constant begins with a $ => Global Variable begins with a : (colon) e.g. :a => Symbol begins with an @ => Instance Variable begins with an @@ => Class Variable in between two |'s e.g. |x| => Block arguments

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Fri, 18 Mar 2011 18:26:33 -0700 Understanding the "difference" in Ruby http://vijaykrishna.posterous.com/understanding-the-difference-in-ruby http://vijaykrishna.posterous.com/understanding-the-difference-in-ruby Finally got some time to write a little more about Ruby today. Well, in this wonderful time of learning this language, there has been one thing that i have been finding difficult to digest and embed as a part of my thinking. And while it matches the way i perceive programming languages to be, it is still requiring  a little "getting used to". What i am talking about is, treating everything as a Method or a message that takes input and returns a result. Treating Operators, if-elsif-else statements and the likes, as methods is one thing. Coding them in that manner is completely different, and i am talking specifically about the kind of syntax that can come into play here. Eg: [sourcecode language="ruby"] at_hotel = true email = if at_hotel address = "why" address << "@hotelambrose" address << ".com" end [/sourcecode] the if statement here actually returns a value. And it returns the value of address. This is a little different from what you would normally see. [sourcecode language="ruby"] code_words['catapult'] #is actually the shorthand for code_words.[]( 'catapult' ) [/sourcecode] [sourcecode language="ruby"] approaching_guy == false #is the short hand for approaching_guy.==( true ) [/sourcecode] These are some different and unconventional coding syntaxes i have never come across, before  Ruby. So, it is taking some time, but i am getting there. :)

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Thu, 10 Mar 2011 16:45:13 -0800 Hello Ruby http://vijaykrishna.posterous.com/hello-ruby http://vijaykrishna.posterous.com/hello-ruby This is probably my 1st line  of Ruby Code that i am blogging here. Learning Rubys these days. So here it is - [sourcecode language="ruby"] 10.times{ print "Hello Ruby."} [/sourcecode]   I must thank Partiosh Chhibber, my friend for his help with this post.

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu
Tue, 01 Mar 2011 18:02:51 -0800 Comprehensive Guide to Ruby on Rails http://vijaykrishna.posterous.com/comprehensive-guide-to-ruby-on-rails http://vijaykrishna.posterous.com/comprehensive-guide-to-ruby-on-rails This is one awesome guide to Ruby on Rails i stumbled upon today. The whole thing is more or less a comic strip and you will end up laughing while learning for a change. So here is the link: http://mislav.uniqpath.com/poignant-guide/book/ Have fun coding!!

Permalink | Leave a comment  »

]]>
http://files.posterous.com/user_profile_pics/1369599/pic.jpeg http://posterous.com/users/hcGXxsTkwP6SS Vijay Krishna Palepu vpalepu Vijay Krishna Palepu