How to replace your iPod Touch 2nd gen digitizer / outer glass and bezel frame

Posted by solipsistic on 31 May 2009 | Tagged as: ipod touch

If you’re like me, you recently had a small accident with your iPod touch… you broke the screen! In our case, the iPod had slipped from a pants pocket into the recliner. It got caught between a few internal recliner arms and pinched to the point where the upper portion of the glass was broken.

In the case where your outer glass (called the digitizer) is broken but the LCD underneath is still perfect, you can replace the glass for $50-$75 in parts and tools. If you just want someone to fix it for you, it’ll run $100+ for a 2nd gen from a parts store. Much better than the $200+ I’ve heard about from the Apple store.

I found a few video tutorials and other articles about replacing parts on the iPod Touch 2nd gen, but nobody described a few issues that I ran into. First, a few good resources:

Things you’ll need

  1. Plastic opening tools (these often accompany digitizer replacements on ebay)
  2. A new digitizer. Available from eBay or a parts shop like http://www.pdaparts.com
  3. Most likely you’ll also need a new front bezel or frame. For best results, get one with rubber gasket around the edge and double-sided tape on the inside
  4. A thin knife with a strong blade (mostly optional)
  5. A small pair of wire cutters (optional)
  6. Intermediate skill if you buy a new front bezel / frame, and advanced skill if you salvage the old one . I took the easier route and bought a new front bezel. Either way, you still need the button seat from the old bezel.

Unfortunately most of the part stores and eBay sellers that advertise replacement digitizers for 2nd generation iPod touches don’t mention that the front bezel is extremely difficult to remove without damage. The front bezel and digitizer are attached through buttons around the digitizer edges. My broken digitizer was also glued down to the front bezel. Additionally, there is a thin rubber gasket that runs around the length of the digitizer. Even with careful prying with my fingers and plastic tools I tore the gasket in several places.

Take it apart

The youtube video linked above gives very good information about the location of the clips and how to pull the digitizer off without damaging it. Be careful that you press the plastic tool on the outside of the rubber gasket (closest to the metal backing) rather than the inside of the rubber gasket (closest to the actual glass). This is especially important if you don’t want to damage the bezel. I found that I accidentally separated the bezel from the digitizer because I didn’t realize the distinction.

Once you have the digitizer off, you can put the rest of the iPod aside and focus on separating the glass from the bezel. It is a pain, and assuming your digitizer is cracked, is likely to drop pieces of glass. You only need to separate the glass from the lower portion of the bezel (near the home button).

The goal is the grab the home button and its seat. I haven’t seen any parts stores that sell the seat, so don’t mess it up! The button just fails out.

The edges around the button seat are raised. After bending the plastic various ways, I found the easiest way to retrieve it is to use a small wire cutter and snip off the edges to the right and left, removing the raised edges. This will allow you to take a small, thin knife and slide it under the tiny plastic buttons that hold it on. Keep the knife away from the center of the button seat because that might sever the electrical connection.

Attach the new digitizer and bezel

Since I didn’t know that I needed a bezel to do the replacement, I just ordered it tonight. I will post more information and pictures when the part arrives.

Slide in the new assembly

After you have the new digitizer and bezel together, complete with home button, you can put it back together! Don’t forget to attach the digitizer ribbon to the rest of the iPod.

Thats it! Post a comment about how your replacement goes.

Remember Basic Authentication passwords in Firefox without Roboform

Posted by solipsistic on 09 Feb 2008 | Tagged as: firefox

If you like to save your passwords, you probably know that its a pain to save Basic Authentication passwords in Firefox. Basic Authentication comes up in a new window saying “Enter username and password for …” and looks like this:

Prompt

There is no ’save this password’ button. If you access this site every day, and close Firefox between sessions, you’d have to type your username/password every time. No longer!

It is possible, though seemingly undocumented, to save the username/password inside the HTTP URL (this long has been done with FTP). For example:

http://user:password@layer2.org

bookmark

Just put this into a bookmark, and you have an easy way to access your password-protected site. Of course, if the password is actually sensitive, you might think twice about saving it in plain text as a bookmark!

The only annoying thing that happens using this method is that you’ll see this prompt the first time you try to log in (for any given Firefox session):

Log in

Just press OK. While not perfect, this is a heck of a lot easier to deal with than entering the password each and every time.

