Are you designing for mobile?

I’m increasingly convinced that the mobile platform is going to be the key platform for the future. I’ve started investigating and even purchased a phone and dataplan capable of browsing the web (not an iPhone - I think they’re still an outlier, though an important one for sure). But I still have more questions than answers:

  • What browsers do you test with? Which ones have a significant market share? How do you test with multiple browsers?
  • Are browsers for mobile handsets standards compliant? Which standards should I target?
  • Do you trust device emulators as an indicator of the true end-user experience? Which emulators do you use?
  • What concerns do you have regarding security? It seems that these devices frequently use proxies controlled by the carriers, are you comfortable transmitting secure data?
  • What user interface standards do you count on?

This last point presents some interesting questions. For example, the homepage for my mobile phone uses numbered lists heavily and limits them to 10 per list, 1 - 0 (0 is the 10th item). Pressing the index number of the list item jumps is equiv to clicking that link. So for example, if item 3 is “ringtons” pressing the 3 on your phone takes you to the ringtone page. If there are more than 10 then a link appears at the end saying, “next 2>>” or similar.

However, other sites, for example Google, do not use this same convention. So are there de-facto standards and if so, what are they and why would I not use them?

So many questions… it’s an interesting new web…

Is ebay snipping OK?

On ebay, a “snipe” is when someone bids on an auction at the very last second. Maybe you’ve experienced this when you bid on something and thought it was in the bag and then refreshed the auction page expecting to see a “Congratulations, you won” message but instead saw, “This auction has ended, sorry, you didn’t win.” It’s frustrating and disappointing and your first response is, “I hate it when that happens!” But really, snipping isn’t a bad thing.

My rule of thumb when bidding is to decide how much I’m willing to pay for an item and don’t pay a penny more than that. I saw a cell phone that you can buy new for $140 go for more than that recently because of last minute bidding. How foolish! You see, as the auction nears its end, people start getting emotional and will start increasing their bid, in many cases paying more than they should. The sellers love this, there’s nothing more exciting as a seller than seeing a last-minute bidding war for your item.

As a consumer you should not get emotional or you’ll spend too much money. If we all followed this rule then snipping would be useless. We’d all just decide how much we want to spend and bid the appropriate amount and the auction would end with the highest bidder getting the item. So if you want to pay $60 for that item, bid $60 initially, if you want to bid $70, decide it up front and bid it. If you don’t win, oh well, there will be another one in a day or two.

But we don’t do that… ebay (and auctions in general) trick us. It looks like we were outbid by only $1 so we increase our bid by a bit, then the other person’s bid increases by $1 more than ours, so we think, ok, its not much, just one more time… so you bid a little bit more and now you’re the winner. The other person then goes through this same process and it repeats itself a couple times and the end result is we pay too much.

So assuming that your initial bid is truly what you wanted to pay, then a sniper will come in and bid at the last second, circumventing the bidding war. Either the sniper will bid more than you and win, or less than you and lose. Both buyers come out ahead because no one has time to make emotionally motivated bids.

Running a virtual server using virtual box, nat and a wifi network connection

I used to install apache, mysql, etc on my laptop for local testing. However having all these extra services caused my computer to start slowly. I disabled them from starting automatically but that became tedious because I needed to remember to start them (generally 3 or so) before I used them. Here’s a better idea - use Virtual Box (recently renamed to Sun xVM) to run an instance of Ubuntu Server (or whatever) locally. When you’re ready to do some dev work, fire up the vm (it boots in about 30s).

The problem is, if you’re on a laptop then you probably use wifi, and that means you’re probably going to need to use a NAT connection for your Ubuntu Server to have network access. Unfortunately, with a NAT connection no one, not even your laptop, can see the guest services running on the Ubuntu Server. Fortunately the Virtual Box developers provided a solution, if you know where to look.

Using a command line tool you can configure port forwarding. The documentation explains this quite well if you know to look there. :-) (I asked in IRC and was politely directed to the fine manual page) It’s in chapter 6.4.1 titled, “Configuring port forwarding.” You should read it, but in case you don’t want to, here’s what you do.

  1. Know the name of your VM. Mine is called “Ubuntu Server”
  2. Shut down the VM - it cannot be running for this to work (according to the manual)
  3. Know the ports of the services you want to forward, for example 80 and 443 for web, 22 for ssh and 3303 for MySQL
  4. Open a terminal and run these commands (I’m assuming you’re running Linux as your host) - you run these on your host pc, not the guest - remember you shut the guest down in step2:

    VBoxManage setextradata “Ubuntu Server” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/Protocol” TCP
    VBoxManage setextradata “Ubuntu Server” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/GuestPort” 80
    VBoxManage setextradata “Ubuntu Server” “VBoxInternal/Devices/pcnet/0/LUN#0/Config/guesthttp/HostPort” 2080

