Thursday, July 15, 2010

error in documentation of php-cake blog tutorial

hii !!
recently while working over php-cake I found that "delete" action was not working.
After some debugging & rolling over documentation; I found that "id" was not set in a proper way.
here goes the solution:
Replace

echo $html->link('Delete', array('action' => 'delete', 'id' => $post['Post']['id']), null, 'Are you sure?' )?>

to

link('Delete', array('action' => 'delete', $post['Post']['id']), null, 'Are you sure?' )?>

Sorry to say but php-cake has a real poor community; even basic tutorials are not updated on site. It lack far behind in community support as compared to ROR.

kind regards!!



Saturday, June 19, 2010

Major Project

After the success of Techfest's web application , Mr. Mukesh Mathur(Assos. Registrar) and Mr. Ankit Bhandari assigned our team to the task of creating web application for college( www.jietjodhpur.com ). That's definitely a great opportunity for our team.

We first decided to create it in RubyOnRails ; then due to unavailability of resources we move towards PHP-Cake.

PHP-Cake is web based frame-work inspired from ROR. But it lacks documentation & tutorials to learn from. Lets see if we are able to create it successfully .(& we will definitely hit that!!).

In my journey to learn php-cake I will write tutorials, so that newbies can learn it with ease and this would definitely going to be fun for me....

Main Module includes:
1) CMS system for general information and publicity.
2)Community web app for Alumni.
3)Blogs for College students

others include:
1) attendence module.
2) profile for students.

Till the time of writing we have completed our first module and working for Alumni module. Mean while we will also try to learn JOOMLA and shift our content management to it.

Lets see how it goes , as time-line is a real hurdle. Will keep posting as we progress.....

Sunday, April 4, 2010

Ruby on Rails – get started


RubyOnRails

Ruby on Rails – get started

Installation:

1) Go to http://rubyonrails.org/download that is official download page for ruby on rails.

2) First download ruby. For windows it is one click installer package just download it and double click it and follow installation wizard.

3) Download ruby gems from same page, extract it and then run ruby setup.rb, just double click it.

4) To install rails type “gem install rails” in terminal, it will automatically install rails for you.

Get it work:

1) Create workspace(simply a folder) where you want to keep all your rails application.

2) Open terminal, move to your workspace ( m assuming it to c:\workspace ) by command “cd\workspace”

3) Type “rails ” and press enter. It will create a whole bunch of files for you as shown.

4) To test everything works fine, move to your rails application folder from command line.( m assuming it

“my_first_rails”) by typing “cd\my_first_rails”.

5) Then from command line only type “cd\script”.

6) Your path should be “cd:\my_first_rails\script>”.

7) Then type “ruby server” and press enter.

8) This will start your server webrick.

9) Open firefox and type http://localhost:3000/ this should open welcome screen as shown.

10)if you reach here everything is just perfect and you complete with installation.

IDE preffered:

There are several IDE available, I haven’t experimented all. I just downloaded RadRails as it is based on eclipse and m already familiar with eclipse and it is open-source as well. You can choose any. Will update about different options and their comparision asap.

Rails Inroduction:

First of all ruby is an language that can be used to create any sort of application, including desktop based application, one can create a word-processor in it as well.

RubyOnRails is a web based framework that is written in ruby, and it is used for developing web application.

MVC Architecture:

(the above diagram is taken from some bloack & is not my original)

RubyOnRails is a web based fram

ework that is totally object-oriented and strictly follows MVC Architecture.

· View:

It is the part that is visible to end-user, it can be simple Html page or HTML page containing script (rhtml in case of rails).In case of JAVA it is .jsp page.

· Model:

It is the part that contains information about variables used, it is generally connected to database and hold values from database, that can be used to interact with controller.In case of JAVA it is JavaBeans.

· Controller:

It is action part that does logical work and navigation. It is responsible for logical navigation of your website. In case of JAVA it is servlet.

· Eg:

An Login form is View part of MVC, when you click on submit it interact with Controller to decide what to do from it, Controller in itself interacts with Model to fetch corresponding data for authentication. In controller check for authentication is done and on the basis of result controller decides where to go, as an example on success one may go to welcome page and on failure it is navigated to failure page describing “invalid username or password.”

DRY and Sensible Defaults:

DRY means Don’t Repeat Yourself Principal. Rails just follows this principal and saves our time from writing same code again and again.

It follows great no. of defaults, it assumes many things, if we follow along these defaults, they really make web-development easy.

Enough with theory !! from where to get start??:

Path which I follow at the time of learning:

· http://www.troubleshooters.co

m/codecorn/ruby/rails/rapidlearning_rails.htm

· http://api.rubyonrails.org/

· If you like you can go for screencast, its an 15 min video tutorial explaining how to create blog application in rails ( it may seems hocus-pocs in starting but it gives an good idea of how rails work ) http://rubyonrails.org/screencasts

· Same tutorial is written here in

text http://guides.rubyonrails.org/getting_started.html

Which you may like to follow along.

Note & troubleshooting:

At the time of writing mysql version RECOMMENDED by rails are 4.1 & 5.0. You can check this information in your , this information is in commented first line


· Default database is sqlite if you want to change default to mysql then, while creating your application write

C:\> rails –d mysql

· for data-connectivity you need to configure database name, username and password in your database.yml file.

· There are three kinds of database according to rails by default, development, test & production. We will work on development.

· Enter in you working application folder and type command

“rake db:migrate”

If u get nothing than everything works perfectly fine and you are connected with your database, you can check “schema.rb” file in “db” folder, it should contain scheama of your database in ruby.

Tutorial- connecting to database

1) check config:

    • create a controller named “say” by typing

“ruby generate controller say”

While using this command you should be in the script folder of your application


o in your folder check in “app \controller” their should be an file “say_controller.rb” created. Every controller file will have “_controller” by convention.

o Open “say_controller.rb” and type as shown

o Open folder “app\views\say “ and create a new file “hello.rhtml”, write any thing inside it and save it.

o Open terminal and navigate through script folder of your application and type

“ruby server”

This will start your server.

o Open firefox and in url-bar type localhost:3000/say/hello

o If You get error

§ it may be some.dll file missing.

§ Or sorry for inconvenience.

§ Or if you look at command line it will ask you to install gem mysql -> just do as it say and you will get rid of this error

§ For other error

· Download libmysql.dll from http://www.google.com/url?sa=D&q=http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/&usg=AFQjCNFv5pYpFNmUe33XXv90ZX-CsrT-Cg and paste it in C:\Program Files\MySQL\MySQL Server 5.0\bin

As well in c:\ruby\bin

· Hope this will make it work

If you get what you written in hello.rhtml then database works perfectly fine.

Java vs RubyOnRails

Major difference between ruby on rails and J2EE is ease of programming. One can develop application much faster in ROR as compared to J2EE, with my own experience working with J2EE frame works (like jsf, struts ) are much more complex then working on ROR.

Though after some search on internet I found that ROR has some performance issue but till date of writing I suppose it hardly matters.

J2EE is considered much reliable as it is in the race from long time, other than that I suppose ROR has grt offerings.

Though I have looked at various discussions I suppose this comparision is fair enough https://www.ibm.com/developerworks/web/library/wa-rubyonrails/

Sunday, January 24, 2010

Open Source Alternatives For Windows

Open Source products are not just property of linux . There are thousand of windows products too . I m just listing here few popular alternatives of common applications .
  1. cdburnerxp:
    An alternative of nero , light weight application available for xp as well as vista .