hacks


17
Jul 10

An easy hack to sharpen images on iPhone 4

I recently released my first web app ported to the iPhone and Android devices. Only a couple days after deploying it, I found out about the increased DPI on the new iPhones.

Once I got my own iPhone 4 to test with, I noticed a huge problem with my web app. The images all looked pixelated against the beautiful text on the display. Not wanting to redo the CSS and header to define a larger viewport, I started to look for better solutions.

I decided to put larger images into the page than the tags were coded for. This way, the images would be resized smaller for the iPhone gen 1, 2, and 3. But for the iPhone 4, it would “zoom” the image to native resolution.

  1. Figure out the ratio that you need to increase all your images by.  This is the formula that I used… (960 / (viewport width)) * (image dimension).  My viewport was set to 320px and my image was 280px, so my equation looked like this:  (960/320)*280.  So, I created new images that were 840px wide.
  2. Since I already had my image tags defined with the appropriate height and width, I just saved the larger images as the same file names.
  3. Success.

This turned out really great, the iPhone does a fantastic job at scaling images, so it looks great on the older iPhones and looks fantastic on the new ones.  Check out the demo.

How to find the viewport on your web app.

<meta name=”viewport” content=”user-scalable=no, width=320” />

If you are using “device-width” as the viewport width, assume 320.
<meta name=”viewport” content=”user-scalable=no, width=device-width” />

A CSS based alternative solution

The folks at sitepoint suggest a CSS alternative that I believe is probably better if you are still in the development phase of your project.  Razor-sharp Images in Mobile Safari on iPhone 4

The only flaw I see in their solution is formula that they use to calculate image size.  Their double the size method does not accommodate for horizontal mode on the phones.

Old iPhone, before hack

Old iPhone, after hack

iPhone 4, before hack

iPhone 4, after hack


29
Mar 10

New Google easter egg

So, I am pretty much the worst speller ever. As such, I am always using google as a spell checker. Anyhow, today I was uncertain of the spelling of “recursion”. So, I googled it.

For those who do not know that recursion is… A recursive function or a subroutine is one that calls itself.

Recursion at Google

Let me google that for you.

Heck yeah, I love geek humor.

Cheers,
Jonathan


6
Oct 09

Nice life hack with Mediacom

Most of my close friends can tell you that I do not like Mediacom.  In fact, I hate most telcos in general.  But Mediacom holds a special place on my shit list.  They are particularly evil.

  • They have this thing where for the first year you get fair priced service.  $90ish for digital cable + broadband.  The only problem is that after a year, it jumps up to like $120.
  • A few years ago, they put in the DNS resolution stuff that sends you to their paid search results when you look up an invalid domain.  When they did this, they introduced frequent artificial outages that lasted for at least 3 weeks.  It didn’t take but an hour or 2 for me to figure this out, and I pointed my DNS resolution to Open DNS.  After that, I no longer had issues.  But everyone else that I knew with Mediacom continued to suffer.
  • Their customer support is just this side of worthless.  At one point, years ago I paid a few extra dollars for a static IP address.  The install kit did not contain my IP, subnet, gateway, etc.  I called customer support to get this required data.  The 1st and 2nd tier support did not know what a static IP was.  In fact, the 1st tier insisted that I did not want this anyhow.  Finally after about 30 min, I was sent to someone that knew the first thing about networking and I had my data.  Several times when I used their services, the customer support insisted that they dot not support Linux or non-M$ systems.
  • Their interface for their Digital Cable is non-intuitive.  If you press the up button while watching a channel, it goes up one (channel 13 –> 14 for example).  But, when you are navigating the guide pressing the up button results in going down a channel (channel 14–> 13).  I’m a little anal about GUIs, so that my be insignificant to most of you.

But back to the hack…

I had a friend who just got a new apartment.  This person called Mediacom and they quoted her $90 for Digital Cable + Internet.  The friend agreed.  After a couple days, the person changed their mind and canceled right before the installer arrived.  My friend had discovered an open Wi-Fi network nearby.  The next day, this person got a phone call from Mediacom.  They called to offer her the same package, but this time for $50.  Rock on.  That’s pretty cheap.

By canceling, the friend was placed on a cancellation or save list.  This enabled the person for significant discounts.

Cheers,
Jonathan