Ben Chuanlong Du's Blog

And let it direct your passion with reason.

Automated Verizon Phone Bill (Continued)

I have switched to the "Share Everything" plan of Verizon two weeks ago, and I got a little complex bill this month due to people leaving and joining my family plan. My ruby program for parsing phone bill still works well. It is actually surprising smarter than I thought on …

String in C++11

  1. auto s = "abcd" creats const char * not string, so use auto with caution.

  2. Since a string in C++ is an array of chars, you can operate it like an array. For example, you can use range-based for loop and so on.

  3. It is recommended that you use std::string in …

Define Operator in R

One thing I do not like R is that operations on String in R are not as convenient as in other programming langauges such as Java, Python and Ruby. In these 3 programming languages, you can simply use + to concatenate strings while in R you have to use the function …

Abuse of Vector in R

R is a language that is friendly to vector operation, so vector is an important data structure in R. A single data (of basic types, e.g., numeric or character) is essentially a vector of length 1. A matrix or an array in R is essentially a vector. R make …

Tips for VB/VB.net

About String Functions

  1. The uniform random variables generated by VB is pretty good. At least it's acceptable according to the test in R.

  2. String functions that return a string can be used with a dollar sign at the end, which is a faster version of the corresponding function.

  3. The function …