2016年12月30日 星期五

VMware vCenter 6.0 + Replication 6.1 install


Reference:

安裝 vCenter 6.0 步驟
  1. 在 DNS server 設定 vcenter 的 IP, hostname 對應 (Ex: vcenter60)
  2. 用 Daemon Tool Lite 掛載 VMware-VCSA-all-6.0.0.iso 為光碟
  3. 安裝光碟中的 vcsa\VMware-ClientIntegrationPlugin-6.0.0.exe
  4. 用 Chrome 開啟光碟中的 vcsa-setup.html,選擇 Install
  5. 安裝完成後用 administrator@vsphere.local 登入 VMware vSphere Client 或 web client https://vcenter60
安裝 Replication 6.1
  1. 用 Daemon Tool Lite 掛載 VMware-vSphere_Replication-6.1.0.iso 為光碟
  2. 登入 VMware vSphere Client 或 web client https://vcenter60
  3. Deploy OVF Template 時選擇光碟的 bin\vSphere_Replication_OVF10.ovf
  4. 安裝完成後,登入 https://IP_address_of_appliance:5480
  5. 用 VMware vSphere Client 設定 Datacenter 的 IP pool。如果沒有設定,啟動 vSphere Replication Appliance 會有錯誤訊息 Cannot initialize property 'vami.netmask0.vSphere_Replication_Appliance'. Network 'port group' has no associated network protocol profile.
  6. 到 Configuration 裡面按 Save and Restart Service。如果有錯誤訊息 Error applying startup configuration: Server returned 'request expired' less than 0 seconds after request was issued, but it shouldn't have expired for at least 600 seconds.,請將 ESXi host, vCenter 6.0, Replication 6.1 的時間設定為一致。
  7. 完成後到 vCenter web client 就可以看到 vSphere Replication

如果啟動 vSphere Replication Appliance 有錯誤訊息 

2016年12月22日 星期四

VMware ESXi 5.1 to 5.5

本來想要把 5.1 直接升到 6.0,但是升級 vcenter 時卡住,只好先到 5.5。

步驟:

2016年12月17日 星期六

寶二水庫路跑

第一次參加路跑。引擎是個偉大的發明~~~


難得有一張陽光型的照片,感謝網友 汪汪 幫忙拍照記錄。(照片來源)

2016年12月13日 星期二

Redmine 沒有 New Issue

Reference:
'New Issue' tab not shown? [Solved]

檢查 Administration / Tracker / Bug (或其他Tracker)
裡面的 Projects 是否有打勾。

2016年11月19日 星期六

2016/11/19 跑步 (第一個 10K)

這是第一次跑 10K。跑三分之一左右覺得右膝蓋有點酸,到二分之一左右就不酸了。跑完回家後反而是左膝蓋很酸。

上星期跑 6.6K 第一根和第二根腳趾中間磨到起小水泡,所以特別準備五指襪把他們隔開。
穿起來不太習慣但有效,這次沒有起水泡。




2016年11月14日 星期一

Redmine modify document preview

Redmine 文件預覽時只會顯示文件的前 250 字。
在網頁上找不到可以修改的地方,只好直接改原始碼。

修改方法:
1. 開啟 C:\redmine-3.1.1\app\helpers\application_helper.rb,尋找 length = options[:length] || 250,將 250 改為想要的數字。
2. restart Redmine 才會生效。

修改前:

修改後:

2016年11月12日 星期六

2016年11月7日 星期一

Get a Free SSL Certificates for Windows IIS

Reference:
使用 SSL For Free 產生 Let’s Encrypt SSL 憑證上傳給 IIS 站台使用

