PHP.INI 打開DeBug模式
你學PHP 應該是PHP5 , 所以預設都會把錯誤訊息關起來, 我還是習慣把他打開. 
你可以研究看看看 PHP.INI 這個設定檔 內的error_reporting 跟DISPLLY_ERRORS 二個 設定值. 我習慣的設定是用下面這個. 
error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED 
display_errors = On

zer931 發表在 痞客邦 留言(0) 人氣()

from http://blog.xuite.net/ahdaa/blog1/34061193
 
這兩個是Javascript的特殊資料類型 

zer931 發表在 痞客邦 留言(0) 人氣()

Zend Debugger Socket link error
錯誤訊息
<b>Fatal error</b>:  Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/usr/local/zend/mysql/tmp/mysql.sock'
解法一

zer931 發表在 痞客邦 留言(0) 人氣()


phpMyAdmin sql query that uses parameters


set
@id:=123;
SELECT*FROM users u WHERE u.ID =@id;

zer931 發表在 痞客邦 留言(0) 人氣()

懶了整理 哈哈 先記錄網址就好
 
Jax 的工作紀錄
http://jax-work-archive.blogspot.tw/search/label/PDO

zer931 發表在 痞客邦 留言(0) 人氣()

 
測試一
find ./-name *.m -print0 | xargs -0 genstrings -o en.lproj

zer931 發表在 痞客邦 留言(0) 人氣()

實作 TableView Section 展開/收合
 from http://blog.yslin.tw/2011/09/tableview-section.html
iPhone中的UITableViewController變化真的很多!
最近剛好需要實作展開/收合的功能,效果如圖所示:



