2012年2月15日星期三

string

we can use strlen(string) > 0 to see if a string is empty or not.

strcmp
strncmp useful!!! to see whether the first n characters are the same.

strcpy
-----------------------------------------------------

how to get "download ..."
how to get the word between space

---------------------------------------------------------------
how to get a array return from a function, 3 array? Many data structures?

2012年2月13日星期一

warning

warning: backslash and newline separated by space
Solution: The backslash (\) character is used as the continuation character to continue #define statements and strings to the next line. GCC expects the backslash character to be the very last character on the line. This warning indicates that there is a space after the backslash. Delete the space and any other characters that come after the backslash.

2012年2月8日星期三

socket-----C

fprintf(out, "Hello %s\n", name);
printf
sprintf
--------------------------
perror
--------------------------------------------------
int i = 0;
while(i < 10)
{
printf(".");
sleep(1);
i ++;
}
--------------------------------------------
int i = 1;
while(i < 10)
{
fprintf(stderr,".");
sleep(1);
i ++;
}
----------------------------------------------
int i = 1;
while(i < 10)
{
printf(".");
fflush(stdout);
sleep(1);
i ++;
}
-------------------------------------------
1 gcc default path: /usr/include
2 gcc -I directory
3 do not search default

about the driver compilation, usually we do not need kernel to search for default path. enforce the kernel not to do that with a parameter
---------------------------------------------
how to get local ip in c on linux is here
-------------------------------------------------------------------
scp test.c xxxxxx@timberlake.cse.buffalo.edu:./

-----------------------------------------------------------

:133:174 co 299
----------------------------------------------

2012年2月6日星期一

MNC 2/6

HTTP & SMTP

PULL (HOST INIT TCP )

PUSH(SENDER SERVER PUSH INFO TO RECEIVER SERVER, RECEIVER SERVER INIT TCP)

ASC2 for SMTP, PERSISTENT

HTTP: OBJECT, EACH OBJ IN ITS OWN RESPONSE MSG

SMTP: EMAIL MESSAGE , MULTIPLE OBJ SENT IN MULTIPART MSG

--------------------------------------
WEB BASED EMAIL

POP3 IMAP
----------------

LOCAL DNS SERVER

13 ROOT SERVER

TLD DNS SERVER

AUTHORITATIVE DNS SERVER

------------------------------

www.google.com
google.com
just different alias which is mapped to the same IP

2012年2月5日星期日

OS&GIANTS

This semesor I take OS course under the instruction of Professor Geoffery. He is a really funny and nice guy. Because of him, I watched super bowl for the first time(no laugh pls...). And I found that it is reallllllly interesting!!!

I am glad to take this course althogh it would be very tough. But that's why I come here.

Hope I can be stronger two months later.

git

do not use Ctrl+z but Ctrl+x to exit when enter git commit help window

if you face this error:

fatal: Unable to create '/path/to/repo/.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.

this can solve the problem

rm .git/index.lock

----------------
git status
git diff
git reset HEAD <>
git checkout -- <>
git add <>
git commit
------------------
git tag -a "asst0-start" -m "ASST0 start"

vim ./gitignore

build
.depend
/defs.mk
kern/compile/
user/testbin/randcall/calls.c

-----------------------
When you clone a repository, Git automatically sets up the
remote repository you cloned from as linked to your clone.

git remote -v

Before you perform any merge it is best to have any changes in your
working directory committed.



2012年2月4日星期六

gdb tips

#gdbinit

(gdb) target remote unix:.sockets/gdb

#when gdb initiate, it will search and execute a file named .gdbinit under current directory

#if you are in gdb debugiing, use

source /.gdbinit
-----------------------------
r
n
s
c
b ; info b; d b n; disable b n; enable n
watch
bt
f n
l
i locals
set
p i
finish
c
q

-------------------------
(gdb) p i
$21 = 101
(gdb) p/a i
$22 = 0x65
(gdb) p/c i
$23 = 101 'e'
(gdb) p/f i
$24 = 1.41531145e-43
(gdb) p/x i
$25 = 0x65
(gdb) p/t i
$26 = 1100101