Harvard CS 50 video note

 



21:36 2013-9-21 Sunday 


start Harvard CS50 lec0, lec1 


 


21:46 2013-9-21 


scratch 


 


22:09 2013-9-21 


./ current directory 


 


22:09 2013-9-21 


ls show me what's in the directory 


 


22:10 2013-9-21 


clang 


 


22:11 2013-9-21 


clang -o hello hello.c 


 


22:14 2013-9-21 


cd == change directory 


 


22:18 2013-9-21 


terminal window // the black & white window 


 


22:18 2013-9-21 


gedit 


 


22:19 2013-9-21 


rm == remove 


 


22:22 2013-9-21 


make 



 


22:24 2013-9-21 


stdio.h // standard library 


 


22:25 2013-9-21 


printf() // f == formatted 


 


22:26 2013-9-21 


%d == decimal 


 


%c == char 


 


22:32 2013-9-21 


GetString() 


 


22:34 2013-9-21 


#include <cs50.h> 


 


22:41 2013-9-21 


segmentation fault 


 


22:53 2013-9-21 


assignment = 


 


22:54 2013-9-21 


equality == 


 


23:07 2013-9-21 


automatic tool like make 


 


23:12 2013-9-21 


primitive type 


 


23:26 2013-9-21 


data type 


 


23:32 2013-9-21 


real numbers: 1.234, 5.67 


 


decimal numbers: 1, 24, 109 


 


23:36 2013-9-21 


data conversion problem 


 



0:05 2013-9-22 


hypervisor: virtual box etc. 


 


0:10 2013-9-22 


what is a compiling? 


 


source code -> object code 


 


0:13 2013-9-22 


printf(): print formatted 


 


0:16 2013-9-22 


~ // home directory 


 


0:17 2013-9-22 


make hello 


 


0:17 2013-9-22 


clang // compiler name 


 


0:18 2013-9-22 


./ // going into the current directory 


 


0:28 2013-9-22 


corner case 


 


0:31 2013-9-22 


ASCII 


 


0:34 2013-9-22 


layed abstraction 


 


0:35 2013-9-22 


bool 


 


0:44 2013-9-22 


a chunk of storage 


 


0:46 2013-9-22 


the data type provides context to the computer 


 


so that computer know how to interprete the 


 


raw bytes 



 


1:11 2013-9-22 


integer arithmetic 


 


1:11 2013-9-22 


truncation 


 


1:13 2013-9-22 


casting 


 


1:14 2013-9-22 


to cast a data type 


 


1:17 2013-9-22 


%.1f // give me 1 position after the decimal point 


 


1:18 2013-9-22 


precedence: more binding power 


 


1:20 2013-9-22 


boolean expression 


 


1:22 2013-9-22 


boolean ANDing 


 


1:34 2013-9-22 


switch statement 


 





19:30 2013-9-22 Sunday 


API == Application Programming Interface 


 


21:47 2013-9-22 


scope 


 


22:52 2013-9-22 


segmentation fault 


 


23:46 2013-9-22 


jailbreak the original iPhone 


 


23:51 2013-9-22 


warmup 


 



23:55 2013-9-22 


sanity checking 


 


0:08 2013-9-23 


boils down 


 


0:49 2013-9-23 


some undeclared identifier 


 


0:59 2013-9-23 


implementation detail 


 


1:18 2013-9-23 


stack & heap 


 


1:18 2013-9-23 


stack frame 


 


1:22 2013-9-23 


bottom of the stack memory 


 


1:30 2013-9-23 


stack overruns the heap 


 


1:31 2013-9-23 


function calls itself 


 


1:35 2013-9-23 


encryption 


 


1:51 2013-9-23 


plain text -> encrypted text 


 


encryption, decryption 


 


1:58 2013-9-23 


array 


 


2:01 2013-9-23 


constant 


 


2:03 2013-9-23 


preprocessor directive 


 



2:05 2013-9-23 


magic numbers 


 


2:14 2013-9-23 


1 byte == 8 bits 


 


2:15 2013-9-23 


computer scientist 


 


2:19 2013-9-23 


command line argument 


 


 


22:40 2013-9-23 Monday 


type casting 


 


22:50 2013-9-23 


chunk of memory 


 


22:53 2013-9-23 


character array 


 


23:01 2013-9-23 


ASCII == American Standard Code for Information Interchange 


 


23:02 2013-9-23 


ASCII: map character to letters 


 


23:09 2013-9-23 


explicit casting 


 


23:14 2013-9-23 


wrap around 


 


23:16 2013-9-23 


% percent sign 


 


23:21 2013-9-23 


pointer? 


 


23:27 2013-9-23 


leftmost bit 


 


23:28 2013-9-23 



2's complement 


 


23:30 2013-9-23 


command-line argument 


 


23:34 2013-9-23 


argc == arguments count 


 


23:41 2013-9-23 


foo bar baz 


 


0:05 2013-9-24 


screw up 


 


0:13 2013-9-24 


explicit demarcation 


 


0:14 2013-9-24 


null character: '\0' 


 


0:18 2013-9-24 


underneath the hood 


 


0:18 2013-9-24 


null terminating character 


 


0:21 2013-9-24 


sanity check 


 


0:30 2013-9-24 


reimplement that wheel 


 


0:39 2013-9-24 


logrithmic time // binary search 


 


0:40 2013-9-24 


solve problem efficiently 


 


0:42 2013-9-24 


linear search 


 


0:47 2013-9-24 


iLab == Innovation Lab 


 



1:02 2013-9-24 


the running time of that algorithm 


 


1:04 2013-9-24 


Holy Grail 


 


1:08 2013-9-24 


exponential computational complexity 


 


1:10 2013-9-24 


social graphs 


 


1:12 2013-9-24 


"linear search" 


 


1:18 2013-9-24 


sorted array, 


 


binary search 


 


1:20 2013-9-24 


optimal next move 


 


1:22 2013-9-24 


chop half of the problems again & again 


 


1:31 2013-9-24 


verbal pseudo code 


 


12:47 2013-9-24 Tuesday 


selection sort // also quadratic computational complexity 


 


13:05 2013-9-24 


insertion sort 


 


13:16 2013-9-24 


running time of the algorithm 


 


13:18 2013-9-24 


worst-case running time of an algorithm 


 


13:21 2013-9-24 


Ο big-O // worst-case 


 



Ω omega // best-case 


 


Θ theta // the tight bound 


 


13:31 2013-9-24 


merge sort // nlog(n) 


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


14:13 2013-9-24 


asymtotic notation 


 


14:17 2013-9-24 


circular definition 


 


14:24 2013-9-24 


recursion: a function calls itself either directly or indirectly 


 


14:26 2013-9-24 


sigma notation(summation notation) 


 


14:32 2013-9-24 


I screwed up here too 


 


14:34 2013-9-24 


segmentation fault(core dumped) 


 


14:38 2013-9-24 


divide & conquer: 


 


 binary search, recursion 


 


14:42 2013-9-24 


local variables 


 


14:51 2013-9-24 


GDB == GNU Debugger 


 


14:52 2013-9-24 


gdb -tui ./buggy3 


 


14:53 2013-9-24 


gdb prompt 


 


14:54 2013-9-24 


run 



 


14:55 2013-9-24 


breakpoint 


 


14:55 2013-9-24 


break main // set a breakpoint at main 


 


14:57 2013-9-24 


print x 


 


garbage value 


 


15:01 2013-9-24 


display x 


display y 


 


15:01 2013-9-24 


info locals 


 


15:02 2013-9-24 


poke around 


 


15:03 2013-9-24 


swap() now is break, let's dive in 


 


15:04 2013-9-24 


step 


 


15:11 2013-9-24 


they are not in scope 


 


they are not in context 


 


15:11 2013-9-24 


backtrace 


 


15:12 2013-9-24 


frame 1 // get temprorily to main() 


 


15:21 2013-9-24 


emergency contact 


 


15:22 2013-9-24 


the entity we're trying to model 



 


15:23 2013-9-24 


encapsulation 


 


15:36 2013-9-24 


memory leak 


 


15:38 2013-9-24 


asking the operating system for memory, 


 


and forgotten to return 


 


15:41 2013-9-24 


file I/O 


 


15:44 2013-9-24 


a long story short 


 


15:44 2013-9-24 


fopen() returns NULL, some bad things happened 


 


15:45 2013-9-24 


fprintf(): file printf() 


 


15:45 2013-9-24 


fp == file pointer 


 


15:47 2013-9-24 


gedit database // open text file 


 


15:48 2013-9-24 


persistent data // save to harddisk 


 


15:50 2013-9-24 


character array 


 


null character 


 


15:51 2013-9-24 


reusable data structure 


 


15:56 2013-9-24 


char* // pointer to char 


 



16:01 2013-9-24 


char* // address of 1 single character in memory 


 


 


11:44 2013-9-25 Wednesday 


32 bits pointer, 64 bits pointer 


 


11:51 2013-9-25 


byte address 


 


11:52 2013-9-25 


HCI == Human Computer Interaction 


 


12:17 2013-9-25 


malloc() == memory allocation 


 


12:28 2013-9-25 


strcpy() 


 


12:31 2013-9-25 


abstract away the details 


 


12:37 2013-9-25 


scrub or wipe the harddisk 


 


12:40 2013-9-25 


file recovery 


 


12:49 2013-9-25 


placeholder 


 


12:58 2013-9-25 


pointer arithmetic 


 


12:59 2013-9-25 


allocating memory 


 


12:59 2013-9-25 


valgrind 


 


13:05 2013-9-25 


dereferencing things 


 


13:06 2013-9-25 



stack frame 


 


13:08 2013-9-25 


just by chance 


 


13:17 2013-9-25 


& // address of operator 


 


13:19 2013-9-25 


text segment // actual program 


 


global variables: 


 


 initialized data, uninitialized data 


 


heap 


 ↓ 


 


 ↑ 


stack 


 


13:23 2013-9-25 


heap: free store 


 


13:24 2013-9-25 


dynamic memory 


 


13:32 2013-9-25 


segmentation fault 


 


13:34 2013-9-25 


pointer, pointee 


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


15:17 2013-9-25 


objective c 


 


15:23 2013-9-25 


BMP == bitmap 


 


15:30 2013-9-25 


JPEG 


 


15:30 2013-9-25 


file recovery 



 


15:34 2013-9-25 


open source 


 


15:35 2013-9-25 


dynamic memory allocation 


 


15:35 2013-9-25 


#include <stdbool.h> // to use bool 


 


15:42 2013-9-25 


#include // sharp include 


 


15:44 2013-9-25 


sentinel value 


 


15:47 2013-9-25 


corner case 


 


15:48 2013-9-25 


sscanf() // string scanf() 


 


15:51 2013-9-25 


parse 


 


15:52 2013-9-25 


garbage value 


 


15:55 2013-9-25 


expected scenario 


 


15:57 2013-9-25 


fgetc() // file get char() 


 


15:58 2013-9-25 


stdin == standard input 


 


15:59 2013-9-25 


EOF == End Of File 


 


Ctrl + D // apple computer 


 


Ctrl + Z // windows 


 



16:00 2013-9-25 


realloc() // reallocate memory 


 


16:06 2013-9-25 


buffer: a bunch of space that you can put data in 


 


16:08 2013-9-25 


buffer overflow attack 


 


16:09 2013-9-25 


return address 


 


16:10 2013-9-25 


memcpy() // memory copy 


 


16:11 2013-9-25 


saved frame pointer 


 


16:11 2013-9-25 


unallocated stack space 


 


16:14 2013-9-25 


Return Address 


 


16:16 2013-9-25 


attack code 


 


16:17 2013-9-25 


trial & error 


 


16:18 2013-9-25 


recycle bin or trash can 


 


16:19 2013-9-25 


table lookup 


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


16:44 2013-9-25 


style50 


 


16:51 2013-9-25 


cs50 Library 


 


16:54 2013-9-25 


scanf() 



 


16:56 2013-9-25 


* // dereference operator 


 


16:57 2013-9-25 


int x; 


 


scanf("%d", &x); 


 


17:08 2013-9-25 


segmentation fault(core dumped) 


 


17:12 2013-9-25 


arrays has some upsides & downsides 


 


17:14 2013-9-25 


structure 


 


17:14 2013-9-25 


typedef struct { 


 .... 


 .... 


} nodeT; 


 


17:17 2013-9-25 


strlen() 


 


17:17 2013-9-25 


dynamic array 


 


17:18 2013-9-25 


dynamically allocate memory 


 


17:20 2013-9-25 


linked list 


 


17:26 2013-9-25 


address of the 1st chunk of memory 


 


17:28 2013-9-25 


doubly-linked list 


 


17:31 2013-9-25 


sequential access, random access 



 


17:33 2013-9-25 


self-referential structure 


 


17:35 2013-9-25 


typedef struct node { 


 int n; 


 struct node *next; 


} node; 


 


17:58 2013-9-25 


linear search 


 


17:58 2013-9-25 


BST == Binary Search Tree 


 


17:59 2013-9-25 


stack: LIFO(Last In First Out) 


 


18:01 2013-9-25 


queue: FIFO(First In First Out) 


 


18:06 2013-9-25 


ADT == Abstract Data Structure 


 


18:10 2013-9-25 


dequeue() 


 


enqueue() 


 


18:11 2013-9-25 


ring buffer(FIFO) 


 


18:12 2013-9-25 


linear operation 


 


18:12 2013-9-25 


to gain the additional performance 


 


18:13 2013-9-25 


to have people just wrap around // ring buffer 


 


18:13 2013-9-25 


% // modular operator 



 


18:14 2013-9-25 


constant time 


 


18:15 2013-9-25 


hash table 


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


19:27 2013-9-25 


valgrind // tool detecting memory allocation etc. 


 


19:39 2013-9-25 


segmentation fault(core dumped) 


 


19:43 2013-9-25 


int *pi = NULL; // commonly 32 bits pointer 


 // but some advance computer has 64 bits pointer 


 


19:44 2013-9-25 


'\0' // backslash zero(null character) 


 


19:50 2013-9-25 


malloc() 


 


free() 


 


19:51 2013-9-25 


sanity check 


 


19:51 2013-9-25 


how to use valgrind to detect memory leak at command line? 


 


valgrind -v --leak-check=full ./memory 


 


// v == verbose 


 


19:54 2013-9-25 


hexadicimal notation // 0x 


 


19:54 2013-9-25 


sizeof(int) == 4 bytes, which is 32 bits 


 


19:55 2013-9-25 


invalid write 


 



19:56 2013-9-25 


you screwed up somewhere 


 


19:58 2013-9-25 


asking the operating system again & again for memory 


 


20:05 2013-9-25 


function prototype 


 


function implementation 


 


20:07 2013-9-25 


global variable 


 


20:12 2013-9-25 


arrow operator -> 


 


20:17 2013-9-25 


update a pointer 


 


20:18 2013-9-25 


newptr == new pointer 


 


20:20 2013-9-25 


insertion at tail 


 


20:20 2013-9-25 


I'm just walking the list 


 


20:22 2013-9-25 


insert at head 


 


insert at tail 


 


insert at middle 


 


20:23 2013-9-25 


hash table 


 


20:26 2013-9-25 


hash function 


 


20:30 2013-9-25 


