Happy New Year! SleepBot, and my new web project for fun.

It's been almost a year since I have posted anything here.

2011 was a great year for me.

SleepBot now has over 500,000 downloads and is one of the top rated apps in the Android Market. Jane and I, the SleepBot Team, has just released the web platform to our registered beta testers and friends and families. (https://beta.mysleepbot.com, though to use the App with it you will have to use a special version that supports Sync, and we are not releasing this to the public because we need to monitor the traffic requirements for scale and fix bugs)

It has been a great learning experience building this site. The site is built on Codeigniter PHP framework. It's a great framework: lightweight, powerful, and yet simple. It allowed us to focus on building the real features. However, as the code base gets large, refactor code becomes painful, since PHP is interpreted. Maybe we will switch to Facebook's HipPop, but at this point, we just want to focus on getting a usable product out. There were a lot design decisions to make, and a lot of them were focused on how to do as much as possible on the client side (since we are bootstrapping the costs).

60% of the time ended up building the front-end (JQuery based, though I tend to do things from scratch). This is also something I learned from working at Squarespace(awesome company!).

-Your html body should be with as little in between the tags as possible. -Your back end's job is to spit out a usable JSON so the front-end can parse it into HTML. -So yes, your back-end is mostly a router for the pages and an API server. -Use Ajax to prevent reloading the whole page as much as possible. -CSS is parsed using less.js. -Most environment variables are cached in Apache's process memory.

And this is not possible if it was not pre-2011. Browser supports are much better these days, and clients are usually powerful enough to render the contents without noticeable lags.

The user experience is great on the site, every post, every error message, and every page is carefully designed to maximize UX.

What took 30% of the time was making Sync working between the central server and various devices. There were so many cases to consider, and many different places for code injections. It is the most important part of the site.

For SleepBot, we Android's push notification to either request the client to sync immediately (such as when there's a state change that needs to be reflected) or update when the user opens the app next time. It works beautifully on the few devices that we have tested (2.2 and above). I'm not sure if we are going to ever support non-Google Android devices or just use Urbanairship (It's Helium reports works, but we might just build our own and make it open source...I don't believe this is not something developers should pay for).

One thing that I don't like the most in the process is also be the sysadmin of the project. Setting up servers took too much time from development time.

I did end up teach Jane CSS in the process though. Jane did all the graphic and styling for the site and she did a great job. :) Teaching her about Bash/SSH/Git/basic networking principles....and how she has to git add * and eventually understood it made me very proud of us as a Team!

