Friday, October 30, 2009

Nice cons about Ubuntu 9.10

ZDNet told some interesting but real cons about Ubuntu 9.10 in the comparison with Windows 7. To install Ubuntu 9.10, you need to find the installer CD which is not available like Windows 7. You need to download the ISO of Ubuntu then burn it to CD then install. But for Windows 7, just buy it and install it. So getting Ubuntu installer CD is a problem for the normal user. To install Windows 7, one may need to buy a new PC with good hardware but in case of Ubuntu 9.10, all hardwares in the market don't work perfectly coz the manufacturers don't provide the driver of their products.Everybody knows the problem of codecs and the proprietary DRM for the media formats which is a little bit problem for the normal user. You can read it from here ...

Thursday, October 29, 2009

Google Transliteration

Its very difficult to type complex script without the help of a software. We always use third party software to write complex script. But during travel and if we don't our netbook, the its impossible to write our language. Google India Labs developed a transliteration system. Its very easy to use it. You can write your language directly in the text box. Currently it is supported for Arabic, Bengali, Gujarati, Hindi, Kannada, Malayalam, Marathi, Nepali, Persian, Punjabi, Tamil, Telugu and Urdu. Go to http://code.google.com/p/t13n/ to know how to use it. 

Wednesday, October 28, 2009

Python threading: An experience as newbie

I was trying to use threading in my python program and as I am new in python I need to learn the Threading. I was googling for a quick example of python threading and I found the following program from here.

import threading
import datetime

class ThreadClass(threading.Thread):
    def run(self):
        now = datetime.datetime.now()
        print "%s says Hello World at time: %s" %(self.getName(), now)
       
for i in range(2):
    t = ThreadClass()
    t.start()
When I run it, its give the following error:
Traceback (most recent call last):
  File "threading.py", line 1, in
    import threading
  File "/home/murtoza/pyro/threading.py", line 4, in
    class ThreadClass(threading.Thread):
AttributeError: 'module' object has no attribute 'Thread'


I just copy the code from the net, and it should run perfectly but why its not running!!! Whats the problem in the code? I had no idea. I googled by the keyword AttributeError: 'module' object has no attribute 'Thread'and found this. Its the same error, same OS. And I got the solution in the second page.

What I did? I coped the code from net, made a file named threading.py and pasted the code. Then run it by $ python threading.py command. The compiler got confused. The first line of the
code is import threading . Which treading file compiler should import. The file I made or the file system has? Both file's name is threading.py . The priority is the file I made, and there is no Thread inside my file. Actually this file is not a library. So I just rename my file as threadTest.py and its work perfectly.

Thursday, October 22, 2009

Female uses Gmail more and male uses hotmail

RapLeaf shows in a study that Gmail users are mostly female and Hotmail users are mostly male. RapLeaf also gave a statistics of users according to age; older people use AOL and younger uses Gmail. Read more...


Google Chrome Portable

To download portable version of Google Chrome go to the following link:

http://portableapps.com/apps/internet/google_chrome_portable

Monday, October 19, 2009

Writing Unicode file in Python

Just use the following code to write an Unicode text in a file by Python.
out = file("Unicode-File.txt", "w" )
out.write(codecs.BOM_UTF8)
s = "any Unicode text"
out.write( s.encode( "utf-8" ) )

Saturday, October 17, 2009

Bold, italics, and strikethrough in Gmail chat

Many of us don't know how to use bold, italics, and strike through in gmail chat but we use google talk every day. Its very easy to do it.
To bold a text, put the text between asterisks, e.g *bold*
To italics a text, put the text between underscores, e.g. _italics_
To strike through, put the text between hyphens, e.g. -strike through-

Friday, October 16, 2009

Google Docs previews in Gmail

Its great coz now I can see Google documents, spreadsheets, or presentations right in my Gmail inbox. For this I needed to enable a new Gmail Labs feature, Google Docs previews, that is released today.


Its a great feature for those who use Google Doc and share with friends, office mate, and others. Why need this feature as we can see the document in the new tab by clicking the shared link? My question, why i need to open another tab to see whats inside the doc? As its a Google product, why i can't see inside the Gmail? Remember the lab user, when Gmail Lab team made a great lab feature to view the YouTube videos, Yelp reviews, and Picasa and Flickr albums inside the Gmail. It was a great feature for me also its help me to save my time. This feature will also save my time a lot.

For more information on Google Docs previews in Gmail, check the Gmail blog post .

Wednesday, October 14, 2009

Got the wrong Bob?

Got the wrong Bob? is a new lab feature of Gmail. As gmail made us lazy, so we don't wanna type the full email address. We just type the first few char of the email address or the name. So there is a great chance of sending the email to a wrong person. I ever sent my mobile contact backup to a public group in place of my back email address. My colleague sent an informal email to our boss in place of me mistakenly coz the first two char of my name and my boss's name is same.

These things happen as we are becoming lazy coz of gmail's contact suggestion and now gmail is helping us to prevent this type of mistake. Got the wrong Bob? is a lab feature that can help us so that we can't do these type of mistake.

But to prevent sending email to wrong place, we need to be careful.

I got Google Wave

I got an invitation of Google Wave from one of my friend. He got it few months ago. I was really happy to get that invitation. Its took few days to get the invitation after my friend invited me. When he invited me, they said "Invitations will not be sent immediately. We have a lot of stamps to lick."





