Thursday, July 31, 2008

Small sample of the 'Big One'

A 5.4 earthquake shook LA a few days ago and thankfully it is just a 5.4. Obama vs McCain card comments and other news about crazy criminials bump off the news about earthquake.

Super unthinkable for America if it was the magnitude of the Chinese earthquake on May 12. It would not just be buildings collapse and lives lost.... there would also be tremendous financial impact: yes, gas (and everything else) will be even more expensive, and stock market would probably fall to the basement.

I repeatedly see this dire warning: "There is a 99 percent chance of California experiencing a quake of magnitude 6.7 or larger within the next 30 years". Unfortunately we can't get a better estimate than that. But if I live in LA I am moving. But yikes is there anywhere truly safe? But I would believe elsewhere has less than 99% chance. In 30 years, will we have better progress in earthquake prediction?

Wednesday, July 23, 2008

No News is Good News

It is very hard to find time and effort but I *do* go to a gym to run on a threadmill machine once a while. I am not in top shape. I need a break after running ONE mile at a time at speed of 5.5 to 6mph. I am not traveling close to speed of light, but time already does seem SLOWER when I am traveling just that speed. (See this link if you are interested in Einstein's theory)
It just seems so much longer to run 10 minutes than watching 10 minutes of TV.

During my run I silently watch CNN's closed captions.

The screen says "BREAKING NEWS". But it is nothing really so important: Obama visited Middle East. McCain says something to capture some attention. 10 minutes: same footage videos over and over again.

The suit and tie anchors must look like this is some important news. I feel sorry for these guys. That job sometimes must be bored to death.

On the other hand: no news is good news. Do you want to hear murders, destructions and all that in headlines?

Perhaps that was a peaceful day. Or perhaps we just don't cover important news?

Is there true journalist freedom in America?

Sometimes we feel NUMB. Suicide bomber (as long as not inside America)? How many marines dead? Wildfire in California? Besides the poor victims, news anchors and reporters that have a job to do, how many care?

Monday, July 21, 2008

Decompiling and Comparing

I have a should-not-happen situation at work. There is a coworker who left the company leaving behind multiple "workspaces" (IBM Websphere project files) for a project that haven not been touched for a year.

We were supposed to use a source control system to hold source code, and create builds off some automatic process. That way, all sources are collected and not relied on the developers' machine.

But no, the guy who left didn't.

Heck I am not even on that guy's team, but now had to look at his stuff: to determine which of the workspaces create the files in production.

Fortunately, Java .class files may be de-compiled. I used the DJ Java Decompiler. This slick tool re-create source code from the .class files so I can compare. Still a painful process but not impossible.

Is there a way to decompile a Windows EXE? Decompiling a Windows EXE will probably be some unthinkable assembly files.

This is one of the beauty of bytecodes of Java. But decompiling will not recover your comments because they are not inside the .class files.

I use ExamDiff to compare text files. It is better than the good old "fc" DOS command.

But it should not happen! SMART company should require code to be in source control. Heck that guy gave a 2 week notice, did you not require him to check in that source code?

If I lose my C:drive nobody else gets hurt, all my code is in source control.

My outrageous request is: find the right source code and put it in version control. Why am *I* suppose to do this. Then, add new functionality to this code. Heck I don't even know what is it supposed to do.

Area of a Trapezoid

So I was watching a HK TV series describing a smart and nice guy. One day he was at a restaurant and saw a kid doing homework and asking his mom:

Kid: "Mom, what's the area of a trapezoid?"
Mom: "How is mom supposed to know?!"
The nice guy tells the kid immediately: "It is top base plus bottom base multiply by height divided by 2"

Do you remember that mouthful formula? How would YOU help the kid?

Do you ever have to use the formula? No, I never had to use it.

Students whine and whine about having to remember a lot of formulas in math. You don't have to remember this one!

Why? Because you can derive it on-the-fly. Instead of remembering the formula: KNOW what you are dealing with!

I would tell the kid like this:

me: "So, what is a trapezoid?"
kid: "Is is a 4 sided figure with 2 parallel sides"
me: "Here is an interesting thing you can do with a trapezoid, make a copy of it! Fit the two to make a parllelogram"
(If the kid ask why, I will tell him about parallel lines and a transversal)
kid: "What do I do next?"
me: "Now, what's the area of the parellelogram here?"
(If the kid know, we are getting closer, let's say the kid does not know)
kid: "I don't know"
me: "For any parallelogram, you can chop off the triangle, move to the other side and get a rectangle"
kid: "So?"
me: "What's the area of the rectangle?"
kid: "base x height"
me: "In this case, your base is top base + bottom base of that trapezoid"
kid: "but what's the area of that trapezoid?"
me: "Well you got this rectangle by doubling the trapezoid, divide that by 2. So this is where the formula come from."

Mom can watch you derive that formula, moms can also know some formula too!

We should teach kids problem solving approach, and not just make them remember formulas.

Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime.

Tell a kid a formula, he can apply it for a problem. Teach a kid where the formula come from, he will be able to apply it for a lifetime.

This trapezoid formula you can derive on-the-fly. However, things like the quadratic formula or the Pythagorean theorem are nothing obvious: those are the ones to remember.

Want an application of the trapezoid area? You may remember the Trapezoid Rule from calculus: to estimate the area under a curve by adding trapezoids.

Monday, July 14, 2008

Not getting an iPhone

The iPhone is essentially a colorful small computer. Wow, that feature list is impressive. Price has came down, but I am still not getting one. That price tag is just 1 reason.

That monthly fee is big. That phone price is probably set smaller than the actual cost as a bait.
It is big. Can it fit in my jean pocket? My fairly basic Nokia can.

I prefer flip phone over keypad lock, even pressing * 0 is too much work for me to unlock. I want to just open-and-use it. Is that screen scratch protected? A computer deserves a protective cover like a laptop or a Palm flap.

I don't want to tap with my big finger, how about a stylus?

I demand a phone to have actual 12 buttons. Not pseudo buttons.

The Blackberry has too many buttons. I don't need a QWERTY keyboard (I prefer a QWERTY keyboard where I can tap)

Yes, I prefer the Palm over the iPhone. How I wish I can plug a headset and use as phone.

But Palm sadly is not as feature rich. At least I can't TALK with it.

Palm combined with phone is nothing new. But yikes, that rice krispie keyboard on Treo I don't like.

My Palm's stylus calliberation is out of whack and no way to fix! :(
I have my THIRD Palm now. First one is water damaged, 2nd one is cracked. How sad
Besides is Palm going out of business soon? no new products for a long time.

So here are the features of my perfect phone:
0. Able to call/receive calls (of course)
1. has 12 actual buttons (and softkeys and directional keys to choose icons) but no more, please lay them out nice and clean.
2. has phone book and alarm clock and vibrate, with quick way to go to silence mode
3. no unlocking, flip phone
4. water resistant (are there ANY?)
5. able to play J2ME games. Give me chess! Give me tetris! I don't need to fight M. Bison on a small screen. (yes, Street Fighter is available for phone)
6. No antenna stick out. (please don't destroy my jeans)
7. able to play mp3. *I* pick the songs. Damn iPod will download everything without my consent. provide a USB chord so I can upload/download address book.

Features I don't need:
internet: I prefer an actual computer with big screen
camera: I prefer a full featured actual camera with flash

Friday, July 11, 2008

10 Things You Can Like About $4 Gas

Time magazine says something positive about expensive gas. See here for the article.

The list includes:

  • Globalized Jobs Return Home
  • Four Day Work Week
  • Less Pollution
  • Fewer Traffic Accidents
  • Less Traffic
  • Less Obesity
  • ..

These are all good! That is the optimists view. But, gas price IS driving everything up, big time, including vital items such as food.

I have one complain though, when we watch reports from news and magazines, it says "Oil at $4 a gallon" when we in Chicago are already paying more than $4.5! They say oil at $3 when we were paying $3.5. Why are the media so late? Or, why is Chicago more expensive than the average?

The Iran missiles don't help.

We also have outrageous 10%+ sales tax.

Folks we must adapt: drive less fuel hungry cars or drive less. But I don't know what to do about high sales tax.

Thursday, July 10, 2008

Missile Command

This classic video game involves the trackball and 3 buttons, an innovation in the 1980s. My Atari only has 1 button.



Waves and waves of missiles and their long trails are attacking your cities! Fortunately, you have a defense system to intercept them!
That siren and missiles indicate the fear of nuclear strikes in the Cold War.

Early video games (such as Space Invaders) often depict disaster strikes as you, the hero, attempt to save the day with quarters.

Nuclear strikes from Missile Command is simply an expanding circle cleaning out the pixels of a city.
Don't despair if you lose a city. Every 10,000 points you get a new city rebuilt.
In real life it would be unbelievably horrible. Just how many times more powerful than the A-bombs in Japan? How long does it take to earn 10,000 points to rebuild a city?

Missile strikes seem much more eminent today as we see Iran show off its missile capabilities.
Do we have a missile defense system like in Missile Command? If you build one in Europe to protect your allies will you upset your European allies?

Of course you can preemptive strike anyone to nuke them before they nuke you. Don't! We can't solve all problems by force.

Option 1: Let's talk to them. You get an example from opposition: talking to Hitler in 1940s wouldn't help.
Option 2: Let's strike them! Would we be fighting every country in the world eventually?
Option 3: Wait and see. If they really strike somebody, strike them back.

I prefer 1 and 3.

Tuesday, July 8, 2008

More on the Rubik Cube

The Rubik Cube is a humbling experience. I probably will never be solve it on my own. (Yet people have come up with many solutions) I can't derive the number of permutations either! How did they come up with 43,252,003,274,489,856,000 possibilities?

I know something about permutations... yet I don't even know how to start figuring out the permutations for the Rubik Cube.

Ok, this is what Wiki says (this info can also be found in Rubik's site):

A normal (3×3×3) Rubik's Cube has eight corners and twelve edges. There are 8! ways to arrange the corner cubies.

Seven can be oriented independently, and the orientation of the eighth depends on the preceding seven, giving 37 possibilities. There are 12!/2 ways to arrange the edges, since an odd permutation of the corners implies an odd permutation of the edges as well. Eleven edges can be flipped independently, with the flip of the twelfth depending on the preceding ones, giving 211 possibilities: 8! x 37 x 12! x 210 = 4.33x1019


I can probably never come up with that on my own.

Casually searching for info about math on the Rubik Cube, I've found this class!
http://match.stanford.edu/bump/rubik.html.
I wish I can sign up for this class. Look folks, this is abstract algebra in action!

The PDF files are beautifully written in LaTex and they look very interesting! (as long as I don't have to be tested on it in a classroom setting). I wish I understand it all. I love it when advanced math is attached to something concrete (such as the Rubik cube).