• 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 more

  • 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 more

  • 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: more

  • Handy MySQL Commands

    Log into mysql: (enter password on next prompt) mysql -u username -p   Show all databases on server: mysql -u root -p -e ‘show databases;’   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: (This assumes you’ve already more

  • 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, more