Tuesday, June 19, 2012

Google Master Search terms and research

You can find some helpful keywords to become a good master searcher via the following:
http://majedlinecode.blogspot.ca/2012/06/google-master-search-terms.html

If you plan to do research, then research articles on sites such as http://www.jstor.org  or http://scholar.google.com/

Remember
 for research, search engines will direct you to sources, but they are not the sources. Try looking through the references in Wiki for example as another research source for a specific topic.

Tuesday, June 5, 2012

Floating-point errors. Computers cannot precisely represent all real numbers. Here is an example.

"Floating-point numbers cannot precisely represent all real numbers, and that floating-point operations cannot precisely represent true arithmetic operations, leads to many surprising situations. This is related to the finite precision with which computers generally represent numbers." (From Wiki)

Today I experienced just that. On a MSSQL query. I must say, it was a very exciting bug to find. (and a bad one). Here is the Example:

select(convert(float,189)-convert(float,128.87)-convert(float,60.15))

-- This yields: 7.105427357601E-15 Let's call the result "MyCalcValue"

Now imagine you are dealing with a financial transaction. Picture 187 as being the total amount to be paid, and there were two payments made to cover for the amount due. If you have the code in SQL Stored Procedure or SQL Function  (which shouldn't be in the 1st place) and if you are doing a comparison saying something like: IF (MyCalcValue > 0.00) THEN print "Amount due" ELSE print "Amount paid" Then you would run into trouble. Your calculation will yield a positive value, and there will always be an amount due. In MSSQL, fortunately, you can deal with this problem by using  money.

select(convert(money,189)-convert(money,128.87)-convert(money,60.15))

-- This yields: 0.00 
I'll be reviewing my university notes and hopefully post more about this. Exciting stuff when theory comes into practice.


Monday, June 4, 2012

Support Blackberry in the interest of security and productivity.

Support Blackberry in the interest of security and productivity. The office needs work tools, not fun stuff!!!!

Can you tell I'm a Blackberry fan :)
Majed A
http://majedline.blogspot.com