Thursday, 16 February 2012

Linux / Ubuntu - Steps to Compile QTMultimediaKit inside QT Mobility 1.2



Steps to Compile QTMultimediaKit inside QT Mobility 1.2

QT ships its valuable Multimedia Kit inside QT Mobility. Now this kit is shipped only in the QT Mobility package which is available for Mobile platforms, for QT Mobility package which are meant for the Desktop OS such as Linux, Windows or Mac, this multimedia kit is unavailable. i.e. If u want to use the valuable elements of this Multimedia Kit in your QT Desktop application then you are out of luck. However, by following the below steps we can compile the unavailable QT Multimedia Kit for Linux / Ubuntu and then make its elements available for our QT application.

  • First we need to place the “qmake” of Desktop framework in our path. for this we will make its symbolic in /usr/bin, Moreover if u have any already present "qmake" item present inside this directory then make sure to remove it before applying the following commands :
    • cd /usr/bin
    • sudo ln -s /home/junaid/QtSDK/Desktop/Qt/4.8.0/gcc/bin/qmake qmake
(In this case I have my QTSDK placed in the /home/junaid. This has to be changed according to ur own arrangements )
  • Get the source code for QT Mobility 1.2 from http://get.qt.nokia.com/qt/add-ons/qt-mobility-opensource-src-1.2.0.zip
  • extract in the desired folder. NOTE: All the libraries and required files will be created in the extracted folder. So place this extracted folder at a place where u can easily locate your libraries.
  • Before going Forward to Compiling the Multimedia kit inside this Mobility framework, We will first install the (known) dependencies. execute following commands in the terminal to make sure that you fulfill the dependencies:

    • sudo apt-get install gstreamer0.10-x
    • sudo apt-get install gstreamer0.10-plugins-base
    • sudo apt-get install gstreamer0.10-plugins-good
    • sudo apt-get install gstreamer0.10-plugins-bad
    • sudo apt-get install gstreamer0.10-plugins-bad-multiverse
    • sudo apt-get install gstreamer0.10-plugins-ugly
    • sudo apt-get install gstreamer0.10-ffmpeg
    • sudo apt-get install libgstreamer0.10-dev
    • sudo apt-get install libgstreamer-plugins-base0.10-dev
    • sudo apt-get install libgst-dev
    • sudo apt-get install gstreamer0.10-alsa
    • sudo apt-get install gstreamer0.10-pulseaudio
    • sudo apt-get install libglui-dev
    • sudo apt-get install libasound2-dev
    • sudo apt-get install libxv-dev
    • sudo apt-get install libxv1
    • sudo apt-get install libxvmc-dev
    • sudo apt-get install libxvmc1
    • sudo apt-get install libxvidcore4

  • Now That our dependencies seems fulfilled, we can move forward to compile our QT MultimediaKit. (Please Note that in my case the downloaded source is present in /home/junaid/Downloads/qt-mobility-opensource-src-1.2.0 )
    • cd /home/junaid/Downloads/qt-mobility-opensource-src-1.2.0
    • ./configure -modules multimedia
    • make
    • sudo make install
  • In the above commands we have explicitly mentioned that we want to compile only the “multimedia” Module of the QT mobility framework, hence the “make” and ‘make install” commands only compile the code that completely builds the multimedia kit inside mobility.
  • Now once we have our libraries and other required files compiled and installed, we need to do one Last and very important step without which all our efforts will be useless i.e. we have to export the Library Path in which the compiled libraries are placed.
  • Above steps will place the libraries at “/home/junaid//Downloads/qt-mobility-opensource-src-1.2.0/lib” so we will export this path using following command
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/junaid/Downloads/qt-mobility-opensource-src-1.2.0/lib/

Now you are all set to utilize the multimedia components of QT mobility inside your QT or QML application for Linux/Ubuntu. Enjoy :)

Friday, 10 February 2012

Android - Setting Up Development Environment.


Setting Up Android Development Environment.

Okay I know this is very basic thing but as my blog says, its Knowledge Dump, Any thing big or small should be shared so here i go. Setting up Android development environment consists of following very easy steps:
First 2 steps are pretty straight forward and self explanatory. However, the 3rd step needs some explanation and is mentioned in the below section.

Setting Up Android SDK inside Eclipse:

