Category Archives: Geeky

How I Upgraded My Laptop Harddisk to SSD


The best ways to boost your computer performance without changing the CPU are two folds: 1. Increase your DRAM or DIMM/memory capacity, which serves as a local scratch pads for your operating system and applications. 2. Increase your harddisk speed by changing to SSD (Solid-State Drive or Flash Drive). In this video, I showed you how I upgraded a cheap laptop (~$250) to an Ultrabook by replacing the slow harddisk to an SSD. This laptop already has 4GB of memory and is plenty enough. All it needs is a fast SSD to turn into a reasonably fast computer with a long battery life (> 6 hrs).

Book Review: “How Not To Be Wrong: The Power of Mathematical Thinking” by Jordan Ellenberg

This is another book that a mathematician attempt to make some sense of the real world problems using mathematics. It’s supposed to answer people’s or his students’ question: when we’ll ever use this stuff? As an engineer, I have benefited a great deal with mathematics. Otherwise, my life could be very miserable and the world would be in a very different shape than it’s now. But this book is not for the light-hearted – unless you’re curious about some of the topics, this book could be overwhelming and hard to digest.

My takeaways from this book:

The missing bullet holes. The focus of the book is on the profound/simple quadrant.

I. Linearity:
when things are not linear, there’s a min/max – like the Laffer curve on a napkin.
a. Linear regression – each extra SAT point could cost you $28 in tuition.
b. Don’t always extrapolate linearly – obesity apocalypse (100% obese).
c. Law of large number: converges to 50% for coin toss when the number of tries go up. NBA best free shot throwers play least games – small number.
d. Large number of tries dilutes the previous results – not change of probability. Very important lesson.
e. Don’t talk about % of numbers when numbers can be negative.

II. Inference:
a. The Baltimore broker: They send you the correct stock prediction by process of elimination. By keep trimming off the mailing list of their incorrect prediction, they ensure all the remaining ones get the correct prediction. From them, they’ll have the confidence of the people and send them their money.
b. Reductio Ad Unlikely: Suppose null H is true, it follows from H that certain outcome O is very improbable (< 5%), but O is actually observed. Therefore, H is very improbable. Bible coders. III. Expectation a. Massachusetts State lottery: expected value should be average value. Playing the WinFall. b. Utility: maximize the utility vs. missing the plane. Stigler's argument: “If you never miss the plane, you're spending too much time in airports.” c. Tying geometry to picking the “random” lottery number, and hamming code. IV. Regression a. Triumph of mediocrity. Scatter plot of father-son height (oval shape), b. Correlation is not transitive (e.g. blood relation). c. Berkson's fallacy: Mean-nice vs. ugly handsome curve. V. Existence a. Public opinion doesn't exist b. Bush/Gore/Nadar election: how best to elect public officials when there are more than 3 candidates. c. Condorcet Paradoxes d. How to be right. General Comments: 1. eBook or hardcopy book is probably better than the audiobook. Easier to visualize on a physical book. 2. Good history of mathematicians and some of how the theorems came about. 3. Not for the faint of heart. Some mathematics are required of interest in it.

Don’t Try to Predict the Future; Be a Now-ist

Joi Ito strikes a chord with me and the central theme of this blog on how to deal with the complex world we’re living today by “having a compass and know where you’re going” then “focus on being connected, always learning, fully aware, and super present.” Don’t try to predict the future. Experiment, learn and improve continuously. Be a “now-ist.”

This is one of the great TED talk videos:

Say Hello and Goodbye to My Acer Chromebook – Why I’m Ditching It

Lately, I’ve been hearing so much about Chromebooks, I even played with it at Best Buy (thanks to their “Showrooming” ;-). When their prices dropped below $200 for a brand new Acer C720, I decided to get one to play with it. I read all about its limitations and the potentials for the expanded capability after installing Ubuntu through Chroot (Crouton) and dual-boot (ChrUbuntu) methods. I have used Enterprise Linux version at work and would like to try the “client” Linux like Ubuntu for the fun of it. Because I knew I wanted to play with Ubuntu Linux so I decided to buy a used 32GB (vs. standard 16GB) flash storage version from eBay for $169. By the way, 32GB is needed if you want to run ChrUbuntu since a full Ubuntu by itself would probably need 24GB on its own if you plan to keep the Chrome OS as a dual-boot.

Since I received the Chromebook on 6/27/14, I have spent numerous hours playing and hacking it. My impression of Chrome OS is that it’s really for the consumers of digital contents due to its limitations. Here are the pluses and minuses:
Pluses:
1) Fast boot and wake up from sleep (almost instantaneous like a tablet).
2) Excellent browsing experience. The two-finger scrolling and three-finger flipping through the browser tabs are nice. Of course, having a physical keyboard makes a big difference as compared to browsing on an iPad. And the trackpad on Acer C720 works really well with sufficient immunity from accidental palm touchings.
3) Most apps are responsive and fast, thanks to the Intel Haswell Celeron 2955U 1.4 GHz CPU, 2GB DRAM’s and 32GB flash drive.
4) Seamless integration with Chromecast. (More on Chromecast on a later blog).

