Monday, April 27, 2009

ruby on rails i18n

An approach:

$script/plugin install git://github.com/svenfuchs/rails-i18n.git

$cp config/locales/en.yml config/locales/es-ar.yml

config/environment.rb

config.time_zone = 'Buenos Aires'
config.i18n.default_locale = :"es-ar"


app/views/payment_operation/show.html.erb

<%= t('views.payment.show_title', :count => @foo.size, :bar => @foo.name) %>


config/locales/es-ar.yml

es-ar:
views:
payment:
show_title:
zero: "Mostrando operación de pago y {{bar}}."
one: "Mostrando operación de pago y {{bar}}."
many: "Mostrando operación de pago y {{bar}}."

Thursday, April 23, 2009

Wednesday, April 22, 2009

Survive in php.. a logger method.


function logger($msg){
if(!isset($GLOBALS['logger'])){
$GLOBALS['logger'] = fopen("/var/www/apps/logs/dev.log","a");
}
fwrite($GLOBALS['logger'],"$msg\n");
}

function request($id = ''){
logger("dir/file.php::request(id[".$id."])");
...
}

Wednesday, April 15, 2009

Conceptual views and Implementation Details.

FSM. Finite State Machine. This is real.

http://blog.objectmentor.com/articles/2008/11/27/the-truth-about-bdd

Languages, are implementation details?

http://blog.objectmentor.com/articles/2009/01/15/adopting-new-jvm-languages-in-the-enterprise

Thursday, March 26, 2009

jquery jcarousel fade efect



Change this file:
jquery.jcarousel.js

Add this lines: starting in line 431
next: function() {
this.stopAuto();
$('#mycarousel').fadeOut(1000);
if (this.tail != null && !this.inTail)
this.scrollTail(false);
else
this.scroll(((this.options.wrap == 'both' || this.options.wrap == 'last') && this.options.size != null && this.last == this.options.size) ? 1 : this.first + this.options.scroll);
$('#mycarousel').fadeIn(1000);
},


Friday, February 13, 2009

xubuntu ruby on rails



Xubuntu 8.10 install.
$sudo aptitude install ruby
http://www.ruby-lang.org
http://rubyonrails.org
http://www.rubygems.org


$sudo aptitude install libyaml-ruby
$sudo aptitude install libzlib-ruby
$sudo aptitude install curl
$curl -O http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-1.3.1.tgz
$tar -xvzf rubygems-1.3.1.tgz
$sudo ruby setup.rb
$rm -r rubygems-1.3.1
$rm rubygems-1.3.1.tgz
( $gem
The program 'gem' can be found in the following packages:
* rubygems1.8
* rubygems1.9 )
$sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
$gem --version
1.3.1
$sudo gem install rails


$sudo aptitude install mysql-server
$mysql -u root -p
mysql>create database stock_development;
mysql>create database stock_test;
mysql>create database stock_production;
mysql>grant all on stock_development.* to 'stock_user'@'localhost' identified by 'stock_user';
mysql>grant all on stock_test.* to 'stock_user'@'localhost' identified by 'stock_user';
mysql>grant all on stock_production.* to 'stock_user'@'localhost' identified by 'stock_user';
$sudo gem install mysql
no such file to load -- mkmf (LoadError)
$sudo aptitude install ruby1.8-dev
$sudo gem install mysql
/usr/bin/ruby1.8 extconf.rb install mysql
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
$sudo aptitude install libmysql-ruby


$mkdir src
$cd src
$rails stock
$cd stock
$script/console
(sh: irb: not found)
$sudo aptitude install irb1.8
$sudo ln -s /usr/bin/irb1.8 /usr/bin/irb
$script/console
no such file to load -- net/https
$sudo aptitude install libopenssl-ruby


$script/generate scaffold Provider name:string iva_type:integer
$rake db:migrate


$sudo aptitude install gedit


$sudo aptitude install git
$sudo aptitude install git-core
$git clone http://github.com/lguardiola/documentation_hacks
$cp -r documentation_hacks vendor/plugins
$rake doc:models:annotate


$script/plugin install git://github.com/technoweenie/restful-authentication.git
$script/generate authenticated user sessions
$script/plugin install git://github.com/timcharper/role_requirement.git
$script/generate roles Role User
No such file or directory - /home/maximilianou/src/stock1/app/controllers/application.rb
$cp app/controllers/application_controller.rb app/controllers/application.rb
$script/generate roles Role User
$mv app/controllers/application.rb app/controllers/application_controller.rb
$rake db:migrate

Friday, October 31, 2008

windows, ruby on rails, sqlite3



Download Ruby from:
http://www.ruby-lang.org/es/downloads/

binarios compilados
ftp://ftp.ruby-lang.org/pub/ruby/binaries/mswin32/ruby-1.8.6-i386-mswin32.zip

UnZip:
C:\ruby

PATH=%PATH%;C:\ruby\bin

Download RubyGems from:
http://rubygems.rubyforge.org

http://rubyforge.org/frs/download.php/45906/rubygems-1.3.1.zip

UnZip:
C:\rubygems-1.3.1

C:\rubygems-1.3.1>ruby setup.rb

C:\gem install rails --include-dependencies

Problemas No Encuentra Esto:
zlib.dll
SSLEAY32.dll

A otra cosa,

Eliminar
C:\ruby

Eliminar
C:\rubygems-1.3.1



Ahora con One-Click Installer:

http://rubyforge.org/frs/download.php/18566/ruby186-25.exe

C:>gem install rails --include-dependencies




C:>mkdir src
C:>cd src
C:\src>mkdir work
C:\src>cd work
C:\src\work>rails demo
C:\src\work>cd demo
C:\src\work\demo>ruby script\server

Rails requires RubyGems >= 1.1.1 (you have 0.9.2). Please `gem update --system`
and try again.

C:\src\work\demo>gem update --system

C:\src\work\demo>ruby script\server

http://localhost:3000/



no such file to load -- sqlite3

http://www.sqlite.org/download.html

UnZip and Copy:
C:\ruby\bin\sqlite3.exe

C:\>gem install sqlite3-ruby
checking for fdatasync() in rt.lib... no


from http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/9d5c9ee6167dace4
http://www.sqlite.org/download.html

UnZip and Copy:
C:\ruby\bin\sqlite3.dll
C:\ruby\bin\sqlite3.def

C:\>gem install sqlite3-ruby
checking for fdatasync() in rt.lib... no

from http://www.nabble.com/Beginner-help:-Problem-installing-sqlite3-on-Windows-XP-td19200418.html
Jim Carter

C:\>gem install --version 1.2.3 sqlite3-ruby

http://localhost:3000/rails/info/properties
Perfecto!!!