The Last Post

This post is the last one on this blog. Yes, it’s the end for this blog. However, this blog still remains in cyber world, it will be transfered to WordPress.com after May, 2008. Others will be kept before June, 2008. After that, all will be removed with this domain name. (I am contacting billing dept. of bluehost, they should be able to follow my request)

I am not sure how worse would this blog be after transferring. Just hope that won’t be too bad.

I am no longer using WordPress. It’s been doing so well, but it’s time to make some changes. As you are reading this post, I already have another space online, which is run by me. Yeah… from now on, I have to suffer noise. boy! summer is coming… But I will not make any direct connections between this and the new space.

An end is not the end.

To be continued at somewhere else…

Yu-Jie Lin (livibetter)

Google Tech Talks: No Time to Think

I highly recommend this video. This video has been available for about two days, but it only has less than 100 views while I am writing this posting.

I probably didn’t really “think” for last three years; No! maybe in my whole life. I always have an idea, then change my mind quickly. I always prepare and study for (all) exams within few days and get outstanding results from others’ eyes. I never take things serious. I often regret afterwards.

I usually google “for loop” in JavaScript or in PHP, instead of standing up and getting a printed specification which is just two steps from me. I could have some time for thinking after 2 * 2 steps, looking up and reading paragraphs. I could be more creative.

Time to Think and to (re)Learn Thinking.

Generating and verifying checksum

What is checksum

checksum is a technique, which can ensure (in some degree) integrity of transfered files. It helps detect errors occurred in transmission. It is an Error Detection, not an Error Correction, therefore once found errors, you can’t not use checksum to correct corrupt data.

Generating checksum

On Linux, you should already have programs that you need to generate checksum.

for files

cksum

It’s a simple CRC-32 checksum generator. You can just run:

cksum *

It generates two numbers: CRC-32 and filesize. It doesn’t provide verifying functionality, you have to check numbers by yourself.

md5sum and sha*sum

md5sum * > MD5SUM
sha512sum * > SHA512SUM

There also are sha1sum, sha224sum, sha256sum, sha384sum.

for standard input

You can get a checksum of a typing message, just don’t give any parameters

md5sum
my message<Ctrl+D><Ctrl+D>

You will get

8ba6c19dc1def5702ff5acbf2aeea5aa  -

Verifying checksum

Verifying is simple, just use parameter -c and the checksum file like

md5sum -c MD5SUM
sha512sum -c SHA512SUM

Do not use AOL Search

I saw this referrer in access log (obscured):

http_//aolsearch_aol_com/aol/search
?encquery=4cb9c379870ea897e28d26457ba3f9073fe933aecf8a54c2
&invocationType=keyword_rollover&ie=UTF-8

Why did this get my attention? Because there is a key pair called encquery, it could mean encrypted query or just encoded query. I believe the answer is later. When I visited that link, I can see the original search keyword which is “grants for 501c(3).” I would like to say no matter it is encrypted or encoded, that doesn’t matter. This kind of processing benefits nothing: a) it’s not a encryption, even it is. It’s easy to decrypt, b) it wastes bandwidth and processing power, since it increases the length of query string and it needs to decode before querying. They do decode it, try to remove few content from encquery.

I also noticed one thing which is the reason I would like you not to use AOL Search (I wonder if there already is someone using it.). Check out the close screen shot below:

The last five results (ads) are sponsored links, will you be fooled? I believe some people will, even there are barely noticeable background highlighting and hardly seen text “Sponsored Link” on top-right corner while you are reading the title of the website and about to click on that fake result (ads), or already clicked.

These advertisements seem to have something about Google, here is the link of first sponsored link (obscured):

