Perl script makes MySQL query; outputs to JSON

Sunday, June 20, 2010
By Colin

An example of a perl script that is called by an ajax request. The script takes in a few parameters, opens a mySQL DB connection, and then makes a rather tortuous query. The result is then formatted in to JSON and returned to the browser. »

macbook pro turns on but screen stays black — my solution

Saturday, June 5, 2010
By Colin

The Apple Macbook Pro would turn on, but the screen would not.  The screen would stay black.  I could tell the computer was on because when I hit the “caps lock” key, the green light on the key would turn on and off. I fixed this the following way (this is basically resetting the Power... »

New Leaf Restaurant in Fort Tryon Park

Sunday, April 25, 2010
By Colin

Inside Fort Tryon Park in Northern Manhattan.  Only had drinks at the bar there late one Sunday night. What a great place. The bartender was genial, the vodkas were home infused, the cocktails were a delight. The building itself is quite a charmer. Old beams and bricks from the early... »

La Bonne Soup in Midtown

Sunday, April 25, 2010
By Colin

The Maitr’ D is a good fellow, and knows how to handle a busy night. Our waiter was a little slow, or a little busy. The food was great, and reasonably priced for midtown Manhattan. Get a table on the balcony on a warm night, like we did, and sparks will... »

UNIX/AWK Tricks: How to copy a long list of files into a directory

Sunday, April 25, 2010
By Colin

Make your list of files, with complete paths, call it “imgList.txt”. Put every file on a new line. Write a small awk script with the following 1 line: { printf(”cp %s images/\n”,$0);} Save the script as “copyList.awk” Do the following command: awk -f copyList.awk imgList.txt | sh Brief explanation of the awk script: %s means you’re putting a string in that... »

HTML Character Entities in Javascript

Sunday, April 25, 2010
By Colin

Sometimes you need to write html character entities in javascript, but html character entities can’t be used, because they don’t get interpreted by javascript. In javascript, you need to use the equivalent unicode character codes instead. HTML character entity, wrong: formElement.value = "Dirección"; You get: Dirección Unicode character code, correct: formElement.value = "Direcci\u00F3n"; You get: Dirección Unicode character charts are located... »