Warning: include_once(/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php): failed to open stream: Permission denied in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217

Warning: include_once(): Failed opening '/home/nullvoid/blog.mikezhang.com/wp-content/plugins/wordpress-support/wordpress-support.php' for inclusion (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in /home/nullvoid/blog.mikezhang.com/wp-settings.php on line 217
NullVoid » 2008 » August NullVoid » 2008 » August

Archive for August, 2008

Pic-A-Day: Lantern of Double Happiness

Friday, August 29th, 2008 -- By ET

tam_xis_wall

Political Correctness at Google

Friday, August 29th, 2008 -- By ET

Google blog posted an article on “Strengthening the Study of Computer Science”.

It started with:

At a time when more and more digital technologies are becoming indispensable to millions of people, the field of computer science (CS) is in trouble. Enrollment and retention of CS students, particularly those historically underrepresented in the field (women, African-Americans, Native-Americans, and Hispanics) has declined sharply.

I think the sharp decline in enrollment is really an issue, but the inner-economist of mine keeps saying that there is something wrong with the argument that we are able to address the issue by promoting this major to underrepresented people.

cssi_students

I believe in the invisible hand theory of resource allocation. There was definitely an excess in supply of CS students during the bubble years, but then the students shifted attention to other desciplines. We only have certain amount of brain power in the society, and the flow of these brains to different industries is definitely a good thing for the society as a whole. If computer science proves to be playing an ever increasing role in the society, I’m sure the brains will flow back. Just reward these brains accordingly.

Overall, the marginal decision maker should be indifferent to choose between any major if the market is effecient and can reward the students through the market system.

Perl Reading A File

Thursday, August 28th, 2008 -- By ET

Read from a file, and write out. Just put it here for my own reference.

#!/usr/bin/perl

$data_file=”file.csv”;

open(DAT, $data_file) || die(“Could not open file!”);
@raw_data=;
close(DAT);

#print “Content-type: text/html\n\n”;
#print “”;

foreach $lines (@raw_data)
{
chomp($lines);
($var1,$var2,$var2)=split(/\|/,$lines);
print “$var1,$var2,$var3\n”;
# print ”
\n”;
}

#print “”;

Olympics Spirit

Friday, August 22nd, 2008 -- By ET

[flv]http://fun.drno.de/flash/rocky_is_back.swf[/flv]

Sara Schaefer’s Comments on the Olympics Opening Ceremony

Tuesday, August 12th, 2008 -- By ET
I got a phone call from Jennifer after the ceremony, they watched the opening ceremony on NBC, and Olivia was so touched and started to cry. They were not alone, the following post from Sara Schaefer said it. I checked out the comments of her blog entry, many people said the same thing. How can I not be proud of reading all these?
Ah, she obviously forgot about the Olympics rings made up with many tiny stars:

CT Oly0808029.JPG

8 Opening Ceremonies Moments That Made Me Crap My Pants
By Sara Schaefer

OpeningCeremonies16.jpgDuring the Beijing 2008 Olympic Games Opening Ceremonies, we witnessed the sheer power and brilliance of what it looks like when thousands of individuals come together for one purpose: to blow your f*cking mind. Throughout the event, I felt a mix of wonder, awe, surprise, joy, inadequacy, terror, and self-hatred – in other words, I was either whispering through tears “It’s just so…beautiful!” or I was sh*tting my pants.

I’ll admit it, it’s a little frightening to see what a country as big as China can pull off when they put their minds to it. I wondered what was responsible for such perfection: a culture of teamwork and self-pride? Or an authoritative regime with significantly more control over their people than we realized? Either way, I had a hard time imagining the U.S. pulling off something with such human precision, and half the time I felt like a fat, lazy slob. In the end, however, there’s no doubt, I’m JAZZED ABOUT CHINA! Who needs human rights when you can have human LIGHTS?

Here are the most pants-crapping moments from the ceremony:

IF GOD HAD A DRUMLINE…

OpeningCeremonies02.jpg

…this is what it might look like. As 2,008 drummers beat on drums that were thousands of years old (outfitted with some space-agey lights), Matt Lauer noted that the men were told to smile, because they realized this could be mistaken for a Persian-Army-esque battle cry. MY FLAT SCREEN TV DOESN’T ROLL UP LIKE FABRIC

OpeningCeremonies03.jpg

The ceremony featured several light displays, screens, and electronic surfaces that seemed to flow as smoothly as silk. The grandest of all these was a giant LED screen that unfurled like a scroll. Do you think Circuit City will be selling these any time soon? PIN ART ON A MASSIVE SCALE

OpeningCeremonies09.jpg

Remember those little Pin Art things we used to stick on our faces? Imagine it the size of a football field. While watching this, I couldn’t tell how on earth they were doing it – it didn’t look real. It was too fluid for machines, but I couldn’t comprehend how people could be doing this. Given what we’d already seen, I should never have underestimated them. At the end of this segment, thousands of men popped out from the boxes, waving happily. MY CURVES CLASS COULD TOTALLY DO THIS

OpeningCeremonies21.jpg

From above, the 2,008 men doing Tai Chi in unison looked like crop circles. Because let’s face it, only aliens could make circles this perfect. LITTLE GREEN MEN

OpeningCeremonies18a.jpg

These guys lit up like Peter Gabriel’s light bulb suit from the Sledgehammer video. They moved around the floor like swirling beads of water, eventually forming a beautiful bird. Then, they came together and formed a replica of the Bird’s Nest stadium, all standing on each other, for at least 3 minutes, while a small girl flew above them with a kite. Seriously, how did they HOLD THAT FORMATION for that long??? Communism, that’s how. THIS OAR ISN’T HEAVY AT ALL! SERIOUSLY, WE’RE FIIINE.

OpeningCeremonies14.jpg

These oars were probably over 12 feet long each, but they waved them this way and that as if they were feathers. WHAT NOW? I KNOW! LET’S BRING OUT A GIANT GLOBE!

OpeningCeremonies23.jpg

I kept wondering what the HELL was going on underneath the stadium – to house all these thousands of people, and giant structures like the globe. And I thought backstage at my college’s production of A Midsummer Night’s Dream was chaotic! Then, during the song, pictures of children from all over the earth appeared above and on umbrella-like things held up by another hoard of people on the floor. Was it super cheesy? Yes. Was I sobbing uncontrollably? Maybe. TINY EARTHQUAKE HERO + GIANT BASKETBALL STAR = HEART BONER

OpeningCeremonies04a.jpg

NBA star and Chinese Olympian Yao Ming walked alongside a tiny boy, who had not only survived the earthquake, but had saved two of his classmates from his school, where most of the children died. It’s just. Too. Much.Needless to say, it was a grand, beautiful, and inspiring event that I’m pretty sure made London say “Well, f*ck.”

More pictures:

OpeningCeremonies07.jpg The torch bearer shows us a new sport: fly-running! Also, note that this happened at the 4 and a half hour mark on my DVR. OpeningCeremonies24a.jpg Wouldn’t it be creepy if your saw yourself on one of those? OpeningCeremonies22.jpg The Tai Chi men do a move called “Collapse From Exhaustion.” OpeningCeremonies19a.jpg Last time you checked, little Fei Yen was in the backyard flying her kite… OpeningCeremonies17a.jpg I was at a party like this once in Prague. OpeningCeremonies15a.jpg I feel like I am at the Electric parade in Disney World! OpeningCeremonies13a.jpg Pop goes the army of two thousand men! OpeningCeremonies10a.jpg How did they know when to stand up, and just how high to go??? It boggles the mind. OpeningCeremonies11a.jpg At this point we heard the first of about 1 million references by broadcasters to the metaphorical “great wall” coming down in China. OpeningCeremonies08.jpg The torch burns bright, symbolizing China’s firey passion for perfection and pollution. OpeningCeremonies01.jpg We got the beat.
For some more pictures, check out BOSTON GLOBE.

Overheard: The War in Georgia

Tuesday, August 12th, 2008 -- By ET

Saw this from Youtube:

“I can’t believe this is happening in Georgia. I have family there.
Does anyone know if Florida or Alabama has been hit? I have friends in Florida.
And where is the National Guard?”

Same question on yahoo answers…

m8qelu

multinomial logit in R

Monday, August 11th, 2008 -- By ET

# load the data
> nes96 <- read.table(“http://www.stat.washington.edu/quinn/classes/536/data/nes96r.dat”, header=TRUE)

# load the nnet library which has the multinom function
> library(nnet)
Loading required package: MASS

# let’s change the PID variable into a factor
> nes96$PID <- factor(nes96$PID, labels=c(“Strong Democrat”, “Weak
Democrat”, “Independent-Democrat”, “Independent-Independent”,
“Independent-Republican”, “Weak Republican”, “Strong Republican”))

# fit a multinomial logit model where PID is the response variable,
# and the predictors are: log(popul+.1), selfLR, age, educ, and income

> multinom.out <- multinom(PID~log(popul+.1)+selfLR+age+educ+income,
data=nes96)
# weights: 49 (36 variable)
initial value 1836.939181
iter 10 value 1691.507857
iter 20 value 1603.709441
iter 30 value 1523.540117
iter 40 value 1461.935703
final value 1461.922748
converged

# let’s take a look at the results
> summary(multinom.out, corr=FALSE)

Re-fitting to get Hessian

Call:
multinom(formula = PID ~ log(popul + 0.1) + selfLR + age + educ +
income, data = nes96)

Coefficients:
(Intercept) log(popul + 0.1) selfLR age
Weak Democrat -0.3733563 -0.01153736 0.2976980 -0.024944529
Independent-Democrat -2.2509348 -0.08875096 0.3916628 -0.022897526
Independent-Independent -3.6659051 -0.10596768 0.5735134 -0.014851243
Independent-Republican -7.6136944 -0.09155519 1.2787425 -0.008680754
Weak Republican -7.0604314 -0.09328575 1.3469400 -0.017903442
Strong Republican -12.1051935 -0.14087942 2.0699883 -0.009432601
educ income
Weak Democrat 0.082487696 0.005195818
Independent-Democrat 0.181044184 0.047874118
Independent-Independent -0.007131611 0.057577321
Independent-Republican 0.199828063 0.084495215
Weak Republican 0.216938699 0.080958623
Strong Republican 0.321923127 0.108890412

Std. Errors:
(Intercept) log(popul + 0.1) selfLR age
Weak Democrat 0.6298384 0.03428246 0.09362654 0.006524873
Independent-Democrat 0.7631917 0.03916169 0.10823837 0.007914493
Independent-Independent 1.1565170 0.05703689 0.15854307 0.011331040
Independent-Republican 0.9575695 0.04379006 0.12889466 0.008418690
Weak Republican 0.8443601 0.03935158 0.11718480 0.007611003
Strong Republican 1.0599179 0.04213748 0.14340364 0.008133748
educ income
Weak Democrat 0.07358680 0.01763372
Independent-Democrat 0.08528965 0.02228102
Independent-Independent 0.12628792 0.03361350
Independent-Republican 0.09412459 0.02619610
Weak Republican 0.08500687 0.02297606
Strong Republican 0.09109678 0.02530048

Residual Deviance: 2923.845
AIC: 2995.845

# the results above aren’t too surprising– for instance we see that
# more conservative respondents are more likely to be Republican identifiers
# than Democratic identifiers or independent identifiers. Income has a
# similar effect. Republican identifiers also tend to be better educated
# than other identifiers.
#

# let’s look at some fitted probabilities. To do this, we’ll set all of
# the covariates (except selfLR) equal to their median values and vary
# selfLR from its low value to it’s high value.

> beta <- coef(multinom.out)
> X <- cbind(1, 3.096, 1:7, 44, 4, 17)

> Xb1 <- X %*% beta[1,]
> Xb2 <- X %*% beta[2,]
> Xb3 <- X %*% beta[3,]
> Xb4 <- X %*% beta[4,]
> Xb5 <- X %*% beta[5,]
> Xb6 <- X %*% beta[6,]

> denomsum <- exp(Xb1) + exp(Xb2) + exp(Xb3) + exp(Xb4) + exp(Xb5) +
exp(Xb6)

> p0 <- 1/(1+denomsum)
> p1 <- exp(Xb1)/(1+denomsum)
> p2 <- exp(Xb2)/(1+denomsum)
> p3 <- exp(Xb3)/(1+denomsum)
> p4 <- exp(Xb4)/(1+denomsum)
> p5 <- exp(Xb5)/(1+denomsum)
> p6 <- exp(Xb6)/(1+denomsum)

> plot(0:6, p0, xlab=”Self LR Placement”, ylab=”", ylim=c(0,1), type=”l”,
col=1, pch=16)
> lines(0:6, p1, col=2)
> lines(0:6, p2, col=3)
> lines(0:6, p3, col=4)
> lines(0:6, p4, col=5)
> lines(0:6, p5, col=6)
> lines(0:6, p6, col=7)
> legend(0, 1, legend=c(“Strong Dem.”, “Weak Dem.”, “Ind. Dem.”, “Ind.
Ind.”, “Ind. Rep.”, “Weak Rep.”, “Strong Rep.”), col=1:7, lty=1)

Olympics Header Images

Saturday, August 9th, 2008 -- By ET

I liked the olympics opening ceremony last night.  In addition to the performances, I really enjoyed looking at the smiles on the athlete’s faces.

To celebate this great event, I have created a few header images for my blog. They have the dimension of 880×153. No particular reason to choose this resolution, it just evolved this way since I started to design this blog.  Here they are:

olympiclogo0

olympiclogo2

olympiclogo3

olympiclogo4

olympiclogos1

olympiclogofuwa

olympics_all

Pic-A-Day: BUDDHA

Monday, August 4th, 2008 -- By ET

km_budha_hdr1

Overheard…

Monday, August 4th, 2008 -- By ET

Pierre Dac used to say : “Predictions are diffcult, especially when they concern the future.”


BlogTimer
You are visitor number several since September 1, 2001

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