Thursday, March 24, 2011

Using batch to 快刀斩乱麻

Excessive use of listeners could result in severe performance problem. One example is the code at work where a user operation takes as long as 2 minutes to finish. Profiling shows that some methods are repeatedly called for a ridiculous number of times (279398 times for getFont()). Further analysis shows that it is caused by the chain reaction resulted from the listeners.

It would be too painful to fix those listeners from the group up (I would rather rewrite the whole thing). A quick but effective fix is to mark the user operation as a batch, and skip any calls to those methods when in the batch. Since there are still some duplicated calls to those methods, it turns out that the code still works but much faster. :)

userOperation() {
beginBatch();
...
endBatch();
}

method_result_in_duplicate_calls() {
if (inBatch()) byebye;
...
}

Wednesday, December 08, 2010

Social Game: Quick Question

WARNING: This one-idea-a-day series are typically 10-minute writeouts of my 40-min whim while I'm running on treadmill. They serve the purpose of givign me the joy of day dreaming and writing something every day. The ideas here will have very high probability of being total crap. Read at your own peril.

You send friends questions, and ask them to answer within a time limit, say 10 seconds. Your friends receive an email with a link to a web page: "Tom just asked you a quick question, and you have 10 seconds to respond. Do you want to answer the question now?" Your friends will have the option to answer or ignore the question. When they choose to ignore the question, they must give a reason e.g. the question is too personal. They can throw back a question to you. You the question asker can rate their answers.

There could be different leaderboards highlighting the most active users: Most asked, Quickest responsor, The king of ignoring, Best rated answerer etc.

You have the option to send questions via email, or your twitter followers, or your facebook friends. Or you can ask public questions which can be answered by anyone who's interested.

Businesses could use this service to get quick feedback from customers.

Does this sound like a fun social game?

Tuesday, December 07, 2010

Phone as Remote Control for Model Planes

WARNING: This one-idea-a-day series are typically 10-minute writeouts of my 40-min whim while I'm running on treadmill. They serve the purpose of givign me the joy of day dreaming and writing something every day. The ideas here will have very high probability of being total crap. Read at your own peril.

I always dream to fly a model plane since I was a kid. The controllers of model planes always resemble joysticks of game consoles. So maybe today's smartphones can be better (more intuitive) controllers since more and more fancy sensors are being added to phones, accelerometers, gyroscopes etc.

It's gonna be like playing video games but controling real (model) planes instead. You can tilt and rotate in different ways to control the pitch, yaw and roll of your plane. The plane can send back data to your phone as well, telling you about its speed, direction, vibrating your phone when it's flying bumpy, and sending back photos it takes. This sound like fun to me.

You could hold your phone in landscape direction as if you are playing a first person flying game; you could also fly the phone as if you are flying a toy plane with hand when you were a kid.

Monday, December 06, 2010

Bug Tracking System for Busy Testers

WARNING: This one-idea-a-day series are typically 10-minute writeouts of my 40-min whim while I'm running on treadmill. They serve the purpose of givign me the joy of day dreaming and writing something every day. The ideas here will have very high probability of being total crap. Read at your own peril.

I've been discussing with a friend about a team collaboration tool idea based on Google Wave a while ago. Today I'd like to reduce the scope much and focus on an area that I'm familiar with: bug tracking system for software projects.

Why?
We don't have dedicated testers, so everyone is a tester whenever he's got some free time. Sometimes we are lazy (aka too busy), and don't want to go through the full-blown bug reporting UI to enter bugs one by one. So the typical bug reports would become a single email or wave:

Hey guys, I've found the following issues:
1) The app crashes when XXX
2) The phone ate my cat when XXX
3) The app not working, and knocking the phone on the wall didn't help.

Obviously, this type of bug reports are hard to track. And even if someone who's dilligent enough to create separated tickets for each report, it's quite possible that we are gonna loose the context -- the whole email itself.

