Archive

Posts Tagged ‘ruby’

TODO LIST 2009

December 1st, 2008

TODO LIST 2009

Read/Learn/Practice:

Python 2.6 (What’s New)

Perl 5 (Modules, Packages)

PHP (Changes, and news)

COBOL

.NET (C#, LINQ, (ok VB but not much))

Java (Im interested on Mobil Applications)

Haskell

Ruby (Im interested on Rails)

Parrot and Pugs

Gnu/Linux (Services and Bash)

BSD and OpenSolaris

Personal Projects 2009:

BSE (Blog’s Search Engine) (http://BSE.AyalaSoft.com)

Invoices PHP (Now is part of a Intranet) (http://valuacion.com.mx)

Forming one’s own business

And others ….

Lambda Functions on PHP 5.3.0:

 $lambda = function () { echo "Hello World!\n"; };

Parrot “Hello World” example:

.sub main
      print "Hello World!\n";
.end

COBOL “Hello World” example:

* Hello World Program
* GPL Copyleft Jonathan Riddell 2001
	IDENTIFICATION DIVISION.
	PROGRAM-ID.    hello.
	ENVIRONMENT DIVISION.
	DATA DIVISION.
 
	PROCEDURE DIVISION.
		DISPLAY "Hello ," WITH NO ADVANCING
		DISPLAY "World!"
		STOP RUN.

Haskell “Hello World” example:

putStrLn "Hello World!"

develop, unix/linux, web, windows , , , , , ,

Using Windows ? Don’t kill Yourself

October 27th, 2008

Using Windows ? Don’t Kill Yourself

Supose you are Linux user and you have a Windows system.

Alternatives: Cygwin, Mingw or Colinux

You need some (or all) of this interpreters:

Perl, PHP, Python and Ruby

Modify the %PATH%

Example you have a bin dir, on C:\ to include the executables on the %PATH% do this:

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

On Windows Vista, you can use your mouse:

computer > properties > Advances system settings > (continue) > Advanced > Enviroment Variables > System Variables > Path (edit)

Example run Kompozer on cmd.exe but no modify %PATH%

: kompozer.bat save on %WINDIR%
@"C:\Program Files\Kompozer\kompozer.exe"

Doble click on your scripts to run:

: Perl Scripts
 assoc .pl=Perl.File
 ftype Perl.File=C:\strawberry\perl\bin\perl.exe "%1" %*
 set PATHEXT=%PATHEXT%;.pl
: Python Scripts
 assoc .py=Python.File
 ftype Python.File=C:\Python26\python.exe "%1" %*
 set PATHEXT=%PATHEXT%;.py

Note:

On Windows Vista you need run cmd.exe as Administrator don’t work as normal user

Apache, PHP and MySQL ?

XAMPP and Server2Go

Notes:

XAMPP: simple, quick and easy install.

Server2Go: is great to make CD demo of a Web Application.

Using Perl or Python as CGI on Windows ?

Using Python 2.6

#!\python26\python.exe

Using Strawberry Perl:

#!\strawberry\perl\bin\perl.exe

Now your script works on http://localhost/cgi-bin/script.cgi

develop, unix/linux, windows , , , , ,

PDF Libraries

October 2nd, 2008

PDF Libraries

Sometimes we need create or export data into a PDF:

.NET:

http://www.pdfsharp.com, http://www.codeplex.com/Print2Pdf

C++:

http://libharu.org

Perl:

http://search.cpan.org/~markusb/PDF-Create/lib/PDF/Create.pm

sudo perl -MCPAN -e 'install PDF::Create'

PHP:

http://www.fpdf.org, http://www.digitaljunkies.ca/dompdf, http://pear.php.net/package/File_PDF

Python:

http://www.reportlab.org

wget -c http://www.reportlab.org/ftp/ReportLab_2_2.tgz
tar xvzf ReportLab_2_2.tgz
cd ReportLab_2_2
sudo python setup.py install

Java:

http://www.lowagie.com/iText, http://www.pdfbox.org

Ruby:

http://ruby-pdf.rubyforge.org/pdf-writer

sudo gem install pdf-writer

develop , , , , , ,

rubygems-update issue on Ubuntu

September 30th, 2008

rubygems-update issue on Ubuntu

If you have this problem on your computer:

sudo gem update --system
Updating RubyGems
Bulk updating Gem source index for: http://gems.rubyforge.org/
Updating rubygems-update
ERROR:  While executing gem ... (Gem::GemNotFoundException)
    could not find rubygems-update locally or in a repository

The problem is RubyGems you need to install manually or use this script solution:

#!/bin/bash
#(download the latest on http://rubyforge.org/frs/?group_id=126)
wget http://rubyforge.org/frs/download.php/43984/rubygems-update-1.3.0.gem
sudo gem install rubygems-update-1.3.0.gem
sudo update_rubygems
# now this work:
sudo gem update --system
echo "done."

I found this solution on this web:

http://rubyglasses.blogspot.com/2008/08/updating-gem-to-120-on-ubuntu.html

develop, unix/linux , ,

Ruby On Rails on Ubuntu

June 4th, 2008

Ruby On Rails on Ubuntu

Aquí dejo un script que hice, sirve para instalar Ruby On Rails con SQLIte3 de manera rápida solo requieren tener privilegios de poder usar el poderoso sudo, hay una guia en Ubuntu Community Doc sobre la Instalación de RoR.

Una vez instalado podemos desarrollar aplicaciones ejemplo:
rails test
cd test
script/server

Si visitamos http://0.0.0.0:3000 en nuestro navegador y le damos click en “About your application’s environment” podremos ver el siguiente contenido:

Ruby version 1.8.6 (i486-linux)
RubyGems version 1.1.1
Rails version 2.1.0
Active Record version 2.1.0
Action Pack version 2.1.0
Active Resource version 2.1.0
Action Mailer version 2.1.0
Active Support version 2.1.0
Application root /home/aayala/ror/test
Environment development
Database adapter sqlite3
Database schema version 0

unix/linux , ,

Play Ruby On Rails

May 21st, 2008

Play Ruby On Rails

Hace tiempo que quería probar este lenguaje/framework hoy decidí probarlo antes de ir al trabajo, la verdad es que estoy molesto, no por ROR sino por no haberlo usado antes.

Solo tengo que generar la base de datos (en mi caso use MySQL pero tiene por default SQLite) editando el “config/database.yml”, estoy seguro de que no programe nada solo escribí estas 2 lineas en la shell:

1) ruby script\generate scaffold usuario id:integer usuario:string nombre:string pass:string correo:string fecha:string status:integer
2) ruby script\server

y con eso es mas que suficiente para que me genere controlador, modelo, vista y claro con eso tener una pagina que liste los registros, inserte uno nuevo, lo edite y lo elimine, aqui un par de screenshots:  usuario_nuevo y usuario_editar

Conclusión: tengo que aprender ROR.

develop , ,