Archive for the 'Short Cuts' Category

Using Baidu

July 16, 2008

As the leading Chinese search engine, Baidu, is used by over 5 million people and has over 57 services but with limited English content or support it is literally a world apart. The main page with its sparse minimalism is familiar enough, as is the single text field for a query. But overlaying a translation differences start to come out.

First up there is some English there on the main page, as a top level search choice no less. Specifically there is a tab for ‘MP3’. Which probably is less English than a technical shorthand for an audio encoding scheme. But it would be kind of funny if 20 years later long after the MP3 format is long forgotten if ‘MP3’ became a loan word for free digital music.

But it is weird. Consider if Google or Yahoo had a top level search tab for 搜索风云榜 right between news and shopping.

So fortunately if your Chinese is not very good you can of course make use of Google’s translation tools. Which is handy. So starting with news you can just click right here to see the current results for the news page on Baidu.

The results are the mostly familiar China news, international, financial, sports entertainment and such. But there is also a page for the Olympics (which could be handy) and the international news page has a military section. Whoa. There’s an addition to add to the Google News >World page. But then again why not.

The final tip is from the main page shown above is the 搜索风云榜 or ‘fengyun bang’ or baidu trends page. Top searches, top ten lists and yes a scrolling window of garbled stuff, like a query for ‘rogue eunuchs’. Whoa again. I think this posts is done.


Seductive Sed & Awesome Awk

April 9, 2008
sed -n 2,2p

print line two of

sed -f script.sed

run sed from script.sed

sed -n =

print line numbers 1 to number of lines in in increments of 1

sed -e 1,3d > file.out

delete first 3 lines from

sed -e 1,/textString/d > file.out
sed -e 1,/'text strings'/d > file.out

delete from first line to first instance of textString or ‘text strings’.

awk '{(if ($1 >0) printf ("%d\n", $2); else printf ("%d\n", $3)}' < > file.out

if the first column is greater than 0 print the second column else print the third column.

awk '{sub(/^[ \t]+/, ""); print}' < > file.out

delete the leading white spaces from

sed s/originalString/replacementString/g > file.out

global search and replace of originalString with replacementString in

sed -e '/pattern/d' > file.out

delete all lines with instances of pattern.

tr "[A-Z']" "[a-z]" < > file.out

convert upper case to lower case.

Screen Shot to BMP File for Windows

March 28, 2008


There are a fair number of pages out there that document the steps to get a screen shot for Windows transferred to the clipboard and then pasted into another application like Word or Microsoft Paint. But how about a way to get a screen capture directly to a BMP file for Windows without a separate utility? This can be done using Microsoft Picture Manager plus the print screen button.

  1. get screen set up with content to be captured
  2. use ‘print screen’ or ‘prt sc’ button to copy screen contents to clipboard
  3. open any picture in All Programs: Microsoft Office: Microsoft Office Tools: Microsoft Office Picture Manager. Can use one from \My Pictures\Sample Pictures\
  4. press ‘ctrl’ and v to paste the clipboard contents
  5. image will not show up in Picture Manager but instead the file ‘New Picture.bmp’  will apppear in the folder where the image opened in step 3 is located, for example \My Pictures\Sample Pictures\ if this is what you used in step 3.
  6. steps 1-5 can be repeated and then new files ‘New Picture(1).bmp’, ‘New Picture(2).bmp’ and so on will be created.