Features:
- Allow filing bug reports in a big ticket. Developers (or not that busy testers) can select some text and click a button to turn the selection into a new "subticket", in case there is need to track each individual "subticket".
- In the original ticket, each selected part would have a hyperlink to its "subticket", and the status of each subticket is displayed inline with the text.
- Send an email to the bug system, the system creates a ticket automatically.
- auto-detect and format special elements in reports such as stack trace.
- Each ticket is a wave.
- The same cool text editor from Google wave: intuitive text entry, easy to attach images, etc
- The same real time communication goodness coming from Google Wave.


Friday, December 03, 2010

Onto Videoless Games/Entertainment Apps

Video games are undoubtly the most popular way of people using their smartphones these days. But I'm still dreaming something that entertains people without forcing us to stare at the tiny phone screen. Here are two of them. They may not be games strictly speaking, but hopefully they are fun.

Shake Your Music -- Shaking your phone to change the speed of music playing. The harder the phone is shaken, the faster the music would play. Allow user to record and shake her own (or others') voice and play back. Different gestures in the air generates different special sound effects.

Phone the Conducting Baton -- Imagine you stand on the stage in front of a world class symphony. You are the conductor. Your phone is your baton. Wave your hand to conduct Beethoven's Ninth Symphony however you want your crew to perform. This sounds like a Kinect type of game which would need more accuracy in tracking users' gestures, but maybe with gyroscopes and accelerometers going into more and more phones, this is becoming more feasible soon?

WARNING: This one-idea-a-day series are typically 10-minute writeouts of my 40-min whim while I'm running on treadmill. They serve the purpose of givign me the joy of day dreaming and writing something every day. The ideas here will have very high probability of being total crap. Read at your own peril.

Wednesday, December 01, 2010

One Idea A Day

WARNING: This one-idea-a-day series are typically 10-minute writeouts of my 40-min whim while I'm running on treadmill. They serve the purpose of givign me the joy of day dreaming and writing something every day. The ideas here will have very high probability of being total crap. Read at your own peril.

As an attempt to force myself to think, write and work out everyday, I decided to try this one-idea-a-day thing, in short, to brainstorm ideas while running on treadmill and then pour my thoughts on a blog post. This is also inspired by 365Beebee (http://beebeeye.blog.sohu.com/).

It goes like:
Think & Work out -- 30 minutes on treadmill, 10 minutes in shower,
Write -- 10 minutes to write a blog post

Maybe all the ideas come up with this way are crap, but as Seth Godin nicely put, "Good ideas come from bad ideas, but only if there are enough of them". I gotta come up with enough number of bad ideas first.

This think-on-treadmill thing used to work pretty well for me -- I ended up writing something each day for two months. Let's see how long I could keep this up.

So here goes the very first one:

============================
Google Tasks Review Tool Mobile
============================
I've finally read several pages of David Allen's Get Things Done, and came to realize the importance of regularly reviewing and processing to-do lists. So I think I need a mobile version of Google Tasks (my todo list of choice) that I could process my to-do list whenever I got a few spare minutes. Basic features include sync, display and edit tasks.

Unique Features:
- dead simple to re-order tasks (use order as priority)
- dead simple to process tasks (triage, mark done)
- dead simple to see next actions
- undo (since we make things so easy, it would be easy to make mistakes, too)

Other Features:
- Sync with Google Tasks
- voice recognition to enter new tasks



Thursday, September 23, 2010

java.lang.LinkageError

java.lang.LinkageError: loading constraint violation: loader "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@621b621b" previously initiated loading for a different type with name "javax/wsdl/factory/WSDLFactory" defined by loader "org/eclipse/osgi/internal/baseadaptor/DefaultClassLoader@4c814c81

This is the best explanation I've found so far:
LinkageError is what you'll get in a classic case where you have a class C loaded by more than one classloader and those classes are being used together in the same code (compared, cast, etc).