Second Try on Augmented Reality

8 03 2011

The previous code i had used was too unstable, it crashes more often than it runs. So searched for a better version of toolkit code and started a code from the scratch rather than using the simplar code. This time the code was much more stable and was able to display more files than the previous version.

[kml_flashembed publishmethod=”static” fversion=”8.0.0″ movie=”” width=”400″ height=”300″ targetclass=”flashmovie”]

Get Adobe Flash player


The Marker is available here

Update: Fixed problem which prevented the model from displaying in web server. Now a torus should be visible once the marker is shown.


A try with Augmented Reality

6 03 2011

Augmented Reality had always been a field of interest. The ability to combine various technologies and to get a outcome which is more intuitive has what that attracts me to the field. Alast after long weeks of thinking of working, and not working coz of laziness :), Decided to give a try.  The easiest method was to use the flartook kit.

It already had its framework to communicate with the camera and get data. Which left only the modeling and the marker part to implement. This reduced loads of work. Very good for lazy ppl like me :).  First work was to get an idea of the code and its working. after few experiments and few crashes it was time to implement some code, but wanted some good 3D models. Being too lazy to start and draw a model, had the lazy man’s best friend at my side “The Google” :D. googled for few models and atlast came up with the same model which we used for our animation project.

Now that reminded me, i already should be having the source files of the Animation projects. A quick search revealed i have misplaced tat too 😀 . So thanks to Dinesh who actually had the copy the source files and was not lazy. So got the code up and running and here is what i ended up with.

The maker is available here

Rather than printing the marker and then showing in front of the camera, Upload the marker to your smartphone or ipods and then just flash the smartphone in front of camera. Saves the time of printing :).

Scheduling periodic MySQL backup in Windows

13 01 2011

When you are working on a project that involves a database and which is also very prone to crashes :D. Its time to check out a backup method to have safe copies of the database.

The easiest method we find for taking a MySQL backup is to use its own inbuilt “mysqldump”. Even though this provides with a backup, it needs all the parameters to work. In-order to make a automatic backup scheduler with the mysqldump would take two basic steps. One would be to make a script, which can take a backup of the database and the second would be to schedule it so that it works uninterrupted at the server.

So the script first. For this we use the windows batch script. We want to take a backup everyday of the month, and the backup can be overwritten at the end of month with the next month backup. and also we would be using another script which takes a monthly backup on the start of every month. that way we have backup for a year.

First step in creating the script is to locate the folder containing the mysqldump. It would be usually something like “c:\xampp\mysql\bin”. Next is to set up a folder where the backup would be stored. We create two set of folders for daily and monthly backup separate.

Now for the script, we use the following script for daily backup

@echo off
echo Database backup running..

c:\<path-to-mysql>\bin\mysqldump -u[user] -p[password] –result-file=”c:\<path>\backup\daily_%DATE:~4,2%.sql” [database]

echo Done!

and the following script for monthly backup

@echo off
echo Database backup running..

c:\<path-to-mysql>\bin\mysqldump -u[user] -p[password] –result-file=”c:\<path>\backup\monthly_%DATE:~7,2%.sql” [database]

echo Done!

The syntax is self explanatory.  This would provides with backup which have the files name as the database name with a extension of the data of the month or the month detail. So if the database is user it would provide with a backup of name User_<date> and User_<month> as the backup. Save the two scripts as two separate files. Now for the scheduling part

This we can do using the windows scheduling command at , So for our scheduling, we are scheduling the daily backup at 2:00 am daily and the monthly backup at 3:00 am, just to make sure no deadlock occurs.

Type the following command in the command prompt

at 02:00 /every:1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 c:\<path>\<daily_backup_batchfile>.bat

at 03:00 /every:1 c:\<path>\<monthly_backup_batchfile>.bat

And that all. The backup has been scheduled successfully.

One Too Many

8 01 2011

The number of programming languages that are available in the world now is astounding. WikiPedia counts the number of programming languages currently available in the world at more than 700 and that too without counting the numerous versions of the same language in the market. Even with all these programming languages, the end result of such programming languages are to compile it and get the output.

When it comes to programming, all programming language have the same property. They all follow a similar software design. The software design is so similar that it can be literally converted to any of the programming language with some work. Its just they syntax used in the programming  languages changes. With the companies wanting to establish their own proprietary version of the software, rather than trying to support the existing system, this language flood happens. If all programming languages are taken in account, they all have a conditional statement, a looping statement, functions. Where in higher level programming language also add the concept of OOPS to the list. So take any programming language and break it down to its system design, we can fill it up with the basic rules and statements like the above.

This becomes a problem when programmers are given tasks which are to be completed in programming languages not familiar to the programmer. Even though the programmer would be able to entirely come up with the design and can even make the code work in the language the programmer is familiar with. The worst part would be the growing of new programming languages. Its more like the programmers would have to keep learning new programming languages. This is more of a redundant task of learning new syntax for the same system design.

With too many programming languages already taken its strong roots in the community, its not easy to make a change to unify the programming language and make a single powerful language. But its still possible to make a programming language which can have a wrapper to all possible languages. Of-course now all programming languages have the same feature to allow them to be coded on a single programming language. This can be taken care by making the language smart enough to detect functions which are allowed on the required result specified.

This would free the programmers from learning new languages every time a new language comes to the market. Rather they would be able to concentrate on trying to sharpen their skills. Every new programming language that comes out just needs its own wrapper written to be able to work with the unified language.

Waiting for the day when some one would come up with such a product rather than add one more the existing language list.

Unity3D does stand upto its name.

8 01 2011

