-std=c11 -Wall -Wextra -Wpedantic -O2
May 26, 2015
May 25, 2015
Lexicographic order in Java
The following notes are from Udacity-Intro to Java Programming
Thus, numbers (1 < 11 < 12 < ... < 2 < 21 ...) < Uppercase letters < Lowercase letters
Ex:
123 < John < john
lesson1 < lesson10 < lesson2
The term lexicographic order is not defined in the videos. It means the order the computer sorts the strings in. In the computer world, numbers are considered to be smaller than letters of any kind. So they come first. Uppercase letters are smaller than lowercase numbers letters. so "X" comes before "x"
This is another interesting thing about alphabetizing Strings containing numbers in computers. Here is how numbers would be ordered. 1, 11, 12, 13, 14 ... 2, 21, 22, 23 ... Anything that starts with 1 comes before anything that starts with 2. so even 1000 would come before 2.
Thus, numbers (1 < 11 < 12 < ... < 2 < 21 ...) < Uppercase letters < Lowercase letters
Ex:
123 < John < john
lesson1 < lesson10 < lesson2
We can use "compareTo" function to compare the lexicographic order between two strings.
ex: String1.compareTo(string2)
the return value:
0 : if two strings are identical
< 0 : if String1 is lexicographically less than String2
> 0 : if String1 is lexicographically greater than String2
See more detail on
May 18, 2015
Install OpenCV for Python on Mac OSX (Yosemite)
The tutorial from the following website works for me. I followed the steps and installed OpenCV v2.4.11_1 on Mac OSX (Yosemite).
https://jjyap.wordpress.com/2014/05/24/installing-opencv-2-4-9-on-mac-osx-with-python-support/
https://jjyap.wordpress.com/2014/05/24/installing-opencv-2-4-9-on-mac-osx-with-python-support/
May 13, 2015
May 12, 2015
Call by assignment in Python
When passing a mutable object (list, dictionary, etc.) to a function, it works like "call by reference" that the object will be shared.
When passing a immutable object (int, tuple) to a function, it works like "call by value" that it pass a copy of the original object to a function.
See more detail:
[1] https://docs.python.org/3/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference
[2] http://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference
When passing a immutable object (int, tuple) to a function, it works like "call by value" that it pass a copy of the original object to a function.
See more detail:
[1] https://docs.python.org/3/faq/programming.html#how-do-i-write-a-function-with-output-parameters-call-by-reference
[2] http://stackoverflow.com/questions/986006/how-do-i-pass-a-variable-by-reference
Subscribe to:
Posts (Atom)