2008年12月28日 星期日

hotspot shield

the software to watch american tv program (hide your real ip)

http://www.anchorfree.com/downloads/hotspot-shield/

connect to Hulu : have many tv programs
http://www.hulu.com/

2008年11月27日 星期四

java preference

show java information 

2008年11月26日 星期三

Beginning iPhone Development: Exploring the iPhone SDK

snmp


3 things to do for SNMP:
(1)query a value and get a reply
(2)set a value and get a return code
(3)An SNMP-enabled device can send you a notification, or "trap"

OID(object identifier)
how you identify SNMP objects in a structured, unique manner.

root of OID tree:
.1.3.6.1  (iso(1).org(3).dod(6).internet(1) )

within .1.3.6.1, there are four branches:
directory(1)
mgmt(2)
experimental(3)
private(4)

mgnt(2) is for standard objects
private(4) is for company-specific objects

MIB(management information base):
help user to understand the meaning of OID,
ex:
.iso.org.dod.internet.private.enterprises.4526.4.3.1.1.0 = STRING: "00146C689987"
is translated to
.iso.org.dod.internet.private.enterprises.netgear.wireless.wg102.sysSettings.sysMacAddress.0 = STRING: 00146C689987

snmpget:
snmpget -c public  192.123.1.1  1.3.1.2.1

snmpwalk:
找出某個節點後所有的value
snmpwalk -c public 192.168.5.18 .1.3.6.1.4.1.1714.1.1.2.1.2

mib file in mac os:
/usr/share/snmp/mibs/

2008年10月4日 星期六

包模

西門町獅子林1F~艾斯機膜
獅子林的魔法貼

2008年10月2日 星期四

app store的軟體

遊戲:
flick bowling:
raging thunder: 賽車
Monkey Ball

money:
splashmoney 

FileMagnet: watch pdf, doc

Scribble:  draw

ezimba:  photo

wedict pro: dictionary

remote:  remote control

touchcalc:  calculator

evernote: note

2008年9月16日 星期二

novamind

mind mapping software

mount iso

hdiutil mount  test.iso

crossover

execute windows software 

2008年9月13日 星期六

@property & @synthesize

@property :
define getter  & setter method
ex:
@property(readwrite, assign)  int test;

@synthesize:
implement getter & setter method
ex:
@synthesize test;

binding

ex:
binding Slider's value to a key, then slider's value will sync with key

How to do:
In slider's inspect, set its binding 
(1)set bind to class A
(2)set A's  test member as model key path

key value coding

ex:
.h檔

@interface AppController : NSObject {

int test;

}

@end


.m檔

// set test

[self setValue:[NSNumber numberWithInt:5]

forKey:@"test"];

// get test

NSNumber *n=[self valueForKey:@"test"];


// is called when valueForKey is called

-(int)test

{

NSLog(@"test is returning %d", fido);

return fido;

}


// is called when setValue is called

-(void)setTest:(int)x

{

NSLog(@"setTest is called with %d", x);

fido=x;

}



delegate

if B is delegate of A,  when something happens to A,  B's method is called

ex:
B is  TableView's delegate 
B implement following method:
-(void)tableViewSelectionDidChange:(NSNotification*)notification 
when the selection row is table is changed ,  this method is called

NSTableView

data source:
decide the content of the table
implement two methods:
-(int)numberOfRowInTableView:(NSTableView*)tv

-(id)tableView:(NSTableView*)tv
                           objectValueForTableColumn:(NSTableColumn*)tableColumn
                           row:(int)row

NSWindow

initialFirstResponder outlet:
this outlet decides which view should be receiving keyboard events when window appears 

NSButton, NSSlider

NSButton:
oval button, square button ,  check box

methods:
-(void)setEnabled:(BOOL)yn

-(int)state
if return NSOnState(1), the check box is on
if return NSOffState(0), the check box is off

-(void)setState:(int)aState

NSSlider:
-(void)setFloatValue:(float)x

-(float)floatValue

NSTextField:
-(NSString*)stringValue

-(void)setStringValue:(NSString*)aString

NSFormatter can convert a string into another type , and vice versa
-(NSObject*) objectValue

-(void)setObjectValue:(NSObject*)obj





2008年8月21日 星期四

2008年8月19日 星期二

2008年8月16日 星期六

kscope

code tracing program

use fink to install 
1.  fink install kscope
2. install graphviz ( install from dmg)
    the executable is stored in /usr/local/graphviz-2.14/bin/dot    

2008年8月15日 星期五

textmate

default:
how to jump to definition:
shift+ cmd + t : go to the symbol dialog, then enter symbol name

remember location:
use bookmark to record location(  cmd+f2)
next location(f2)
last location(shift + f2)

diff bundle:
compare difference

external bundle:
getbundle bundle:
for easily install bundle

ctags bundle:
1. install ctags bundle
2. jump to definition:  ctrl+ ]

cvs bundle:

changes

1. compare file difference 
2. support version control

fink

install linux program

enable to install unstable program:
1. fink configure ( active unstable tree)
3 run fink selfupdate-rsync

