Sunday, October 30, 2016

How To Fix: External Disk Drive Suddenly Became RAW

 How To Fix: External Disk Drive Suddenly Became RAW

DISCLAIMER: These example use techniques that I actually employ once to recover a drive from a raid 1 bay where both drive where bad. This tutorial might be wrong or dangerous or inefficient. If you try yourself, it might cause damage or irreparable loss. I take no responsibility for anything you do based on my examples or the information that his provide.


A common and befuddling problem with computers is the sudden and seemingly inexplicable disappearance of an external hard drive that has been functioning properly. It can be a breathtaking experience to suddenly be told that your data, often irreplaceable pictures and documents, might be gone forever.
This can even happen on a pair of Raid 1 hard drive because maybe you purchased them as a pair at the same store and they both went down at the same time. I think it is almost better to buy them at different store location or to make sure they were not manufactured at the same time :)

As with many similar situations in life the appropriate response is “Don’t panic”. When approached sensibly and carefully, the situation can be resolved and the data saved more times than not.

Error Messages

Common error messages associated with the sudden inability to access an external hard disk drive.


Windows XP




Windows 7
DO NOT FORMAT THE DRIVE

When attempting to access the drive in Windows you may see a message asking you to format the drive DO NOT FORMAT THE DRIVE
You need to format the disk in drive before you can use it.
Do you want to format it?

Another error that you may see when trying to access the drive in Windows from a program or the command line is…
This volume does not contain a recognized file system. Please make sure that all required file system drivers are loaded and that the volume is not corrupted.

Attempting to run chkdsk in an attempt to repair the problem will give an error also…
chkdsk can not be run on the drive
The type of the file system is RAW.
CHKDSK is not available for RAW drives.

The Disk Management window shows the partition as either RAW or without a filesystem type.


Windows XP

Windows 7



Properties of the drive show that both used and free spaces are 0 byte in size for the raw drive



What does RAW partition mean

A RAW filesystem simply means that it is a filesystem that is not recognized by Windows. Therefore all the available filesystem drivers are unable to mount the filesystem as a drive. This often happens when the records determining the filesystem type or location on the disk are damaged or corrupted, usually the partition table or the boot sector.
Since Windows sees no filesystem in the partition, it prompts you to format it in order to create a filesystem on it. DO NOT FORMAT IT. 


Why does it happen and how to avoid it

The most common cause of external hard drives suddenly becoming RAW drives is if they are disconnected from a computer without using the “Safely Remove Hardware” option. This can happen in many ways such as a power failure, unplugging the drive from the USB port or from its AC adapter, a problem with the computer that causes it to temporarily disconnect the USB hubs and many more circumstances can lead to this occurring.
Always use “Safely remove hardware” to disconnect the drive. Left click the icon on the taskbar, select the device from the menu, and wait for the confirmation message.

Before proceeding beyond this point, you need to be aware of the risks involved. If the problem with the drive is not simply a logical error but is a manifestation of physical damage then the more you use it and try to repair, the worse the damage may become. To minimize the risks, the drive can be taken to a professional who is experienced in this type of repair. The drive should not be making strange clicking or beeping noises. That means that there is definitely physical damage and it should be sent to a facility with the proper tools and environment to repair/recover it since trying to repair it as described in this post can make that situation worse. If you wish to continue on your own there are three important rules to remember.

1. Computer problems are variable. You may very well come up with a different situation than I outline below. Make sure that you stop and think things through carefully when the process becomes different than I describe.

2. You DO NOT WANT TO WRITE ANYTHING TO THE RAW DRIVE except for the repaired MBR and repaired Boot Sector if necessary. Any other writing can overwrite data on the drive that you would want to keep.

3. This repair does not apply to solid-state drives (SSD). They are very different than normal drives and can erase important data on a RAW partition just by connecting power to them. 

Accessing and Assessing a Hard Drive’s S.M.A.R.T. Data to Determine if There is Physical Damage

