Firebird News

Wednesday, October 17, 2012

Rails On Firebird - status and follow the guide

Rails On Firebird - you need to check that Firebird active record adapter and ruby driver are installed
gem install rails

rails /home/mariuz/mynewapp -D firebird
But it generated sqlite config so i had to delete all and

I have configured this way my database : first i have created in flamerobin an empty firebird db /var/lib/firebird/2.5/data/rubyonfire.fdb

Be aware about indentation
cat config/database.yml



ruby script/generate scaffold Client name:string address:string email:string remark:text
rake db:migrate


You can create the table structure by hand if you wish so

I have re-read the ruby guide
so i did these commands while following the official guide
rake db:create
but database was already created in flamerobin
script/generate controller home index
vi app/views/home/index.html.erb
and write something there, start the server with
script/server
and now you can see something in browser
http://localhost:3000/


I have created the table and one sequence in firebird db
CREATE TABLE posts (
id BIGINT NOT NULL PRIMARY KEY,
name VARCHAR(255),
title VARCHAR(255),
content VARCHAR(255),
timestamps timestamp
);
CREATE GENERATOR POSTS_SEQ;

I have ran the scaffold again to generate the posts model/view/controller
script/generate scaffold Post name:string title:string content:text
and then
started the server
script/server

of course I have modified the route and added an link as in tutorial and now i can add and modify blog posts
note: in new rails route is defined this way in config/routes.rb
map.root :controller => "home"

http://localhost:3000/posts






Follow the normal ActiveRecord conventions for table names, primary key columns, etc. The one “extra” you’ll need for Firebird is that you’ll have to create a generator for any tables that require a sequence-based primary key. The default naming convention is TABLENAME_SEQ. So if you have a users table, you would need to create a corresponding USERS_SEQ generator

You don't need to create before insert triggers ! rails reads the value from sequence and then increments it in ruby code, Yay!

Saturday, October 13, 2012

People still use Pascal? yes and is Growing


Free Pascal and  Delphi/ OO Pascal is growing that is what Tiobe says : if you add them both it should be in the top 10 programming languages displacing Ruby and JavaScript 
1.097+0.839=1.936
Another more credible source is the downloads page on sourcefogre for the Lazarus IDE

We assist on Libre Pascal Renascence of Hacker culture that they don't care about corporate languages like C#/Java

Why ? because Pascal is Modern and insanly Fast and it does have it's own advatages compared with other languages. 
Here are advatages in using the modern Pascal http://www.freepascal.org/advantage.var
I have written my own rants here , feel free to comment
The trend is for typed and more readable languges TypeScript , Python , Ruby ...

Wednesday, October 03, 2012

Installing Firebird Active Record driver for Ruby

Here is how to install activerecord-fb-adapter for rails
using the the gem version

gem install activerecord-fb-adapter
Fetching: fb-0.7.*.gem (100%)
Building native extensions.  This could take a while...
Fetching: activerecord-fb-adapter-0.7.*.gem (100%)
Successfully installed fb-0.7.*
Successfully installed activerecord-fb-adapter-0.7.*
2 gems installed
That is all You can build it manually if you wish
git clone https://github.com/rowland/activerecord-fb-adapter.git
cd activerecord-fb-adapter
rake gem

ls -lah pkg/activerecord-fb-*

gem install pkg/activerecord-fb-adapter-*.gem 

Successfully installed activerecord-fb-adapter-0.7.*
1 gem installed
Successfully installed 

gem install rails 
So now we are ready to play with Rails on Fire

Update:Rails works with this driver and here is the Rails guide