http_//search_aol_com/aol/redir
?src=dmn_promo
&requestId=fe0beaf4d45a5d18
&clickedItemRank=1
&userQuery=grants+for+501c%283%29
&clickedItemURN=
http%3A%2F%2Fswitcher.dmn.aol.com%2Fsw%2Fr%3Fri%3D03CJbFowLxSSqM06o1OhPeVA%26ai%3D0%26dt%3D1204667069866%26u%3D
http%253A%252F%252Fwww.google.com%252Faclk%253Fsa%253Dl%2526ai%253DBdSSDvcLNR9CFN4nOhQTgrM2vCrPO2TPrgr7QAsvP2gyQi0AIABABGAEg6peCAigDMAA4AVDh0KuCBGDJBqABw92B_wPIAQHIAuuKmgHZA5vN436cJI3Y4AMQ%2526ggladgrp%253D193223363%2526gglcreat%253D605916443%2526sig%253DAGiWqtz3kMWiNmTm4k_zFiSOBnKE53YrkQ%2526q%253D
https%253A%252F%252Ffundraising.entertainment.com%252Fpsp%252Fpacpc%252FCUSTOMER%252FCRM%252Fs%252FWEBLIB_CNTCT_US.HTML_FUNCS.FieldFormula.IScript_Fundraising%25253Fv%25253D1%252526ln%25253D0%252526t%25253D1%252526wave%25253DFS-284%252526campaign%25253DFR-5%26cs%3DIxfqGTWmN2pxr9t0%252FXfhOEA6%252B9g%253D
&partnerClientId=aol-com&partner=AFS&googlePromoFlag=1&title=Easy+Fundraising+Ideas&partnerChannelId=-&moduleId=dmn_right.jsp.M&googleLocalFlag=0&clickedItemPageRanking=1&clickedItemPage=1&clickedItemDescription=GoogleSLResults

Obviously, Google enhances AOL Search, why not use this word power? Anyway, there is a poll for you:

SHAREAZA™ IS THE PROPERTY OF THE SHAREAZA DEVELOPMENT TEAM

That company is really dirty.

Read: After Hijacking Site, Scammers Move to Seize Shareaza Trademark and Urgent: Opposing the Shareaza Trademark.

PS. This is not about P2P, but the stealing of identity of a software.

Generating random binary content file

The following command will generate an 1MB file:

head -c 1m /dev/urandom > test.bin

It uses head command to retrieve random data from kernel random number source /dev/urandom, -c 1m specifies the amount is 1 * 1024 * 1024 bytes, then redirect to the file test.bin.

-c recognizes three multiplier suffixes: b is for 512, k is for 1024 and m is for 1024 * 1024.

If you require higher quality randomness, then you can use /dev/random, but you have to use your computer for long enough time to generate random data.

Super cow

Those cows are not bodybuilders, it’s all about genetic.

It’s kind of sick… I think I will have a while no eating any steak.

Latest Java Beta Test

Not the Sun Java you thought, but Joffrey’s Java Beta Test. Go to sign up, then you have the chance to be chosen as a tester. You have to be a blogger.

And I have been accepted as a BETA tester! Even I am not in US.

The testing subject is Jamaican Me Crazy: Caramel, vanilla and coffee liqueur flavoring. Caramel exactly is what I love to taste.

Bash: for loop

I am trying to find out which way to loop in Bash is efficient. The general code is:

#!/bin/bash

t1 () {
    tt1=$(date +%s.%N)
    }
t2 () {
    tt2=$(date +%s.%N)
    echo $(echo $tt2 - $tt1 | bc) seconds;
    }

TIMES=100000
## brace expansion
t1
for i in {1..100000}
do dummy=1 ; done
t2
## C style
t1
for ((i=1;i<=$TIMES;i++))
do dummy=1 ; done
t2
## seq command
t1
for i in $(seq 1 $TIMES)
do dummy=1 ; done
t2

Surprisingly, C style is neither the fastest one nor the most efficient one in memory usage. Yea, C style doesn’t mean it has the performance as if C code has. Using Brace expansion is the best solution in my test.

However, there is a con in Brace expansion, you can’t program like for i in {1..$TIMES}. In the manual of Bash: Bash does not apply any syntactic interpretation to the context of the expansion or the text between the braces.

Note: I use Valgrind to get memory usage information with three Bash scripts (extracted from the script above).

References: Brace Expansion, Looping Constructs and Valgrind program.

Finally, Google Webmaster Tools Gadgets

I have been waiting such features for long long time. Now we can have EIGHT iGoogle Gadgets at once, it will also add these gadgets into a new tab of your iGoogle.

Simply go to Tools section, then Gadgets.

The problem is EIGHT gadgets are too many, why they didn’t use Tabs UI of iGoogle Gadget?

Link: iGoogle Gadgets for Webmaster Tools

Follow

Get every new post delivered to your Inbox.