January 6, 2010
Most of Google searches that hit my blog are about ‘ruby on rails interview questions‘.
Responding to this popular request
, I will post 3 more questions that are related.
1. What type of data would you use to represent currency?
2. Why is it not a good practice to use float for currency?
3. Explain the following behaviour:
~$ ruby --version
ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux]
~$ irb
irb(main):003:0> (10.12*100).to_i
=>; 1011
The answer – in my next post .
1 Comment |
Uncategorized | Tagged: activerecord, currency, decimal, float, interview questions, rails, ruby |
Permalink
Posted by vladzloteanu
January 5, 2010
To deploy something other than the HEAD, you must use the -s option.
Below are examples for git.
cap -s branch=my_branch deploy
cap -s tag=my_tag deploy
Leave a Comment » |
Uncategorized | Tagged: branch, capistrano, git, git branch, revision, scm, subversion, tags |
Permalink
Posted by vladzloteanu
December 23, 2009
One of the nicest things in the built-in Rails internationalization features is the ability to format the currency according to the local culture (the number_to_currency method). For example, many european contries use ‘,’ as a separator and ‘.’ as a delimiter.
However, the examples presented in the help page (http://api.rubyonrails.org/classes/ActionView/Helpers/NumberHelper.html#M001684) are missing something essential.
number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "")
# => £1234567890,50
number_to_currency(1234567890.50, :unit => "£", :separator => ",", :delimiter => "", :format => "%n %u")
# => 1234567890,50 £
Why should i need a helper method where i can set all those parameters by hand?
Digging in the source code, i found how those settings can be put in the locale yml config file. Below is an example from my french localization file.
fr:
number:
currency:
format:
delimiter: ','
separator: '.'
precision: 2
format: '%n %u'
Leave a Comment » |
Uncategorized | Tagged: currency, i11n, internationalization, number_to_currency, rails, ruby |
Permalink
Posted by vladzloteanu
August 24, 2009
This article shows how to create multiple VPS-es using OpenVZ and how to configure those VPS-es as a Rails prod/testing server.
It is an updated and improved version of http://wiki.openvz.org/Quick_installation
Why OpenVZ?
+ low overhead, good performace (claiming only 3% penalty)
+ soft memory allocation
+ free
+ relatively easy to install/manage
- requires both host and to guest OS be Linux
- no GUI on guest machines
Leave a Comment » |
Uncategorized | Tagged: linux, openvz, production, rails, server, testing, ubuntu, vps |
Permalink
Posted by vladzloteanu
July 25, 2009
1 Comment |
Uncategorized | Tagged: 3rdrail, aptana, aptana issues, editors, java, linux, netbeans, radrails, rails, rubymine, sun, ubuntu, ubuntu 9 |
Permalink
Posted by vladzloteanu
July 17, 2009
Problem: forked a project from Git, made some changes, wanted to push the changes. Got this error:
git push
fatal: protocol error: expected sha/ref, got ‘
*********’
You can’t push to git://github.com/user/repo.git
Use git@github.com:user/repo.git
Read the rest of this entry »
1 Comment |
Uncategorized | Tagged: git, git error, git push, git push error |
Permalink
Posted by vladzloteanu
July 13, 2009
A lot of GitHub projects are dedicated to creating a Rails Start-up application that should have the most used functionalities in any web application, like:
- user authentication
- profile management
- user roles
- users management
- integration with other authentication systems (OpenID, FacebookConnect, etc)
Some of the most well known are listed below:
Read the rest of this entry »
3 Comments |
Uncategorized | Tagged: authentication, authlogic, baseapp, openid, rails, startup apps, users management |
Permalink
Posted by vladzloteanu
July 2, 2009
For writing a short ToDo list, taking some notes from a conference or saving an interesting shell command, an Ubuntu user needs a simple sticky notes desktop widget. Tomboy Notes is the easyest to use but in the same time very well featured, and it is bundled in Gnome Desktop.
Read the rest of this entry »
Leave a Comment » |
Uncategorized | Tagged: ext2, ext3, fs-driver, linux, sticky notes, tomboy notes, ubuntu, windows |
Permalink
Posted by vladzloteanu