肖恩D++
Not Equal C && !=C && 不等于西-
补胎记
Posted on January 26th, 2012 2 comments昨晚,挠人的轮胎报警灯又亮了。在经历了一次又一次狼来了之后,还是决定检查一下看看到底是因为胎压不稳还是轮胎真有问题。撅着腚趴在地上一个轮子一个轮子检查之后,狼真来了:一根直径大概半厘米的铁钉很不识相的嵌在轮胎的胎纹里。郁闷半天之后,决定第二天一早去补胎。
早就知道家附近就有一个叫“America Tires”的轮胎店,虽然从来没进过。店员都还很亲切,简直有点肉麻,让我“噗通,噗通”乱跳的小心脏又增加了几分紧张,要知道服务往往是和价钱挂钩的。
在一番检查之后,技工把车开进车间里修理。大约半个多小时后,接待我的店员递给我钥匙和一张收据,说道:“Sir, you are all set. have a nice day!”
开车赶向办公室的途中,在苦思冥想了半天总觉得“忘了什么事儿”后,终于意识到,原来这次补胎竟然不用给钱……
213 views
-
未尽的事业
Posted on January 14th, 2012 Add comments据说这十大地方会在不远的未来彻底消失——悉数一下,这十个地方去过的数字仍然是“0”。看来在人类还未曾找到有效改善自己方法的前提下,最好还是尽早踏上这十个濒危的地方。
176 views
-
Custom Validation for MVC 3 Model Example 1: Positive Integer
Posted on January 7th, 2012 2 commentsWhen you define a property of the model, you can always put some MS’s attributes to validate the data, like “Required”, “Range”. Also you can use custom validation via expression or creating new attribute class. For example, the “NumberOfStock” for “Product” must be an integer and positive.
Actually to accomplish this validation is quite easy, if use regular expression:12345678public class Product{[Required(ErrorMessage = "Number of Stock is Required")][RegularExpression("^\\d+$", ErrorMessage = "Must be a Positive Non-decimal Number")]public int NumberOfStock{ get; set; }/******** Other Properties **************/}The way showed above will be good enough if you only have a few models or a small application. For a big project, you might want to create your own attribute instead of using expression. The advantage of dong this is easy to centralize (if you have many custom validations), and easy to debug.
Read the rest of this entry »
3,067 views
-
One line to remove all unneeded old kernel for Ubuntu
Posted on December 5th, 2011 Add commentsAlong with the kernel keeps updating, many old kernels are kept in the system. For normal users, those old kernels are no longer needed, so the best way just remove them.
To remove all kernels, just run the single line with below:1dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge*Original post from here
164 views
-
火鸡和感恩节
Posted on November 23rd, 2011 Add comments在美国,一提起感恩节,就马上会和火鸡联系起来。人们纷纷去超市购买火鸡,然后与全家一起分享,颇有点合家欢乐的感觉。不过,换位思考一下,如果站在火鸡的立场上,一定是对感恩节深恶痛绝、势不两立的……
明天,有是一年一度的火鸡的冤家。可没想到,中午竟然发现一队火鸡在领队的带领下,在公司的停车场游荡。不得不为他们的勇气致敬,难道他们是在提醒我们,“嘿,感恩节到了,准备好了吗?”
166 views
Recent Comments