Awesome tools for data recovery

So I did something incredibly stupid the other day. While trying to do a clean Linux install, I wiped my external HDD clean and overwrote it with an OS. I meant to do that to my internal drive but I messed up, badly. I absolutely was just not paying attention to what I was doing. I had other things on my mind and when I realized what was happening, my reaction was something like this:

Michael-scott-no-god-no

I had 4+ years of photos, a large collection of wallpapers, animated gifs, purchased mp3s, and other valuable information stored on that external HDD. I thought everything was lost forever, but I wasn’t going to just give up. So I turned to my trusty friend Google and asked it for help. I came across a number of resources which I’d like to share with you here.

PhotoRec
The steps laid out in the above link is what I used to recover most if not all of my data that was wiped AND overwritten. I’m not sure if I got it ALL because I had so many photos and other files but a large majority of them seem to be there. Follow the instructions in that link and you should be good to go.

BootMed
This was the first thing I stumbled upon. When you download it, you get a zip file containing an iso. Burn that bad boy onto a CD/DVD and boot your computer from the CD/DVD you just made. It’ll load Ubuntu 10.10 with some custom tools installed. When Ubuntu boots up it’ll open a website in FireFox automatically with some instructions. You can use either TestDisk (this one didn’t work at all for me) or PhotoRec (worked amazingly). I recommend burning a copy of this iso to have handy in case of emergencies! It has a lot of nice tools packaged into one iso.

MAMP: Working around phpMyAdmin’s MySQL file size limit when importing a database

Working locally has many advantages. I try to stay away from developing on a production server whenever possible for a number of reasons. The major reason is that I don’t want to make a mistake that can corrupt my data or bring the server down.

I’m currently working on a project that involves calling data from a large database (> 100MB) using some old PHP code a previous developer wrote. I *could* just tinker with it on production but I don’t think that’s a good idea. So I decided to export the database from the production server and then tried bringing it into phpMyAdmin so I could work locally. I kept getting a very ambiguous error saying:

You probably tried to upload too large file. Please refer to documentation for ways to workaround this limit.

Error messages that use the word “probably” kind of irk me, but that’s another post. The documentation was no help either, I tried all the things they recommended but still no luck. I could use a tool they recommended to use in order to split the file up but the disclaimer on the site saying “We are not responsible for lost data” made me not want to use it. It dawned on me that there had to be a way to import this via the command line, and indeed there was. Why didn’t I think of that first.

First create the database you want to import the data to. Either in phpMyAdmin or in the terminal.

To import your abnormally large DB, type this in a terminal:

/Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot dbname < /path/to/database/you/want/to/import.sql

Obviously if you have a different username, password and database name, change the appropriate parameters. If it is a really large file it may take a while but viola! No more being at the whim of phpMyAdmin, you just took matters into your own hands.

Children’s Museum of Oswego Gets A Website

cmoo

I’m happy to share with you a new website I did for the Children’s Museum of Oswego. It was a pleasure working with Jon and Jill Shaver on this and they are truly doing a wonderful thing for the Oswego community. While I don’t currently live in Oswego, I was born and raised there and know there needs to be more things like this there. If you’d like to find out more information about CMOO, check out their website at www.cmoo.org.

Simple Sticky Footer Using jQuery

I was recently working on a project that required a sticky footer. I needed the footer to always be aligned flush with the bottom of the screen. This was no problem when there was enough content to push the footer against the bottom edge. But what happens when there isn’t enough content? You end up with a floating footer and that’s no fun.

I immediately Googled the problem and found a bunch of various jQuery and CSS solutions. When I tried them though, none of them seemed to do exactly what I wanted them to do. Plus my code was structured a little differently than the examples. I decided to just try to come up with my own solution using jQuery. I’ve had enough of dealing with IE’s quirks, IE understands JQuery so it seemed like the easiest solution.

In order for this to work, the footer can’t be in a wrapper class. The code would have to be structured like this example:

<div id="page"></div>
<footer id="colophon"></footer>

Also, it is required that you set margin and padding for body to 0. These are the only requirements as far as I know of that have to do with CSS.

body {
    margin: 0;
    padding: 0;
    }

The idea behind the jQuery was pretty simple. Check the height of the element, then check the height of the viewport. If the viewport height is greater than #page’s height, then we need to set some CSS on the footer. That CSS will just absolutely position it at the bottom of the frame. It’s a good idea to make sure your footer’s width is 100% so it looks right.

I brought in jQuery and inserted the code.

<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script><script type="text/javascript">
$(document).ready(function() {
  var bodyHeight = $("body").height();
  var vwptHeight = $(window).height();
  if (vwptHeight > bodyHeight) {
    $("footer#colophon").css("position","absolute").css("bottom",0);
  }
});
</script>

In order to make this work with older versions of IE (< IE9), include Google's HTML5 shiv. [html] <!-- Add conditional for IE7 + 8 support --> <!--[if lte IE 8]> <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> [/html]

See the demo

Worked like a charm for my purposes. Feel free to modify it for your own use. If you have any questions or comments, feel free to leave a comment! 🙂