Pages

Tuesday, October 23, 2012

Recover your lost partitions

Recently somehow I courpted my eSATA drive's partitions and I googled a lot to find some good FREE tools to recover "lost" partitions.

I found TestDisk tool to recover the lost partition. Following are steps I performed to get my lost partition recovered.

I started TestDisk with admin rights (Select the .exe and right click and select "Run As Administrator". You will see similar screen:













Then press Enter to proceed to next step as shown below:

Select your hard drive that has lost partition (I choose the highlighted one because of 500GB) and then press Enter to proceed to next step as shown below:

The TestDisk will analyse the partition table based on your selection. Press Enter to proceed to next step. You will be shown similar screen as below:






When you are on above screen, you can perform "Quick Search" to find out all partitions for selected Hard Disk. Select [Quick Search] option using arrow key and hit Enter. Below screen shows all partitions.

Use left/right arrow keys to see the partitions.
* = Primary bootable,
P = Primary,
L = Logical,
E = Extended,
D = Deleted

Select Primary partition and press "P" to list all files in that partition. You can verify your partition using lost files.


Once you are sure that you have selected the correct partition, you can press "q" to go to previous screen.
When you got back to previous screen, then press Enter to proceed to next step. You will get similar screen shown below:


















When you are on above screen, select [Write] option and hit Enter, and press y to confirm. Once it is done, TestDisk will ask you to restart. Quit the TestDisk app using [ Back ] option and exit.

Leave your hard disk connected and restart your machine. After restart you will be able to see your hard disk. It worked for me and thats why I am blogging it to help others.

Below is the step by step guid.
http://www.cgsecurity.org/wiki/TestDisk_Step_By_Step

Thanks a lot TestDisk...for saving my money and DISK as well.

Sunday, August 12, 2012

Published source code of my SlidingBoxes game

Recently I have uploaded my game's source code to codeplx. Download and learn how to write a game for windows mobile in XNA.

Here is the link to source code: http://slidingboxes.codeplex.com/

and  here is the link for game and app for windows mobile: http://www.windowsphone.com/en-au/store/app/sliding-boxes/f6135389-b136-4da7-ad14-a4106aad19ca

Sunday, February 5, 2012

My first Android App -- Called "Bill Tracker"

I have developed my first app on Android 2.3.3 version. It can be downloaded Download Bill Tracker

This application logs all your bills. It does not remind you but it does lists all your due bills.


















Thursday, July 21, 2011

graph using xml with GraphViz tool

Currently I am working on project that generate graph for xml file. I have found few tools that does the same but I have expended to another level.

I am using GraphViz to generate the graph. GrahpViz is very awesome tool. You need to understand GraphViz dot statement.

http://www.graphviz.org/Gallery.php Please have a look that site.

I have written one WinForm tool that translates dot statment to graph and another which is a console application that convert xml file into graph image.

I share the code as well.

I have written a small utility that generates graph, the idea is how to execute the dot statement. You can create Windows form application, where user can write dot statment and it will show the image based on that.

Here is the code that does for you:
public void CreateImage(string graphVizDotExePath, string dotStatement, string imagePath)
{
var startInfo
= new ProcessStartInfo(graphVizDotExePath)
{
FileName = graphVizDotExePath,
Arguments = "-Tpng -o" + imagePath,
UseShellExecute = false,
RedirectStandardInput = true,
RedirectStandardOutput = true,
CreateNoWindow = true
};

graphVizProcess = Process.Start(startInfo);
graphVizProcess.StandardInput.Write(dotStatement);
graphVizProcess.StandardInput.Close();

string output = graphVizProcess.StandardOutput.ReadToEnd();
graphVizProcess.WaitForExit();
}

here is the main method:
static void Main(string[] args)
{
GrapVizWrapper dotCmd = new GrapVizWrapper();
Console.WriteLine("Write your dot statement here, when you finish press q:");
StringBuilder dotStatement = new StringBuilder();
string line = string.Empty;
do
{
line = Console.ReadLine();
if (!line.Equals("q"))
dotStatement.Append(line);
} while (!line.Equals("q"));

Console.WriteLine("Creating image please wait...");
dotCmd.CreateImage(@"C:\Program Files (x86)\Graphviz 2.28\bin\dot.exe", dotStatement.ToString(), @"C:\Projects\masood.png");
Console.WriteLine("image created.");
Console.ReadKey();
}

and I am calling above method from Main method of program class with:
path to dot.exe file (when you install GraphViz, you will see in Program File folder)
dot statement like below:
digraph {
"class a" -> "class b"
}

and path and file where you want this exe to create the image. You can have a look the generated image below:


I have tried another statment, that is:
digraph {
"clean"
"compile"
"build"
"compile" -> "clean"
"build" -> "compile"
"build" -> "clean"
}

and following is the output:


There is whole lot of different types of statements to generate the graph or diagram.
Visit http://www.graphviz.org/Gallery.php to the different types of dot statements. To view the statement, you have to click on the picture and supply the same dot statement to your program to see the output.

Using this technique I have created a tool that generates graph of all dependencies and calls for NAnt build file.