Wednesday, December 17, 2008

最受欢迎的10大android应用程序

根据medialets的最新统计结果,android最受欢迎的10大程序是

  • Pac-Man by Namco
  • MySpace Mobile
  • The Weather Channel
  • ShopSavvy
  • Ringdroid
  • imeem Mobile
  • Shazam
  • Rings Extended
  • Bonsai Blast
  • Brain Genius Deluxe

游戏程序里面Bonsai和Brain Genius Deluxe上榜我一点也不奇怪,他们本身不是试玩版,而且质量很不错。特别是Bonsai,我是爱不释手。完了一会Pac-Man,没搞清楚操控,就pass了。改天再试试。

我更加关注android市场上的读书软件,尤其是pdf读书软件。关于文本书,我觉得熊猫读书不错,但是有的时候触摸操控经常会不小心导致进度条大幅度跳进,有点不爽,只好每次使用跟踪球。不过我看好熊猫读书,放到android市场上应该会有很好评价。

另外我还关注的软件是跟桌面同步的软件。市场上有一个和outlook 2007同步的软件,但是和其他版本的outlook同步有问题,很遗憾。
Read more!

Monday, December 8, 2008

如何在G1上安装非Android Market应用程序

首先你必须有adb.exe工具(android SDK包中自带)。adb是android device bridge的缩写,可以将电脑上的android程序通过USB接口安装到手机上。我已经安装了整个SDK,所以我不知道是否单单提供adb工具就可以完成。你可以试试,这边是下载adb工具的链接

第二部是通过该链接获得G1手机的USB驱动。将它解压到任何目录下,比方说C盘根目录下(C:\android_usb_windows)。

在连接G1和你的电脑之前,你还要修改一些设置
选中
Application setting -> Development -> USB debugging

Application setting -> Unkown sources
然后取消
SD card & phone storage -> Use for USB stroage

修改完之后,你就可以通过USB将G1连接到你的电脑上。连上之后,会出现“发现新硬件"的对话框,你只要指定USB驱动程序的位置即可(C:\android_usb_windows)。这个过程可能会花一点时间...

当你看到成功安装HTC G1硬件对话框后,你就可以通过以下命令安装
adb install c:\com.netdragon.pandareader_signed_1.apk

Read more!

Thursday, November 20, 2008

盟盟之辅食进阶

从上个星期我们开始给盟盟喂辅食了,给他的母乳和奶粉里我们加了点gerber的含铁米粉,但是加了以后奶开始变稠,原先的奶嘴眼太小,出不来了...然后发现还有大号奶嘴(同样大的奶嘴,只不过眼大一点)。gerber奶瓶有自带的中号奶嘴,不用我们去买了。doctor brown的奶瓶我们买了3号奶嘴,到目前为止盟盟吃的还好,大便还算正常。昨天喂了一点香蕉,发现盟盟暂时还不会吃用勺喂的,先前喂的米汤不用舌头舔就可以喂下去,稍微固体一点,他就不知道怎么吃了。但是可以明显的感觉到盟盟很想吃,手抓住小勺不放,而且下意识的抿嘴吃。明天再试试...

ps: 这个周末盟盟要去做4个月的well check up了,时间挺快,盟盟已经四个月了,再过一个月,外公外婆就要回国了,盟盟也要去日托了,希望他能乖乖的,不然妈妈又要心疼了。妈妈已经约了12月的头一周去一家家庭日托试一个星期。 再上几张盟盟照片:





Read more!

Tuesday, November 18, 2008

Oracle JDBC Driver IO Exception

I am working on an internal tool that uses the ORACLE JDBC driver to access the database. In my testing environment, everything is fine, but my colleague got an SQL exception after running the tool.
java.sql.SQLException: Io exception:
The Network Adapter could not establish connection
First, I search the internet and all results roots from this solution. But it doesn't apply to my case.

So I return to the starting point, and think if the database connection is available to my colleague. He doesn't have ORACLE installed, so there is no tnsping.exe tool and tnsnames. But there is telnet, and you can type this command to see if the database instance at the port on the host is available to you
telnet host port
If it is available, you will be led to a clean dos window; otherwise, there will be message saying "Could not open connection to the host...".

It turns out that our network engineer has put some restrictions on the IPs that are allowed to access the database, and that is the cause for the IO exception.
Read more!

Monday, November 17, 2008

Track the Location of an IP Address

I found two free online tools for tracking the location of an IP address, which are pretty useful.
IP2Location
and
GeoBytes IP Locator
Read more!

Tuesday, November 11, 2008

Another Syntax Highlighter for Online Code Posting

Today, I found another code prettify plugin for my blog today through Google Code: SyntaxHighlighter. There is an online tutorial for how to use it in Blogger. But I did have some issues with line breaks, and Blogger add <br> to replace line breaks, which it should skip instead.

So I switch to Blog In Draft and check the option "Make Blogger in Draft my default dashboard". It solved the line break issues.


Read more!

Monday, November 10, 2008

Another Mobile Browser - Mozilla Fennec - under Alpha Testing

