PIXNET Logo登入

逗點大的雨滴

跳到主文

工作日記、心情日記

部落格全站分類:心情日記

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 4月 06 週日 201418:05
  • Android Hello

Q:
[2014-04-06 14:52:47 - HelloWord] No Launcher activity found!
[2014-04-06 14:52:47 - HelloWord] The launch will only sync the application package on the device!
Ans:
(繼續閱讀...)
文章標籤

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

  • 個人分類:Android
▲top
  • 2月 21 週四 201310:32
  • 2013面試之旅-1-x鴻(監視系統)

筆試:
1. C語言
題目1: 程式填空




//Descript: str_parser used for parse src string into toke array


//Parameter: src = source string


//                   dst_token = save token string


//                   max_token_count


int str_parser(const char *src, char *dst_token[]; int max_token_count) {


         // You shall use malloc space to save token string


        return 0;


}


 


int main(){


    char *src = "aa bb  ccc";


    char *dst_token[];


    // Call strparser function


    return 0;


}


 





(繼續閱讀...)
文章標籤

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

  • 個人分類:Interview
▲top
  • 7月 19 週四 201217:04
  • bat批次檔

1. 取得使用者輸入的參數
     SET /P VAR1=請輸入Ruby code file path:
2.類似註解
(繼續閱讀...)
文章標籤

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

  • 個人分類:window系統
▲top
  • 6月 20 週三 201211:21
  • 查出電腦佔port的程式pid

netstat -ano:可以查出現在程式使用中的ip port和使用的程式
Note: 迅雷會佔用80 port
 




C:\Users\Genie>netstat -ano


使用中連線


協定 本機位址 外部位址 狀態 PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 3696
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 708
TCP 0.0.0.0:443 0.0.0.0:0 LISTENING 3696
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
TCP 0.0.0.0:3300 0.0.0.0:0 LISTENING 1216
TCP 0.0.0.0:3389 0.0.0.0:0 LISTENING 1312
TCP 0.0.0.0:42702 0.0.0.0:0 LISTENING 3696
TCP 0.0.0.0:49152 0.0.0.0:0 LISTENING 812
TCP 0.0.0.0:49153 0.0.0.0:0 LISTENING 900
TCP 0.0.0.0:49154 0.0.0.0:0 LISTENING 1080
TCP 0.0.0.0:49157 0.0.0.0:0 LISTENING 912
TCP 0.0.0.0:49158 0.0.0.0:0 LISTENING 920
TCP 0.0.0.0:50446 0.0.0.0:0 LISTENING 4440
TCP 127.0.0.1:5939 0.0.0.0:0 LISTENING 2124
TCP 127.0.0.1:8888 0.0.0.0:0 LISTENING 1660
TCP 127.0.0.1:49155 127.0.0.1:49156 ESTABLISHED 2124
TCP 127.0.0.1:49156 127.0.0.1:49155 ESTABLISHED 2124
TCP 127.0.0.1:49495 127.0.0.1:49496 ESTABLISHED 3292
TCP 127.0.0.1:49496 127.0.0.1:49495 ESTABLISHED 3292
TCP 127.0.0.1:53399 0.0.0.0:0 LISTENING 1872


 


(繼續閱讀...)
文章標籤

= = 發表在 痞客邦 留言(0) 人氣(7,144)

  • 個人分類:window系統
▲top
  • 5月 08 週二 201210:54
  • ruby - create directory

建立目錄
 




def create_default_dir folder
   if !Dir.exist?(folder)
      puts "%s%s" % ["Folder name = ",folder]
      Dir.mkdir(folder, 0777)
   else
      puts "Folder exist"
   end
end


def main


   create_default_dir 'rpt'


end


 


 if __FILE__ == $0
   main
end


(繼續閱讀...)
文章標籤

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

  • 個人分類:ruby
▲top
  • 4月 30 週一 201211:17
  • ruby - log file

 
傳進function裡的參數,若不固定數量,則可用*來指定參數
 




def write_log(*elements)
puts elements[0],elements[1],elements[2][0],elements[2][1],elements[3];
end


=begin
ary = Array.new(3)
ary = [1,2,3,4]
write_log(ary)
=end
a="a"
b="b"
c="c"
ary = Array.new(3)
ary = [1,2,3,4]
write_log(a,b,ary,c)


 


(繼續閱讀...)
文章標籤

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

  • 個人分類:ruby
▲top
  • 4月 30 週一 201210:43
  • c - 進制轉換

以下:
8進制轉10進制
16進制轉10進制
 
(繼續閱讀...)
文章標籤

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

  • 個人分類:c
▲top
  • 4月 26 週四 201216:13
  • ruby - hadle excel file (xls)

 
sample code 
 




=begin
Spreadsheet library
Ref. http://spreadsheet.rubyforge.org/GUIDE_txt.html
=end
require 'spreadsheet'


file_name='C:/Ruby192/atm_ruby/practice_myself/access_xls/test2.xls'


=begin
Write data into excel
=end


book = Spreadsheet::Workbook.new(file_name)


##########################################
#
# Create a Worksheet with the Name
#
##########################################
# method 1
sheet1 = book.create_worksheet
sheet1.name = 'My First Worksheet'
# method 2
sheet2 = book.create_worksheet :name => 'My Second Worksheet'


