Wednesday, April 2, 2008

Loosing RoR

I'm totally loosing grip on RoR. I hope I'd be able to grab back to her.

Wednesday, January 30, 2008

Encryption with Digest#SHA

There are several levels of encryption you can use in Digest#SHA.

  1. Digest::SHA1.hexdigest() - produces a 40 characters of hexadecimal digits.
  2. Digest::SHA256.hexdigest() - produces a 64 characters of hexadecimal digits
  3. Digest::SHA384.hexdigest() - produces a 96 characters of hexadecimal digits
  4. Digest::SHA512.hexdigest() - produces a 128 characters of hexadecimal digits

You can check it by trying the following.

Note: To execute the commands, press Enter after typing.

  1. Open your console.
  2. Change the directory to any of your existing rails application.
  3. Type ruby script/console.
  4. Type a = Digest::SHA1.hexdigest(“test”).
  5. Type a.length. It will display the length of the strings in the variable a.
  6. Repeat step 4 but replacing SHA1 with SHA256, SHA384, or SHA 512.

Depending on your required level of security you can choose among the different SHA levels. If you require the highest level of encryption then you can use SHA512.

Most of its use include encrypting passwords before saving it to the database. You can also use it to encrypt files.

Peace!

Monday, January 28, 2008

I found Rails

Rails. The clever work of a Danish web developer named David Heinemeier Hansson. It was extracted from 37Signals' Basecamp application. An now it is an open source framework.

Rails is a web framework which is powered by Ruby a scripting language. It follows the Model-View-Controller (MVC) architecture. Which means there is a separation between data(database/Model), logic(business rules/Controller), and presentation(user interface/View).

It follows the following principles.

  1. Convention over configuration. - You can get up and running without going through the process of repeating the same configurations in your code. All you have to do is to set it once and your done. Configure your database connections and you can use that connection wherever in your code you want.
  2. Don't Repeat Yourself (DRY) – No more copying and pasting the same code. Just define the methods(functions, actions, whatever you may call it) once and use it anywhere in your code. If you want to make changes to your methods then you can just easily change it in one place.
  3. Agile development – Rails follow the Agile development process. It's sort of like more on user demand based approach. List down the initial requirements and layout the basic skeleton of the application. Acquire further requirements suggested by the user and implement those requirements. And the cycle is repeated until an application is acceptable.

The applications of 37Signals are based on Rails like Basecamp, Backpack, and Writeboard. Currently, Rails is now on version 2.0.2. I think Rails 2.0 has more features although I haven't used it yet since I'm still using using version 1.2.3 included in InstantRails.

I hope to get better in Rails and I hope to pound more code in the future.

Peace!

Note: I'm not an expert so some of the terms and ideas that I've wrote here might be incorrect. Feel free to give comments. Thanks!

Saturday, January 19, 2008

I See Ruby

Ruby is a dynamic scripting language that embraces the full object-oriented paradigm. It's a pure object-oriented language wherein everything is considered an object. When we say “everything” even nil(null) is an object.

Ruby is created by a clever japanese guy named Yukihiro Matsumoto (hands down to this guy) commonly known as Matz in 1993. One of the goals why Matz created ruby is to make programmers enjoy programming and be more productive. Finally I've found a language that is literally makes a programmer happy. I hope I get to meet Mr. Matz in the future.

The syntax of Ruby is clean and simple(no more messy braces or semicolons). Control statements are much tighter. And learning object-oriented concepts is easier for me than with other languages like C/C++ or Java.

Ruby is the language that powers Rails. If you have tried visiting websites that is based on Rails then that site is definitely has Ruby behind it. If you learn Rails then you are also learning Ruby. But the best way to learn and understand how Rails works is to learn and understand Ruby first.

Aside from powering Rails, Ruby can also be used in many different programming disciplines like creating GUI applications, handling databases, console apps or anything you can think of. I've been considering using Ruby as a replacement for creating desktop apps(since I use VB6 and got tired of it).

There are a lot of resources on the internet that you can find to begin your quest in learning ruby. You can begin by visiting www.ruby-lang.org/en/ where you can find basic information about Ruby among others.

Ruby shines! Thanks Matz!

Saturday, January 5, 2008

First Encounter With Ruby On Rails

Wow! This my first on trying my luck to learn Ruby on Rails. The first time I heard it (RoR) I got curious. After a few weeks of learning I got easily in love with it. What I like about most about RoR is that its much easier to understand the syntax of the language which is Ruby. I guess what interested me in knowing more of it is that its simple and enables you to concentrate more on its logic rather than trying to understand all of the technicalities after several hours of hair pulling.

Even though I'm haven't yet learned of the things that I need to learn about it, I can see myself working and living with RoR in the future.

More to come in the future as I work my way on trying to me good enough for sharing what I've learned from RoR.

More power to Ruby on Rails!