皮克斯創始人之一、動畫界傳奇的 John Lasseter 在接受一家德國媒體《南方德國報》採訪時暢談了他所謂堅持的“七大創意原則”,他表示這七大原則是他實現其動畫電影創作目標的根源所在。
原則一:永遠不要只抱著一個點子
createps 發表在 痞客邦 留言(0) 人氣(48)
Apple Corona in 5 minutes Part 2
Animation and Sound
Let's animate the text and add some sound every time the user taps the button. Start with the “HelloWorld2” project and add the following lines at the end of main.lua so that the text will move vertically down by 100 pixels:
createps 發表在 痞客邦 留言(0) 人氣(70)

Corona in 5 minutes Part 1
Let's start with a quick introduction to the Corona
SDK. We'll focus just on the essentials without getting stuck in the details.
We're not trying to be complete or precise. Rather, we want to get you as
quickly as possible to the point where you can start creating cool, useful, or
engaging apps.
createps 發表在 痞客邦 留言(0) 人氣(658)
方法二
4.4.4 對List<T>進行排序
List<T>作為列表,排序也是它的一個基本功能。List<T>可以通過Sort()對列表中的元素進行從小到大排序,同時Sort()還接收自定義比較器,這樣開發人員可以根據需要指定希望的比較方式。Sort()方法的3個常用版本的定義如下:
public void Sort();
public void Sort(IComparer<T> comparer);
public void Sort(int index,int count,IComparer<T> comparer);
其中,第1個版本是通過默認的比較器對列表中所有元素進行從小到大排序,如果類型T沒有默認比較器,也沒有實現接口IComparer<T>,即T不能進行比較,那麼會產生異常。參數comparer是一個實現了IComparer<T>接口的類型對象,Sort()通過comparer接口的Compare()對元素進行比較。第3個版本是部分元素進行比較,index表示起始索引(0開始計數),count表示要排序的元素個數。
IComparer<T>接口只有一個成員Compare(T x, T y),通常情況下,如果x小於y返回負數,x等於y返回0,x大於y返回整數。如示例代碼4-10中的MyIntComparer類,該類實現接口IComparer<int>,成員Compare(int x, int y)根據x和y的絕對值x和y進行比較。
示例代碼4-10演示Sort()方法和IComparer<T>的使用,泛型方法PrintList<T>()用來打印列表中的元素,該函數在後面的例子中會繼續使用。在UseSort()方法中,ary是最原始的數據,首先,用默認的比較器對元素按照從小到大排序(負數小於整數)。然後,用自定義整數比較器MyIntComparer對象mic對列表中的元素按照絕對值排序。最後,用mic對列表中第2個開始的3個元素按照絕對值排序。
示例代碼4-10
//自定義整數比較器,按照整數的絕對值進行比較
class MyIntComparer:IComparer<int>
{
//重寫int比較器,|x|>|y|返回正數,|x|=|y|返回0,|x|<|y|返回負數
public int Compare(int x, int y)
{
int x1 = Math.Abs(x); //x的絕對值x1
int y1 = Math.Abs(y); //y的絕對值y1
return x1 - y1;
}
}
//在同一行上打印列表中的元素
static void PrintList<T>(string hint, List<T> lst)
{
System.Console.Write(hint + ":");
foreach (T val in lst)
//遍歷並打印列表中的元素
{
System.Console.Write("{0} ", val);
}
System.Console.WriteLine();
}
static void UseSort()
{
int[] ary = {9, 8, -11, 10, -3, 2}; //準備
數據,添加到列表中
MyIntComparer mic = new MyIntComparer();
List<int> intLst = new List<int>( );
intLst.AddRange(ary);
//將數據添加到List<int>中
PrintList<int>("排序前", intLst); //打印數據
intLst.Sort( ); //使
用默認比較器進行排序
PrintList<int>("默認排序後", intLst); //打印數據
intLst.Clear( ); //重新準備數據
intLst.AddRange(ary);
intLst.Sort(mic); //用自定義
的比較器進行排序,即按絕對值排序
PrintList<int>("絕對值排序後", intLst); //打印數據
intLst.Clear( ); //重新準備數據
intLst.AddRange(ary);
intLst.Sort(2, 3, mic); //對第2個開始的3
個元素按絕對值排序
PrintList<int>("部分排序後", intLst); //打印數據
}
示例代碼4-10的輸出如下,默認排序之後元素按照從小到大排序,負數小於0和整數。按絕對排序之後,-3大於2,可見MyIntComparer起作用了。同樣部分排序的時候,第0和1兩個元素和最後一個元素都沒有參與排序。
排序前:9 8 -11 10 -3 2
默認排序後:-11 -3 2 8 9 10
絕對值排序後:2 -3 8 9 10 -11
部分排序後:9 8 -3 10 -11 2
技巧:如果希望對元素從大到小排序,可以先用Sort()方法對元素從小到大排序,然後再用Reverse()將列表中的元素倒置,就變成從大到小排序。
///////////////////////////////////////////////////////////////////////////////////////////
createps 發表在 痞客邦 留言(0) 人氣(17,295)
取得執行檔的目錄
string path = Directory.GetCurrentDirectory();
or
createps 發表在 痞客邦 留言(0) 人氣(179)
制作/ 刪除 目錄:
if (!System.IO.Directory.Exists("檔案路徑"))
System.IO.Directory.CreateDirectory("檔案路徑");
createps 發表在 痞客邦 留言(0) 人氣(2,330)
使用Gmail
private void 寄送email(string 標題,string 寄件者, string[] 收信者,string 內文)
{
int i;
try
{
string men = "";
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress(寄件者);
for (i = 0; i < 收信者.Length; i++)
{
mail.To.Add(收信者[i]);
men += 收信者[i];
}
mail.Subject = 標題;
mail.Body = 內文;
//附件刪掉
//System.Net.Mail.Attachment attachment;
//attachment = new System.Net.Mail.Attachment("you attachment file");
//mail.Attachments.Add(attachment);
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("你的email","密碼");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
//MessageBox.Show("mail Send");
}
catch (Exception ex)
{
Debug.Print("發送Email發生錯誤");
}
}
createps 發表在 痞客邦 留言(0) 人氣(2,253)
在Window Server 2008 裝 VS 2008
要裝 FrameWork 3.5 時出現錯誤,寫xxxx您必須使用角色管理工具來安裝或設定xxxx
這時候,到開始->所有工具->系統管理工具->伺服器管理員->功能->新增功能->.NET Framework 3.5.1 功能
把它安裝起來就可以了
createps 發表在 痞客邦 留言(0) 人氣(67)
C# 上個月的最後一天
string 上個月的最後一天 = DateTime.Now.AddDays(DateTime.Now.Day * -1).ToString("yyyyMMdd");
createps 發表在 痞客邦 留言(0) 人氣(1,544)
輸入法 嘸蝦米記憶法我本來會大易,可是有越來越的多的平台都有嘸蝦米(iOS竟然也有...),所以我想說換用它來打字。
以下是我自己的字根記法:
音:
createps 發表在 痞客邦 留言(0) 人氣(459)