constant time insertion & dynamic insertion 



 


20:31 2013-9-25 


uniformly distributed 


 


20:32 2013-9-25 


probability of collision 


 


20:37 2013-9-25 


linear probing 


 


20:37 2013-9-25 


separate chaining 


 


20:39 2013-9-25 


constant time insertion 


 


20:40 2013-9-25 


traverse the linked list 


 


20:47 2013-9-25 


tree: some of the jargons 


 


root, leaves, parent, child, sibling 


 


20:48 2013-9-25 


binary search 


 


20:48 2013-9-25 


BST == Binary Search Tree 


 


20:53 2013-9-25 


trie 


 


21:04 2013-9-25 


markup language <> 


 


21:05 2013-9-25 


html5 


 


21:05 2013-9-25 


CSS == Cascading Style Sheet 


 


21:05 2013-9-25 


generate dynamic htmls 



 


21:07 2013-9-25 


JavaScript 


 


21:09 2013-9-25 


He's fast, He's strong, He's TCP/IP 


 


21:11 2013-9-25 


spell checker 


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


21:17 2013-9-25 


web programming 


 


21:17 2013-9-25 


PHP, JavaScript and the like 


 


21:50 2013-9-25 


compress data 


 


21:53 2013-9-25 


Huffman coding 


 


21:54 2013-9-25 


Huffman tree(a kind of binary tree) 


 


use short code for common character 


 


use long code for noncommon character 


 


21:59 2013-9-25 


Huffman coding tree 


 


22:07 2013-9-25 


compressing information 


 


22:08 2013-9-25 


there can be no confusion of prefix and actual code, 


 


because all alphabets we're encoding ARE LEAVES. 


 


so a prefix of coding can not be leaves! 


 


22:11 2013-9-25 


How many bits have to be flipped to convert from 



 


uppercase 'A' to lowercase 'a'? 


 


A 01000001 


 


a 01100001 


 


22:11 2013-9-25 


just 1 bit! 


 


22:13 2013-9-25 


bitwise operator 


 


22:14 2013-9-25 


bitwise OR 


 


22:16 2013-9-25 


flipping a bit 


 


22:16 2013-9-25 


mask 


 


22:22 2013-9-25 


hexadecimal: 0x20 == 32 


 


22:29 2013-9-25 


left shift operator 


 


22:37 2013-9-25 


c uses 8 bits to represent every bool! 


 


22:39 2013-9-25 


bitwise operation 


 


22:40 2013-9-25 


GIF == Graphic Interchange Format 


 


22:44 2013-9-25 


lossless compression 


 


22:44 2013-9-25 


JPEG is a lossy format! 


 


22:45 2013-9-25 



GIF is lossless compression format! 


 


22:56 2013-9-25 


throw away information that does not change in between frames! 


 


22:56 2013-9-25 


interframe compression 


 


22:58 2013-9-25 


clang takes source code, and convert it into object code 


 


22:59 2013-9-25 


4 steps: preprocessing, compiling, assembling, linking 


 


23:00 2013-9-25 


#include // sharp include, this is preprocessing directive 


 


23:01 2013-9-25 


copy & paste 


 


23:01 2013-9-25 


assembly language 


 


23:05 2013-9-25 


linking: merge my 1s & 0s with his 0s & 1s 


 


23:06 2013-9-25 


static library, dynamic library 


 


23:09 2013-9-25 


web programming & networking 


 


23:09 2013-9-25 


html5, JavaScript, PHP, CSS, sql.... 


 


23:11 2013-9-25 


http == Hyper Text Transfer Protocol 


 


23:12 2013-9-25 


http is a protocol which web browser & web server 


 


uses to communicating... 


 


23:14 2013-9-25 



what the web browser send? 


 


GET / HTTP /1.1 


Host: www.facebook.com 


 


23:15 2013-9-25 


chrome 


 


23:16 2013-9-25 


html == hyper text markup language 


 


23:16 2013-9-25 


when your browser request a web page, it .... 


 


23:16 2013-9-25 


web browser request <-> web server respond 


 


23:17 2013-9-25 


<> angle bracket 


 


23:21 2013-9-25 


google chrome 


 


23:25 2013-9-25 


start tag, close tag(end tag) 


 


23:26 2013-9-25 


< open bracket 


 


> closing bracket 


 


23:29 2013-9-25 


path 


 


23:30 2013-9-25 


attribute 


 


23:31 2013-9-25 


text editor 


 


23:32 2013-9-25 


hyperlinks 


 


23:34 2013-9-25 



<br/> 


 


23:34 2013-9-25 


href == hyper reference 


 


23:35 2013-9-25 


Am I done yet? 


 


23:37 2013-9-25 


scratching the surface 


 


23:37 2013-9-25 


php allows us to generate html page automatically, 


 


and generate JavaScript automatically 


 


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


23:44 2013-9-25 


dpi == digit per inch 


 


23:45 2013-9-25 


c -> php, JavaScript // from low-level to higher-level 


 


23:45 2013-9-25 


Android, ios programming 


 


// 


11:03 2013-9-26 Thursday 


API == Application Programming Interface 


 


11:21 2013-9-26 


CSV == Comma Separated Values 


 


11:22 2013-9-26 


HarvardFood API 


 


11:23 2013-9-26 


html == hyper text markup language 


 


11:23 2013-9-26 


html5 


 


11:24 2013-9-26 


start tag, stop tag 



 


11:24 2013-9-26 


line break 


 


11:32 2013-9-26 


apache 


 


11:33 2013-9-26 


server 


 


11:33 2013-9-26 


localhost 


 


11:35 2013-9-26 


domain name 


 


11:35 2013-9-26 


you can actually use the same server, 


 


and develop hundreds of same websites 


 


11:37 2013-9-26 


vhosts == virtual hosts 


 


11:40 2013-9-26 


apache web server 


 


11:43 2013-9-26 


mv == move 


 


11:46 2013-9-26 


<br/> // line break 


 


11:48 2013-9-26 


<p> </p> // use to denote a paragraph 


 


11:50 2013-9-26 


hyperlinks 


 


11:50 2013-9-26 


<a href = "...."> // hyper reference 


 


11:55 2013-9-26 


attribute generally modify the behavior of tag 



 


12:01 2013-9-26 


interactive website 


 


12:08 2013-9-26 


ls -l 


 


12:09 2013-9-26 


permission 


 


12:11 2013-9-26 


rw == read write 


 


12:12 2013-9-26 


my group, anyone else in the world 


 


12:13 2013-9-26 


chmod == change mode 


 


12:33 2013-9-26 


http == hyper text transfer protocol 


 


12:35 2013-9-26 


request + respond 


 


12:39 2013-9-26 


caching for performance 


 


12:47 2013-9-26 


traceroute 


 


12:49 2013-9-26 


router 


 


12:57 2013-9-26 


web browser + server 


 


12:57 2013-9-26 


html == hyper text markup language 


 


http == hyper text transfer protocol 


 


12:58 2013-9-26 


http is just a service of the internet 



 


12:59 2013-9-26 


TCP/IP 


 


13:03 2013-9-26 


IP address 


 


13:03 2013-9-26 


IPv6 


 


13:04 2013-9-26 


Port 


 


13:05 2013-9-26 


https == http security 


 


13:06 2013-9-26 


SMTP == Simple Mail Transfer Protocol 


 


13:09 2013-9-26 


nslookup == name server lookup 


 


13:11 2013-9-26 


DNS == Domain Name Server 


 


13:12 2013-9-26 


TCP/IP just put all information into an envelope, 


 


then write the destination address & return address 


 


on the envelope 


 


13:14 2013-9-26 


warriors of the net // Ericsson 


 


13:14 2013-9-26 


TCP packet 


 


13:16 2013-9-26 


ICMP Ping Packet 


 


13:17 2013-9-26 


UDP Packet 


 



13:17 2013-9-26 


the Router 


 


13:17 2013-9-26 


Ping of Death 


 


13:17 2013-9-26 


the Router switch 


 


13:20 2013-9-26 


LAN == Local Area Network 


 


13:21 2013-9-26 


IP packets 


 


13:22 2013-9-26 


router switch 


 


13:27 2013-9-26 


firewall 


 


13:28 2013-9-26 


router & switch 


 


13:33 2013-9-26 


corporate firewall 


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


13:44 2013-9-26 


CSS == Cascading Style Sheet 


 


13:46 2013-9-26 


programming language 


 


13:46 2013-9-26 


markup language 


 


13:52 2013-9-26 


style attribute 


 


14:01 2013-9-26 


separate CSS file from html file! 


 


14:01 2013-9-26 


CSS file usually embedded in html file 



 


14:04 2013-9-26 


div == division 


 


14:19 2013-9-26 


transition from c to php 


 


14:19 2013-9-26 


PHP 


 


http://us2.php.net/manual/en/langref.php 


 


14:23 2013-9-26 


interpreted language 


 


14:27 2013-9-26 


$x $y $z 


 


14:27 2013-9-26 


How to declare array in c & php? 


 


in c, use { } // curly braces 


 


in php, use [ ] // square brackets 


 


14:30 2013-9-26 


php has foreach() loop 


 


14:38 2013-9-26 


numeric indexed array 


 


14:38 2013-9-26 


associated array 


 


14:43 2013-9-26 


run in a interpreter 


 


15:06 2013-9-26 


hash table 


 


15:14 2013-9-26 


KJV == King James Bible 


 


15:14 2013-9-26 



spell checker 


 


15:16 2013-9-26 


trade off between space, time, development effort 


 


15:20 2013-9-26 


interpreted languages 


 


15:27 2013-9-26 


html that represent this webpage 


 


15:28 2013-9-26 


php is a web-centrl language 


 


15:34 2013-9-26 


html language can be put in php file 


 


15:35 2013-9-26 


mutual exclusive radio buttons 


 


15:39 2013-9-26 


query string 


 


15:41 2013-9-26 


get & post 


 


15:41 2013-9-26 


comingle html & php 


 


15:42 2013-9-26 


print_r == print recursively 


 


15:43 2013-9-26 


whenever you submit a form by "get & post" 


 


15:45 2013-9-26 


http parameter 


 


15:47 2013-9-26 


super global variable 


 


15:48 2013-9-26 


bootstrap library 


 



15:48 2013-9-26 


free available library 


 


15:55 2013-9-26 


%_POST // post super global variable 


 


15:56 2013-9-26 


go ahead and yell at the user 


 


15:56 2013-9-26 


chmod == change mode 


 


15:57 2013-9-26 


switch mode between html & php // html & php can comingle 


 


15:58 2013-9-26 


allow me to toggle between html & php 


 


15:58 2013-9-26 


require statement // similar to #include directive in c 


 


15:59 2013-9-26 


PHPMailer 


 


16:00 2013-9-26 


php is an Object-Oriented language 


 


16:02 2013-9-26 


SMTP == Simple Mail Transfer Protocol 


 


16:04 2013-9-26 


concatenation 


 


16:07 2013-9-26 


if the user screwed up 


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


16:09 2013-9-26 


mySQL, database, web programming 


 


// 


8:45 2013-9-27 Friday 


php, web programming 


 


8:48 2013-9-27 



html == hyper text markup language 


 


css == cascading style sheet 


 


8:53 2013-9-27 


ajax(using JavaScript) 


 


8:53 2013-9-27 


superglobals 


 


8:55 2013-9-27 


%_COOKIE 


 


%_SESSION 


 


8:56 2013-9-27 


superglobals are just kind of shopping basket 


 


8:58 2013-9-27 


% // dollar sign 


 


8:59 2013-9-27 


%counter 


 


9:01 2013-9-27 


server side 


 


9:05 2013-9-27 


keep your source code well-organized 


 


9:06 2013-9-27 


MVC == Model View Controller 


 


9:06 2013-9-27 


calling functions, query databases... 


 


9:10 2013-9-27 


index.php 


 


9:11 2013-9-27 


smarter, longer thinking design 


 


9:13 2013-9-27 


c's sharp include mechanism // #include<stdio.h> 



 


php use keyword "require" for the same purpose 


 


9:19 2013-9-27 


dynamism 


 


9:23 2013-9-27 


subdirectory 


 


9:24 2013-9-27 


require() 


 


require_once() 


 


9:56 2013-9-27 


go get into the parent directory 


 


10:01 2013-9-27 


SQL == Structured Query Language 


 


10:03 2013-9-27 


phpMyAdmin 


 


10:09 2013-9-27 


database is compromised 


 


10:21 2013-9-27 


DBA == DataBase Administrator 


 


10:21 2013-9-27 


relational database 


 


10:22 2013-9-27 


PK == Primary Key 


 


10:24 2013-9-27 


enforce uniqueness for me 


 


10:26 2013-9-27 


web-based GUI 


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


10:44 2013-9-27 


superglobal, associated array 


 



10:45 2013-9-27 


incarnation of a shopping cart 


 


10:46 2013-9-27 


the session closed 


 


10:48 2013-9-27 


session_start() 


 


10:50 2013-9-27 


php is weakly-typed 


 


10:51 2013-9-27 


$_SESSION // session superglobal 


 


10:54 2013-9-27 


raw source code 


 


10:55 2013-9-27 


developing website 


 


11:02 2013-9-27 


real juicy line 


 


11:06 2013-9-27 


cookie: a text file or binary data that web server plant in web browser 


 


just a kind of "hand stamp", it includes the past visiting history 


 


11:09 2013-9-27 


the cookie is sent back & forth through the net 


 


11:11 2013-9-27 


https // http secure 


 


11:14 2013-9-27 


best practice 


 


11:18 2013-9-27 


http & public WIFI is not secure 


 


11:20 2013-9-27 


database design 


 



11:21 2013-9-27 


user friendly way of view database 


 


11:22 2013-9-27 


poke around table 


 


11:30 2013-9-27 


VARCHAR == Variable Length Char 


 


11:33 2013-9-27 


the price you pay is performance 


 


11:35 2013-9-27 


random access 


 


11:46 2013-9-27 


primary, unique 


 


11:49 2013-9-27 


A_I == Auto Increment 


 


11:51 2013-9-27 


SQL query 


 


11:56 2013-9-27 


this database design is inefficient 


 


12:04 2013-9-27 


don't store information redundantly in any of my tables 


 


12:13 2013-9-27 


OS == Operating System 


 


12:22 2013-9-27 


lock every else out 


 


12:23 2013-9-27 


atomicity 


 


12:25 2013-9-27 


a bad scenario would be... 


 


12:26 2013-9-27 


transaction 



 


12:27 2013-9-27 


start transaction 


 


12:30 2013-9-27 


JavaScript 


 


12:32 2013-9-27 


DOM == Docuemnt Object Model 


 


12:34 2013-9-27 


what nice about html is that it does has 


 


this hierarchical nature 


 


12:35 2013-9-27 


JavaScript can navigate throught the tree much more easily 


 


12:38 2013-9-27 


what's the difference between php & javascript? 


 


php is usually used by the server side, 


 


javascript is usually used by the browser.... 


 


12:39 2013-9-27 


B/S == Browser, Server 


 


12:40 2013-9-27 


Browser side, Server side 


 


12:41 2013-9-27 


javascript is also weakly typed 


 


12:42 2013-9-27 


variable in JavaScript 


 


var s = "hello, world!"; 


 


