October 13, 2009, 7:23 pm
I read about a survey of iPhone developers which found that a third had made under $250 and 52% under $15,000. Not exactly reassuring for anyone wanting to earn a living with iPhone apps.
As far as I know, there hasn’t been any similar studies done of Android developers, so I decided to set up a simple poll to see how we compare. I couldn’t find out what the iPhone survey counted as earnings, but I am limiting my first poll to just application sales and in-application advertisements. I have read Mark Murphy’s 40 Android Business Models posts, so there are definitely more ways to make money, but let’s start with the survey I set up.
With that set up, head over to the poll page.
October 12, 2009, 5:35 pm
Many companies run services in the Amazon cloud infrastructure, so it makes an attractive target for criminals as well. You need to make sure that you really are talking to the right Amazon servers when you use the cloud services.
boto seems to have emerged as the winner in the scramble to develop Python libraries to deal with Amazon Web Services (AWS). By default, boto will use the stdlib httplib.HTTPSConnection. This is a problem, because the stdlib does not provide secure SSL out of the box. However, boto designers have made it easy to plug in alternative SSL implementations that conform to the httplib.HTTPSConnection interface. M2Crypto provides this in httpslib.HTTPSConnection.
The first step is to get CA certificates that we can use to verify that the Amazon servers we will be talking to have valid certificates issued by trusted certificate authorities.
Amazon offers various services that boto provides access to, so the exact details vary a little bit (namely what connection class to instantiate). I’ll use the SimpleDB as an example, because the first 25 machine hours per month are free so it makes a great test system (you still need to sign up for AWS and provide credit card information).
#!/usr/bin/env python
import sys
from M2Crypto import httpslib, SSL
from boto.sdb.connection import SDBConnection
def https_connection_factory(host, port=None, strict=0, **ssl):
"""HTTPS connection factory that creates secure connections
using M2Crypto."""
ctx = SSL.Context('tlsv1')
ctx.set_verify(SSL.verify_peer | SSL.verify_fail_if_no_peer_cert, depth=9)
if ctx.load_verify_locations('cacert.pem') != 1:
raise Exception('No CA certs')
return httpslib.HTTPSConnection(host, port=port, strict=strict,
ssl_context=ctx)
def create_connection(aws_access_key_id, aws_secret_access_key):
"""Create SimpleDB connection."""
conn = SDBConnection(aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
https_connection_factory=(https_connection_factory, ()))
return conn
if __name__ == '__main__':
# Sample usage
if len(sys.argv) != 3:
sys.exit('Usage: %s aws_access_key_id aws_secret_access_key' % sys.argv[0])
conn = create_connection(*sys.argv[1:])
domain = conn.create_domain('mytest')
try:
item, key, value = 'item1', 'key1', 'value1'
domain.put_attributes(item, {key: value})
assert value == domain.get_attributes(item)[key]
finally:
conn.delete_domain(domain)
print 'Usage:', conn.get_usage()
The sample application takes your AWS access key and secret access key as parameters, and it assumes cacert.pem file containing the CA certificates is in the same directory. Typically running that application shows that it uses less than 0.006 secondshours of Amazon computing facilities so you could run this application over 15 million4500 times a month without charge.
Update:I mixed up units, which Mocky pointed out; fixed above.
October 6, 2009, 9:40 pm
M2Crypto has been claiming support for OpenSSL 0.9.7 but it actually turned out I wasn’t testing with quite that old OpenSSL version. Recently M2Crypto got support for RSA PSS stuff, but it turns out this was added in OpenSSL 0.9.7h, and you could not build/run M2Crypto against an older OpenSSL version. Arguably you should not use those old OpenSSL versions, but apparently there are people who can’t help it. And since M2Crypto claims support all the way back to 0.9.7 it made sense to make it so.
The M2Crypto trunk and 0.20.2 now omit the RSA PSS stuff if you have too old OpenSSL. Additionally, to prevent this kind of error from happening in the future, I added “minreq” (for Minimum Requirements) Tinderbox client that builds and tests M2Crypto trunk using Python 2.3, OpenSSL 0.9.7 and SWIG 1.3.28 (the current minimum requirements) on Ubuntu 8.04.
October 1, 2009, 10:59 pm
Last Sunday Dreamhost went and switched the host on which all of my sites run to a different machine. There was no advance notice, just an email after the fact informing me the change occurred and hopefully they did not break anything. As it turns out, they changed quite a bit. I am not sure if the old host was 64 bit or not, but the new one definitely is. Some of the apps I had compiled myself no longer run, complaining about wrong architecture. Some paths were different, some Apache settings were different, and mail filtering through procmail broke. As a consequence, my blog, M2Crypto Tinderbox and all my Python web applications broke. Those are the things that I know of, because I have now fixed all of them as far as I can tell. It was reasonably straight forward to recompile everything (luckily I had saved the previous configure options), find and change the changed paths, and google the Apache error. The procmail filter started working after I redid the mail filtering settings through the Dreamhost panel.
While this unannounced change was definitely not cool, it is the only time (so far) when I have been really unhappy with Dreamhost since I started hosting there in early 2006. So I am still recommending them as a cheap hosting provider: for under $9/month you get unlimited bandwidth and disk space, and cheap and anonymous domain registration to boot.
Anyway, Murphy’s Law still rules, as this all happened while I was on vacation with no net or even cell phone coverage. Sorry for the extended downtime.
September 23, 2009, 10:28 pm
My Dell Inspiron 5000e was the first computer I bought after I moved to California in 2000. It was pretty near the top of the line laptop because I wanted a desktop replacement, and even though it was a refurbished system it cost around $3,000. It was a great computer at the time, although it overheated too easily (probably why it was refurbished in the first place), requiring an external fan or other auxiliary cooling methods when working for extended periods of time in normal room temperatures. However, it is about 10 years old technology so I am finally getting rid of it.
Costco has has a laptop recycling deal with Gazelle, and it seems Gazelle would pay about $20 for the laptop with Windows Me on it. Unfortunately it does not seem like they would pay for any of the extra stuff that I’d like to part with: extra battery, Windows 2000 Professional upgrade, a second Orinoco wireless PCMCIA card, PCMCIA Firewire card, PCMCIA Ethernet card and PCMCIA modem card, along with an assorted set of cables, other software and nylon carrying case. Everything in about perfect condition. Incidentally, if anyone wants any of that, email me an offer.
While preparing to get rid of the laptop I wanted to see how a modern Linux distro runs on it. I first tried Xubuntu 9.04 but the Live CD only boots about 10% of the way, same with Ubuntu 8.04. I did not want to fight too much with it, so I decided to try SimplyMEPIS 8.0.10 instead, because I have read good reviews about Mepis. While it first did not have any better luck, I figured out the problem was that it did not detect the right display resolution. Forcing that by adding xres=1400×1050 to boot options fixed it, and I had no other problems installing it.
I was surprised and disappointed that I have more problems running Linux on a 10 year old laptop compared to last year’s model. Suspend and hibernate don’t work, plugging in PS/2 mouse disables touchpad until reboot, and wireless does not connect automatically after reboot (although the latter could be an issue with KDE). I am pretty sure most if all problems could be worked around, but when things just work with later hardware it really is a disappointment. I used to run Redhat 8 on it, but can’t remember if it had any of those problems. I am also pretty sure setting that up required some more work to get the display right.
SimplyMEPIS seemed fine, although I was somewhat lost due to unfamiliar UI. That could be due to SimplyMEPIS using KDE, but since I don’t have much experience with KDE it is hard to tell. The UI was slightly sluggish (although not too annoying), so if I were forced to use this laptop again, I would probably look for a more lightweight solution than KDE or Gnome.
I did a full writeup too in the Linux-on-laptop style: SimplyMEPIS 8.0.10 Linux on Dell Inspiron 5000e laptop
September 15, 2009, 6:16 pm
Is Python the Apple of Programming Languages? I don’t know who to credit for the expression, but I first heard it mentioned by JJ. It certainly rings a bell in me. Python code looks somewhat polished compared to many other languages, mostly due to whitespace rules and the lack of curly brackets. Python is trendy, generally just works, is pretty consistent, opinionated (there is generally one obvious way to do it) and is governed by a dictator. When you think about those adjectives in the computer hardware sector you can’t help but think about Apple. Many of those points are not unique about Python, nor can Python claim the top spot in trendiness etc. but the combination seems to define Python uniquely in my mind at least.
There is at least one obvious difference when I am comparing the Python programming language to Apple. If your needs or opinions differ from Apple’s, you are out of luck. But since Python is open source you can take it and make it fit your needs better with enough determination. Python is also easy to extend.
The reason why I have been thinking about the aesthetics of Python is because when I am faced with a task that requires me to use another programming language, I immediately become disgusted by the thought because the other language does not feel as elegant as Python. I’ve also been meaning to learn Ruby, and even started to read an online book about Ruby, but my interest waved after I realized Ruby code did not look as nice as Python (to me at least). Some of the resistance against other languages is no doubt because of the natural resistance to change, something which I try to combat consciously by doing something out of my immediate comfort zone every once in a while. Maybe an interesting project where Ruby clearly was the best option would help…
JJ and I have also discussed how you can look at a piece of Python code on someone’s monitor from across the room, and make a pretty good guess about the quality of the code in general just by seeing how the structure looks from far away. I guess that is true to some extent with other programming languages, but I have never experienced that as strongly with anything but Python.
Don’t get me wrong, though. I do know many other languages, and I am actively coding in other languages as well, but it is a constant battle to force myself to do so. I do get occasional surprises of joy with other languages, like when I discover I can do something even easier than with Python. Of course releasing something is always a high, regardless of the language used.
I have heard that people who have used Apple products have a hard time migrating, because they tend to experience the lack of polish in other products more severely compared with people who have not used Apple products. I wonder if Apple products are more popular with Pythonistas than with Rubyists and others.
I guess the question of the day is, if you have tasted Python, will you ever be able to enjoy any other programming language?
September 9, 2009, 9:37 pm
At work I have an old Dell desktop running SLES 9 (among other systems I manage). I inherited the system, and it was configured to mount home directories with help of LDAP, a process that I am not familiar with. It also runs some legacy systems I do not feel like migrating to newer systems yet.
Recently the LDAP information changed, so I needed to find out how to update this information. I found the settings in YaST, and everything seemed to be functioning with the new settings. That is, until I tried to become root. I got informed that there is no such user. “That is weird,” I thought, “I don’t think I’ve ever seen this kind of error with a Linux box”. After some more experimenting it became clear that updating LDAP had somehow caused all local users to disappear. /etc/passwd was empty!
As luck would have it, I found several backups of /etc/passwd, one even made by YaST itself when I updated the LDAP information. But this file was only accessible by root, which I could not become! Ubuntu has a way to boot into a root prompt, but I could not see how to do that with the SLES 9 boot prompt.
If I had a system rescue CD or Knoppix or something similar I would have tried that next, but it seems the recent office move displaced a number of our CDs so that was not immediately available either. However, I found old Ubuntu and openSUSE Live CDs. The Ubuntu CD wouldn’t work in this aging Dell (I suspect flaky CD drive), but the openSUSE 11 Live CD booted ok. I could not start X, but I could login as root through the console. Almost there!
The Live CD had not mounted the hard drives, but I could see the devices with fdisk -l. Then it was a matter of issuing:
mkdir /tmp/hd1
mount /dev/sda1 /tmp/hd1
to mount the HD, and then finally copying the backup passwd file over the empty one. After reboot everything was nominal (I guess I’ve watched too much Defying Gravity).
August 31, 2009, 10:54 pm
Caltrain updated schedules today, August 31, 2009. I released updated versions of my Caltrain schedule applications last night, so this is a little delayed notice.
My first application is CaltrainPy, which started out as a Python app for my phone, but it did not work so great on the phone after all, at least on Windows Mobile. It is fine for desktop use, though. I added schedule scraping functionality later to support the next two applications. Fully open source and all that.
CaltrainJS is a web version, optimized for Windows Mobile browser. It of course works with other browsers as well, although it hasn’t been optimized for them. CaltrainJS is free to use, but not really open source.
The last and most fully featured one is the Android port, Caltroid, which is a commercial version. I’ve added a little Google Comments gadget on the Caltroid homepage in the hopes that people would find this an easier way to communicate with me on what new features they’d want, what is broken and so on. The Android Market comment system doesn’t let me respond to comments in any sane manner, but the Comments gadget does. The gadget isn’t perfect, but hopefully better than nothing. This is also first time I am testing out Google Gadgets, so time will tell if I’ll keep using them.
The only application to gain small new features is the Python version, which basically just got some properties to identify which schedule it embeds and what schedule date it was confirmed to be able to process. I have some additional ideas for improvements, but due to currently being somewhat sleep deprived those will have to wait a bit. But if you do have ideas, please let me know.