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!!!

debian, lenny, virtualbox, amd64



from http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=502375
thanks to Daniel Baumann

#apt-get update

#apt-get upgrade

#apt-get install virtualbox

#vi /etc/group
...
vboxusers:x:114:maximilianou
...

#apt-get install virtualbox-ose-source

#m-a a-i virtualbox-ose

Restart the system

#modprobe vboxdrv


Sunday, October 26, 2008

debian, lenny, amd64, mysql



Installing MySql Server and Client:

#apt-get install mysql-server


#netstat -tap |grep mysql


#mysqladmin -u root password xxxx


#mysql -u root -p
password:xxxx
mysql>quit


Creating a Database and User

MySql Information Schema
http://dev.mysql.com/doc/refman/5.0/en/information-schema.html
http://www.xcdsql.org/Misc/MySQL_INFORMATION_SCHEMA.html

#mysql -u root -p
password:xxxx
mysql>create database mvcdb;
mysql>grant all privileges on mvcdb.* to 'mvcuser'@'%' identified by 'mvcuser';
mysql>use mysql;
mysql>show tables;
mysql>select host, user, password from user where user like 'mvcuser%';
mysql>use information_schema;
mysql>show tables;
mysql>select * from user_privileges where grantee like "'mvcuser%'";


$mysql -u mvcuser, runs well
but i want
$mysql -u mvcuser -p, and this is not running well
now reading..

Friday, October 24, 2008

Reading Agile Web Development with Rails



Api installed documentation
use RubyGems to install rails.
$gem help server
$gem server
http://localhost:8808/

Agile Manifesto

Source: agilemanifesto.org

I have to remember this:

. Individuals and Interactions over processes and tools.
. Working Software over comprehensive documentation.
. Customer Collaboration over contract negotiation.
. Responding to Change over following a plan.

C#, Existent DataGridView, Add Column



Una vez que tenemos las rutas visibles en el DockPanel, y todo funciona perfectamente. Vamos a sumar el campo de Grupo a las rutas.
Pasos para recordar y en un futuro agregado no quedar en el camino.


1. Agragar la columna en la base:

ALTER TABLE RUTAS
ADD GRUPO_NOMBRE VARCHAR(50)


2. Re-Generar el DataSource en el "RUTASDS.xsd"
.Ir al Solution Explorer > LocalDatasets.DataSources.RUTASDS DobleClick
.Seleccionar el Query GetDataByRutasVisibles() ClickDerecho Properties
.Salvar en un NotePad el CommandText
.SELECT "ID_RUTA", "RUTA_NOMBRE", "RUTA_VISIBLE", "RUTA_COLOR", "GRUPO_NOMBRE" FROM "RUTAS" WHERE RUTA_VISIBLE = 1
.Ir al Solution Explorer > LocalDatasets.Datasources.RUTASDS BORRAR
.Ir al Panel DataSources > ClickDerecho > Add New DataSource
.Crear por default el DataSouces RUTASDS con la tabla Rutas > Finish
.RUTASDS.xsd > RUTASTableAdapter ClickDerecho > Add Query > Use SQL statements >
Select which returns rows > Pegar el Query
SELECT "ID_RUTA", "RUTA_NOMBRE", "RUTA_VISIBLE", "RUTA_COLOR", "GRUPO_NOMBRE" FROM "RUTAS" WHERE RUTA_VISIBLE = 1


3. Re-Generar el DataSource de "Object DataSource del DataGridView"
.Build Solution
.Select DockRutas.cs > DataGridView Click > ir al panel DataSources
> Expandir LocalDatasets > RUTASDS > Remove Object
.LocalDatasets > ClickDerecho > Add New DataSource > Object
> LocalDatasets.LocalDatasets.RUTASDS > Next > Finish
.Build Solution


4. Re-Generar el DataGridView
.ClickDerecho en el DataGridVew > Delete
.DataSources.LocalDatasets.RUTASDS.RUTAS > Arrastrar y pegar en el DockPanel
.Seleccionar el DataGridView > Panel Propiedades > Propiedad DataSource > Cambiar (rUTASBindingSource1) a rUTASBindingSource
.Eliminar del Panel Bajo del DataGridView > rUTASBindingSource1 y rUTASDS


5. Verificar los enganches del Codigo fuente.
.Verificar que seguimos teniendo en DockRutas.cs:

public DockRutas(FormCliente parentForm)
: base(parentForm)
{
InitializeComponent();
this.rUTASBindingSource.DataSource = RutasProcess.GetInstance().Rds;
}

private void DockRutas_Load(object sender, EventArgs e)
{
RutasProcess.GetInstance();
}

. y en RutasProcess.cs

protected RutasProcess()
{
_rutasTA = new RUTASTableAdapter();
_rutasDS = new RUTASDS();
_ruta_puntosTA = new RUTA_PUNTOSTableAdapter();
_ruta_puntosDS = new RUTA_PUNTOSDS();
_rutasTA.Fill(_rutasDS.RUTAS);
_ruta_puntosTA.Fill(_ruta_puntosDS.RUTA_PUNTOS);

}


6. Re-Generar el CheckBox del campo RUTA_VISIBLE
.DataGridView > ClickDerecho > Edit Columns > Seleccionar RUTA_VISIBLE
> ColumnType DataGridViewCheckBoxColumn
.Data > TrueValue 1 > FalseValue 0 > OK.


7. Correr y Verificar.

Thursday, October 23, 2008

Catch Exception en asp:SqlDatasource before insert



Catch Exception en asp:SqlDatasource before insert



1. Clientes.aspx

< asp:SqlDatasource
...
OnInserting="SqlDataSourceClientes_Inserting" >



2. Clientes.aspx.cs

protected void SqlDataSourceClientes_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
try
{
e.Cancel = true;
e.Command.ExecuteNonQuery();
LabelMensaje.Text = "Cliente Ingresado Correctamente";
}
catch
{
LabelMensaje.Text = "Cliente No Ingresado, verifique Nombre no repetido u otro parametro.";
}
}