顯示具有 筆記 標籤的文章。 顯示所有文章
顯示具有 筆記 標籤的文章。 顯示所有文章

2013年4月15日 星期一

Android Virtual Device 無法開啟

在 Android Virtual Device Manager 選擇虛擬機按下 Start 後出現以下錯誤,無法開啟虛擬機

Starting emulator for AVD 'AVDNAME'
PANIC: Could not open: AVDNAME

原因是因為 Android SDK 放置安裝在 C 碟以外的地方 以我來說,放在 D 碟就出現這樣的錯誤,這時候查看 D 碟目錄下,會發現有一個 .android,代表 SDK 是放在 D 碟以下路徑沒錯,只要在系統環境變數加入一個變數名稱 ANDROID_SDK_HOME,變數值 D:\ 即可。如下圖所示。

 

2013年4月12日 星期五

Telnet C# - 簡單好用的 C# Telnet lib

Telnet C# 是一款 C# 語言上用來模擬執行 Telnet 的 Open Source Library,可以設定對指定的 IP、Port連線,並可在成功連線後,等待指定的訊息出現以及送出相對應的訊息,可以說是一款相當簡單好用的 Lib。程式最後一次更新的日期是 2011 年 7 月,算是不會太舊的 Lib,目前使用上沒有什麼問題。

Lib 放置於 CodePlex 網站上,官方網站 Telnet C#


使用範例如下 (節錄自 Telnet C# > Documentation > Example)

Terminal tn = new Terminal("giga", 23, 10, 80, 40); // hostname, port, timeout [s], width, height

tn.Connect(); // physical connection
do 
{
    f = tn.WaitForString("Login");
    if (f==null) 
        break; // this little clumsy line is better to watch in the debugger
    Console.WriteLine(tn.VirtualScreen.Hardcopy().TrimEnd());
    tn.SendResponse("telnet", true); // send username
    f = tn.WaitForString("Password");
    if (f==null) 
        break;
    Console.WriteLine(tn.VirtualScreen.Hardcopy().TrimEnd());
    tn.SendResponse("telnet", true); // send password 
    f = tn.WaitForString(">");
        break;
    tn.SendResponse("df", true); // send Shell command
    if (tn.WaitForChangedScreen())
        Console.WriteLine(tn.VirtualScreen.Hardcopy().TrimEnd());
} while (false);
tn.Close(); // physically close on TcpClient

使用 Terminal 建構子參數來設定 Hostname 或 IP,以及 Port 、 Timeout …等等。

Terminal.WariForString(string) 用於等待指定的 string 出現,會一直等待直至 Timeout,若沒出現指定的 string 則會回傳 null。

Terminal.SendResponse(string, bool) 用於送出 string,並可設定是否要送出換行(Enter)訊息。

2013年3月29日 星期五

Dropbox Error - 設定 Ramdisk 後無法執行 Dropbox


Could't start Dropbox
This is usually because of a permissions error. Errors
can also be caused by your home folder being
stored on a network share.

將環境變數的 Temp 以及 Tmp 更改路徑至 Ramdisk 之後,執行 Dropbox 時會出現以上錯誤,很可能是因為 Dropbox 找不到 Ramdisk 碟內的 Tmp 目錄。

在 Ramdisk 內新增了 Tmp 目錄後,將環境變數的 Temp、Tmp 設定在 Ramdis/Tmp,但該 Ramdisk 設定的是不會在開關機時儲存、讀取映像檔,導致重新開機後 Ramdisk 內的 Tmp 目錄消失,造成 Dropbox 找不到該 Tmp 目錄。

解決方法很簡單,只要設定 Ramdisk 啟用時,自動產生 Tmp 目錄即可,下圖是 Primo Ramdisk 的設定。


若所使用的 Ramdisk 沒有提供此功能,可以自己寫一個批次檔(.bat),在 Ramdisk 下產生 Tmp 目錄,再將此批次檔放置 Windows 啟動裡即可在開機時自動產生此目錄。批次檔內容只要簡簡單單的下面兩行即可。
R:
mkdir Tmp
以上範例為 R 碟,若磁碟機代號為 T 則輸入 T: 以此類推。

2013年3月14日 星期四

asp.net 4.0 ReportViewer IE9 報表欄位寬度顯示問題

在 ASP.NET4.0 使用 ReportViewer 在 IE9 瀏覽時,報表內的表格欄寬,不會依照設計時所設定的寬度顯示。


在檢視 ReportViewer 所產生的 iframe 內,發現有一 <td width="100%" height="0/">,在某些瀏覽器下,該 <td> 會占據大量版面,導致原有的報表表格受到擠壓。


解決方法很簡單,只要在網頁內加上少許 CSS,讓該 <td> 無效即可。如下。
<style type="text/css">
    td[id*='oReportCell'] {width:100%; !important;}
</style>
並在 ReportViewer 屬性加上 AsyncRendering="false" 使 iframe 套用外層的 CSS 屬性
<rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana"
    Font-Size="8pt" Height="0px" ProcessingMode="Remote" Width="100%" AsyncRendering="false">
</rsweb:ReportViewer>

本文參考
ReportViewer doesn’t take full width in Internet Explorer

apktool - apk 反編譯 unpack 工具

簡介

apktool 是一款可以將包裝好的 apk 解開的 open source 工具,目前支援 windows 、 linux 、 osx

網站

Google code - apktool
https://code.google.com/p/android-apktool/

下載

https://code.google.com/p/android-apktool/downloads/list

需求

 JAVA JRE 1.6 (或以上?)

安裝

下載 apktool1.5.2.tar.bz2 (或更新版本) 、 apktool-install-windows-r05-ibot.tar.bz2 (或更新版本),各自解壓縮後得到 apktool.jar 、 aapt.exe 、 apktool.bat ,將這三個檔案放至 C:\Windows 目錄下即安裝完成。

使用

命令提示字元  cmd

  • 反編譯 unpack
    • apktool d test.apk testapkfolder
    • 將 test.apk 解開至 testapkfolder 資料夾
  • 編譯回 apk
    • apktool b testapkfolder
    • 將 testapkfolder 編譯回 apk
  • 說明
    • apktool
    • 直接輸入 apktool 即出現說明資訊

2013年3月6日 星期三

TortoiseSVN Server 架設教學

架設步驟

1. 下載並安裝 TortoiseSVN
2. 開啟 cmd 輸入以下指令(全部為一行)
sc create "svnservice" binpath="C:\Program Files\TortoiseSVN\bin\svnserve.exe --service --listen-port 8888 --listen-host 0.0.0.0 -r C:\SVNRepository" displayname= "SVNService" depend= Tcpip

指令解說

svnservice 為 windows 服務的真正名稱

binpath 輸入要執行的程式

C:\Program Files\TortoiseSVN\bin\svnserve.exe 是 TortoiseSVN 的 serv 執行檔路徑

後方帶的參數有 port、hostip、SVN資料夾路徑

SVNService 為 windwos 服務顯示的名稱