After Opera, Safari, IE Mobile, Chrome Mobile, we are welcoming another mobile browsers: Mozilla Fennec. Currently, it is still under alpha testing. Anyone are welcome to alpha test it. If you don't own a N810 Internet Tablets, you can still try it out on your desktop. I am more intested when this will go to Android OS powered phones like G1 and PSP, but there is no luck in the near future, because Fennec is not written in Java and Android does not support applications that run directly on the operating system itself without the need to be written in Java. I am hoping that Google will do the right thing and make a deal with Mozilla so that we can have Fennec soon on G1.

Here is the brief feature list and working UI for Fennec.
Read more!

Monday, November 3, 2008

My New Google Android G1 Phone

I just got the Android G1 phone from EBay, and the phone looks awesome. At the beginning, I opened the back cover with caution, and now I can open the back cover very quickly.

After begging for an activated TMobile SIM from one of my collegues, I was able to set up my G1 phone. After setting up the phone, I replaced the SIM with the unactivated TMobile SIM card coming with the phone, and I was able to use the Wi-Fi connection. So far, I only experienced G1 applications using Wi-Fi connections.

The browser on G1 is really amazing, and it renders a lot of pages that can't be loaded into the browser that is built into the BlackBerry.

There are several issues that concerns me:

  • I got a Bronze one and it is a little bit difficult to see the letter once the bakc light is on. So far, this is ok for me.

  • the GPS is not working very well. It is not very acurate and sometimes, it doesn't work

  • I can't manage to install G1 applications from Android Market. This really bothers me, because I am eager to try those applications.

  • ...


UPDATE: I was able to install G1 application from Android Market using Wi-Fi. I guess during the time when I tested, the network is not quite stable.

Read more!

Wednesday, October 29, 2008

Unlock Your T-Mobile G1 Phone

I think a log of people who bought their G1 phone from EBay would love to unlock their new baby so that they can use G1 phone in different network. Here is the Unlock T-Mobile G1 Phone Site that provides you the unlock code based on your phone's serial number. Unfortunately, you have to pay $24 for the service, but it worths a try.
Read more!

Lessons Learnt from Recent Bugfix Release

Last week, I was working on a SCORM export bug. It came in pretty late and I barely have time to check into the Perforce before the branch is locked. I was also busy working on other stuffs so I didn't verify it carefully and thought my QA colleagues could help me out. However, my colleagues assigned to test this bug fix is not quite sure about the software we are using for testing SCORM course packages, and he didn't test it and the bugfix went out. The next day, we got complaint and I was yelled by this mistake. So here is the lesson I learned from this:

  • RULE NO 1: Verify it as a QA before resolving the TT and send it to QA team.

  • RULE NO 2: Sit with another developer and do some peer review. It doesn't matter whether the other developer is familiar with the component you are working on. Sometimes, when you are explaining your fix, you will find the issue. At the same time, the other developer gets to know the component better.

  • RULE NO 3: Create unit test.

  • RULE NO 4: Make sure QA team is aware of your fix and know how to test it.

  • RULE NO 5: Stop blaming your colleagues and start to figure out the approach to avoid the same sh*t happens again.



Read more!

Sunday, October 26, 2008

盟盟和妈妈单独相处的一天

10月25日,也就是盟盟满100天的前一天,盟盟和妈妈度过了出生以来单独相处的第一天。因为爸爸要带外公外婆去环球影 城,妈妈不忍心让盟盟出去受苦,所以决定留在家里陪伴盟盟。因为之前一直有外公外婆和爸爸帮忙,所以爸爸走之前妈妈还是有点担心的,生怕一个人搞不定盟 盟。事实证明盟盟基本上还是一个乖宝宝,吃饭和玩耍都可以打10分,只有睡觉的时候还是喜欢哭闹,害得妈妈每次都要把盟盟抱在怀里哄着了才敢放下去。这一 天里盟盟最开心的时候就是被妈妈抱起来学走路的时候,虽然摇摇晃晃歪歪倒倒,盟盟还是很执着的一步一步往前迈,甚至把妈妈的腿当楼梯上。妈妈最开心的时候 就是盟盟睡觉的时候,特别是看着盟盟在妈妈怀里睡得很香甜的样子,妈妈都觉得这一天的bonding还是卓有成效的。
附:今天是盟盟百天,活动安排如下:上午去公园外公给照相相,中午全家吃长寿面(盟盟旁观),下午去照相馆照相相,之后在AppleBee's晚餐(盟盟旁观)。
Read more!

Saturday, October 18, 2008

儿子学会侧着睡了

今天突然就学会了,即使把他给掰回来平躺着,他身子马上就往右侧过去睡了,总算解决了扁头和偏头的问题。但是侧着睡得问题就是安慰奶嘴老掉,所以儿子好像睡的也不踏实。旧问题没了,又来新问题了。
Read more!

Tuesday, October 14, 2008

儿子越来越矫情了

特别是想睡觉的时候,就得抱着,一放下立马就开始扯着嗓子哭,虽然光打雷不下雨(还不会下雨呢?),但是也够惊天动地的,反正是不安抚兔崽子睡着大家都没得安宁,看来自己还不是特别有耐心,一到这个时候按就要跟兔崽子杠上,每次都想把他往哪一丢,爱哭就哭呗。老婆和岳父岳母要耐心一点,会哄儿子睡着,睡着后就没事了。有的时候刚睡醒,那个哭的也跟马景涛有的一拼了,以后琼瑶奶奶的戏让俺们演得了。

