tech
Perl script make MySQL query, binds variables, outputs JSON
An example of a Perl script that is called by an ajax request. The script takes in just one parameter, opens a MySQL DB connection, binds the parameter to the query, and sends the query. The result is then formatted into JSON and returned to the browser. This can be seen in action... »
Perl script makes MySQL query; outputs to JSON
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
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... »
UNIX/AWK Tricks: How to copy a long list of files into a directory
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
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... »
Handy MySQL Commands
To reset an auto_increment field to 1: ALTER TABLE tbl_name AUTO_INCREMENT = 1; To load a local csv file into an empty existing table: LOAD DATA LOCAL INFILE ‘/completePathToLocalData.csv’ INTO TABLE tableName FIELDS TERMINATED BY ‘,’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\n’ IGNORE 1 LINES; This assumes you’ve already created your empty table with the same number... »
jQuery parsererror: clean up your JSON objects
Has your JSON using jQuery web app suddenly stopped working? Getting a parsererror on your JSON objects, where you got none before? This is what happened to me when my site upgraded to jQuery 1.4. I use the Google API’s jQuery, and it automatically upgraded my whole site to jQuery 1.4. In jQuery 1.4,... »
Why would a tablet be better for magazines?
Time Inc, publisher of Sports Illustrated, has shown us a vision of its future on tablet devices: A magazine application that readers buy and download each week. Bonnier, publisher of Popular Science, has created a similar demo. But I have to ask: if the magazine app wasn’t a hit on PCs, why would it be... »
IE 8 inPrivate Filtering on by Default
NOTE: A better way to block ads, popups, cookie setters, and profile trackers is to edit your hosts file, which will block such annoyances on all browsers and web applications. Go here for more info on hosts files. IE 8 inPrivate Filtering mode can be set to on/enabled by default by doing the following: Open IE... »
New Salary Guide, Salary Comparison Tool
I just finished coding up a salary guide tool. The salary data is taken from the Bureau of Labor Statistics. Of course the data is searchable on the BLS site, but I thought I could give it a more user-friendly interface, using AJAX and jQuery. Give it a visit, give it a search, and let me... »