2013年3月21日 星期四

ANDROID SD卡中無法立刻完全刪除檔案

Root cause : Android has a cache of file that keeps track of media files.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));

It makes the MediaScanner service run again, which should remove the deleted file image from the device's cache.

2012年8月25日 星期六

雜牌Android手機在window上無法以USB數據連線

裝置管理員顯示 : RNDIS Communication ... 黃色驚嘆號

解法: 裝置管理員→更新驅動程式軟體→瀏覽電腦上的驅動程式軟體→讓我選擇...→網路介面卡→Mircosoft Corporation→Remote NDIS Compatible Device

2010年9月2日 星期四

[C#] Uninstall

  1. 新增專案Uninstall
  2. 主要是呼叫System32下msiexec.exe來執行新增移除程式,然後自己關掉。
  3. 建立新的 Setup Project
  4. 新增 UninstallApp.exe 到 'File System' 內的 "Application Folder"
  5. 再於 "User's Program menu" 建立一個 UninstallApp.exe 的捷徑
  6. 最後重建 Deployment Project



static void Main()
{
//Application.EnableVisualStyles();
//Application.SetCompatibleTextRenderingDefault(false);
//Application.Run(new Form1());

using (Process p = new Process())
{
ProcessStartInfo info = new ProcessStartInfo();
info.FileName = System.IO.Path.Combine(System.Environment.SystemDirectory, "msiexec.exe");
//package 修復或移除//uninstall 直接移除 //封裝專案之ProductCode
info.Arguments = " /uninstall {9E1E3B12-DB7F-40DF-BA2F-0455B645BED8}";
info.CreateNoWindow = true;
p.StartInfo = info;
p.Start();
}
//killProcess(Application.ProductName);
Process[] allProcess = Process.GetProcesses();
foreach (Process p in allProcess)
{

if (p.ProcessName.ToLower() + ".exe" == Application.ProductName.ToLower() + ".exe")
{
for (int i = 0; i < p.Threads.Count; i++)
{
p.Threads[i].Dispose();
}
p.Kill();
}
}
}

2010年1月21日 星期四

Balsamiq Mockups.

在專案製作過程中,想為軟體、或是網站設計個介面,又覺得那些Office 之類的繪圖介面不好用怎麼辦???
上 網搜尋的過程中發現了這個有趣的手繪風格版面介面設計 軟體 Balsamiq Mockups.

Balsamiq Mockups 的官方網頁

安裝後的桌面圖示,設計稿與筆。

Balsamiq Mockups 的軟體介面,整個手繪風格看起來非常舒服。

介面非常簡潔也一目了然,上面是軟體提供的介面元件,只要用拖拉的方式就可 以放到下面的工作區。
拖曳一個視窗的 元件,來測試一下


每個元 件都有不同的屬性,可以做調整,我把視窗元件的狀態列拿掉,模擬一個AP的頁面。
哦哦~ 試用版每幾分鐘就跳出來提醒你一下,這是有版權的軟體哦XD

拖拖拉拉一堆元件後 :

鏘鏘~! 拖拖拉拉 打幾個字,就完成了一個簡易AP的layout, 這樣之後要設計界面或是跟同事溝通就簡單多了。

很有趣的是,軟 體還提供了Mark up 的元件,可以以這檔案做資訊及意見的溝通交流。比如說貼個便條紙,畫些建議之類的。

同樣的也可以拿 來當網頁、甚至是iPhone App 的介面規劃
這軟體的特色:
  • 使 用Adobe Air platform 開發,可跨平台使用
  • 手繪風格可愛簡潔
  • 介面簡單、上手容易
另 外這是要付費的軟體,要價 $79..... 不知道這篇介紹文能不能騙到個License.....

2009年12月16日 星期三

[C#] 產生亂數

產生數字與英文大小寫所產生的字串

//Generate random strings
private string generateRandomString(int length)
{
string ranStr = "";
Random ran = new Random();
for (int i = 0; i < length; ++i)
{
switch (ran.Next(0, 3))
{
case 0:
ranStr += (char)ran.Next(65, 91); //A~Z
break;
case 1:
ranStr += (char)ran.Next(97, 122); //a~z
break;
case 2:
ranStr +=ran.Next(0,10); //0~9
break;
}
}
return ranStr;
}

2009年12月15日 星期二

[C#][XML] 在根層次的資料無效

在根層次的資料無效


XmlDocument.Load("讀取xml 檔案(未定義dtd)");
XmlDocument.LoadXmL("讀取已定義之XML");

2009年12月1日 星期二

[C#][SQL] Sql Parameter

myConn.ConnectionString = "data source=localhost;Initial Catalog=DB;User ID=user;Password=1234";
myConn.Open();

string strEq = "AAA";
string strSQL = "";
try
{
strSQL = " Update table SET ";
strSQL += " Name = @Name, ";
strSQL += " Address = @Address ";
strSQL += " WHERE ID = '" + strEq + "' ";

SqlCommand myCmd = new SqlCommand(strSQL, myConn);
myCmd.Parameters.Clear();
SqlParameter p1 = myCmd.Parameters.AddWithValue("Name", DbType.String);
p1.Value = "David";
SqlParameter p2 = myCmd.Parameters.AddWithValue("Address", DbType.String);
p2.Value = "Taipei";
myCmd.ExecuteNonQuery();
myConn.Close();

}
catch (Exception ex)
{
//exception output
}