其他的时候都还好,特别是下午吃完饭洗完澡后,丫的特别有兴致和你互动。现在发的音都开始迎扬顿挫了,大声的很。特别容易笑,还会笑出声来,特别尖的那种,小公公一名...

体育方面,就是还不会爬,就像走了,典型的急性子性格啊...让他趴在那,就会脚乱蹬,不会用手,每次蹬了半天,没劲了,就开始哭闹了,哎。

来几张儿子开心笑的照片




和狗保姆在一起


Read more!

Safari Fails to Include the Successful Controls in the Form Data Set

Another bug (you might need to have a Apple ID for accessing the link) for Safari!

<form action="fake_action" method="POST">
<button name="disable" value="Deactivate Account" type="submit" onclick="click();">Deactivate Account</button>
</form>

For the above form, the name/value pair for the submit button should be included in the data set when the form is submitted (i.e., the submit button is clicked). When I run the above form in Safari, the server app doesn't get
NAME         VALUE
disable   Deactivate Account

in the form data. However, if I remove the onclick event in the submit button control, the server app get the data I expect.

UPDATE:
Here is the link to the standalone test


it is a simple form with 4 different kinds of submit buttons, and here is the source code for the html page
<html>
<head>
<title>A simple form</title>
<script type='text/javascript'>
  function test(){
    document.forms[0].submit();
  }
</script>
</head>
<body>
<form action="formsubmit.php" method="POST">
<input name="disable1" value="Deactivate Account(submit button with onclick)" type="submit" onclick="test()">
<input name="disable2" value="Deactivate Account(submit button w/o onclick)" type="submit">
<button name="enable1" value="Activate Account(submit push button with onclick)" type="submit" onclick="test();">Activate Account(submit push button with onclick)</button>
<button name="enable" value="Activate Account(submit push button w/o onclick)" type="submit">Activate Account(submit push button w/o onclick)</button>
</form>
</body>
</html>


here is the source code for formsubmit.php, which simply print out the successful control sent to the server (any one of those submit buttons)
<html>
<head>
<title>Submit Form</title>
</head>
<body>
<?php

foreach ($_POST as $item) {
print $item;
}
?>
</body>
</html>


basically, I only get successful control for those submit buttons without onclick event handler, which does nothing, but call the form submit method in this test case, while I got all submit buttons in Firefox.

Read more!

Monday, October 6, 2008

小人最新进展

两个多月过去了,小人长得不错,多亏岳父岳母在这照顾Bryant. 现在小人和人沟通的欲望越来越强了,会不停的跟你说话,如果你愿意用他的语言和他沟通的话。如果你和他笑,他笑的比你开心。总算大家幸苦没白费,能看到小人笑,开心顿时幸苦觉得都值得了。

GSD姐姐Ally很好奇弟弟,经常有机会就像和弟弟亲热一下,这不又舔起弟弟的脚了。
再show一下小人最近的玩具,这个还是一个月前(9.11)参加另一个小朋友生日party的时候拿的。可惜气球昨天气没了,看看那天去给买个新的。小人左手特别灵活,比右手玩的好。不知道和他头经常偏有有关联?

Read more!

Friday, September 5, 2008

What we can do with String.replace()

Here is the spec from Mozzila for String.replace().

The basic syntax for it is
var newString = str.replace(regexp/substr, newSubStr/function[, flags]);


It finds a match by either a regular expression or a string, and replaced it with the new string or the result of a function. For example,
var string = "hello world, user1 user";
var newString = string.replace("user", "thunder planet");
//the newString is "hello world, thunder planet1 user
var newString1 = string.replace(/user$/, "thunder planet")
//newString1 is "hello world, user1 thunder planet


The replacement string can include those special patterns
  • $$ -- a '$'
  • $& -- the matched substring
  • $` -- the portion of string that precedes the matched string
  • $' -- the portion of string that follows the matched string
  • $n -- if the matched string is specified using a regular expression, it gives the group in the regular expression


Please see the following examples:
var string = "hello world user"
var newString = string.replace("user", "$$");
//newString is "hello world $"
var newString1 = string.replace("user", "$&");
//newString1 is the same with string
var newString2 = string.replace("user", "$`");
//newString2 is "hello world hello world"
var newString3 = string.replace("user", "$'");
//newString3 is "hello world "
string = "Hello, John Smith";
var newString4 = string.replace(/(\w+)\s(\w+)$/g, "$2,$1")
//newString4 is "Hello, Smith,John"


The definition to the replacement function depends on whether you are using regular expression and how many groups are in the regular expression. Basically, the replacement function is in form of
function replacer(str, p1, ..., pn, offset, s)

The first parameter is the matched string, and the following n (n can be zero) parameters represent the groups in the regular expression, offset is the offset for the matched string, and the last parameter is the whole string.

function replacer(str, p1, p2, offset, s){
return "{" + str + "/" + p1 + "/" + p2 + "/" + offset + "/" + s + "}";
}

function replacer1(str, p1, offset, s){
return "{" + str + "/" + p1 + "/" + offset + "/" + s + "}";
}

