Saturday, December 31, 2011

Putting your iPod Touch into Recovery Mode

Recently my daughter's 2nd generation iPod Touch got into a state where it was permanently asking to connected to iTunes.  The problem was when I connected to iTunes I was given the following error message:

iTunes could not connect to the iPod because it is locked with a passcode. You must enter a passcode on the iPod before it can be used with iTunes.
Obviously, I couldn't enter a passcode because the iPod was stuck on the "Connect to iTunes" screen.  I did some searching and it seemed the tried and true approach was to put the iPod into "recovery mode".  Simple enough, I thought.  I tried the instructions at Apple's own site: http://support.apple.com/kb/ht1808

But, the instructions as written did not work.  I tried them over and over again with no luck.  Finally I made a Genius Bar appointment at my local Apple store and the guy there did a slight variant on the apple instructions which I will post here.  If you think the Apple support instructions do indeed work please comment below.  I'm happy to be proven wrong, but I banged my head on this for quite a while before throwing up my hands.

Here's what the Apple Store employee did, and how it differs from the support instructions.

  1. To turn off the device he held the Sleep/Wake button and the Home button for 10 to 15 seconds, and continued to hold down the Home button after that. (The support site recommends turning off the iPod in the regular fashion by holding the Sleep/Wake button down and using the red slider - this is what I tried time and time again to no avail.)
  2. While still holding the Home button, plug the iPod into your computer with iTunes running.
  3. Wait for the iPod to restart (still holding the Home button), and you should be prompted by iTunes that it has found a device in recovery mode.  
  4. Follow the prompts to restore the software on your iPod (may take some time)
  5. Reset your passcode (if desired)
Update: Here's a link to a recent answer on the Apple StackExchange site to a question I posted about this a while back.  His steps are more succinct than mine.

Wednesday, November 30, 2011

So Now You Tell Me!: Setting Up Eclipse for Android Development on Windows

Note: I've toyed with creating this "So Now You Tell Me!" series for a while. The goal is to create useful how-to posts for tasks that I can't find definitive instructions for anywhere on the web.

I've talked to a handful of developers that have Android phones who want to dabble in developing an application, but find it a bit difficult to get the development environment up and running. The google page for installing the Android Developer Toolkit is a decent start, but assumes you have the Java and eclipse parts down already.

My goal here was to create the "missing manual" for bootstrapping an Android development environment on Windows (Windows 7 in this case). I really try to leave no stone unturned, without adding so much additional detail as to make it hard to follow. I'll update it as I learn more, or as the Android SDK evolves. Please comment below if you find an error, or information that may be missing!

So, here we go...

Installing the JDK (Java Development Kit)



The first thing we need to do is to install the java development kit and runtime on our computer.  You can find the latest stable download at:

http://www.oracle.com/technetwork/java/javase/downloads/index.html


The full JDK installer is needed, just the JRE will not be enough.



1. Find the windows EXE installer for your platform (32-bit or 64-bit) in the list and download it to your computer

2. Run the installer and follow the default prompts until it completes


Installing the Eclipse IDE

1. Open http://www.eclipse.org/downloads/ in a browser

2. The order and names of packages change fairly frequently. Select the "bare bones" package as I call it, usually called something like "Eclipse IDE for Java Developers" (Make sure you select the proper platform - 32-bit or 64-bit).  As of the time of this writing the latest version available for Windows is "Indigo SR1".



3. You will be prompted to download a zip file with the eclipse software.  Save it to disk then extract it to an empty folder on your computer.

4. From the root of the extracted eclipse folder, run eclipse.exe


5. Eclipse has the idea of top level "workspaces", which are basically folders which contain any number of eclipse projects that serve as default starting points when opening eclipse.  You'll be prompted to create a new workspace the first time.  Enter the name of an empty folder on your computer where you want your workspace to reside.



6. When eclipse has started, close the initial "Welcome" tab to see the initial view (or the initial "Perspective" in eclipse jargon).

7. Close eclipse for now, we'll come back to it later


Installing the Android SDK

The Android SDK install can be found at:

http://developer.android.com/sdk/index.html

I always select the EXE installer for Windows.


1. Download the Android SDK EXE installer (versioned at 'r15' at the time of this writing.  Google increments this number with every new release of the Android SDK and that number is what is used when selecting which SDK version to target in your application - more on that later)

2. Run the executable installer and follow the default prompts

3. At the end, choose to run the SDK Manager which will help you download the various SDK versions that you may want to target for your application





Using the Android SDK Manager

When the SDK manager first starts, you'll be prompted with a list of SDK versions to download.  I usually research what the current distribution of Android versions is out in the wild, and then install all SDKs that will cover the vast majority of the handsets.  (At the time of this writing I usually install all versions back to 2.1).

1. Select all the SDK versions that you may want to support



2. Click Install X Packages, where X is the number of selected SDK packages.

3. You will be prompted with a list of selected packages - click Install

Warnings:
  • Installing all the selected versions may take a while
  • If you have an aggressive firewall installed you may see warnings of attempts to connect to multiple local ports - allows these connections or you may have problems

One last thing you will need to do is create an emulator image (AVD - Android Virtual Device) to run your apps in during development.  To accomplish that do the following:

1. In the SDK Manager, select Tools > Manage AVDs from the menu bar

2. Click the New... button

I usually enter the following values:

Name: PlainXX where XX is the version of Android I am targeting (e.g. Plain21 for Android 2.1)

