Showing entries tagged as: programming

Moosaik.

By isendev.

 Posted on 2012/05/30 14:52.

 Tagged as: programming, graphics, mootools.

I've been pretty busy lately but over the last few weeks I've been learning about how to make Mootools and Instagram API play nice together. The result of this work is Moosaik, a small client application to browse Instagram public image streams.

After login with your Instagram account, the browser shows you the current most popular Instagram images in a mosaic layout with 32 tiles. Each image can be zoomed using a Mootools-based lightbox. From there, you can click on the username link to browse the latest images from user's public stream. Alternatively, you can browse for a specific user using the search box.

In future versions, I would like to add new features like image stream paging, multiple search result box or user image stream loading from URL. Feel free to try it and send me your comments.


Programming notes: Using Tomcat connection pool on Spring Framework.

By isendev.

 Posted on 2012/02/02 22:47.

 Tagged as: programming, java, springframework.

Recently, I switched from the outdated (but reliable) c3p0 connection pool I was using in my blogging software to the more recent Tomcat 7 integrated connection pool. This is a code snippet from my Spring Framework bean configuration file that shows you how to configure a Tomcat connection pool with a MySQL database:

<!--
  Deploy a in-memory MySQL configured datasource using the Tomcat's integrated
  connection pool (DBCP). IMPORTANT! It's necessary to copy the MySQL JDBC library
  (.jar) to Tomcat's library folder ($CATALINA_HOME/lib).
-->

<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
 
  <!-- Database driver class name -->
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />      

  <!-- DEV database -->
  <property name="url" value="jdbc:mysql://127.0.0.1:3306/dblog" />

  <!-- PROD database -->
  <!-- <property name="url" value="jdbc:mysql://127.0.0.1:3306/pblog" /> -->

  <!-- Credentials -->
  <property name="username" value="myuser" />
  <property name="password" value="mypassword" />
      
  <!-- TOMCAT connection pool parameters -->      
  <property name="initialSize" value="0" />
  <property name="initSQL" value="SELECT * FROM USER" />      
  <property name="minIdle" value="10" />
  <property name="maxIdle" value="100" />
  <property name="maxActive" value="100" />
  <property name="maxWait" value="6000" />
  <property name="jmxEnabled" value="true" />
  <property name="jdbcInterceptors"
    value="org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;
    org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer" />
  <property name="removeAbandoned" value="true" />
  <property name="removeAbandonedTimeout" value="60" />
  <property name="logAbandoned" value="true" />
  <property name="testOnBorrow" value="true" />
  <property name="testOnReturn" value="false" />
  <property name="testWhileIdle" value="false" />
  <property name="useEquals" value="false" />
  <property name="fairQueue" value="false" />
  <property name="timeBetweenEvictionRunsMillis" value="30000" />
  <property name="minEvictableIdleTimeMillis" value="30000" />
  <property name="validationInterval" value="1800000" />
  <property name="validationQuery" value="SELECT * FROM USER" />

</bean>


Tags
Archives