Search

6/30/2006

Doing nothing in Bash

http://ynniv.com/blog/2005/04/doing-nothing-in-bash.html
像是C語言中的;
bash中沒有do nothing的語法

* touch /dev/null [Keystrokes: 15. Runtime: 0.02s]
* sleep 0 [Keystrokes: 7. Runtime: 0.03s]
* A=0 [Keystrokes: 3. Runtime: 0.00s]

interesting

6/19/2006

今日閱讀2006-06-19

tag: linux

6/18/2006

Ubuntu Tips- virtual pdf printer

  1. sudo apt-get install cups-pdf
  2. sudo chmod +s /usr/lib/cups/backend/cups-pdf
  3. 系統->管理->printing->新增印表機->印表機類型選"本地印表機", 使用偵測到的印表機選"PDF Printer"->下一步
  4. 製造商選Generic -> 型號選postscript color printer rev3b->下一步
  5. 套用
參考: Print to PDF using cups-pdf

歷史股價查詢

歷史股價查詢
start,end,stockid分別是起迄以及股票代號
開一個文字檔, 複製上面網址, 副檔名改為.iqy, 即可用excel處理

tag: 股票

6/16/2006

An Inside View From a Google Employee

http://blog.outer-court.com/archive/2006-06-15-n22.html

  • ZorbaTHut says that Google is mostly C++, Java, and Python (or so he’s been told).

  • “We’ve got extensive automated unit tests, all of which (obviously) must pass.”

  • Zorba writes that he has only about one meeting per month.

  • The company’s structure, at least for engineers, is amazingly flat.
    Zorba says the Google hierarchy is just five levels: Programmer - Tech lead - Manager -
    Department lead - Larry/Sergey/Eric. Google just assumes their workers are competent,
    Zorba adds.

  • “[M]ost people are Linux-only

  • Zorba says that in his opinion, C++ is the best single programming language out
    there
    . He says however that it also doesn’t protect you from shooting yourself in the foot.

  • On how Google goes about staffing a Test Engineer position, Zorba replies: “I don’t know
    what other teams are like, but on my team everyone owns their own tests and handles
    their own quality
    .”

6/15/2006

如何寫一份好的師程工簡歷

如何寫一份好的師程工簡歷
1.談到你做過的技術時,應該提到用的程序語言、你的個人貢獻和產品細節。
2.多講事實, 少用形容詞。
3.你獲得的獎、商業的榮譽或表揚、受用戶歡迎的產品和你做過的有難度的業餘項目都該包括在簡歷裡。
4.分清主次,刪掉相比之下不起眼的成績,以免沖淡更加突出的成績。

greasmonkey script example

因為每次yahoo登入都記不住帳號跟密碼, 所以寫了一個簡單的來自動填
順便練習了一下addEventListener的用法,
這樣寫的優點可以等到整各頁面load完之後在開始執行function()的部份.
這邊有人寫一樣的東西


// ==UserScript==
// @name yahoo username & password filler
// @namespace http://birdegg.tw
// @description 懶人的工具
// @inclue http://tw.login.yahoo.com/
// @inclue http://login.yahoo.com/
// ==/UserScript==
window.addEventListener(
'load',
function() {
var login = document.getElementsByName('login')[0];
var passwd = document.getElementsByName('passwd')[0];
login.value = "username";
passwd.value = "passwd";
},
false
);

HTML META Tags

A Dictionary of HTML META Tags


<META HTTP-EQUIV="refresh" CONTENT="0;URL=http://us.imdb.com/title/tt0414387">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-2022-JP">
<META HTTP-EQUIV="Window-target" CONTENT="_top">
<META NAME="ROBOTS" CONTENT="NOINDEX,FOLLOW">
<META NAME="keywords" CONTENT="oranges, lemons, limes">

6/09/2006

Shell Script Practice

一個shell script, 可以把活躍會員帳號轉為lftp的bookmark

#!/bin/bash
user="birdegg1108"
passwd=""

#sort -n 以數字排序
datas=`cat active.account|grep 3322.org|sort -n -t's' -k2|uniq`

for data in $datas
do
number=`echo $data|cut -d'.' -f1|cut -d'f' -f2`
if [ "$passwd" == "" ]; then
echo "$number \"ftp://$user@$data\""
else

