發表文章

javascript window close event confirm

當瀏覽器關閉的時會先呼叫,不會直接關閉。 window.onbeforeunload = function (e) {     e = e || window.event;     // For IE and Firefox prior to version 4     if (e) {         e.returnValue = 'Any string';     }     // For Safari     return 'Any string'; };  Here is a working  jsFiddle

Put 參數傳送方法

I was trying to do this the easy way with C#, but apparently that is not the tool of choice from looking at the code samples :) private bool PutData(string sURL, string sData, out string sResponse) { try { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] arr = encoding.GetBytes(sData); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sURL); request.Credentials = new NetworkCredential(" ", " "); request.Method = "PUT"; request.ContentType = "text/xml"; request.ContentLength = arr.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(arr, 0, arr.Length); dataStream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream respStream = ...

C#, WebRequest PUT, and XML

I was trying to do this the easy way with C#, but apparently that is not the tool of choice from looking at the code samples :) private bool PutData(string sURL, string sData, out string sResponse) { try { System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] arr = encoding.GetBytes(sData); HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(sURL); request.Credentials = new NetworkCredential(" ", " "); request.Method = "PUT"; request.ContentType = "text/xml"; request.ContentLength = arr.Length; Stream dataStream = request.GetRequestStream(); dataStream.Write(arr, 0, arr.Length); dataStream.Close(); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Stream respStream = ...

JQuery - $.each如何做到continue, break

今天剛好碰到這個問題 記錄一下 $.each(data, function(index, obj){     if (index == 1) {         return; // 等於continue     } else {         return false; // 等於break     } }); 轉至: http://qaz33326.pixnet.net/blog/post/46540628-jquery---$.each%E5%A6%82%E4%BD%95%E5%81%9A%E5%88%B0continue,-break

計算連續登入次數

SQL連續登入

Unity腳本:激活遊戲物件 SetActive

圖片
在Unity腳本中,要激活遊戲物件的方法就是使用遊戲物件的SetActive方法: gameObject.SetActive( true ); 短短一行程式碼,但依然有要注意的地方。 首先遊戲物件在未激活的狀態下,本身的腳本是不會執行的, 所以如果你在一個激活的遊戲物件的start()函式中使用下面程式碼: gameObject.SetActive( false ); 可以成功地將物件變成非激活狀態, 但是在一個非激活的物件中使用下面程式碼: gameObject.SetActive( true );  

unity3d中脚本生命周期

圖片
1、静态构造函数 当程序集被加载的时候就被调用了,如果你的unity处于编辑状态时,此时你保存一个脚本(从而迫使重新编译),静态构造函数会立即被调用,因为 unity加载了DLL。并且它将不会再次运行,永远只会执行一次,unity运行时,是不会再次执行了!在一个已部署的游戏上,这个构造器将会在 unity加载过程的早期被调用! 静态构造函数文章: http://www.cnblogs.com/MrZivChu/p/BaseKnowledge_staticConstructor.html 2、非静态构造器 Unity将会在一个貌似随机的时间调用一个对象的默认构造器。当你编辑一个游戏时,在你保存一个脚本(从而迫使重新编译)后,这构造器将会被立马调用! 程序运行时被随机调用多次,程序结束时也被调用了(自己测试发现) 所以不要使用构造器去初始化字段的值,unity的Awake就是专门为这个目的设计的。