Time of Update: 2016-03-02
標籤:/// <summary> /// 擷取指定IP地址的資料庫所有資料庫執行個體名。 /// </summary> /// <param name="ip">指定的 IP 位址。</param> /// <param name="username">登入資料庫的使用者名稱。</param> /// <param
Time of Update: 2016-03-02
標籤:在C#中定義常量的方式有兩種,一種叫做靜態常量(Compile-time constant),另一種叫做動態常量(Runtime constant)。前者用“const”來定義,後者用“readonly”來定義。 對於靜態常量(Compile-time constant),它的書寫方式如下: public const int MAX_VALUE = 10;
Time of Update: 2016-02-25
標籤:using System;using System.IO;namespace Utils{ public class IOHelper { public IOHelper(); public static bool CopyDir(DirectoryInfo fromDir, string toDir); //複製目錄 public static bool CopyDir(string fromDir, string toDir);
Time of Update: 2016-03-02
標籤:先來點與標題不相關的:CLR支援兩種程式集:弱命名程式集和強命名程式集。兩者的區別在於強命名程式集使用發行者的公開金鑰和私密金鑰進行簽名。由於程式集被唯一性地標識,所以當應用程式綁定到強命名程式集時,CLR可以應用一些已知安全的策略。程式集可以採用兩種方式部署:私人或者全域。弱命名程式集只能以私人方式部署。在《CLR via
Time of Update: 2016-02-28
標籤:首先說明:程式碼片段是從網路擷取,然後自己修改。我想好的東西應該拿來分享。先說下原理:當我們採集頁面的時候,如果被採集的網站需要登入才能採集。不管是基於Cookie還是基於Session,我們都會首先發送一個Http要求標頭,這個Http要求標頭裡面就包含了網站需要的Cookie資訊。當網站接收到發送過來的Http要求標頭時,會從Http要求標頭擷取相關的Cookie或者Session資訊,然後由程式來處理,決定你是否有許可權訪問當前頁面。好了,原理搞清楚了,就好辦了。我們所要做的僅僅是在
Time of Update: 2016-03-01
標籤: public static string StrToHex(string mStr) //返回處理後的十六進位字串 { return BitConverter.ToString( ASCIIEncoding.Default.GetBytes(mStr)).Replace("-", " "); } /* StrToHex */ public static string
Time of Update: 2016-03-01
標籤:private string RevertToTime(int l)//轉換為時分秒格式 { string str = ""; int hour = 0; int minute = 0; int second = 0; second = l / 1000; if (second > 60) { minute = second / 60;
Time of Update: 2016-03-01
標籤:最近又再看基礎知識了。看到方法的重寫(new)和覆蓋(override)的時候有點不太懂。於是百度之。那答案啊。。。。。要麼就是把覆蓋(override)和重載(overlord)混淆了。要麼就是把重寫(new)和覆蓋(override)說反了。最後不得已Google之。在stackoverflow裡看到一個比較好的答案:-------------------------------------------------------------------------------------
Time of Update: 2016-03-01
標籤:在使用TabControl控制項時,希望隱藏其中某個選項卡(即TabPage)。TabPage類明明提供了一個Hide方法,用在代碼中卻沒有任何效果,甚是奇怪。無奈之餘,只好考慮另闢途徑。方法一:設定該TabPage的父容器為null 即可,如TabPage.Parent = null 。如需顯示該TabPage,設定其父容器為對應的TabControl即可。方法二:利用TabControl的TabPages屬性,它是TabPage對象的集合,調用集合的Remove(TabControl.
Time of Update: 2016-02-22
標籤:在晚上12點執行任務 using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Diagnostics;using System.Linq;using System.ServiceProcess;using System.Text;using System.IO;namespace WindowsService2{
Time of Update: 2016-03-03
標籤:關於System.Object 所有類型都從System.Object派生而來。 System.Object的公用方法中ToString()一般是返回對象的類型的全名,只有Int32這些類型將其重寫後,新方法才會返回其值的字串表示。 其中還有兩個受保護的方法: MemberwiseClone:深複製。 Finalize:在記憶體回收行程判斷此對象應該被回收後,在對象的記憶體被實際回收前會調用此方法。關於類型判斷和轉換: 用is來判斷對象為某類型或者某類型的衍生類別,是為
Time of Update: 2016-02-29
標籤: class DESHelper { string _iv = "9AUP"; string _key = "9d"; /// <summary> /// DES加密位移量,必須是>=8位長的字串 /// </summary> public string Iv { get { return _iv; } set {
Time of Update: 2016-03-02
標籤: private void button1_Click(object sender, EventArgs e) { //擷取文本 string text = this.txtName.Text; //得到Bitmap(傳入Rectangle.Empty自動計算寬高) Bitmap bmp = TextToBitmap(text, this.txtName.Font,
Time of Update: 2016-02-29
標籤:前言:上一篇博文從原理和定義的角度介紹了C#的委託和事件。本文通過一個簡單的小故事,來說明C#委託與事件的使用方法及其方便之處。在閱讀本文之前,需要你對委託和事件的基本概念有所瞭解。如果你是初次接觸C#的委託與事件,請先閱讀:C#委託與事件初探 好了,故事開始了~ 一.小考拉從前的生活 從前有一隻小考拉,她的生活中只有三樣東西:水,米飯和肉。她渴了就去拿水喝,餓了就去拿米飯和肉吃。而且,米飯和肉一定要一起吃(換作你也不會單吃一種吧^_^),於是代碼是這樣的 1
Time of Update: 2016-03-02
標籤:sed今天一個群友在群裡提問的a.b.c.d.e.f.g正則處理一下變成d.e.f.g總結了幾種方法首先就是cut大法[email protected]:/tmp/tmp# echo a.b.c.d.e.f.g|cut -d"." -f4,5,6,7d.e.f.g絕對好用、但不推薦。。接下來就是sed了,還挺好用的[email protected]:/tmp/tmp# echo a.b.c.d.e.f.g|se
Time of Update: 2016-03-02
標籤: make linuxcd src && make linuxmake[1]: Entering directory `/root/lua/lua-5.3.2/src‘make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"make[2]: Entering directory `/root/lua/lua-5.3.2/src‘gcc -std=gnu99 -O2 -Wall -Wextra
Time of Update: 2016-03-03
標籤:http://coolshell.cn/?s=setjmphttp://www.cnblogs.com/hazir/p/c_setjmp_longjmp.html 1 double divide(double to, double by, jmp_buf env) 2 { 3 if(by == 0) 4 if (env) 5 longjmp(env, 1); 6 else 7 return 0; 8
Time of Update: 2016-03-03
標籤: 【圖一】 【圖二】 【圖三】通過以上三段程式證明逸出序列‘\r’和‘\n’的作用是純粹作用在滑鼠定位上的,即:‘\r’
Time of Update: 2016-02-29
標籤:採用迴圈鏈表,用取餘操作做。(VS2010)#include <stdio.h>#include <stdlib.h>#include "stdafx.h"#include <iostream>typedef struct node{int data;node* next;}node;void CreatList(node*& head, node*& tail, int n){if(n<1){head = tail = NULL;
Time of Update: 2016-02-29
標籤:可能初學大家都對一個程式的登入跳轉會有一定的疑問,我主程式不是登入表單,如何從登入表單調轉到主表單等問題。現在我就貼點實際的項目裡面的代碼看看 1 /// <summary> 2 /// 應用程式的主進入點。 3 /// </summary> 4 [STAThread] 5 static void Main(string[] args) 6 { 7 Application.EnableVisualStyles(); 8