"XXzzzz---Xz--XXzzz".replace(/(X+)(z+)/g, replacer)
//result is "{XXzzzz/XX/zzzz/0/XXzzzz---Xz--XXzzz}---{Xz/X/z/9/XXzzzz---Xz--XXzzz}--{XXzzz/XX/zzz/13/XXzzzz---Xz--XXzzz}"
"XXzzzz---Xz--XXzzz".replace(/(X+z+)/g, replacer)
//result is "{XXzzzz/XXzzzz/0/XXzzzz---Xz--XXzzz/undefined}---{Xz/Xz/9/XXzzzz---Xz--XXzzz/undefined}--{XXzzz/XXzzz/13/XXzzzz---Xz--XXzzz/undefined}
"XXzzzz---Xz--XXzzz".replace(/(X+z+)/g, replacer1)
//result is "{XXzzzz/XXzzzz/0/XXzzzz---Xz--XXzzz}---{Xz/Xz/9/XXzzzz---Xz--XXzzz}--{XXzzz/XXzzz/13/XXzzzz---Xz--XXzzz}"
"XXzzzz---Xz--XXzzz".replace("Xz", replacer1, "g")
//result is "X{Xz/1/XXzzzz---Xz--XXzzz/undefined}zzz---{Xz/9/XXzzzz---Xz--XXzzz/undefined}--X{Xz/14/XXzzzz---Xz--XXzzz/undefined}zz"
"XXzzzz---Xz--XXzzz".replace(/X+z+/g, replacer1)
//result is "{XXzzzz/0/XXzzzz---Xz--XXzzz/undefined}---{Xz/9/XXzzzz---Xz--XXzzz/undefined}--{XXzzz/13/XXzzzz---Xz--XXzzz/undefined}"

So the replacement function depends on the first argument in the String.replace function.

Read more!

Wednesday, September 3, 2008

Web on PSP

Here are several article discussing the web development for PSP
Web design for the Sony PSP
What Browser Does the SONY PSP Use?

The big issue with the browser on PSP is lacking support of DOM and AJAX. For example, it doesn't support innerHTML or document.createElement/document.appendChild. The only thing it supports is document.write. There is no support of XMLHttpRequest object either. It only supports flash 6, which is also disappointing.
Read more!

Wednesday, August 27, 2008

IE6 XMLHttpRequest same-origin policy

In IE6, there is no native XMLHttpRequest object, but we can use ActiveXObject('Msxml2.XMLHTTP') for the same purpose. The same-origin policy also applies to ActiveXObject in IE6, and there might be exceptions. There is a setting called "Access data sources across domains" for internet, intranet, and trusted sites zone. If it is set to enable in internet/intranet/trusted sites and the page that tries to access data in different domains falles into one of those zones, you won't get the permission denied exception. If the option is set to false, you will get the exception.
Read more!

Monday, August 25, 2008

Safari's defect on same-origin policy?

XMLHttpRequest object follows the same-origin security policy, which means you can't use it to request data from another domain. For example, the web page is hosted in domain http://www.domain.com, and it is forbidden to request data from http://www.domain1.com using XMLHttpRequest. You will get a permission denied exception when you try to call the open() method.

Same origin means same protocol, same host and same port. However, it looks like different browsers interpret this in different ways. I had an SCORM course, which is hosted in domain http://www.domain.com, but the requested app is located in domain http://www.domain.com:80. I didn't have any issue with IE and FireFox, but in Safair, I got a permission denied exception. I am wondering if this violate the same-origin policy in Safari.

Interesting discussion here for by passing the same-origin policy for XMLHttpRequest object in Firefox and IE.

PS: According to RFC 1738, the port defaults to 80 if port is ommitted. After I get rid of the 80 port number in the url for the requested app, it works in Safari. Unlike IE and Firefox, I guess Safari literally check the URL for the domain.

Read more!

Thursday, August 21, 2008

照顾小人真是麻烦啊

还是忍不住上来发发牢骚,这小人也太难伺候了。先是不好好吃奶,懒得吃,每次都要妈妈把奶给泵出来,就着奶瓶才喝,这样他不费力。这倒好,累了妈妈也累了爸爸。这洗瓶子蒸馏瓶子的功夫也不少啊。还好省了洗尿布的事,就用纸尿布了,但是这换尿布也花时间,每天得换上10来次,偶的钱包就是被这小人给拉完了。而且每次来小的,这小人就像杀猪似的,从来就没有轻轻松松换过。然后就是要吃饭了,就跟强盗一样狠命抢,吃不到就狠命的哭。喂好后,肚里有气了,又开始乱蹬,小脸憋得通红,想burp他都不容易,每次得爸爸妈妈,外公外婆轮番上阵,直到出嗝为止。这些倒还好,可恶的还是小人晚上不好好睡觉,每次喂完换好尿布后,还在那唧唧歪歪的,整的大家睡不好。前天总算出满月了,希望小人好好体谅一下爸妈和外公外婆,乖乖的吃饭,好好睡觉...

来两张出浴图




还有跟姐姐ally的合影

Read more!

Tuesday, August 5, 2008

encode AICC data in JavaScript

The AICC data in putparam command needs to be encoded before send the HTTP request, and there are several JavaScript methods for encoding strings: escape, encodeURI, encodeURIComponent. Here is the article describing the difference between them. However, those 3 doesn't quite meet the requirements, because all of them will skip some unsafe characters. For example, escape and encodeURI will skip the unsafe character "/", and encodeURIComponent will skip the unsafe character "'".

