Archive for the ‘ruby’ Category

Gem of the day: haml - abstraction markup language

preamble

If you use RoR [http://en.wikipedia.org/wiki/Ruby_on_Rails] then you already know that
ERuby [http://en.wikipedia.org/wiki/ERuby] is pretty enough and you don’t ever think you need something else.

Haml {markup haiku}

Haml is an alternative way to code your “views”. It can be much easier, look on these examples:

XHTML:
<strong class=”code” id=”message”>Hello, World!</strong>

Haml:
%strong{:class => “code”, :id => “message”} Hello, World!

XHTML:
<div id=’content’>
<div class=’left column’>
<h2>Welcome to our site!>/h2>
<p>
<%= print_information %>
</p>
</div>
<div class=”right column”>
<%= render :partial => “sidebar” %>
</div>
</div>

Haml:
#content
.left.column
%h2 Welcome to our site!
%p= print_information
.right.column= render :partial => “sidebar”

like it .. so give you a try with Haml..

haml site: [http://haml.hamptoncatlin.com/]
haml docs: [http://haml.hamptoncatlin.com/docs/]

Setup of Ruby on Rails environment under Debian GNU/Linux

preamble

here you will find just quick-and-dirty hints how to use Ruby on Rails on Debian GNU/Linux platform

ruby and RoR installation

# apt-get install ruby

install ruby gems [http://en.wikipedia.org/wiki/RubyGems]
# apt-get install rubygems

then don’t use ‘rails’ Debian package because it doesn’t work with gem and so gem will not know about it.
you should use gems for that:
# gem install rails –include-dependencies

if you located behind a firewall, export following value before gem using:
HTTP_PROXY=http://[username]:[password]@[proxyserver]:[port]

if you use some IDE like NetBeans [http://en.wikipedia.org/wiki/NetBeans]with Ruby on Rails extension than after installing of ruby and rubygems packages
you can use NetBeans to install ruby extensions

installation of gems that require building of native extensions

some gems are simple set of ruby scripts and then can be just installed
some gems contain source code c/c++ and so before installing of such gems you should have:

**development environment
# apt-get install build-essential

**ruby development header files
# apt-get install ruby-dev

**header files of library that you want to build

for example: you want to have ruby driver for postgresql DB
# apt-get install postgresql-server-dev-8.3
# gem install postgres

enjoy it ..

Fast ways for creation of web-based solutions

preamble

Nowadays business require full-featured cost-effective solutions with short time to market.
I see only 3 approaches to achieve it:

**development platform which allows rapid visual component-based web-applications development
Unfortunately only .Net platform has it at this moment but we try to avoid proprietary [http://en.wikipedia.org/wiki/Proprietary] solutions.

**using of real productive framework Ruby on Rails (RoR) [http://en.wikipedia.org/wiki/Ruby_on_Rails]

**lightweight platform which provide already developed full-featured system that can be easily customized with modules
- CMS (Content Management System) [http://en.wikipedia.org/wiki/Content_management_system]

I want to make a note here: not every CMS can be used as such base platform.
Appropriate platform should contain well-designed API and documentation for extension development as well as
good set of already developed extensions.

Ruby on Rails

RoR gives you an extremely quick way to develop flexible Web applications.
It contains set of useful classes and methods for carrying out the actions most used in Web-based applications, and
provide base structure of project that everyone should follow.

Rails based on 2 principles: Convention over Configuration (CoC) [http://en.wikipedia.org/wiki/Convention_over_Configuration]
and Don’t repeat yourself (DRY) [http://en.wikipedia.org/wiki/Don%27t_repeat_yourself];
uses the Model-View-Controller (MVC) [http://en.wikipedia.org/wiki/Model-view-controller] architecture,
and ActiveRecord [http://en.wikipedia.org/wiki/Active_record_pattern] which maps relational tables to Ruby objects.
I just like it..

Selected CMSs

There are set of different CMSs, and even commercial ones but we should not use them because we have enough cool open source software.

I have reviewed numerous Open-source CMSs for our company to find some noteworthy systems.
Look to this list to understand that we have to select from:
[http://en.wikipedia.org/wiki/Category:Open_source_content_management_systems]

I will not provide you with any comparison due to you can easily find them on the Internet.
There are several platform as base for CMSs: Java, Ruby, Python, PHP

Personally I like Java for strict object-oriented programming methodology, type safety [http://en.wikipedia.org/wiki/Strongly-typed_programming_language],
automatic garbage collection, good design of API, and amount of libraries that almost all are open-source.
But: Java based CMSs are heavy, ugly, and still lack functionality.

Most of wonderful (lightweight, pretty, and full-featured) CMSs are written in PHP, and 2 most cool are:

Joomla! [http://en.wikipedia.org/wiki/Joomla%21]
features list: [http://www.joomla.org/content/view/4483/118/]
documentation: [http://docs.joomla.org/]
api: [http://api.joomla.org/]
list of extensions: [http://extensions.joomla.org/]

Typo3 [http://en.wikipedia.org/wiki/TYPO3]
features list: [http://typo3.com/Feature_list.1243.0.html]
documentation: [http://typo3.org/documentation/]
api: [http://typo3.org/fileadmin/typo3api-4.0.0/]
list of extensions: [http://typo3.org/extensions/]

and at the end of the article I will provide to you one of our last solution based on Joomla!:

project name: car auctions site
rough description: site that provide functionality to purchase cars from auctions, forum to discus details, multi language support,
vote functionality, customized searches.

platform: Joomla! 1.5
template: free template from [http://joomlashack.com]
Joomla extensions:
forum: simplest forum 1.1.4 [http://extensions.joomla.org/component/option,com_mtree/task,viewlink/link_id,3131/Itemid,35/]
Polls: built-in Joomla! 1.5 vote component
localization support: JoomFish 2.0 [http://www.joomfish.net]

men-hours: 110
site URL: http://www.svidcars.com