1. 到 https://www.sslforfree.com/ 申請 Free SSL Certificates
2. 選用 Manual Verification,下載認證檔,放到 C:\well-known\acme-challenge
3. 在 IIS 建立虛擬目錄 .well-known,指向 C:\well-known
4. 新增 MIME type . text/plain
5. 驗證後下載 SSL 憑證,並建立過期前通知信箱
6. 安裝 Open SSL for Windows
7. 將憑證轉為 pfx 格式
    cd "C:\Program Files (x86)\GnuWin32\bin"
    openssl pkcs12 -export -out C:\tmp\sslforfree\certificate.pfx -inkey C:\tmp\sslforfree\private.key -in C:\tmp\sslforfree\certificate.crt -certfile  C:\tmp\sslforfree\ca_bundle.crt
8. 在 IIS 管理員匯入 pfx 憑證,並在 Binding 將憑證修改為匯入的這一個

2020/05/21 update:
另一個方法:
Let’s Encrypt 使用 ACME 協定,對於 Windows 有提供相對應的版本可用。
Win32/Win64 Portable ZeroSSL client for Let's Encrypt
操作說明

Ex:
cd c:\tmp
le64.exe --key account.key --csr domain.csr --csr-key domain.key --crt domain.crt --domains "www.domain.com" --generate-missing --unlink --path C:\well-known\acme-challenge --export-pfx "mypasswd" --tag-pfx "mydomain" --live

注意:
IIS bind 憑證時必須要能夠連上 Internet,否則憑證 binding 會有問題。

安裝憑證之後,用Chrome, Firefox開自己網頁,如果顯示 "不安全",
必須更改為 TLS 1.2。
作法參考 在Windows Server 2008 R2 IIS服務中,啟用TLS 1.2傳輸協定

2022/1/13 update: 
Zerossl.com只提供三個免費憑證可以申請。
改用 Let’s Encrypt 使用 ACME 對應的程式申請免費憑證。
搭配 nginx 選用 kshcherban / acme-nginx 這個工具。
因為驗證時會暫時用到http,所以需要把 linux 的 http service 關閉,
如果使用 firewalld 需要 allow http,再確認 Internet firewall policy 已經開好。
執行 acme-nginx -d www.domain.com 取得憑證。
如果遇到問題可用 acme-nginx -d www.domain.com --debug
完成後憑證放在 /etc/ssl/private/letsencrypt-domain.pem

2016年10月26日 星期三

Excel VBA 下拉清單

Reference:
https://msdn.microsoft.com/zh-tw/library/office/ff835840.aspx
http://forum.twbts.com/thread-3516-1-1.html


1. 選擇 開發人員
2. 插入 下拉清單
3. 點選 下拉清單
4. 輸入 下拉清單名稱,按 Enter 確定
5. 按 Alt + F11 開啟 VBA 編輯畫面
6. 輸入 VBA 程式

Sub tt()
    Sheet1.Shapes("mon_1").ControlFormat.RemoveAllItems     '清除所有下拉選項
    Sheet1.Shapes("mon_1").ControlFormat.AddItem ("111")    '新增一筆下拉選項
    Sheet1.Shapes("mon_1").ControlFormat.AddItem ("aaa")    '新增一筆下拉選項
    Sheet1.Shapes("mon_1").ControlFormat.AddItem ("xxx")    '新增一筆下拉選項
    Sheet1.Shapes("mon_1").ControlFormat.Value = 2          '將下拉選單設定預設值為第二筆
    MsgBox (Sheet1.Shapes("mon_1").ControlFormat.List(2))   '顯示第二筆選單的值
End Sub

2016年10月14日 星期五

VBA to get web asp result

Reference:
Excel VBA 2a:Learning MSXML2.XMLHTTP
Scraping a website's HTML in VBA
XmlHttp Post in Excel VBA not updating website form

Example:
use VBA to download 台灣期貨交易所的台股期貨
http://www.taifex.com.tw/chinese/3/3_1_2.asp

