Information

Computing Power Skirmish

Wednesday, January 6th, 2010 -- By ET
I have to make some heavy computations these days.  It gives me a chance to compare the computing power of my two computers.
On both machines, I have the same version of MySQL.  The program, written in Perl, conducts some complex calculations based on MySQL data.
skirmish
Dell-Mac Skirmish
It is interesting to observe that my Macbook Pro actually performs better than my Dell Server.  The above figure shows 5 random sampling points, at which I count how many data records have been processed since last sampling.  Macbook constantly beats Dell.
Here are the specs:
Dell:
Dual Quad-Core Xeon CPU 2.33GHz, 32GB Memory, 1T HDD, Windows 7 64 Bit
Macbook Pro:
Core 2 Duo Intel CPU 2.8GHz, 8GB Memory, 500G HDD, Snow Leopard 64 Bit
Due to the nature of the program, only 1 CPU-Core can be used, this may explain the disadvantage of Dell. (Although it has 8 cores, 4 times that of the Macbook Pro.)
UPDATE:
A few more hours of data keep supporting the advantage of Macbook:

dellmac

Fully Utilizing My Computing Power

Tuesday, January 5th, 2010 -- By ET

Before tweaking MySQL: it used 5% of the CPU and 250MB of the memory.

After tweaking, it uses 94.3% of the CPU and 2.33GB of the memory.

I could increase the memory use even more if I needed it. :-D

screen-capture9

Join Multiple PDF files to a Single One on Mac

Monday, December 28th, 2009 -- By ET

I downloaded an ebook, it contains hundreds of one-page pdf files.  I certainly don’t want to upload all of these one-pagers to my Kindle. To concatenate these files, there is no simply and easy way.  Commercial software packages are available from $14.00 to 20Euro.

A simply perl hack does the job:

  1. Install the perl module:
    perl -MCPAN -e 'install("PDF::Reuse")'
  2. Create a perl program, call it “catpdf.pl”:

    use strict;
    use PDF::Reuse;

    prFile(”output.pdf”);

    for(@ARGV) {
    prDoc($_);
    }

    prEnd();

  3. To concatenate, call it in two possible ways:
  • perl catpdf.pl a.pdf b.pdf, or
  • perl catpdf.pl *.pdf

————–

As a side note, it is really easy to concatenate mp3 files on mac, just do:
cat *.mp3>output.mp3

RIP: Dr. Tsien Hsue-shen (Qian Xuesen)

Sunday, November 1st, 2009 -- By ET

Dr. Tsien Hsue-shen (also spelled as Qian Xuesen) passed away yesterday.

To me, he is as legendary as John Nash. A movie based on his life would also be highly appropriate named “A Beautiful Mind”.

qian

Interestingly, both Nash and Tsien were affiliated with MIT.  It was 2008 when I last visited Hang Zhou, the hometown of Tsien, I visited the memorial museum (called Qian King Temple) dedicated to Tsien’s ancestor Qian Liu.  I found Tsien’s Certificate of Master of Science, conferred in December, 1936.  The design hasn’t changed a bit for so many years.  It looks exactly the same as my certificate which I got in 2006, almost 70 years after Tsien got his. I cannot express how proud I was while looking at that certificate.

Tsien is a very typical Chinese scientist, smart, hard-working and humble. He kept a very low profile despite his great achievements.   Great achievements comes with great social responsibility, he sets a great example for anyone who cares to call himself/herself a scientist.

A Complicated SQL Query

Monday, August 17th, 2009 -- By ET

Just wrote the most complicated SQL query I’ve ever encountered.  Since the table “clicks” has more than 5 million records, I’m going to wait till tomorrow to get the result.

The reason I have to write this is that I was trying to use a PERL program to do the same, and so far, after two days, it is still running with very slow progress.


create table sqlhistory as
SELECT a.inc, a.clicktime, (SELECT MAX(clicktime) FROM clicks b
where a.keyid=b.keyid and a.adid=b.adid and b.clicktime<a.clicktime
) as bctime, a.keyid, a.adid, a.bid, a.price, a.rank, a.reserve_price, a.reserve_price_new
FROM clicks a
where a.bid<>(select c.bid from clicks c
where a.keyid=c.keyid and a.adid=c.adid and c.clicktime=(SELECT MAX(clicktime) FROM clicks b
where a.keyid=b.keyid and a.adid=b.adid and b.clicktime<a.clicktime

)
limit 1
)

======Update====

Sun Wei suggested a new way to do it, and the productivity increased almost 1000 fold

1.

create table clickorder as
select * from clicks
order by keyid, adid, clicktime

2.

create an auto_increment field called ‘inc’, and a new field called lastbid

3.

update clickorder a, clickorder b
set a.lastbid=b.bid
where b.inc=a.inc-1 and a.keyid=b.keyid and a.adid=b.adid

Venn Diagram for Social Media

Tuesday, June 9th, 2009 -- By ET

socialvenn

Media Hype

Tuesday, May 12th, 2009 -- By ET

Resetting Samsung Cellphone

Tuesday, November 4th, 2008 -- By ET

I added an empty passcode to my phone by accident and samsung approved it in the first place. But when I tried to restart the phone, it prompts for a passcode, when I input an empty string, it says the passcode is too short.  So there seems to be no way to get over the first screen.

I figured out a way to reset the phone so I can clear the passcode like this:

remove all sim cards from the phone and type:

*2767*2878#

or

*2767*3855#

It worked.

Web 2.0 Logos

Wednesday, October 15th, 2008 -- By ET

web20

Keeping SSH sessions alive with Mac OS X Terminal

Sunday, October 12th, 2008 -- By ET

Need to add the following lines to ssh config (~/.ssh/config or /etc/ssh/ssh_config depending on your desired scope)

ServerAliveInterval 300
ServerAliveCountMax 3


BlogTimer
You are visitor number several since September 1, 2001

Copyright Xiaoquan (Michael) Zhang, 2004-2010. All rights reserved.
All trademarks property of their owners.