Java :: final

在 Java 語言中, final 關鍵字可以用來修飾變數, 方法和類別. 一個簡單的理解是: >加上 final 就說明了這玩意兒永遠不會被改變! 1) final variable 一般變數 定義時即須賦 »

The 1.01 & 0.99 Rule

$1.01^{365} = 37.8$ $0.99^{365} = 0.03$

這是有名的 1.01 & 0.99 法則. 但原始版本裡的每天 1% 我總覺得太多了, 每天了不起進步個千分之一. 所以稍作修改, 但道理不變.

$1.001^{365} = 1.44$ $0.999^{365} = 0.69$

積跬步能致千里, 積怠惰終墜深淵.

»

ORA-28001: the password has expired

That is such a trivial task for an Oracle DBA to periodically change an application user’s password. Consider a situation that we forgot to set up an no-expire user profile for an application user, and it was just expired, how can we change the user’s password to be unchanged as well as set its profile to no-expire? We can have a look on this qeury to check all expired users. SELECT username, account_status, expiry_date FROM dba_users; And then set the profile of our user to be password no-expire, in this case we just edit the default user profile, but should be careful. »

ImageMagick and the GRUB splash image

Sometimes we have to make our own image for GRUB splash background. But there are some restrictions on that image for GRUB bootloader to accept and display it. By ImageMagick, we have an easy way to convert any image to satisfy that: convert oldsplash.jpg -resample 72 -sampling-factor 2x2 -resize 640x480\! newsplash.jpg Hint: The \! means FORCE, so it maybe breaks original ratio. »

Convert text to upper/lower case using sed

最近需要寫一段程式去解析並編輯 /etc/hosts 這個檔案, 由於 hostname 是不區分大小寫的, 所以在操作前先統一轉換成大寫會較方便. 試了幾種不同的寫法, 發現還是 sed 幹起來 »