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.

icon.linkedin.jpgicon.twitter.jpg

  • Subscribe to this RSS Feed
  • Excellent Example and Explanation on How to Inject Properties from an External Properties File from Outside of a WAR in a Spring Application
    01/29/2014 8:39PM

    I am doing some refactoring on a Spring MVC application, pulling out configuration data and login crentials from the spring.xml file.

    What I want to do is to consolodate sensitive data into external .properties files that can be read, at runtime by the app and not require recompiling the war to make changes.

    Thanks to Ben Northrop and Summa Technologies for such a clear, concise and well written article.

    The long and the short of it (copied from the aforementioned article) is to add the following to your spring.xml

    <bean id="propertyPlaceholderConfigurer"  
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
      <property name="locations"> 
        <list> 
          <value>classpath:database.properties</value> 
        </list> 
      </property> 
    </bean> 

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> 
      <property name="user" value="${db.user}"/> 
      <property name="password" value="${db.password}"/> 
      ... 
    </bean>

  • Disabling Window Snapping for Fedora Core 20 Under Xfce
    01/28/2014 11:50AM

    For me, window snapping is incredibly annoying.

    For FC 20 with the Xfce spin, there a couple of knobs to turn before it can be turned off completely:


    Applications Menu/Settings/Window Manager:

    Go to the Advanced tab and uncheck 'Snap windows to screen border' and 'Snap windows to other windows'


    Applications Menu/Settings/Window Manager Tweaks:

    Go to Accessibility tabUncheck the 'Use edge resistance instead of window snapping'

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

    #!/bin/bash

    for i in `cat tables_list.txt`
    do

       # 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

    done;

  • 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")

Advanced Search

Categories

Archives