Dear Operating System Designers

I don’t care if things run slow.  I can wait 5, 10, 15 more minutes for something to encode.

I want my user interface to be fast.

I want my windows to move around fast, and I want to switch programs quickly.  When I click on menus, I don’t want to wait for disk access to do basic menus.

Biggest offender:  Windows XP Start menu — why the hell do you hit my disk when I click start->all programs?  It would take so little to cache that.

5 Tips for Optimizing Website Bandwidth Usage

More on optimization now. I’ve gone from running on a super low end VPS to one that has much more resources. Therefore, I’m not under the same extreme memory limitations I once was (although I’m unsuccessfully trying to migrate tomcat+axis to a 512 openvz server for another project).

So, what’s this about? CPU cycles are cheap. RAM costs a bit more. Bandwidth is … well, it’s cheap too, but bandwidth requirements rise with usage higher than the other two. This isn’t a hard and fast rule, but there’s a “high Y intercept” for memory requirements. With ram, you can’t run an application at all without it. However, with bandwidth, if you have zero users, you use (almost) zero bandwidth.

So, now I’m going to talk about two sites I run. UrbanPug.com and Resizr.com. Urban Pug is a simple pug focused blog that I recently redesigned. Resizr is an image resizing web application. A REALLY simple web app that resizes and crops images. It also offers image hosting, send-via-email, and send-via-SMS. With Urban Pug, the bandwidth gets consumed by lots of people looking at pictures of my dogs. With resizr, well, free image hosting. That takes up bandwidth.

So what do I do to optimize the sites?

1) Make sure all your images are fully compressed.

This first one is super important. I feel a little ignorant for having just discovered this, but Photoshop includes ICC color profiles in JPG files. I recently found that I had created the Urban Pug redesign with 14 62×62 jpeg files that were 25k each. Most of that was extraneous data. The solution is to use photoshop’s “save to web” function. Alternatively, but EVEN BETTER THAN THAT is something I found called littleutils that takes advantage of several other programs / libraries (jpegtran, pngcrush, etc) to give you some pretty kickass image compression. In almost every case, littleutils / jpegtran / pngcrush has been able to reduce the size of the files i’ve been serving. Also, in just about every case, i’ve been able to LOSSLESSLY reduce the size of files saved by photoshop (using “save to web”) by another 1-2 KB.

What’s even better about this is that the littleutils “opt-jpg” script will work in batch. I was able to save a couple hundred megs of disk space on my server (hey, i’ve got a 10 gig limit and i’m pushing it)

Message to take: make sure your images are as compressed as they can be w/o losing quality.

2) Use mod_gzip or the like.

Use something like mod_gzip which can automatically compress outgoing text. Can’t wait til there is support for mod_7zip.

3) Compress your css.

Big CSS files get loaded by every user. This can add up, even with mod_gzip. If you want to help things you, you can use a CSS compressor. When you read this, you might not see CSS as the problem. However, at some point, you’ll thank me!

4) Check what’s causing the problem!

Use the tried and true optimization technique. CHECK AND SEE. Here’s a really simple php shell script I wrote to check my access.log for what’s going on. I’m not guaranteeing it will work for you, but if you want to check it out, try it! (view script here)

Work on the biggest problems first. Optimize what you can, rinse, repeat. After some time goes by, you’ll optimize away everything you can.

5) Let hotlinkers link? But… ?

With resizr.com, I give people free image hosting for their resized images. I let people hotlink. However, this adds up. Here’s what I do to help with the bandwidth.

  1. I have a PHP script that reads and recompresses images on the fly. I use mod_rewrite to hide this.
  2. I tell the difference via a time sensitive password hash technique. Basically, PHP scripts can send “image” HTTP headers. This means that a browser will display a PHP file as an image if you do things right. You can pass GET variables into a php file that’s being displayed as an image. If you make the script require a password via HTTP GET that is varied based on a secret key plus the time plus some salt, you get something that works pretty well.
  3. I give viewers of images who are ON my site, a high quality image. I
    give hotlinkers a lesser quality image that has a black box / watermark. I tell the difference based on the password technique just above.
  4. Hotlinked images are displayed w/ added “black boxes” that tell people to come to my site. I don’t mind serving up a high quality image that uses bandwidth, but I can’t do it for free, ya know? When people actually come to my site, I can show them CPM ads and recover the costs. For an example of this, check out these hot chicks on myspace that apparently use resizr (and were using lots of bandwidth before I did all this optimization!)