Rails migration with a list of all United States

Posted by solipsistic on 12 Jan 2008 | Tagged as: rails, ruby

How many times have you created web applications that use addresses? Since I felt like I wasted the entire 10 minutes it took me to type out this state list, I figured I’d share it with everyone so that their time wasn’t equally wasted. Enjoy.

Run this command:

ruby script/generate model State

And put this in db/migrate/XXX_create_states.rb:

class CreateStates < ActiveRecord::Migration
  def self.up
    create_table :states do |t|
      t.column :name, :string
      t.column :abbreviation, :string
    end
 
    State.create :name => 'Alabama', :abbreviation => 'AL'
    State.create :name => 'Alaska', :abbreviation => 'AK'
    State.create :name => 'Arizona', :abbreviation => 'AZ'
    State.create :name => 'Arkansas', :abbreviation => 'AR'
    State.create :name => 'California', :abbreviation => 'CA'
    State.create :name => 'Colorado', :abbreviation => 'CO'
    State.create :name => 'Connecticut', :abbreviation => 'CT'
    State.create :name => 'Delaware', :abbreviation => 'DE'
    State.create :name => 'District of Columbia', :abbreviation => 'DC'
    State.create :name => 'Florida', :abbreviation => 'FL'
    State.create :name => 'Georgia', :abbreviation => 'GA'
    State.create :name => 'Hawaii', :abbreviation => 'HI'
    State.create :name => 'Idaho', :abbreviation => 'ID'
    State.create :name => 'Illinois', :abbreviation => 'IL'
    State.create :name => 'Indiana', :abbreviation => 'IN'
    State.create :name => 'Iowa', :abbreviation => 'IA'
    State.create :name => 'Kansas', :abbreviation => 'KS'
    State.create :name => 'Kentucky', :abbreviation => 'KY'
    State.create :name => 'Louisiana', :abbreviation => 'LA'
    State.create :name => 'Maine', :abbreviation => 'ME'
    State.create :name => 'Maryland', :abbreviation => 'MD'
    State.create :name => 'Massachutsetts', :abbreviation => 'MA'
    State.create :name => 'Michigan', :abbreviation => 'MI'
    State.create :name => 'Minnesota', :abbreviation => 'MN'
    State.create :name => 'Mississippi', :abbreviation => 'MS'
    State.create :name => 'Missouri', :abbreviation => 'MO'
    State.create :name => 'Montana', :abbreviation => 'MT'
    State.create :name => 'Nebraska', :abbreviation => 'NE'
    State.create :name => 'Nevada', :abbreviation => 'NV'
    State.create :name => 'New Hampshire', :abbreviation => 'NH'
    State.create :name => 'New Jersey', :abbreviation => 'NJ'
    State.create :name => 'New Mexico', :abbreviation => 'NM'
    State.create :name => 'New York', :abbreviation => 'NY'
    State.create :name => 'North Carolina', :abbreviation => 'NC'
    State.create :name => 'North Dakota', :abbreviation => 'ND'
    State.create :name => 'Ohio', :abbreviation => 'OH'
    State.create :name => 'Oklahoma', :abbreviation => 'OK'
    State.create :name => 'Oregon', :abbreviation => 'OR'
    State.create :name => 'Pennsylvania', :abbreviation => 'PA'
    State.create :name => 'Rhode Island', :abbreviation => 'RI'
    State.create :name => 'South Carolina', :abbreviation => 'SC'
    State.create :name => 'South Dakota', :abbreviation => 'SD'
    State.create :name => 'Tennessee', :abbreviation => 'TN'
    State.create :name => 'Texas', :abbreviation => 'TX'
    State.create :name => 'Utah', :abbreviation => 'UT'
    State.create :name => 'Vermont', :abbreviation => 'VT'
    State.create :name => 'Virginia', :abbreviation => 'VA'
    State.create :name => 'Washington', :abbreviation => 'WA'
    State.create :name => 'West Virginia', :abbreviation => 'WV'
    State.create :name => 'Wisconsin', :abbreviation => 'WI'
    State.create :name => 'Wyoming', :abbreviation => 'WY'
 
  end
 
  def self.down
    drop_table :states
  end
end

Use ffmpeg to extract first image out of FLV

Posted by solipsistic on 03 Dec 2007 | Tagged as: linux, web

