Categories
Programming/C Programming/iOS

Protected: Objective-C quick reference / 快速參考

This content is password protected. To view it please enter your password below:

Categories
Programming/C Programming/iOS Software

[參考] Objective-C Cheat Sheet and Quick Reference

Objective-C Cheat Sheet and Quick Reference

URL : http://www.raywenderlich.com/4872/objective-c-cheat-sheet-and-quick-reference

Categories
Copy_N_Paste Programming/C Programming/misc

iphone / hello world 2 / single rows in the table view

// --
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}


// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    [cell.textLabel setText:@"Hello World!"];
    return cell;
}
// --
// --


Categories
Copy_N_Paste Programming/C Programming/misc

[導覽] 有趣的 iPad iPhone development video 教學

From : Rory Lewis, PhD, JD

URL : http://www.rorylewis.com/docs/02_iPad_iPhone/05_iPhoneTutorials.htm

另外給初接觸 objective-c 的介紹:

URL : http://maciku.blogspot.com/2009/12/iphone-objective-c.html

中文開發網站 : http://www.cocoachina.com/iphonedev/

// ——————

obj->method(argv);

[obj method: argv];

// ——————

@implementation HelloController
- (IBAction)sayHello:(id)sender {
  [destinationTextField setStringValue:[sourceTextField stringValue]];
}
@end
(id)sender 是一個可以選擇性的用法,
若您有需要取得發出 IBAction的元件時,可以用這個 sender變數來取得.
但記得可能需要 cast一下.
UIButton *senderButton=(UIbutton*) sender;
[senderButton setHidden: YES];
這樣就會把該button隱藏起來.

(id)sender 是一個可以選擇性的用法,若您有需要取得發出 IBAction的元件時,可以用這個 sender變數來取得.但記得可能需要 cast一下.

UIButton *senderButton=(UIbutton*) sender;[senderButton setHidden: YES];

這樣就會把該button隱藏起來.

// ——————

[2010/7/9 下午 04:48:25] Rimmon 2.0: jason 有 mac os 的 sftp GUI 的 tools 嗎?

[2010/7/9 下午 04:48:40] Rimmon 2.0: 想要用 tools 傳 code 比較方便

[2010/7/9 下午 04:51:05] _RTN Jason Chen: http://www.versiontracker.com/dyn/moreinfo/macosx/15693

[2010/7/9 下午 04:51:08] _RTN Jason Chen: Fugu

[2010/7/9 下午 04:51:35] _RTN Jason Chen: www.versiontracker.com 有非常多的 OSX 軟體可下載

[2010/7/9 下午 04:53:59] _RTN Jason Chen: 還有 Microsoft Remote Desktop Connection 可遠端遙控 Windows

[2010/7/9 下午 04:55:13] _RTN Jason Chen: smb://172.30.0.29/Install   這樣 OSX 才看得懂網路分享目錄

[2010/7/9 下午 05:00:10] _RTN Jason Chen: Finder, 用 apple鍵 + K 再輸入 cifs://172.30.0.19/Install 即可連 server shared

Categories
JOB Programming/C System/Linux/Unix*

開啟 vmware esxi server virtual switch Promiscuous Mode 的方法 – for sniff network purpose

要研究這麼深?! 沒辦法, 最近遇到奇怪問題非得啟用 Promiscuous Mode 來看看發生啥事了.

設定 step by step 看圖:056a3fd358a30a988ad401d605afe440

 

這是 免費的 sniff tools: http://www.ethereal.com/

Categories
JOB Network service Programming/C

tracking system 新點子

上週聽了 ora 公司的產品說明, 覺得不錯.

它是 tracking system 產品, 可是更 friendly / 非侵入式的作法, 它利用 switch 或 SLB設備的 mirror port 把流經的 traffic 導進這個 program , 由這個 program 來進行 traffic 分析.

架構簡圖:

420dbc62a3d3bc44984d3a927888b7fe

 

若要自行作的話可能會需要看懂這個

Programming with pcap
http://www.tcpdump.org/pcap.htm

The Sniffer’s Guide to Raw Traffic (a libpcap tutorial)
http://yuba.stanford.edu/~casado/pcap/section1.html

Categories
Copy_N_Paste JOB Programming/C System/Linux/Unix*

Get MAC address using C

不過 , 這邊有指定 eth0 , 若 server 有很多 interface 的話就要注意一下了.

#include <stdio.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>

int main( int argc, char *argv[] )
{
	int s;
	struct ifreq buffer;

	s = socket(PF_INET, SOCK_DGRAM, 0);

	memset(&buffer, 0x00, sizeof(buffer));
	
	strcpy(buffer.ifr_name, "eth0");

	ioctl(s, SIOCGIFHWADDR, &buffer);

	close(s);
	
	for( s = 0; s < 6; s++ )
	{
		printf("%.2X ", (unsigned char)buffer.ifr_hwaddr.sa_data[s]);
	}

	printf("\n");

	return 0;
}
Categories
Copy_N_Paste Programming/C

[好文推薦] A TUTORIAL ON POINTERS AND ARRAYS IN C

"C 語言" … ㄏㄏ.. 這麼古老且重要的語言,從 1972年開始到現在至少超過30年! 學會 pointer 後 C 就算是懂 90% 了

REF: http://en.wikipedia.org/wiki/C_%28programming_language%29

FROM URL : http://home.netcom.com/~tjensen/ptr/pointers.htm

TABLE OF CONTENTS

Preface

Introduction

Chapter 1: What is a Pointer?

Chapter 2: Pointer Types and Arrays.

Chapter 3: Pointers and Strings

Chapter 4: More on Strings

Chapter 5: Pointers and Structures

Chapter 6: More on Strings and Arrays of Strings

Chapter 7: More on Multi-Dimensional Arrays

Chapter 8: Pointers to Arrays

Chapter 9: Pointers and Dynamic Allocation of Memory

Chapter 10: Pointers to Functions

Categories
Copy_N_Paste Programming/C Programming/javascript Programming/misc Programming/php Software System/Linux/Unix*

編程最佳的字型 consolas / notepad++ 及 winscp 設定 / Best programming fonts

http://www.sitepoint.com/blogs/2009/05/01/top-10-programming-fonts/

173dd6cf51cee56ee41c03a4eea53d43 5f51869c4d702101b28643d2ce7ee81f eb97be5da4e6ee5ee99f97467c5b3187

Categories
Copy_N_Paste JOB Programming/C Software System/Linux/Unix*

The Expat XML Parser – XML 分析/拆解工具 – C – 這個讚! 用 C 寫 spider 會用到

Expat is an XML parser library written in C. It is a stream-oriented parser in which an application registers handlers for things the parser might find in the XML document (like start tags). An introductory article on using Expat is available on xml.com.

Function reference : http://www.xml.com/pub/a/1999/09/expat/reference.html