Apr 27

Giving a new life to old smartphone

My Samsung Galaxy Ace’s battery has become very week lately. It has swollen and been discharging really fast. Whenever I used to connect charger , the battery charge level used go up to 100% within minutes and again discharge within an hour when I start using it. It got discharged within minutes from 100% to 0% while using WI-FI or 3G.

Initially I thought , it may be due to age of the phone (2 years), rooting the phone, installing custom ROM (manufacturer knows the phone best ) or due to partitioning SD card to increase internal storage (phone may be unknowingly accessing my slow class 4 SD card frequently). I also consulted some “Gadget Guru” friends of mine but as expected their knowledge was limited to the user’s and market point of view. They asked me to get a new phone as a 3 year old would have suggested me :) . I completely forgot that fact that in our childhood gadgets we used to change the rechargeable batteries. These days the smart phones are being upgraded so frequently nobody bothers to get a new battery.

Finally I decided to replace the battery for 450 INR and then get a new phone if the phone really had a problem. It has been a week and battery performance has been drastically increased  as if it is a new phone. Here is a screenshot of the battery usage after I charged the battery to only 85%. I read somewhere the battery life increases more when you let the battery discharge below 10% and then charge all the way till 100% (one has to wait even after 100% , phone should say battery is charged.)
Also note that following good practices helps the phone retain charge for longer hours in my experience

  • Keep the WI-FI turned off when not in wi-fi area, phone spends a lot of power just searching for signal
  • Disable Background data use when not required.
  • Create profiles and manage various power settings depending on the usage (Home, work or Car). This feature is available in most of the custom ROMs.
  • Reduce screen brightness  at night time.
  • Close the apps with Back button of Android because they keep running in the background if you press home button. Apple products does magic in this case by putting the background apps to sleep.

Mar 23

Increase your Internal Phone Storage

One of my biggest problem with my phone got solved today. I had been using an old Android phone with only 181 Mb of Internal phone storage. As a result my phone starts complaining after installing few apps, especially the ones which can not be moved to SD card. I have a 16GB SD card installed but its of no use when it comes to running more number of apps. Lately I had to uninstall a lot of my favorite apps and rely on the browser, e.g. I never could install Android apps for Facebook, Twitter, Google+ etc. I always used the mobile websites.

Finally I started searching the workaround for the same. I found that a part of my SD card can be partitioned and formatted as linux file system , so that Android OS considers it as part of phone storage. This is possible for phones which are rooted and I was already using custom ROM from Cyanogenmod.

Galaxy ACE

Note: following will wipe all your data in SD card including music and photos.

  1. Use Mini Tool Partition Wizard Manager to delete the original SD card partition and create two primary partitions as follows
    1. A FAT32 partition with most of the size of the SD card.
    2. An EXT2 (old type file system format to make sure most of the ROM support it), you can try with EXT3 or EXT4 also but I never tested. I kept this partition as 1 GB, I think I will never run out of this space , adding apps.
  2. Click “apply” to commit the partition changes  and format the SD card.
  3. Copy and unzip the system.zip file on to the SD card.
  4. Put the SD card back in the phone and start the Terminal Emulator app of the rooted phone.
  5. copy the file 40int2ext file (found in the system.zip file ) in /system/mnt/etc/init.d directory of the phone. I used the “cp” command and changed the permission of the destination directory for writing file after changing the user to super user (su). You may have to click “allow” while changing the user.
  6. That’s it, I rebooted and phone and saw the internal memory has been increased to almost 1 GB.

Wow ! that was great, I immediately loaded the phone with all the apps I always wanted to install.
I was surprised to see that the performance did not decrease noticeably even tough it is a low class SD card. I will continue to test by installing more apps.

Finally a word of caution : Do this only if you fine in case the phone or the card does not work after this experiment.
However if experiment is successful , you will never see the “insufficient storage” or “low memory” error :)

Source

Mar 08

Recursively find list of files in a directory in Python 2.2

I have been using python for writing small utility programs. Till now I avoided scripting languages like python because I though shell script is master of everything and works in any linux computer. They also have all programming constructs like loops and conditions etc. However when it came to quickly get some work done, shell script too a lot of time write a error free program. Finally I jumped to python to do some file batch processing.

The most fundamental need to batch file processing is to iterate through all the files in a given directory. I could found several ways to do so using os.walk function but my old linux server had only Python 2.2 and I did not want to FTP files to my local PC to server back and fourth . So here is the code which also works in old version of python.

 

import os

# finds all the files in a directory recursively 
def listAll(dirName):
    filelist1=[]
    files = os.listdir(dirName)
    for f in files:
        if os.path.isfile(os.path.join(dirName,f)):
            filelist1.append(os.path.join(dirName,f))
        else:
            newlist=listAll(os.path.join(dirName,f));
            filelist1.extend(newlist)			
    return filelist1 
# root directory path
rootdir= '/home/'  

for f in listAll(rootdir):
    print "Absolute Path " + os.path.abspath(f)
    print "File Name"      + os.path.basename(f)
    print "Directory Path" + os.path.dirname(f)
    # Change directory 
    os.chdir(os.path.dirname(f))
    # print current directory 
    os.system("pwd")
    print os.getcwd()
    # check file extension
    if not ( f.endswith(".java") or or f.endswith(".xml")):
        # Do nothing 
        continue


Older posts «

Plugin from the creators of Brindes Personalizados :: More at Plulz Wordpress Plugins