Skip to main content


Showing posts from May, 2012

Javascript - Rounding numbers to decimal

function roundNumber(number, decimal) { returnMath.round(number *Math.pow(10, decimal)) /Math.pow(10, decimal); }
How it worksThe first thing to understand is how the Math.round() function works in Javascript. The round function takes what ever number that it is given and strips off everything after the decimal point. So if you have a number like 343.12345678 it will return 343. For this example lets say you want to have 2 decimal points left for your output like 343.12. To get the decimal points that we want we need to move the decimal point over 2 spots so that they will not be removed from the round function. Each decimal place is a factor of 10. Tenths, Hundredths, Thousandths, etc.Lets now multiply 343.12345678 by 10^2. 10 is the decimal and the 2 is how many we need to move.You should get 34312.345678. Now if you use the round function you will get 34312 right?So now that we have all the correct numbers we need to get the number back to the right value. 34312 is way bigger than…

Windows 7 ODBC Tricks

If you are migrating over to Windows 7 and running 64bit there may be some issues when trying to use 32bit ODBC drivers.
Step 1. Navigate to c:\Windows\SysWOW64\ directory
Step 2. Run odbcad32.exe

From here you will be able to configure your ODBC DSN.