2012年1月10日 星期二

Socket Coding Function

inet_ntoa(), inet_aton(), inet_addr

Convert IP addresses from a dots-and-number string to a struct in_addr and back

Prototypes

#include  #include  #include   // ALL THESE ARE DEPRECATED!  Use inet_pton()  or inet_ntop() instead!!  char *inet_ntoa(struct in_addr in); int inet_aton(const char *cp, struct in_addr *inp); in_addr_t inet_addr(const char *cp);


Reference:
http://www.retran.com/beej/inet_ntoaman.html

2012年1月9日 星期一

Header File and Include

Method 1: (Not very rigid)
1. Sometimes you wll write a sub module in the other file
2. then you didn't link it.
3. and can call it.



Method 2: (Serious)
1. you should Define function name before each function usage
2. you should add the header file.



{{{
Time_C.cpp

#include "vxWorks.h"
#include "timexLib.h"
#include "stdio.h"


#define ITERATIONS 200

/*Function Define Region */
int printit(void);
void timing(void);


void timing(void) {
printit();
}

int printit(void) {
int i;
for (i=0; i < ITERATIONS; i++) {
printf("Hello, I am i %d\n", i);
}
}

////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
Add the 'include ' Time_C content, then use the timeing
////////////////////////////////////////////////////////////
/* Define user function */
#include "Time_C.cpp"

void usrAppInit (void) {
#ifdef USER_APPL_INIT
USER_APPL_INIT; /* for backwards compatibility */
#endif

/* add application specific code here */
timing();
}





}}}

2011年12月28日 星期三

Useful Alias

alias 454FLX='ssh adminrig@172.16.7.253'
alias dumd='du -h --max-depth=1 | sort -k2'

2011年12月21日 星期三

Java parameter

-xmx maxmimum heap size
-xms minimum heap size


From 2011_12_22 core-meeting report

2011年11月27日 星期日

Sort

Multiple Sort usethe

sort -k filed1,field1 -k filed2.field2(g)

becareful,
sort -k 14,14 -k 16,16g R_CPU1_Q_CPU8.blat | less

兩個相同, 代表只用相同 key, 而不是 key 後的content

link

ln -s


-s soft_link, when there are cross-device

2011年11月23日 星期三

Copy Remote File

# Copy file
scp Andy@192.168.200.40:/dir

# Copy Directory
scp -r foo your_username@remotehost.edu:/some/remote/directory/bar


#Reference
http://www.hypexr.org/linux_scp_help.php