The beginning of Django !!!

Hi… all .. Since it was long time for me . I actually stopped learning python. But my first job was in Android . When was working in Android app development ,i felt something is missing and more over i want to continue my learning in python and my other interested one’s .Yes the time came for me. Now i’m in job in my favorite language .This is the time i can learn my interested language and make use of this opportunity . So friends i try to explain  Django(web framework) from the scratch in my upcoming posts .

Happy coding !!!!!


How to format pendrive or Memorycard or USB in ubuntu by Terminal

Hi…all today ..i tried to to format by pendrive by our file manager. But sometimes it fails to format.So we have to format it by terminal.

After plugging your device(usb or pendrive or memory card).

Open Terminal(cntrl +Alt + T)

type the command as $ dmesg | Tail

it will display like this

[ 1749.108796] sd 9:0:0:0: [sdb] Write Protect is off
[ 1749.108813] sd 9:0:0:0: [sdb] Mode Sense: 43 00 00 00
[ 1749.109803] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.109816] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.116895] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.116906] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.118911]  sdb: sdb1    –> Things to be noted
[ 1749.122785] sd 9:0:0:0: [sdb] No Caching mode page present
[ 1749.122800] sd 9:0:0:0: [sdb] Assuming drive cache: write through
[ 1749.123771] sd 9:0:0:0: [sdb] Attached SCSI removable disk

Then Unmount your device by

$ sudo umount /dev/sdb1

Finally Enter this command to format Your device

$ sudo mkfs.vfat -n ‘Ubuntu’ -I /dev/sdb1

Thats it….Now plug out your device and plug in again to use . Your device is now formatted and ready to use now..

Happy coding!!!!

How to fix subtitles delay or ealier with your movies by python code

Hi..all …today i was watching movie with subtitles . I had delay with my subtitles files ,like  subtitles mismatch with  the every scenes of movie.  .

I sloved this issue by python code .Subtitles are in .srt format. (e.x) Pirates of the Caribbean -The Curse of the Black Pearl(2003).srt

I found that i got delay by 2 minutes in my .srt file

Library that  i used : pysrt

Open your terminal (cntrl+alt+t)

type python —> enter into python interpreter mode

import pysrt

if you got any error like –> no moduled named pysrt.  then you need to install pysrt .To install pysrt – sudo easy_install pysrt

for python3 users its available pysrt3

if don’t get any error then you already have this library.

now , if you want to make a delay in .srt file means do like this


>>> subs.shift(seconds=-2) # Move all subs 2 seconds earlier
>>> subs.shift(minutes=1)  # Move all subs 1 minutes later

finally save this file from your terminal by

>>>'path to ur location/', encoding='utf-8')

My Entire code which sloved my delay in .srt file

#! usr/bin/python
import pysrt
subs=open("/home/bala/Pirates of the Caribbean -The Curse of the Black Pearl(2003).srt")
subs.shift(minutes=-2) # Move all subs 2 minutes earlier'/home/bala/', encoding='utf-8')#saves file with in your home directory

This sloved my problem .
Thats it..   Happy coding !!!!

Android Splash Screen Activity

Hi . all i’m going to share about android splash screen activity .

Now Most of the applications coming with splash screen .Before going into session ,make sure you have made the development environment to develop application in android.

Development tools needed for Android are


2.Java Runtime Environment

3.Android ADT and Android Sdk

4.Android API

You can develop application from “Android Studio” also . Its upto to you people. I’m not going to tell about installations and and setting up environment.You can find lot of good tutorials to do this.

Here in this session i’m telling about developing app in Eclipse

Open up Eclipse and create new Android Application Project.

project name i given here is FreeTamilEbooks

package name for me here is com.ebook.freetamilebooks

If you created project in eclipse means you can see the file structure like this

Screenshot from 2013-10-01 21:02:16

in src folder you can see java files.

in layout folder you can see xml files.


Things to remind here .

UI part of the application was done in xml in layout folder.

The coding Part done in java in src folder.

Confusing ?? let me clear this.

UI in the sense , lets imagine a button in a screen,

now for creating a button in a screen you have to use xml in android (dynamically can create in java)

For Actions like clicking a button etc . have to be coded in java .

now got clear with this. I hope u got some idea about this.

now open up java file in src folder .My java code with

package com.ebook.freetamilebooks;

import android.os.Bundle;
import android.os.Handler;
import android.content.Intent;
import android.view.Menu;
import android.view.Window;

public class SplashScreen extends Activity {

	protected void onCreate(Bundle savedInstanceState) {
		 Handler handler=new Handler();
	        handler.postDelayed(new Runnable()
	            public void run() 
	                Intent intent = new Intent(SplashScreen.this,Home.class);
	        }, 3000);

	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(, menu);
		return true;


java code for second Screen

package com.ebook.freetamilebooks;

import android.os.Bundle;

public class Home extends Activity {
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub


my xml codes are 

<RelativeLayout xmlns:android=""
    tools:context=".SplashScreen" >

my home.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android=""
    android:orientation="vertical" >
        android:text="Welcome to home "/>

Finally one important thing to do with AndroidManifest.xml

this xml file is like guidemap . While running our app this file gets executed first and tell the activites ,and necessary things to the emulator.

Android uses DVM (Dalvik Virtual Machine) . It combines java and xml code into .apk format.
java files gets compiled by JVM(Java Virtual Machine)

By default your very first activity is specified in this file. If you have more than one activity you have specify the activities in this file. Else your application won’t work .


<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=""
    android:versionName="1.0" >

        android:targetSdkVersion="18" />

        android:theme="@style/AppTheme" >
            android:label="@string/app_name" >
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
       <strong> <activity
            android:label="@string/app_name" >


one last thing to do for splash screen . We need an image to show at very first screen of our app.

so choose your image .It must be in .pngformat.
create folder named drawable under /resdirectory in eclipse.

Here i named the image as splash.png . I used that image as in activity_splash.xml like this

you can give any name to your image and make sure same name in while using in xml file too.

Thats it . Now save your file and press Contrl+F11

After home launched from emultor you can see the page like this

Screenshot from 2013-10-01 23:02:00

Thats it. Thanks for reading. Happy coding!!!