Being able to effectively analyze the S.M.A.R.T. data on a hard disk drive (HDD) enables you to quickly identify problems that can aid you in recovering all of the data from it before it becomes irretrievable or requires significant expense to retrieve.
S.M.A.R.T. stands for Self-Monitoring, Analysis and Reporting Technology and is the hard drive’s record of its internal diagnostic monitoring and usage statistics packaged for being accessed externally. The primary purpose of S.M.A.R.T. is to alert us to an impending failure of the drive while there is still time to save the data. When a hard drive reports that the S.M.A.R.T. health is FAILED you must get the important data off of it immediately and not use the drive anymore.
IT IS IMPORTANT TO UNDERSTAND THAT DIFFERENT MANUFACTURERS AND DIFFERENT DRIVE MODELS CAN STORE AND DISPLAY DIFFERENT SUBSETS OF S.M.A.R.T. DATA AND CALCULATE VALUES AND TOLERANCES DIFFERENTLY.
S.M.A.R.T. data is best used as a general guide. For specifics, the hard drive’s technical documentation must be consulted. Sometimes that information is difficult to come by and can be proprietary. For example, the formulas for how some manufacturers calculate normalized values for attributes can be very difficult to find.


Proper analysis of S.M.A.R.T. data

  • Can help determine if the problem is physical damage or just logical damage.
    • With logical damage, the drive can be trusted and continue to be used after being repaired.
    • With physical damage, you want to get any important data off of the drive and replace it.
  • Helps you choose the best method for recovering all of the data from the drive.
  • Prevents you from accidentally doing things that may make matters worse.


In order to check the S.M.A.R.T. data on a HDD

  • The drive should not be making strange clicking or beeping noises. That means that there is definitely physical damage and it should be sent to a facility with the proper tools and environment to repair/recover it.
  • The drive needs to be accessible by the computer’s BIOS during POST (responds to the ATA command IDENTFY_DEVICE). In other words, the drive should be visible in Windows.
  • In the case of external drives connected via USB they need to be detected by the computer’s Plug and Play software (responds to the ATA command IDENTFY_DEVICE).

After making sure that the connection between the drive and the computer is correct and its quality is the best it can be, you need to check the health of the drive itself. Then you can rule out physical damage that requires repair with specialized tools in a controlled environment.

What We Are Looking For

·        Does the drive make noises that it did not make before?
o   Loud clicking or a periodic beeping sound may indicate mechanical damage. Physical damage may require the drive to be sent to a facility with the proper tools and equipment to recover the data.
·        Does S.M.A.R.T. show any errors or bad attribute values?
o   We look at the Raw Value of S.M.A.R.T. attributes with ID#s 5, 191 and 197.
·        Does it pass the S.M.A.R.T. Short Self-Test?
o   We run the S.M.A.R.T. Short Self-Test.
If it does not pass any of these tests, you need to take it to a data recovery lab and have it professionally recovered otherwise you risk making things worse.


View S.M.A.R.T. data with GSmartControl

Get a copy of GSmartControl for Windows
http://sourceforge.net/projects/gsmartcontrol/files/0.8.7/gsmartcontrol-0.8.7-win32.zip/download
Unzip it and run gsmartcontrol.exe
Double-click your drive and click the ATTRIBUTES tab.
  • If ID #05 Reallocated Sectors Count is listed and has a RAW VALUE greater than 5 then there is physical damage in the form of bad sectors.
  • If ID #191 G-sense Error Rate is listed and has a RAW VALUE greater than 0 then that means the drive has been dropped or bumped hard.
  • If ID #197 Current Pending Sector Count is listed and has a RAW VALUE greater than 5 then there is physical damage in the form of bad sectors.
Next, click on the PERFORM TESTS tab and execute the SHORT TEST. If it does not pass the test then there is physical damage.

If there is no indication of physical damage then you can continue. In order to repair the most common problems that cause an external disk to suddenly become RAW we will use TestDisk.
Download Testdisk
http://www.cgsecurity.org/wiki/TestDisk_Download
and run testdisk_win.exe

TestDisk is a console application so you have to use your keyboard to interact with it instead of your mouse. Won't work without a keyboard on most tablet as most on screen touch keyboard are lacking down/up arrow This is the case for  Samsung tablet

If you want to recover your data I recommend to buy a sabrent dual 3.5 HDD external enclosure where you can snap the bad disk in. Before you proceed. Purchase a disk of the same size and format it. The disk can be used to copy your data when possible using TestDisk

Run testdisk_win.exe as admin

Choose Create log if you want to document your steps 

Select the disk that you can't access - make sure the disk is online and that you identify clearly the disk you will use to recover/copy data onto vs your bad disk.
select that disk. Make sure that your external disk is highlighted
Choose Proceed and hit enter 