These three commands set up one rule that forwards incoming TCP traffic on port 2080 to the http port 80 on the virtual machine called “Ubuntu Server.” So above, change the text “Ubuntu Server” to be your virtual machine’s name in ”all three lines”. Change TCP in the first line to UDP if necessary (ICMP won’t work). In the second line change 80 to something else if you’re not working with the http protocol. For example, maybe you want a mailserver in which case you’d want port 25. And in the third line, change 2080 to the port you want to use to access this service. I used port 2080 which means to view the site I’d have to go to http://localhost:2080/. (I have this thing against running development servers on standard ports on my PC)

One special note above, each port I’m forwarding (called a “rule”) has to have a unique name. In the example above the rule is called “guesthttp.” All three lines that set the rule use that same phrase. If I were going to forward another port, say 443 for https, then I’d use a different name for the rule, maybe “guesthttps.” Make sure that all three lines that make up the rule use the same name though.

If you want to delete a rule just repeat those three lines with the last option blank. Using my example above, exclude TCP, 80 and 2080 from the commands.

I believe you can run multiple servers and forward different ports. Just make sure that you use different ports on the host. So for example, the first guest may use 2080 for http, the second guest you may want to use 3080, and the next 4080. That way you can run three different web servers at the same time, each in their own guest.

Good luck, I hope this helps.

Rent a mouse

A little over one year ago I received a Logitech V220 cordless notebook mouse as a gift. It’s small, high resolution and amazingly, it works for nearly six months on a single AA battery (I put a high quality battery in it). The first time the battery died I was so impressed. I put the new battery in and started working. Coincidentally I’d recently upgraded to Hardy Heron Alpha 2 or 3. I was noticed some erratic behavior where holding the mouse button down produced multiple mouse clicks. You didn’t notice it unless you were clicking and dragging, for example using the selection tool in a graphics program or highlighting a paragraph of text.

I assumed it was something related to Hardy Heron and discussed the problems with a few people. It was really a head scratcher so someone suggested I test the mouse with a different computer so we could rule it out as the culprit. Remarkably, the problem followed the mouse to the other computer. I was stunned. I opened the mouse and looked inside to see if it was a worn button. Everything looked OK. I called Logitech and they gave me instructions to return the mouse and they would send me a new one. The new one was fine and I was happy and promptly forgot the problem.

It’s been about 6 months since that incident and I’ve recently upgraded to Intrepid Ibex Beta 4. You’ll never guess what happened… my mouse battery died. Amazing how long that single cell lasted! I replaced the battery and you won’t believe it, but I’m getting the sporadic extra click problem again. Two mice in a row! What are the odds? Could this be a problem with their firmware? I don’t know. I’m getting creative… I’ve pressed the “connect” button on the bottom. I’ve also pulled the battery a few times to “reboot” the mouse. So far no improvement. I’ve just now tried turning the mouse off and holding the connect button in for a while while I turn the mouse on again. Interestingly, this causes the mouse to not function until you pull the battery.

Rent - a - mouse
So this causes me to think… if you go and buy a mouse for $35, what are you certain to get? I think that you can reasonably expect to have a functioning mouse for as long as the warranty period of the mouse lasts. If it dies before the warranty period you will get a replacement, but if it dies after it’s gone. In a sense its like when you purchase “software support and maintenance” instead of purchasing a perpetual license (or use OSS). In these cases you can use the software for as long as you keep paying for it, but once you stop buying support you have to stop using the product.

In the case of a product with a one year warranty, you’re basically renting the product for a year but you may be able to use it slightly longer. This is especially true today when hardware feels like it’s designed to be disposable and to have a limited life in order to ensure you keep upgrading.

The good news is, Logitech’s warranty on this mouse is 3 years. The bad news is, I don’t have the receipt (it was a gift), so lets hope the support dept will be helpful.

Aptana "acquires" pydev

This seemed shocking at first because I think of pydev as being an open source application and how can a company “acquire” an open source application? I realized that pydev is more because of the “pydev extensions” commercial plugin. Either way, this is probably good news.