Minuses:
1) No email clients like Thunderbird except webmails like gmail, which works very well but not good enough for work-related emails.
2) No use of OpenOffices.
3) No IPsec VPN (the one my employer uses)
4) Can’t run Java apps. Java plugins cannot be installed. I sensed some bad blood between Google and Oracle such that Google refused to put Java on Chromebook at the time of this writing.

If you don’t plan to do lots of emails and are mainly browsing the web and run only Chrome Apps, then Chromebook may be the right laptop for you as a supplement to your tablets. Since the #1 and #3 minuses are show stoppers for me, I need to add on Linux to mitigate them. There are two options: Chroot and ChrUbuntu.

I first installed Chroot to enable running Ubuntu along side the Chrome OS in “Developer” mode. This was ideal as I would have the best of the both worlds: Chrome OS and Ubuntu – switching back and forth with simple CTL-ALT strokes. The only problem was that I couldn’t install VPN properly on it – neither Cisco AnyConnect nor OpenConnect. I suspect that the Chrome OS, running in parallel, may be causing conflicts. I gave up on it after 3 days of intensive hacking.

Then I decided that install Ubuntu as a duel-boot partition. I followed the installation directions here. After a couple of hours of downloading and installation, I was able to boot to Ubuntu and installed Cisco AnyConnect VPN. I was now in business.

Then after playing with the Ubuntu on Chromebook, I discovered a few quirks that really got me to wonder why I bothered with Ubuntu.
1. Some system settings don’t work right, like disabling the mouse while typing to avoid cursor movement. I had to type in a command to enable it manually (“/usr/bin/syndaemon -i 1.5 -K d”) and I had a hard time putting in the autostart service.
2. Locale issue: Constant “Locale” warnings popped up when running a shell. I fixed it with this locale tip.
3. Font sizes: I had a hard time fixing the font sizes on Ubuntu. It was either too small or too big.
4. The touchpad no longer works after I accidentally disabled it and wasn’t able to bring back the driver. Sigh! (This was fixed by following the directions in this link).

So at the end, I started to miss and appreciate Microsoft’s Windows 7 or even Windows 8. With Ubuntu on Chromebook, I would be wasting lots of my time fixing some minor Linux issues which seem to pop up here and there, unless I revert it back to the standard Chrome OS Chromebook, which would not do better than an iPad or an Android tablet. Then I looked around and found that for an extra $20~30, I could have bought a cheap full Windows laptop instead!

My conclusion is that, at this time, Chrome OS Chromebook and Ubuntu Chromebook are not ready for prime time. I like the pluses but the minuses are too great for me to ignore. I will most likely be reselling my Chromebook on eBay…

Installing Thunderbird on Oracle Linux or Redhat Linux

Geek alert! If you don’t do system administration on a server, this is probably not very interesting to you. But if you’re curious about installing the Thunderbird email client on a Linux Server and how it’s different from your regular click-and-install on a Windows or Mac PC, then you may want to read on.

Oracle Linux is a freely downloaded operating system that anyone could download to your server or PC and enjoy an instant power over a very powerful server, commonly used to facilitate data processing on the Internet. You use them when you shop on Amazon, search on Google or use Google Drive and etc. So what’s a big deal in installing Thunderbird on a server?

Well, installing software on a Linux system is NOT straightforward. This is why Microsoft Windows remains the gorilla in the PC world, albeit a declining one. For several times over the span of months, I attempted to download Thunderbird directly from http://www.mozilla.org/en-US/thunderbird/ and install it on the Oracle Linux server that I manage, I kept running into all kinds of problem. Like after installation, Thunderbird would not run, complaining of “libxul.so: cannot open shared object file: No such file or directory Couldn’t load XPCOM.” And then the software would just die. I tried on several machines and kept running into the same problem. Many people are having the exact problem based on my Google search.

After googling around and looking for a solution for over a month, I discovered that the standard Thunderbird download site contains a simple Linux version of the Thunderbird, destined for mostly client-based Linux like Fedora, or others. (Yes, there are many Linux variants: those for the PC/Clients and those for the servers.) But it would not work properly in the “Enterprise”-class type of this Linux variant – Oracle Linux.

1. You’d need to do a software update. This is done with the “yum install” command to bring all the software modules up to date. This Oracle Public Yum site helped me.

2. Next, download the latest Thunderbird from this website
using your favorite browser.

3. Find the rpm module from this findrpm website instead of from Thunder Download. Keep in mind that you’d need to look for CentOS version as it’s mostly compatible with Oracle Linux. See below screenshot:
findrpm