Oh. and I started on a new project for fun: Web as a Shell (https://github.com/wzsddtc2/Web-as-a-Shell), this is the first project that I have as public repository on GitHub. :) ---In short, it will allow you to execute commands such as : facebook post "Happy New Year" in command line. And the best thing is...it lives inside your browser and requires no server to run. The app is fully built on HTML5, will support basic file IO and have user permission model. Oh, and any one will be able to add any new "Handler" to handle any new commands with a line of code! Detail in my next post. :)

Motorola Atrix 4G - Easiest WebTop Hack.

Got some time to play with my Atrix today while trying to study for stochastics.....

anyways...Many of you have probably got the Atrix phone but got scared away by the price tag on the laptop dock. Here's how you may still use your dual-core phone to run Firefox on your HDTV. Please note I am NOT responsible for any damage that will be done to your phone. :)

Requirements: 1. Atrix Rooted. (Google it. There's already a one click root online) 2. A monitor or TV that has HDMI connectivity. 3. Bluetooth Keyboard/Mouse set.

Steps:

1. Download a Terminal Emulator (Such as this free one: https://market.android.com/details?id=jackpal.androidterm) 2. Type: "su" and Enter. (Click Allow when Super User alerts you) 3. Type: "/osh/usr/local/bin/webtop-restart" and Enter.

Then you should see Webtop booting up with Firefox open. :)

Enjoy.

Thoughts on Android Market Rankings

From daily observation of SleepBot's rankings...I found a few interesting things about the way Google ranks the top applications on the Android Market.

Google's potential heuristic function for ranking:

Definition of Recent: past week/month.

Features/Weight. 1. Recent Downloads / 20 2. Recent Keep Percentage. / 30 3. Total Downloads. / 20 4. Total Keep Percentage. / 30

AppBrain's top rated is rather simple: 1. Ratings. 2. Total Downloads.

(To be edited later)

360 Vs. QQ Part 1

As a software engineer, I have to say that I am very disappointed at what is going on in China's software industry.

Let's take the stand point of an end user and ask the question: why are they doing this and how is it going to benefit me?

1. You should be fairly sure that QQ will not be (even if it was) intruding your privacy.

2. You should be very sure that 360 will change it's (very stupid and unprofessional) way of scanning for viruses.

Note: Anything I say here can be verified using Google. Please don't use Baidu, it is a participant - ._.

Let's start with the first series of incidents that happend between the end of 2009 to Feb 2010 - 360 tries to grab users from Kaspersky when expired, suggesting users to uninstall KingSoft's Anti-Virus and stop Avast from auto start. This is how QQ put it: a. Grab users when a software when expired. -unprofessional marketing technique. but this can benefit the end user, so it can be bared. b. Uninstall KingSoft Anti-Virus: VERY unprofessional practice since there is no real evidence that one can prove it is better. You can say you are better, but you cannot say that the other one has to go. c. stop Avast from autostart: VERY unprofessional practice.

But what really happened: a. When a good software expired, the end user is suppose to renew it, because I think we both know that 360 is not much better. 360 did offer user a choice. So as an end user, I am fine with what 360 did. 360+1 b. Uninstall KingSoft: This one I would go with QQ since the user had to uninstall KingSoft in order to install 360. It did not give user the freedom to have both. It was using its credibility to eliminate potential software that are better. QQ group+1 c. Ok, we know Avast is good. QQ group +1

Now it gets ugly:

Let's examine this post from QQ.com: http://tech.qq.com/a/20100930/000017_2.htm

If you know computer, you know that you want a warning when something gets changed, that's why Windows 7 has user protection (which is annoying :D). But is it fair to do so? Yes, because 360 was simply telling user that something will get changed and give it the option to do so. For example, Norton's osCheck.exe....yea, it will prob slow down the system startup time, but it could potentially be helpful, THAT"S WHY ITS THERE. But as an end user....you don't usually know what to do, and when you are WARNED that something is going to change, you would more likely to stop it if you know what you are doing. Well. I would say both of them's got a point.

Another post from QQ.com: http://tech.qq.com/a/20100930/000017_4.htm

a. interfering with windows update - 360 should NOT interfere with microsoft's update and accuse it of using extra system resource. it is probably not true since software packaging and releasing an update is not something companies like to do on a regular basis, it usually gets released because it was a "have to" situation. QQ+1

b. Stop Baidu and other companies plugins - as an end user, i would have to say that giving people a choice to uninstall them is good because it was usually not so easy to uninstall them. 360+1

Part I score:

QQ alliance: 2 360 : 2 -----------> Everyone is for themslves.

0-50,000 Downloads...3 months

Yup. SleepBot is now in the 50,000 - 250,000 download range now. :D

We also got on

Lifehacker (http://lifehacker.com/5650915/sleep-bot-tracks-logs-and-analyzes-sleep-patterns)

World Street Journal's Technology feed: http://onespot.wsj.com/technology/2010/10/02/a/706797663-screenshot-tour-sleep-bot-for/ (via downloadsquad)

and many other publications.

There is still a lot to do and fix....but too bad i'm getting killed by midterms. :D

We did it! We have released our first app!

We have released our first version of our application this morning around 06:30 am EST!

At the time of publishing this blog post, we have already got over 100 downloads!

We are really glad that people have already start using this application and most of them have kept it on their device!

It was a sleepless night for us, but we will not take a break from this. Our next goal would be working on our website and also preparing for our next release of the application. We have already planned a list of new features to roll out soon. We will keep everyone informed on this blog.

Please let us know if you have any questions, bug report, or good suggestions. Even though it is time to celebrate, we will keep an eye in our inbox.

Graphing on Android

Graphing on Android was one of the hardest problem we had to conquer because the Android platform, similar to other platforms, does not have native libraries that support plots like it does for text and images, or tables. And it does not support Java's native graphing libraries that are available online. Furthermore, unlike iPhone and desktop applications, our graph has to occupy a variable amount of space to fit the different screen sizes supported by different devices.

Upon research, I found that there are several options:

  1. Buy a professionally designed library native for Android such as the aiChart. The problem with this is that all the libraries are very expensive, and we don't think it is necessary to spend that much money on those if it is possible for us to do it ourself.
  2. Render the graph using a web view which will redirect the user to a browser, either rendering the graph using javascript or rendering it online using cloud services such as the Google Charts. We decided against we because of that will use a lot more resources (as compare to our last resort) and it does not offer as much flexibility as we may want it to have in the future.
  3. So there is only one option left: writing our own native graphing library for Android (we are not porting a Java graphing library because those do not offer as much flexibility as well).
Building a graphing library only for the line graph came out not that bad. By making all the lines, dots, and text relative to each other and setting the size of the objects from multiplying the current screen spec to a standard one, we finally made our graph.

Here is a prototype of our graph that shows the last ten days of one of our developers' sleep hours:

[caption id="attachment_79" align="alignnone" width="300" caption="A graph that shows my sleep hours for the past ten days"][/caption]

Universal iPhone/Itouch Unlock Guide for 3.1.2

Disclaimer: I do not take any responsibly of聽 possible damage to your device and legal issues during this process.

All of the steps shown in this posts were tested working for most people. WIFI environment is required for this process.

This guide will guide you through the jailbreak process and unlock the latest Firmware 3.1.2 (iphone baseband 05.11.07) if you need to. At the end, we will provide you with links to download free softwares.

The process consists of a few steps:

1. Preparation: backup your phone and download the necessary tools for it.

2. Upgrade to 3.1.2. (optional)

3. Jailbreak 3.1.2.

4. Unlock 3.1.2. (optional).

5. Add necessary tools to make your phone/itouch run free apps.

6. Restore your contacts and finishing up.

Step 1: Preparing

~~~Backup: depending on your device's condition (jailbroken with old firmware, etc..) You want to do a full backup.~~~~~

~~Skip this step if you do not want to perform a backup. ~~

Some of the software that will help you accomplish the backup: (you possibly only need one of them) 1. iTunes: If you can synch with iTunes (there are people that can't ), do a backup now, you will be able to restore easily. Please make sure you are using the latest version. At the moment I post this article, it can be downloaded here: http://www.apple.com/itunes/download/聽聽聽聽聽 (version 9.0.2) 2. 91 Phone/Itouch Assistant: If you can read Chinese, this is perfect for you. It does a full backup for almost everything. To download it, head to: http://dl.sj.91.com/pcsuite/91assistant.exe 3. Any other backup software that can do the job.

~~~~~Jailbreak/Unlock Tools~~~~~ At the moment, the best tool would be Blackra1n+Blacksn0w: http://www.blackra1n.com/ both the Mac/Windows versions are there to download.

~~~~~Appropriate Firmware~~~~~

@For iPhone users: 1. Please check your Modem Firmware under Settings->General->About->Firmware 05.11.07. If it is not, you are required to perform a clean install. 2. If you got your 'new' phone recently (about after Sept 2009), it is very likely that your phone cannot be jailbreak perfectly. There are two issues with it though it is possible to get around them with complicated method.聽 To precisely determine if you are phone have such problem with jailbreak, you will need to look at the serial number on the About section. If you have a 3GS with the 4th number greater than 4, you are in bad luck. Or if you brought your phone from a certified retailer lately, you can be sure that you are one of the unfortunate ones. However, the maker of blackra1n might fix this issue soon.

Firmware downloads for both Itouch and Iphone: http://www.felixbruns.de/iPod/firmware/

~~~~Now you are ready~~~~

~~~~~Step 2: Clean Upgrade to 3.1.2~~~~ To make sure everyone is at the same step, a clean upgrade is recommended.

To do it we will first enter your device into recovery mode: 1.Connect it to computer