##########################################
#
# Add data into the Worksheet
# Method: 1.concat
# 2.push
# 3.replace
# 4.update_row
##########################################
# About concat->Concatenates Concatenates the given object to str
sheet1.row(0).concat %w{Name Country Acknowlegement}
sheet1[1,0] = 'Japan'
row = sheet1.row(1)
row.push 'Creator of Ruby'
# About: unshift->Prepends objects to the front of self, moving other elements upwards.
row.unshift 'Yukihiro Matsumoto'
sheet1.row(2).replace [ 'Daniel J. Berger', 'U.S.A.',
'Author of original code for Spreadsheet::Excel' ]
sheet1.row(3).push 'Charles Lowe', 'Author of the ruby-ole Library'
sheet1.row(3).insert 1, 'Unknown'


sheet1.update_row 4, 'Hannes Wyss', 'Switzerland', 'Author'
##########################################
#
# Add font format
#
##########################################
sheet1.row(0).height = 18


format = Spreadsheet::Format.new :color => :blue,
:weight => :bold,
:size => 18
sheet1.row(0).default_format = format


bold = Spreadsheet::Format.new :weight => :bold
4.times do |x|
sheet1.row(x + 1).set_format(0, bold)
end


# Write excel
book.write(file_name)


=begin
Parse excel data
=end


book = Spreadsheet.open file_name


# Select worksheet
# method 1
sheet1 = book.worksheet 0
# method 2
sheet2 = book.worksheet 'My Second Worksheet'


sheet1.each do |row|
puts "%s %s\n" % [row[0],row[1]]
end


printf "\n\n\n"


sheet1.each 1 do |row|
puts "%s %s\n" % [row[0],row[1]]
end


 


(繼續閱讀...)
文章標籤

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

  • 個人分類:ruby
▲top
  • 4月 16 週一 201210:23
  • Linux - 壓縮、解壓縮

解壓縮 tar.gz     =>     tar -zxvf filename.tar.gz

壓縮 tar.gz       =>      tar -zcvf filename.tar.gz /folder

解壓縮 tar.bz2   =>     tar -jxvf filename.tar.bz2
(繼續閱讀...)
文章標籤

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

  • 個人分類:linux
▲top
  • 9月 01 週四 201118:02
  • c - 關於ip (16進轉10進轉字串)

 





include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <linux/types.h> 
#include <sys/socket.h>
#include <string.h>
#include <sys/types.h>
#include <netinet/in.h>
#define IP_STR "10.0.41.0" 
typedef     unsigned char           u8; 
typedef struct {
    u8      version;            // 4 for IPv4, 6 for IPv6
    u8      address[16];        // pad zero for IPv4
} ipAddress_t;
void dec_to_ip(int32_t snmp_ip, char *ipv4)
{
    int ip3;
    int ip2;
    int ip1;
    int ip0;
    ip3 = (snmp_ip >> 24) & 255;
    ip2 = (snmp_ip >> 16) & 255;
    ip1 = (snmp_ip >>  8) & 255;
    ip0 = (snmp_ip      ) & 255;
    sprintf(ipv4,"%d.%d.%d.%d", ip0, ip1, ip2, ip3);
}
int main(char *args, int argc){
    ipAddress_t    r_ip;
    ipAddress_t    router_ip;
    char ipv4_str[32];
    struct in_addr    router_addr;
    memset(&r_ip, 0x00, sizeof(ipAddress_t));
    memset(&router_ip, 0x00, sizeof(ipAddress_t));
    r_ip.version                     = 4;
    inet_pton(AF_INET, IP_STR, r_ip.address);
    memcpy(&router_addr, r_ip.address, 4);
    /* dec format*/
     printf("ip %d\n",router_addr.s_addr);
    /* string format*/
    dec_to_ip(router_addr.s_addr,ipv4_str);
    printf("ip %s\n",ipv4_str);


    return 0;
}





(繼續閱讀...)
文章標籤

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

  • 個人分類:c
▲top
12...4»

個人資訊

= =
暱稱:
= =
分類:
心情日記
好友:
累積中
地區:

最新文章

  • Android Hello
  • 2013面試之旅-1-x鴻(監視系統)
  • bat批次檔
  • 查出電腦佔port的程式pid
  • ruby - create directory
  • ruby - log file
  • c - 進制轉換
  • ruby - hadle excel file (xls)
  • Linux - 壓縮、解壓縮
  • c - 關於ip (16進轉10進轉字串)

文章分類

  • Android (1)
  • Interview (1)
  • window系統 (2)
  • ruby (3)
  • linux (2)
  • perl (3)
  • shell (3)
  • web programer (6)
  • c (12)
  • 未分類文章 (1)

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣:

熱門文章

  • (1,145)fork of C language
  • (221)socket and select chart communication
  • (202)semaphore multiprocess access the same share memory
  • (116)thread of C language
  • (66)javascript 防右鍵
  • (41)fixed location text with scroll bar of windows in CSS
  • (23)student single data list (hashlist)
  • (9)Create a welcome cookie
  • (8)A clock created with a timing event
  • (7)Create a new windows

最新留言

    文章精選

    文章搜尋

    動態訂閱