12:45 2013-9-27 


{ // open curly braces 


 


} // close curly braces 


 



12:47 2013-9-27 


JavaScript has no big deal with Java actually 


 


12:49 2013-9-27 


div // rectangular division of the page 


 


12:52 2013-9-27 


javascript code embedded in my webpage 


 


12:52 2013-9-27 


javascript is an object-oriented language 


 


12:56 2013-9-27 


CSS == Cascading Style Sheet 


 


12:56 2013-9-27 


CSS, html are not programming language 


 


13:00 2013-9-27 


address bar, title bar 


 


13:00 2013-9-27 


function pointer 


 


14:31 2013-9-27 


<script> // script tag 


 


14:32 2013-9-27 


js == JavaScript 


 


14:33 2013-9-27 


jquery 


 


14:34 2013-9-27 


raw JavaScript 


 


14:35 2013-9-27 


anonymous functions: 


 


 functions which has no name but have a body 


 


14:37 2013-9-27 


tree representation 


 



14:41 2013-9-27 


event handler 


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


14:44 2013-9-27 


user experience 


 


14:45 2013-9-27 


ajax: a kind of asynchronous JavaScript 


 


14:52 2013-9-27 


design tells us what to build? 


 


14:55 2013-9-27 


UCD == User Centered Design 


 


14:58 2013-9-27 


accessible 


 


intuitive 


 


efficient 


 


15:05 2013-9-27 


ease of use 


 


15:11 2013-9-27 


facebook 


 


15:17 2013-9-27 


privacy is a huge user experience issue 


 


15:35 2013-9-27 


UI mechanism 


 


15:36 2013-9-27 


develop, test, iterate 


 





15:00 2013-9-29 


dereference operator 


 


15:12 2013-9-29 


double pointer 


 



15:18 2013-9-29 


segmentation fault 


 


16:43 2013-9-29 


anode+ 


 


cathode- 


 


17:37 2013-9-29 


forward declaration 


 


17:59 2013-9-29 


a light-weight version of process called threads 


 


18:00 2013-9-29 


concurrency 


 


18:00 2013-9-29 


when you build scratch programs, you constantly use concurrency 


 


18:04 2013-9-29 


event handling 


 


18:05 2013-9-29 


each running inside its own threads 


 


18:08 2013-9-29 


concurrency, concurrent programming 


 


18:27 2013-9-29 


sscanf() == string scanf() 


 


18:28 2013-9-29 


format string 


 


18:29 2013-9-29 


%d, %c // conversion specifier 


 


18:30 2013-9-29 


parse from the string 


 


18:31 2013-9-29 


format specification 


 



18:32 2013-9-29 


whitespace 


 


18:36 2013-9-29 


buffer overflow attack 


 


18:39 2013-9-29 


fgetc() 


 


18:39 2013-9-29 


stdin == standard input 


 


18:41 2013-9-29 


strncpy() 


 


18:45 2013-9-29 


character string(also called string) 


 


18:45 2013-9-29 


'\0' // backslash zero 


 


18:51 2013-9-29 


binary tree 


 


18:51 2013-9-29 


BST == Binary Search Tree 


 


18:52 2013-9-29 


subtree 


 


18:56 2013-9-29 


degenerate case 


 


18:56 2013-9-29 


balanced tree 


 


19:00 2013-9-29 


decimal notation 


 


19:02 2013-9-29 


base 


 


19:12 2013-9-29 


binary notation 



 


19:20 2013-9-29 


inline comments 


 


19:22 2013-9-29 


multiline comments at the top 


 


19:27 2013-9-29 


CR == Carriage Return 


 


19:29 2013-9-29 


indentation == 4 spaces 


 


19:53 2013-9-29 


side effect 


 


19:59 2013-9-29 


declare a variable 


 


20:11 2013-9-29 


underscore convention 


 


20:12 2013-9-29 


camel case convention 


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


20:16 2013-9-29 


scope: context in which variables are visible or accessible 


 


20:23 2013-9-29 


function call stack 


 


20:23 2013-9-29 


stack frame 


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


20:25 2013-9-29 


variables 


 


20:25 2013-9-29 


mutable: can be changed after being defined 


 


20:26 2013-9-29 


local variable 


 


20:26 2013-9-29 



global variable 


 


20:27 2013-9-29 


local variable: 


 


 variable which is declared within functions 


 


20:28 2013-9-29 


scope: where these varialbes can be used in the program 


 


20:28 2013-9-29 


global scope 


 


20:28 2013-9-29 


local scope 


 


20:29 2013-9-29 


memory map: 


 


 initialized variables 


 


 uninitialized variables 


 


20:30 2013-9-29 


# // pronouced as "sharp" or "hash" 


 


20:31 2013-9-29 


named constant 


 


magic number 


 


20:32 2013-9-29 


because global variable clutter the namespace 


 


20:34 2013-9-29 


the C standard Libraries 


 


20:35 2013-9-29 


one of the essential skills of engineering is to know 


 


tools available in your toolbox. 


 


20:37 2013-9-29 


header file + implementation file 



 


20:38 2013-9-29 


interface 


 


20:38 2013-9-29 


man pages // man == manual 


 


20:40 2013-9-29 


information hiding(encapsulation) 


 


20:42 2013-9-29 


"source files" compiled into "object files", // compiler 


 


then linked together to form "binary file" // linker 


 


20:44 2013-9-29 


pounding include the header files // #include <stdio.h> 


 


20:45 2013-9-29 


< left angle bracket 


 


> right angle bracket 


 


20:45 2013-9-29 


binary library file 


 


20:47 2013-9-29 


how to link library binary files? 


 


-lcrypt // crypt library 


 


-lcs50 // cs50 library 


 


-lm // math library 


 


20:50 2013-9-29 


HLL // High Level Language 


 


assembly language 


 


machine language 


 


20:52 2013-9-29 


preprocessing 



 


20:52 2013-9-29 


preprocessing directive 


 


20:53 2013-9-29 


preprocessor 


 


20:54 2013-9-29 


<stdio.h> copied and paste into the top of the file 


 


20:55 2013-9-29 


compilation: 


 compile from source code into assembly code 


 


20:56 2013-9-29 


assembly code is very processor specific 


 


20:59 2013-9-29 


assembler: 


 assemble "assembly code" into "machine code" // object code 


 


21:01 2013-9-29 


linking: linker links several object file into single binary file 


 


21:01 2013-9-29 


linking is very system dependent 


 


21:05 2013-9-29 


ASCII == American Standard Code for Information Interchange 


 


21:06 2013-9-29 


represent letters in binary notation 


 


21:06 2013-9-29 


character code 


 


21:07 2013-9-29 


digit character 


 


21:08 2013-9-29 


How to represent text in computer? 


 


21:09 2013-9-29 


different encoding schemes 



 


21:09 2013-9-29 


ANSI == American National Standard Institute 


 


21:10 2013-9-29 


ASCII uses a 7 bits encoding 


 


21:11 2013-9-29 


teletype machines: 


 typewriters which can send information through the net 


 


21:12 2013-9-29 


backspace character 


 


21:12 2013-9-29 


LF == LineFeed 


 


21:13 2013-9-29 


control characters 


 


21:16 2013-9-29 


control characters + printable characters 


 


21:18 2013-9-29 


Why is that the lowercase letters & uppercase letters 


 


are designed as such? 


 


because it's easy to toggle between them using bitwise operation 


 


21:20 2013-9-29 


just a simple bit flip 


 


21:21 2013-9-29 


Unicode 


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


21:21 2013-9-29 


typecasting: 


 to alter computer's interpretation by implicitly or 


 


explicitly changing its datatype. 


 


21:23 2013-9-29 


numeric datatype 



 


21:23 2013-9-29 


data type: how to interpret that raw bit pattern? 


 


21:25 2013-9-29 


How to interpret data type? 


 


wind can be a "noun" or a "verb", it depends... 


 


21:28 2013-9-29 


Why data type? 


 


how to interpret those 0s & 1s 


 


21:33 2013-9-29 


truncation 


 


21:33 2013-9-29 


chopping off 


 


21:33 2013-9-29 


loss of precision 


 


21:34 2013-9-29 


significant digits 


 


21:34 2013-9-29 


implicitly casting & explicitly casting 


 


21:36 2013-9-29 


because double has more precision than it, so 


 


we won't lose any information. 


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


21:40 2013-9-29 


yet under the hood, all the files are nothing but a long 


 


sequence of zeros & ones 


 


21:45 2013-9-29 


How to open a file in c? 


 


FILE* fp = fopen(strFileName, "w"); // fp == file pointer 


 



21:47 2013-9-29 


w == write, 


 


r == read, 


 


a == append 


 


21:47 2013-9-29 


present working directory 


 


21:49 2013-9-29 


fputs(input, fp); 


 


// what need to be written? 


 


// where can be written? 


 


21:50 2013-9-29 


fp // file pointer, which has type of FILE* 


 


21:51 2013-9-29 


fclose(fp); // close file 


 


21:53 2013-9-29 


char output[256]; 


 


fgets(output, sizeof(output), fp); // read from file 


 


21:54 2013-9-29 


fputs() // write to file 


 


fgets() // read from file 


 


21:54 2013-9-29 


EOF == End Of File 


 


21:55 2013-9-29 


ferror() 


 


feof() 


 


21:57 2013-9-29 


feof() checks whether the end of the file has already been reached? 


 



21:59 2013-9-29 


layer of abstractions 


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


22:02 2013-9-29 


GetString() 


 


22:04 2013-9-29 


mv command == move 


 


22:05 2013-9-29 


mv SOURCE DEST // mv has 2 arguments 


 


22:06 2013-9-29 


int main(int argc, char* argv[]) 





 // great code goes here 





 


22:06 2013-9-29 


argc == argument count 


 


argc is the number of argument(including the command itself) 


 


22:07 2013-9-29 


argv == argument vector 


 


22:09 2013-9-29 


because argv is array of pointer to char(char*), so 


 


argv[0] is char*, which is the command(e.g. mv) 


 


argv[1] contains the 2nd argument(char*) 


 


argv[2] contains the 3rd argument(char*) 


 


argv[3] contains NULL(null character) // notice this! 


 


22:11 2013-9-29 


command line argument 


 


22:11 2013-9-29 


[ open bracket 


 


] close bracket 



 


22:14 2013-9-29 


'\n' // the newline character 


 


22:16 2013-9-29 


nested loop 


 


22:31 2013-9-29 


strlen() 


 


22:32 2013-9-29 


# // can be pronouced as "sharp" or "hash" 





9:44 2013-9-30 Monday 


DOM == Document Object Model 


 


9:47 2013-9-30 


DOM tree 


 


11:37 2013-9-30 


traverse DOM tree using JavaScript 


 


11:41 2013-9-30 


and it's going to really cumbersome 


 


11:42 2013-9-30 


CSS selector 


 


11:42 2013-9-30 


query the document 


 


11:50 2013-9-30 


valgrind 


 


11:53 2013-9-30 


How to use valgrind? 


 


valgrind ./invalid_read 


 


12:00 2013-9-30 


rock on! 


 


12:04 2013-9-30 


1 to 1 correspondence between malloc() & free() 



 


12:06 2013-9-30 


definitely lost // lost the pointer 


 


indirectly lost 


// lost the 1st pointer of linked list, so 


 


// 1st node is "definitely lost", and other nodes 


 


// are indirectly lost 


 


12:08 2013-9-30 


all leak should be eliminated 


 


12:13 2013-9-30 


executable file 


 


12:14 2013-9-30 


flags or options 


 


12:15 2013-9-30 


clang, gcc... 


 


12:18 2013-9-30 


clang hello.c 


 


./a.out 


 


12:19 2013-9-30 


we can use the -o flag 


 


clang hello.c -o hello 


 


./hello 


 


12:20 2013-9-30 


-W // Warning 


 


12:21 2013-9-30 


warning free 


 


12:23 2013-9-30 


-ggdb // I can run gdb debugger when my program crashes 


 



12:25 2013-9-30 


-lcs50 // use the cs50 library 


 


12:27 2013-9-30 


gdb // the GNU Project Debugger 


 


12:33 2013-9-30 


gdb works on executable files 


 


12:33 2013-9-30 


we can use gdb to figure out what's going on 


 


12:35 2013-9-30 


gdb ./factorial 


 


(gdb) r // r == run 


 


12:36 2013-9-30 


b == breakpoint 


 


12:38 2013-9-30 


n == next 


 


12:39 2013-9-30 


l == list 


 


12:40 2013-9-30 


l 12 // line 12 


 


12:41 2013-9-30 


p == print 


 


12:43 2013-9-30 


How to set a breakpoint at a specific location? 


 


(gdb) b factorial.c:14 


 


12:44 2013-9-30 


c == continue 


 


12:45 2013-9-30 


uninitialized variable !!!!!! 


 


12:46 2013-9-30 



info locals 


 


12:47 2013-9-30 


you can use "make" command without left gdb 


 


12:47 2013-9-30 


disable // disable all breakpoints 


 


12:50 2013-9-30 


what does mv command mean? 


 


just use "man mv" // man == manual mv == move 


 


to look up info 


 


12:52 2013-9-30 


cryptography 


 


12:53 2013-9-30 


for example: if KEY == 3, 'a' should shifted to 'd' 


 


13:03 2013-9-30 


Alice has crush on Bob, fortunately Bob also has eyes on Alice. 


 


13:05 2013-9-30 


Caesar Cipher 


 


13:06 2013-9-30 


wraps up to the beginning of the alphabet 


 


13:09 2013-9-30 


frequency analysis to attack on the Caesar Cipher 


 


13:10 2013-9-30 


brute-force attack 


 


13:12 2013-9-30 


improvement: use multiple shift values 


 


13:12 2013-9-30 


Vigenere cipher 


 


13:14 2013-9-30 


plain text 



 


13:15 2013-9-30 


e.g. use "bacon" as secret key 


 


b, shift == 1 


a, shift == 0 etc 


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


13:18 2013-9-30 


RSA 


 


13:19 2013-9-30 


symmetric key algorithms 


 


13:20 2013-9-30 


RSA, however use a pair of keys, 


 


one for encryption // public key 


 


and another for decryption. // private key 


 


13:21 2013-9-30 


you can share you public key, however 


 


you should always keep your private key secret 


 


13:23 2013-9-30 


if user1 want to communicate with user2: 


 


message sent from user1 to user2 only use user2's key pair 


 


message sent from user2 to user1 only use user1's key pair 


 


13:24 2013-9-30 


RSA ia a "asymmetric key algorithm" 


 


13:51 2013-9-30 


generate 2 prime numbers: p & q 


 


13:51 2013-9-30 


n = p * q 


 


m = (p - 1) * (q - 1) 


 


13:52 2013-9-30 



coprime 


 


13:53 2013-9-30 


modular arithmetic % 


 


13:56 2013-9-30 


our private key will be (d, n) 


 


14:00 2013-9-30 


database(DB) 


 


14:01 2013-9-30 


SQL == Structured Query Language 


 


14:02 2013-9-30 


SELECT, INSERT, UPDATE, DELETE 


 


14:03 2013-9-30 


database can contain many "tables", and 


 


a table can contain many "columns" 


 


14:03 2013-9-30 


table 


 


14:04 2013-9-30 