我是參考Expanding/Collapsing TableView Sections的實作,然後在自己簡化。
一個展開/收合的單位為一個Section,Row0表示Parent,Row1~N表示Child,程式碼中都有註解。


  • testTableViewController.h












  • 1

    2

    3

    4

    5

    6

    7

    8



    #import <uikit uikit.h="">

     

    @interface MoodDiaryViewController : UITableViewController {

     /* Store the indexpath which already expanded */

     NSMutableIndexSet *expandedSections;

    }

    @end

    </uikit>







  • testTableViewController.h












  • 1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    37

    38

    39

    40

    41

    42

    43

    44

    45

    46

    47

    48

    49

    50

    51

    52

    53

    54

    55

    56

    57

    58

    59

    60

    61

    62

    63

    64

    65

    66

    67

    68

    69

    70

    71

    72

    73

    74

    75

    76

    77

    78

    79

    80

    81

    82

    83

    84

    85

    86

    87

    88

    89

    90

    91

    92

    93

    94

    95

    96

    97

    98

    99

    100

    101

    102

    103

    104

    105

    106

    107

    108

    109

    110

    111

    112

    113

    114

    115

    116

    117

    118

    119

    120

    121

    122

    123

    124

    125

    126

    127

    128



    #import "testTableViewController.h"

     

    @implementation MoodDiaryViewController

     

    #pragma mark -

    #pragma mark View lifecycle

     

    - (void)viewDidLoad {

        [super viewDidLoad];

     

     if (!expandedSections)

        {

            expandedSections = [[NSMutableIndexSet alloc] init];

        }

    }

     

     

    #pragma mark -

    #pragma mark Table view data source

     

    - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {

        // Return the number of sections.

        return 3;

    }

     

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {

        /* Return the number of rows in the section. */

     if ([expandedSections containsIndex:section]) {

      /* Return all rows when expanded */

      return 5;

     } else {

      /* Only top row showing */

      return 1;

     }

    }

     

     

    // Customize the appearance of table view cells.

    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%d_%d", indexPath.section, indexPath.row];

     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

      

     if (indexPath.row == 0) {

      /* Parent cell */

      if (cell == nil)

       cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];

       

      /* Change UI status */

      if ([expandedSections containsIndex:indexPath.section]) {

       cell.textLabel.text = [NSString stringWithFormat:@"- Section=%d Row=%d", indexPath.section, indexPath.row];

      } else {

       cell.textLabel.text = [NSString stringWithFormat:@"+ Section=%d Row=%d", indexPath.section, indexPath.row];

      }

       

     } else {

      /* Child cell */

      if (cell == nil)

       cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];

       

      cell.textLabel.text = [NSString stringWithFormat:@"Section=%d Row=%d", indexPath.section, indexPath.row];

     }

     

        return cell;

    }

     

     

    #pragma mark -

    #pragma mark Table view delegate

     

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

     /* If user choose the parent row */

     if (indexPath.row == 0) {

      NSInteger section = indexPath.section;

      BOOL currentlyExpanded = [expandedSections containsIndex:section];

      NSInteger rows;

      NSMutableArray *arrRows = [NSMutableArray array];

       

      if (currentlyExpanded) {

       /* Child cell for this parent */

       rows = [self tableView:tableView numberOfRowsInSection:section];

       [expandedSections removeIndex:section];

      } else {

       [expandedSections addIndex:section];

       rows = [self tableView:tableView numberOfRowsInSection:section];

      }

     

      /* Create child index path. Child path start frow index one */

      for (int i = 1; i < rows; i++) {

       NSIndexPath *tmpIndexPath = [NSIndexPath indexPathForRow:i inSection:section];

       [arrRows addObject:tmpIndexPath];

      }

     

      UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

       

      /* Remove of insert above index path into tableview */

      if (currentlyExpanded) {

       [tableView deleteRowsAtIndexPaths:arrRows withRowAnimation:UITableViewRowAnimationTop];

       cell.textLabel.text = [NSString stringWithFormat:@"+ Section=%d Row=%d", indexPath.section, indexPath.row];

      } else {

       [tableView insertRowsAtIndexPaths:arrRows withRowAnimation:UITableViewRowAnimationTop];

       cell.textLabel.text = [NSString stringWithFormat:@"- Section=%d Row=%d", indexPath.section, indexPath.row];

      }

       

     } else { // For choosing child row

      ;

     }

    }

     

     

    #pragma mark -

    #pragma mark Memory management

     

    - (void)didReceiveMemoryWarning {

        // Releases the view if it doesn't have a superview.

        [super didReceiveMemoryWarning];

         

        // Relinquish ownership any cached data, images, etc. that aren't in use.

    }

     

    - (void)viewDidUnload {

        // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.

        // For example: self.myOutlet = nil;

    }

     

    - (void)dealloc {

        [super dealloc];

    }

    @end





     

    zer931 發表在 痞客邦 留言(0) 人氣()

    分享一个搭建php版push服务器的流程
    from http://www.cocoachina.com/bbs/read.php?tid-30410.html
     

    zer931 發表在 痞客邦 留言(0) 人氣()

    Push pem文件生成步骤
    from http://www.ixiaohuaxiaocao.net/2012/push-pem%E6%96%87%E4%BB%B6%E7%94%9F%E6%88%90%E6%AD%A5%E9%AA%A4
     

    zer931 發表在 痞客邦 留言(0) 人氣()

    mac  eclipse 設定php debugger 
     
    設定php debug 有兩種
    第一種是zender debug

    zer931 發表在 痞客邦 留言(0) 人氣()

    本文引用自austintodo - php - MySQL 教
    這邊有個php mysql 教學的網站


    http://www.php-mysql-tutorial.com/



    zer931 發表在 痞客邦 留言(0) 人氣()

    (JavaScript) checkbox全選範例
    from http://www.wretch.cc/blog/persongood/14193719
    最近實在是太忙了,幾乎每天都八點多才回家,回到家差不多九點了!
    回來都是累趴在地上,真是忙忙忙啦,太久沒作筆記了!今天來作個我之前用到的check全選作法

    這都在網路上找的,當然是可以使用啦!不過我還要搭配PHP下去使用,才是我要的結果! 
    第一種:勾選checkbox才能全選

    <script language="JavaScript">
    function CheckAll() { 
    var ck = document.form.elements["c1[]"]; 
    var ckAll = document.form.allbox; 
    if (!ck) { //當沒有checkbox時 
    ckAll.checked = false; 
    } else if (!ck.length) { //當只有一個checkbox時 
    ck.checked = ckAll.checked; 
    } else { //當有兩個以上的checkbox時 
    for (var i=0;i<ck.length;i++) 
    ck[i].checked = ckAll.checked; 
    } 
    } 
    </script>
    <form name="form">
    <input type="checkbox" name="allbox" onclick="CheckAll()">全選<br> 
    <input type="checkbox" name="c1[]" value="1"><br>
    <input type="checkbox" name="c1[]" value="2"><br> 
    <input type="checkbox" name="c1[]" value="3"><br> 
    <input type="checkbox" name="c1[]" value="4"><br> 
    <input type="checkbox" name="c1[]" value="5"><br> 
    </form>


    第二種:全選,取消,反向選取都分開按(就跟yahoo的信箱全選是一樣的)

    <script type="text/javascript">
    <!--
    function selAll(){
    //變數checkItem為checkbox的集合
    var checkItem = document.getElementsByName("c1");
    for(var i=0;i<checkItem.length;i++){
    checkItem[i].checked=true; 


    function unselAll(){
    //變數checkItem為checkbox的集合
    var checkItem = document.getElementsByName("c1");
    for(var i=0;i<checkItem.length;i++){
    checkItem[i].checked=false;


    function usel(){
    //變數checkItem為checkbox的集合
    var checkItem = document.getElementsByName("c1");
    for(var i=0;i<checkItem.length;i++){
    checkItem[i].checked=!checkItem[i].checked;


    //-->
    </script>

    <input TYPE="checkbox" name="c1"> 
    <input TYPE="checkbox" name="c1"> 
    <input TYPE="checkbox" name="c1"> 
    <input TYPE="checkbox" name="c1"> 
    <input type="checkbox" name="c1"> 
    <input type="checkbox" name="c1"> 
    <input type="checkbox" name="c1"> 
    <input type="checkbox" name="c1"> 
    <br> 
    <input type="button" value="全選" onclick="selAll();">
    <input type="button" value="全取消" onclick="unselAll();">
    <input type="button" value="反向選取" onclick="usel();">

    zer931 發表在 痞客邦 留言(0) 人氣()

    Blog Stats
    ⚠️

    成人內容提醒

    本部落格內容僅限年滿十八歲者瀏覽。
    若您未滿十八歲,請立即離開。

    已滿十八歲者,亦請勿將內容提供給未成年人士。