Since "+" will be decoded to spaces on the server, this needs to be encoded before sending the AICC data. This makes escape() the last one we should choose, and encodeURI skips a lot of unsafe characters, besides "+". So it looks like encodeURIComponent is the best choice, but we need to be careful about "'" and "~".

Read more!

Monday, July 28, 2008

给儿子做的ticker

昨天在tickerfactory刚刚给儿子Bryant新做的ticker


今天去儿科医生处做检查,结果儿子体重只长了2 oz,一声认为吃的比较少,说我们应该加大剂量。
Read more!

Sunday, July 27, 2008

妈妈的产经

儿子出生1周了,写写我的顺产产经,给还在期待中的准妈妈们打个气。

先说生产的过程简单而迅速,连我自己都没想到会这么顺利,本来是做好了熬通宵打持久战的心理准备的。下午6点钟进医院,开3指,我自己评估疼痛指数是6。在经历了数个指数12的宫缩之后我已经痛得连调整呼吸都顾不上了,为了保存实力push还是要了挨批丢。8点半上挨批丢,开4-5指,之后宫缩频率有所降低,但痛感还是很明显,完全没有体会到很多人说的上天堂的感觉。这里要特别感谢一下老公,他在陪我上产前辅导课的时候就很认真的学习lamaze呼吸法,这会派上了极大用场,要不是他coach有方,我是无论如何也坚持不到8点半的。上了挨批丢不久OB来了一次,说要帮我破水。我只看到一根细细长长的塑料签子在我眼前晃动了一下,之后的事情就不知道了。老公说还是不要知道得好。10点25护士来查说是全开了, 10点50开始push, 11点26儿子就出来了。顺便说一下push的过程。因为挨批丢搞得我双腿全部麻痹,既不痛也没有压力,只能按照护士说得在头脑里想象poo poo的感觉然后干用力,结果护士说能看见儿子头的时候我自己都吃了一惊,没想到这种盲目的push也会有效果。后来听老公说,护士阿姨本来很温柔的,又是按摩又是抹油,可惜儿子的头下到一定程度就卡在那不动了。OB来了之后先是观察了一阵,估计嫌护士进展太慢,于是亲自上阵,又拉又扯,仅仅两次宫缩就把儿子给拽出来了。如此猛烈的攻势下,撕裂是免不了的,虽然OB没说我的撕裂程度,我还是亲眼看到一系列穿针引线的动作,感觉缝针的次数一定是大于等于2的。事后我每次在头脑里幻想到OB类似庖丁解牛的动作就不寒而栗。儿子出来时的感觉就像很多人描述的,身体里有一大团东西被唏哩呼噜的拽出来了。我当时脑子里一片空白,不敢相信自己这么快就完成任务了,只觉得嘴上被劳工重重地吻了一下,然后就看到一个白花花张牙舞爪的小东西被护士抱到旁边的小床上去清理了,耳边充斥着儿子响亮的哭声。接下来的时间过得很漫长,劳工忙着给儿子照相,护士忙着给儿子清理和秤重,OB忙着缝针和清理我的胎盘。据她说我的胎盘很sticky,一次掏不干净还得掏两次三次,每掏一次还要show给我看一下。不夸张地说胎盘真是我见过得最恐怖最bloody的东西,不看也罢。因为一切告一段落,我开始观察周围的情况,突然发现放眼望去自己的血渐得到处都是。因为没有感到疼痛,我很难相信自己已经流了那么多血。老公说如果当时我从OB的角度看过去一定会把自己吓晕过去。

等一切处理妥当我才终于迎来和儿子见面的历史性时刻。儿子抱到我面前的时候已经停止了哭闹,争着大眼好奇的打量这个世界。我异常失望的发现儿子远不如我想象中的好看,而且最郁闷的是,他长得一点都不像我。当然儿子回家后越长越顺眼,像我的地方已越来越多地被发掘出来,那是后话。

回顾整个生产过程,虽然称得上一帆风顺,却也有一些感受可以分享。因为我身材偏瘦,从怀孕开始,就不停的有好心人告诫我要多走路,

特别是最后临产的阶段,言下之意就是你这么瘦能不能生得出来啊。实话说我对自己也没有什么信心,所以把多走路这个精神贯彻得相当彻底。先是因为工作性质的关系每天上班都在不停的走来走去,直到生前两周才休息。我怀孕9个月的时候跟我实习的新同事都还赶不上我的步伐。歇下来以后坚持每天到附近的公园散步3次,平均每天2mile左右吧。生的前一天还和老公带狗狗去了狗公园。生的当天早上看OB,说是internal开了3指,如果她当下帮我massage一下我立马就可以进医院了。不过因为我预产期还有10天,OB就放我回去慢慢等了。我当时已经明显感到经常性的宫缩,只

是不觉得痛。我本来还计划着要不要去逛mall把儿子逛出来,不过听OB一说,还是取消了逛mall计划,改为去超市买菜了。回到家吃

过午饭睡午觉的时候开始感觉到疼痛。我自己觉得差不多了,于是爬起来洗澡,并指挥老公收拾箱子。一切准备就绪的时候已经是下

午4点, 我也开始痛得呲牙咧嘴了。劳工还是不依不饶的拉我和他去遛狗,理由是如果去了医院开得不够大护士还是会让我走路,与