I found at least one other person trying to find a way to extract a JPG snapshot out of a flash video using ffmpeg.

The above article suggests using ffmpeg to extract a PNG, and then convert that to a JPG (since the JPG will be much smaller). Instead, just use the correct arguments to ffmpeg:

ffmpeg -i movie.flv-vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 movie.jpg

With -vcodec mjpeg the important argument.

Rails’ attachment_fu, :thumbnail_class and you

Posted by solipsistic on 19 Nov 2007 | Tagged as: rails, ruby

I was having a bit of trouble with attachment_fu that took a while to figure out, so I thought I’d post my solution for the next person.

I have a Photo model that I’m using to store pictures. Since attachment_fu will automatically resize, create thumbnails, and store pictures on the file system, it was an easy choice to use it. The things I found I didn’t like about it:

  1. It stores thumbnails as separate records inside the photos table. This means you have to check if thumbnail.nil? each time you display the pictures, and you’ll have to check parent_id.nil? to count your photos.
  2. You can’t use your own model validations. For example, I wanted to use
validates_presence_of :name
validates_presence_of :description

But I’d always get validation errors because attachment_fu tries to save the thumbnail attributes when it creates or resizes a thumbnail. As you can imagine, this is a major problem.

:thumbnail_class to the rescue

Mike Clark’s attachment_fu blog post mentions that you can use the :thumbnail_class argument to separate your model validations and attachment_fu’s validations. Here’s how to do it:

class Photo < ActiveRecord::Base
  has_many :thumbnails, :foreign_key => 'parent_id'
 
  has_attachment  :storage => :file_system,
                          :content_type => :image,
                          :max_size => 10.megabytes,
                          :resize_to => '640x480',
                          :thumbnails => { :thumb => '100x100' },
                          :thumbnail_class => Thumbnail
 
  # Validations
  validates_presence_of :name
  validates_presence_of :description
end
 
class Thumbnail < ActiveRecord::Base
  belongs_to :photo, :foreign_key => 'parent_id'
 
  has_attachment  :storage => :file_system,
                  :content_type => :image
end

The killer for me initially was that I wasn’t specifying has_attachment in the Thumbnail model. I always got this error:

