Tuesday, February 18, 2014

Recovering photos from memory card: Ubuntu

Yesterday I had to go through a nightmare of losing all the pics on my memory card when I had not taken a backup. Thus began my hunt for recovery softwares and online solutions most of which didn't work for me until I found 'recoverjpeg' for ubuntu which is very easy to use.

Hence I thought of sharing the steps with you all.

Step 1: Install recoverjpeg
          sudo apt-get install recoverjpeg       

Step 2: Assuming your drive is mounted at /dev/sdb1, run the following on the terminal

           sudo recoverjpeg /dev/sdb1

Step 3: The above step will store the recovered files in your Home directory which will be owned by the root. You can copy all the recovered files to a folder and run the following command to change the ownership

           sudo chown -R youruser:youruser /home/username/Desktop/backup

Here /home/username/Desktop/backup is the folder where I copied all my recovered files.
For Step 2, if you are not sure about the location where your drive is mounted, go to /dev/disk/by-label and then right-click-->properties on the file with the name of your mounted drive. The 'link-target' information on properties tab will give the location of where the drive is mounted.

Thats all!! Photos recovered in 3 easy steps!!!
Happy Photo-recovering !!!

photo courtesy: Google

Saturday, February 1, 2014

LocalTime on TinyOS

When I started googling about fetching local time on motes, I hardly found any relevant help online and spent quite some time to finally make it work. So I thought of sharing what I learnt.
Say, following the naming convention, I have 2 files called TempC.nc and TempAppC.nc.







In TempAppC.nc add the following lines ..

       

implementation
{
       //General Components
 ....
 components LocalTimeMilliC;
 ....

 ...
 App.LocalTime -> LocalTimeMilliC; 
 ...
}
       
 

and in TempC.nc add the following lines ...
       
module TempC
{
 uses
 {
  ...
  interface LocalTime;
                ...
 } 
}

implementation{
        ...
 uint32_t timestamp;


       ...
       event void Boot.booted()
 {
                ...
  call Timer.startPeriodic(5000);
                ...
 }

       event void Timer.fired()
 {
                ...
                timestamp = call LocalTime.get();
                printf("Local Time = %d\n",timestamp);
                ...
         }

          ...
}