in Partition Table Type selection. most tutorial recommend to move the cursor from None to Intel. In my case and certainly with recent version of testdisk for NTFS disk, I just left the selection at None and just press Enter. Then TestDisk immediately found the NTFS partition.

Select Analyse and hit enter

The partition data looks incorrect (an explanation of why is beyond the scope of this article)
Select Quick Search and hit enter

When the Quick Search completes, we see one partition (if you only see the option to CONTINUE at the bottom of the screen press ENTER one time to continue to the screen that you need to be at).

Assuming that the partition was shown correctly (Structure:OK) 
Lets look at the data on that partition press
P
and you should see a list of files/folders in the partition.

If none were shown, I would assume there was none to show or Test Disk was unable to do the job :(



Hmmm… This looks like a bunch of diagnostic tools but not our missing data. We’ll need to look further. This means that you probably have more than one partition on that disk Press
Q
to go back a screen and then press
enter

To get to this screen, select DEEPER SEARCH and press enter.

Naturally, the Deeper Search takes longer than the Quick Search

When the Deeper Search completes we now see two partitions. The one we saw after the quick search and maybe another one.


Select the new partition and press
P
to see the files/folders and now we see the data we want to make visible again.


You can browse the FAT select parent folder by moving pointer to it use .. to move up etc...
pres a to select all from top folder this will select all folders and sub folders and files

press c to copy

now select target drive. The drive MUST BE a different drive than the damage drive.

Be patient it will take a while.... The file count will increase in green some might be bad meaning lost forever. At least you recover some of your data!


Friday, October 28, 2016

Text to speech audio recording

The best voices I've found so far are:

Ivona (www.ivona.com)
iSpeech (www.ispeech.org)
https://www.ispeech.org/create.text.to.speech.audio

There are a few specialty tools available that help to record stuff
from your PC. However, you should be able to do this using a built-in
Windows setting. It's a little hidden:

1) Right click the speaker icon in the taskbar and select Recording Devices.

2) Right click the empty space in the list of devices and select Show
Disabled Devices.

3) A new item (if it wasn't already visible) should appear called
Stereo Mix. Right click this and select Enable.

Now make sure you have an audio recording tool installed. Audacity
should do the trick.

1) In your audio recording tool's settings (Preferences in Audacity)
select your recording device input. Pick Stereo Mix.

2) Click the record button in Audacity, then play the file on the PC
that you want to record from.

3) Stop the recording when you're done and edit to taste.

4) Export as the audio format of your choice.

Sunday, September 25, 2016

How to protect walking garden fruit cage

How to protect walk-in garden fruit cage

  • Heirloom tomatoes
  • Zucchini flowers/zucchini
  • Cucumber


I love to garden but am surrounded by squirrels where I live so I decided to purchase this fantastic product from the UK:

http://www.henrycowls.net/fruit-cages

It's not cheap but definitely the best for the money because it is clean and gives a great look for a walk-in garden. It comes with a door and good quality netting.





I built it alone and ordered it with custom dimension to fit perfectly in a small patch alongside my house. I left enough space to walk around but because it is close to my neighbor's fence but a problem came along the way....
From spring to August, no squirrels were able to get in with the normal installation but then one squirrel figured it out and oh boy, it was game on!

I wanted to protect my garden without killing the squirrels and I won that battle!

Squirrels



A squirrel is a dangerous animal -  They carry disease in their feces and fleas which can bite you and give you bubonic plague or other diseases.  They are rats with a bushy tail.  Sure, they are cute to look at, but they can be a real problem rodent for many people.  They will try to burrow under or into your home and they can eat up electrical wires can even cause your house to burn down.  Not so cute now, huh?  The multiply faster than rabbits.  In springtime you may see one, then suddenly in just three months you will see 14 and that can double again in July.  They can overrun your property and they will steal your bird food, cat food, fruit and vegetables and just make life miserable for you.  The also have amazingly powerful teeth and those fangs are really long fangs too.  One bite from a squirrel and you will be visiting the emergency room for stitches.  Some squirrels can become aggressive and attack you or your kids.
"Squirrels have caused more than 50 power outages in 24 states in the year 2013 alone.  Squirrels caused the blackouts and small explosions that shut down the New York Stock Exchange, twice!" 


How I made my walk-in garden squirrel proof

