Wednesday, June 21, 2006

MYSQL Explorations....

To create a database:

mysql> CREATE DATABASE smrpnm;

--> database name is case sensitive, unlike SQL keywords.

We should use the db...to make a database the current one...

mysql> USE smrpnm;

Alrernate at shell level, # mysql -h host -u user -p smrpnm
password: *********** (or)
# mysql -h host -u user -pmypassword smrpnm // not recommended
---------------------
No tables are present, so the following will not return anything...

mysql> SHOW TABLES;

So time to create a table now,

mysql> CREATE TABLE members (name VARCHAR(20), dob DATE, email VARCHAR(30), bg VARCHAR(20), mobile VARCHAR(14), locality VARCHAR(20), bagh VARCHAR(20), phone VARCHAR(14));

--> Character length: 1-255 char.

---------------------
But now, give,

mysql> SHOW TABLES;

To verify that the table was created as expected..

mysql> DESCRIBE members;

---------------------
Loading data:

mysql follows yyyy-mm--dd format

A single record at a time...

mysql> INSERT INTO members VALUES ('Sample',NULL,'sample@sample.com',NULL,NULL,'Vadapalani','Vadapalani','2222222');

Load data provides chances to get bulk data to the table..

mysql> LOAD DATA LOCAL INFILE '/root/Desktop/loadtosql.txt' INTO TABLE members;

--> In loadtosql.txt each value of a record seperated by tab witn \N representing NULL. In window '\n\r' has to be used as line seperator.
---------------------
SELECT statement:

Syntax:

SELECT what_to_select FROM which_table WHERE conditions_to_satisfy;

mysql> SELECT * FROM members;

To update a record, which has got erroneous value in table....or replace a NULL value....

mysql> UPDATE members SET name = 'Seshadri' Where locality = 'Ashok Nagar';
---------------------

To DELETE record from a table....

mysql> DELETE FROM members;

---------------------

More SELECT staements examples:

Option: All columns

mysql> SELECT * from members WHERE locality = 'T Nagar';

mysql> SELECT * from members WHERE bagh = 'Medavakkam' AND locality = 'Medavakkam';

mysql> SELECT * from members WHERE bagh = 'Medavakkam' OR bagh = "Mylapore";

mysql> SELECT * from members WHERE (bagh = 'Medavakkam' OR bagh = "Mylapore") AND (bg = 'B+ve');
------
Option: Few columns

mysql> SELECT name, mobile from members WHERE locality = 'T Nagar';

Selecting distinct value to get displayed when there is a repitition,'

mysql> SELECT DISTINCT bg FROM members;

mysql> SELECT name from members WHERE (bagh = 'Medavakkam' OR bagh = "Mylapore") AND (bg = 'B+ve');
------
Sorting:

mysql> SELECT locality, name, mobile from members ORDER BY locality;

For desecding order sort..

mysql> SELECT locality, name, mobile from members ORDER BY locality DESC;

Multi-column sort,

mysql> SELECT locality, name, mobile from members ORDER BY locality, name;
------

Monday, June 05, 2006

Fonts in GNU/Linux

In a GNU/Linux system fonts are generally located in three places,

1) /usr/share/fonts,
2) /usr/local/share/fonts and
3) /home//.fonts

These are defined in /etc/fonts/fonts.conf

To add a True type font,

# cd /usr/local/share/fonts # or /usr/share/fonts, but this is less safe
# sudo mkdir truetype
# cd truetype
# sudo cp /path/to/your/fonts/*.ttf .
# sudo cp /path/to/your/fonts/*.TTF .
# sudo chown root:root *.ttf
# sudo chown root:root *.TTF
# sudo mkfontscale

>> Note: For fedora do # ttmkfdir before fc-cache

# sudo mkfontdir
# sudo fc-cache


(mkfontscale and mkfontdir creates fonts.scale and fonts.dir files within /usr/local/share/fonts/truetype, and fc-cache updates fonts.cache-1 files within all font directories.)

Now we need to create sym links to other fonts folders,

# ln -s /usr/local/share/fonts/truetype /usr/share/fonts/truetype/myfonts
# ln -s /usr/local/share/fonts/truetype /home//.fonts

Fonts can also be added directly to /user/.fonts

But this way its available only to particular user(s).

Also we can open the virtual fonts folder thru nautilus for GNOME, by Open Locatiom --> fonts:

or by,

# nautilus fonts:

Again this restricts to particular user(s).

For bitmapped fonts,

Please refer https://wiki.ubuntu.com/FontInstallHowto

Friday, June 02, 2006

Installation Procedure for IITM Multi-Lingual Editor...

Download the following iitmeditor gzipped files into your desired directory
(i) iitmed_linux.tar.gz
(ii) support_files.tar.gz

Link: http://acharya.iitm.ac.in/software/Linux_ed.html

Unzip these downloaded files using gunzip command
(i) gunzip iitmed_linux.tar.gz
(ii) gunzip support_files.tar.gz

Become root (su) and do the following.

(i) mv support_files.tar /usr/local/share/
(ii) cd /usr/local/share/
(iii) tar -xvf support_files.tar

Untar 'iitmed_linux.tar' into your desired directory (/ directory is chosen)

$ tar -xvf iitmed_linux.tar [please note $ is shell prompt]

Now add the IITM Fonts(Multi-lingual fonts) to the set recognized by X11.

$ cd multlingeditor/
$ cd LLfonts/
$ ./addfonts.sh
$ cd ..
$ ./iitmeditor

Now the editor is ready for use.