Time of Update: 2015-12-29
標籤:原文地址:http://www.cnblogs.com/s380774061/archive/2012/10/15/2725297.html之前一直想自己搞把C#的Socket代碼,一直沒有下手,今晚終於實踐了一把。現把流程編寫出來,以備後用。很簡單的源碼。工具:Vs2010建立項目:C# 控制台應用程式Server代碼using System;using System.Collections.Generic;using System.Linq;using
Time of Update: 2016-01-03
標籤:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Reflection;using System.IO;namespace ConsoleApplication9{ class Program { static void Main(string[] args)
Time of Update: 2015-12-27
標籤://此方法得到的百分比後小數太多,不行double percent=Convert.ToDouble(2)/Convert.ToDouble(34);string result=(percent*100).ToString()+"%";//得到的是5.8823529411764%//此方法能得到你想要的小數點後位元double percent=Convert.ToDouble(2)/Convert.ToDouble(34);string result=string.Format("{0:0
Time of Update: 2015-12-23
標籤:深入C#記憶體管理來分析實值型別&參考型別,裝箱&拆箱,堆棧幾個概念組合之間的區別-C#初學者經常被問的幾道辨析題,實值型別與參考型別,裝箱與拆箱,堆棧,這幾個概念組合之間區別,看完此篇應該可以解惑。 俗話說,用思想編程的是文藝程式猿,用經驗編程的是普通程式猿,用複製粘貼編程的是2B程式猿,開個玩笑^_^。 相信有過C#面試經曆的人,對下面這句話一定不陌生: 實值型別直接儲存其值,參考型別儲存對值的引用,實值型別存在堆棧上,參考型別儲存在託管堆上,實值型別轉為參考型別
Time of Update: 2015-12-14
標籤:escape不編碼字元有69個:*,+,-,.,/,@,_,0-9,a-z,A-ZencodeURI不編碼字元有82個:!,#,$,&,‘,(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-ZencodeURIComponent不編碼字元有71個:!, ‘,(,),*,-,.,_,~,0-9,a-z,A-Z1.JS: escape : js使用資料時可以使用escape
Time of Update: 2015-12-17
標籤:今天開始重溫C語言程式設計,琢磨了一下用命令列編譯C代碼。 步驟如下:1、先用記事本編寫如下所示的代碼,並另存新檔hello.cpp,假設其儲存路徑為D:CPratice\hello.c。#include
Time of Update: 2015-12-21
標籤:/// <summary>/// 過濾空格、換行、script、style等等標籤/// </summary>/// <param name="html">html的內容</param>/// <returns>處理後的文本</returns>internal static string SHTML(string html){ html = html.Trim(); html = html.Replace(@"
Time of Update: 2015-12-20
標籤:c#中變數的聲明和初始化int i;string text;for(i = 0 ; i < 10; i++){ text = "Line"+Convert.ToString(i); Console.WriteLine("{0}",text);}Console.WriteLine("Last text in loop
Time of Update: 2015-12-10
標籤:在winform中有一個控制項可以顯示html的內容,該控制項就是webbrowser,設定它的DocumenText屬性為HTML的內容即可。在使用WebBrowser做UI的時候,我們有時不希望裡面的連結被使用者點擊,更不希望彈出煩人的指令碼錯誤提示框,也不希望使用者能點出右鍵的IE菜單,要做到這些,其實都是很easy地…//設定webBrowser webBrowser1.ScriptErrorsSuppressed = true; //禁用錯誤指令碼提示
Time of Update: 2015-12-05
標籤: 紅色為關鍵字,藍色為文法,紫色為注意。第一個c#控制台應用程式:(開啟VS,選擇“控制台應用程式”會自動產生c#編程基礎架構) 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 6 namespace HelloWorld(空間名) 7 { 8 class Program(類名)
Time of Update: 2015-12-09
標籤:1. public static bool ReferenceEquals(object left, object right)Object.ReferenceEquals()在兩個變數引用到同一個對象時返回true,也就是兩個變數具有相同的對象ID。不管比較的類型是參考型別還是實值型別的,這個方法總是檢測對象ID,而不是對象內容。string a = "test";string b = "test";if (Object.ReferenceEquals(a, b)){
Time of Update: 2015-12-04
標籤: 1 using System; 2 using System.Collections.Generic; 3 using System.ComponentModel; 4 using System.Data; 5 using System.Drawing; 6 using System.IO; 7 using System.Linq; 8 using System.Text; 9 using System.Threading.Tasks;10 using
Time of Update: 2015-12-04
標籤:以下內容有錯誤請指正,為個人理解和經驗。c#提供三種互斥Monitor類、Lock和Mutex類,他們的區別和使用方法如下:一、Lock類名叫“臨界區”,為Monitor的封裝版,用於多線程,對單線程無用,即支援在同一個線程內多次調用lock鎖定同一個目標。用法 lock (this) { //執行代碼 }效果為在多個線程內調用同一個函數時,函數內部使用鎖定方法,可以讓線程進行“
Time of Update: 2016-01-06
標籤:ojective-c convert to pascal patternhttp://www.cnblogs.com/cnsoft/archive/2013/06/09/3128619.html Case I. Simple Class Objective-C XE4 // Protocol@protocol mycalcEvent- (void) oncalcEventA : (int) inx ext1:(int) extInx1;-
Time of Update: 2016-01-05
標籤:參考:http://www.cnblogs.com/whiteyun/archive/2011/07/22/2113560.html 問題: 如果用了 DEF 檔案來匯出 DLL 的函數, 還需要在匯出的函式宣告前面加 extern "C" 嗎? DEMO 下載: http://pan.baidu.com/s/1kTTY6rH extern "C" 的目的是告訴 C++ 編譯器不要對函數名進行改名處理(以便支援函數重載), 而是按照 C
Time of Update: 2015-12-26
標籤://聲明結構體 關鍵字 struct// 聲明一個用於描述學生對象的結構體類型// 聲明成員變數時不能賦值,因為這是在聲明結構體類型// struct student// {// int num; //學號 //成員變數之間用分號;隔開// char name[30]; //姓名 //必須指定字元數組的大小// &
Time of Update: 2015-12-26
標籤:/*// 1. 無參無傳回值void hello() { printf("hello world!\n"); }// 2. 無參有傳回值int peoplweCount(){ return
Time of Update: 2015-12-25
標籤: 檔案 一個檔案通常就是磁碟上的一段命名的儲存區。但對於作業系統來說,檔案就會更複雜一些。例如,一個大檔案可以儲存在一些分散的區段中,或者還會包含一些使作業系統可以確定其檔案類型的附加資料。 C將檔案看成是連續的位元組序列,其中每一個位元組都可以單獨地讀取。ANSI C提供了檔案的兩種視圖:文本視圖和二進位視圖。 1° 文本視圖和二進位視圖
Time of Update: 2015-12-17
標籤:題意:p, q,都是整數.sigma(Ai * ki)>= p, sigma(Bi * ki) >= q;ans = sigma(ki)。輸出ans的最小值約束條件2個,但是變數k有100000個,所以可以利用對偶性轉化為求解ans = p * y1 + q * y2約束條件為:Ai * y1 + Bi * y2 <= 1 其中i為0~n-1也就是n個約束條件。 後面三分搞搞就好了 1 #include <bits/stdc++.h&
Time of Update: 2015-12-14
標籤:/**Base64.h**/#import <Foundation/Foundation.h>@interface NSData (Base64)+ (NSData *)dataWithBase64EncodedString:(NSString *)string;- (NSString *)base64EncodedStringWithWrapWidth:(NSUInteger)wrapWidth;- (NSString