Time of Update: 2018-12-08
1.scanf("%s",str)和gets(str)scanf("%s",str)和gets(str)均可用於輸入字串到字元陣列變數str,但scanf("%s",str)唯讀到輸入字元的空格或斷行符號處,而gets(str)讀到斷行符號處結束,所以當句子中單詞由空格分開時要用後者來輸入,如所示:需要強調一點,scanf("%s",str)在遇到'\n'(斷行符號)或' '(空格)時輸入結束,但'\n'(斷行符號)或' '(空格)停留在出入緩衝區,如處理不慎會影響下面的輸入;gets(str)
Time of Update: 2018-12-08
a、List<>泛型集合 複製代碼 代碼如下:View Code using System; using System.Collections.Generic; namespace _02_泛型集合 { class Person { public Person(string name, int age) { this .name = name; this .age = age; } private string name; public string Name { get {
Time of Update: 2018-12-08
快速鍵輔助類 複製代碼 代碼如下:class HotKey { /// <summary> /// 如果函數執行成功,傳回值不為0。 /// 如果函數執行失敗,傳回值為0。要得到擴充錯誤資訊,調用GetLastError。.NET方法:Marshal.GetLastWin32Error() /// </summary> /// <param name="hWnd">要定義熱鍵的視窗的控制代碼</param> /// <param name="
Time of Update: 2018-12-08
自己寫一個類模仿Dictionary實現 a、自訂字典類MyDic 複製代碼 代碼如下:using System.Collections.Generic; namespace _10_自己寫Dictionary { class KeyValuePair { public KeyValuePair() { } public KeyValuePair(string key, string value) { this.key = key; this.value = value; } private
Time of Update: 2018-12-08
需求winForm 程式輸出類型為 windows 程式(不是命令列程式)在運行時想輸入一些資訊編譯開發調試,如何?這一功能解答:AllocConsole、FreeConsole 這兩個 API 可以在任何時候調用和關閉 命令列。代碼示範:API 部分複製代碼 代碼如下:using System.Runtime.InteropServices;namespace WindowsFormsApplication1{ public partial class NativeMethods
Time of Update: 2018-12-08
情境還原: 公司一項目新上線,剛上線的第2天,在後台探索資料程式庫伺服器與IIS伺服器的網路IO出現瓶頸,1GB的網路頻寬,佔用了70%-100%,也就是每秒傳輸資料700MB-1GB,資料庫使用記憶體高達21GB。 IIS伺服器CPU使用率時常爆至80%-90%,導致網站頻頻出現連線逾時。 原因:晚上只好暫時關閉網站,進行伺服器維護,作全面的檢查跟蹤,發現是一句Select語句導致: Select * From Table1 這條語句,文法是沒問題的,但在應用上出了問題。Table1儲存的是1
Time of Update: 2018-12-08
複製代碼 代碼如下:private void button1_Click(object sender, EventArgs e) { string s = textBox1.Text.ToString(); bool b = ValidateDataTime(s); string rs = ""; if (b) { rs = "true";
Time of Update: 2018-12-08
複製代碼 代碼如下:<AspNet:AspNetPager ID="AspPages" runat="server" CustomInfoHTML="第%CurrentPageIndex%/%PageCount%頁,每頁%PageSize%條,共%RecordCount%條" FirstPageText="首頁" LastPageText="尾頁" NextPageText="下一頁" AlwaysShow="true"
Time of Update: 2018-12-08
RepeaterRepeater(foreach)用於對綁定資料來源中的資料進行遍曆並按格式顯示,每條資料以什麼格式顯示是由Repeater的<ItemTemplate>來決定的,模板會多次顯示,就像foreach, ItemTemplate 中相當於{}中的語句。<ItemTemplate>姓名:<%#Eval(“Name”)%><b>年齡:<%#Eval(“Age”)%></b><br
Time of Update: 2018-12-08
集合常用操作添加、遍曆、移除 命名空間System.Collections ArrayList 可變長度數組,使用類似於數組 屬性 Capacity Count 方法 Add() AddRange() Remove() RemoveAt() Clear() Contains() ToArray() Hashtable 索引值對(KeyValuePair)的集合,類似於字典 a、ArrayList對實值型別的操作 複製代碼 代碼如下:using System; using
Time of Update: 2018-12-08
$(document).ready( function(){});function hiden(){$("#divObj").hide();//hide()函數,實現隱藏,括弧裡還可以帶一個時間參數(毫秒)例如hide(2000)以2000毫秒的速度隱藏,還可以帶slow,fast}function slideToggle(){$("#divObj").slideToggle(2000);//窗帘效果的切換,點一下收,點一下開,參數可以無,參數說明同上}function show(){$("#
Time of Update: 2018-12-08
今天在使用innerText時遇到一個相容性問題,FireFox不支援innerText方法,查了下MDN,發現FireFox下有個類似的方法,叫textContent,它和IE的innerText類似, 都是用來擷取(設定)元素中text的方法。文法 •設定 複製代碼 代碼如下:element.textContent = “text”; •擷取 複製代碼 代碼如下:var text = element.textContent; 複製代碼 代碼如下:Note:
Time of Update: 2018-12-08
1、Case 子查詢串連查詢複製代碼 代碼如下:select * from score create database demo use demo create table [user] ( [uId] int identity( 1 ,1 ) primary key, [name] varchar ( 50), [level] int --1骨灰大蝦菜鳥 ) insert into [user] ( name, level ) values (' 犀利哥 ', 1 ) insert into
Time of Update: 2018-12-08
方法一:res/values檔案夾下建立styles.xml:複製代碼 代碼如下:<?xml version=“1.0″ encoding=“utf-8″?> <style name="translucent"><item name="android:windowBackground">@color/translucent_background</item><item
Time of Update: 2018-12-08
最近一直在忙著建站,可是做好之後,又感覺不是那麼的盡如人意,還要有些許的調動,根據地區不同,而查看不同的網站頁面,由於我產生的頁面都是靜態,著實有些為難的,以前也有發表過一些這方面的文章,但感覺還是挺麻煩的,況且也達不到令自己滿意的效果,所以,在朋友的協助下,找到一個比較方便的方法,就是把以下代碼,加入我們自己需要跳轉的頁面裡,這樣做還是不錯的呢! 複製代碼 代碼如下:<script src="http://counter.sina.com.cn/ip"
Time of Update: 2018-12-08
基於網路改進為:最正常版本複製代碼 代碼如下:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
Time of Update: 2018-12-08
今天在開發系統的時候,需要實現這樣一個功能 根據選中的日期,查詢相關的內容,但不是按照整個日期去過濾,而是根據,年,月,日拆分的形式去過濾,比如2013年的,2月份的 在sqlserver中,我們可以可以直接根據datePart去完成即可 select * from pays where 1=1 and datepart(year, pdate)=2013 and datepart(month, pdate)=2 and datepart(day, pdate)=26
Time of Update: 2018-12-08
JQuery真的太強大了,真好看!Jquery代碼如下:複製代碼 代碼如下: $(function () { $(".n_zyb_gzright .n_zyb_gzrightlist").hover(function () { $(this).find(".n_zyb_gzrightlistc").attr("style",
Time of Update: 2018-12-08
自從2.0版本的net framework推出之後泛型(Generic)得到了廣泛好評。它不必像object類型一樣效能上因為“拆箱”或者“裝箱”得到損失,同時在編譯文法檢測階段就可以即時檢測出傳入或者傳出的類型是否符合特定條件。 但“金無赤足,人無完人”——在我們享受這些幸福編程的同時,泛型自身類型的不確定也帶來了一個顯著的問題——無法進行運算子多載。譬如現在我要寫一個函數(一個通用的選擇排序演算法,使用泛型T),該怎麼辦呢?如果你簡單使用這樣的代碼(C#如下):複製代碼 代碼如下://
Time of Update: 2018-12-08
有時使用HttpWebRequest對象會出現錯誤,總結有三種: 1、System.Net.WebException: 伺服器提交了協議衝突. Section=ResponseStatusLine 2、System.Net.WebException: 基礎串連已經關閉: 串連被意外關閉。 3、System.Net.ProtocolViolationException: 無法發送具有此謂詞類型的內容本文。 使用TcpClient對象搞定: 複製代碼 代碼如下:private string