I hope these tips help!

The Poor Man’s iPhone

So, last weekend, I decided to replace my 3 year old cellphone.  I liked the way the old phone worked, but it was on its last legs.  It was time to upgrade.  I’d been holding out til iPhone launch to determine if I wanted to get one, but ultimately, I couldn’t let myself part with 600 dollars for merely a phone.

I wasn’t sure what phone to get, but I’d heard good things about both the samsung blackjack and the samsung sync (a707, which my sister has).  I checked, and it looked like Opera Mini would work on both devices, so I figured i’d be able to at least do some basic web surfing with either phone.  iPhone on a budget.

Anyway, after going in and deciding on the Blackjack, the AT&T rep told me i’d have to get a $40/month unlimited data plan with it.  On the other hand, if I got a sync, I’d have to get a $20/month plan.  The AT&T rep told me that this was because “the phones accessed the internet differently” — however, they’re really giving you a different pricing plan based on expected usage of the phone, not actual capabilities (though out of the box the Blackjack may have a better browser, i don’t know).  I ended up deciding on getting the Sync, which I played with for a while, and I’ve come to realize that it’s a pretty damn good little phone, barring the usual interface difficulties.

Here’s what I like about the phone:

  • I can get Google Maps.  I didn’t know Google Maps for Mobile existed as a J2ME App, now I do.  It’s pretty similar to what you get with the iPhone, but I have a smaller screen.
  • I can browse the web.  Opera Mini works pretty well.
  • It’s got HSDPA.  While I don’t have HSDPA in my area, it’s nice to know that my phone has it for when I travel.
  • It’s got Bluetooth Dial Up Networking support.  That’s right.  I can connect my laptop to my phone and get on the internet.  On the road in an area with HSDPA, that makes for a great alternative to paying for wifi.
  • It plays MP3 files and supports up to 2GB MicroSD flash.  Yeah, only 2 gigs, but it’s better than my shuffle.
  • It connects to Yahoo Music (and Napster).  I’ve been a yahoo music subscriber for a while (though I only listen on the computer), and the possibility of putting a few playlists on my phone sounds really cool.

When you think about it, this phone gets you a good deal of what the iphone gets you, minus ITMS, minus the beautiful touch screen.  So, I think it’s appropriate to call this phone the Poor Man’s iPhone.

Apple is the new Sony…

Black is the new White.  No, wait, white is the new white.  Most of Apple’s products these days come in white, so it must be in, right?  Just as we perceive colors to have certain properties, we also see companies as having certain properties.  For example, many people see Apple, Dell, and HP as all companies that make “computers.”  Well, that’s correct, but we all know that Apple does more than just make computers.  They make iPods, AppleTVs, and of course, the iPhone!

However, what really makes Apple different?  Ultimately, I feel that it’s the business model.  First, look at how Dell works.  They’re extremely efficient at building Wintel, Win-AMD-tel WinAMDtelbuntu boxes, but they don’t innovate.  That’s not entirely accurate, they do innovate, but not at the level I’m talking about.  Fundamentally, Dell can only release a product that Microsoft (or someone else) gives them the software for.  Maybe that will change, but, fundamentally, not soon.  Let’s take a few examples.

  • The Dell Axim – great handheld device, but at best, all Dell did is market and manufacture the thing.
  • HP’s handheld devices – same thing – they’re building a device with someone else’s software, whether it’s a Palm device or a Windows Mobile, they’ve still basically only sold a device, not the whole package.
  • All Media Center PCs — it’s Microsoft’s software, installed on some metal and silicon put together by other companies.

