備份AD通訊錄

備份Active Directory上所有 user 的分機與 e-mail…
把下面的 code 存成 export.vbs以後,點擊兩下就可以執行了。

'Global variables
Dim oContainer
Dim OutPutFile
Dim FileSystem
'Initialize global variables
Set FileSystem = WScript.CreateObject("Scripting.FileSystemObject")
Set OutPutFile = FileSystem.CreateTextFile("msi.csv", True)
Set oContainer=GetObject("LDAP://DC=test,DC=com")
'Enumerate Container
EnumerateUsers oContainer
'Clean up
OutPutFile.Close
Set FileSystem = Nothing
Set oContainer = Nothing
WScript.Echo "Finished"
WScript.Quit(0)
Sub EnumerateUsers(oCont)
On Error resume next
Dim oUser
For Each oUser In oCont
Select Case LCase(oUser.Class)
Case "user"
'If Not IsEmpty(oUser.distinguishedName) Then
'	OutPutFile.WriteLine "dn: " & oUser.distinguishedName
'End If
If Not IsEmpty(oUser.name) Then
OutPutFile.Write oUser.Get("name")
End If
OutPutFile.Write ","
If Not IsEmpty(oUser.FullName) Then
OutPutFile.Write oUser.FullName
End If
OutPutFile.Write ","
' EmailAddress
If Not IsEmpty(oUser.EmailAddress) Then
OutPutFile.Write oUser.EmailAddress
End If
OutPutFile.Write ","
If Not IsEmpty(oUser.TelephoneNumber) Then
OutputFile.Write oUser.Get("TelephoneNumber")
End If
OutPutFile.WriteLine
Case "organizationalunit" , "container"
EnumerateUsers oUser
End Select
Next
End Sub

參考資料:

關於遲到這檔子事情

有鑑於早上遲到狀況頻仍,老闆寫信勸告RD同仁。
還好我平常都差不多08:30~09:00就到公司了,所以對我沒啥影響。但對其他比較認真的同仁來說,會減低加班意願,每個都會這麼想,”何必呢?搞那麼晚,連晚點到的福利都沒有”。
會貼這上來的原因,是因為我覺得老闆寫的不錯,共賞之。

Subject: first time request all RD clleague and hope it is last time request manage yourself
Hi, all RD colleague:
From HR collect many months and report in company management meeting information, that total company employee in Taiwan, we have more than 3% colleague later come to office until 9:30~11:30, and have more and more colleague join this 3% group and become a normal case even fresh employee, it is far away than our normal working time 8:30, as it is already have flexible 30 minutes for all colleague due to consider traffics issue, but unfortunately still have so many people violate this rule, it already impact our company total competition in the team work spirit strength, it is can’t allowable in this trend, as M RD working style is request for self responsibility and management by yourself, but it is not mean you can do anything and don’t keep any rule, the basic discipline is still need be kept as IT industry is highly competition and team work, and as this rule is request all manager so many times, but seems no good result, “物必自腐而後虫腐之,人必自恥而後人辱之”, as your manager 不好意思要求你,hope you can 約束自己and don’t let your manager be claim by me as this request, and hope you don’t become first employee be claimed from me. As I hope and insist still keep don’t 打卡上班 and 自我約束的傳統 rule in M, it needs your good self manage, I will ask HR consistence to monitor this rule, except your did job very smoothly, and can achieve the target that time to marketing performance request, you can break this rule and on time come or even early leave office, I will invite you and your manager come to my office in PM8:00 or later to tea time and understand your job loading and performance if you are the lucking man, hope you don’t become the luck man and see me along for this issue, of course, I am welcome you visit my office except this issue.
Boss

新成員加入!

2006/10/21 住院,進行催生。
歷經長達約17~18個小時的催生之後,子宮頸仍然只開三指,繼續催生,也許可以成功,但也有可能失敗,最後決定聽醫生的建議進行剖腹。
2006/10/22 早上進行剖腹手術,母子均安。
相簿在此:2006/10/23 My baby

