Time of Update: 2018-12-04
假定使用vim建立c來源程式test.c,現在要編譯並執行該程式,可按照如下步驟。預先處理階段 gcc –E test.c –o test.i在test.i檔案中即把標頭檔加入進去編譯階段 gcc –S test.i –o test.s該階段的主要任務是把test.i編譯成彙編檔案彙編階段 gcc –C test.s –o test.o把.s檔案彙編成目標檔案連結階段 gcc test.o –o test產生可執行檔test。 ./test 運行該程式。
Time of Update: 2018-12-04
.Net
Time of Update: 2018-12-04
Windows作業系統是一個訊息驅動的作業系統,所以要想操作Windows作業系統中的任何控制項,都可以用訊息來進行。Windows作業系統開放了大量的API給使用者,使用者可以通過這些API從底層來操作Windows系統中的控制項,並且是以訊息的方式進行的,下面以C#通過Win32 API來操作IE瀏覽器 --- 獲得IE的URL為例:
Time of Update: 2018-12-04
/// <summary> /// 得到硬碟與CPU的ID及網卡MAC /// </summary> public class HardwareInfo { /// <summary> /// 取機器名 /// </summary> /// <returns></returns> public string
Time of Update: 2018-12-04
在做項目的時候為了讓編號看起來更霸氣,都加上了00,例如 10加了00 ,編程了0010,1加上了就編程0001了。但新增的時候需要產生新的編號,要擷取最大的值,然後分離,再加1,再填充00,開始採用replace("0",""),將0全部替換為空白,但這樣對於0010則必然是無效的,在js中用過給div的寬度賦值 ,採用了 int.Parse 類型轉換,可以將 100px 直接轉換成 100,在C#中實驗了下,果然也行,很犀利,類型轉換V5。隨筆記下: mst.UserGroupID =
Time of Update: 2018-12-04
一、取中文日期顯示1、年月日時分 currentTime.ToString("f"); //不顯示秒 2、年月 currentTime.ToString("y"); 3、月日 currentTime.ToString("m"); 4、格式為:2003-9-23 currentTime.ToString("d"); 5、格式為:14:24 currentTime.ToString("t"); 二、字元型轉換 轉為字串 1234
Time of Update: 2018-12-04
第一種方式 檔案夾與資料庫配合 近來做了不少關於這塊的功能 ,隨著網路的飛速發展,網路存取圖片已不再是神話,而成為了一種時尚,如果是你 是用Asp.net開發的話,可能更多的人會考慮使用資料庫儲存圖片的路經,而在檔案夾是儲存圖片的方式。這種方式主要的方法有兩個一個就是怎麼樣讀取圖片,怎麼樣儲存圖上,讀取的話我就不多說的這個是最簡單的了,只要大家把地址=給儲存圖片的對象就行了,在取的時候一般要使用相對位址也就是“~”
Time of Update: 2018-12-04
private void Start_KeyDown(object sender, KeyEventArgs e) { //方向鍵作用 if (e.KeyCode == Keys.P) { Process p = new Process(); p.StartInfo = new ProcessStartInfo("winword.exe",
Time of Update: 2018-12-04
本人搞C#編程已經有幾年了,但Flex一直沒有接觸過,目前正在自學中, 首先開啟VS,本人用的是2005+SP1的版本,建立一個Web應用程式在預設頁Default.aspx中,加入Page_load方法 protected void Page_Load(object sender, EventArgs e){ string str = "HelloWorld"; Response.Write(str);} 好了,Server端建立完畢,簡單吧,下面來建立Flex程式用戶端1.
Time of Update: 2018-12-04
為了深入理解訊息機制,先來做一個測試專案在建立項目的Form1的代碼中,加入方法:protected override void DefWndProc(ref Message m) { if (m.Msg == 0x200) { MessageBox.Show("捕捉到訊息"); } else {
Time of Update: 2018-12-04
"^"為C#當中的異或運算子,通常可以理解為"排他性"運算.運算規則如下--------------------------------------------------------------------------------------------------True ^ False TrueTrue ^ True FalseFalse ^ True
Time of Update: 2018-12-04
一、添加cookie1 HttpCookie cookie = new HttpCookie("Info"); //定義cookie對象以及名為Info的項 2 DateTime dt = DateTime.Now; //定義時間對象 3 TimeSpan ts=new TimeSpan(1,0,0,0); //cookie有效作用時間,具體查msdn 4 cookie.Expires = dt.Add(ts);
Time of Update: 2018-12-04
bool IsFileInUse(string fileName) { bool inUse = true; if (File.Exists(fileName)) { FileStream fs = null; try { fs = new FileStream(fileName,
Time of Update: 2018-12-04
使用了兩個開原始檔控制讀取Excel檔案的內容,不需要安裝Excel或Office,開發環境可能需要vs2008(2005沒測試過)NPOI, 讀取xls檔案(Excel2003及之前的版本) (NPOI.dll+Ionic.Zip.dll) http://npoi.codeplex.com/EPPlus, 讀取xlsx檔案(Excel2007版本) (EPPlus.dll)
Time of Update: 2018-12-04
private Point mouse_offset; private void label1_MouseDown(object sender, MouseEventArgs e) ...{ mouse_offset = new Point(-e.X, -e.Y);// } private void label1_MouseMove(object sender, MouseEventArgs e) ..
Time of Update: 2018-12-04
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;using System.Drawing.Drawing2D;using System.Threading;n
Time of Update: 2018-12-04
如果代碼是:device.DrawPrimitives(PrimitiveType.LineStrip, 0,3);執行結果是:它把頂點繪製為一條折線。至少需要兩個頂點。如果代碼為:device.DrawPrimitives(PrimitiveType.PointList,
Time of Update: 2018-12-04
private bool FindNode(TreeNode Node) ...{ /**//* int ID1 = Convert.ToInt16(Node.Tag.ToString()); string sqlstr = "delete from dp where id1=" + ID1; return DBClass.Db_ExecuteNonquery(sqlstr); */
Time of Update: 2018-12-04
以產生金字塔為例,在C#下,可以用以下代碼: if(ds.BuildOverviews(args[1], levels, new Gdal.GDALProgressFuncDelegate(ProgressFunc), "Sample Data") != (int)CPLErr.CE_None){ MessageBox.Show("error"); return;} 其中ProgressFunc為一個函數,可以將進度顯示的代碼放在其中,定義如下: public staticint
Time of Update: 2018-12-04
可以使用如下方法設定Socket通訊端的接收或發送的逾時檢測 static void ConfigureTcpSocket(Socket tcpSocket){ // Don't allow another socket to bind to this port. tcpSocket.ExclusiveAddressUse = true; // The socket will linger for 10 seconds after //