Ok now that we have our dependencies and IDE ready, we need to integrate the Android’s SDK and Android Development tools with our IDE i.e. we have to make our IDE capable of developing Android Applications. For this First we will have to install the Android Plugin for Eclipse so that it can help in the integration of Android SDK tools and Android Development Tools with our Eclipse IDE.
For Installing Android Plugin open Eclipse->help->Install New Softwares. Click ‘Add’ and this will show you a dialog having ‘Name’ & ‘Location’ fields. Enter any name in the ‘Name’ field say Android Plugin or ADT Plugin. In the ‘Location’ field enter https://dl-ssl.google.com/android/eclipse/. If this doesn’t work then try the link with simple “http”. Click ‘Ok’ and eclipse will show you the available softwares/plugins on this url that can be installed. Select all and install them.  Once Installed Eclipse might ask you to restart the IDE.
 Restart the IDE and now in ‘Window’ menu you can see “Android SDK Manager” and “AVD manager”. Select the “Android SDK Manager” and it will show you available Packages such as Tools, SDKS and Extras. Select available packages in ‘Tools’ and at least one SDK say “Android 2.2 (API 8)” and then Install them. Once Installed you are all set to develop applications for android by simply going into File->New->Other->Android Project.

Papa Reference:

Android - Steps for Signing & Making Publish Ready App.


Android - Steps for Signing & Making Publish Ready App.

Following are the steps involved in Signing and making your Android App publish ready. These steps should be followed in the same order as written in this document while Publishing an App to Android Market. Before you move towards the Signing and Publishing Steps; there are few things you have to take care in your App.
  • First of all we need to do proper versioning of the App. Versioning is important for the future updates. There are 2 fields in the Application Manifest file that determines the version of the App. First is “android:versionCode”  this represents the number of times the app is being put on the App Store. For first time it is “1”. Second Parameter is “android:versionName ” this is the version that u want users to see. It is a string and can contain major,minor version name. e.g “0.8.5
  • Once versioning is done next thing is to declare minimum, target and maximum API Level in the manifest file. Its good to mention just minimum SDK Level.
  • Disable : “Debuggable” & “Allow Clear User Data” in the Manifest File. 
  • Disable all the Logs in your app.
  • Register for a Maps API Key by sending the MD5 hash of the certificate with which we are going to sign our application. Once we get the Maps Api key then we use it in our application by mentioning this in the mapview layout( if your application is using MapView element). There are 3 steps of generating Maps api key for the application, first is to locate the “keytool” in your JDK, then use it to generate the MD5 hash of the certificate with which you are going to sign ur application. And finally use this MD5 hash to get the maps Api key.
  • To take the MD5 finger print hash of the certificate we first have to make sure that the ‘keytool’ is in our windows PATH variable. If not then add the path of the keytool in ur environment variable. The keytool needed for generating the MD5 hash is present in the “bin” directory of ur JDK i.e. the path will be something like this: C:\Program Files\Java\jdk1.6.0_17\bin
  • Once u have added the path of keytool in ur environment variables then open the command promp and use the following command to generate the MD5 hash
keytool –list –alias Appkey –keystore c:\MyKeystore
here the “Appkey” is an example alias for the key present in the example keystore “MyKeystore” located on the ‘C’ Drive
  • The above command will ask u for the password of the key and will then generate MD5 hash of the certificate.
  • Go to http://code.google.com/android/maps-api-signup.html and enter the MD5 fingerprint of the certificate calculated above and hit the “Generate Api Key” Button and get the Google Maps Api key. Now use it in the xml layout of the MapView.
  • Now we can proceed towards signing and publishing.
  • You should first Compile the application in Release Mode to get an Unsigned “.apk” package, Sign it using the keystore and then finally Align the package with zipalign.exe.
  • The above steps of Release Compile, Signing and Aligning can easily be done using Eclipse Export tools. Moreover it can also Create a KeyStore if u don’t have one.
  • Keystore contains the keys being used by you for signing application. The keys can be referenced in the keystore by there Alias.


Note: Keystore can contain number of Keys and each key in the keystore references to a Certificate binded with it. Moreover, both keystore and keys have their own Passwords however its more convenient to use the same password for both keys and keystore.

Papa Reference

Tuesday, 29 November 2011

Upgrading Android ROM


