Unknown Kadath

Windows ‘File Recovery’ series : Part 6 Reading/Editing The Windows Registry From Outside of Windows

Posted on May 14th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 6 Reading/Editing The Windows Registry From Outside of Windows

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

Caution
Incorrectly editing the registry may severely damage your system. Before making changes to the registry, you should back up any valued data on the computer.

Caution
Do not edit the registry directly unless you have no alternative. These techniques bypasses standard safeguards, allowing settings that can degrade performance, damage your system, or even require you to reinstall Windows. If you must edit the registry directly, back it up first.

Most of the time you can use standard registry editing tools on a Windows computer that cannot boot into Windows.


If you are able to boot the machine into Safe Mode with Command Prompt then you can use the reg command
Reg Command
http://technet.microsoft.com/en-us/library/bb490984.aspx

Recovery Console Command prompt on Windows Vista / 7
You can run regedit.exe.
You can also use the reg.exe command.

Windows 8 Startup Repair Command Prompt
You can run regedit.exe.
You can also use the reg.exe command.



I’m sure that there are other ways. Computers are always full of new surprises when it comes to breaking them.

Then there is Windows XP
Recovery Console Command prompt in Windows XP has no reg or regedit command.

Using chntpw as a Windows registry editor

Anyone who repairs consumer computers on a regular basis comes across this scenario sooner or later.

Client has a Windows XP computer with a problem that can be easily repaired from the XP Recovery Console. You proceed to boot into XP Recovery Console and ask the client “Is there an administrator password to this machine?” and they respond with something like “I don’t think so…”.

Read more on “Windows ‘File Recovery’ series : Part 6 Reading/Editing The Windows Registry From Outside of Windows” »

Windows ‘File Recovery’ series : Part 5 Manually Recover a Deleted File From an NTFS File System

Posted on March 12th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 5 Manually Recover a Deleted File From an NTFS File System

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

For this post we will be looking at Windows NTFS filesystems.

How files are deleted

Deleted files are not removed from the hard drive until the space that they occupy is needed by a new file.

When a file is deleted, the list of disk clusters occupied by the file is erased, marking those sectors available for use by other files created or modified thereafter. If the file wasn’t fragmented and the clusters haven’t been reused, you should have a great chance of getting it back.

Recovery is often done by looking at the raw data on the disk for data in areas that are marked as being available for use, then determine the file type and directory structure, copy them and save them elsewhere.

NTFS and the MFT

Read more on “Windows ‘File Recovery’ series : Part 5 Manually Recover a Deleted File From an NTFS File System” »

Windows ‘File Recovery’ series : Part 4 Recover Files From a Bad Hard Drive

Posted on March 10th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 4 Recover Files From a Bad Hard Drive

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

We will be looking at Windows (FAT and NTFS) filesystems.

How it usually starts

Often as a hard drive begins to go ‘bad’ you start to get strange errors in programs and your computer occassionally shuts down with a blue screen error. You may also start to notice sounds from the hard drive that you have not heard before. In many cases, the computer will not boot to Windows at all and none of the repair options will seem to work. Disk diagnostics programs either crash, show errors on the disk or don’t run at all.

At this point the user realizes that they need to completely re-install Windows (and hopefully, but not always, understand that they need to replace the hard drive). How do they get their data from a crashing or unbootable drive?

How to Recover the Data

A broken hard drive isn’t just ‘broken’ it is almost always still in the process of ‘breaking’ and everything we do to it is going to make it worse. That means we have to be as efficient as possible in our recovery efforts.

Read more on “Windows ‘File Recovery’ series : Part 4 Recover Files From a Bad Hard Drive” »

Windows ‘File Recovery’ series : Part 3 Recover A Deleted Partition with Testdisk

Posted on March 8th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 3 Recover A Deleted Partition with Testdisk

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

We will be looking at Windows (FAT and NTFS) filesystems.

How partitions are deleted

This post is not about partitions disappearing due to damage or corruption of the file system. That kind of recovery will be covered later in this series. Here we will discuss solutions for recovering from accidental removal of a partition.

From personal experience, there are three ways that I have seen partitions accidentally deleted.


