ListView中通過手勢滑出刪除鍵_第1頁
ListView中通過手勢滑出刪除鍵_第2頁
ListView中通過手勢滑出刪除鍵_第3頁
ListView中通過手勢滑出刪除鍵_第4頁
ListView中通過手勢滑出刪除鍵_第5頁
已閱讀5頁,還剩50頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)

文檔簡介

1、linux中,下載完關(guān)機,linux終端播放音樂歌詞同步顯示,ListView中通過手勢滑出刪除鍵,并響應(yīng),List方法subList(fromIndex,toIndex)測試list集合交換元素下標(biāo),lmdb鍵值數(shù)據(jù)庫讀寫測試,lockfree算法多線程下不需要加鎖log4net屏蔽nhibernate日志,Lua中利用元表實現(xiàn)類和多態(tài)Lua文件 common.php 0) $data = fread($fp, $filesize); else $data = false; flock($fp, LOCK_UN); fclose($fp); return $data; else return

2、 false; /* * 創(chuàng)建一個目錄樹 * * 用法: * * mkdirs(/top/second/3rd); * * * param string $dir * param int $mode */ function mkdirs($dir, $mode = 0777) if (!is_dir($dir) mkdirs(dirname($dir), $mode); return mkdir($dir, $mode); return true; /* * 讀取指定緩存的內(nèi)容,如果緩存內(nèi)容不存在或失效,則返回 false * * example: * * $cacheId = my_cach

3、e_id; * if (!($data = FLEA:getCache($cacheId) * $data = Data; * FLEA:writeCache($cacheId, $data); * * * * 如果 $cacheIdIsFilename 參數(shù)為 true,則生成的緩存文件會以 $cacheId 參數(shù)作為文件名。 * 基于安全原因,盡量不要將 $cacheIdIsFilename 參數(shù)設(shè)置為 true。 * * $time 參數(shù)默認(rèn)為緩存內(nèi)容的有效期。其計算依據(jù)是以緩存文件的最后更新時間為準(zhǔn)(也就是最后一次更新該緩存內(nèi)容的時間)。 * * 如果 $timeIsLifetime

4、為 false,則 $time 參數(shù)表示用于和緩存文件最更新時間進(jìn)行比較的依據(jù)。 * 如果 $time 指定的時間早于緩存文件的最后更新時間,則判斷緩存內(nèi)容為有效。 * * param string $cacheId 緩存ID,不同的緩存內(nèi)容應(yīng)該使用不同的ID * param int $time 緩存過期時間或緩存生存周期 * param boolean $timeIsLifetime 指示 $time 參數(shù)的作用 * param boolean $cacheIdIsFilename 指示是否用 $cacheId 作為文件名 * * return mixed 返回緩存的內(nèi)容,緩存不存在或失效則

5、返回 false */ function getCache($cacheId, $time = 900, $timeIsLifetime = true, $cacheIdIsFilename = false) $cacheDir = Root./cache/.substr(md5($cacheId),0,2)./.substr(md5($cacheId),1,2)./; if(!is_dir($cacheDir) mkdirs($cacheDir); if (is_null($cacheDir) return false; if ($cacheIdIsFilename) $cacheFile

6、= $cacheDir . / . preg_replace(/a-z0-9-_/i, _, $cacheId) . .php; else $cacheFile = $cacheDir . / . md5($cacheId) . .php; if (!file_exists($cacheFile) return false; if ($timeIsLifetime & $time = -1) $data = safe_file_get_contents($cacheFile); $hash = substr($data, 16, 32); $data = substr($data, 48);

7、if (crc32($data) != $hash | strlen($hash) != 32) return false; return $data != false ? unserialize($data) : false; $filetime = filemtime($cacheFile); if ($timeIsLifetime) if (time() = $filetime + $time) return false; else if ($time = $filetime) return false; $data = safe_file_get_contents($cacheFile

8、); $hash = substr($data, 16, 32); $data = substr($data, 48); if (crc32($data) != $hash | strlen($hash) != 32) return false; return $data != false ? unserialize($data) : false; /* * 將變量內(nèi)容寫入緩存 * * example: * * $data = .; / 要緩存的數(shù)據(jù),可以是任何類型的值 * / cache id 用于唯一指定一個緩存數(shù)據(jù),以便稍后取出緩存數(shù)據(jù) * $cacheId = data_cahce_1

9、; * FLEA:writeCache($cacheId, $data); * * * param string $cacheId * param mixed $data * param boolean $cacheIdIsFilename * * return boolean */ function writeCache($cacheId, $data, $cacheIdIsFilename = false) $cacheDir = Root./cache/.substr(md5($cacheId),0,2)./.substr(md5($cacheId),1,2)./; if(!is_dir

10、($cacheDir) mkdirs($cacheDir); if (is_null($cacheDir) return false; if ($cacheIdIsFilename) $cacheFile = $cacheDir . / . preg_replace(/a-z0-9-_/i, _, $cacheId) . .php; else $cacheFile = $cacheDir . / . md5($cacheId) . .php; $data = serialize($data); $prefix = ; $hash = sprintf(% 32d, crc32($data); $

11、data = $prefix . $hash . $data; if (!safe_file_put_contents($cacheFile, $data) return false; else return true; /* * 刪除指定的緩存內(nèi)容 * * param string $cacheId * param boolean $cacheIdIsFilename * * return boolean */ function purgeCache($cacheId, $cacheIdIsFilename = false) $cacheDir = Root./cache/.substr(m

12、d5($cacheId),0,2)./.substr(md5($cacheId),1,2)./; if(!is_dir($cacheDir) mkdirs($cacheDir); if (is_null($cacheDir) return false; if ($cacheIdIsFilename) $cacheFile = $cacheDir . / . preg_replace(/a-z0-9-_/i, _, $cacheId) . .php; else $cacheFile = $cacheDir . / . md5($cacheId). .php; if (file_exists($c

13、acheFile) return unlink($cacheFile); return true; ?代碼 db.class.php dbhost:$dbhost; $dbuser=?$dbuser=$this-dbuser:$dbuser; $dbpw=?$dbpw=$this-dbpw:$dbpw; $dbname=?$dbname=$this-dbname:$dbname; if($pconnect) if(!$this-link = mysql_pconnect($dbhost, $dbuser, $dbpw) $this-halt(Can not connect to MySQL s

14、erver); else if(!$this-link = mysql_connect($dbhost, $dbuser, $dbpw) $this-halt(Can not connect to MySQL server); if($this-version() 4.1) if($this-dbcharset) mysql_query(SET character_set_connection=$this-dbcharset, character_set_results=$this-dbcharset, character_set_client=binary, $this-link); if(

15、$this-version() 5.0.1) mysql_query(SET sql_mode=, $this-link); if($dbname) mysql_select_db($dbname, $this-link); function select_db($dbname) return mysql_select_db($dbname, $this-link); function fetch_array($query, $result_type = MYSQL_ASSOC) return mysql_fetch_array($query, $result_type); function

16、fetch_all($query, $result_type = MYSQL_ASSOC) $result = array(); $num = 0; while($ret = mysql_fetch_array($query, $result_type) $result$num+ = $ret; return $result; function fetch_row($query) $query = mysql_fetch_row($query); return $query; function result($query, $row) $query = mysql_result($query,

17、 $row); return $query; function query($sql, $type = ) $func = $type = UNBUFFERED & function_exists(mysql_unbuffered_query) ? mysql_unbuffered_query : mysql_query; if(!($query = $func($sql, $this-link) & $type != SILENT) $this-halt(MySQL Query Error: , $sql); $this-querynum+; return $query; function

18、insert($table,$row) if(!$row)return null; $row = $this-_escape($row); $tmp = $tmp2 = array(); foreach($row as $key = $val) $tmp = $key; $tmp2 = $val; $sql = insert into $table (.join(,$tmp).) values (.join(,$tmp2).); return $this-query($sql); function update($table,$row,$where= null) if(!$row | !$ta

19、ble)return null; $row = $this-_escape($row); $tmp = array(); foreach($row as $key = $val) $tmp = $key.=$val; $sql = update $table set .join(,$tmp).; $sql = $where ? $sql. where .$where:$sql; return $this-query($sql); function find($table,$field = *,$where=null) if(!$table) return null; $sql = $this-

20、bulidsql($table,$field,$where); $query = $this-query($sql); $data = null; while($row = $this-fech($query) $data = $row; return $data; function findOne($table,$field = *,$where=null) if(!$table) return null; $sql = $this-bulidsql($table,$field,$where); return $this-fech($this-query($sql); function bu

21、lidsql($table,$field = *,$where=null) $sql = select .$field. from .$table; $sql = $where ? $sql. where .$where:$sql; $this-sql = $sql; return $sql; function fech($query,$type = MYSQL_ASSOC) return mysql_fetch_array($query, $type); function _escape($row) if(is_array($row) foreach($row as $key = $val)

22、 $row$key = addslashes($val); return $row; function affected_rows() return mysql_affected_rows($this-link); function error() return ($this-link) ? mysql_error($this-link) : mysql_error(); function errno() return intval($this-link) ? mysql_errno($this-link) : mysql_errno(); function num_rows($query)

23、$query = mysql_num_rows($query); return $query; function num_fields($query) return mysql_num_fields($query); function free_result($query) return mysql_free_result($query); function insert_id() return ($id = mysql_insert_id($this-link) = 0 ? $id : $this-result($this-query(SELECT last_insert_id(), 0);

24、 function fetch_fields($query) return mysql_fetch_field($query); function version() return mysql_get_server_info($this-link); function close() return mysql_close($this-link); function halt($message = , $sql = ) echo $message . . $sql; exit; ?代碼 C#代碼 using System;using System.Drawing;using System.Win

25、dows.Forms;using System.Drawing.Drawing2D;namespace MessageBoxDemo public partial class frmShowMessage : Form public frmShowMessage() InitializeComponent(); / / Here I am overriding Paint method of form object / and set its background color as gradient. Here I am / using LinearGradientBrush class ob

26、ject to make gradient / color which comes in System.Drawing.Drawing2D namespace. / / protected override void OnPaint(PaintEventArgs e) Rectangle rect = this.ClientRectangle; LinearGradientBrush brush = new LinearGradientBrush (rect, Color.SkyBlue, Color.AliceBlue, 60); e.Graphics.FillRectangle(brush

27、, rect); base.OnPaint(e); / / setMessage method is used to display message / on form and its height adjust automatically. / I am displaying message in a Label control. / / Message which needs to be displayed to user. private void setMessage(string messageText) int number = Math.Abs(messageText.Lengt

28、h / 30); if (number != 0) this.lblMessageText.Height = number * 25; this.lblMessageText.Text = messageText; / / This method is used to add button on message box. / / MessageButton is type of enumMessageButton / through which I get type of button which needs to be displayed. private void addButton(en

29、umMessageButton MessageButton) switch (MessageButton) case enumMessageButton.OK: /If type of enumButton is OK then we add OK button only. Button btnOk = new Button(); /Create object of Button. btnOk.Text = OK; /Here we set text of Button. btnOk.DialogResult = DialogResult.OK; /Set DialogResult /prop

30、erty of button. btnOk.FlatStyle = FlatStyle.Popup; /Set flat appearance /of button. btnOk.FlatAppearance.BorderSize = 0; btnOk.SetBounds(pnlShowMessage.ClientSize.Width - 80, 5, 75, 25); / Set bounds of button. pnlShowMessage.Controls.Add(btnOk); /Finally Add button control / on panel. break; case e

31、numMessageButton.OKCancel: Button btnOk = new Button(); btnOk.Text = OK; btnOk.DialogResult = DialogResult.OK; btnOk.FlatStyle = FlatStyle.Popup; btnOk.FlatAppearance.BorderSize = 0; btnOk.SetBounds(pnlShowMessage.ClientSize.Width - 70), 5, 65, 25); pnlShowMessage.Controls.Add(btnOk); Button btnCanc

32、el = new Button(); btnCancel.Text = Cancel; btnCancel.DialogResult = DialogResult.Cancel; btnCancel.FlatStyle = FlatStyle.Popup; btnCancel.FlatAppearance.BorderSize = 0; btnCancel.SetBounds(pnlShowMessage.ClientSize.Width - (btnOk.ClientSize.Width + 5 + 80), 5, 75, 25); pnlShowMessage.Controls.Add(b

33、tnCancel); break; case enumMessageButton.YesNo: Button btnNo = new Button(); btnNo.Text = No; btnNo.DialogResult = DialogResult.No; btnNo.FlatStyle = FlatStyle.Popup; btnNo.FlatAppearance.BorderSize = 0; btnNo.SetBounds(pnlShowMessage.ClientSize.Width - 70), 5, 65, 25); pnlShowMessage.Controls.Add(btnNo); Button btnYes = new Button(); btnYes.Text = Yes; btnYes.DialogResult = DialogResult.Yes; btnYes.FlatStyle = FlatStyle.Popup; btnYes.FlatAppearance.BorderSize = 0; btnYes.SetBounds

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論