Thursday, March 19, 2015

CSV Escapes

Today I learned that if you are exporting the results of a SQL query to a .csv file to open in Excel, and certain fields may contain newlines, the correct way to make it import correctly is to ensure that your escape character is ".  It took much experimenting to realize this. The more you know.

Friday, March 13, 2015

In honor of pie day, a function that will approximate pi more and more the larger positive number you give it. Note that it will exceed your stack before it gets very far. wink emoticon This is my stalling-before-bedtime attempt to implement 4/1 - 4/3 + 4/5 - 4/7 + etc.

var pie = function(x) { 
    x = (x%2==0) ? x+1 : x ;
    if (x < 2) { 
        return 4; 
    } else { 
        return pie(x-2) + (1- (2*(((x-1)/2)%2))) * (4/x); 
    }
}
In my current instance of Chrome, in the dev console, I can enter up to pie(35859), which returns 3.1415368811414246.