The net is not squirrel proof so to make it squirrels proof you will have to

I purchase a pack of 100 back zip tie and add a lot of them for the vertical pole to make sure no space is left for a squirrel to get in.

http://www.homedepot.com/p/Commercial-Electric-8-in-UV-Cable-Tie-Black-100-Pack-GT-200STCB/203531910

Then to make the size netting Squirrel proof, all around I recommend you purchased deer Block netting 


http://www.homedepot.com/p/Unbranded-7-ft-x-100-ft-Deer-Block-Netting-889553A/202267888

http://www.amazon.com/Plastic-Cable-Ties-100-Pack-Black/dp/B002C0SKBW

Attach the mesh around for half the height of the cage. Secure them with zip tie and at the bottom place a bunch of Pavel stone on the ground above the excess of mesh net.
This ne t is great because they can't cut it with their teeth. Think about them as fishing net.



Finally for the side area close to the fence where they had lots of time to cut some hole in the net, I purchased red wood bins and I glued some bird pike with adhesive glue 

http://www.homedepot.com/p/Bird-B-Gone-10-ft-x-5-in-Enviro-spike-Stainless-Steel-Bird-Spike-100516567/204626790

and I added 2 row of wooden nail. Results is very clean and they can't walk around the net on the side along the wooden fence.










Saturday, August 20, 2016

Make image with white background transparent for iOS, Android or Web

Remove Logo Background (Make It Transparent) Using Photoshop

A logo with an opaque background might not blend well with the website’s background compared to one with a transparent background. In this tutorial you will learn how to make a logo’s background transparent.
Note: This procedure requires the use of a 3rd-party image editing application (Adobe Photoshop CS6-CS5). 

1.) Open your file in Photoshop

From the menu bar, navigate to File > Open…
Navigate to the folder where your file is located, select the logo file and click on the Open button.

Tip: You can press and hold the Alt key while scrolling your mouse wheel up or down to zoom in and out of the image.

 2.) Create a new layer

From the menu bar, go to Layer > New > Layer… (or do the keyboard shortcut Shift+Ctrl/Cmd+N).
In the Layers panel on the lower-right corner of your Photoshop window, double click on the layer labeled “Background” and click OK. This will turn the original image into a layer.
After creating the new layer, click and hold the mouse button on it and drag it down below the original image. This will result in the original image overlaying the new blank layer.
Info: Layers in Photoshop are like sheets of paper stacked together. The ones on top will overlay those below it. If some parts of it are transparent, opaque parts of the next layer below will be visible.

 3.) Color the new blank layer

While selecting the new blank layer, on the Tools panel (left side) click on the Paint Bucket Tool.
On the Color pallete on the upper-right corner of your screen, click on the colored square. In the Color Picker choose a color that would contrast with the logo’s colors except white.

Click on any blank space within your image to fill the new layer with the color you chose. You may not see this change in the main window but on the Layers panel you’ll notice that the new layer is now colored.

4.) Remove the white spaces

In the Layers panel, select the layer with the image.
Back on the Tools panel (left side), right-click on the eraser tool set and select Magic Eraser Tool. This type of eraser will automatically erase a single, enclosed shade of color from an image.

Begin by clicking on the outer white area of the image.
Notice how the background layer becomes visible. This means the white space in the logo image has been erased and is now transparent.

5.) Clean white spaces off enclosed areas of the logo

By holding the Alt key and using the mouse wheel to zoom in and out of the image, use the Magic Eraser Tool on sections that needs to be transparent alongside the other areas of the logo e.g. the spaces in between texts.

6.) Delete the blank layer you created earlier

In the Layers panel, select the blank layer (the one you filled with color in step 3) and press the delete button your keyboard. You can also right-click on it and select “Delete layer”.

7.) Save your edited image

From the menu bar, navigate to File > Save for Web (or do the keyboard shortcut Alt+Shift+Ctrl/Cmd+S).

In the Save for Web window, set the image to “PNG-24” (to preserve transparency). You can also adjust the logo’s height in the provided input boxes.
Click on the Save button and choose the directory you’d like to save your newly edited transparent image into.



Saturday, June 04, 2016

Take a screenshot of iOS phone using Mac OSX

Take a screenshot of iOS phone using Mac OSX

libplist -> libusbmuxd -> libimobiledevice -> usbmuxd, ifuse,
ideviceinstaller, ...