VBA code:
Sub get_taifex()
    Dim pXmlHttp As Object
    Set pXmlHttp = CreateObject("MSXML2.XMLHTTP")
    pXmlHttp.Open "POST", "http://www.taifex.com.tw/chinese/3/3_1_2dl.asp", False
    pXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
    pXmlHttp.send ("goday=&DATA_DATE=&DATA_DATE1=&DATA_DATE_Y=&DATA_DATE_M=&DATA_DATE_D=&DATA_DATE_Y1=&DATA_DATE_M1=&DATA_DATE_D1=&syear=&smonth=&sday=&syear1=&smonth1=&sday1=&datestart=2016%2F09%2F14&dateend=2016%2F10%2F14&COMMODITY_ID=TX&commodity_id2t=&his_year=2015")
   
    MsgBox pXmlHttp.ResponseText
End Sub

用 Wireshark 收集到的網頁傳輸參數

2016年9月29日 星期四

Excel Chart with VBA

Reference: 

用 VBA 為新增圖表
    Sheet1.Select
    ActiveSheet.Shapes.AddChart.Select    '新增圖表
    ActiveChart.ChartType = xlLine            '折線圖
    With ActiveChart.Parent
        .Name = "3260.TW"                           '命名
        .Height = Range("A2:F12").Height    '高
        .Width = Range("A2:F12").Width      '寬
        .Top = Range("A2").Top                     '位置
        .Left = Range("A2").Left                    '位置
    End With

也可以用pixel數
     With ActiveChart.Parent
         .Height = 325 ' resize
         .Width = 500  ' resize
         .Top = 100    ' reposition
         .Left = 100   ' reposition
     End With

2016年9月23日 星期五

Linux top process io

找出哪個 process 占用 I/O。

方法一:
1. 安裝 epel。到 RPMfind 找對應的安裝檔,裝到 linux 上。
https://www.rpmfind.net/linux/rpm2html/search.php?query=epel&submit=Search+...&system=&arch=
2. yum install python python-ctypes iotop

方法二:
安裝 python-ctypes, iotop。到 RPMfind 找對應的安裝檔,裝到 linux 上。
https://www.rpmfind.net/linux/rpm2html/search.php?query=python-ctypes&submit=Search+...&system=&arch=
https://www.rpmfind.net/linux/rpm2html/search.php?query=iotop&submit=Search+...

CentOS 5.9 實測:
安裝 python-ctypes-1.0.2-3.el5.x86_64.rpm, iotop-0.4.3-4.el5.noarch.rpm 後,執行 iotop 可以列出 process I/O 排序。

CentOS 4.8 實測:
沒有適合的 iotop RPM 可以安裝。

Reference:
iotop on RHEL 5.7 (CENTOS too)

Linux top process io

找出哪個 process 占用 I/O。

方法一:
1. 安裝 epel。到 RPMfind 找對應的安裝檔,裝到 linux 上。
https://www.rpmfind.net/linux/rpm2html/search.php?query=epel&submit=Search+...&system=&arch=
2. yum install python python-ctypes iotop

方法二:
安裝 python-ctypes, iotop。到 RPMfind 找對應的安裝檔,裝到 linux 上。
https://www.rpmfind.net/linux/rpm2html/search.php?query=python-ctypes&submit=Search+...&system=&arch=
https://www.rpmfind.net/linux/rpm2html/search.php?query=iotop&submit=Search+...

CentOS 5.9 實測:
安裝 python-ctypes-1.0.2-3.el5.x86_64.rpm, iotop-0.4.3-4.el5.noarch.rpm 後,執行 iotop 可以列出 process I/O 排序。

CentOS 4.8 實測:
沒有適合的 iotop RPM 可以安裝。
不用iotop的方法是去讀/proc/<PID>/io
CentOS 4.8的/proc/<PID>/io沒有rchar, wchar,看起來是沒有記錄process io。

Reference:
iotop on RHEL 5.7 (CENTOS too)
Know which process does I/O without iotop

2016年9月22日 星期四

CentOS DHCP problem on VMware Workstation 12

狀況:
在 VMware Workstation 12 安裝了虛擬的 CentOS,無法自動取得 IP address。