install packages:
ex:
fink install kscope

2008年8月8日 星期五

install cdt on eclipse (for c & c++ development)

1. download  cdt-master-5.zip
2. help --> software update --> available software  --> add site  --> archive -->  
    choose cdt-master-5.zip

2008年8月5日 星期二

show hidden file in finder

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

2008年7月30日 星期三

vmware

problem: No Permission to access this virtual machine
answer:
change owner of each file of virtual machine
ex:
sudo chown  -R ${USER}  *

2008年7月25日 星期五

redirect output

use >
> should be preceded with a number, such as 2>  , but default is 1 if no number
ex:
ls > output
equals   
ls  1> output

ex:
Sending Both Output and Error Messages to Different Files
test 1> messages.out  2> message.err 
or 
test > messages.out  2> message.err 
2 means STDERR

add & after >:
means the output is redirected to a file descriptor
ex:
ls >& 2

write STDOUT & STDERR to the same place:
ex:
ls >& outfile 
or 
ls > outfile 2>&1 


run the command in the background

put & after command:
ex:
ls &

/dev/null

/dev/null:
throwing output away,  redirect output to /dev/null
ex:
ls > /dev/null

2008年7月24日 星期四

輸入法

open vanilla 

嘸蝦米
Liu3.cin
本機硬碟>>資料庫>>OpenVanilla>>0.7.2>>Modules>>OVIMGeneric 

safari bookmark

Users/deeplove/Library/Safara/Bookmarks.plist

2008年7月16日 星期三

IOIteratorNext

iterator must be released

the element got from IOIteratorNext must be released 

ex:

ele= IOIteratorNext(iter)

while(ele != IO_OBJECT_NULL){

   IOObjectRelease(ele);

   ele = IOIteratorNext(iter);

}

IOObjectRelease(iter);

ioclasscount

the instance count of the class

useful for tracking leaks

2008年7月15日 星期二

google code hosting server

http://code.google.com/hosting/

2008年7月14日 星期一

zip command

zip -r data.zip .
This copies the current directory, including all subdirectories into data.zip 

startup item

start the application in the startup item:
/sbin/SystemStarter start "Test"


2008年7月3日 星期四

organized widget

a widget for
1. clock
2. note
3. event
4. to do

2008年6月27日 星期五

find command

ex:
find  .   -name  "test.c"
first argument set the path to find
second argument set the file to find

2008年6月25日 星期三

build java project from eclipse in xcode

prepare:
change Java template in Xcode
edit  /Developer/Library/Xcode/Project Templates/Java/Java Applicationex/build.xml
       source="1.5"  target="1.5"

(1)check out project "Test" from cvs
(2)create the Java project named "Test"
(3)now xcode create build.xml to compile your Java project 

include external jars
place jars in   Test/lib/

set main function:
in Info.plist,  set value = packageName.className  for key = MainClass
in Manifest,  set  Main-Class: packageName.MainClass

set image files:
place them in Test/bin

set VMOptions
in info.plist,  set  "-Xmx512m"  for key  "VMOptions"

set class path for app:
In Info.plist, set the value of  ClassPath
ex:

<key>ClassPath</key>

<array>

<string>$JAVAROOT/test1.jar</string>

<string>$JAVAROOT/test2.jar</string>

</array>


not including other jars when creating jar
comment  zipgroupfileset refid="lib.jars"

when the resource is the same location as execution file, how to set resource:
1. if execution file is jar(in jars/) , put resource in jars/ and use "java -jar" to run program
2. if execution file is App(in dist/), put resource in dist/  and run from xcode
3. place them in the bin/packageName/  


2008年6月24日 星期二

define macro in xcode

ex:
configuration: Debug
gcc 4.0 processing-> preprocessor macros:   _DEBUG

memory management in objective-c

retain:
increase retain count

release:
decrease retain count

array:
when an object is added to the array, the object's retain count is increased
when the array is deallocated,  the object( in array) 's retain count is decreased 

dealloc:
when an object's retain count becomes 0, its dealloc method is called

autorelease:
the object is added to autorelease pool when it is sent message autorelease
when the pool is drained, it sends message release to all objects in the pool

objects created by alloc, new, copy or mutableCopy have a retain count of 1 & are not in the autorelease pool 

if the object is get from other method, it is usually in the autorelease pool. If you do not want it to be deallocated when the pool drain, you must retain it

memory control for setter:
retain , then release
ex:
-(void)setName:(NSString*)name
{
      [name retain];
      [myName release];
      myName= name;
}

2008年6月23日 星期一

2008年6月18日 星期三

fileMerge

the GUI software to compare two files

compare two files
the two files compared are on the two top windows

use action to create merged file
the merged file is on the bottom window
(1) do action
(2) save file

diff

-w: ignore all whitespace

-q: Output only whether files differ

2008年6月16日 星期一

create application from jar

create  icon
use icon composer to create icon

use  jar bundler 
set jar files,  main class, icon pic