1. While trying to use partition changing software. Usually while changing the size of an existing partition or adding a new one.

2. When adding an operating system to make a multiboot computer.

3. When re-installing an operating system on a drive with multiple partitions.



I’m sure that there are other ways that it happens too. Computers are always full of new surprises when it comes to breaking them.

Deleted Partition Recovery with TestDisk

Read more on “Windows ‘File Recovery’ series : Part 3 Recover A Deleted Partition with Testdisk” »

Windows ‘File Recovery’ series : Part 2 Recover Deleted files with Testdisk and PhotoRec

Posted on March 8th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 2 Recover Deleted files with Testdisk and PhotoRec

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

Data recovery from hard drives has not changed much in decades. However, the effectiveness and ease of use of free tools has increased greatly. Also, the fact that CD’s, DVD’s, flash drives, SD cards and USB keys are made to behave like hard drives makes them candidates for recovery using the same tools. SSD’s provide some new challenges due to techniques they use to extend their life expectancy but for the most part are recoverable in the same manner as platter based drives.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

We will be looking at Windows (FAT and NTFS) filesystems.

How files are deleted

Deleted files are not removed from the hard drive until the space that they occupy is needed by a new file.

When a file is deleted, the list of disk clusters occupied by the file is erased, marking those sectors available for use by other files created or modified thereafter. If the file wasn’t fragmented and the clusters haven’t been reused, you should have a great chance of getting it back.

Recovery is often done by looking at the raw data on the disk for unreferenced data, then determine the file type and directory structure, rebuild them and save them elsewhere.

Simple Recovery with Testdisk and PhotoRec

We’ll do this in Windows XP Professional Service Pack 3

TestDisk is a program that does lots of things that we will talk about later in this series but for this post we are looking at its file undelete capabilities. It also comes with the program PhotoRec which has some advantages for recovering specific file types like pictures or Outlook mailboxes (currently over 200 file types).

When to use TestDisk or PhotoRec for Deleted File Recovery

Read more on “Windows ‘File Recovery’ series : Part 2 Recover Deleted files with Testdisk and PhotoRec” »

Windows ‘File Recovery’ series : Part 1 Recover Deleted files with Recuva

Posted on March 7th, 2012 by James Litten

Windows ‘File Recovery’ series
Part 1 Recover Deleted files with Recuva

DISCLAIMER: These examples use techniques that I actually employ in the real world to deal with real problems. They might be wrong or dangerous. They might be inefficient. If you try them yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that I provide here.

Data recovery from hard drives has not changed much in decades. However, the effectiveness and ease of use of free tools has increased greatly. Also, the fact that CD’s, DVD’s, flash drives, SD cards and USB keys are made to behave like hard drives makes them candidates for recovery using the same tools. SSD’s provide some new challenges due to techniques they use to extend their life expectancy but for the most part are recoverable in the same manner as platter based drives.

In this series we’ll look at some real world examples of disastrous situations salvaged and made better again.

We will be looking at Windows (FAT and NTFS) filesystems.

How files are deleted

Deleted files are not removed from the hard drive until the space that they occupy is needed by a new file.

When a file is deleted, the list of disk clusters occupied by the file is erased, marking those sectors available for use by other files created or modified thereafter. If the file wasn’t fragmented and the clusters haven’t been reused, you should have a great chance of getting it back.

Recovery is often done by looking at the raw data on the disk for unreferenced data, then determine the file type and directory structure, rebuild them and save them elsewhere.

Read more on “Windows ‘File Recovery’ series : Part 1 Recover Deleted files with Recuva” »

Monitoring the impact of Google/Webkit Prerendering of Pages with Piwik Analytics

Posted on June 21st, 2011 by admin

Google has announced that their search engine will begin prerendering pages. http://googlewebmastercentral.blogspot.com/2011/06/announcing-instant-pages.html

The potential problem with Google’s prerendering…
It’s done with Javascript.

That means that it happens on the client and not on Google’s server. There is no way to tell if my page was actually viewed by the user or if the page was prefetched and cached by the user’s browser because the search page they were viewing told it to prerender the page. Well, no way to tell by just looking at my normal stats. There is a way to detect whether or not the user actually views the page using some javascript.