SELECT statement is used to retrieve data from a specific 


 


database table 


 


14:05 2013-9-30 


phpMyAdmin 


 


14:05 2013-9-30 


SELECT * FROM cupcake_cupboard // cupcake_cupboard is a table 


 


14:08 2013-9-30 


we can select specific column(s) from the table 


 


SELECT CakeID, CakeType FROM cupcake_cupboard 


 


14:10 2013-9-30 


WHERE clause 


 



14:11 2013-9-30 


SELECT * FROM cupcake_cupboard 


 


WHERE CakeIsNice = false // using WHERE clause 


 


14:12 2013-9-30 


VARCHAR 


 


14:13 2013-9-30 


INSERT statement 


 


14:16 2013-9-30 


How to insert a cupcake into cupcake_cupboard? 


 


INSERT INTO cupcake_cupboard 


 


(CakeType, CakeColor, CakeIsNice) 


 


VALUES ('Peanut Butter', 'Light Brown', true) 


 


14:20 2013-9-30 


How to update a cupcake's state? 


 


UPDATE cupcake_cupboard SET 


CakeIsNice = true 


WHERE CakeIsNice = false 


AND CakeType = 'Chocolate' 


 


14:22 2013-9-30 


the DELETE statement 


 


14:23 2013-9-30 


How to delete a cupcake from the cupcake_cupboard? 


 


DELETE FROM cupcake_cupboard 


 


WHERE CakeID = 1 


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


14:28 2013-9-30 


cs50 spaces 
//


18:16 2013-10-7 


infinite recursion 


 


18:16 2013-10-7 


stack overflow 


 


18:25 2013-10-7 


functions are tail-recursive 


 


18:27 2013-10-7 


tail-recursive function can reuse the stack frame 


 


18:33 2013-10-7 


How to write a good binary search function? 


 


18:37 2013-10-7 


binary search can be implemented both as a 


 


1. recursive solution 


 


2. iterative solution 


// 




 










8:09 2013-10-15 Tuesday 


start cs50 section 3 


 


8:15 2013-10-15 


big O is the upperbound, 


 


Omega is the lower bound 


 


8:31 2013-10-15 


main() has its own stack frame 


 


8:53 2013-10-15 


tail recursive functions 


 


8:54 2013-10-15 


it will reuse the same stack frame again 


 


and again for the same recursive call 


 


8:59 2013-10-15 


tail recursive 


 



12:57 2013-10-15 


tail recursive functions 


 


12:59 2013-10-15 


stack overflow 


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


13:47 2013-10-15 


start cs50 section 4 


 


13:55 2013-10-15 


the stack is always growing up 


 


13:55 2013-10-15 


the heap is growing down 


 


13:57 2013-10-15 


stack frame 


 


14:12 2013-10-15 


virtual memory 


 


14:18 2013-10-15 


with a 32 bits system, you have a 


 


4 bytes pointer 


 


10:29 2013-10-16 Wednesday 


start cs50 section 4 


 


10:30 2013-10-16 


undefined behavior 


 


13:19 2013-10-16 


dereference a pointer 


 


21:37 2013-10-16 


3 types of memory management: 


 


1. automatic memory management 


 


2. dynamic memory management 


 


3. static memory management(global) 


 


21:45 2013-10-16 


address space 


 


21:48 2013-10-16 


processes should be completely unaware of one another 


 


21:48 2013-10-16 


virtual mamory 


 


21:50 2013-10-16 


32-bit system 


 


// 


7:43 2013-10-17 Thursday 


cs50 section 4 done! 


 


8:56 2013-10-17 


start review cs50 section 3 


 


10:11 2013-10-17 


iterative solution & recursive solution 


 


10:51 2013-10-17 


any elements in the array is below a certain size 


 


10:58 2013-10-17 



get statistics of the array: 


 


element as key, counts as value 


 


11:15 2013-10-17 


ssh 


 


11:34 2013-10-17 


ssh into the appliance 


 


11:43 2013-10-17 


some text editors: nano, emacs, vi 


 


11:45 2013-10-17 


Notepad++, text wrangler 


 


11:47 2013-10-17 


stream 


 


11:48 2013-10-17 


stdin == standard input 


 


stdout == standard output 


 


stderr == standard error 


 


11:50 2013-10-17 


stream of bytes 


 


11:53 2013-10-17 


redirect stdin 


 


redirect stdout 


 


11:59 2013-10-17 


redirecting stderr 


 


12:00 2013-10-17 


printf(), sprintf(), fprintf() 


 


12:04 2013-10-17 


pipeline 


 


12:07 2013-10-17 



wc == word count 


 


12:09 2013-10-17 


What is a pipeline? 


 


sort names.txt | uniq 


 


12:13 2013-10-17 


seg fault 


 


12:13 2013-10-17 


segmentation fault, core dumped! 


 


12:13 2013-10-17 


What is a seg fault? 


 


you are touching memory that you should not touching 


 


12:14 2013-10-17 


dereference a null pointer results a seg fault, 


 


because memory address 0 is not touchable 


 


12:16 2013-10-17 


segmentation fault(core dumped) 


 


12:17 2013-10-17 


read-only memory 


 


12:18 2013-10-17 


What is a read-only memory? 


 


char *s = "hello, world!"; 


 


// s is in stack, but string literal is read-only memory 


 


12:19 2013-10-17 


char s[] = "hello, world!"; // s is in stack 


 


12:21 2013-10-17 


What is a core dumped? 


 


when the program crashes, the state of memory all 


 



copied into the core, and dumped into the file 


 


12:23 2013-10-17 


bt == backtrace 


 


12:25 2013-10-17 


gdb buggy1 core 


 


12:25 2013-10-17 


frame 1 


 


12:25 2013-10-17 


up, down(up or down frame) 


 


12:31 2013-10-17 


dereference a null pointer results in a crash 


 


12:34 2013-10-17 


break main // set a breakpoint at main 


 


12:36 2013-10-17 


next // step over 


 


step // step into 


 


12:44 2013-10-17 


char *s = malloc(sizeof(char)); 


 


12:46 2013-10-17 


strcpy() 


 


13:16 2013-10-17 


constant pointer 


 


13:22 2013-10-17 


array is just a constant pointer 


 


13:27 2013-10-17 


sizeof() is an operator 


 


13:51 2013-10-17 


fd == file descriptor 


 


13:53 2013-10-17 



termios 


 


14:10 2013-10-17 


stop 


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


16:11 2013-10-17 


wget // get something from the internet 


 


16:21 2013-10-17 


gdb buggy1 core 


 


16:22 2013-10-17 


segmentation fault 


 


16:23 2013-10-17 


bt == backtrace 


 


16:26 2013-10-17 


How to pass commandline arguments? 


 


CS50\ rocks // using escape sequence, 


 


otherwise only CS50 will be passed as the argv[1] 


 


17:25 2013-10-17 


sizeof() operator 


 


17:27 2013-10-17 


%p // format specifier to print pointer 


 


17:42 2013-10-17 


struct termios current_settings; 


 


17:43 2013-10-17 


current_settings, hacker_settings 


 


17:45 2013-10-17 


fd == file descriptor 


 


17:51 2013-10-17 


tcgetattr() 


 


tcsetattr() 


 



17:52 2013-10-17 


ICANON // canonical mode 


 


18:01 2013-10-17 


Where is the fd(file descriptor)? 


 


FILE* fp = fopen(...); 


 


then file descriptor(fd) is inside this FILE* 


 


// 


8:47 2013-10-18 Friday 


valgrind 


 


8:55 2013-10-18 


stack, stack frame 


 


LIFO == Last In First Out 


 


9:11 2013-10-18 


calloc(), realloc() 


 


9:13 2013-10-18 


void * // generic pointer 


 


9:13 2013-10-18 


dynamic memory 


 


9:30 2013-10-18 


enqueue(), dequeue() 


 


9:36 2013-10-18 


memcpy() 


 


9:54 2013-10-18 


memmove() 


 


10:05 2013-10-18 


pointer arithmetic 


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


20:34 2013-10-18 


start cs50 section 6 


 


20:35 2013-10-18 



valgrind 


 


20:52 2013-10-18 


alloc(), calloc(), realloc() 


 


21:01 2013-10-18 


stop section 6(not complete) 


 


21:02 2013-10-18 


stop section 7(binary tree) 


 


21:05 2013-10-18 


PHP is a dynamically-typed language 


 


21:05 2013-10-18 


what is a dynamically-typed language? 


 


type-checking happens at runtime 


 


21:06 2013-10-18 


what is a statically-typed language 


 


type-checking happens at compile-time 


 


21:18 2013-10-18 


http://php.net/manual/en/ 


 


21:20 2013-10-18 


regular array <-> associative array 


 


21:24 2013-10-18 


weakly typed, strongly typed 


 


21:54 2013-10-18 


print_r // print recursively 


 


22:46 2013-10-18 


pass arguments by reference 


 


23:05 2013-10-18 


cs50 section 8 php done! 


 


// 


16:06 2013-10-19 Saturday 



little-endian 


 


16:37 2013-10-19 


ajax 


 


16:37 2013-10-19 


jQuery 


 


17:01 2013-10-19 


thread 


 


17:02 2013-10-19 


php lives in the server 


 


17:02 2013-10-19 


JavaScript is client side. 


 


17:13 2013-10-19 


XML == eXtensible Markup Language 


 


17:26 2013-10-19 


stop cs50 section 9 


 


19:40 2013-10-19 


What is a shell? 


 


shell is the interface for user to computer OS 


 


19:44 2013-10-19 


sh == shell 


 


19:45 2013-10-19 


csh == c shell 


 


19:45 2013-10-19 


tcsh == tc shell 


 


19:46 2013-10-19 


ksh == Kron shell 


 


19:47 2013-10-19 


bash == ba shell 


 


19:51 2013-10-19 



DEC == Digital Equipment Corporation 


 


19:53 2013-10-19 


shell script 


 


19:55 2013-10-19 


$* // refer to all the arguments 


 


$# // refer to number of arguments 


 


19:57 2013-10-19 


What does the pound sign mean in shell? 


 


the # is the comment-line character in all shells 


 


20:08 2013-10-19 


What is the Bourne shell? 


 


Bourne shell is the original shell. 


 


20:09 2013-10-19 


shell specifier 


 


20:12 2013-10-19 


interactive sub-shell 


 


20:19 2013-10-19 


C-shell aliases 


 


20:48 2013-10-19 


history-type reference 


 


21:07 2013-10-19 


positional parameter for shell scripts 


 


21:17 2013-10-19 


what is C-shell variables? 


 


1. environment variables 


 


2. shell variables 


 


21:22 2013-10-19 


setenv == set environment variables 



 


21:23 2013-10-19 


printenv == print environment variable 


 


21:25 2013-10-19 


environment variables <-> shell variables 


 


21:28 2013-10-19 


home directory 


 


21:30 2013-10-19 


path variables 


 


21:37 2013-10-19 


export to the environment 


 


21:46 2013-10-19 


back-quote syntax 


 


21:50 2013-10-19 


built-in command 


 


22:00 2013-10-19 


set noglob 


 


22:21 2013-10-19 


bsd == berkeley standard edition 


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





8:02 2013-10-20 Sunday 


Bourne shell, the original shell 


 


8:06 2013-10-20 


Berkeley unix 


 


8:06 2013-10-20 


C-shell(csh) 


 


8:06 2013-10-20 


tc-shell(tcsh) is a superset of C-shell 


 


8:07 2013-10-20 


shell programming 


 



8:19 2013-10-20 


$* // all the arguments 


 


$# // number of arguments 


 


8:20 2013-10-20 


# // comment-line character 


 


8:22 2013-10-20 


shell specifier line 


 


8:25 2013-10-20 


often, if you type "sh", you get bash, 


 


you type "csh", you get tcsh 


 


8:31 2013-10-20 


login shell 


 


8:32 2013-10-20 


shell specifier 


 


8:34 2013-10-20 


shells can be called as interactive sub-shells. 


 


8:37 2013-10-20 


if a bash-shell running under a C-shell, we call 


 


it a sub-shell 


 


8:37 2013-10-20 


the Bourne-typed shells are prefered for programming 


 


8:38 2013-10-20 


bash-shell has arrays, the original Bourne shell does't 


 


8:45 2013-10-20 


C-shell aliases 


 


8:46 2013-10-20 


wildcast expression 


 


8:48 2013-10-20 


What is a C-shell alias? 



 


alias lgs 'ls g*' 


 


8:54 2013-10-20 


history-type reference 


 


9:02 2013-10-20 


so actually we're using 2 levels of escaping here 


 


9:08 2013-10-20 


history mechanism 


 


9:16 2013-10-20 


stop unix shells 


 


9:19 2013-10-20 


text editor 


 


9:19 2013-10-20 


document processor? 


 


9:19 2013-10-20 


start cs50 seminar on Vim 


 


9:26 2013-10-20 


text object 


 


9:27 2013-10-20 


ciw 


 


9:47 2013-10-20 


Vim is the "modal editor": 


 


1. Normal mode(all keystrokes are interpreted as commands) 


 


2. Insert mode 


 


3. Visual mode(highlighting) 


 


9:51 2013-10-20 


HJKL // as arrow key 


 


9:53 2013-10-20 


How to get into insertion mode? 



 


use 'i' 


 


9:53 2013-10-20 


How to get into normal mode(command)? 


 


ESC 


 


9:56 2013-10-20 


How to save & quit in Vim? 


 


:wq<enter> // : runs the command, w == write, q == quit 


 


10:04 2013-10-20 


:wq == Write & Quit 


 


10:10 2013-10-20 


some advanced movement: 


 


^ == begin line 


 


b == beginning 


 


e == end 


 


w == word 


 


$ == end line 


 


10:13 2013-10-20 


What is a "Operator-Motion Model"? 


 


d2w == delete 2 words 


 


10:15 2013-10-20 


some operators: 


 


d == delete 


 


c == change(delete & go into insertion mode) 


 


y == yank(copy) 


 


v == visual/highlighting 



 


10:16 2013-10-20 


type twice to act upon the entire line: 


 


dd == delete the entire line 


 


10:21 2013-10-20 


What does "dd" mean? 


 


dd == delete the incorrect line 


 


10:21 2013-10-20 


What does "cc" mean? 


 


cc == delete the incorrect line & enter insertion mode 


 


immediately 


 


10:25 2013-10-20 


V == Visual line highlighting 


 


o == open new line for me 


 


x == delete the character under cursor 


 


u == undo 


 


A == append 


 


I == Insert into beginning of line 


 


10:27 2013-10-20 


R == go into Replacement mode 


 


10:28 2013-10-20 


text objects 


 


10:44 2013-10-20 


/ search some word in the document 


 


10:50 2013-10-20 


regular expression 


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


16:43 2013-10-20 



modal editing 


 


16:43 2013-10-20 


normal mode(command mode), insertion mode, 


 


visual mode(highlighting mode) 


 


16:44 2013-10-20 


your keystrokes takes on different meaning 


 


depend on what mode you are in 


 


16:55 2013-10-20 


API == Application Programming Interface 


 


16:57 2013-10-20 


What is a JSON? 


 


JSON == JavaScript Object Notation 


 


17:04 2013-10-20 


plain JavaScript 


 


17:04 2013-10-20 


JSON is a convenient version of JavaScript 


 


17:05 2013-10-20 


DOM == Document Object Model 


 


17:06 2013-10-20 


query the database 


 


17:10 2013-10-20 


in google chrome, use Ctrl + Shift + J to open the 


 


JavaScript Console 


 


17:13 2013-10-20 


hash-map 


 


17:15 2013-10-20 


this is the query object, and this is the object 


 


that web browser sent to the API 



 


17:24 2013-10-20 


facebook API 


 


17:24 2013-10-20 


graph API explorer 


 


17:26 2013-10-20 


Where can we find the facebook API? 


 


developers.facebook.com/docs/reference/api/user/ 


 


17:27 2013-10-20 


What is a "access token" in facebook? 


 


17:31 2013-10-20 


cs50 API 


 


17:33 2013-10-20 


CSV == Comma Separated Value 


 


17:36 2013-10-20 


JQuery 


 


17:37 2013-10-20 


json == JavaScript Object Model 


 


17:49 2013-10-20 


rate limiting feature 


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


17:53 2013-10-20 


Andoid apps 


 


18:00 2013-10-20 


SDK == Software Development Kit 


 


ADT == Android Development Tool 


 


18:04 2013-10-20 


What's your cellphone's Android OS version? 


 


4.1.2 (API 16) 


 


18:11 2013-10-20 



src == source folder 


 


res == resource folder 


 


18:47 2013-10-20 


Jelly Beans (Android OS 4) 


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


19:07 2013-10-20 


surviving the internet 


 


19:19 2013-10-20 


information security 


 


19:26 2013-10-20 


password service manager 


 


19:28 2013-10-20 


2-step verification 


 


19:31 2013-10-20 


the age of privacy is over 


 


19:39 2013-10-20 


WiFi security 


 


19:41 2013-10-20 


WPA2 WIFI 


 


19:42 2013-10-20 


VPN == Virtual Private Network 


 


19:42 2013-10-20 


Encrypt your harddisk: BitLocker 


 


19:46 2013-10-20 


Hushmail 


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


20:21 2013-10-20 


ICT4D == Information Communication Technology For Development 


 


21:09 2013-10-20 


time & space complexity 


 


21:17 2013-10-20 



How to design a shuffle algorithm? 


 


21:20 2013-10-20 


Knuth Shuffle 


 


21:20 2013-10-20 


induction == mathematical induction 


 


21:22 2013-10-20 


How to design an algorithm to solve the problem of Maximal Subarray? 


 


(output == maximum sum) 


 


21:24 2013-10-20 


What can define a subarray? 


 


lowerbound, upperbound 


 


21:26 2013-10-20 


brute force: enumerate all the possibilities 


 


21:29 2013-10-20 


dynamic programming 


 


21:30 2013-10-20 


subproblem 


 


21:33 2013-10-20 


How to use "dynamic programming" to solve the problem 


 


of Maximum Subarray? 


 


21:38 2013-10-20 


subarray 


 


21:41 2013-10-20 


find the recurrence relationship 


 


21:41 2013-10-20 


recurrence 


 


21:42 2013-10-20 


subproblem(i) = max(0, subproblem(i-1) + A(i)) 


 



// this is the recurrence relationship 


 


21:55 2013-10-20 


stock problem: 


 


 output == max profit 


 


21:59 2013-10-20 


bruteforce solution 


 


22:30 2013-10-20 


stack frame 


 


22:32 2013-10-20 


How to convert? 


 


stock market problem -> Maximum Subarray problem 


 


22:41 2013-10-20 


stop 


 


// 


10:01 2013-10-21 Monday 


review seminars Technical Interview(algorithms) 


 


10:14 2013-10-21 


How to shuffle a deck in linear time? 


 


Knuth Shuffle(Fisher-Yates shuffle) 


 


10:14 2013-10-21 


shuffled portion, unshuffled portion 


 


10:20 2013-10-21 


Maximal Subarray 


 


10:29 2013-10-21 


dynamic programming(memorization) 


 


10:43 2013-10-21 


windows 8 App_game development 


 


11:06 2013-10-21 


windows 8 DEMO 



 


11:10 2013-10-21 


MVC == Model View Controller 


 


11:12 2013-10-21 


view: html + CSS 


 


model controller: JavaScript 


 


11:15 2013-10-21 


winRT 


 


11:16 2013-10-21 


IE9 


 


IE10 


 


11:17 2013-10-21 


GPU == Graphics Processing Unit 


 


11:18 2013-10-21 


CSS3 


 


11:25 2013-10-21 


IE10 testDrive 


 


11:26 2013-10-21 


PHP + Apache + mySQL 


 


11:28 2013-10-21 


hijack 


 


11:28 2013-10-21 


framework 


 


11:32 2013-10-21 


what is a WinJS? 


 


WinJS is Windows Library for JavaScript 


 


11:36 2013-10-21 


control 


 


11:37 2013-10-21 



What is a sandbox? 


 


11:44 2013-10-21 


designing UX for apps 


 


11:58 2013-10-21 


Blend for Visual Studio 2012? 


 


GitHub 


 


12:04 2013-10-21 


js == javascript 


 


12:04 2013-10-21 


WinJS: windows's library for JavaScript 


 


12:18 2013-10-21 


media query 


 


12:19 2013-10-21 


CSS media query 


 


12:26 2013-10-21 


GeoLocation 


 


12:31 2013-10-21 


Windows Azure 


 


12:45 2013-10-21 


blend is a tool that work hand in hand with Visual Studio 


 


12:47 2013-10-21 


lightening bolt 


 


12:53 2013-10-21 


contoso bookbook 


 


13:02 2013-10-21 


design mode, interactive mode 


 


13:17 2013-10-21 


simulator, emulator 


 


13:20 2013-10-21 



DOM == Document Object Model 


 


13:20 2013-10-21 


framework 


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


14:02 2013-10-21 


writing apps for ios 


 


14:06 2013-10-21 


ios use programming language: objective-C 


 


14:07 2013-10-21 


programming tool: Xcode 


 


14:08 2013-10-21 


OOP == Object-Oriented Programming 


 


14:13 2013-10-21 


interface <-> implementation 


 


14:16 2013-10-21 


message passing 


 


14:26 2013-10-21 


Objective-C 


 


14:27 2013-10-21 


entry point 


 


14:28 2013-10-21 


Objective-C use .h & .m file extension 


 


14:30 2013-10-21 


object == method + property 


 


14:31 2013-10-21 


why .m file? 


 


maybe because m == implementation 


 


14:33 2013-10-21 


super keyword refers to the parent class 


 


14:33 2013-10-21 



what is this? 


 


this refers the current instance of the class 


 


14:35 2013-10-21 


seg fault == segmentation fault 


 


14:39 2013-10-21 


message passing metaphor 


 


14:39 2013-10-21 


View Controller 


 


14:39 2013-10-21 


MVC == Model View Controller 


 


14:40 2013-10-21 


what is a View Controller 


 


class representing one screen 


 


14:43 2013-10-21 


self // the current instance 


 


14:43 2013-10-21 


interface builder 


 


14:43 2013-10-21 


What is a IBOutlet? 


 


wire up views to properties 


 


14:44 2013-10-21 


What is a IBAction? 


 


wire up events to methods 


 


14:45 2013-10-21 


view controller 


 


14:45 2013-10-21 


single view application 


 


14:46 2013-10-21 



automatic reference counting 


 


14:47 2013-10-21 


ViewController 


 


14:48 2013-10-21 


story board 


 


14:48 2013-10-21 


i can just scroll down and search for a button 


 


14:49 2013-10-21 


emulator 


 


14:50 2013-10-21 


What is an action? 


 


action == event handler 


 


14:51 2013-10-21 


IBAction 


 


14:58 2013-10-21 


sent events 


 


14:59 2013-10-21 


TicTacToe 


 


15:01 2013-10-21 


tag 


 


15:01 2013-10-21 


each of these buttons have a unique tag 


 


15:09 2013-10-21 


thread 


 


15:10 2013-10-21 


strong: I'm the one who are going to create this object 


 


15:21 2013-10-21 


single-page app 


 


15:24 2013-10-21 



delegation 


 


15:31 2013-10-21 


design pattern 


 


15:32 2013-10-21 


table view 


 


15:33 2013-10-21 


Table View 


 


15:33 2013-10-21 


sections 


 


15:36 2013-10-21 


textLabel 


 


15:43 2013-10-21 


storyboarding 


 


15:45 2013-10-21 


What is a segue? 


 


15:47 2013-10-21 


What is a property list? 


 


property list is just a bunch of key-value pairs 


 


15:48 2013-10-21 


plist == property list 


 


15:49 2013-10-21 


slide from one screen to another one 


 


15:51 2013-10-21 


transition 


 


15:52 2013-10-21 


segue 


 


15:52 2013-10-21 


destinationViewController // where to go 


 


15:54 2013-10-21 



What is a DivisionsViewController? 


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


16:12 2013-10-21 


webdev == web development 


 


16:14 2013-10-21 


back-end: makes things work 


 


front-end: makes things pretty 


 


16:31 2013-10-21 


priority list 


 


19:06 2013-10-21 


facebook for cats 


 


19:06 2013-10-21 


from idea to implementation 


 


19:08 2013-10-21 


idea -> implementation 


 


19:09 2013-10-21 


What is a client? 


 


browser side(html, CSS, JavaScript) 


 


19:09 2013-10-21 


server side 


 


19:10 2013-10-21 


C/S == Client/Server 


 


19:10 2013-10-21 


reduce complexity 


 


19:10 2013-10-21 


MVC == Models View Controller 


 


19:11 2013-10-21 


What is a model? 


 


the data/information your app deals with 


 



19:12 2013-10-21 


What is a view? 


 


views are how you present data to the user 


 


19:13 2013-10-21 


What is a controller? 


 


controllers are how you change your model in 


 


response to the user input. 


 


19:15 2013-10-21 


What is the important thing about model? 


 


data lives in both client/server 


 


19:17 2013-10-21 


important things about model(data)? 


 


what kind of data? 


 


what kind of queries? 


 


19:35 2013-10-21 


keeps the server as simple as possible 


 


client-side searching/filtering is faster 


 


19:38 2013-10-21 


How to keep data in server-side? 


 


hard to change DB, so consider a JSON blob 


 


19:38 2013-10-21 


What is a JSON blob? 


 


 


19:40 2013-10-21 


How client & server communicate? 


 


get/create/update 


 


19:40 2013-10-21 



request/post data 


 


19:41 2013-10-21 


ajax request 


 


19:41 2013-10-21 


client-server communication: 


 


keep request simple: get/create/update 


 


19:42 2013-10-21 


best to prefetch large amounts of data 


 


19:43 2013-10-21 


JSON == JavaScript Object Notation 


 


19:45 2013-10-21 


the server is just doing database queries & 


 


checking permissions 


 


19:46 2013-10-21 


static html 


 


19:47 2013-10-21 


make a post 


 


19:48 2013-10-21 


client-side 


 


19:48 2013-10-21 


What is jQuery? 


 


jQuery makes manipulating HTML easily 


 


19:50 2013-10-21 


utility function(helper function) 


 


19:50 2013-10-21 


What is Backbone.js? 


 


Backbone.js makes better architecture 


 


19:53 2013-10-21 



trigger events when model(data) change 


 


19:53 2013-10-21 


render function 


 


19:54 2013-10-21 


What about Views? 


 


pretty straigtforward technically, 


 


just jQuery, jQuery, jQuery 


 


19:58 2013-10-21 


What's new about html5? 


 


local storage, websockets, one-page apps 


 


20:00 2013-10-21 


CoffeeScript 


 


20:01 2013-10-21 


Other server languages othe than PHP? 


 


Ruby, Python, node.js 


 


20:05 2013-10-21 


client/server division 


 


20:07 2013-10-21 


Model, Controller, View system 


 


20:07 2013-10-21 


UI design 


 


20:11 2013-10-21 


MCV == Model Controller View 


 


20:14 2013-10-21 


UI == User Interface 


 


20:15 2013-10-21 


CSS == Cascading Style Sheet 


 


20:16 2013-10-21 



CSS 3 is the newest version 


 


20:16 2013-10-21 


js/jQuery 


 


20:16 2013-10-21 


js == JavaScript 


 


20:17 2013-10-21 


JavaScript is painful to use // verbose 


 


jQuery is convenient 


 


20:19 2013-10-21 


jQuery is super super useful 


 


20:19 2013-10-21 


What does UX mean? 


 


UX == User Experience 


 


20:20 2013-10-21 


UI == User Interface 


 


20:22 2013-10-21 


UI should be simple & intuitive 


 


20:52 2013-10-21 


PM == Project Management 


 


20:55 2013-10-21 


team size is very important, 


 


the more people, the more communication needed 


 


20:57 2013-10-21 


balance of skills: front-end, back-end 


 


20:59 2013-10-21 


Fun + motivation 


 


20:59 2013-10-21 


choose another project, choose sth really inspires you 


 



21:03 2013-10-21 


Iteration: 


 


work in functional spurts 


 


21:05 2013-10-21 


don't be afraid to embrace new ideas 


 


21:08 2013-10-21 


code can get messy, so Clean up regularly 


 


21:08 2013-10-21 


version control: git 


 


21:13 2013-10-21 


using Python, Ruby etc instead of PHP? 


 


pros: python is much better language than PHP 


 


cons: much bigger learning-curve 


 


PHP is much widely supported 


 


21:14 2013-10-21 


Ruby on Rails 


 


21:18 2013-10-21 


mySQL is the industry standard 


 


21:18 2013-10-21 


rapid development 


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


21:25 2013-10-21 


CSS == Cascading Style Sheets 


 


21:30 2013-10-21 


so what CSS is about? 


 


styles apperance of HTML elements 


 


21:31 2013-10-21 


change apperance of multiple webpages 


 


with a single .css file 



 


21:32 2013-10-21 


what cascading is about? 


 


cascading refers to the fact that: 


 


start general, move to more specific 


 


21:34 2013-10-21 


1. inline styles - used sparsingly 


 


2. external style sheets - .css file 


 


21:36 2013-10-21 


external style sheet 


 


21:36 2013-10-21 


Why inline style is bad? 


 


because external style can change style globally, 


 


inline style is too specific 


 


21:38 2013-10-21 


What is CSS's syntax? 


 


Selector{Property:Value; Property:Value...} 


 


21:40 2013-10-21 


What is the difference between ID & class? 


 


ID refers to specific element, 


 


but class refers to a group of elements 


 


21:42 2013-10-21 


What is a Pseudo-class? 


 


21:43 2013-10-21 


What is the 2 main kinds of CSS ? 


 


1. CSS For Appearance 


 


2. CSS For Layout 



 


21:44 2013-10-21 


px == pixel 


 


21:46 2013-10-21 


rgba() // a refers to the amount of transparency 


 


21:56 2013-10-21 


What's the difference between margin & padding? 


 


22:03 2013-10-21 


HTML for the entire page is unstyled html 


 


22:05 2013-10-21 


html + CSS // CSS acts upon unstyled html pages 


 


22:06 2013-10-21 


What is the main 2 parts of CSS? 


 


1. CSS for apperance 


 


2. CSS for layout 


 


22:11 2013-10-21 


break the raw html into sections, and develop 


 


corresponding CSS files to act upon htmls 


 


22:12 2013-10-21 


let's style this 


 


22:20 2013-10-21 


CSS Selector 


 


22:24 2013-10-21 


the content section: 


 


content.html + content.css 


 


22:25 2013-10-21 


unordered list 


 


22:29 2013-10-21 


color refers to font-color in CSS 



 


22:31 2013-10-21 


border radius property 


 


22:31 2013-10-21 


ensure all web browser support your CSS 


 


22:35 2013-10-21 


the hover pseudo-class 


 


22:38 2013-10-21 


link html file to CSS file 


 


22:39 2013-10-21 


let's open that style sheet 


 


22:42 2013-10-21 


navbar == naviagation bar 


 


22:43 2013-10-21 


use the comma(,) to apply the same properties 


 


to 2 classes or more 


 


22:45 2013-10-21 


CSS for Layout, 


 


CSS for apperance 


 


22:47 2013-10-21 


sections: 


 


header, content, leftnav, rightnav 


 


22:56 2013-10-21 


add some padding to make them move away from 


 


the left margin of the page 


 


22:58 2013-10-21 


and here we'll add some CSS for Layout properties 


 


23:01 2013-10-21 


What is a div? 



 


23:01 2013-10-21 


when we inspect element & highlight something 


 


23:02 2013-10-21 


div class == section class 


 


23:06 2013-10-21 


content-wrapper 


 


1. content-wrapper-inner 


 


2. content-wrapper-outer 


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


8:10 2013-10-22 


preparing your site for the web 


 


8:12 2013-10-22 


domain name 


 


8:19 2013-10-22 


WHOIS: input domain name, supply you with info 


 


8:20 2013-10-22 


What is a DNS? 


 


DNS == Domain Name Server 


 


8:21 2013-10-22 


What does DNS do? 


 


input: domain name 


 


output: IP address 


 


8:26 2013-10-22 


domain name 


 


8:30 2013-10-22 


What kind of hosting? 


 


1. shared 


 


2. VPN 



 


3. Semi-Dedicated 


 


4. Dedicated 


 


8:34 2013-10-22 


control panel 


 


8:35 2013-10-22 


What kind of customization & options do they offer me? 


 


8:37 2013-10-22 


MySQL 


 


8:38 2013-10-22 


SSL supports https 


 


8:40 2013-10-22 


cross-browser compatibility 


 


8:42 2013-10-22 


How to ensure cross-browser compatibility? 


 


1. only use standard HTML/CSS/JavaScript 


 


8:45 2013-10-22 


What is bootstrap? 


 


it's a CSS framework 


 


8:46 2013-10-22 


code packages // WordPress... 


 


8:49 2013-10-22 


you must test your website on all 


 


explorers & platforms 


 


8:52 2013-10-22 


browser screenshots to test your CSS 


 


9:00 2013-10-22 


What is .htaccess? 


 



9:03 2013-10-22 


image optimization 


 


9:09 2013-10-22 


minify code 


 


9:11 2013-10-22 


what is CDN? 


 


9:12 2013-10-22 


SEO == Search Engine Optimization 


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


9:35 2013-10-22 


jQuery 


 


9:36 2013-10-22 


jQuery is just a tool that build upon 


 


JavaScript that provide more functionality 


 


jQuery is a JavaScript library 


 


9:48 2013-10-22 


What is a SELECTOR? 


 


SELECTOR let you select HTML element in a page 


 


then you can manipulate these elements using jQuery functions 


 


9:51 2013-10-22 


$ // dollar sign indicates that this is a jQuery function 


 


9:53 2013-10-22 


anchor tag 


 


9:55 2013-10-22 


href == hypertext reference 


 


9:56 2013-10-22 


DOM manipulation 


 


9:56 2013-10-22 


DOM == Document Object Model 


 



10:00 2013-10-22 


What kind of manipulation can you do with jQuery? 


 


1. append/prepend 


 


2. change classes 


 


3. remove 


 


4. overwrite 


 


5. retrieve information 


 


6. modify CSS 


 


10:03 2013-10-22 


I'm going to select all divs in this page 


 


& remove it 


 


10:10 2013-10-22 


you can use the CSS property in jQuery 


 


10:12 2013-10-22 


effects == animation effects 


 


10:13 2013-10-22 


What kind of effects does jQuery provide? 


 


1. show & hide 


 


2. slide up & down 


 


3. fade 


 


4. toggle 


 


5. chained effects 


 


10:19 2013-10-22 


What is a jQuery events? 


 


10:21 2013-10-22 


we can select the boxid & makes it disappear 



 


10:22 2013-10-22 


trigger events 


 


10:32 2013-10-22 


What is a AJAX? 


 


AJAX == Asynchronous Javascript And XML 


 


10:34 2013-10-22 


What AJAX can do? 


 


AJAX allow us to send HTTP requests without reloading the page 


 


10:36 2013-10-22 


using AJAX, you can pull information from the server 


 


constantly 


 


10:39 2013-10-22 


using AJAX, you can both GET/POST 


 


10:42 2013-10-22 


AJAX allows us to send request without reloading a page 


 


10:49 2013-10-22 


CSV == Commad Separated Values 


 


10:49 2013-10-22 


let's request in JSON 


 


10:49 2013-10-22 


JSON == JavaScript Object Model 


 


10:52 2013-10-22 


parse data 


 


10:53 2013-10-22 


if you request data in JSON format... 


 


10:56 2013-10-22 


once the data is returned, parse it, 


 


turn it into JSON 



 


11:01 2013-10-22 


jQuery.get() 


 


jQuery.post() 


 


11:10 2013-10-22 


HTTP POST 


 


HTTP REQUEST 


 


11:11 2013-10-22 


AJAX request easily & seamlessly 


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


12:54 2013-10-22 


mobile application security 


 


12:55 2013-10-22 


paradigm shift 


 


12:56 2013-10-22 


web application, mobile application 


 


12:59 2013-10-22 


insecure WIFI 


 


13:00 2013-10-22 


baseband attacks // broadband attacks 


 


13:02 2013-10-22 


jailbreakers 


 


13:02 2013-10-22 


trying to break into someoneelse's machine, 


 


and compromise it 


 


13:03 2013-10-22 


OS level vulnerabilities 


 


13:04 2013-10-22 


malware 


 


13:04 2013-10-22 



application layer 


 


13:10 2013-10-22 


EULA == End User License Agreement 


 


13:12 2013-10-22 


shared library inherit your app's permission 


 


13:14 2013-10-22 


mobile top 10: 


 


1. malicious code 


 


2. vulnerable code 


 


13:18 2013-10-22 


mobile malware 


 


13:18 2013-10-22 


What kind of technology does mobile malware use? 


 


1. repackaging 


 


2. update 


 


3. drive-by 


 


4. standalone 


 


13:20 2013-10-22 


What is a repackaging? 


 


1. decompile 


 


2. insert malicious code 


 


3. compile 


 


13:21 2013-10-22 


What is update? 


 


update is similar to repackaging, instead 


 


it insert "update mechanism" 



 


13:24 2013-10-22 


activity monitoring & information retrieval 


 


13:25 2013-10-22 


secret SMS replica 


 


13:28 2013-10-22 


unique identifier 


 


13:32 2013-10-22 


premium rate SMS 


 


13:34 2013-10-22 


send SMS to premium rate numbers 


 


13:35 2013-10-22 


unauthorized network activity 


 


13:37 2013-10-22 


UI Impersonation 


 


13:39 2013-10-22 


mobile banking application 


 


13:40 2013-10-22 


credential // username, password etc.. 


 


13:41 2013-10-22 


UI impersonation: 


 


present the UI of another App 


 


13:42 2013-10-22 


system modification! 


 


13:42 2013-10-22 


APN == Access Point Name 


 


13:43 2013-10-22 


rootkit behavior: 


 


 Application layer | OS layer 


 



13:46 2013-10-22 


logic & time bomb 


 


13:52 2013-10-22 


PC bots 


 


13:52 2013-10-22 


UUID == User Unique ID 


 


13:53 2013-10-22 


code vulnerabilities 


 


13:53 2013-10-22 


harvest the user's personal information 


 


13:54 2013-10-22 


shared library! // risk 


 


13:54 2013-10-22 


sensitive data leakage 


 


13:58 2013-10-22 


public WIFI // risky! 


 


13:58 2013-10-22 


someone is sniffing on the internet 


 


13:59 2013-10-22 


Pandora 


 


14:01 2013-10-22 


shared libraries can inherit App's permission 


 


14:09 2013-10-22 


address book 


 


14:11 2013-10-22 


sensitive information 


 


14:19 2013-10-22 


unsafe sensitive data transmission 


 


14:19 2013-10-22 


SSL // support https 



 


14:25 2013-10-22 


do statistical analysis 


 


14:28 2013-10-22 


hardcoded password // just usiing plain text? 


 


14:29 2013-10-22 


iOS 


 


14:29 2013-10-22 


directory traversal 


 


14:30 2013-10-22 


jailbreak your phone 


 


14:31 2013-10-22 


to totally "compromise" the device 


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


17:33 2013-10-22 


JavaScript framework 


 


17:39 2013-10-22 


.html // html file 


 


.js // JavaScript file 


 


17:40 2013-10-22 


event handler 


 


17:41 2013-10-22 


html + JavaScript + CSS 


 


17:44 2013-10-22 


document.getElementById() 


 


17:47 2013-10-22 


How do I get back to the html? 


 


17:52 2013-10-22 


js == JavaScript 


 


18:02 2013-10-22 


jQuery: a JavaScript library makes easier to 



 


do things like access individual element of the DOM 


 


18:10 2013-10-22 


DOM == Document Object Model 


 


18:13 2013-10-22 


some framework has different approaches 


 


18:15 2013-10-22 


backbone framework 


 


18:15 2013-10-22 


angular framework 


 


18:28 2013-10-22 


CDN 


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


18:32 2013-10-22 


review JavaScript framework 


 


18:35 2013-10-22 


event, event handler 


 


18:38 2013-10-22 


using DOM: 


 


document.getElementById() 


 


18:39 2013-10-22 


that's an element in the html, it has attributes 


 


18:40 2013-10-22 


that's just the name of my global data structure 


 


18:43 2013-10-22 


append to the bottom of the list 


 


18:44 2013-10-22 


and I'm just going to close that tag 


 


18:54 2013-10-22 


jQuery is a JavaScript library 


 



18:55 2013-10-22 


using jQuery instead of JavaScript do make 


 


the code get cleaner 


 


19:01 2013-10-22 


framework can factor out these design pattern 


 


19:01 2013-10-22 


MVC == Model View Controller 


 


19:02 2013-10-22 


framework1: angularjs.org 


 


19:04 2013-10-22 


tie or bind this textbox to a variable 


 


19:08 2013-10-22 


making html more powerful, keep html & JavaScript in sync 


 


19:08 2013-10-22 


framework2: backbone 


 


19:09 2013-10-22 


but our js file is a little different 


 


19:13 2013-10-22 


Model, View, Controller == MVC 


 


19:15 2013-10-22 


We need to render this TODO list 


 


19:17 2013-10-22 


so now every Todo is displayable or renderable by this 


 


TodoView 


 


19:20 2013-10-22 


specify the way to render one of these Todos 


 


19:28 2013-10-22 


JavaScript framework 


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


19:30 2013-10-22 



pattern matching with regular expression 


 


20:19 2013-10-22 


What does regular expression do? 


 


regular expression is used to match pattern in strings 


 


20:32 2013-10-22 


What does regular expressions do? 


 


protocol for finding patterns in text 


 


20:34 2013-10-22 


fscanf() is like a rudimentary regular expression 


 


20:37 2013-10-22 


regularity 


 


20:37 2013-10-22 


formal language theory 


 


20:39 2013-10-22 


grep // linux shell command 


 


20:40 2013-10-22 


regular expression algorithm 


 


20:41 2013-10-22 


What is a DFA? 


 


DFA == Deterministic Finite Automaton 


 


20:42 2013-10-22 


build phase, run phase 


 


20:43 2013-10-22 


Regex == Regular Expression 


 


20:43 2013-10-22 


Regex is built into Python 


 


20:46 2013-10-22 


search takes 2 arguments: 


 



the 1st is the Regular Expression, 


 


the 2nd is the text(string) that you want to analyze 


 


20:47 2013-10-22 


alphabetical character 


 


20:50 2013-10-22 


pattern matching 


 


20:51 2013-10-22 


repetitive patterns 


 


21:02 2013-10-22 


^ // start of string 


 


$ // end of string 


 


21:03 2013-10-22 


raise an error 


 


21:04 2013-10-22 


the power of regular expression is that it can specify 


 


patterns not just characters 


 


21:07 2013-10-22 


fuzzy matching 


 


21:09 2013-10-22 


C has PCRE 


 


UNIX has grep 


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


21:11 2013-10-22 


Kohana, a lightweight PHP framework 


 


21:15 2013-10-22 


What is Kohana? 


 


Kohana is just a PHP development framework 


 


21:22 2013-10-22 


boilerplate code 



 


21:22 2013-10-22 


MVC == Model, View, Controller 


 


21:23 2013-10-22 


lower-level details 


 


21:24 2013-10-22 


What's the difference between library & framework? 


 


using the library, you should provide the skeleton(architecture), 


 


using the framework, you just fill the holes 


 


21:26 2013-10-22 


Kohana is one of many PHP frameworks 


 


21:26 2013-10-22 


Kohana use MVC architecture 


 


21:27 2013-10-22 


MVC == Model + View + Controller 


 


21:29 2013-10-22 


MVC Architecture 


 


21:30 2013-10-22 


What does the Model do? 


 


Database interface & application state 


 


21:30 2013-10-22 


What does the Controller do? 


 


Application logic 


 


21:30 2013-10-22 


What does the View do? 


 


Render the data using a template 


 


21:33 2013-10-22 


Why MVC? 


 



1. separation of concern 


 


2. code reuse 


 


3. don't repeat yourself 


 


21:35 2013-10-22 


Kohanaframework.org 


 


21:36 2013-10-22 


go to my server, download it & 


 


I'm going to extract it 


 


21:41 2013-10-22 


Routing 


 


21:49 2013-10-22 


index.php is the entry point of your application 


 


21:50 2013-10-22 


.htaccess file? 


 


21:55 2013-10-22 


What do controllers do? 


 


1. controllers handle application logic 


 


2. controllers have various actions that handle different things 


 


3. generally create separate controllers for separate part of the 


 


 website(one controller for one model) 


 


21:57 2013-10-22 


create controller for data object 


 


21:58 2013-10-22 


data object 


 


22:00 2013-10-22 






What is a Object-Relational Mapping? 


 


1. representing database rows as programming objects 



 


2. preserves relationships between objects 


 


3. allows you to attach functionality to objects 


 


22:06 2013-10-22 


phpMyAdmin 


 


22:13 2013-10-22 


What is ORM? 


 


Object Relational Mapping??? 


 


22:26 2013-10-22 


Post Model 


/





8:05 2013-10-23 Wednesday 


RSA 


 


8:08 2013-10-23 


symmetric key algorithms 


 


8:10 2013-10-23 


RSA uses 2 keys: 


 


public key: used for encryption 


 


private key: used for decryption 


 


8:12 2013-10-23 


you can share your public key, but 


 


you should always keep your private key secret 


 


8:12 2013-10-23 


you encrypt using your public key, 


 


and decrypt using your private key 


 


8:13 2013-10-23 


key pair: public key + private key 


 


8:13 2013-10-23 


message from user A to user B only use user B's keypair 



 


8:14 2013-10-23 


RSA is a asymmetric key algorithm 


 


8:22 2013-10-23 


public key & its corresponding private key 


 


8:23 2013-10-23 


RSA ia a asymmetric key algorithm 


 


8:24 2013-10-23 


public key == private key 1 * private key 2 


 


8:25 2013-10-23 


we need 2 prime numbers: p & q 


 


8:25 2013-10-23 


in order to get 2 prime numbers, we first generate 


 


pseudo-random numbers, then test if it's prime? 


 


8:33 2013-10-23 


n = p * q 


 


m = (p -1) * (q - 1) 


 


8:34 2013-10-23 


What is said two numbers are coprime? 


 


GCD(num1, num2) == 1 // GCD == Greatest Common Divisor 


 


8:36 2013-10-23 


we'll need a number e that is relative prime to m 


 


& less than m 


 


8:36 2013-10-23 


relative prime == coprime 


 


8:37 2013-10-23 


find a number e that is relative prime to m 


 


8:38 2013-10-23 


find d such that d * e == 1 (mod m) 



 


8:38 2013-10-23 


modular arithmetic 


 


8:40 2013-10-23 


wrap back around 


 


8:41 2013-10-23 


a clock uses modular arithmetic 


 


8:42 2013-10-23 


All the numbers? 


------------------------------------------------// 


n = p * q 


 


m = (p -1) * (q - 1) 


 


GCD(e, m) == 1 // find e 


 


d * e == 1 (mod m) // find d 


 


public key(e, n) 


 


private key(d, n) 


------------------------------------------------// 


 


8:42 2013-10-23 


What is the key pair of public key? 


 


(e, n) 


 


8:43 2013-10-23 


What is the key pair of private key? 


 


(d, n) 


 


8:44 2013-10-23 


if user A want to send message to user B, 


 


user A should first ask user B for her(his) 


 


public key! 


 


8:45 2013-10-23 



user B can safely share her(his) public key 


 


without compromise security, 


 


but user B must not share her(his) private 


 


key in any circumstances 


 


8:49 2013-10-23 


How to encrypt message m usinig public key 


 


pair(e, n)? 


 


c == exp(m, e) (mod n) // m is the message to be encrypted 


 


 // c is the encrypted message 


 


8:53 2013-10-23 


We can break m up into smaller chunks each of 


 


which smaller than n, then encrypt each of the 


 


chunks 


 


8:54 2013-10-23 


to encrypt the message "CS50"? 


 


the encrypted message chunks: c1, c2, c3, c4 


 


9:01 2013-10-23 


Let's see how we found the number d? 


 


9:03 2013-10-23 


a * x + b * y == GCD(a, b) 


 


9:05 2013-10-23 


we notice GCD(e, m) == 1 // e & m are coprime 


 


9:08 2013-10-23 


5x + 924y = 1 


 


5x = 1 - 924y 


 


9:08 2013-10-23 



here we start at 1, an wrap around exactly 


 


y times, so we still be at 1 


 


9:09 2013-10-23 


5 * x == 1 (mod 924) 


 


here the x is the same d we're looking for before 


 


9:29 2013-10-23 


multiplicative inverse 


 


9:31 2013-10-23 


integer factorization 


 


9:35 2013-10-23 


RSA, AES 


wire shark 


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


9:54 2013-10-23 


FIFO == First In First Out 


 


9:57 2013-10-23 


a lightweight version of process called thread 


 


10:18 2013-10-23 


fputs(), fgets() 


 


10:22 2013-10-23 


feof(), ferror() 


 


10:22 2013-10-23 


fprintf(), fputc() 


 


10:45 2013-10-23 


DOM describes how the web browser represents 


 


a webpage in memory 


 


10:46 2013-10-23 


DOM == Document Object Model 


 


10:47 2013-10-23 


JavaScript has DOM, but PHP also has DOM 


 



10:47 2013-10-23 


html element is the root node 


 


10:49 2013-10-23 


DOM tree 


 


this is how the browser store your webpage 


 


10:50 2013-10-23 


how we can traverse this tree using JavaScript 


 


10:51 2013-10-23 


document object 


 


10:54 2013-10-23 


be able to query the document 


 


10:55 2013-10-23 


CSS selector 


 


10:55 2013-10-23 


a quicker way: 


 


document.querySelectorAll('#foo') 


 


document.getElementById('') 


 


10:57 2013-10-23 


we have some search capabilities 


 


10:58 2013-10-23 


but under the hood, DOM is just a tree 


 


10:58 2013-10-23 


http == HyperText Transfer Protocol 


 


11:00 2013-10-23 


http request 


 


11:00 2013-10-23 


http response: is a webpage 


 


11:00 2013-10-23 


HTML == HyperText Markup Language 



 


11:01 2013-10-23 


B/S == Browser/Server 


 


C/S == Client/Server 


 


11:02 2013-10-23 


http traffic between chrome & the server 


 


11:04 2013-10-23 


CSS == Cascading Style Sheet 


 


11:05 2013-10-23 


JS == JavaScript 


 


JavaScript + html + CSS 


 


11:06 2013-10-23 


html style attribute 


 


11:08 2013-10-23 


inline style 


 


11:09 2013-10-23 


separate their html markup with CSS style 


 


11:09 2013-10-23 


CSS Selectors are used to choose elements 


 


to which decoration are applied 


 


11:11 2013-10-23 


select a html element by its id attribute 


 


11:13 2013-10-23 


combinator 


 


11:13 2013-10-23 


that sounds a lot complicated than it really is 


 


11:14 2013-10-23 


by using rules instead of inline styling, we 


 


can get much cleaner code 



 


11:16 2013-10-23 


selectors & combinators 


 


11:19 2013-10-23 


Caesar Cipher 


 


11:22 2013-10-23 


redirecting & pipes 


 


11:23 2013-10-23 


stream 


 


11:23 2013-10-23 


stdout == standard out 


 


11:23 2013-10-23 


redirect standard out(stdout) to a file 


 


11:24 2013-10-23 


./redirect -> file.txt 


 


11:25 2013-10-23 


append rather than overwrite in redirect 


 


./redirect >> file.txt 


 


11:27 2013-10-23 


a special file: /dev/null 


 


11:29 2013-10-23 


redirect stdin 


 


11:29 2013-10-23 


./redirect < file.txt 


 


11:29 2013-10-23 


redirect both stdin & stdout 


 


./redirect < file.txt > file2.txt 


 


11:30 2013-10-23 


What is a pipe? 


 



use output of one program as input of another program 


 


11:32 2013-10-23 


Do we really need this intermediate text file? 


 


11:32 2013-10-23 


luckily we can avoid this text file using a mechanims 


 


called pipe 


 


11:33 2013-10-23 


pipeline 


 


11:34 2013-10-23 


How can you find how many file are in the currenct directory? 


 


using pipe: ls | wc -l // wc == word count, -l means line 


 


11:36 2013-10-23 


read a text file & sort it using pipe! 


 


cat students.txt | sort // using '|' to denote pipe 


 


11:39 2013-10-23 


read text file & sort it & eliminate duplicate! 


 


cat students.txt | sort | uniq 


 


11:40 2013-10-23 


read from file & sort it & eliminat duplicate & save it! 


 


sort < students.txt | uniq > final.txt // use both redirect & pipe 


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


12:52 2013-10-23 


Vigenere Cipher 


 


13:01 2013-10-23 


frequency analysis attack at the Caeser Cipher 


 


13:02 2013-10-23 


brute-force attack // try all the possible key(shift) 


 


13:03 2013-10-23 


use multiple shift values instead of just one 



 


13:04 2013-10-23 


multiple shift values 


 


13:05 2013-10-23 


How does the Vigenere Cipher works? 


 


plain text: Meet me at the park at eleven am 


 


we can choose a word, for example: bacon 


 


13:06 2013-10-23 


Meet me at the park at eleven am 


baco nb ac onb acon ba conbac on // find each letters index in aphabet 


 


then use the index as the specific value for each of 


 


the plain text character 


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


13:12 2013-10-23 


RSA is a widely used algorithm for encrypting data 


 


13:13 2013-10-23 


symmetric key algorithms: Caeser Cipher & Vigenere Cipher 


 


13:15 2013-10-23 


RSA has 2 keys: 


 


public key for encryption, 


 


private key for decryption 


 


13:15 2013-10-23 


we can share our public with anyone without 


 


compromising the security of our secret message 


 


13:16 2013-10-23 


public key & its corresponding private key 


 


13:16 2013-10-23 


you can share your public key, but you should 


 


always keep your private key secret 



 


13:17 2013-10-23 


AES 


 


13:17 2013-10-23 


key pair(public key + private key) 


 


13:20 2013-10-23 


RSA is an asymmetric key algorithm 


 


13:22 2013-10-23 


public key only use the product of two prime nunbers 


 


13:22 2013-10-23 


it's hard to factor a large number into 2 prime numbers 


 


13:25 2013-10-23 


private key use the 2 prime numbers???? 


 


13:26 2013-10-23 


first get 2 prime numbers: p & q 


 


13:27 2013-10-23 


1st number: p 


 


2nd number: q 


 


3rd number: n = p * q 


 


4th number: m = (p - 1) * (q - 1) 


 


5th number(e): 1. GCD(m, e) == 1 


 


 2. e < m 


 


6th number(d): d * e == 1(mod m) 


 


public key: (e, n) 


 


private key: (d, n) 


 


13:32 2013-10-23 


modular arithmetic: wrap back to zero 


 



13:34 2013-10-23 


notice that our original prime numbers p & q 


 


don't appear anywhere in either public & private 


 


keys 


 


13:35 2013-10-23 


I want to send message to Bob, then Bob will 


 


in charge of generating both public & private keys 


 


13:36 2013-10-23 


I use Bob's public key to encrypt the message, 


 


then send to Bob 


 


13:36 2013-10-23 


break the messge into chunks which are all smaller 


 


than n 


 


13:38 2013-10-23 


if I want to send the message "CS50", first 


 


translate into ASCII 


 


13:40 2013-10-23 


How can I encrypt the message with public key? 


 


public key: (e, n) 


 


13:44 2013-10-23 


How we got that value for d? // d is used for private key 


 


13:45 2013-10-23 


multiplicative inverse 


 


d * e == 1(mod m) 


 


13:48 2013-10-23 


find the Greatest Common Divisor of a & b? 


 


it will also gives us 2 numbers x & y such that 



 


a * x + b * y == GCD(a, b) 


 


13:52 2013-10-23 


notice GCD(e, m) == 1 


 


e * x + m * y == 1 


 


e * x = 1 - m * y <-> e * x == 1 (mod m) 


 


13:55 2013-10-23 


the x is the same d we're looking before 


 


13:56 2013-10-23 


use table method to find GCD(a, b) 


 


a == 5, b == 924 


 


14:00 2013-10-23 


the table method 


 


14:06 2013-10-23 


integer factorization 


 


14:08 2013-10-23 


AES is a symmetric key algorithm 


 


14:08 2013-10-23 


shared secret key between the 2 systems 


 


14:08 2013-10-23 


sender, receiver 


 


14:09 2013-10-23 


we just use the RSA to encrypt the shared AES key 


 


14:11 2013-10-23 


How the AES works? 


 


AES just use the RSA to encrypt & decrypt the AES shared key 


 


not the data itself 


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


14:29 2013-10-23 



PHP is a script language use for web server development 


 


14:30 2013-10-23 


server <-> web browser 


 


14:31 2013-10-23 


Apache HTTP server 


 


14:31 2013-10-23 


PHP interpreter 


 


14:31 2013-10-23 


404 error: not found 


 


14:32 2013-10-23 


What does hello.php do? 


 


14:32 2013-10-23 


How to run the hello.php file? 


 


php hello.php 


 


14:33 2013-10-23 


http://localhost/hello.php 


 


14:33 2013-10-23 


What's the content of hello.php file? 


 


<?php 


 


printf("Hello from PHP!\n"); 


 


?> 


 


14:36 2013-10-23 


php file? 


 


<?php 


 // pho code put here 


?> 


 


14:38 2013-10-23 


How can we pass data among our various php pages? 


 



14:39 2013-10-23 


query string // in URL 


 


e.g. ?foo=bar&baz=qux 


 


14:39 2013-10-23 


query string allows you pass arguments 


 


to php script 


 


14:40 2013-10-23 


query string contains key & value pairs 


 


14:41 2013-10-23 


What is the $_GET? 


 


is associated to an array that is automatically 


 


populated with query string data 


 


14:42 2013-10-23 


http://localhost/get.php?foo=bar&baz=qvx 


 


$_GET["foo"] == "bar" 


 


14:46 2013-10-23 


post.php 


 


14:47 2013-10-23 


What are the 2 different ways of passing data 


 


between php pages? 


 


1. get request: populate $_GET 


 


2. post request: populate $_POST 


 


14:49 2013-10-23 


When should one use get request or post request? 


 


generally speaking, when you read data from the server, 


 


use get request, otherwise when you write data to server, 


 



use post request 


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


14:52 2013-10-23 


PHP syntax 


 


14:52 2013-10-23 


What is PHP? 


 


PHP is a recursively acronym 


 


PHP == PHP Hypertext Processor 


 


14:53 2013-10-23 


What is the basic syntax of PHP? 


 


all of our PHP code should be put inside between 


 


these delimiters 


 


<?php 


 


?> 


 


14:54 2013-10-23 


there is no main() function in php file, 


 


all codes are executed according to theire sequence 


 


14:56 2013-10-23 


other than C, PHP is an interpreted rather than 


 


compiled language 


 


14:57 2013-10-23 


PHP interpreter 


 


14:57 2013-10-23 


PHP command 


 


14:58 2013-10-23 


variables are handled a little differently in PHP 


 


14:58 2013-10-23 


all variables in php must start with a dollar sign 



 


14:59 2013-10-23 


php is a loosely typed language // weak-typed language 


 


15:00 2013-10-23 


What is a php function? 


 


in php functions, you don't have to specify a 


 


paticular return type 


 


function() { ... } // no return type 


 


15:02 2013-10-23 


both strings & arrays are built-in type in php 


 


15:02 2013-10-23 


you can not use pointers in php 


 


15:03 2013-10-23 


How can you create an array in php? 


 


$a = array(1, 2, 3); 


 


$a = [1, 2, 3]; 


 


15:04 2013-10-23 


you can index into the array using the same syntax as C 


 


$a[0]; // get the 1st element 


 


15:04 2013-10-23 


What is a associated array? 


 


associated arrays are just like the hashtable 


 


data structure we've already seen 


 


they map a key to a value 


 


15:06 2013-10-23 


How can you create an associated array in php? 


 


$staff = [ 



 "instructor" => "david", 


 "tf" => "tommy" 


]; 


 


15:07 2013-10-23 


key => value 


 


15:09 2013-10-23 


value can also be array 


 


$staff = [ 


 "instructor" => "david", 


 "tf" => [ 


 "tommy", 


 "rob" 


 ] 


]; 


 


15:11 2013-10-23 


How can you add element into an array? 


 


$a = [1, 2, 3]; 


 


$a[] = 4; // append 4 to end of array a 


 


 // now $a == [1, 2, 3, 4] 


 


15:13 2013-10-23 


How can you add element(key-value pairs) to an 


 


associated array? 


 


$staff["total"] = 3; 


 


15:14 2013-10-23 


How can you find the size of arrays? 


 


use count keyword: count($a); 


 


15:14 2013-10-23 


How can you create strings in php? 


 


in php, you can create strings using both 


 



single quote or double quote 


 


$s1 = "string"; 


 


$s2 = 'another string' 


 


15:17 2013-10-23 


How can you concatenate strings in php? 


 


$n = 5; 


 


$s = 'n is ' . $n // use dot notation to concatenate 


 


15:19 2013-10-23 


the difference between single quote & double quote 


 


when concatenating strings? 


 


$s = "n is $n"; // $n will be substituted as is 


 


$s = 'n is $n'; // $n will NOT be substituted 


 


15:27 2013-10-23 


foreach loop is just a syntax sugar of for loop 


 


15:28 2013-10-23 


How does the foreach() loop works? 


 


<?php 


 $array = [1, 2, 3]; 


 foreach ($array as $number) 


 print($number ."\n"); 


?> 


 


15:29 2013-10-23 


in C, we often organize our code into separate 


 


files, in PHP, we can do the same thing 


 


15:31 2013-10-23 


What is the require_once()? 


 


it's just like the #include <***.h> & 


 



#ifndef XXX.H 


#define XXX.H 


 


#endif 


 


15:32 2013-10-23 


What is the __DIR__ stands for in PHP? 


 


__DIR__ is the current directory in PHP 


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


15:35 2013-10-23 


PHP sessions 


 


18:01 2013-10-23 


What is $_SESSION? 


 


$_SESSION is an associative array 


 


18:03 2013-10-23 


How to initialize the session? 


 


session_start() 


 


18:03 2013-10-23 


What does PHP session do? 


 


it's related to user logging 


 


18:06 2013-10-23 


log the user in, log the user out 


 


18:07 2013-10-23 


session_destroy() 


 


18:07 2013-10-23 


so what is going on underneath the hood? 


 


18:08 2013-10-23 


the server needs to store our session data 


 


in place where multiple php file can access 


 


18:12 2013-10-23 


that's the current identifier for my session 



 


18:16 2013-10-23 


cookie 


 


18:16 2013-10-23 


PHPSESSID 


 


18:17 2013-10-23 


the browser remind the web server which session id 


 


should use 


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


18:21 2013-10-23 


review PHP session 


 


18:22 2013-10-23 


$_SESSION // store session information here 


 


contains key-value pairs 


 


$_SESSION is basically an associated array 


 


18:23 2013-10-23 


$_GET, $_POST, $_SESSION 


 


18:24 2013-10-23 


How to initialize the session? 


 


18:26 2013-10-23 


What is a cookie? 


 


1. cookie is just a piece of text file 


 


2. 


 


18:30 2013-10-23 


by logging the user in, we put information in 


 


the session array($_SESSION), 


 


by logging the user out, we remove that information 


 


from the sessioin array 


 



18:31 2013-10-23 


session_destroy() 


 


18:32 2013-10-23 


first, the server needs to store the data in the session 


 


18:33 2013-10-23 


the server needs to store our session data in place where 


 


multiple php file can access, 


 


obviously local variable can not be shared 


 


19:11 2013-10-23 


when session_start() the first time, php 


 


will generate a large random value 


// 


8:48 2013-10-24 Thursday 


review php session 


 


8:57 2013-10-24 


when I visit a php page containing session_start() 


 


for the first time, php will generate a large random 


 


value, that's how the server tracking who I am? 


 


8:59 2013-10-24 


session_id() 


 


9:00 2013-10-24 


What is a cookie? 


 


cookie is a small text file in your computer that 


 


the server can write to via the webbrowser, the session_id(), 


 


that is the large random number, will be stored into the 


 


cookie by web server 


 


9:02 2013-10-24 


the web browser will include this unique identifier in 



 


each request to the server 


 


9:03 2013-10-24 


php will store in session data in /tmp, and use the unique 


 


identifier which is supplied by webbrowser to retrieve this 


 


session data 


 


9:05 2013-10-24 


cookie contains the PHPSESSID 


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


9:10 2013-10-24 


cs50 lec8 


 


9:14 2013-10-24 


CSS == Cascading style Sheet 


 


HTML == HyperText Markup Language 


 


9:17 2013-10-24 


html tag 


 


9:21 2013-10-24 


html form 


 


9:22 2013-10-24 


What is a GET? 


 


GET is a way of passing information to the server 


 


in the URL 


 


9:23 2013-10-24 


if query string is too long, try use POST rather 


 


than GET 


 


9:29 2013-10-24 


style attribute 


 


9:30 2013-10-24 


CSS can be emebedded into the html page, 



 


it's just comma separated key value pairs, 


 


<body style="text-align: center"> 


 


9:33 2013-10-24 


We can put it inside style tag 


 


9:35 2013-10-24 


the 3rd version: use link 


 


it's just like #include <...h> 


 


<head> 


 <link href="search3.css" rel="stylesheet"/> 


 <title>CS50 Search</title> 


</head> 


 


9:38 2013-10-24 


separate CSS into a file, and link into html file 


 


9:40 2013-10-24 


What is a div tag? 


 


div is a tag that introduce the division of 


 


a page, you can think this as an invisible rectangle 


 


9:44 2013-10-24 


header division + content division + footer division 


 


9:46 2013-10-24 


When you have an id attribute in a html, 


 


you must uniquely identify one of these elements 


 


in your html 


 


9:48 2013-10-24 


How CSS is applied to the correponding html tag? 


 


CSS use id to identifiy which html element to apply: 


 


#header 






 text_align: center; 





 


9:50 2013-10-24 


an example of footer's CSS? 


 


#footer 





 font_size: smaller; 


 font_weight: bold; 


 margin: 20px; 


 text_align: center; 





 


9:56 2013-10-24 


selectors: to whom you want to apply 


 


10:02 2013-10-24 


php has no main(), it just runs from top 


 


to bottom 


 


10:04 2013-10-24 


any variable in php by design starts with 


 


a dollar sign 


 


10:06 2013-10-24 


php is not a strongly-typed language as in C 


 


10:11 2013-10-24 


associated array(hashtable) 


 


10:13 2013-10-24 


How to implement a "hello, world" program in php? 


 


<?php 


 printf("hello, world\n"); 


?> 


 


10:17 2013-10-24 


bin == binary 


 



10:18 2013-10-24 


php hello.php 


 


10:20 2013-10-24 


How to enable hello2.php executable? 


 


chmod a+x hello2.php 


 


10:21 2013-10-24 


chmod == change mode 


 


10:21 2013-10-24 


a+x // all executable 


 


10:21 2013-10-24 


linux just show me the file name in green, 


 


convey the idea that it's executable 


 


10:22 2013-10-24 


bit x == executable 


 


10:22 2013-10-24 


that's a hint to the linux that use this 


 


interpreter to run this file 


 


10:23 2013-10-24 


How to rename a file in linux? 


 


mv hello2.php hello2 


 


so I can just run ./hello2 instead of ./hello2.php 


 


10:24 2013-10-24 


file extension 


 


10:25 2013-10-24 


How to specify a php interpreter explicitly? 


 


#!/bin/env php 


<?php 


 printf("hello, world\n"); 


?> 



 


10:26 2013-10-24 


Why env? 


 


env == environment, if you don't know where 


 


php interpreter is, using env to figure it out 


 


10:28 2013-10-24 


which php 


 


/usr/bin/php // this is the response 


 


10:40 2013-10-24 


spellchecker 


 


10:58 2013-10-24 


Where does this ridiculour slowdown come from? 


 


11:00 2013-10-24 


this is generally the case with all interpreted language 


 


11:03 2013-10-24 


in the internet, there is a large amounts of latency 


 


11:04 2013-10-24 


between the browser & the server 


 


11:12 2013-10-24 


you can use php just as a scripting language 


 


11:13 2013-10-24 


.php file are usually comingled with html & php 


 


11:15 2013-10-24 


How does the html form forward information to php file? 


 


<form action="register0php" method="post"> 


 


11:21 2013-10-24 


What's the difference between query & post? 


 


in post, query string does not appear in URL 


 



11:25 2013-10-24 


POST method hides the information whichs is submitted 


 


to the server, it does not appear in the URL 


 


11:27 2013-10-24 


How do you update an image in the URL? 


 


for anyting that is sensitive(usrname,psw etc) or big, POST is 


 


the way to go 


 


11:28 2013-10-24 


we can comingle html & php 


 


11:32 2013-10-24 


in the middle of my html file, I've temporarily enter 


 


into php mode 


 


11:32 2013-10-24 


print_r // recursively print 


 


11:32 2013-10-24 


How to print the POST data? 


 


<?php print_r($_POST); ?> 


 


11:33 2013-10-24 


Where is the POST data stored? 


 


$_POST 


 


11:35 2013-10-24 


$_POST is a special global variable 


 





10:49 2013-10-25 Friday 


review cs50 lec week8 


 


10:49 2013-10-25 


CSS == Cascading Style Sheet 


 


10:50 2013-10-25 



HTML == HyperText Markup Language 


 


11:50 2013-10-25 


CSS let us stylize a page by apply properties 


 


12:22 2013-10-25 


using CSS instead of html tag 


 


12:30 2013-10-25 


style attribute 


 


12:31 2013-10-25 


CSS syntax: colon separated key-value pair 


 


12:33 2013-10-25 


CSS selector: to whom property applies? 


 


12:41 2013-10-25 


What is a div? 


 


div is a tag that introduce a division of a page 


 


it's an invisible rectangle 


 


12:43 2013-10-25 


header division, 


 


content division, 


 


footer division 


 


12:45 2013-10-25 


apply this property to any element whose 


 


id is content 


 


#content 





 text-align: center; 





 


12:52 2013-10-25 


What does cascading means? 


 



#content input // input nested in content 





 margin: px; 





 


13:21 2013-10-25 


associative array 


 


13:21 2013-10-25 


traditional array & associative array 


 


14:12 2013-10-25 


KJB == King James Bible 


 


14:17 2013-10-25 


in the internet, there is a high amount of latency 


 


14:19 2013-10-25 


there is no pointer in PHP 


 


14:26 2013-10-25 


php is a web-central language 


 


14:26 2013-10-25 


.php is generally conmingled with php & html 


 


14:35 2013-10-25 


http parameters 


 


14:38 2013-10-25 


super global variable 


 


14:39 2013-10-25 


What is the bootstrap library? 


 


It's just a bunch of CSS written by twitter 


 


14:40 2013-10-25 


bootstrap.min.css 


 


14:49 2013-10-25 


toggle between html & php 


 


14:51 2013-10-25 



PHPMailer 


 


/// 


19:36 2013-10-26 Saturday 


review cs50 week 8 


 


19:40 2013-10-26 


CSS == Cascading Style Sheets 


 


19:41 2013-10-26 


html tag 


 


20:11 2013-10-26 


What's that in a nutshell? 


 


20:11 2013-10-26 


HTML == Hyper Text Markup Language 


 


20:12 2013-10-26 


a better way to stylize your page 


 


20:13 2013-10-26 


html -> CSS 


 


 


20:47 2013-10-27 Sunday 


CSS == Cascading Style Sheets 


 


HTML == HyperText Markup Language 


 


21:27 2013-10-27 


colon-separated key-value pair 


 





8:38 2013-10-28 


CSS == Cascading Style Sheets 


 


8:41 2013-10-28 


HTTP == HyperText Transfer Protocol 


 


http is actually a stateless protocol 


 


8:45 2013-10-28 


superglobals 



 


8:56 2013-10-28 


shopping-cart feature 


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


11:05 2013-10-28 


http is a stateless protocol 


 


11:05 2013-10-28 


superglobal 


 


11:07 2013-10-28 


shopping-cart like feature 


 


11:12 2013-10-28 


MVC == Model View Controller 


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


11:35 2013-10-28 


start cs50 week 9 


 


11:46 2013-10-28 


$_SESSION 


 


11:47 2013-10-28 


http is stateless 


 


12:03 2013-10-28 


What is a cookie? 


 


a cookie is a textfile that server gives the 


 


browser which contains a unique identifier: 


 


PHPSESSID etc 


 


12:22 2013-10-28 


VARCHAR == Variable-Length Char 


 


12:36 2013-10-28 


PK == Primary Key 


 


13:03 2013-10-28 


atomicity 


 


13:09 2013-10-28 



transaction 


 


13:10 2013-10-28 


DOM == Document Object Model 


 


13:10 2013-10-28 


DOM tree 


 


13:13 2013-10-28 


JavaScript 


 


13:13 2013-10-28 


jQuery 


 


13:15 2013-10-28 


JavaScript is usually executed browser side 


 


13:17 2013-10-28 


var == variable 


 


13:41 2013-10-28 


in raw JavaScript 


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


13:52 2013-10-28 


start cs50 week 9 


 


13:54 2013-10-28 


AJAX == Asynchronous JavaScript 


 


15:25 2013-10-28 


UCD == User Centered Design 


 


16:03 2013-10-28 


JavaScript selectors 


 


16:06 2013-10-28 


What is Ajax? 


 


Ajax == Asynchronous JavaScript & XML 


 


16:07 2013-10-28 


make a http request 


 


16:17 2013-10-28 



get request, post request 


 


16:31 2013-10-28 


bootstrap 


 


16:35 2013-10-28 


autocomplete 


 


16:44 2013-10-28 


JSON == JavaScript Object Notation 


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


17:18 2013-10-28 


review cs50 week 9 


 


17:29 2013-10-28 


design flaw 


 


17:32 2013-10-28 


design + engineering 


 


17:35 2013-10-28 


UCD == User-Centered Design 


 


17:50 2013-10-28 


privacy is a huge user experience issue 


 


18:13 2013-10-28 


JavaScript Selectors 


 


18:14 2013-10-28 


#submit // what is this JavaScript selector? 


 


.centered // select by class 


 


18:17 2013-10-28 


form input[type=text] 


 


18:21 2013-10-28 


What is Ajax? 


 


Ajax == Asynchronous JavaScript & XML 


 


18:22 2013-10-28 


web browser make a http request to a link 



 


18:29 2013-10-28 


listen an event, event handler 


 


18:32 2013-10-28 


I want a http POST request 


 


18:38 2013-10-28 


display the result dynamically in the same page 


 


18:48 2013-10-28 


bootstrap library 


 


18:49 2013-10-28 


autocomplete 


 


18:59 2013-10-28 


JSON == JavaScript Object Notation 


 


19:02 2013-10-28 


convert JSON to associated array 


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


21:37 2013-10-28 




 


//


 


21:47 2013-10-28 


https 


 


21:47 2013-10-28 


VPN == Virtual Private Network 


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


21:54 2013-10-28 


start cs50 week 11 


 


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


22:30 2013-10-28 


THE END OF CS50! 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值