解法:
在 Virtual Network Editor 按 Restore Default。

Reference:
Networking is broken in my VMware 10.0 VMs after upgrading to Windows 8.1

2016年9月14日 星期三

Excel VBA 更改文字方塊內容

如果不用 VBA,參考這一篇可以做到 文字方塊 和 特定儲存格 同步。
Excel-讓圖表的標題自動更新

設定 文字方塊 的名稱,提供 VBA 使用。
How to change textbox name in Excel 2007 and 2010 in a chart tab?

用 VBA 設定文字方塊 的內容。
Working with textboxes (vba)

設定文字方塊 Example:
Sheet1.Shapes("文字方塊 1").TextFrame.Characters.Text = "aaaa"

設定圖表中的文字方塊 Example:
Sheet1.ChartObjects("圖表 2").Chart.Shapes("文字方塊 1").TextFrame.Characters.Text = "bbb"

2016年9月9日 星期五

IIS7 iis 7 disable server header

Reference:
Remove Unwanted HTTP Response Headers
Remove IIS Server version HTTP response header

1. install URLRewrite
http://www.iis.net/downloads/microsoft/url-rewrite
2. open URLRewrite
 3. View Server Variables
 4. Add "RESPONSE_SERVER"
 5. Add Outbound Rule


IIS7 disable Method OPTIONs

Reference:
[IIS]OPTIONS method is enabled

1. in server manager. Add Role "Request Filtering"
2. IIS manager / Request Filtering / HTTP Verbs. Add Deny Verb: OPTIONS.

2016年7月27日 星期三

OneNote 2016 無法登入

安裝 OneNote 2016 後一直無法登入。
輸入 Microsoft Account 後出現 "很抱歉,伺服器發生問題,因此目前無法新增 Office 365 SharePoint。請稍候再試一次。"

亂試好多方法,最後終於登入了。
最後一次是先按一次 OneNote 登入不進去,讓登入的畫面留著,在工作列的 OneNote 2016 圖示上按滑鼠右鍵,選 OneNote 2016 並輸入 Microsoft Account / Password 就成功了。

不確定這是不是解法,或是剛好 Microsoft 的伺服器修好了。

2016年7月26日 星期二

2016年7月15日 星期五

CentOS locale path different on 4.x and 5.x

有個軟體在 CentOS 4.x 執行正常,但是在 CentOS 5.x 會有錯誤訊息:
locale not supported by xlib locale set to c
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate:            ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfBeginLine
Warning: ... found while parsing ':<Key>osfBeginLine:           ManagerGadgetTraverseHome()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfHelp
Warning: ... found while parsing ':<Key>osfHelp:                        ManagerGadgetHelp()'
Warning: String to TranslationTable conversion encountered errors
Warning: translation table syntax error: Unknown keysym name:  osfActivate
Warning: ... found while parsing ':<Key>osfActivate:    ManagerParentActivate()'
Warning: String to TranslationTable conversion encountered errors

Workaround:
1. 在 CentOS 5.x 建立目錄 /usr/X11R6/lib
2. 在目錄內建立 link,指令 ln -s /usr/share/X11 X11

Reference:
http://parallelgeo.com/download/spw2linux/currentrelease/ReadMe_for_recent_Linux_distributions.txt

2016年6月2日 星期四

Polycom Soundstation Flash 頻率調整

Reference:
SoundStation 多方通話 Flash Time

SoundStaion與您的交換機flash時間不吻合,請照以下方式調整:
SoundStation 系列(Normal)操作步驟:

※ 實施步驟前先將電源拔除
A. 按住 MUTE 鍵不放, 插上電源
B. 聽到 Bong 音後, 放開 MUTE 鍵
C. 按 # 字鍵放開後按 * 字鍵, 此時面板上的 LED 指示燈全亮(紅色)
D. 輸入 3位數字, 如下
242 → 100 m sec.
142 → 300 m sec.
000 → 600 m sec.
輸入完畢後, 面板指示燈全滅, 電源關閉, 重新啟動後即完成