雜記after勝券在握

  • 如何認定企業價值?資料可以到哪裡取得?
  • 如何判斷股票市場高估企業價值?
  • 瞭解企業
    • 主要商業活動
      • 如何評估自己夠瞭解
    • 下屬公司
    • 持有哪些公司的股份,有哪些資產(也就是公司如何投資其他產業)
    • CEO的個人特質、經歷、決策方向、處事態度、作風
    • 負債是否逐年減少?
    • 經營管理者如何分配盈餘(以每年來看)

潤絲精的惷事

小時候老覺得用潤絲精是一種浪費的行為,因為洗了油油的,最後還不是要用洗髮精再洗一次,豈不是脫褲子放屁。是故,後來就都不使用潤絲精了,純粹使用洗髮精,當兵的時候甚至使用香皂。
最近因為換了某不知名牌子的洗髮精,發現洗了之後還真是澀,於是就幫著老婆一起把潤絲精用完,也因此開始能瞭解潤絲精的功效在哪裡了。

只能等待

老婆接近預產期了,總是會不經意想著,寶寶什麼時候會呱呱落地呢?
誰也無法預測,只能等待。
前兩天看到這句話:

等待並不痛苦,因為沒有別的事情值得等待。

很能描寫我目前的狀況。

雞尾酒排序

早上翻譯了這篇:雞尾酒排序,翻譯的不是很好~以後再求改進吧。
順手再寫了 c# 的版本。
public static void cocktailSort( int[] theList )
{
    int bottom = 0;
    int top = theList.Length-1;
    bool swapped = true;
    
    while( swapped == true )
    {
        swapped = false;
        for( int i=bottom; i<top; i++ )
        {
            if( theList[i] > theList[i+1] )
            {
                int tmp = theList[i+1];
                theList[i+1]=theList[i];
                theList[i]=tmp;
                swapped = true;
            }
        }
            
        top = top-1;
        for( int i=top; i>bottom; i– )
        {
            if( theList[i]<theList[i-1] )
            {
                int tmp = theList[i-1];
                theList[i-1]=theList[i];
                theList[i]=tmp;
                swapped = true;
            }
        }
            
        bottom = bottom+1;
    }
}

FireFox 2.0 RC1

把公司的 FireFox 改用 2.0RC1,Extension 詳列如下:

  • 2.0 仍可使用者:
    • DOM Inspector
    • Talkback
    • Adblock Filterset.G Updater
    • CustomizeGoogle
    • IE Tab
    • Image Zoom
    • PDF Download
    • Web Developer
    • FlashGot
    • 新同文堂
    • Download Statusbar
    • Adblock Plus
    • ColorZilla
    • Google Toolbar for Firefox
    • Google Browser Sync
  • 不相容 2.x:
    • del.icio.us
    • Fasterfox
    • Hypertext DOM Browser
    • Furl Tools
    • Copy URL +
    • Greasemonkey
    • CSSViewer
    • Screen grab!
    • gmif
    • Tabbrowser Preferences

目前一切順利,不過少了一些如 del.icio.us、furl.net、Copy URL+等等的方便工具,還真是麻煩~

VFP 與 Regular Expression

VFP 本身並不支援 Regular Expression,幸好,有人非常熱心,以 C/C++ 有名的 Boost library 為基礎,製作了給 VFP 用的 Regular Expression Library。
License 基本上是遵循 boost library 的 LGPL license,所以你可以直接使用 binary code (也就是 .fll)在商業用途上。
為甚麼要 Regular Expression?因為他可以很方便地以簡單的語法表示出一段文字的規則。
文章裡面的範例來看,你會發現他真的好用~

*!* 驗證 email 信箱格式
lcExpression = “^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$”
?RegExp(“john@isp.com”,lcExpression)
?RegExp(“john@.isp.com”,lcExpression)
*!* 驗證金額
lcExpression = “^(\$)?(([1-9]\d{0,2}(\,\d{3})*)|([1-9]\d*)|(0))(\.\d{2})?$”
?RegExp(“$1,244,311.81”,lcExpression) && Match
?RegExp(“$1,24,4311.81”,lcExpression) && No Match
*!* 驗證電話號碼
lcExpression = “^[2-9]\d{2}-\d{3}-\d{4}$”
?RegExp(“507-562-0020”,lcExpression) && Match
?RegExp(“507-56-0020”,lcExpression) && No Match

基本規則說明可以直接參考洪朝貴先生發佈的文章
參考資料: