Compiling: Compiling : turning written code into machine code, 1s and 0s Make is not a compiler Breakpoint: Breakpoint : explicitly define stopping point, allows you to inspect memory at that point and step through lines one at a time Multithreading: performing multiple tasks at once Floating po point im imprecision Heap: unallocated memory that can be dynamically used ( MALLOC) Stack: memory set aside when program starts Scope: Scope : use pointers for values inside functions or your functions won't return same values Stack overflo : whe when n sta stack ck runs runs out out of of spa space ce reme rememb mber er to free dynamically free dynamically allocated memory !c files do files do not need a main function malloc allocates malloc allocates memory on the heap "#LL does "#LL does not demarcate the end of a string Ala$s check check for "#LL% "#LL% also for malloc &reprocessing : Directives like include are processed, then inserts contents of header files and any declarations into file being preprocessed Segmentation fault: fault : attempts to access memory it isn't allowed to Compiling: Compiling : !reprocessed " code is translated into assembly, possibly with optimi#ations 'mplicit declaration: declaration : program is defined after main function, no prototype O( no no header file Assemling Assemling: $ssembly instructions translated into machine code and stored in ob%ect (&o file #ndeclared identifier: identifier : variable not declared (ememe (ememer r to initiali* initiali*e e pointers pointers (ememe (ememer r +,&OS+,&OSLinking: Linking : ob%ect code for main is combined with ob%ect code from other files, creating executable file H-M H-ML is is a mar marku kup p lan langu guag age e Huff Huffma man n codi coding ng:: using freuency of $)"** characters, make +) (ecursion adds (ecursion adds to the stack, consumes lots of memory and can cause segfaults and stack overflow, don't forget base case, leads to elegant code H--&: H--&: !ort -0 .mail: .mail: !ort ./ H--&S: H--&S: !ort /'F is /'F is lossless 0&./ is lossy !rograms may compile ackdoors ackdoors &H&S.SS'1: &H&S.SS'1: cookie, value identifies user's browser, maps to server2side file containing +,S.SS'O" which +,S.SS'O" which is superglobal superglobal &H& uses &H& uses 3 4 mario for(i50,in,i;; < for(%50,%i,%;; < print(?@=> print(?Cn@=>
t$pedef struct < type a= type b=> structname = (Aptr&str O( ptr2Bstr ptr2Bstr
2variale 5 address (referencing 5variale 5 5variale 5 actual value (dereferencing (dereferencing use pointers pointers hen actuall$ manipulating manipulating vals pointer arithmetic moves address 8 $tes
fgetcsv goes goes one line at a time &H&: &H&: !! ypetext !rocessor char: char: 1 byte char5: char5: bytes int: int: bytes int5: int5: bytes long long: long: - bytes long long5: long5: bytes t$pe5: t$pe5 : bytes Cn: newline Dr: Dr: return line to beginning of line execute bool nodesearch(nodeA nodesearch (nodeA list, int n
ptr 5 ptr2Bnext=> return false=> void nodeinsert (int n new2Bn 5 n= new2Bnext 5 E799= new2Bnext 5 he head= head 5 new=>
344 6 344 6 succ succes essf sful ully ly resp respon ond d to to 789 789 reu reues estt +rows rowser er look lookss up up ip address 643 6 643 6 789 exists, exists, but but redirect redirect client client to other other 789 "ontacts "ontacts 1"S server 1"S server if needed 746 6 746 6 file access forbidden )ends H--& reuest to port vi port vi nearby router 747 6 unable to find file 7pon receipt, website responds with H-ML 944 6 944 6 server improperly configured or syntax error 64 6 64 6 789 permanently redirected, redirect client to another 789 74 6 74 6 7nauthori#ed
; CHA(AC-.( (n (n BOOL.A" SMALL'"- 1.C'MAL(p,s 1O#BL. &(.C'S'O" ?=input@ element by id, and also tag name >A(CHA( (n >A(B'"A(? (n '"-./.( (.AL 1A-. ex: K('inputs'&submit(function( <> B'"A(? (n (n '"-./.( (p (p B'/'"FLOA-'M. only submits if return true K('input'&val(= SAL#.S 0O'" O" ;s vs &H&: &H&: faster response, but invalid data if %s disabled C vs &H&: &H&: best for high2performance (compiled, but not as good for web programming and cmd line scripting S : more efficient, but reuires server trie vs hash: hash: constant2time lookup (L(k while hash 5 L(n, but lots of memory linked list vs arra$ : arra$ : dynamic si#e but bigger memory reuirements local vs gloal variale: variale : restricts scope tightly, accessible when needed, global may simplify code 1OM: 1OM: Docu Documen mentt Lb%e Lb%ect ct Godel Godel,, each each suble sublevel vel is node node of of upp upper er level level Gore Gore bytes bytes than than expecte expected, d, some some exe execut cutabl ablee code code →overw overwrit rites es retur return n add addres resss →return return there, there, +uffer2array attack, never make assumptions about user input length, users should use secure wifi and ))9 sites scanf must must send value to address to alter the actual value →if you don't initiali#e pointer value, you can write to wrong memory and get segfault sscanf returns returns num of args filled atomic transaction atomic transaction is either executed or not associative arra$ 6 6 data structure that associates values with keys e8ternal st$lesheet st$lesheet 6 6 centrali#es styles, allows easy changes M>C 6 M>C 6 model2view2controller, ?design pattern@ separates ?business logic@ (" from representation of data (G from display of data (N for submitted php data: http:FFwebsite&comFmvc&php Evarval2var3val32!!! etc OneGa$ hash: hash: take variable2length string, output fixed2length, hard to do backwards stacks are L'FO (la L'FO (last st in, in, first first out out struc structu ture, re, stack& stack&si# si#ee marks marks top of sta stack ck insertion into insertion into hash tale% separate chaining: chaining : Lmega 1, L 1 insertion into trie: trie: Lmega 1, L 1 insertion into sorted linked list: list : Lmega 1, L n deletion from deletion from sorted linked list: list : Lmega 1, L n deletion from deletion from unsorted linked list: list : Lmega 1, L n
ueues ueues are are F'FO (first F'FO (first in, first out structure, index of first element will change as deueue
A;a8: A;a8: asynchr asynchronous onous %ava and and xml xml
ex: xhr&on xhr&onread readysta ystatech techange ange 5 handler handler== calls calls handler handler on on state state change change ex: xhr&onreadystatechange 5 handler(=, calls function immediately 0avascript: 0avascript : client2side programming language A;a8: A;a8: couples %s with OG9 or P)LE, can reuest additional data from servers via ! even after initial page load ;
*f two websi te tes on same server, share same *! address, Host header Host header indicates desired domain Anon$mous Anon$mous functionFlambda functionFlambda function: function without a name, passed as inputs to functions to be called later
gd 6 gd 6 allo allows ws you you to to run run prog progra ram m line line by line line reak run ne8t step print continue
)et )et a cookie 6 cookie 6 store store key2value pair in 8$G or file for subseuent subseuent retrieval retrieval *f array array ?var@ has ?f1@ 5 ?v1@, ?f.@ 5 ?v.@, etc& print(%sonQencode(Kva print(%sonQencode(Kvar r 5
stdio!h int fclose( fclose (S*9HA fp= int fprintf ( fprintf (S*9HA fp, string format= si#eQt fread(void fread(voidAA ptr, ptr, si#eQt si#eQt si#e, si#e, si#eQ si#eQtt block blocks, s, S*9HA S*9HA fp= S*9HA fopen(string fopen (string filename, string mode= int fscanf (S*9HA (S*9HA fp, string format= int fseek (S*9HA (S*9HA fp, long int offset, int fromQwhere= si#eQt frite(voidA frite (voidA ptr, si#eQt si#e, si#eQt blocks, S*9HA fp= int scanf (string (string format= int sprint(string sprint (string ptr, string format= int sscanf (const (const char Astr, const char Aformat
/.- A;a8 re@uest e8ample K&get(url,function(price< get(url,function(price< var msg 5 ?blah1@;var1;@blah.@;@var.;etc K(?form K(?formQwra Qwrapper pper@&h @&html( tml(msg msg=>= =>=
string!h charA strcat(charA strcat (charA dest, const charA src= charA strncat(charA strncat (charA dest, const charA src, si#eQt n= int strcmp(string strcmp(string str1, string str.= charA strtok (charA (charA str, const charA delim= stdli!hB stdli!h B int rand(void= rand(void= (pseudorandom btwn #ero, 8$EDQG$O= olBFolB 2 ordered list ulBFulB 2 unordered list liBFliB 2 list element
htmlspecialchars (Kstring escapes users' input so it doesn't become G9 m$s@l,real,escape,string (Kstring escapes users' inputs so it doesn't become )R9
tableBFtableB tableBFtableB 2 table trBFtrB 2 table row tdBFtdB 2 table data void insert(int insert (int n 'nsert: 'nsert : insert node into doubly linked list list 5 ptr=>> void remove(int remove (int n (emove: (emove: remove node from doubly linked list > else > free(ptr= return=> ptr 5 ptr2Bnext=>> int pop(void pop(void &op: &op: take int at top of stack, else return 21
bool push(int n &ush: take int and add to stack, else return false void traverse(nodeA root -raverse: traverse binary search tree < if (root 55 E799 < return= > traverse(root2Bleft= printf(VWiCnV, root2Bn= traverse(root2Bright= > bool search(int n, nodeA tree Search: searches binary search tree else if (n tree2Bn else if (n B tree2Bn else > find with recursion bool find(nodeA root, int i return false=>
find without recursion bool find(nodeA root, int i
bool odd(unsigned int n Odd: checks for even or odd binary < if (n X 1 return true= else return false= > MDL"T!H htmlB htmlBheadB script src5Vhttp:FFcode&%uery&comF%uery2latest&min&%sVBFscriptB scriptB K(document&ready(function( < K(VinputsV&submit(function( < var value 5 K(VnameV&val(= if (value M5 VV return false=>=>= FscriptB titleBui#FtitleB FheadBbodyB form id5VinputsVB input id5VnameV type5VtextVFB input id5VbuttonV type5VsubmitV value5VIreetVFB FformBFbodyBFhtmlB check 3 vars ith ;s var val1 5 document&getHlement+y*d(Vval1V&value= var val. 5 document&getHlement+y*d(Vval.V&value= if (val1 55 VV UU val. 55 VV return false= if (val1 M5 val. return false= return true= bool en@ueue(int n .n@ueue: adds to end of ueue &numbers3(&si#e ; &front W "$!$"*T4 5 n= &si#e;;= return true=> int de@ueue(void 1e@ueue: removes and returns int at front, ?forgets@ this val &si#e22= int n 5 &numbers3&front4= &front 5 (&front ; 1 W "$!$"*T= return n=> &H& functions reuire(filename&php echo exit empty