...................................................................................................................................
SoundStation 2 No-LCD操作步驟:
※ 實施步驟前先將電源拔除
A. 按住 MUTE 鍵不放, 插上電源
B. 聽到 Bong 音後, 放開 MUTE 鍵
C. 按 # 字鍵放開後按 * 字鍵, 此時面板上的 LED 指示燈全亮(紅色)
D. 輸入 5位數字, 如下
600 m sec.→ 00000 、04520、04022、04002、00020、04020
300 m sec.→ 14020、14022
100 m sec.→ 26022、26020、24022、24020
(依不同交換機適用不同編碼)
輸入完畢後, 面板指示燈全滅, 電源關閉, 重新啟動後即完成
...................................................................................................................................
.Premier 操作步驟:

※ 實施步驟前先將電源拔除
A. 按住 MUTE 鍵不放, 插上電源
B. 聽到 Bong 音後, 放開 MUTE 鍵
C. 同時按住 # 字鍵及 * 字鍵, 此時 LCD面板內顯示 "COUNTRY CODE"
D. 輸入 4位數字, 如下
0200 → 100 m sec.
7546 → 300 m sec.
7442 → 600 m sec.
輸入完畢後, 聽到 嗶 一長聲, 電源關閉, 重新啟動後即完成

2016年5月20日 星期五

VMware ESXi 5.x host experiences a purple diagnostic screen mentioning E1000PollRxRing and E1000DevRx

狀況:
安裝 Skype server 2015,user logon 時造成整台機器出現紫色畫面當機。

原因:
VMware ESXi 5.x 的虛擬網路卡 E1000E 有 bug。

解法:
安裝 VMware 更新檔
VMware ESXi 5.x host experiences a purple diagnostic screen mentioning E1000PollRxRing and E1000DevRx

因為安裝更新檔必須整台機器重開機,如果暫時不方便重開機,可以改用虛擬網路卡 VMXNET3。



2016年5月18日 星期三

從 Windows 2008 R2 查看 Windows 7 的裝置管理員

Reference:
Using Device Manager Remotely

狀況:
從 Windows 2008 R2 管理 Windows 7 時,開啟 Windows 7 的裝置管理員出現錯誤訊息。
Unable to access the computer PC01
Make sure that this computer is on the network, has remote administration enabled, and is running the "Plug and Play" and "Remote registry" services.
The error was: Access is denied.

解法:
修改 AD (Windows 2008 R2)  的 Group Policy。
將 Computer Configuration \ Policies \ Administrative Templates \ System \ Device Installation \ "Allow remote access to the Plug and Play interface 設為啟用。

2016年5月12日 星期四

Install Skype Server 2015

硬體、軟體需求:
商務用 Skype Server 2015 的伺服器需求

如果安裝 Standard version,只需要一台 server,資料庫會用 SQL Express。
如果安裝 Enterprise version,需要兩台以上 server,資料庫不能和 Front End server 裝在一起。

按照這個步驟安裝即可:
Skype for Business Server 2015企業版部署體驗(上)
Skype for Business Server 2015企業版部署體驗(中)
Skype for Business Server 2015企業版部署體驗(下)

2016年5月3日 星期二

Installing Windows fails with error 0x80300024

狀況:
新買的 Notebook 有 128G SSD 和 500G HD。
Windows 7 預裝在 SSD上,希望將 Windows 8.1, 10 另外安裝到 HD。
安裝 Windows 8.1 時,選擇 HD 發生錯誤 0x80300024。

解法:
1. 拆掉 SSD,只留 HD。
2. 將 Windows 8.1, 10 安裝到 HD。
3. 裝回 SSD。用 SSD 開機到 Windows 7。
    (看到Windows 8.1, 10 安裝在 D:\Windows, E:\Windows)
