Tuesday, August 4, 2009

My Dev Environment on OSX



sudo easy_install -U setuptools
sudo easy_install pyamf

Monday, June 22, 2009

My Dev Environment

Eclipse

http://pydev.sourceforge.net/updates/

http://www.migue.org/diario/2007/08/cmo-usar-subversion-en-eclipse.html

Monday, December 29, 2008

mod_python installation

Running mod_python on Windows (XP) is actually quite simple:

  • install Apache (Windows MSI Binary 2.0.X) 
  • install Python
  • install mod_python from here; make sure you pick the correct matching version for Apache and Python!
  • edit httpd.conf
  • add "LoadModule python_module modules/mod_python.so" in the LoadModules section
  • restart Apache
  • test

Friday, December 26, 2008

Postgres installation

NOTE: RHEL5 comes with PostgreSQL 8.1.11 rpm packages for installation from the install disks. So we need to upgrade to the version we use 8.3.3-2
First uninstall postgresql 8.1 with
rpm -e postgresql postgresql-server postgresql-python

then download the file 
change the file priviledges with chmod 755 filename
run the installation program with ./filename

configure as follows:
Installation Directory [/opt/PostgreSQL/8.3]: /opt/postgres/8.3
Data Directory [/opt/postgres/8.3/data]:
database superuser (postgres).
password:
Port [5432]:
Please choose an option [1] :
pl/pgsql [Y/n]: Y
pl/Perl (trusted) [y/N]: Y
pl/Perl (untrusted) [y/N]: N
pl/Python (untrusted) [y/N]: Y
pl/Tcl (trusted) [y/N]: N
pl/Tcl (untrusted) [y/N]: N

Adding the postgres User
$ su - -c "useradd postgres"

Setting Environment Variables

Initializing and Starting PostgreSQL
You will need to log in as postgres user before typing the following commands
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Note: in RHEL5 the PostgreSQL rpm has done all of this for us if we told the installation disks to do so. If not you can run yum install postgresql postgresql-server and install it afterwards. Be warn that the $home directory for the postgres user is in /var/lib/pgsql, and it has also run for us the initdb creating the data dir under /var/lib/pgsql.

Running postmaster in the foreground
$ /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data
in RHEL5 use:
/usr/bin/postmaster -D /var/lib/pgsql/data

Running postmaster in the background
$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /tmp/pgsql.log start
in RHEL5 use:
/usr/bin/pg_ctl -D /var/lib/pgsql/data -l logfile start

Starting PostgreSQL with the SysV script
$ service postgresql start
$ service postgresql stop

Creating a Database
$ createdb testdb

Accessing a database with psql
$ psql testdb

Login to the template1 database
To see the encoding codification of the databases 
\l
to change the encoding of one database use
6 = UTF8, 8 = LATIN1
update pg_database set encoding=6 where datname='testdb';

Helpfull linux commands

To change system configuration parameters regarding Firewall use
$ /usr/sbin/setup

To know which ports are open use
$ nmap -sT localhost

To know if a service is running use
/sbin/service postgresql status

or
/etc/init.d/postgresql status

To check the status/add/remove a service from a runlevel
/sbin/chkconfig --list [name]
/sbin/chkconfig --add [name]
/sbin/chkconfig --level [levels] [name]

To find out which rpms are installed, and filter them by a software name use:
rpm -qa |grep [package name]

and to delete a package use
rpm -e [package name]

Thursday, September 25, 2008

Installing Rails

If you don't have an Internet connection or your company blocks some ports to downloads gems, you'll need to download each gem to your HDD first and then install them locally.

This procedure is explaines here, but in a short version, do the following:

1) Activesupport from: http://rubyforge.org/projects/activesupport/
2) ActionPack from http://rubyforge.org/projects/actionpack/
3) Actionmailer from http://rubyforge.org/projects/actionmailer/
4) Activerecord from http://rubyforge.org/projects/activerecord/
5) Activeresource from http://rubyforge.org/projects/activeresource/
6) Actionwebservice from http://rubyforge.org/projects/aws/
7) Rake from http://rubyforge.org/projects/rake/
8) Rails from http://rubyforge.org/projects/rails/

Then go to the directory where all this files are, and install them in the same order with:
c:\> gem install gemname

After installing rails you might probably install some other packages that I personally use a lot:
gem install mongrel
gem install postgres-pr

Wednesday, September 3, 2008

My First Rails Project

rails appname
createdb dbname -U postgres -O postgresadmin -E 'UTF8'
cd appname
script/plugin install http://svn.techno-weenie.net/projects/plugins/restful_authentication/
script/generate authenticated user sessions --include-activation
rake db:migrate

// edit in /app/controller/application.rb and add the very first line
include AuthenticatedSystem

// edit in /config/database.yml
adapter: postgresql
database: dbname
username: postgresadmin
password: postgresadmin
host: localhost
timeout: 5000

links:
restful_authentication
with an excellent tutorial

if you want to have an easy backoffice, you can use the active_scaffold plugin:
git clone git://github.com/activescaffold/active_scaffold.git vendor/plugins/active_scaffold && rm -rf vendor/plugins/active_scaffold/.git

Use WebOrb for commmunication between Flex and Rails with:
ruby script/plugin install http://themidnightcoders.net:8089/svn/weborb

install http://themidnightcoders.net:8089/svn/weborb

if you want to send automatically generated mail on some action use
script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls
more explained on here and here