其这样还不如自己先在家里走了。我觉得劳工说的有理就跟他去了,结果这一圈走的痛苦无比,每走一两分钟就痛得要停下来调整呼吸,平时20分钟的路程这次走了40分钟。回到家上厕所,发现出血已经很明显了,我当时就有点慌,恨不得立刻飞到医院。跟老爸老妈说明情况,他们还是坚持我应该吃完晚饭再走,特别是在他们知道美国医院不给吃东西之后。事实证明这是一个很英明的决定,我到了医院真的是滴水未尽直到第二天凌晨2点。老爸老妈还作了另一个英明决定就是跟我去医院。我本来想说服他们留守,一来怕他们熬夜太辛苦,二来怕他们对美国的医院大惊小怪影响我的情绪。结果老爸老妈很配合得在waiting room里等候,儿子也十分争气,全家人终于在午夜来临之前一起迎来了儿子的诞生,皆大欢喜!
Read more!

Monday, July 7, 2008

快要做爸爸了

马上Bryant就要出世了,做老爸的一点感觉也没有,哎。昨天和Bryant外公把他的小床给买回来,然后搭起来了。还好有他外公在,不然一个人干还挺吃力的。

看着满屋的小孩的东西,不由得感叹当初我们小的时候哪搞得这么复杂,什么毯子(receiving blanket), 带帽子浴巾(hooded towel), 幼儿内衣(body suit), (婴儿车)stroller, (婴儿床)crib, (小电动秋千)swing,婴儿车座(car seat),换尿布的台子(chaging pad)等等。衣服得分3个月以内的,3到6个月的,还有围嘴,帽子等等。爸妈还寄来的小肚兜,可惜印的都是猪或者狗的图案,还好外公外婆带来两件带老鼠的肚兜。还有布尿布,虽然我也想用布的不想用纸的,可是想到要洗这些尿布还是有点头大。如果外公外婆牺牲一下,给Bryant洗尿布,我是举双手双脚赞成用布尿布的,不用纸的。要是爷爷奶奶过来了,肯定是用布的了,奶奶肯定会给孙子洗尿布的。然后奶奶还给织了很多毛衣,想起这洛杉矶穿毛衣的日子还真不多,估计奶奶的心血要白费了,还好着毛线不是很厚的那种,如果能穿,还是尽量让Bryant穿奶奶的爱心毛衣的。

这可恶的保险,到现在还没确定下来我们究竟能不能在san gabriel medical center生。

后记:最后在老婆医院的同事的帮助下,偶们终于可以在San Gabriel Vallye Medical Center生了,好处就是跟Garfield Medical Center比,这边单间多的是,而且人少,我就可以配老婆和儿子一起住院了。
Read more!

Wednesday, July 2, 2008

Data Posting When the Winodw is Unloading?

I had a web application and it will do some data posting when it is closed. All the heavy lifting work in done in the onunload event handler for the page. However, it is not guaranteed that the data posting will be finished/succeed before the window is destroyed. So a Exit button is provided in the web application and the event handler to the button will do the heavy lifting work before calling
window.close();


We want to encourage users to click the Exit button instead of the browser closing button. So the design is that if users exit the application through browser closing button, a warning message will be thrown, and ask users if they really want to exit the application with the risk of losing data. If they choose ok, they will exit the application and probably the data will get lost. If they choose cancel, they will stay on the page.
window.onbeforeunload = confirmExit;

function confirmExit () {
if (!safeExit) {
return "You have attempted to leave the application without clicking the Exit button, and your progress will be lost. Are you sure you want to exit the application?";
}
}

//event handler for the Exit button
function doClickExit(){
safeExit = true;
//blahblah
}

Please see my previous post for more details about setting up the onbeforeunload event handler.

PS: I also tried synchronous XMLHttpRequest object for posting data, and it looks like it has a higher rate (maybe there is no data get lost forever) of posting data in the onunload event handler. But still, it is a good practice to provide a way which guarantees that data will be persisted and users are aware of it.

Read more!

Tuesday, July 1, 2008

可怜的ally

妈妈快要生弟弟了,所以上个星期四ally她外公外婆从国内过来帮忙。结果外公外婆一下子见到这么大的狗狗在家里,还真有点不适应。外公其实很想和ally玩,但是ally动作会比较大,暂时决定让外公不理ally,外婆有点怵ally,主要是ally的狗天性不该,见到任何人都会在下边闻很久。不过看在妈妈的份上,ally暂时还好,没被隔离到院子里。突然一下子家里多了两口人,ally可能压力一下子大了起来,加上那天给她吃了很多骨头,结果周末开始上吐下泻,已经在地毯上有了三次事故了。可怜的ally,现在只好白天我不在家的时候把ally给放院子里了。上次好像在院子里晒了会太阳好像就不拉肚子了,希望这次也能好的快点。 这样就可以呆家里了,不然呆在外面很快就有臭味了,又得给她洗澡。唉,这爹当的...
Read more!

Thursday, June 26, 2008

Use xmlHTTPRequest for Accessing Local Files