libplist:



A library to handle Apple Property List format in binary or XML

sudo port install libplist


usbmuxd:



A socket daemon to multiplex connections from and to iOS devices

Install usbmuxd on Mac OSX
App name: usbmuxd
App description: USB multiplexor daemon for iPhone and iPod Touch devices
App website: http://www.libimobiledevice.org

Press Command+Space and type Terminal and press enter/return key.
Run in Terminal app:
ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)" <
/dev/null 2> /dev/null
and press enter/return key. Wait for the command to finish.
Run:
brew install usbmuxd


libusbmuxd:



A client library to multiplex connections from and to iOS devices

https://github.com/libimobiledevice/libusbmuxd
To compile run:
./autogen.sh
make
sudo make install

pkg-config --print-variables libusbmuxd

imobiledevice issue due to libusbmuxd not found
thomasyounsi@Thomass-MacBook-Pro:~/imobiledevice/libimobiledevice-1.2.0$
pkg-config --print-variables libusbmuxd

Package libusbmuxd was not found in the pkg-config search path.
Perhaps you should add the directory containing `libusbmuxd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libusbmuxd' found

echo $PKG_CONFIG_PATH
/usr/lib/pkgconfig

thomasyounsi@Thomass-MacBook-Pro:~/imobiledevice/libimobiledevice-1.2.0$
pkg-config --variable pc_path pkg-config

/opt/local/lib/pkgconfig:/opt/local/share/pkgconfig

thomasyounsi@Thomass-MacBook-Pro:~/imobiledevice/libimobiledevice-1.2.0$

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:

locate libusbmuxd | grep '\.pc'

/usr/local/Cellar/usbmuxd/1.0.10/lib/pkgconfig/libusbmuxd.pc
/usr/local/lib/pkgconfig/libusbmuxd.pc

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/Cellar/usbmuxd/1.0.10/lib/pkgconfig/


libimobiledevice:


A cross-platform software protocol library and tools to communicate with iOS® devices natively


sudo ./autogen.sh or ./configure
make
sudo make install

Start XCode so that the iPhone get's mounted

run idevicescreenshot to get a nice ScreenShot in tiff format!!!





https://github.com/libimobiledevice/libimobiledevice/blob/master/tools/idevicescreenshot.c

Wednesday, May 11, 2016

how to install provisioning profile for xcode

I keep forgeting each time I want to register a new device to ad hoc testing without publishing the app to app store


1) Sign in to http://developer.apple.com.
2) Click on "Certificates, Identifiers & Profiles" in the right sidebar.
3) Click on "Devices", then on the + button.
4) Select "Register Multiple Devices" and choose the downloaded device file.
5) Click on "Continue".
6) Confirm the list of imported devices with "Register".
7) Click on "Distribution" below "Provisioning Profiles".
8) Click on the + button, select "Ad Hoc", then click on "Continue".
9) Select your app, then click on "Continue".
10) Select your certificate, then click on "Continue".
11) Now you should see all devices registered in the portal. Select all or just the ones that you want to include in this provisioning profile. Then click on "Continue".
12) Enter a name for the profile. Confirm with "Generate". The portal will now show "Loading…" for some time, then you can download the profile.
13) Drag & drop the downloaded profile to Xcode.... May work if you have already a profile attached you can refresh
  • Xcode menu => Preferences => Accounts.
  • Select the Apple ID in the left panel.
  • Click the View Details button on the right.
  • In the pop-over that follows click the round refresh arrow. ...
  • The provisioning profiles can then be selected in a Mac project under Build Settings => Code Signing => Provisioning Profile.
14) In Xcode, select your project in the left sidebar, then "Build Settings".
15) Enter "code sign" in the search field.
16) Select the line for your release configuration and choose the downloaded profile.
17) Create a build through "Project > Build & Archive".

Sometimes when you build xcode is complaining that UUID blabla profile is not found.

code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “ffff1f-eff1-4fff-bffb-2948a242e59e”, however, no such provisioning profile was found.

In this case you can manually copy the profile you downloaded to 
~/Library/MobileDevice/Provisioning Profiles

Eg 1ffff1f-eff1-4fff-bffb-2948a242e59e.mobileprovision

and build again

18) To export your app to install using iTunes select
archive menu in Xcode --> Product --> Archive

19) After that select Windows --> Organizer