Thursday, August 15, 2013

The Unix file system!!

The Unix file system is divided into four sequential blocks namely Boot block, Super block, Inode block and the data block as shown below. In all the blocks except data blocks, all are fixed at the time of creation. and data blocks will be changed when the file content is changed.

The Boot Block:  This block is starting of the file system and booting code (bootstrapping) will be stored here.Each file system should have one boot block to boot the system. Only one boot block is need to boot the system and if you have more than one file systems, other boot blocks will be empty. So for starting the machine, Operating systems reads the data from boot block to load.
The Super Block: This block specifies the status of the file system. It provides the information like how much space available, how large the file system, total size of the disk, total used blocks, bad blocks etc.
The Inode Block: This blocks specifies the information about the files. each file will have one unique inode (information node) on the disk. The inode contains the information like owner of the file, file type, permissions of the file etc.
The Data Blocks: This block starts immediately after the inode block and this block contains actual data or file content. It also contains other files which contains user data like FIFO, regular files, directory files, character special , block special and socket files etc.

I will post in detail about the Inode structure later.

Tuesday, August 13, 2013

What is ipa file for iPhone and how to open it?

What is ipa file:
ipa is the extenstion of the iPhone Application file. Mostly known as the iPhone Application archive which contains the payload which need by iPhone app mostly images and sound files.

Where can I find ipa file:
 we can find the ipa file at the below location in the mac system. You can find all the application ipa files which are installed in the connected iPhone.
~/Music/iTunes/iTunes\ Media/Mobile\ Applications/

How to open ipa file:
 ipa file is just a archive file, you can rename as .zip file and you can unzip it. ipa a file contains Payload directory. if you unzip the ipa file, you will get Payload directory which contains another directory with a extension of .app. you cant open it directly, because its name has extension. So rename it with some name,it will change to directory, in this directory you can see all the supported files like images an d sound files etc.

Steps to open IPA file:
  • Got to the path ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/
  • Select the ipa which you want to unzip, rename it to zip file using mv unix command
  • unzip the file and you will get payload directory, open Payload directory
  • you will find .app file, which is actually a directory. rename the file with some name, it becomes the directory
  • open that directory, you will find the supported files

Shell commands order to open ipa file:

$ cd ~/Music/iTunes/iTunes\ Media/Mobile\ Applications/
$ ls
$ mv test.ipa
$ ls
$ unzip 
$ ls
$ cd Payload/
$ ls
$ mv testDir
$ ls
Let me know or comment below if you need any info or if you find any issue.

Thursday, August 8, 2013

reversing a given string using recursion C program!!

Below is the simple C program for reverse a given string using recursion.  Check here for non-recursive ways to reverse a string.


void reverse(char *str2,char *str1 )
     str2[strlen(str1) - 1] = str1[0];
     reverse(str2, str1+1);

int main()
  char str1[20],str2[20];

  printf("Enter a string for str1 :");
  printf("\n Source string:%s",str1);

  memset (str2, 0, 20);

  reverse (str2, str1);
  printf(" \n Destination string:%s \n",str2);

  return 0;

Sample Output: 
warning: this program uses gets(), which is unsafe.
Enter a string for str1 :reverse

Source string:reverse
Destination string:esrever

Let me know or comment below for any info or some bug if you find in the above code.

Popular Posts