Search This Blog

Friday, April 19, 2013

Working with multiple Python projects

While working with multiple Python projects, you might soon realize you need different versions of the same Py package or packages are conflicting between multiple projects.
VirtualEnv to your rescue.
But once you go through the docs, install and start using virtualenv, you might soon realize it is a little cumbersome.
  1. You need to provide the complete path where you want to save your virtualenv environment folder. virtualenv proj1 will just create the env in your current directory. If you are using a long path to store your envs, it might be a pain to put it in every-time.
  2. To activate an env, source <path-to-envs>/proj1/bin/activate
  3. To find all envs, you have to ls <path-to-envs>. But this works only if you have all yours envs in a single place.
Don't worry, VirtualEnvWrapper is here to help you.
Now you have a wrapper which provides you some shortcuts to the virtualenv commands. But it doesn't end there. VirtualEnvWrapper provides you with the an extension system.
ls $WORKON_HOME and you will find files starting with "post" and "pre". These are simple shell scripts. You can add your commands to these scripts and they will be everytime you run one of the commands.
It doesn't end there. You can also have separate extensions for each of your env. ls $WORKON_HOME/proj1/bin/ should show some similar files starting with "post" and "pre". For eg. To go to your source folder when you activate your env, just add "cd to "postactivate"
All said and done, one thing that might trouble you is figure out what packages are available in your current env?
Yolk will prove useful here. Remember, you can write extensions in wrapper. Just add pip install yolk to "$WORKON_HOME/postmkvirtualenv" and yolk will be installed on all new virtual envs created automatically. You can then activate your env and just use yolk -l to list packages available in that env.
Not much time for formatting. Will do it later.

Wednesday, April 03, 2013

Install CyanogenMod 10.1 (JellyBean Android 4.2.2) on Samsung S2 Skyrocket

Before you begin:

  • You NEED a windows machine (atleast as of now) for odin.
  • Download using Chrome/ Firefox to avoid issues with tar/ md5 downloads.
  • Read all steps before you start anything.

5 simple steps:

  1. Download CyanogenMod 10.1 and gapps, copy it on the internal external SD card
  2. Download and run odin on Windows machine
  3. Download and install TWRP using Odin
  4. Boot in recovery and install the ROM using TWRP
  5. Install gapps using TWRP

Lets get going:

  1. CyanogenMod 10.1:
    1. Go to http://get.cm/?device=skyrocket
    2. Select the type of build
      • Stable - Stable. Well tested. But will not have latest features.
      • Nightly - Nightly builds. Latest features added but unstable.
      • M snapshot (Experimental) - Similar to nightly. You could call them monthly builds. Somewhere between stable and nightly.
    3. Copy the file onto the phone using USB transfer.
  2. GApps
    1. Go to http://goo.im/gapps
    2. Download the gapps which match your CyanogenMod version.
    3. Copy the file onto the phone using USB transfer.
  3. TWRP (Similar to clockworkmod [CWM])
    1. Download TWRP from http://d-h.st/Xo2
  4. Odin
    1. Download odin from http://forum.xda-developers.com/attachment.php?attachmentid=925569&d=1330549534.
    2. Extract the zip.
    3. Run the exe.
    4. Check "auto-boot". Uncheck all other options
    5. Click on "PDA" button. Select TWRP tar file.
    6. HOLD YOUR HORSES HERE
  5. Process - Install TWRP
    1. Put the phone into download mode. (Download mode is different from recovery mode.)
    2. Connect USB cable to computer but not the phone.
    3. Shutdown and remove the battery of the phone
    4. Wait for sometime and reinsert the battery.
      • AT&T - Hold both volume buttons.
      • Rogers - Hold only volume down button.
      (Do not release the buttons until instructed to do so. Do not touch the power button.)
    5. Insert the usb cable into the phone. The phone will boot up. When you see a download mode page with a little yellow triangle at bottom, release the volume button(s).
    6. Now press the volume up button as per the instructions on the screen to continue to download mode.
    7. Odin should have recognized your phone now. You should see a green box with com port listed.
    8. Click start in Odin.
    9. When odin is finished flashing, you should see a green box with Pass written right above the com port green box.
  6. Process - Install CyanogenMod 10.1
    1. Put the phone in recovery mode:
    2. Turn off phone and unplug USB.
    3. Hold down both volume keys.
    4. Hold power button till you feel the phone vibrate. (Release only power button, not the volume keys when the phone vibrates.)
    5. When the screen goes black, release volume keys.
    6. You should now be in recovery mode.
    7. It is a good idea to backup here.
    8. Click on install button.
    9. Select the cyanogenmod zip file from internal/ external sd card and follow on screen instructions to complete the install.
    10. Click Home.
    11. Click Wipe.
    12. Click on Cache, Dalvik Cache and Factory Reset.
    13. Click on back button.
    14. Click on Reboot -> System.

Since we reset cache, the first boot could take 5-10 mins. But if it is taking longer, go to recovery mode and try other options in Wipe menu of TWRP. Then reboot.

On first boot, you might panic to see none of the Google related apps available. Not even Google Play. Thats where the gapps we downloaded come into picture.

  1. Install GApps
    1. Go to recovery mode.
    2. Click Install and select the gapps file. Complete the install.
    3. Reboot.

You should be good to go.

References

Need some more time to work on the post formatting. But instructions are pretty much covered.