4. 用 "系統管理員權限" 開啟 命令提式字元
5. 用 bcdboot D:\Winodws 把 Windows 8.1 加入 boot menu
6. 用 bcdboot E:\Winodws 把 Windows 10 加入 boot menu


Reference:
Solved: Installing Windows 8.1 fails with error 0x80300024
How to Add New OS in Windows 7 BCD Boot Menu – Dual Boot Windows 7 and Windows Server 2012

2016年4月24日 星期日

2016/4/22 加里山 (2220M)

學弟找我一起去爬山,既然學弟都提出來了,我當然是捨命陪君子啦。
(真的感覺差點掛在山上.......)

第一次爬高山就來這麼硬的。一開始上山的時候感覺右小腿很酸,到下山時變成右大腿很酸,所以下山時我只能右腳先下、左腳再跟上,因為右腳幾乎撐不住啦。

學弟果然是有練過的,我累得快掛了他還有餘裕幫我拍照,太強了!

感想:
過程超級累,心裡想我幹嘛自找罪受,下山後有 "劫後餘生" 的感覺 (我出運啦~~~~)

手機的紀錄:

2016年4月21日 星期四

2016年4月11日 星期一

(還願文) 王建民重登大聯盟

其實我並不是個棒球迷,多年前王建民開始上大聯盟,19 勝的時候我才注意到他。
從那時我才開始關心他的戰況,但後來他經常被打爆...

雖然如此我還是在心中默默幫他加油,我在心中許了個願,如果他重登大聯盟我就貼我的 "排骨照"。終於看到王建民重登大聯盟,實在太厲害了!於是我來還願了~~~


2016年4月8日 星期五

excel vba sql server select query

Reference:
Query MS SQL Server With Excel VBA

' Before we can start you’ll need to add a reference to your VBA project:
' Microsoft ActiveX Data Objects x.x Library

Option Explicit
Private Conn As ADODB.Connection

Function ConnectToDB(Server As String, Database As String) As Boolean

    Set Conn = New ADODB.Connection
    On Error Resume Next
   
    Conn.ConnectionString = "Provider=SQLOLEDB.1; Integrated Security=SSPI; Server=" & Server & "; Database=" & Database & ";"
    Conn.Open
   
    If Conn.State = 0 Then
        ConnectToDB = False
    Else
        ConnectToDB = True
    End If

End Function

Function Query(SQL As String)

    Dim recordSet As ADODB.recordSet
    Dim Field As ADODB.Field

    Dim Col As Long

    Set recordSet = New ADODB.recordSet
    recordSet.Open SQL, Conn, adOpenStatic, adLockReadOnly, adCmdText

    If recordSet.State Then
        Col = 1
        For Each Field In recordSet.Fields
            Cells(1, Col) = Field.Name
            Col = Col + 1
        Next Field

        Cells(2, 1).CopyFromRecordset recordSet
        Set recordSet = Nothing
    End If
End Function

Public Sub Run()

    Dim SQL As String
    Dim Connected As Boolean

    SQL = "SELECT * FROM QUOTA_Quota"

    Connected = ConnectToDB("SQL_SERVER", "DB_Name")

    If Connected Then
        Call Query(SQL)
       
        Conn.Close
    Else
        MsgBox "Huston we have a problem!"
    End If

End Sub

2016年4月7日 星期四

VBA 消除字串全部的空白

Reference:
HOWTO:使用 Split 函式將區隔的字串放入字串陣列中

Function remove_space(str_in As String) As String
    Dim tmp_array() As String
    rst_str = ""
    tmp_array() = Split(str_in)
    For i = LBound(tmp_array) To UBound(tmp_array)
        rst_str = rst_str & tmp_array(i)
    Next
    remove_space = rst_str
End Function

2016年4月3日 星期日

養樂多鬆餅

參考這一篇 養樂多蛋糕 做的。

材料:
麵粉 100g、雞蛋 2 顆、糖10g、養樂多 1 瓶