here are some of my experiences working with xmlHTTPRequest object to open local files.
xhr.open("GET",localFile,false);          
httpRequest.onreadystatechange = function(){
if (xhr.readyState == 4) {
if (xhr.status == 200) {
//blahblah...
} else {
//blahblah...
}
}
xhr.send(null);


First of all, there will be exceptions if you trying to access a local file that doesn't exist. Instead of returning 404 status code, it throws out an exception. In addition, the status code from opening local files will be 0. Below is quote from Mozilla website for xmlHTTPRequest object.

file:/// and ftp:// do not return HTTP status, which is why they return zero for status and an empty string for statusText. please refer to bug 331610 for more insight.

I didn't find any IE related document to xmlHTTPRequest object, but from my test, it also return 0 for file:///.

Below is the modification to original code
try {
xhr.open("GET",localFile,false);
httpRequest.onreadystatechange = function(){
if (xhr.readyState == 4) {
if (xhr.status < 300) {
//blahblah...
} else {
//blahblah...
}
}
}
xhr.send(null);
} catch (ex) {
//blahblah...
}


Read more!

Wednesday, June 25, 2008

FireFox 3 is out

Good news that FireFox 3 is out, and I think it cheers a lot of geeks. But I will still keep using FireFox 2 for a while until FireBug is integrated with FireFox 3 smoothly. During the FireFox 3 beta testing, a lot of people has found a lot of issues using FireBug. In addition, Mozilla has reported a minor vulnerability in FireFox 3 and its earlier version.
Read more!

Does FireFox support beforeunload event?

The answer is yes. FireFox does support beforeunload event. However, you can't expect it to work if you put its event handler into the <body> tag as we do in IE.
In IE, there are several ways to define the onbeforeunload event handler


(1)<body onbeforeunload='confirmExit();'>

(2)document.body.onbeforeunload=confirmExit;

(3)window.onbeforeunload=confirmExit;

function confirmExit(){
return "You are about to leave this page. Are you sure?";
}

in FireFox, you can only use the (3) to trigger the unbeforeunload event handler. It frustrated me first, because I thought they are all same, but why I didn't get what I expected. I guess it is not supported very well and the first two approaches don't work in FireFox. So if you want to use onbeforeunload, please use the (3) to make it work on both IE and FireFox.

Read more!

Monday, June 16, 2008

My First Father's Day

I felt so great about getting my first father's day gift


"Dear Daddy,

Even though I haven't see you, I can hear your voice and feel your touch. Thank you for taking good care of me and mommy, and I can't wait to hug you and kiss you when I come out to the world!
Happy Father's Day!

Love,
Mengmeng"
Read more!

Monday, June 9, 2008

A nice Joomla debugging extension

I have been looking for some kind of logging framework for Joomla development, that is similar to log4j, but I couldn't. So I came across this article talking about J!Dump. Looks like it might be helpful.
Read more!

Tuesday, May 20, 2008

Ally salutes

Ally salutes to those rescue dogs in 2008 Sichuan Earthquake!
Ally向四川大地震中的搜救犬敬礼!

Read more!

a nice label cloud for Blogger

Here is the link to How to add the label cloud to your Blogger and thanks for the wonderful work
Read more!

Wednesday, May 14, 2008

Use Fiddler with Firefox

Fiddler is a awesome tool for monitoring the net traffic and it is free for download. Yeah, I knew that there is a FireBug, which also can help you monitor the net traffic. Why bother?

The FireBug console is a plug-in to the Firefox browser, and it is window based, which I guess each tab will have a different FireBug instances for monitoring the HTTP traffic. So there is no central place for monitoring HTTP traffic from all opened browser windows. If something goes wrong in the window, which is then closed, the record for the HTTP traffic before the error occurs will be missing. By letting the Fiddler monitor the HTTP traffic in your Firfox browser will avoid this issue.

Fidder works very well with IE browser and no effort will be required to let Fiddler monitors the HTTP traffic in the IE browser. For Firefox, you need to

* Open options from the Tool menu item and click Advanced tab
* Go to Network | Connection Settings
* Use the Manual proxy configuration option
* Set Http proxy to 127.0.0.1 and Port 8888



Read more!

Tuesday, May 13, 2008

Increase File Upload Limit for Moodle

The uploaded file size limit in Moodle actually is determined by Apache and PHP, and the default value is 16MB, which may not be big enough for those Flash based courses with audio and video. To increased the file size limit

First find the file httpd.conf under the directory apache\conf and make the following changes
LimitRequestBody 52428800
#OR
#LimitRequestBody 50M

Then find the php.in under the directory apache\bin and make the following changes
upload_max_filesize 52428800
post_max_size 52428800


Now restart Apache and MySQL and log into Moodle with administrator user, you should find the available file size limit for the site has been increased from
Site Administration > Courses > Add/Edit courses > select Course category & edit each course > Maximum upload size
Site Administration > Security > Site Policies > Maximum uploaded file size


Read more!

Monday, May 12, 2008

Adding Google Prettifier to Blogger

First download the Google Prettify and upload it to somewhere and in this tutorial we use http://xxx.org as an example.

Goto dashboard, and click Editing HTML under the Layout tag, add the following two lines in the <head> tag
<link href="http://xxx.org/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="http://xxx.org/prettify.js"></script>


The next thing is to find the <body> tag and change it to
<body onload='prettyPrint()'>


Ok, you are done and you can create a post testing this feature. For example, creating a post with the following code
<pre class='prettyprint'>
class Voila {
public:
// Voila
static const string VOILA = "Voila";

// will not interfere with embedded tags.
}
</pre>

and here is the result
class Voila {
public:
// Voila
static const string VOILA = "Voila";

// will not interfere with embedded tags.
}


PS: Made some improvement to the prettify style and add overflow: auto; for pre.prettyprint

pre.prettyprint { padding: 2px; border: 1px solid #888; overflow: auto;}



Read more!

Thursday, May 8, 2008

Create summaries for the blog posts

Please refer to the How can I create expandable post summaries? in the Blogger help. Here is my experience with my template.

In blogger Dashboard, click layout and select 'Edit HTML' tab. The first thing you need to do is to download the full copy of the template in case you mess up something with the template. At least, you can recover it by uploading the full copy. The template should be a xml file. Please make a copy before any further action.

Now open the xml file in your favored editor, since I am using the layout template, I have to add the following style definition into <header>
   <b:if cond="data:blog.pageType == "item"">
span.fullpost {display:inline;}
<b:else>
span.fullpost {display:none;}
</b:else>


In my template, there is a big section for <b:skin> tag in the header, so I placed the code above just after it and before the end of <head>. This actually defines the style for class fullpost of span tag. If all blogs are on the same page, any texts of class fullpost will be hidden; otherwise, they will be displayed.

The next thing is to enable the summaries ("Read More" link at the end of the blog) when your blog posts are listed on the page.
</b:skin></b:if><div class="post-body entry-content">
<p>
<data:post.body>
<!--add for blog summary-->
<b:if cond="data:blog.pageType != "item"">

<a href="data:post.url">Read more!</a>
</b:if>
<!--end-->
</data:post.body></p>
<div style="clear: both;"> <!-- clear for photos floats -->
</div>

Finally, you need to specify which part of the blog will be hidden. You can use <span> tag (<div> tag doesn't work). Please refer to the help for more information or check this post itself.

Read more!

Wednesday, May 7, 2008

Perforce HOW -- remove a changelist

Here is the command for removing the changelist if you don't have the P4 window client

p4 [-c clientName] change -d changelist_number

Read more!

Perforce HOW -- revert a file to old revision

In order to do this, you need to install P4 command line tool so that you have 'p4' command available in the command window.

p4 sync file_name#old_revision_number  -- sync file to its old revision
p4 edit file_name
p4 sync file_name
p4 resolve -ay -- auto resolve the file and accept yours
p4 submit file_name --submit the file with its old revision


I haven't figure out how to do it in Perforce window client. Please drop me a comment if you happen to know how to do this.

Read more!

Tuesday, May 6, 2008

getURL and onBeforeUnload

Any getURL calls in the flash module will trigger the onBeforeUnload event in IE6. So if you have some critical logic that is attached to onBeforeUnload, you should be aware about this issue. For example, if you try to start the timer in the load event and trying to stop the timer in beforeUnload event, calling getURL in the flash module may cause unexpected behavior in IE6. This is not a case in FireFox 2. I didn't know if this is still an issue in IE7.
Read more!

Oracle Text -- FILE_DATASTORAGE

Recently, I am working on Oracle Text as an index engine for the website's file system. In general, the files and the Oracle reside on different servers, and in order to let Oracle index files, Oracle needs to get access to those files through either URL without authentication or file system. Since access to our website needs authentication, we have to mount the file system to the Oracle server, so that it looks like all files are on the same server with Oracle, and Oracle can use FILE_DATASTORAGE to access those files.

There is a default FILE_DATASTORAGE preference by Oracle Text, but you have to specify the full path in the text table for the files that you want Oracle Text to index. However, you can create your own FILE_DATASTORAGE and set the path attribute for the preference and only specify the file name in the text table.

BEGIN
CTX_DDL.CREATE_PREFERENCE('my_datastorage', 'FILE_DATASTROAGE');
CTX_DDL.SET_ATTRIBUTE('my_datastorage','path', '/home/doc');
END


it is not allowed to give a partial path in the text table if you specify the path attribute for the FILE_DATASTORAGE preference. The location in the text table is either just file name or a full path for the file. If it is just file name, Oracle Text should looks up all paths in the path attribute of the preference and search for files with the specified name. So it may not be a good idea to use this if there are files with same names. If path is specified, it might be ignored if path is set for the preference. It will be helpful if Oracle Text doesn't accept partial path in the text table.

Here is the scenario that partial path might be helping. It is probably that the whole file set may be placed at different locations. If Oracle Text supports partial path in the text table, it is possible for Oracle to index two file sets with one table (and index) by creating another FILE_DATASTORAGE preference (this should be working if your file set is just plain files under the root directory).
BEGIN
CTX_DDL.CREATE_PREFERENCE('my_datastorage1', 'FILE_DATASTROAGE');
CTX_DDL.SET_ATTRIBUTE('my_datastorage','path', '/home/doc_copy');
END


and the text table specify the relative path for files under /home/doc_copy or /home/doc, so they can share the same text table and index, but just change the meta data for the index every time when you try to synchronize the index.

Note: This is just my thought and haven't try to test this and measure its performance if you change the FILE_DATASTORAGE every time you try to synchronize the index.

Read more!