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.

Monday, January 24, 2011

Renaming a Column in a table

To rename the columns(attributes)in a table the syntax is as follows:

syntax:

alter table table_name rename column current_column_name to new_column_name;



Example:


alter table student rename column stud_dept to dept_id;

Renaming a Table name

To rename the table name the syntax is as follows:

Syntax:
rename current_table_name to new_table_name;

Example:


rename students to student;

Monday, January 3, 2011

SQL SERVER – Definition, Comparison and Difference between HAVING and WHERE Clause

In recent interview sessions in hiring process I asked this question to every prospect who said they know basic SQL. Surprisingly, none answered me correct. They knew lots of things in details but not this simple one. One prospect said he does not know cause it is not on this Blog. Well, here we are with same topic online.

Answer in one line is : HAVING specifies a search condition for a group or an aggregate function used in SELECT statement.

HAVING can be used only with the SELECT statement. HAVING is typically used in a GROUP BY clause. When GROUP BY is not used, HAVING behaves like a WHERE clause.

A HAVING clause is like a WHERE clause, but applies only to groups as a whole, whereas the WHERE clause applies to individual rows. A query can contain both a WHERE clause and a HAVING clause. The WHERE clause is applied first to the individual rows in the tables . Only the rows that meet the conditions in the WHERE clause are grouped. The HAVING clause is then applied to the rows in the result set. Only the groups that meet the HAVING conditions appear in the query output. You can apply a HAVING clause only to columns that also appear in the GROUP BY clause or in an aggregate function. (Reference :BOL)

Example of HAVING and WHERE in one query:

SELECT titles.pub_id, AVG(titles.price)
FROM titles INNER JOIN publishers
ON titles.pub_id = publishers.pub_id
WHERE publishers.state = 'CA'
GROUP BY titles.pub_id
HAVING AVG(titles.price) > 10

Sometimes you can specify the same set of rows using either a WHERE clause or a HAVING clause. In such cases, one method is not more or less efficient than the other. The optimizer always automatically analyzes each statement you enter and selects an efficient means of executing it. It is best to use the syntax that most clearly describes the desired result. In general, that means eliminating undesired rows in earlier clauses.

Sunday, January 2, 2011

HTML Tags.

The following are tags using in HTML 5.


<!-->
<!DOCTYPE>
<a>
<abbr>
<acronym>
<address>
<applet>
<area>
<article>
<aside>
<audio>
<b>
<base>
<basefont>
<bdo>
<big>
<blockquote>
<body>
<br>
<button>
<canvas>
<caption>
<center>
<cite>
<code>
<col>
<colgroup>
<command>
<datalist>
<dd>
<del>
<details>
<dfn>
<dir>
<div>
<dl>
<dt>
<em>
<embed>
<fieldset>
<figcaption>
<figure>
<font>
<footer>
<form>
<frame>
<frameset>
<h1> - <h6>
<head>
<header>
<hgroup>
<hr>
<html>
<i>
<iframe>
<img>
<input>
<ins>
<keygen>
<kbd>
<label>
<legend>
<li>
<link>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
<xmp>





Saturday, January 1, 2011

Shell Environment.

To find all available shells in our system type following command.

syntax: 
cat /etc/shells


To find our current shell type following command.

syntax:

echo $SHELL