4. Download the correct version:
centos_rpm
Look for your corresponding OS version. I had a Oracle Linux 5.10 so I looked for “x86_64” version of CentOS 5.10 if you have a 64-bit version, otherwise look for the “i386” version.

5. Install with “rpm -i Thunderbird-xxxxx.rpm”. You can try to run it but for the Oracle Linux 5 version, there is another rpm, Launchmail, to install before it’s fully functional.

6. Download and install “Launchmail”:
centos_rpm

There you have it. You can now run the Thunderbird from /usr/bin/thunderbird .

Unlike the PC or Mac OS version, Thunderbird for Enterprise-class Linux is a pain to install. No wonder people are stuck with Microsoft and MacOS because of the ease of installation and other numerous ease-of-use reasons. Hopefully, this tip helps. I surely hoped someone else had written this before I spent many hours getting Thunderbird to work. However, I got to understand how fragmented Linux Apps are. There were many details I wish I didn’t have to deal with. Just double click and install automatically. Until that happens, Linux is not going to catch on for most people.

Bayesian Theorem for the Practical Thinkers

I have been reading up on Bayesian Theorem, as you might have noticed based on my past blog posts. What really gets me is how hard it is to think in practical terms for people in general without a degree in Statistics and without resorting to complicated math. Because Bayesian Theorem/Inference is so useful in our daily lives, I would like to share my shortcut so people can calculate the probability using a simple 10-key calculator instead of a computer.

The shortcut is to always think in terms of odds instead of probability. The power of Bayesian Theorem is to take the base rate and after some new evidences provided the modified rate.

The best way to learn this is to use some examples:

Example 1:
From this blog, here is an example:

1% of women have breast cancer (and therefore 99% do not).
80% of mammograms detect breast cancer when it is there (and therefore 20% miss it).
9.6% of mammograms detect breast cancer when it’s not there (and therefore 90.4% correctly return a negative result).
What’s the probability of having the breast cancer once detected positive by mammograms?

The trick is to think of the base odd of getting the breast cancer:
1% to 99% = 1 to 99
Now think of the odd the evidence provided by mammograms:
80% to 9.6% = 8.33 to 1

So the odd of having the breast cancer when tested positive by mammograms are:
1/99 * 8.33/1 = 8.33/99 = 0.084 or “odd of 0.084 to 1”

Now you must convert the odd to probability (if probability is what you’re looking for):
0.084 to 1 odd = 0.084/(1+0.084) = 7.8%

Example 2:
Allen Downey, my favorite Bayesian Statistics author and professor, has this example in his blog:
Elvis Presley had a twin brother who died at birth. What is the probability that Elvis was an identical twin?

You need the following facts:
”Twins are estimated to be approximately 1.9% of the world population, with monozygotic twins making up 0.2% of the total—and 8% of all twins.”

The odd of getting identical twin to fraternal twins are:
8% of twins are identical twins
92% of twins are fraternal twins
So the odd of identical twins is 8% to 92% or 0.087 to 1

Now there is another piece of information we must take into account => It’s a twin brother. The odd of same sex in a twin increases the odd that his brother is an identical twin. What’s the odd? It’s 2:1 ( identical twin brother + fraternal twin brother to fraternal sister).

So the odd of Elvis’s brother being an identical twin is:
0.087:1 x 2:1 = 0.174:1
Converted to probability => 0.174/(1+0.174) = 15%

Example 3:
Let’s do a final example from Example 5 of Allen Downey’s blog:
According to the CDC, “Compared to nonsmokers, men who smoke are about 23 times more likely to develop lung cancer and women who smoke are about 13 times more likely.”
If you learn that a woman has been diagnosed with lung cancer, and you know nothing else about her, what is the probability that she is a smoker?

So the odd of getting cancer as a woman who smoke is 13 to 1 (13:1). Now we need to know the base odd of women who smoke to non-smoking women. From the blog, it’s 17.9% of woman smoke. So the odd is 17.9% to 82.1% or 0.21:1
So the odd that the woman is a smoker is:
13:1 x 0.21:1 = 2.83:1 => 2.83/(1+2.83)= 74%

Now isn’t that more intuitive and practical. Go out and apply the Bayesian Theorem in a party to impress people.
Or maybe you want to calculate your chance of meeting single women if you were a single men. Let’s say you’re going to a friend’s party whose friends are 25% female and 75% male and there’s a probability that 20% of the female are single, 80% is not single or unavailable. There you have base odd of 1:3 (25%:75%)and the odd of meeting single women is 1:4 (20%:80%). Your odd of meeting a single woman in a party is going to be (1/3)*(1/4)=1/12 or 0.083:1 => 7.7%. Suppose you’re highly selective and possess a prince charming quality, your odd of finding your qualified, desirable women is 1:10. Now your odd just drop to 1/120 or 0.83%. Unless the party attendance is going to be > 120 people, then it’s worth a shot. Otherwise, you might as well stay home and watch a sports game at home instead 😉