Target: Pick the lowest version of Android you want to support (2.1 in my case). Yes, more recent versions have more APIs and features, but you'll exclude yourself from large market segments if you pick the most recent version. If you plan on creating a tablet-specific version as well, then create a separate AVD targeting version 3.0 or above later on.

Size: Unless you are doing heavy SD Card data storage in your app, you can pick a relatively low SD card size.  I usually pick 40 MB.

Snapshot: This persists emulator state between test runs.  I usually leave this unchecked as using it decreases emulator performance on startup.

Hardware: I usually go with the default hardware settings.  If you are targeting a specific set of hardware features (resolution, etc), do it here.



3. Click Create AVD then exit the SDK Manager



Installing the Android Developer Toolkit (ADT) Plug-in For Eclipse

The Android Developer Toolkit (ADT) is a plug-in for eclipse that provides project types and tools to develop Android applications more quickly.  It can be found at: http://developer.android.com/sdk/eclipse-adt.html

The instructions to install the ADT are on the link page, but here they are for completeness sake:

1. Start eclipse again

2. Select Help > Install New Software... from the menu

3. Click the Add button in the top right-hand corner

4. In the Add Repository dialog, type ADT for the name and in the Location box type: https://dl-ssl.google.com/android/eclipse/

5. Once the item is fully loaded, mark the check box next to Developer tools and click Next



6. You will be shown a list of items that will be installed, click Next

7. Accept the license terms and click Finish

8. When the installation is complete, restart eclipse

9. When eclipse restarts, you will be prompted to install a new SDK or select an existing one.  Since we already installed the SDK and downloaded all the revisions we need, choose Use Existing SDKs, and enter the root folder of the Android SDK (Usually "<System Drive>:\<Program Files Folder>\Android\android-sdk".  e.g.:

C:\Program Files (x86)\Android\android-sdk



10. Click Next

You're now ready to create your first Android application!



Creating an Android application project

To create an Android project in eclipse:

1. Select File > New > Other from the menu bar

2. In the resulting dialog, under Android select Android Project



3. Click Next

4. Type in a project name and click Next

5. Select the target Android version (again, the lower the better - 2.1 in my case)



6. Click Next

7. Lastly, type in a java package name, usually in the form like this: com.companyname.product, but you can pick whatever serves you best.

8.  Click Finish


Now you are ready to start coding!

Sunday, May 15, 2011

I'm totally HP'eeved

Update:

HP actually read my email and an "executive support representative" called me to discuss the issue. I was hoping they would stand behind their products and perhaps fix at least one of the laptops at their cost. All the rep did was tell me that it would basically be $300+ per motherboard. I told her I could have gone through normal repair channels if I wanted to take that route. Why should I have to buy 2 or 3 year warranties on the hardware? The first laptop was obviously defective - 2 motherboard replacements in 6 months???? And you're going to hide behind the fact that it failed for a third time outside of the warranty period and expect me to pay 1/2 to 1/3 the price of the original to get yet another motherboard that may fail prematurely? I've thought about it and I cannot remember any other brand with which I have had such a universally poor experience. I do not expect HP to fix every old product that has failed in the field no matter what the reason. But when you have a product like the one I bought that (at least in my case) has a history of failure, I do expect you to stand by your product regardless of the warranty terms. The original post is below:


Over the past 4 years I have had horrible experiences with HP products. 2 laptops dead within 2 years of purchase, and a printer that I cannot connect to over my home network. I don't know if I can name a brand with which I have had a more disappointing experience. Of course both laptops are out of warranty, and with both seeming to suffer from motherboard failures I would be on the hook for a fair amount of money to fix them.

While I develop software for Microsoft platforms and do love the Windows experience, they are an unfortunate casualty of my HP woes. In fact when I went back to buy another laptop, I could not look at a Windows notebook without having severe pangs about whether it would last any longer than the ones I have already owned, regardless of the brand. So I actually ended up buying a MacBook Air. I can't afford to be buying new machines every 2 years. I like to spend my money on other things, like housing and food.

So I'll probably call HP support and try to get them to fix my laptops without significant cost to me, but before I do that I figured I'd use the mail the CEO link on HP's site to tell him about my woes. Of course, I know how these things work. Some automated system probably processes these things, looking for keywords and possibly forwarding items of interest to a potential human. But what the heck, at the very least it was cathartic. I would have written more but I was limited in the # of characters I could send. The text is below.

Dr. Mr Apotheker,

I'm writing you to inform you of my almost universally poor experience with HP products.

In September of 2007, I purchased a HP Pavillion dv9000z notebook. Within the first 6 months I had to send it in for repair twice. The motherboard was replaced both times. After 2 years of owning it, the motherboard failed again (and of course it is now out of warranty).

In November 2008, I purchased a HP Pavillion DV6809WM notebook. Again, almost 2 years to the day, the notebook died with very similar symptoms to my original HP laptop. I suspect it is the motherboard again (and of course, out of warranty).

I also have an HP Photosmart 3301 printer which refuses to let me connect to it over my home network. I have been on the phone for many hours with HP support and they have been unable to help me resolve this. I am a computer professional myself, so it is rare that I even need to call support for any product, but your printer continues to confound.

So I have 3 HP products which I paid a lot of money for which are useless to me right now. The whole experience has been so frustrating that I purchased an Apple MacBook Air as our family laptop, hoping that their reputation for quality hardware products will turn our dismal fortunes around.

I'd appreciate any advice you have which would help me get my HP products working again without having to go to great personal expense and inconvenience to do so. I cannot tell you how disappointed I am with my HP products and I would be hard pressed to recommend your products to anyone. In fact I would probably actively discourage anyone from buying HP products.