undefined method `temp_path=' for #thumbnail:0xb69a9514

So save yourself by putting has_attachment in both models. Make sure to define any attachment_fu arguments in your Photo model, and leave the Thumbnail model bare. You’ll also want to make sure you have the normal attachment_fu schema in both models:

      t.column :parent_id,  :integer
      t.column :content_type, :string
      t.column :filename, :string
      t.column :thumbnail, :string
      t.column :size, :integer
      t.column :width, :integer
      t.column :height, :integer

I’ve found that everything seems to be working as normal going this route. My model validations work and the thumbnails are not polluting the photos table. If you want to find the Photo for a particular Thumbnail, keep in mind that parent_id now refers to the id in the Photo model:

t = Thumbnail.find ....  # find your thumbnail
p = Photo.find(t.parent_id)

And for the ultimate ease-of-use relationship, just use:

t = Thumbnail.find ....  # find your thumbnail
p = t.photo               # get a photo
p.thumbnails              # get all thumbnails

This works since we defined the has_many relationship in the model.

Let me know if you have any problems with this method or if it helped you!

Serve home directories to internal IPs only with lighttpd

Posted by solipsistic on 04 Nov 2007 | Tagged as: network, web

Recently, I decided I wanted to share home directories via HTTP to everyone on my home network. This is an easy way to share files with Windows machines where you don’t have any type of sshfs-like support. The problem was that this file/web server also faces the Internet. Obviously I don’t want to share our personal files to anybody who cares to look. After a bit of playing, I came up with this configuration:

$HTTP["remoteip"] != "192.168.1.0/24" {
  $HTTP["url"] =~ "^/~" {
    url.access-deny = ( "" )
    dir-listing.activate = "disable"
  }
}

This allows any host with an IP in the 192.168.1.1-254 range view any URL that begins with /~username. It denies everyone else with a 403 – Forbidden message. Note that for some reason, listing the conditions in the opposite order (url first, remoteip second) did not produce the correct results.

Finally, make sure that you have both the appropriate modules enabled:

server.modules += ( "mod_access", "mod_userdir" )

Google IMAP will be a Yahoo mail killer!

Posted by solipsistic on 24 Oct 2007 | Tagged as: mail

If you haven’t heard already, Google with be and is offering IMAP for their Gmail service! You might not have it available on your account immediately, but it should be within a few days or a week.

I’m one of the lucky ones that already has IMAP set up. I tried it out in Thunderbird and the setup was quite smooth. The only problem I ran into is that some of my old chats came up with a timestamp of 2:33am this morning. So, they were out of order and weird, but it wasn’t that big of an issue.

The real point I wanted to make in this post is that this will be a killer (imo) for Yahoo mail. Back in the day when I signed up for Yahoo mail, they were on the leading edge for features and interface. I remember when they moved to the interface they have which they now call their ‘classic’ interface, and I have saved HTML pages that show what their REAL classic interface looks like.

But until now I have not had a reason to move to Gmail. While I do have a Gmail account, I don’t use it as my primary account because there was no real advantage to switch to it. Some of the features might be nicer and sexier, but webmail is still webmail. Now that Gmail offers IMAP along with a host of other features that set it apart from other webmail clients, there is a huge reason to move to Gmail. For this reason, Yahoo will lose many ‘techie’ customers it hasn’t already lost unless it offers the same feature.

In case you’re curious, here are the settings:

Incoming: imap.gmail.com
Outgoing: smtp.gmail.com
Username: username@gmail.com
SSL: yes

Have fun!

LDS General Conference Podcast RSS feed

Posted by solipsistic on 20 Oct 2007 | Tagged as: Uncategorized

LDS General Conference audio and video is available via podcast!

After watching conference the LDS General Conference at the beginning of October, I really wanted to download all the talks via an RSS feed. I didn’t see one available right away, so I considered making my own. Fortunately, I found that an official podcast does exist. Its just not publicized well by the Church.

MP3 audio: http://feeds.lds.org/ldsgccomplete_eng

Video: http://feeds.lds.org/ldsgccomplete_eng_mp4

This should get you the most recent General Conference. If you haven’t used RSS before, you just need to give either (or both) of the above feed URLs to a podcast downloader (such as iTunes). The downloader will download all the current talks, and theoretically, will download the new talks next conference.

As an unrelated side note, feeds.lds.org is actually hosted by feedburner. Thanks to ldswebguy for originally posting these podcast feeds.

Verizon FIOS and running a Linux operating system

Posted by solipsistic on 19 Oct 2007 | Tagged as: fios, linux, network

Despite the well known fact that Verizon Can’t Do Math, I have to say that I am surprised to find that their FIOS service is pretty good. I’ve had it for over a month, and haven’t noticed it go down or have any speed problems.

More interestingly, I’ve actually found that they are pretty Linux-friendly. Actually, Linux-friendly might be too strong – lets just say that they have not locked me into using Windows for their service. I did have to use activatemyfios.verizon.net, which has a Windows/OS X only Firefox extension. But other than that, I haven’t felt the vendor lock-in blues.
Here are some good points:

  • As far as I can tell, Verizon only blocks port 80. I run both SSH and HTTPS from my home box.
  • Once I spoofed the correct MAC address, I was able to use my own non-Verizon router
  • There is no PPPoE authentication or the like
  • My IP address has not changed since I started the service
  • Latency is very low (about 12ms to Google)
  • Service has not gone down

I don’t use their phone or TV services, so I can’t comment on those. My guess would be that services like Vonage or Skype would work pretty well on my FIOS connection.

Bad points:

  • The backup battery is supposedly pretty weak. It only provides voice service during a power outage, not Internet. For that, you’d have to use a UPS. Fortunately, I haven’t had the power go out.
  • It took forever to get the service installed. Even though the previous house owner already had FIOS installed, they couldn’t come out for 2.5 weeks.

Verizon does pretty well here. So if you’re thinking about switching – I would recommend it.

How to create a lookup table in Ruby on Rails

Posted by solipsistic on 18 Oct 2007 | Tagged as: rails, ruby

I’m a big fan of the Rails way, but sometimes the simple things get you. I like to set up “lookup tables” in Rails, ie. tables in the database that hold commonly used, (often) fixed values. For example, if I have a Car model, I might want to define a Car type model. This would have two purposes:

  1. Give me the ability to associate a type with the Car model (ie. Car.type => ’sport’)
  2. Pre-load common values into the database (ie. sport, coupe, sedan, etc)

Continue Reading »

Next »