I added the Sudoku Extension and played together with friends. Its really enjoyable to play like that.


I didn't get any option to send invitation, so I can't send any invitation. There are many of my friends are asking for the invitation now. I hope googlewave will give me the option to send invitation soon.

Tuesday, October 13, 2009

Add Blogger to Webmaster Tools

go to webmasters
Click the Add a Site.. button.

Copy the blogger URL address and paste, then click Continue



Copy the meta code.


 Go to blogger Layouts and Click Edit HTML. Then paste the meta link just belo
 

Then click SAVE TEMPLATE


now back to webmaster and click Verify


Its done in less than 7 steps :)

Sunday, October 11, 2009

copy files over ssh

Following command can be use to copy files across an ssh (Secure Shell) connection by scp  (Secure Copy) in Linux. Its encrypted and secured.

one file
scp file.ext user@192.168.1.101:/home/user/directory/

many files with same extension
scp *.ext user@192.168.1.101:/home/user/directory/

a directory/folder
scp -r dir/ user@192.168.1.101:/home/user/directory/

Saturday, October 10, 2009

MySQL Insert from another table

Its easy to insert data to a table from another table in MySQL by query. 
insert into database01.table1 (c1, c2, c3) select cx1, cx2, cx3 from database02.anotherTable

Friday, October 09, 2009

Find all files and folders in JAVA of a given file path and work on it

This function takes a file path, then checks whether is it a folder or not. if it is a folder then finds all files under it. It also checks is the file hidden or not and the file format. Here i checked text (.txt) file.
private void findFileFromFolder(java.io.File file){
    if (file.isDirectory()){
        java.io.File subFile[] = file.listFiles();
       
        for (int i = 0; i < subFile.length; i++){
            if (subFile[i].isDirectory()){
                this.findFileFromFolder(subFile[i]);
            } else {
                if (!subFile[i].isHidden() && this.isExtension(subFile[i], "txt")) {
                  
this.doFileProcess( );
                }//if
            }//else
        }//for
    } else {
      
this.doFileProcess( );
    }
}


private void doFileProcess( ){
    /// todo: add your file code
}

Encode / Decode your HTML Entities

http://centricle.com/tools/html-entities/
http://htmlentities.net/
http://www.webatic.com/run/convert/html_entities.php
http://www.onlinetoolscollection.com/htmlentities_encoder.php








HTML Entities Encode / Decode Tool © Dev Mechanic™



HTML Code
HTML to Encode

Encode / Decode
Encode / Decode HTML Entities
Encode
Decode

Enter Captcha To Continue
To prevent spamming, please enter in the numbers and letters in the box below



Report Problem with Tool.




http://tools.devshed.com/?option=com_mechtools&tool=27

CSS Media Types

While linking the style sheet by <link> element, we can specify the devices by using optional attribute called media.

CSS for all devices (Default):
<link type="text/css" rel="stylesheet" href="your-css.css" />

CSS for computer screen:
<link type="text/css" rel="stylesheet" href="your-css.css" media="screen" />

CSS for printer:
<link type="text/css" rel="stylesheet" href="your-css.css" media="print" />

CSS for hand held (mobile phone, pda, etc):
<link type="text/css" rel="stylesheet" href="your-css.css" media="handheld" />

CSS for speech browser:
<link type="text/css" rel="stylesheet" href="your-css.css" media="aural" />

CSS for tactile readers:
<link type="text/css" rel="stylesheet" href="your-css.css" media="braille" />

CSS for paged braille printers:
<link type="text/css" rel="stylesheet" href="your-css.css" media="embossed" />

CSS for presentation and slides:
<link type="text/css" rel="stylesheet" href="your-css.css" media="projection" />

CSS for teletypes and terminals:
<link type="text/css" rel="stylesheet" href="your-css.css" media="tty" />

CSS for televisions:
<link type="text/css" rel="stylesheet" href="your-css.css" media="tv" />

Thursday, October 08, 2009

Validate your CSS

Validate your HTML/XHTML code

validator.w3.org

Cursive Font Family


Cursive Family
Handwritten types of fonts are in Cursive Font Family.




Fantasy Font Family

There are five families of fonts:

Serif Family
Sans-serif Family
Monospace Family
Cursive Family
Fantasy Family
Fantasy Family
Stylish decorative fonts are in Fantasy Font Family.


MySQL unicode query in python

It’s very easy to run MySQL Unicode query in python. Just use the Unicode string by putting u on the front of string and use \u for Unicode char.

q = u"select * from tableName where column01 = \"\u09e7\u09e8\""
cursor.execute(q)

Wednesday, October 07, 2009

Monospace Font Family


Monospace Family

Fonts having constant width glyph are in the Monospace Font Family. People generally use these fonts to show computer code.



Sans-serif Font Family


Sans-serif Family

The fonts that have no serif are in Sans-serif Family. These fonts are very good for reading on a computer screen. See the following picture for example. Sans-serif means “without serif”. 






Serif Font Family




Serif Family

Serif is not a name of font. The fonts having serifs in the glyph are in Serif Family. These fonts are good for printing especially for news paper. You can see the barbs and hooks on the ends of the letters in the following picture; these are called serif.


Calculating elapsed Time in python

import time

startTime = time.time()
myWorkHere() #do your work here
endTime = time.time()
print "Total time elapsed = ", endTime - startTime, "seconds."