The process of upgrading android ROM consists of over all 4 basic steps.
  • Root your Android device, i.e. get root permissions for your android device.
  • Flash Andriod recovery image on the ROM.
  • Getting Right Android ROM for your device.
  • Flash Android ROM on the device using the recovery tool at the startup.



  1. Rooting Android Device

Android is Linux based and hence has root account which is set as a super user. Rooting is a mechanism to get root access on your android device. There are 2 mechanisms of rooting an android device.

Easy Mechanism :
  • Download android application for rooting the device from AndRoot link or Alternate AndRoot link. (The downloaded file should have ‘.apk’ extension)
  • Plug in your android device with the computer and transfer this file to the sdcard of your phone.
  • In your phone go to Android Market and install AndExplorer (or any good File Explorer).
  • Open AndExplorer after installation and go to sdcard, click on the AndRoot application file that you transferred earlier. You will see a prompt to install the application AndRoot. Go through the steps and install AndRoot.
  • Once installed open AndRoot application, Select the android version of your device and select the button that says anything about rooting the device.
  • It will take some time and viola you are done with rooting your device.


Advance User Mechanism:


  1. Flashing Android Recovery Image

Recovery Image is a 3rd party recovery tool that lets you load up a utility at the device startup i.e. before android loads. By using this tool you can create and restore the backups of your android device, Wipe out data of your device and most importantly Flash an Android ROM on the device (i.e. Upgrade Android OS). You can flash the recovery image by following these steps:
  • Go to android market from your phone and install “ROM Manager” by CLOCKWORKMOD.
  • Open the application and select the first option of “Flash ClockworkMod Recovery”.
  • It will try to detect ur phone set and asks to confirm your phone model. confirm your phone model. It will then flash the Recovery Image on your device in around 10 - 15 secs.
  • Now you are ready to boot your device in the Recovery Tool by starting your device by holding “power” & “Home” keys. But you obviously need to get the Android ROM image before booting into this revover tool. Other wise its point less in roaming around the recovery tool when you don’t have any Anroid ROM to flash.



  1. Getting Right Android ROM For Your Device

Probably one of the most important part of this whole process is to have an authentic/popular Android ROM for your device. For this purpose you are totally dependant on Internet Community. XDA Developers is a great place to search for the Android ROMs for your device. In my case, I needed Android’s Froyo (i.e. Android 2.2) ROM image for HTC hero. After searching Over the web  this great link for HTC hero ROMS was found, out of which this (from ‘Froyo ROM’ option) one ROM with the highest ranking was picked.
Make sure you download the ‘.zip’ ROMs mentioned in the links in this post via a relaible download manager. Downloading the ‘.zip’ ROM via a browser could be risky because the download can be interrupted and you will be left with the broken ROM.

NOTE: If the link from where you downloaded the ROM also gives you the info of the MD5 hash of the ROM then to make sure that the downloaded ROM isn’t corrupted, Take MD5 hash of the ‘.zip’ ROM file that you downloaded and compare it with the MD5 hash value given on the download page. If it matches then you are good to go to the step 4 other wise try re-downloading  the ROM with a reliable download manager.


  1. Flashing Android ROM / Upgrade Android OS

The Last and most important step is to Flash the Android ROM (downloaded in step 3) on your device. Follow these steps to Flash the new Android ROM on your device:
  • Plug in ur android device with your computer and transfer the downloaded Android ROM on ur SD Card’s root i.e. right on the sdcard and NOT in any folder inside the sdcard.
  • Rename the ROM file to update.zip
  • Power off your device. Power it back On while holding both “power” & “home” keys.
  • The device will now boot in the recovery tool. Once in the recovery tool first of all take the backup of the device by going into “backup and restore” -> “Backup”. This backup could be used to restore your device (via “backup and restore”->”Restore” option) if anything goes wrong in the process of upgrading the ROM.
  • Now select “wipe data/factory reset”.
  • Select “wipe cache partition”.
  • Go to “advanced” and select “Wipe Dalvik Cache”.
  • Now go back to the main recovery tool menu by pressing back button.
  • Select “install zip from sdcard” , Now select “choose zip from sdcard”. You will now see a list of files on the sdcard, Select the “update.zip” on the sdcard that we transferred earlier.
  • recovery tool might ask for u to confirm the action and then will flash the new ROM on your device. Once done select the “reboot system” from the main menu of the recovery tool.
  • Hurrraaaaaaayyyyyyyyy !!!!!!  your device will now boot in the new Android ROM.


