Wednesday, October 24, 2007

iPhone SDK ... ?

Apple iPhone made revolution in the world of mobile. iPhone hit the market by its tremendous advanced technologies. That makes it iPhone a huge success.

I am curious...! are there any killer application for iPhone...? I think till now no such softwares hit the market. I could be wrong :-( . The real truth is that Apple did not released any SDK for iPhone. No SDk means no killer application.

Developer are limited to develop only web based application for iPhone. This restricts hackers development to only web based applications like GMail, Google Maps etc to iPhone.

But one good news is that Apple is planning to release iPhone SDK in the early 2008.

So I am curiously waiting to see who will win the race (Apple/Hackers) ...?

Yours,
Satish

Java Native Interface [ JNI ]

JNI is an acronym of Java Native Interface. It is an programming framework for Java software developer to interact with native libraries which were written in some other languages, such as C, C++ ... etc.

The usability of the JNI comes into picture when a Java software developer try to use some of the native or open source libraries which were written in languages other than Java.

I was working on project of similar kind of requirement. The project which I worked the requirement was something like, replacing the Quicktime for Java library with native Quicktime library APIs. The entire project code was in Java. Quicktime for Java library is actually a provides some higher level APIs which intern calls the native Quicktime APIs. Some times this renders some performance issue while running the Java application. And also this lacks some features and is not as good as the native Quicktime library.

The project which I worked was on Mac platform. In that project we developed a JNI shared library which is wrapper layer over Quicktime Mac library.

Start up with the project:

Generate a C header file from the Java class using the below command:

javah [optionns] java_classname

Create a jni library target in your Java application. Add all the source and header files to your newly created target. Final step is that implement all the methods in the header file which was created by javah using your native library.

Load the created the jni shared library from your Java application.

Here I did not mention all the steps in detail. If you find any difficulty in understanding the concept and steps, please raise your comments in the comments column.

If anybody working on the similar requirement, and got struck at any point please share with me through comments. I will try to shed some lights on your issue.

Below is the link to sample code:
http://developer.apple.com/samplecode/MyFirstJNIProject/

Yours,
Satish

Parse .FLV file

Are you working on Adobe flash file parsing...? and found difficulty in parsing the flv file and found difficulty in understanding the flv file specification. Share your difficulties with me.

Fifteen days back I worked on one of the project, in that I did demuxing and muxing of the flv file.

The language we used in the project was C. I faced some issues in the beginning of the project, but somehow I resolved those by googling. So now I am pretty much comfortable with the flv file specification. Now I could be able to parse the entire flv. In the project which I worked we successfully demuxed meta data, cue points, alpha channel, audio and video packets from the flv file. Once the demuxing is done we constructed the flv file back by muxing all the components.

We provided some of the higher level APIs for the user to demux and mux the flv file.

If someone is working on the similar requirement and got struck at some point, please share your difficulty with me. I will try my level best to help you out. If you are in dilemma about which data structure to use to parse flv file, please put forward your thoughts through comments... I will try to share my previous project experience with you all.

If you have any comments on this article, please post your comments....

Yours,
Satish

Cgreen: Unit Test framework for C

Are you looking for simple and easy to use unit test framework for C ...?. If so here we go Cgreen.

Cgreen is a unit tester for the C software developer. This tool is completely open source. This framework provides some rich set of features to test our C code. I personally adopted this framework in my project to my C code. This will definitely reduce lots of debugging time and also helps in developing the quality code.
After adopting this tool in my project , I personally felt that this tool is easy to build and easy to use.

At this point of time I know how to get the things out of this framework.So if anybody wants to use this tool in your project and if you face any issues while using this tool, please share with me.

I will try my level best to help you out.

Educative link to Cgreen:
http://www.lastcraft.com/cgreen.php

Download Cgreen from the below link:
http://sourceforge.net/projects/cgreen

If you have any comments on this article or if you have any ideas, please share with me through your comments....

Yours,
Satish

Why, Background Process

Just an thought about Background Process.
Can't we use background process as remainders...

Consider the following examples... Suppose if we want to print some message on the console after some interval of time, then in such condition we can use background process as remainder.The below chunk of code meets the above requirement.

#include
void main( int argc char *argv[] )
{

int time_sec = 0;
time_sec = atoi ( argv [ 2 ] );
sleep ( time_sec );
printf ( " %s\n ", argv [ 1 ] );

}

Run:./a.out " Hello World " 4Prints Hello World on the console after 4 seconds.

Consider one more useful example, suppose if you would like to copy a large content of data from one file to another. Surely this would take some time to complete the task. Its a very bad practice if we block our main process until the copying process complete. Instead we can create a separate background process and get the task done through that process. This will ensures the smooth flow.

Snippet of code to illustrate copying process...

#include
void main ( int argc, char *argv [] )
{

FILE *readFilePtr, *writeFilePtr;
char c;

readFilePtr = fopen ( " inputFile " , r );
writeFilePtr = fopen ( " outputFile " , w );
while ( c = fgetc ( readFilePtr ) != EOF )fputc ( c, writeFilePtr );
sys_beep( 2 );

}

One more situation wherein which this is useful is, when the system administrators wants to know who are all the users currently logged in to the system at regular interval of time.

Unix command to achieve the above task is: who wc -l

if somebody knows any other situation wherein which these background process are most useful, please share with us...

Yours,
Satish