Aptana acquired RadRails a bit ago and incorporated it, making it a very feature complete Ruby on Rails development tool. Maybe now that the pydev developer is working with a team of people with similar interests Django will get the same treatment. I’d love to have a dev environment where you debug your django code right there.

Sometime recently Aptana also gained PHP support however it looks like there’s no debugging, making it inferior in at least this regard to NetBeans 6.5. I don’t think this is bad news for Django since it, unlike PHP, has a built in web server. Debugging PHP has traditionally been a trying experience and I’ve never seen it work as nicely as, for example, debugging a java web application.

Getting data out of IMAP or Gmail with python

I have a contact form that has been sending me data via email. It was quick and dirty and I didn’t expect to get nearly as many responses as I did. The data really needs to be in a spreadsheet but the thought of manually doing this bothered me so I wrote some python code to do it. Here it is. Note that:

  • it is quick and dirty
  • change the gmail user name to whatever, this should work on any imap server so change server name if not gmail
  • change the name of the imap folder containing the messages - mine go into a folder called P/package-registration
  • once I’ve downloaded a batch of messages I mark them as read using my email client so that they won’t download again when the script runs (that’s what the “UNSEEN” bit is for)
import imaplib, base64, re, getpass

def parseline(line):
    data = line.split('||||')

    results = {'product': '', 'fname': '', 'lname': '', 'company': '', 'email': '', 'phone': ''}

    for i in data:
        k = re.match(r"A new (?P<product>[^ ]+) registration", i)

        if k:
            results['product'] = k.group(1)

        elif i:
            j = i.split(': ', 1)

            if len(j) == 2:
                results[j[0]] = j[1]

    return results


mail = imaplib.IMAP4_SSL('imap.gmail.com', 993)

mail.login('yourloginname', getpass.getpass())
log = open('emaillog.txt', 'w')

log.write('product\tfname\tlname\tcompany\temail\tphone\n')

mail.select('P/package-registration')
typ, data = mail.search(None, 'UNSEEN')

for num in data[0].split():
    typ, data = mail.fetch(num, '(RFC822)')

    body = data[0][1].split('\r\n')

    b = False
    msg = ''
    for line in body:

        if not line and not b: b = True

        if b: msg += line
        email = base64.b64decode(msg)

    e2 = email.replace('\r\n\r\n', '||||').replace('\r\n', '||||').replace(',||||','||||')

    e3 = parseline(e2)
    try:
        log.write('%s\t%s\t%s\t%s\t%s\t%s\n' % (e3['product'], e3['fname'], e3['lname'], e3['company'], e3['email'], e3['phone']))

    except KeyError:
        print e3

log.close()

mail.close()

I’m not proud of the messy code but at least I can justify it… I started out using a simple regex, then I realized that the fields in the email sometimes were in different order and my regex started growing big and ugly. Then the project started taking too long and I just wanted to get it done. Voila, you get a tangled mess.

Now if I could just get a system in place for pasting code to my blog in a way that comes out looking pretty…

Font hinting in Inkscape

I was recently chatting with the programmers of inkscape and lamenting the lack of font hinting. The developers responded that font hinting didn’t seem applicable because Inkscape is a vector application used to create resolution independent graphics and it didn’t really make sense to add a resolution dependent feature. This is logical and the conclusion is that font-hinting belongs in your raster application, such as the GIMP.

font hinting

(font hinting is the magical property of high quality fonts to manually adjust their size and shape in very minor ways so that they line up with pixel boundaries and avoid blurred or invisible portions of the text)

So this leads to the problem of how to get your work from inskcape to a raster application. Right now, it’s not possible to make use of hinting, but someone with GIMP fu skills could make it happen. There is a plugin for inkscape that lets you export to GIMP’s xcf format while maintaining layers. It’s functional but it currently works by exporting each layer as a png.

Ideally this could be improved in a couple ways:

  • Preserve type layers as type: This means that if a layer is made up of only one or more text objects when it gets exported, instead of exporting it as a png, create type objects with the same coordinates. This could be very challenging because some coordinate translation would need to be done. And while we’re at it,
  • Allow resolution selection when exporting: Right now it appears to export at a fixed 90dpi, which is fine for web graphics but nothing else.

The benefit of this is that GIMP, which does have font hinting support, could be used to slice and export the graphics and hopefully have better results with the typography.

The code is a combination of python and gimp-fu (see the source of the plugin which is linked above). It’s pretty easy to read through and understand what is happening, but I am unable to do more than research the problem and encourage someone to help out. So, if you are the person that just needs a little encouragement and someone to point you in the right direction, have at it!

