Wednesday, 22 August 2012

Some thoughts about Evaluation of Advanced Software and Tech Dev Investment

Advanced Software and Tech is always benefit to the company and every one are aware of that. But the manager's questions are always: How good it is? What is the Cost? Can it bring revenue or save cost? Worth to invest? 

The Cost is relatively easy to measure if the license fee is certain and the development period estimation is kind of accuracy.

Take an commercial or development plan of an advanced automation test tool for example,

The benefit to a Software Company may be:

1. Reduce the number of bugs found and unfound.
bugs found: bug avg analysis time; bug fixed time; Sanity Test or Regression Test time; Redeployment time; Employee Salary.

Bugs unfounded: can be defined found by customers. The impact may be: Halted production time hence take the lost revenue as cost; Brand loyalty, hard to measure but maybe we can define a concept like: One customer will stop using the product completely if he find 10 significant bugs in run time. So one significant bug cost is worth 10% of revenue generated by one customer .

2. Reduce the regression test time. Just consider the saving time and the employee salary.

3. If a tool is self-developed, we may need to consider the depreciation period. For example, we can assume the tool will be totally deprecated after 10 years.  It is possible because the technology may be outdated, or the maintenance cost is uncontrolled increasing due to bad design or changing dev and support guys or others.

Anyway, even though hard to quantization, data is more more reliable and supportive to decide to invest a new product. And it is better that each quantitative factor is specific, which means understandable and measurable.  For those data which is hard to measured, can be decided by experts, engineers and managers discussion. 

boost::split string split algo

Today just check how a url is parsed into several components.

 std::vector< std::string > tokens;
 boost::split( tokens, URL, boost::is_any_of( ":/" ));


It is very simple and straightforward way to implement the functions.

much better than istringstream.getline used before.

        char tmp[128];
        istringstream stream(str.c_str());
        stream.getline(tmp, MAX_ATTRIBUTE_LEN, delimiter);

Also check the boost website
http://www.boost.org/doc/libs/1_49_0/doc/html/string_algo/usage.html

such like case conversion and trim are there.

string str1("HeLlO WoRld!");
    to_upper(str1); // str1=="HELLO WORLD!"
 
    string str1="     hello world!     ";
    string str2=trim_left_copy(str1);   // str2 == "hello world!     "
    string str3=trim_right_copy(str1);  // str3 == "     hello world!"
    trim(str1);  // str1 == "hello world!" 

It is cool. Don't know the performance now but let it there 
unless it is the bottleneck of the whole application. I believe it won't be recently.

Thursday, 16 August 2012

boost regex usage

Good thing in C++.

Just define your regular expression, and put a string to check if it matches. 

for example: 
       boost::regex pureNumberReg("(^[1-9]+[0-9]*)|(^(([1-9]+)|([0-9]+\.[0-9]{1,}))$)");
        return boost::regex_match(value,pureNumberReg);


Easy.

But on windows, it may have some link error message for MD, MT things.

By using BOOST_ALL_NO_LIB, it will force boost won't import the library during compilation.

R with Database

Easy to do by installing RODBC.

After configuring ODBC driver, then from R console, enter

library(RODBC)
 myconn <-odbcConnect("Test", uid="root", pwd="root")
dt <- sqlQuery(myconn, "select * from test")
close(myconn) 


enjoy the output result dt from database!