I use Piwik on many websites in parallel with Google Analytics. Piwik gives me the ability to monitor performance and trends in real time.

I use Google Analytics for monitoring trends over greater periods of time like weeks, months or years.

Google Analytics will likely give me the ability to filter out and monitor prerendered pages in the near future. Piwik will probably add an option for this eventually also but right now, I want to begin monitoring it to see how often it happens and how important it is to my infrastructure.


1. How much bandwidth is used by pages that are prerendered but never viewed?

2. What pages does Google rank highly enough that they feel the need to prerender them and what keywords are they resulting from?

3. Who else is causing my pages to prerender besides Google.com?


Using some javascript we can check on the webkitVisibilityState of the page as it is viewed or cached by the client based on the W3C Page Visibility spec http://www.w3.org/TR/2011/WD-page-visibility-20110602/

Google Chrome Labs has a page on this http://code.google.com/chrome/whitepapers/pagevisibility.html

We’ll use their technique to log our Piwik stats differently if the page is prerendered and then properly log the visit if the prerendered page is subsequently viewed.

A simple Piwik tracking image will be sufficient for our tests. We can add full javascript based tracking once we know that it works. If it is prerendered then we will track it to a different website account on Piwik using the querystring variable idsite and then monitor it with an event listener so that if it is subsequently viewed then it will track it as normal.

var isPrerendering = false;

function handleVisibilityChange(evt) {
if (!isPrerendering) return;
countView();
isPrerendering = false;
}

