2015年1月31日 星期六

Unable to create '/.git/index.lock': File exisit

正在 commit 的時候取消,結果發現這個  error,或許其他方式也會產生

這時只需要到 ../.git/ 刪除 index.lock 即可 commit

或者是 rm -f ./.git/index.lock

2015年1月7日 星期三

CSS cellpadding & cellspacing

對我來說,這兩個東西在工作時,時常讓我搞混。所以才寫這篇分析並且記錄。

在 HTML 5 的話,如果不是把 這兩標籤改成 CSS 的話,會被提示已過期或是非法的標籤

現在來看使用方法


未分離的寫法

                              cellpadding 表示 td 內與字元間的間距
                              cellspacing  表示 td 與 td 間的間距

分離寫法
                              在 CSS 寫法中更改成 border-collapse
separate默認,邊框會被分開。不會忽略 border-spacing 和 empty-cells 属性。
collapse將邊框合為單一。會忽略 border-spacing 和 empty-cells 属性。

引用來源3 的 圖片說明


資料來源

2014年10月28日 星期二

SQL Error 1175

Error Code: 1175.
You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Queries and reconnect.

MySQL Workbench 的安全設置

  1. Edit -> Preferences
  2. 新版都在 SQL Queries -> General
  3. 把 "Safe Updates". XXXXXXX 的勾勾取消掉,即可完成

VirtualBox uuid error

 使用 VirtualBox 可能會有誤刪裝置,導致必須重新新增一個系統。當系統有 Snapshot 但卻因為誤刪裝置導致 Snapshot 無法使用,從盲更改 .vbox 或是 .VirtualBox\VirtualBox.xml 導致 uuid error。

VirtualBox 提供一個 CloneVDI tool,能夠把 .VMDK、.VHD 、.VMDK 產出一個 .VDI 讓使用者可以新增的時候掛載它。


CloneVDI

2014年9月21日 星期日

var_dump fun function

var_dump 是 類似於 print_r 的 function

不過相較之下

var_dump 會幫你把它 陣列化

void var_dump ( mixed $expression [, mixed $... ] )


2014年5月1日 星期四

CodeIgniter 分頁

CI 裡面就有一個 library 叫 Pagination ,在 system/librarie/Pagination.php

現在來講一下用法

先說明 all_query 的函數定義,all_query($limit, $offset, $direction)

$this->load->helper('url');

$this->load->library('pagination');

$this->load->model('users_sql'); //呼叫model用來取資料

$query = $this->users_sql->all_query(null, null, 'ASC'); //抓取全部資料

//開始 pagination 的設定

$config['base_url'] = site_url()."/admin/users/"; //指向 admin(class) 的 users(function)

$config['total_rows'] = $query->num_rows(); //回傳資料總比數,切割有幾頁

$config['per_page'] = 10; //一頁只有 10 筆

$config['num_links'] = 2; //前後的頁碼 ex:  當前頁碼如果是 5,會顯示為 34567 的頁碼數

$config['uri_segment'] = 3; //這是個很重要東西,會抓取 URL 並切割,例如 http://localhost/CI/admin/users/10,會切割成 admin、users、10
 
 
$this->pagination->initialize($config);
 
$data = array(
                "records" => $this->users_sql->all_query($config['per_page'], $this->uri->segment(3), 'ASC')->result_array()
        );


就樣就可以使用分頁了,搜尋分頁,會比較複雜...之後再補充

$this->uri->segment(3) 很重要,是擷取網頁的區塊三,然後傳送到model抓取資料!!

phpmyadmin 結構錯誤


我也有看一下,似乎他錯誤是因為 AJAX 傳送的 JSON 有錯誤