Sunday, September 27, 2009

A seasonal pattern of iPhone app usage

The following is an ad request chart of my iPhone app, Men vs Chimps Lite, for the first three weeks since its first release. Do you find anything interesting? Notice that today, 9/27/2009, is a Sunday.



Although the data is limited, I found that Wednesday, Thursday and Friday usually have peak usages. I have thought people may use iPhone apps more often on weekends. Obviously, I was dead wrong! From the chart, Saturday has the lightest app usages.

Perhaps, people are having fun on the weekend and they don't need iPhone apps. Everyone works hard on Monday and Tuesday. By Wednesday, iPhone users are already looking for weekends and use (entertainment) apps to kill time.

Saturday, September 19, 2009

Mutable objects as default arguments in Python

I spent quite some time Friday morning trying to figure out a weird problem. The problem was not there when executing code in command line in a production machine or in a local environment.

It turned out that I made a mistake that I had never known. I had a function looks like
def a(m=[]):
  m.append(1)
  return m
If you call a() three times, you get
[1]
[1 1]
[1 1 1]
which was not what I expected. I used m as a flag to select algorithms, and the function a() was called exactly once in every process. In a single thread process, everything seems ok. But in a multi-threading environment, once a flag is set, the flag will be there for all subsequent calls.

I checked Python documents and found that "the default value is evaluated only once." That's a potential problem if you use list or dict as a default argument in Python. It essentially says that a list or a dict as default is taken as a static object. If the argument is read-only, you are fine. If you want to overwrite the argument, make sure you intend to use the list or dict as a static object. For me, I rewrote my function like
def a(m=[]):
  m = m + [1]
  return m
so m is pointed to a new list object. Problem solved. Lesson learned.

Friday, September 4, 2009

iPhone app review process - a level playing field?

Facebook submitted its iPhone app 3.0 on August 16, 2009 (according to TechCrunch). Joe Hewitt, the Facebook iPhone app lead, wrote a blog a week later and proposed "the review process needs to be eliminated completely." TechCrunch then wrote "Tear Down This App Store Wall." Users were inpatient too, pointing fingers to Apple. I could feel Apple was under great pressure.

Facebook 3.0 for iPhone was available in Apple App Store late night August 27th. People were so excited as you could see the wave at Twitter. I found a bug that crashed the app every time I scrolled my friend list to the bottom (friends' names in Chinese) and reported it to Facebook. Then Facebook 3.0.1 came out three days later. Bugs fixed. That was really QUICK! Yesterday afternoon, September 3rd, Facebook 3.0.2 was out. That was unbelievably efficient from Apple.

Set aside any discussion to remove iPhone app review process for now. As a small developer, I have another concern about a level playing field in the app review process. I was very surprised it took Apple only 11 days to review Facebook 3.0. It took Apple two weeks or more to review my app for its first release and also a subsequent update. My app, Real-Time Stocks, has only five views (aka screens), obviously cannot compare with Facebook for its breadth of functionality. How could Apple approve a huge Facebook app a few days faster than my tiny app? What's more shocking to me, Facebook 3.0.1 and 3.0.2 were both approved in about three days. That really disturbed me.

I submitted a new app, Men vs Chimps, on August 25th, and just received ready-for-sale notice from Apple yesterday evening. Now I know during the review process for my app, Apple approved three Facebook app submissions. My little iPhone app has only three views: a menu, a game view, and a result view. You don't even have to count to know Facebook app has more than ten times as many views as mine. But the most important point here is that Facebook submitted two updates a few days after my submission, and both of them came out ahead of mine.

Now, I want to know if Apple is willing to update my app on a super fast track if I have a bug fix for my app. Didn't I pay as much as Facebook did for the standard iPhone Developer Program? As long as there is a review process for iPhone apps, I suppose all apps should play by the same rules. Unless there is a rule that I don't know.

A blog reborn

It has been a long time since last update. I have removed posts that were meant to be experiments for old work. They are in the past. From now on, I will write more of my thoughts and many useful programming tricks, libraries, and tools that I have used in various projects.

I still write C/C++ and actually used it alone to develop all the computer vision and image/video processing algorithms for an internet video object tracking project for my current company. However, I will say that the most fun in programming is probably in Python, ActionScript 2/3, JavaScript, and Objective-C/iPhone. Lots of fun comes from programming with APIs like YouTube, Facebook, and many others. Expect I write more on these stuff.