echo "$number \"ftp://$user:$passwd@$data\""
fi
done

tag: linux bash shell script

6/08/2006

今日閱讀2006-06-08

Extra, Extra - Read All About It: Nearly All Binary Searches and Mergesorts are Broken
一開始是一個簡單的binary search

1:     public static int binarySearch(int[] a, int key) {
2: int low = 0;
3: int high = a.length - 1;
4:
5: while (low <= high) {
6: int mid = (low + high) / 2;
7: int midVal = a[mid];
8:
9: if (midVal < key)
10: low = mid + 1;
11: else if (midVal > key)
12: high = mid - 1;
13: else
14: return mid; // key found
15: }
16: return -(low + 1); // key not found.
17: }

如果low+high比int(2^31-1)大的話, 會有bug

作者提供了解決的方法

6: int mid = low + ((high - low) / 2);

或者
6:             mid = ((unsigned) (low + high)

6/06/2006

今日閱讀2006-06-06

6/05/2006

利用Javascript對用戶端資訊的蒐集

http://qtutu.com/blog/?p=11
http://www.chedong.com/tech/click.html


/* (C) 2003 - 2004 www.chedong.com

* Free for all users, but leave in this header

* click based user analysis:
* usage: touch a empty click.gif or create a static page on at server
* including following script into your html page
*/

document.onclick = clickStat;

function clickStat() {
// create a new empty element
var image = document.createElement("<img src="" />");

// record client screen size and mouse coordinate
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
image.src = "http://www.chedong.com/click_stats.php?width=" + screen.width + "&x="
+ tempX + "&amp;y=" + tempY;
image.height = 0;
image.width = 0;

//send request to stat server
document.body.insertBefore(image);
return true;
}

Random Files

http://googlesystem.blogspot.com/2006/05/random-files.html
Google indexes not just web pages and documents, but also interesting file types like executables, databases or source code files. To search for a file with a specific extension, you need to use the operator filetype.

1. Find applications.
If you search for [winamp filetype:exe], the first result is a direct link to Winamp 5.08. Searching for [python filetype:msi] brings many direct links to Python 2.4 setup. It's interesting to see that Google actually indexes the files and gets some metadata from them.

2. Find source code.
There's a lot of code available on Google: some on governmental sites, other useful for educational purposes. You can even restrict your search to a certain type of license.

3. Find databases.
You can find CSV files, SQL scripts, DBF files, MDB files.

4. Find feeds.
Get a list of great feeds to import to your favorite feed reader. This way you can search for the feed address of your favorite site, without looking in the source code.

5. Other interesting files.
Registry files, configuration files and, my favorite, Inno Setup scripts.

So the next type you need a file to test an application or to use it as an example, try Google.

今日閱讀2006-06-05

Levels of JavaScript Knowledge

Serving JavaScript Fast
via
He talks about several different approaches, including:

* Monolith - the bigger the chunks the better, less overhead of loading more than one file for each page execution
* Splintered Approach - divide it up into multiple subfiles and only load what you need
* Compression - gzipping up the content to reduce its filesize as sent to the browser
* Caching- sending headers to correctly cache the javascript file(s)

6/01/2006

今日閱讀2006-06-01

Web Development Bookmarklets
Dive Into Greasemonkey
Gecko DOM Reference, Index
A look at the FreeNAS server


<form action=http://www.google.com/search name=f>
<input type=hidden name=hl value=zh-TW>
<input maxlength=2048 size=55 name=q title="Google 搜尋">
<input type=submit value="Google 搜尋" name=btnG>
</form>



// ==UserScript==
// @name google at yahoo
// @namespace http://birdegg.tw
// @description add a search box at http://tw.yahoo.com
// @include http://tw.yahoo.com/
// @include http://localhost/*
// ==/UserScript==
var hotsch = document.getElementById('hotsch');
hotsch.innerHTML = "";
var googlediv = document.createElement("DIV");
googlediv.innerHTML = "
<form action=\"http://www.google.com/search\" name=f>
<input type=hidden name=hl value=zh-TW><
input maxlength=2048 size=39 name=q title=\"Google\">
<input type=submit value=\"Google\"
name=btnG></form>"

hotsch.appendChild(googlediv);