ex:
the created application is test.app
the executed file is:
test.app/Contents/MacOS/JavaApplicationStub 

2008年6月15日 星期日

NSObject

(id)init

(NSString*)description:
when NSLog print object, it will print the return value of description of the object


(BOOL)isEqual:(id)anObject
for NSString, isEqual will compare characters 
note: == compare if two objects are the same objects

NSString

start with @
ex:
NSString *test= @"hello";

NSString to C string
ex:
char *test = [ a UTF8String];

C string to NSString:
ex:
a= [NSString stringWithUTF8String:test];

NSLog

similar to printf in C
ex:
NSLog(@"hello");

token for NSLog:
%@: id

NSNumber

initWithInt


NSMutableArray & NSArray

NSArray:
objectAtIndex


NSMutableArray:
addObject:
ex:
[test addObject:dog1];

class and object

calling method:
ex:
[test run];
test is a object, run is its method

calling method with arguments:
ex:
[test run:1  secondArg:2];
1 is first argument,  2 is second argument, secondArg: is the description of second argument

create a object:
test = [NSMutableArray alloc];

create & init a object:
test = [  [NSMutableArray alloc] init];

TextField

setStringValue:
ex:
[textField setStringValue:@"hello"]

setIntValue:

setObjectValue:


import & objective-c keyword

#import:
similar to include. But it ensures the header is included only once.

keywords:
@end
@implementation
@class
@selector
@protocol
@property
@interface
@synthesize

type in objective-c

id:  a pointer to any type of object

BOOL::

YES: 1
NO: 0

IBOutlet:  a macro that evaluates to nothing. It is a hint for interface builder

IBAction:  the same as void,  a hint for interface builder

nil:  the same as NULL.  for pointers to objects
        In Objective-C, it is ok to send message to nil. The message is simply discarded.

interface builder and nib

the application's GUI is designed by interface builder

GUI is defined in the nib file.  

Use interface builder to open nib file & design gui

define class used in the nib
IBOutlet
instance variable points to other object is called outlet
ex:
IBOutlet  NSTextField *testField;
IBAction
the method is called by user interface objects
ex:
-(IBAction)seed:(id)sender;

create an object instance:
1. drag object from Library window to doc window
2. set its class to object's class name in the Identity Inspector

make connection:
connect two objects
ex:
a object has outlet textFiled of type TextField , then connect textFiled to  TextFiled GUI
ex:
when button b is pressed, it calls the method test in object c. Then connect b to object c's methods test

awakeFromNib:
all objects are sent the message awakeFromNib after the objects in nib file are brought to life
Hence, we can do something in awakeFromNib to init GUI



2008年6月11日 星期三

grep

find string in the file 
parameter:
-n:  show line number

ex:
grep -n  "rabbit"  test.rb

2008年6月10日 星期二

xcode debug

step over:
execute the function and move to the line after function

step into:
execute the function and move to the body of the function

step out:
originally in the function, execute the function and move to the line after function

continue:
continue program execution

2008年6月3日 星期二

2008年5月30日 星期五

chown

sudo chown  -R  root:wheel test.kext

2008年5月13日 星期二

xcode

compile files in xcode
做完改變後,
若要在local端儲存改變,
按file,然後按住option,
然後選save a copy as ,
然後檔名選local端file的檔名,
如此就會覆蓋local端原本的檔案。

set parameter for running
in Excutables-> executable_name-> arguments

ln

ln -s Documents/project/test   Desktop/testLink

2008年5月8日 星期四

cvs

set cvsroot:
export CVSROOT=:pserver:andy@10.1.1.1:/home/cvs

login
cvs  login

import:
cvs  import  test andy ver1
test: project name on cvs server
andy:  Vendor-tag
ver1:  Version-tag

checkout:
get specific version:
cvs co -r  v1_2   projectName

get specific date:
cvs co -D "12/02/2008 13:00" projectName

get specific branch
cvs co -r branch_name  projectName

show status:
ex:
cvs st test.c

commit:
cvs commit  test.c

remove
1. rm test.c
2. cvs rmove teset.c
3. cvs commit test.c
when check out project next time, test.c is not checked out
but test.c is still on cvs server
Hence, we can roll back  the time test.c exists

2008年5月6日 星期二

macports

the software to help install open source porgram

install:
set path:
export PATH=$PATH:/opt/local/bin

apache on mac

start apache server:
system preference --> web sharing 

cgi directory:
/Library/WebServer/CGI-Executables

2008年5月3日 星期六

times (RSS reader)

RSS reader

svn

svn on windows: tortoiseSVN


一般分三種directories
trunk: 最新的程式
branch: 程式某個版本的branch,不會影響到最新的程式
tag: 每個release的程式,會有個tag對應,如此可以取回任何一版release的程式

將程式抓下來:
ex: svn checkout http://svn.techno-weenie.net/projects/plugins/acts_as_authenticated/

2008年4月30日 星期三

apple product list

product        description                                         date

iMac             20,24 2.4GHz,                  2008/4/28
                      2.66GHz, 2.8GHz, or 3.06