Knowledge Base

February 22, 2008

mysql_pconnect() vs mysql_connect()

Filed under: Technical — Tags: , , — rkutti @ 12:35 pm

When connecting, the pconnect wolud first try to find a (persistent) link that’s already open with the same host, username and password. If the link already exist then the identifier for that will be returned instead of opening a new connection. Later, create a new link for each connection.

The Connection to the SQL server will not be closed when the execution of the script ends. Instead the link will be opened for future use and mysql_close() will not will not close links established by mysql_pconnect(). Later, The link to the server will be closed as soon as the execution of the script ends, unless its closed earlier by explicitly calling mysql_close().

Reference: mysql_pconnect() and mysql_connect()

February 20, 2008

Take the dump of Postgresql database from Linux console

Filed under: Technical — Tags: , , , , — rkutti @ 12:28 pm

*To dump data or structure in the database from a dump file

$psql -u DBUserName datbaseName < databaseName_dump.sql

*To take the dump from the database

$pg_dump -u databaseName > filename.sql // data + structure
It will ask the username and password of database

$pg_dump -u databaseName -a > filename.sql // only data

$pg_dump -u databaseName -s > filename.sql // only structure

$pg_dump –username=sql-ledger -W databaseName > filename.sql
It will ask the password of database

February 14, 2008

Quote from Bible for Valentine’s day

Filed under: Inspirations — Tags: , , — rkutti @ 11:30 am
Jesus said this:

But I tell everyone who is listening:
Love your enemies.
Be kind to those who hate you.
Bless those who curse you.
Pray for those who insult you.
If someone strikes you on the cheek, offer the other cheek as well. If someone takes your coat, don’t stop him from taking your shirt.
Give to everyone who asks you for something. If someone takes what is yours, don’t insist on getting it back.

Do for other people everything you’d like them to do for you.

If you love those who love you, do you deserve any thanks for that? Even sinners love those who love them.
If you help those who help you, do you deserve any thanks for that? Sinners do that too.
If you lend anything to those from whom you expect to get something back, do you deserve any thanks for that? Sinners also lend to sinners to get back what they lend.
Rather, love your enemies, help them, and lend to them without expecting to get anything back. Then you will have a great reward. You will be the children of the Most High God. After all, he is kind to unthankful and evil people. Be merciful as your Father is merciful.

Stop judging, and you will not be judged.
Stop condemning, and you will not be condemned.
Forgive, and you will be forgiven.
Give, and you will receive. A large quantity, pressed together, shaken down, and running over will be put into your pocket.
The standards you use for others will be applied to you.

Refrence:Ramblings of Passion

February 6, 2008

Some usefull Linux Commands

Filed under: Technical — Tags: , — rkutti @ 9:59 am

To know the ip address of the machine
$ifconfig

To view list of previously typed commands in command prompt
$history | grep <word that need to be searched>

To Know the ip address of the website
$host site-name

To list all the process running in a machine
$ps aux

To kill a process that is running
$kill -9 the process code

To know which process consumes more space
$top

To know how much space the folder occupies
$du -sh .

February 5, 2008

House for Rent

Filed under: Real Estate — Tags: , , , , — rkutti @ 4:02 pm

Ground Floor and First Floor duplex model
Anna Nagar, Chennai, Tamil Nadu
Bedrooms : 3
Land Area : 1200 Sq-ft
Buildup Area – 2000 Sq ft

Description:
This flat is located in Vellacherri, chennai with good surroundings, with spacious rooms, with good water supply, with main road approach, with easy access.

Key Features:-
Semi Furnished, Spaceous terrace, Double Car Parking

Contact Person : Mr. Prathab
Contact Number : +91-9944168941

January 31, 2008

Display textarea content with line breaks in html page

Filed under: Technical — Tags: , , , — rkutti @ 12:21 pm

Let us see how javascript, php, and ruby display the content of textarea with line breaks

Javascript:

document.getElemnetById(‘textareacontent’).value.replace(/\n/g,’<br>’);

PHP:

preg_replace(“/\n/”,”<br>”,$_REQUEST['t1']);

Ruby:

(teaxtareacontent).gsub(/\n/,”<br>”)

January 29, 2008

PHP Singleton Object

Filed under: Technical — Tags: , — rkutti @ 1:58 pm

The singleton pattern is a design pattern that is used to restrict instantiation of a class to one object. This is useful when exactly one object is needed to coordinate actions across the system.

Here is an example, that demonstrates this singleton pattern: (more…)

January 23, 2008

Take the dump of database from the console

Filed under: Technical — Tags: , , — rkutti @ 8:09 am

To take dump of whole database:
$ mysqldump -u <username> -p <databasename> > <filename>.sql

To take dump of the (only)structure of the database
$ mysqldump -u <username> -p <databasename> -d > <filename>.sql

To take dump of the (only)data of the database
$ mysqldump -u <username> -p <databasename> -t > <filename>.sql

To take dump of the database with complete insert statement
$ mysqldump -u <username> -p <databasename> -c > <filename>.sql

January 8, 2008

How to create database using mysql commands

Filed under: Technical — Tags: — rkutti @ 9:39 am

To create database from command prompt. Login to mysql as root user.
To login into mysql prompt in linux machine.
Type the following command in the console

$ mysql -u <username> -p<password>

After entering the mysql prompt follow these steps to create a database
and load the database with sql file.

A CREATE DATABASE statement to create a database.
> create database <databasename>;

A GRANT statement to grant privileges to database.
> grant all on <databasename>.* to <username>@localhost identified by ‘<password>’;

A FLUSH PRIVILEGES statement to tell the server to reload the grant.
> flush privileges;

A USE statement to tell the server to use the given database for further operations.
> use <databasename>;

A SOURCE statement to tell server to load the given sql file in the database.
> source <filename.sql>

December 10, 2007

Microformats

Filed under: Technical — Tags: , — rkutti @ 4:29 am

Microformats are tiny little markup definitions built on top of, usually, HTML or XHTML.

The available microformats are hCalendar, hReview, hCard, RelLicense, RelTag, XFN Format etc.,

The basic format of hCard is to use vCard object/property names in lower-case for class names, and to map the nesting of vCard objects directly into nested XHTML elements.

For example, Here is a sample vCard

BEGIN:VCARD
VERSION:3.0
FN:Jeffrey Thomas
END:VCARD

and an equivalent in literal hCard:
< p class=”vcard”> < span class=”fn”>Jeffrey Thomas < \span > < \ p>

There are several ruby parser for parsing this microformats to mention a few like mofo, hpricot etc

Check the microformats wiki for further details.

Importance of Microformats

Helps in – Aggregation Sites and Sharing Information with a Specific Community

You can also get more information from this blog about microformats and how websites using this.

Older Posts »

Blog at WordPress.com.