Time of Update: 2016-06-28
標籤:雖然網上已經有了SharpSniffer這一個SharpSniffer還是原創的無他,唯為學習工程檔案下載:SharpSniffer.rar1、建立通訊端2、綁定到本機3、設定IOControl4、接收資料5、處理(顯示)資料1、建立通訊端建立socket ,據MSDN,IOControlCode.ReceiveAll(後面要使用到)使用時有以下限制:ReceiveAll啟用對網路上的所有 IPv4
Time of Update: 2016-06-28
標籤: 第一種方法:System.DateTime.Nowusing System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Example{ public class Program { static void Main(string[] args) { int sum=0;
Time of Update: 2016-06-28
標籤:轉 http://kwon.iteye.com/blog/1068255 http://blog.csdn.net/tvvbbb/article/details/47256943 public static string DecimalToString(decimal d) { return d.ToString("#0.#
Time of Update: 2016-06-28
標籤: int[] ss = new int[6]; Random s = new Random();
Time of Update: 2016-06-28
標籤:輸入每個人的中獎號碼,進行滾動顯示 //清屏 //隨即一個索引 // 根據索引列印 //等待0.1秒 Console.Write("請輸入參與者人數:"); &
Time of Update: 2016-06-28
標籤:1. string str = "32323";2. double a = (double)str ;3. double a = Convert.ToDouble(str); 第3行會轉換成功,第2行就會報錯,ToDouble方法會自動進行溢出檢查,但是為什麼第2行會失敗?轉換方法Method1: double.TryParseMethod2
Time of Update: 2016-06-28
標籤: /// <summary> /// 建立xml檔案 /// </summary> /// <param name="xmlDoc">xml</param> /// <returns></returns> public string CreateXml(string xmlDoc) { string
Time of Update: 2016-06-28
標籤: SmtpClient smtpServer = new SmtpClient("smtp.163.com"); smtpServer.Port = 25; smtpServer.Credentials = new System.Net.NetworkCredential("feiyang", "1234"); smtpServer.EnableSsl = true;
Time of Update: 2016-06-28
標籤:我們需要在XML與實體類,DataTable,List之間進行轉換,下面是XmlUtil類,該類來自網路並稍加修改。 using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.IO;using System.Data;using System.Xml;using System.Xml.Serialization;/// <summary>
Time of Update: 2016-06-28
標籤:static void Main(string[] args) { //Action TestAction<string>(Action, "Hello"); TestAction<int>(Action, 1000); TestAction<string>(p => { Console.WriteLine(p); }, "Lamada");
Time of Update: 2016-06-28
標籤: C# 中在映像上畫框,通過滑鼠來實現主要有四個訊息響應函數MouseDown, MouseMove, MouseUp, Paint重繪函數實現。當滑鼠鍵按下時開始畫框,滑鼠鍵抬起時畫框結束。Point start; //畫框的起始點Point end,//畫框的結束點bool blnDraw;//判斷是否繪製Rectangel rect; 滑鼠按下響應private void PictureBox1_MouseDown(object sender,
Time of Update: 2016-06-28
標籤:單例:一個類只有一個執行個體。巧妙利用了程式設計語言的一些文法規則:建構函式private, 然後提供一個public的方法返回類的一個執行個體;又方法和返回的類的執行個體都是static類型,所以只能被類所擁有,而不能被執行個體化類的對象擁有。這樣一個類就只能有一個執行個體了。 public class InstanceNote { private string
Time of Update: 2016-06-28
標籤:返回單個值 /// </summary> /// <param name="user">使用者資訊</param> /// <returns></returns> public static int VerifyUser(clsUser user) { int iRet;
Time of Update: 2016-06-28
標籤:stream為服務端接收的檔案流var bytes = new byte[stream.Length];stream.Read(bytes, 0, bytes.Length);// 設定當前流的位置為流的開始stream.Seek(0, SeekOrigin.Begin);var pathHead = HttpContext.Current.Request.PhysicalApplicationPath;if (!Directory.Exists(path))
Time of Update: 2016-06-28
標籤:劍指offer第四十九題:把字串轉換為整數 1 //============================================================================ 2 // Name : JZ-C-49.cpp 3 // Author : Laughing_Lz 4 // Version : 5 // Copyright : All Right Reserved 6 // Description :
Time of Update: 2016-06-28
標籤:劍指offer第四十八題:不能被繼承的類:用C++設計一個不能被繼承的類(如C#裡關鍵字Sealed,Java裡關鍵字final) 1 //============================================================================ 2 // Name : JZ-C-48.cpp 3 // Author : Laughing_Lz 4 // Version : 5 // Copyright :
Time of Update: 2016-06-28
標籤:劍指offer第四十七題:不能用加減乘除做加法 1 //============================================================================ 2 // Name : JZ-C-47.cpp 3 // Author : Laughing_Lz 4 // Version : 5 // Copyright : All Right Reserved 6 // Description :
Time of Update: 2016-06-28
標籤:在I2C裝置讀取,必須是在同一個周期內。一個例子,可以同時讀出兩個值int read_register_double_value(int reg_addr, unsigned char *value_h, unsigned char *value_l){struct i2c_rdwr_ioctrl_data io_data = {0};struct i2c_msg msg[2] = {{0}};unsigned char data = 0;unsigned char out[2] = {0
Time of Update: 2016-06-28
標籤:1、sscanf函數原型:int sscanf(const char *,const char *,...);int sscanf(const char *buffer,const char
Time of Update: 2016-06-28
標籤: C函數可以通過堆棧來和Lua交換資料,但有時候C函數需要在函數體的範圍之外儲存某些Lua資料,那麼我們想到全域變數或static變數,這樣做的缺點是:為Lua設計C函數庫時,導致不可重新進入;不是所有的Lua值都能很好的儲存到C變數中。那麼可不可以將值儲存在Lua全域變數裡面呢,可以,Lua就提供了一個獨立的被稱為registry的表,但是Lua代碼本身不能訪問它。registry全域註冊表解釋:一個普通的Lua表,使用假索引(pseudo-index)LUA_REGISTRYINDE