Monthly Archives: September 2012

template in c++

C++ templates: Function templates: Class templates: Note that member functions of template class are considered function templates. Thus, the implementation (not the definition in the class) needs to have template attribute. Also note the template tag before the scope resolution … Continue reading

Posted in C/C++ | Leave a comment

Type casting in c++

Implicit conversion: No need for operator. Automatically performed when a value is copied to a compatible type. Such as short to int, int to float, double to int, etc. Also include constructor or operator conversions. For example, the following conversion … Continue reading

Posted in C/C++ | Leave a comment

typedef in C++

typedef c++ typedef allows you to create an alias for a data type. typedef [attributes] DataType AliasName; typedef also allows you to define an alias for a function. You must specify the return type of the function and its type(s) … Continue reading

Posted in C/C++ | Leave a comment

Double Hashing

Apply a second hash function to the key when a collision occurs. The second hash function returns the number of positions from the collision point to insert. Cannot be 0.  A popular second hash function would be: Hash2(key) = R – (key % … Continue reading

Posted in Algorithm | Leave a comment

“memset” in C++

memset function sets the first num bytes of the block of memory pointed by ptr to the specified value. Note that the value is interpreted as an unsigned char. Function prototype: void * memset (void * ptr, int value, size_t … Continue reading

Posted in C/C++ | Leave a comment

“union” in C++

union is a user defined type that used the same block of memory for every its list member. All the members are allocated starting at the same location in memory, and thus allows the access to the same data with … Continue reading

Posted in C/C++ | Leave a comment

#include header files with C preprocessor

The `#include’ command works by directing the C preprocessor to scan the specified file as input before continuing with the rest of the current file. The output from the preprocessor contains the output already generated, followed by the output resulting from the … Continue reading

Posted in C/C++ | Leave a comment

misc quick notes

JRE: Java runtime environment, consists of JVM (abstract computing machine, have an instruction set that uses memory), Java platform core classes, supporting Java platform libs. JIT: just in time compiler, improvement execution performance, especially for long running, compute-intense programs. If JIT env var … Continue reading

Posted in Miscellaneous | Leave a comment

Cursor movement in Linux cmd line

The following keyboard shortcuts may help your cursor to move faster around Linux command line, and hopefully improve productivity :)

Posted in Linux | 1 Comment

Things must know about Linux

Linux directory structure: Explanation of Linux directory structure. Install packages on Linux: – Extract the package using tar – Go to extracted folder and do (usually install under /usr/local directory). And then compile and install. Note that the last command … Continue reading

Posted in Linux | 1 Comment