Great References:

http://theunlockr.com/2010/09/27/how-to-load-a-custom-rom-on-the-htc-hero-2/
http://theunlockr.com/2010/09/27/how-to-root-the-htc-hero-androot-method/
http://theunlockr.com/category/roms-2/android-roms-2/htc-hero-roms/
http://theunlockr.com/2011/04/22/froyo-rom-3/
http://forum.xda-developers.com/showthread.php?t=767886


http://forum.xda-developers.com/wiki/HTC_Hero
http://www.pocketables.net/2011/06/how-to-manually-root-almost-any-android-device.html
http://www.pocketables.net/2011/06/what-is-root-and-why-do-i-want-it.html

Handling Driver Malfunction in Ubuntu - Fixing broadcom driver malfunction in ubuntu.

In Ubuntu 11.04 many drivers come in already installed with the OS. Sometimes they can malfunction causing your kernel headers to get corrupted and as a result you will neither be able to boot into normal / recovery mode nor will you be able to do any fresh installation using ubuntu live. Now this is quite frustrating situation, however one can get rid of it by following these steps:
  1. Locating the exact driver that could have malfunctioned. Now this is the first and most important step that needs to be done. You can either go through the system log dump or you can try to recall your last actions after which your ubuntu fell into the limbo. In my case it was disabling my wireless adapter, hence i simply searched over the net for the name of drivers that could have been used on ubuntu for broadcom wireless adapter. 
  2. Black list the driver. This can be done by appending “blacklist driver_name” in the “/etc/modprobe.d/blacklist.conf”. 
  3. Restart the system and in grub menu select recovery mode. Once in the recovery mode select “dpkg” option i.e. recover broken packages. This will list kernel headers as a broken package along with other broken packages. Download and re-install these packages. 
  4. Restart the system and boot in to normal Ubuntu 11.04 environment.

Puzzled han ??? thinking Easier said then done. well perhaps a personal example of mine can help you map my issue on yours. As i mentioned earlier, In my case disabling wireless adapter (from the dedicated key) simply froze my OS. So it was quite probable that the driver of my wireless adapter was responsible for all of this. So i searched over the internet to find this very useful link, which helped me decide the driver name of broadcom wireless adapter. 
Following is the step by step recovery when broadcom wireless adapter malfunctioned on my system:
  • The broadcom driver was identified as  brcm80211.
  • Edit the black list: At system startup and at the grub menu select the “previous version” and select the recovery mode. In the recovery mode select the root shell. Once in the root shell edit the black list by using following command “nano /etc/modprobe.d/blacklist.conf” and append blacklist brcm80211 at the end of the file.
  • Restart the system, go in the recovery mode and select the package repair option. restart the system again and this time boot normally.
  • Once you have logged in you will see that enabling or disabling the wireless adapter won't freeze the OS any more as its driver has been black listed.
  • But you are not done now, as you have not only put the malfunctioning driver in the blacklist but also made your system handycap of using any driver for the wireless adapter. Hence Now in order to use the wifi adapter you will have to install proprietary driver for the wifi card. To do this first type the command "sudo apt-get install broadcom-sta-common"
  • Remove "blacklist brcm80211" from the end of "/etc/modprobe.d/blacklist.conf" and append it at the end of "/etc/modprobe.d/broadcom-sta-common.conf"
  • Append "lw" at the end of "/etc/modules". Restart the system.
  • Once the boot is completed, open "additional driver tool" and it will show you that your system can use proprietry drivers for broadcom wifi adapter. Install the drivers and reboot the system. 
  • Now you will be able to use the wifi adapter via proprietary drivers to connect to the available wifi access points :)

Prologue

Hi everybody, Finally i have gathered the courage and time to create a blog of mine where i can share my knowledge with the Internet community. My motivation for creating a blog to share my knowledge with others, comes mainly from my experience of last 2 years in software development. Over this time i have had strong feeling of responsibility towards me to pay back the Internet community for all the help they have provided me in getting the knowledge in various fields.
It has occurred to me so many times that i wanted to share something on the Internet but the thought of taking time to create and manage the blog always held me back BUT not anymore :)
As the name of my blog clearly shows, i am planning to keep this blog as my knowledge dump i.e. I want to share stuff related to any field either its development in linux, android, symbian, engineering or even hacking. So lets see what i can come up to share with you guys :)