After the a happy life of doing the Masters. Its the time to for the job hunting. With many interview comes the exposure to many different kinds of interview, and also comes exposure to the kind of projects the companies work on. With singapore motivating for people to become entrepreneur , There are loads of start up companies which tons of creative ideas to implement. Getting to know such companies and the ideas they are planning to commercialize.

During my hunting we had couple of opportunity to attend such companies. One such company is the 3rdplanet .Of-course there would be nothing in the home page yet, other than a coming soon page. The ideas the companies working on are very interesting. This provided us with the opportunity to learn about a totally cool game engine Unity3D.

The main feature that was impressive about the product was that it can run on literally any platform, may it be Mac, PC, Andriod , iOS devices , Xbox , PS3, Wii, any browser. Now you can see that it can run on almost of the popular device that is out there in the market. Another feature of interest is the development enviroment. Unlike other products which support development for multiple environment, the environment need not be pre-configured before starting the projects. Instead create a project and develop it as it would be done normally. Once all the development is finished jus need to specify the device when building the final product. This provides with a very consistent development environment, and also provides with a consistent project over all the platforms.

This is the first product we have seen that does not restrict the user to do the coding on the proprietary language. Instead Unity supports Javascript , C# and also Boo Scripts. I have no idea how they managed 3 totally different languages to interact with each other seamlessly.  With multiple device support , multiple language support for coding, multiple platform support for project development, Man! this is one serious product to watch out for.

We had a run of the product on our Mac, to complete one of the assignment provided to us. It runs smooth on the macbook pro. No problems at all.

As seen from the above screenshot, the interface is pretty simple. With all the advanced features neatly arranged into the menus and drop-down boxes. Those who are familiar with the 3D tools already available in the market should find this in the same territory . The coding part of the Unity3D seem a little weird to common method of programming. When it comes to animating a object, the code does not take the object , the kind of transformation to make as parameters. Instead the code is made generic, as in the code can be written and then attached to any required object to execute for the particular object. This makes the animation work for with animations with better options than transformations like using curves, linear curves etc to to define the animations. Also combined with the language to code on. Its pretty hard to get the head around it, if someone is not familiar with the language and also the structure. It would have been much better if there were more sample codes provided for the functions.


This is a third party plugin for Unity3D which takes care of all the basic animations with no need to program. This is pretty easy to use and also have loads of options for pretty much any animations that is required.



We tried to work on the Unity3D using some 20 texture files of around 4000×4000 pixel resolution each. Even that was crashing Unity3D on the mac computer. Even when the computer was running on its max performance more. Not sure if Unity3D requires even higher end configurations to work.

On the whole this one product which takes the idea of unification of multiple platforms into a single development API.


Encoding of images to videos and Upload to web using PHP

29 12 2010

Web programming was never my cup of coffee. Its been always a black-box, which works just some how and should not be tested how :D. As part of my assignments, i was given the “black-box” task of converting a set of images into video, as if that is not enough also have to connect some how to youtube and upload the the account of the users choice.

The best part being all of this needs to be done in Silverlight. This was the first time i was getting to know we could even do programming in silverlight :D. So with the task assigned it was time to execute the unknown. After a bit of consultation with the programmers best friend “the Google”, figured out its easier to use PHP for this process rather than Silverlight. Also Silverlight does integrate with well with PHP .

The encode i chose for the my assignment was the FFMPEG. The advantage of this program other than it being free is that, its cross platform compatible and also all the features of the program can be accessed and manipulated via command line. This is the feature i plan to use as i dint have much time to go into actual video encoding programming. In-order to make sure the images are read in the correct sequence to make into video, the images get named in a specified sequence. Mostly numbers starting from 0, 1 and so on. This is easier to be read from ffmpeg command line method.

The following code can be used to convert images to videos

ffmpeg -r 10 -b 1800 -i %03d.<image_extension> <video_name>.<video_extension>

Where 10 specifies the frame rate , 1800 denotes the bit rate and the images are read in the sequence of 000.jpg or 000.png etc to 001.jpg , 002.jpg etc. This simple one line code would provide with the video in the folder in the same folder.

Next was the video uploading part.  Zend framework provides excellent support when it comes to Video processing with YouTube. The installation of the frameworks is also pretty straightforward.


Step 1: Download Zend Framework

Step 2: Add the path of the Zend library to the “php.ini”

Step 3: Enable openssl.dll in “php.ini”

Step 4: Restart server.

And that would be only step up required to install Zend. The samples present along with the Zend provide the code for video upload to YouTube.


Funny and Creative Programmers comments

22 01 2010

Programming is always a stressed work. But it still is fun and creative. Here are some of the programmers comments collected during stumbling. Starting with my favourite 😀


// Dear maintainer:


// Once you are done trying to ‘optimize’ this routine,

// and have realized what a terrible mistake that was,

// please increment the following counter as a warning

// to the next guy:


// total_hours_wasted_here = 16



#define TRUE FALSE

//Happy debugging suckers


//You are not expected to understand the following


//If you can’t do pointer math in your sleep, while

//driving a car backwards on the freeway,

//you shouldn’t change this routine.


//Yes, this is stupid. no it wasn’t planned. Drunken

//Lemurs change the spec every day. Check your mail.

//US Postal mail, not email. They’re not that advanced.


//Don’t touch it or ninja will punish you


//Dear future me. Please forgive me.

//I can’t even begin to express how sorry I am.


// I don’t know why I need this, but it stops the people being upside-down

x = -x;


return 1; // returns 1


Exception up = new Exception(“Something is really wrong.”);

throw up; //ha ha


//When I wrote this, only God and I understood what I was doing

//Now, God only knows


// I dedicate all this code, all my work, to my wife, Darlene, who will

// have to support me and our three children and the dog once it gets

// released into the public.


// sometimes I believe compiler ignores all my comments


Proves not to screw with programmers :D.