function countView(){
document.write('<img src="http://PIWIK WEBHOST/piwik/
   piwik.php?idsite=[ID OF NORMAL SITE]&rec=1" />');
}

/*
* We can count the view right now if the document isn't being prerendered.
* Browsers that don't support the API will return undefined for
* webkitVisibilityState.
*/
if (document.webkitVisibilityState != "prerender") {
countView();
} else {
//We'll need to count the pageview later
isPrerendering = true;
document.write('<img src="http://PIWIK WEBHOST/piwik/
   piwik.php?idsite=[ID OF PRERENDER TRACKING SITE]&rec=1" />');
document.addEventListener("webkitvisibilitychange", 
   handleVisibilityChange, false);
}


Trying it out
Using Chrome 13 http://tools.google.com/dlpage/chromesxs enable prerendering by starting Chrome like this…
chrome.exe –prerender=enabled

To test this I go to http://prerender-test.appspot.com/ and enter the address of a page that I am tracking like this one and it will show a prerendered hit in the Piwik website I set up for tracking them.

I like it.
It’s fast and enhances the users experience. Using javascript puts all of the cost (processing and bandwidth) on my webserver and user’s browser so we’ll see if this causes problems for its adoption. I’ll keep playing with it and when it does become mainstream, I hope to be ready to embrace it and not allow it to adversely affect my servers, visitors or analytics.

X10 Lamp Control Over The Internet With Live Streaming Video Example

Posted on May 13th, 2011 by James Litten

In this project, we are trying to find the simplest way to allow public access to X10 home automation devices while maintaining a secure environment that does not allow anything damaging to happen. The video and button below are live and in my home. This post will describe how this is done. Read more on “X10 Lamp Control Over The Internet With Live Streaming Video Example” »

Learning to Use Android NDK With a Neat Augmented Reality Example

Posted on March 7th, 2011 by James Litten

I’ve been moving some Flash SWF files over to AIR for Android and while looking into how best to optimize ActionScript code for AIR for Android, I got sidetracked. After reading about the obvious optimizations for memory and CPU resources, I decided to take a look at the AIR .apk file that is installed on my Android phone. I found that the magic was happening in

\lib\armeabi\libCore.so

Ahh, the Adobe AIR runtime kind of runs beside the Dalvik virtual machine rather than completely inside of it.

The libCore.so file is a shared object file using JNI. Java Native Interface(JNI) http://en.wikipedia.org/wiki/JNI code written in C or C++ allows you to access platform specific features and ‘touch the metal’ with your code.

Android provides the Android NDK so you can use native code.
http://developer.android.com/sdk/ndk/index.html

Some words of wisdom from the Android developer page :)

The NDK will not benefit most applications. As a developer, you need 
to balance its benefits against its drawbacks; notably, using native 
code does not result in an automatic performance increase, but 
always increases application complexity. In general, you should 
only use native code if it is essential to your application, not just 
because you prefer to program in C/C++.
http://developer.android.com/sdk/ndk/overview.html

I wanted to try compiling and running some native code on my phone (Android 2.2) so that I have that tool in my toolbox when I need it. I found a great example at Qualcomm.
https://ar.qualcomm.com/qdevnet/sdk

The sample application that comes with the SDK allows you to detect and track image targets in 3D using your phone’s camera and then it puts a floating teapot (http://www.sjbaker.org/wiki/index.php?title=The_History_of_The_Teapot) over your target. The NDK is required to compile the native C++ code which uses OpenGL ES http://en.wikipedia.org/wiki/OpenGL_ES. It has step by step instructions that will show you how to build the native C++ source files with the NDK package of the Android SDK and then use Eclipse to build the Java sources and create the APK package that can be deployed to the phone.

This is very much like the augmented reality on the new Nintendo 3DS
http://www.siliconera.com/2011/03/04/lose-your-nintendo-3ds-ar-cards-just-print-out-new-ones/

If you are having a hard time with the NDK, try the sample that comes with it in \samples\hello-jni along with the tutorial at http://www.pocketmagic.net/?p=1332 for a very basic example that will help you understand the proper procedure.

I have some broken antique clocks around the house so I made image targets out of their faces and now have a teapot floating in front of them. Next time I get a little break in the action, I’ll change that teapot to a semi-transparent digital clock so my clocks will no longer be broken provided, I run the program on my phone and point the camera at the clocks :)

Clock Face

The NDK combined with current hardware capabilities certainly seem to be enough to make sophisticated and engaging toolkits and engines for game developers and artists.

Anyway, enjoy playing with the code as that is how you learn.

Developing With Flash CS5 for Adobe AIR on Android

Posted on February 22nd, 2011 by James Litten

Now that Adobe AIR is available for Android 2.2, it is easy to move your Flash games to Android’s app store and also to add functionality that takes advantage of things like the camera and GPS.

AIR stands for Adobe Integrated Runtime and was originally for

...building rich Internet applications using Adobe Flash, Adobe Flex,
Adobe Dreamweaver (HTML or Ajax), AIR SDK, that can be run as 
desktop applications.

But now seems to be headed toward becoming an easy way to quickly develop powerful applications for smartphones, TV’s, car dashboards, tablets, big computers, tiny computers and everything in between.
http://www.adobe.com/products/air/


Setting up your development environment

1. Get Flash CS5 (you can get a 30 day free trial at http://www.adobe.com/downloads)


2. Install Flash extension for AIR http://labs.adobe.com/technologies/flashpro_extensionforair/


3. Install AIR SDK http://www.adobe.com/products/air/


4. Install Android SDK http://developer.android.com/sdk/index.html


Step by step video instructions

Setting up your development environment with Flash CS5 and AIR for Android
http://www.gotoandlearn.com/play.php?id=123


More instructions for setting up.

Getting started with Adobe AIR for Android
http://www.adobe.com/newsletters/edge/august2010/articles/article1/index.html


Some AIR for Android examples

Build a GPS Speedometer
http://mobile.tutsplus.com/tutorials/android/build-a-gps-speedometer-getting-into-air-for-android/


AIR for Android MazeFM Application
http://www.flashandmath.com/mobile/mazefm/index.html


Air for Android: Geolocation
http://www.unitedmindset.com/jonbcampos/2010/08/30/air-for-android-geolocation/


Simple camera application with Flash CS5 and AIR for Android
http://www.gotoandlearn.com/play.php?id=124


Publishing AIR for Android Applications to the App Store
http://www.gotoandlearn.com/play.php?id=131


The .apk file that is created for AIR for Android has the .swf file in the assets folder and an application.xml file in the assets/META-INF/AIR folder which works with the main AndroidManifest.xml file to set the programs application properties and how it should start (run the swf file).


Now it’s easy to move your Flash apps and games to the mobile market. Enjoy.