Welcome to my website. I am always posting links to photo albums, art, technology and other creations. Everything that you will see on my numerous personal sites is powered by the formVistaTM Website Management Engine.


  • Subscribe to this RSS Feed
  • Executing Dynamically Generated SQL Queries in a Shell Script and Saving the Output to a Variable
    01/10/2014 10:19AM

    If you would like to, in a shell script, dynamically generate SQL queries for MySQL and save the output of those queries to a variable that you can then use in the script, here is an example:


    for i in `cat tables_list.txt`

       # Build the query
       QUERY="SELECT count(*) FROM ${i}"

       # Run the query from the command-line and save the
       # output into the $ROW_COUNT variable
       ROW_COUNT=$(echo $QUERY | mysql -u${USER_NAME} -p${PASSWORD} -h ${HOST} -P ${PORT} --skip-column-names ${DBASE})

       # Do something with the var...
       echo -n -e "$ROW_COUNT\t" >> $OUT_FILE
       echo "$i" >> $OUT_FILE


  • Figuring out MySQL ERROR 1005 (HY000) Can't create table (errno: 150)
    01/03/2014 4:56PM

    So I'm dumping a database on a remote server to pull down to my local box to do some development.  When loading the mysqldump file I encountered the error:

    ERROR 1005 (HY000) at line 8680: Can't create table 'database.table' (errno: 150)

    After doing some searching online it seems that is one of the notoriously cryptic MySQL error messages that is woefully overloaded.

    I did manage to fix the error (which ended up being a foreign key reference from another table to the one that was erroring out whereby the column definitions were not exactly the same) and learned two important things:

    1. You can invoke the following mysql command immediately after the error to get a more verbose error message (which is what enabled me to solve the problem): SHOW INNODB STATUS
    2. Jason Hinkle has a very nice online reference with a number of possible culprits, and their solutions are listed.

  • Dynamically Appending Elements to a Bash Array
    12/18/2013 2:05PM

    Following is how to dynamically append (push) items to an array in a bash script.

    declare -a ARRAY=()

    ARRAY=("${ARRAY[@]}" "item1")

    ARRAY=("${ARRAY[@]}" "item2")

  • Install Android Application Directly Without it Being in the Market
    12/05/2013 10:20AM

    When developing apps you will not only want to test them against the Eclipse AVDs but also install them on an actual device.

    To do so, set up an HTTP server (here is a link to another article on how to set up a quick and dirty HTTP server) and put you .apk file somewhere where you can get to it from your local network.

    Make sure that you check the 'Unknown sources' setting that will enable you to install applications that are of non-Market origin. 

    Then just open a browser on your Android device and download the .apk file.  Once done, when you attempt to open the .apk file the device will ask you if you want to install it.

  • Deleting Safari Cookies in iOS Simulator
    11/06/2013 9:36AM

    If you are doing any kind of development that involves cookies and need to be able to delete them while testing iOS you will likely need to delete them as well.

    The iOS simulator (Launched from Xcode by going to Xcode > Open Developer Tool > iOS Simulator) stores data for the simulator in the following directory on the host Mac OSX file system:  /Users/<uid>/Library/Application Support/iPhone Simulator/

    First, quit out of the iOS Simulator.

    To find the cookies and delete them open up a terminal and cd to the iPhone Simulator directory.

    $ cd /Users/<uid>/Library/Application\ Support/iPhone\ Simulator/

    Then execute the following find command to find the cookie data file:

    $ find ./ -type f -iname '*binarycookies*' -exec ls -l {} \;
    -rw-r--r--  1 ryanchapin  staff  2503 Nov  6 08:32 .//7.0-64/Applications/630F9FE9-87B2-4A6D-8C60-CA70EBC5FD8A/Library/Cookies/Cookies.binarycookies

    You can then update the find command to the following to delete the file.

    $ find ./ -type f -iname '*binarycookies*' -exec rm {} \;

Advanced Search