Archive for January, 2008

RoR and Text Editors Part-1

January 29th, 2008 | Category: Basics

Though there is no preferred editor in the coding and editing of programs which is usually left to the programmer to decide. There are a couple of purpose built editors that can be used with RoR.

Emacs, has a quite simple configuration that accompanies its use and allows simultaneously displays changes as they are made hence it�s classification as a Display Editor. It also has a nifty help function the user can evoke by the simple press of the Ctrl-H keys. The Point feature allows the definition of the position of a character as they are entered onto the keyboard. The Echo Area Feature is a segment on the lower bottom of the screen editor that shows the amount of characters on the screen for various purposes should they be needed. The Mode Line is the last line on the screen which is signified by the starting and ending with dashes on the screen. Like all editors, Emacs has a menu bar where all the options available to the user can be found making use simpler instead of having to memorize special key combinations.

No comments

Getting Started and how to open Programs : Part 2

January 25th, 2008 | Category: Basics, Sample Code

Save the text file with the following filename “first1.rb” and we now go into the syntax checking function and the facility provided to show the syntax check verbosely. The following code shows how code is checked for syntax correctness and returns the result of the said checking by typing the following code :

$ ruby :cw first1.rb

The “-c” flag initiates Ruby’s syntax checker while the “w” flag shows the result of the syntax checker. If there is no issue with the code being checked you get a “Syntax OK” result which means you can execute the code for there are no syntax issues. Type $ruby first1.rb on the command line and you get the result ” The concatenated line is : This is my first Ruby Program ”

No comments

Getting Started and how to open Programs : Part 1

January 21st, 2008 | Category: Basics, Sample Code

RubyonRails is similar to most programming languages where in one can use the command line in windows or a terminal in Unix based systems. All programs should be written and saves in plain text format for the compiler and interpreter to process it easily. The first program would give you a feel for the overall syntax of how the program is created and what the compiler does. Type the following code into the text file to see how it is done:

#this is a sample program
a = “This is”
b = “my first Ruby Program”
print “The concatenated line is :”
print a << b

The next post would show the continuation of the exercise.

No comments

Database manipulation

January 17th, 2008 | Category: Advanced, Basics, Medium, Set-Up

The database has been initialized, so now we get down to business of defining the fields in that database and include a field that we would call a foreign key which allows the establishment of the one to many relationship between the tables. This part of the process requires quite a bit of background of database creation, manipulation and handling. It also requires knowledge regarding the workings of data types. So assuming you do not have much knowledge in such areas do some more reading to give you a better understanding of what how and why they are there. The ROR developers might say that it is very easy to do and use ROR but without the background on logic formulation, data types and manipulation as well as database handling the rest of the posts which would tackle ever hardening topics and operations would be very difficult to make sense of.

Don’t get me wrong, we just want to make life easier for you and not have you not understanding anything at all.

No comments

Next step : Creating the database for the filename application

January 13th, 2008 | Category: Basics, Sample Code, Set-Up

The next phase or step would be to create a database for the application to use. Make sure the MySql engine is running and in the command window type “mysql -u root -p” and press enter and another enter for the password when prompted for there has not been any defined password yet. You are now logged into the engine as the root user and proceed to create the database by entering the following command “create database filename_development”. Also type in “grant all on filename_development.* to ‘ODBC’@'localhost’ this tells windows to grant access to a user named ODBC so you avoid an error when you try to access the said database from the command prompt. We next tackle the creation of tables that would allow the database to store the information we send it.

No comments

RoR Application Directories in-depth

January 09th, 2008 | Category: Basics, Set-Up

There are quite a number of directories locate in the apps folder we have just created so to de-mystify them here are some explanations which hopefully would help you out. The directory “app/controllers” is where Rails searches for the controller classes which controls the web request from the user. The next one is the, “app/views” folder which houses the templates to which the data from the app is converted to HTML and then returned to the user’s browser. The next folder houses the “apps/models” subdirectory which contains the data classes that wraps the data stored within the application’s database (this is the messiest part of the framework in other frameworks). Then last of the vital sub-directories is the “app/helpers” which hold the helper classes of data that assists the view, model and controller classes keeping them small, organized and focused on the task it is supposed to do in the first place.

No comments

Next Step : Creating Empty Applications

January 05th, 2008 | Category: Basics, Set-Up

Now that all has been set-up and is working, you should be able to create empty apps which is merely defining the application using rails which automatically creates all the necessary directories that are needed. Open a command prompt window and go to the directory where it was installed and proceed into the rails_apps directory. Type in ‘rails filename’ and rails creates all the necessary directories you would be needing for the development process. Don’t get freaked out when you see the multitude of directories for they will be filled out by “RAILS” and not by you manually. The next post will discuss some of the nuances of those dizzying directories to take some of the fog over them out.

No comments

Bad Behavior has blocked 14 access attempts in the last 7 days.