me,myself,english and programming..

Archive for September, 2008

How to program Gambas with MySQL in Ubuntu

Sunday, September 21st, 2008

I’ve read a nice introduction to Gambas here.Gambas is a free development environment based on a Basic interpreter with object extensions.

Since installing Gambas in ubuntu is a piece of cake, I then decide to try to program using Gambas. I found quite a number of article to do a connection with MySQL but then it fail when I run it with error message :

Cannot find driver for database: mysql

Googling help me to find this another nice article and i’m happily coding using that sample.Thanks. :)

then, I hit another error.

Can’t connect to local MySQL server through socket’/var/run/mysqld/mysqld.sock’(2)

This time I’m very sure it’s not about the code anymore, it’s something to do with Gambas configuration. Since I have install MySQL using XAMPP,socket file is in /opt/lampp/var/mysql/mysql.sock not at the place that Gambas looking for.I can’t find the solution yet. I just use temporary solution where I manually create the link file. Below are the command.

sudo mkdir /var/run/mysqld
sudo ln -s /opt/lampp/var/mysql/mysql.sock /var/run/mysqld/mysqld.sock

Here are the way how to program Gambas with MySQL. :)

(more…)

MSSQL – Date Manipulating

Wednesday, September 10th, 2008

By default, result for select getdate() in MS-SQL will be something like below:

getdate()
————————-

2008-09-09 15:01:47.340

CONVERT function can be use to manipulate the date format as per our need.

Using CONVERT:

CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

example:

select CONVERT(varchar(25),getdate(),100)

————————-
Sep 9 2008 3:04PM

Below are the lists of style/format for reference :

(more…)

Generating a self signed SSL certificate in Ubuntu Hardy

Saturday, September 6th, 2008

There are a few way to generate a self signed SSL certificate . You can read it here,here and here .

This is the most inexpensive way to use a ssl connection because it’s totally FREE. From a cryptographic perspective, there is no difference in security whether you use a self signed SSL certificate or buy an expensive SSL certificate.Of course,you will get a warning from your browser but the data is still encrypted.

Make no mistake, these certificates are good only for personal use or for use in your intranet in order to provide a secure way to login or communicate with your services, so that passwords or other data is not transmitted in the clear.

The following simple commands,create a self-signed key/certificate pair with a lifetime of 1 years.

(more…)

Simple DOS command..yet still saves my day.

Tuesday, September 2nd, 2008

My friend send me a bunch of files where it have a sql scripts for each table. I need to combine all those files into one and later will be use to reverse engineer and analyze the tables.

Below are simple steps that I use to combine all those files using command prompt.

Create an empty file.

echo.> mytables.sql

Run this magic.

for %x in (*.*) do type %x >> mytables.sql

That’s all.