懶人做法:
通通丟進果汁機去打,然後用平底鍋煎。我的技術不好做出來不好看,但吃起來還不錯。


做完後才想到,可以更懶一點,不用平底鍋煎,倒進電子鍋一鍵搞定應該也可以。

電子鍋一鍵搞定版。

據說蛋黃、蛋白分開打會更鬆軟。我是沒那麼挑嘴,能吃就好 ^__^


2016年3月14日 星期一

鼎新 憑證(報表) 底圖 修改

以 ACPI02 應付憑單為例。

1. 開啟要修改的憑證 (ACPR01)

2. 如果要新增 列印使用格式

  • 開啟 C:\Conductor\ConductorC.INI,查看 RTBuilderDataPath 的目錄
  • 到 RTBuilderDataPath 目錄裡尋找 TfrmAcpr01Fmt_1_A.dat,複製一份為 TfrmAcpr01Fmt_1_B.dat
3. 底圖可匯入的格式為 .emf, ,bmp
  • Word 檔可以用 C:\Conductor\C_dsbin\Doc2Emf.exe 將 .doc 轉為 .emf
  • 其他檔案的話,先用 PDFCreator 列印成 .pdf 檔,再用 PDF-XChange 開啟 pdf 並匯出為 .bmp 檔。用小畫家修改 .bmp 寬度高度,讓底圖符合憑證需求。

2016年2月24日 星期三

Perl 取出 HTML 檔案的 table 內容

Reference:
HTML::TableExtract is beautiful

HTML::TableExtract 可以把 HTML 檔案理的 table 內容取出,非常方便。

Example:
#!/usr/bin/env perl

use strict; use warnings;
use HTML::TableExtract;

my $te = HTML::TableExtract->new(
    attribs => { id => 'tbl' },
);

# local copy of
# http://bea.gov/iTable/iTableHtml.cfm?reqid=9&step=3&isuri=1&903=58

$te->parse_file('personal-income.html');

my ($table) = $te->tables;

for my $row ($table->rows) {
    my ($undef, $label, @row) = @$row;
    next unless defined $label;
    if ($label eq 'Unemployment insurance') {
        print "$label\t@row\n";
    }
}

2016年2月14日 星期日

VMware Module DevicePowerOn power on failed Unable to create virtual SCSI device for scsi0:1

收到 mail 通知有一台在 VMware 上的 Windows server 備份失敗,用 VMware vSphere Client 檢查發現是 server 狀況是關機。

啟動這一台 VM guest 時出現錯誤訊息:
Module DevicePowerOn power on failed Unable to create virtual SCSI device for scsi0:1

用 Google 找到這一篇,但它是 import VM 發生的錯誤。

我的做法:
  1. 編輯 VM guest 設定,將第二個硬碟移除
  2. 用 SSH 連到 VM host,切換到 VM guest 的目錄,將 hbr-persistent-state-RDID-xxxxxxx.psf 移到其他目錄
  3. 編輯 VM guest 設定,將 VMDK 加回去
這樣 VM guest 就可以開機了!

回想可能的原因:
昨天設定這一台 VM host 的 Replication,可能複製到另一個 VM host 時發生錯誤,造成 VMDK 檔案狀態卡住。

2016年1月27日 星期三

Perl scheduler task problem under Windows 2012

有一支 perl script 從 Windows 2003 搬到 Windows 2012 執行有錯誤。
手動執行是正常的,但是從 scheduler task 執行卻發生錯誤。

檢查發現從 scheduler task 執行 perl script,會在檢查目錄是否存在時發生錯誤。
測試發現 scheduler task 沒有網路磁碟機的連線,因為這個目錄在網路磁碟機上,
所以會找不到目錄。

解法:
用 batch file 把 perl script 包起來,scheduler task 改為執行 batch file。
batch file 內容:
net use N: \\server\share_dir
perl C:\tmp\my_script.pl