Wednesday, August 24, 2011

Chrome doesn't display tamil fonts properly

I have faced a problem when am working with chrome under ubuntu. Browser doesn't display the tamil fonts properly. I solve this by removing "FreeSans" font. You found this file under

Path: /usr/share/fonts/truetype/freefont under this path you will found FreeSans.ttf file just remove it. Now Chrome will display all tamil fonts properly.

Sunday, August 14, 2011

Python Documentation

If you installed Python along with documentation. Here is the command to get the list of modules and its functionalities(docs).

pydoc -p <port_number>

Now you can view the documentation with the help of browser by entering the URL as "http://localhost:<port_number>/" the port_number is the number which is mentioned in the command

Example: pydoc -p 8080

For the above command documentation is avail in "http://localhost:8080/" address.

Saturday, February 12, 2011

unzip tarball files:

usually to unzip a *.tar.gz file i used 'tar' command. The syntax of the tar command is:

Syntax:
tar -option file_name.tar.gz

tar -xzfvp file_name.tar.gz
the above command will unzip a tarball file.

but when i tries to unzip it says error 'vp can not open file', so am unable to unzip a file. Then i found a alternative command to unzip a tar.gz files. Its gzip command i command i used to unzip my tarball. The command i used is as follows:

gzip -dc file_name.tar.gz | tar xf -

Sunday, February 6, 2011

stack smashing detected

'stack smash'-"buffer overflow...." when i tried to run a array sort program the following error shows.


*** stack smashing detected ***: ./a.out terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x50)[0x215970]
/lib/libc.so.6(+0xe591a)[0x21591a]
./a.out[0x8048520]
/lib/libc.so.6(__libc_start_main+0xe7)[0x146ce7]
./a.out[0x8048381]
======= Memory map: ========
00130000-00287000 r-xp 00000000 08:09 1574075    /lib/libc-2.12.1.so
00287000-00289000 r--p 00157000 08:09 1574075    /lib/libc-2.12.1.so
00289000-0028a000 rw-p 00159000 08:09 1574075    /lib/libc-2.12.1.so
0028a000-0028d000 rw-p 00000000 00:00 0
00828000-00829000 r-xp 00000000 00:00 0          [vdso]
0085f000-0087b000 r-xp 00000000 08:09 1574071    /lib/ld-2.12.1.so
0087b000-0087c000 r--p 0001b000 08:09 1574071    /lib/ld-2.12.1.so
0087c000-0087d000 rw-p 0001c000 08:09 1574071    /lib/ld-2.12.1.so
0089a000-008b4000 r-xp 00000000 08:09 1572944    /lib/libgcc_s.so.1
008b4000-008b5000 r--p 00019000 08:09 1572944    /lib/libgcc_s.so.1
008b5000-008b6000 rw-p 0001a000 08:09 1572944    /lib/libgcc_s.so.1
08048000-08049000 r-xp 00000000 08:09 655695     /root/a.out
08049000-0804a000 r--p 00000000 08:09 655695     /root/a.out
0804a000-0804b000 rw-p 00001000 08:09 655695     /root/a.out
0962d000-0964e000 rw-p 00000000 00:00 0          [heap]
b781e000-b781f000 rw-p 00000000 00:00 0
b7832000-b7835000 rw-p 00000000 00:00 0
bfbbd000-bfbde000 rw-p 00000000 00:00 0          [stack]
Aborted

when i tries to found why this error happens, then i found i tried to access the array bound limit in my program. when i surf, i found a gcc command, for stack protection,

gcc -fno-stack-protector file_name.c

this command protects the stack overflow...and produces the result when you runs the program,if the error still precedes your program tries to access illegal memory location...

Friday, January 28, 2011

creating and running a python file

create a python file:

vi file_name.py

the extension of python file is .py
to check python libraries are installed on your system, type python in shell, this will shows the version and options in python.

example:
vi hello.py

the above command will create a python file with file name as hello.

running python scripts:

python file_name.py

the above command will run the python scripts.

example:

>vi hello.py
print("Hello world!")

>python hello.py
output:Hello world!

First hello world program in python

syntax:
print("message")

example:
print("Hello world!!")

Wednesday, January 26, 2011

Solution:changing directory delimits to white space.

while changing directory, cd command delimits to white spaces.

syntax:
cd directory_name

is the syntax for changing directory. cd command workout with directory without whitespace.

example:
cd Documents

this will workout. But if the directory name is 'pdf files' cd command

cd pdf files

will wont work out 'cd: pdf no such file or directory' will be the result if there is no 'pdf' directory this is because cd command takes 'pdf' as a directory, which delimits to white space. The cd command resolved by '\' before whitespace. The above example can resolved as,

cd pdf\ files

suppose the directory contains two whitespace i.e,'pdf  files', the command will be,

cd pdf\ \ files.

if your directory is 'pdf\files', then the command for changing directory is

cd pdf\\files.