Why does this matter?  “It’s the software, stupid.”  That’s where the innovation is.  Basically, the point I’m trying to get across is that all Dell and HP are doing is putting their “brand” on a bunch of parts they assemble.  They are trying to play the branding game, but they don’t really control their product line.  They’re trying to pretend they’re car manufacturers.  Yes, a BMW is a nice car, and yes, I’m probably going to get something better for my money when I buy a BMW than when I buy a Toyota Yaris.  However, I see the market Dell and HP play in different than that.  I think it’s more like the market for Gas.  Sure, there are slight differences between how Royal Dutch Shell and Exxon Mobil refine crude oil into gasoline, but gas from either one still combusts the same way.  Both the oil companies and the box makers are taking a commodity [crude oil | windows + metal + plastic + silicon chips] and turning it into another commodity [gasoline | a PC]

This is Microsoft’s model.  They have come to this place of dominance where the manufacturers make whatever it is that Bill gives them the plans to make.  This is Microsoft’s plan.  They want to be in this special place where they can tell everyone else what to do. (See: Origami) The profit margins are good there!

Apple’s model is a bit different.  They control everything.  If they want to do something a little bit differently, they can.  If Apple wants to include Firewire in their product line, wham, done.  If they want to take their OS, strip it down, and build a special purpose product, they can do that. (AppleTV runs a stripped down OS X)

What does this mean? Apple can do things that Dell and HP can’t.  Because they own their operating system, but for greater reasons, because they have the engineering capability to do it, they can build whatever product they want, and they can make it integrate with a number of other products you already have or can buy from them.  They are in a unique position that NOBODY else is in.  Sony can’t compete with this, because their PCs have to conform to Windows, and Dell doesn’t do anything original.  Rather, Dell doesn’t TRY to do anything original because it’s not part of *their* business model.

What does this mean for the future?  This is the point of this post.  Apple is the new Sony.  Apple, in the age of connected devices, has such control over their products, that they are capable of producing the kind of “consumer electronics” that we want to buy.

Here’s the theory.  Consumer electronics devices are getting more complicated.  They are basically becoming custom purpose PCs.  Dell and HP and the like are limited to giving us what Microsoft says they give us, which is Windows (and maybe if you pay more you can get some extra features).  Apple can produce a single purpose computer in the way that Dell cannot.  This is exactly what’s happening with the AppleTV.  So, Apple can leverage its OS / Application Development expertise into building customized, single purpose boxes.  Because of this, it’s going to look like Apple is becoming a “consumer electronics” company.  In other words, because of Apple’s unique position, they have and will continue to outdo the likes of Sony to the point where Apple will BECOME the next Sony.

Dear Apple, I want to give you money but you don’t let me.

Apple,
I like your products.  My wife and I own several iPods, and I’m getting closer and closer to switching my desktop to Mac.  I want to buy an AppleTV, but you see, you’re not letting me.  I want a good device hooked up to my tv, and the AppleTV looks like it could be what I want.  However, no codec support basically makes the product useless to me.

What am I gonna watch?  The shows I recorded with my Tivo? The shows I recorded with my Windows Media Center PC?  No! You won’t let me.  The video clips I recorded with my camera, the home movies, etc.  They’re not in your format, so you won’t let me play those either.

Basically, all I can watch is content I buy from you or podcasts.  Now,
I’m a fan of Tiki Bar TV, Diggnation, and the like, but that’s not
going to cut it.  I’m not going to buy a 300 dollar device just to buy
content from you.  You have to let me use the device with MY content.

“But you want me to buy content from the ITMS,” you say.  Well, yeah, I can understand that.  However, I’m not going to buy your device in the first place if it doesnt play my content.  I look at it this way: If i had an AppleTV, I probably would occasionally buy a movie or missed tv episode.  The same thing happened with the ipod.  I got it, and occasionally, I bought a song.

If you’re not going to let the appletv play various formats, at least give out a free [* –> H.264] transcoder.  Would it be that hard?  Videora already has one out, but they’ve got an agenda, and I don’t like that their “Videora iPod converter” auto-loads and sits in my system tray every time I reboot.  I’d much prefer that YOU, apple, give us a quality tool that does the job.  Well, that or make the AppleTV more useful to me than a $300 brick that doesn’t do what I want.