If I were doing it, I’d attack it this way:

  • Use GIMP-fu to create an image with a text object using a specific type-face and size and try to target a specific coordinate. Experiment with different alignment options such as left, right or center.
  • Try to do the above multiple times in the same image and get predictable results
  • Try to adjust the gimp_xcf.py plugin so that type objects show up in GIMP as type objects (though maybe not in predictable locations with the correct font face or size)
  • Try to get the font objects in the correct place and with the right size and alignment.
  • Revel in the glory of your major accomplishment!

Is anyone up for it?

Happy Birthday Debian

We created a new banner for Debian’s birthday. At 15 years theyre one of the oldest distros still in active usage. What has made Debian unique is that its maintainers are passionate about two things - free software and the OSS philosophy and also about technical excelence. Debian is the foundation of Ubuntu so of course we’d have to do something to celebrate their birthday. The banner itself was created by Kenneth Wimer. I took it and overlaid it onto an existing Ubuntu banner so that it looked more like a real banner hung up over a doorway like you might do for a birthday party.

Debian Banner

Oddly enough, the night before I put the banner up I had this crazy dream that a bunch of Debian developers were chasing me shouting about LZW compression algorithm patents and I was trying to justify myself by pointing out that the patent expired and that LZW was ok now. It’s always funny when you wake up remembering your dreams.

If you have no clue what I’m talking about that you haven’t looked closely enough or you just aren’t clever. Sorry. :-/ If you do get it then be sure to post a comment here so I know.

Should you upgrade your Photoshop?

I was reading through Andy Fitzsimon’s blog recently and this article about the cost of non-free graphic design software really struck a chord. I’ll admit, I have often wished I could upgrade my version of Photoshop but just don’t want to spend the money. I am using free software for my graphic design 98% of the time now (estimated, actually probably more often than that) and do just fine. Andy’s comments really hit me - I haven’t been able to stop thinking about it for over a week now.

He’s right on the money about the upgrade cost. If you bought CS2 for $600 it officially became obsolete when CS3 came out. You pretty much have to upgrade, costing another $200. And if you decide to be clever and skip a version, the cost to upgrade may go up. And the learning curve for Photoshop is no different than for other software. You learn it by using it and it takes 100’s of hours to become proficient. If instead of the commercial products you spent the time learning other tools you’d be proficient as well.

I’m glad I work for a company who is willing to stand up for free software. Not everyone gets a choice on the tools they use.

history

I saw on Kees blog a history meme that was interesting so I must join in I think.

$ history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head
87 vi
70 ls
50 ssh
50 cd
49 bzr
33 fg
17 ./manage.py
15 sudo
10 iconv
10 exit

I was surprised at how I use vi more than ls or cd. I was also surprised at how often fg shows up in there. :-/ ./manage.py is part of django.

I think that having multiple terminals open at once does crazy things to your history and I sometimes secretly thing that some of my history does not persist. For example, I’m pretty certain I’ve used scp more often than iconv.

it's sooo uncuil

The only interesting thing I’ve found about cuil is that it’s getting a ton of bad press. What makes this interesting is that most search engine upstarts get no press, good or bad. I’ll bet they’ve paid a bunch of money for a PR agency.

I tried it out… I found the search results page very confusing. Which hit is the second best hit, the one below the first result or the one to the right of it? Why don’t the headlines in the second and lower rows line up (this must communicate something about the ordering of the search results)?

Also, there are no ads. This means that either:

  • They won’t make money
  • They’re making money in ways they don’t tell us (subversive)
  • They’re doing a bait and switch and will monetize this later (subversive)

Drat. uncuil.com is already taken.

If only KDE and GNOME would join...

I know its so unlikely, but think about it… all of the pieces of the fully functional, fully productive and beautiful Linux desktop are here. Its just that some are part of KDE 4 and the others are part of GNOME. Look at the screenshots and features of KDE 4.1 and try and tell me its not marvellous to look at. But most of the programs I use are GNOME programs, and tbh, a lot of the stuff in KDE’s menus look like they’re quickly put together as a, “we have that too” feature.

Mark has challenged open source to be as beautiful as Mac OS and I think it’s a noble and necessary goal. IMHO, the KDE people know how to do it. (KDE has other positive attributes of course, but this one is probably the most visible)

(obligatory screenshot below, though no small image can do it justice)
glimpse of kde4.1 desktop

Back to top