C Language Constructors and Destructors with GCC

Constructors and Destructors are special functions. These are one of the features provided by an Object Oriented Programming language. Constructors and Destructors are defined inside an object class. When an object is instantiated, ie. defined of or dynamically allocated of that class type, the Constructor function of that class is executed automatically. There might be many constructors of which the correct implementation is automatically selected by the compiler. When this object is destroyed or deallocated, the Destructor function is automatically executed. For example when the scope of the object has finished or the object was dynamically allocated and now being freed. The Constructors and the Destructors are generally contains initialization and cleanup codes respectively required by an object to operate correctly. Because these functions are automatically invoked by the compiler therefore the programmer freed from the headache of calling them manually.

Continue reading “C Language Constructors and Destructors with GCC”

WordPress.com Stats API

gimp_logoWordPress.com has a very nice stat plugin showing the overall post views data and also post by post, but it would be always great if there was more. A lot of people talk about introducing Google Analytics. A lot of people save the data offline by copying the summary tables into files to save the site data. I had an idea to process the data of my site a bit differently and find trends in the data. I thought except copy-pasting the site summary data, there should be a cleaner manner to store the data. First I made a brief Google search, then made a wordpress.com forums thread. Then i had a short chat with Mark in wordpress.com freenode IRC and was redirected to wp.com email support. The first result came from email support telling that there is no data export feature. But another email followed to correct the previous one which told about the wordpress.com stats API with which you can get your wordpress.com site’s stats data in CSV or XML format.
Continue reading “WordPress.com Stats API”

Cricket World Cup 2011

Cricket World Cup 2011 Logo I was keeping myself updated and was watching portions of the matches casually but I started watching the matches seriously from the semi-finals. The Ind v Pak match was a fine one (although the next day was one final examination). India-Pakistan matches have always been high-voltage matches. After defeating Pakistan I was feeling like it was the 2003 world cup, India again in the finals. 2003 final match was a painful memory, India was loosing from the very first moment. But in 2011 things have changed Australia is eliminated, and India is the one to do this cleaning job.

Continue reading “Cricket World Cup 2011”

Bash Script: Generating Primes within Range

Objective

Generating prime numbers within a range using bash script. The technique used in this implementation to generate the prime numbers is still the good old divide and check method, but with some tweaks attempting to make the execution a bit better.

Approach

The core method is, we check if an integer p is prime by:

  1. Dividing with integers which are not multiples of 2’s and 3’s
  2. Dividing with integers upto floor ( sqrt ( p ) )

The integer p itself is needed to be not divisible by 2 or 3 or both.
Read more to get the bash script

Rockbox in iPod Video 5G

For a long time I am using the Rockbox OS in my Apple iPod Nano 1G as the primary OS, which also has iPodlinux, and ofcourse the Apple OS installed. You can find the step-by-step guide how I made this stuff here : Triple Boot Your iPod. Yesterday my brother asked me if there are other options for his iPod Video 5G, and can it be dual booted just like a computer. Because what he wants is operational iPod, i stroke iPodLinux out of the list, as has a lot of problems (sorry for that). Rockbox is the primary choice which gives tons of features and good performance. I sat down and started to follow my own guide, three causes: [1] Wanted to make sure nothing goes wrong, [2] Wanted to see if the guide I wrote is really a helpful one, [3] It is still thrilling. Although there is no need to manually install Rockbox as they now supply auto installers, but installing manually although needs some time and might need some responsibility, but with auto install the thrill factor is over. I should not comment about the Rockbox auto installer, as I haven’t used the installer or enough time, but it is pretty good and worked flawlessly. I would encourage you to use Rockbox auto installer, they provide a GUI and options and choices of softwares and very easy click-click install interface. Therefore for non-commandline guys the Rockbox autoinstaller is recommended. You can get it here: http://www.rockbox.org/download/
I am re-writing only the Rockbox installation process, probably this would be a bit easier to read than the previous guide, for the people who wants to avoid installing iPodLinux.
Continue reading “Rockbox in iPod Video 5G”