Quick Reference Cards

Quick Reference Cards @ 藍色情懷 :: 隨意窩 Xuite日誌

There’s some good stuff about BASH on the web – I’d recommend (in increasing order of difficulty):

10 Seconds Guide to BASH Shell Scripting
Linux Shell Scripting Tutorial – A Beginner’s Handbook
BASH Programming Introduction and of course the definitive
Advanced BASH Scripting Guide
bash Quick Reference

However, what I haven’t been able to find is a simple reference card that just listed one way to do all the basics. Yes, I know there are ten different ways to do anything in BASH, and some of them are “very clever indeed”, but all I want is one simple way to write code, which I (or anyone else) will understand when I next look at it sometime in the distant future.

BASH Reference CardSo, I decided to make the effort and create a two sided reference card. The idea is you print it on thin A4 card double-sided, fold into thirds, and there you have something to gather dust on your desk until you need it.

Migrating from TFS to SVN

esmithy.net » Blog Archive » Migrating from TFS to SVN

Migrating from TFS to SVN
February 1st, 2011 by Eric

I’ve just spent the past few days migrating a Team Foundation Server source repository to Subversion. It took longer and was more difficult than I expected it to be.

Of course, the easy way is to just get the latest from the TFS repository and add all of the files to the new SVN repository, but change history is valuable and I didn’t want to:

lose it
be required to go back to TFS to get it

I found tfs2svn, a tool written by Kevin Colyar expressly for the purpose of migrating while preserving the change history. If you’re going to run this on a big, mature TFS repository, there are a couple of things you should know:

It’s going to take a long time.
Stuff is going to go wrong.

This is no disrespect to Kevin — that the tool is available at all is a great help. I also have to confess that I hacked the source code a bit, so there’s a possibility that some of what went wrong was my own fault.

C# lock整理

C# lock整理 – Phoenix’s 技術學習記事- 點部落

之前使用lock來控制物件的存取發生了點問題,

後來查文章發現自己對lock有些不正確的認知,

整理一下lock的特性。

lock的目標並不是物件,而是程式碼區段,只有被lock包覆的程式區段才會有作用。
當使用lock(xxx)時,xxx可以想象成是一個識別號,所有相同識別號的lock程式區段,會受到lock的影響。
lock並不能使用struct來當作識別號。
當有資料要作存取的控制時,把這些要控制的資料包裝起來,然後提供方法來存取,並且用lock(this)來控制是不錯的作法。

當需要做多執行緒的資源存取控制的程式碼的時候,感覺是一個相當具挑戰性的工作,以自己的能力,把這項工作做好並不容易,之前所發生的問題,最後也並沒有得到解決,最後的處理方式是改用別的方法來避開,以當時的狀況而言,這是最佳的做法,不過,萬一必須得面對這狀況的時候,一定會花掉相當的時間去修改程式、測試程式,將這些整理起來,如果下次再遇到相同的問題,可以用來參考。

關於lock(this)會發生Deadlock的一些文章:

http://haacked.com/archive/2005/04/12/neverlockthis.aspx

http://haacked.com/archive/2006/08/08/threadingneverlockthisredux.aspx

建議的作法是在類別內宣告一個私有物件,然後以其作為lock的instance,

免費資源網路社群

網路相簿

DreamHost Apps – 整合 Google Apps 與開源應用程式的免費空間平台!

by Pseric on 2009-06-11分類:個人網誌、免費論壇、網路相簿、編輯推薦
 
你或許聽過 Google應用服務(Google Apps),只要使用者擁有一個網域名稱,就能使用 Google 提供的各項服務,包括最知名的 Gmail、Google Talk、Google Sites、Google文件與Google日曆等等,這麼做除了可以大幅節省軟體與硬體的費用開銷外,更能直接導入 Google 系統平台的各項技術,Google Apps 也成為許多個人網站、小型公司、企業與教育單位的新選擇。

不過你可能會覺得 Google應用服務支援的工具太少,那麼不妨試試看由知名虛擬主機商 DreamHost 所提供的 DreamHost Apps!這個與 Google應用服務名稱類似的工具可是大有來頭,除了目前 Google Apps 的各項功能以外,還加入了WordPress、Durpal、phpBB、ZenPhoto、MediaWiki等開放原始碼程式,只需要註冊一次,就能夠擁有這麼多的服務,完全無須付費!如果你想要同時擁有三個WordPress部落格,也可以在 DreamHost Apps 的管理後台內快速新增,相當方便!

Invoke的用法(C#)

Invoke的用法(C#) – BeelinkerLidejun的专栏 – CSDN博客

在多线程编程中,我们经常要在工作线程中去更新界面显示,而在多线程中直接调用界面控件的方法是错误的做法,Invoke 和 BeginInvoke 就是为了解决这个问题而出现的,使你在多线程中安全的更新界面显示。

正确的做法是将工作线程中涉及更新界面的代码封装为一个方法,通过 Invoke 或者 BeginInvoke 去调用,两者的区别就是一个导致工作线程等待,而另外一个则不会。

而所谓的“一面响应操作,一面添加节点”永远只能是相对的,使 UI 线程的负担不至于太大而已,因为界面的正确更新始终要通过 UI 线程去做,我们要做的事情是在工作线程中包揽大部分的运算,而将对纯粹的界面更新放到 UI 线程中去做,这样也就达到了减轻 UI 线程负担的目的了。

举个简单例子说明下使用方法,比如你在启动一个线程,在线程的方法中想更新窗体中的一个TextBox..

using System.Threading;

//启动一个线程
Thread thread=new Thread(new ThreadStart(DoWork));
thread.Start();

//线程方法
private void DoWork()
{
this.TextBox1.Text="我是一个文本框";
}

如果你像上面操作,在VS2005或2008里是会有异常的…

正确的做法是用Invoke\BeginInvoke

using System.Threading;
namespace test
{
public partial class Form1 : Form
{
public delegate void MyInvoke(string str1,string str2);
public Form1()
{
InitializeComponent();

}
public void DoWork()
{
MyInvoke mi = new MyInvoke(UpdateForm);
this.BeginInvoke(mi, new Object[] {“我是文本框","haha"});
}
public void UpdateForm(string param1,string parm2)
{
this.textBox1.Text = param1+parm2;
}
private void button1_Click(object sender, EventArgs e)
{
Thread thread = new Thread(new ThreadStart(DoWork));
thread.Start();
}
}
}
注意代理的使用!

Make your .NET Code Beautiful with NDepend

NDepend Home Page

Make your .NET Code Beautiful with NDepend

NDepend is a Visual Studio tool to manage complex .NET code and achieve high Code Quality. With NDepend, software quality can be measured using Code Metrics, visualized using Graphs and Treemaps, and enforced using standard and custom Rules.

Hence the software design becomes concrete, code reviews are effective, large refactoring are easy and evolution is mastered.