boscowang 's Profile

Member since Oct 18, 2008, follows 0 people, 0 public groups, 706 public bookmarks (1306 total).

More »
Tags

Recent Tags:
Top Tags:

More »
Recent Bookmarks and Annotations

  • 多肉リスト1 on 2009-11-23
  • Brian notepad: perl 中文 string split by use encoding big5 on 2009-11-18
    • perl 中文 string split by use encoding big5




      Perl 處理中文, 加入

      use encoding big5;
      $string="中文成功123";
      後, split(//,$string); 即可拆成 "中","文","成","功","1","2","3"

      若是從資料庫取得的字串, 可試試
      $string=decode("big5", $string);
      再做 @str=split(//,$string);

  • EvoTalk » Blog Archive » perl 編碼 on 2009-11-17
      • use Encode qw/from_to/;


      • from_to($data, "big5", "utf8");
  • Conversion of CSV file to hash table using perl - Perl answers on 2009-11-17
    • ################################################## #####################

      # Name : read_csv

      #

      # Description : Reads csv file into hash array

      #

      # In : csv file name, filed separation key (; in most cases)

      #

      # Out : hash array

      ################################################## #####################

      sub read_csv {

      my $csv_file = shift;

      my $separator = shift;


      my %hash=();

      my @labels;

      my @lines;

      my $col_count = 0;

      my $row = 0;

      my ($line,$odd,$item,$data);


      if (open(CSV,$csv_file)) {


      while (<CSV>) {

      # remove leading and trailing spaces

      $_ = trim($_);

      #skip emty lines

      next if /^$/;

      # copy next line

      $line .= $_;


      # if the line has an odd number of double qoutes it will concatenate the

      # following lines until an od number of qoutes are encountered again.

      if ((not $odd and /^[^"]*"[^"]*(?>[^"]*"[^"]*"[^"]*)*[^"]*$/) or # Regexp: test if even number of double qoutes

      ($odd and /^[^"]*(?>[^"]*"[^"]*"[^"]*)*[^"]*$/)) { # Regexp: test if odd number of double qoutes

      $odd = 1;

      # keep new line

      $line .= " ";

      next;

      }

      # reset column counter

      $col_count = 0;

      # remove carriage if any and linefeed from end

      $line =~ s/\r?\n$//;

      # split on separator if followed by an odd number of double qoutes

      foreach $item (split /$separator(?=(?>[^"]*"[^"]*"[^"]*)*[^"]*$)/, $line, 100000) {


      # remove leading and trailing spaces

      $item = trim($item);

      # remove last new line

      $item =~ s/\s"$/"/;


      # skip first line of labels

      if ($row > 0) {

      $hash{$row}{$labels[$col_count++]} = $item;

      } else {

      push (@labels,$item);

      }


      }

      $row++;

      undef $line;

      undef $odd;

      }

      close (CSV);

      } else {

      print_log("$csv_file: $!");

      die ("$csv_file: $!");

      }

      return (\@labels,\%hash);

      }
  • Ruslan's blog: Function List for Notepad 5.x Unicode on 2009-11-05
  • Unix Crontab - setting up cron jobs using crontab on 2009-11-04
    • Crontab
      syntax :-

      A crontab file has five fields for specifying day , date and time  followed
      by the command to be run at that interval.



      *     *   *   *   
      *  command to be executed

      -     -    -    -   
      -

      |     |     |    
      |     |

      |     |     |    
      |     +----- day of week (0 - 6) (Sunday=0)

      |     |     |    
      +------- month (1 - 12)

      |     |     +--------- day of month
      (1 - 31)

      |     +----------- hour (0 - 23)

      +------------- min (0 - 59)

       
  • PHP- Adding And Subtracting Dates on 2009-10-23
  • Dates in PHP and MySQL on 2009-10-23
    • $mysqldate = date( 'Y-m-d H:i:s', $phpdate );
      $phpdate = strtotime( $mysqldate );
  • Soulful Lyrics! on 2009-10-16
  • TAYLOR JAMES // Creative Production Studio // REALWorldRendering™ on 2009-10-02

More »
Bookmark Lists

Highlighter, Sticky notes, Tagging, Groups and Network: integrated suite dramatically boosting research productivity. Learn more »

Join Diigo