Category: Programming Language
-
Developing against H2 Database: Lesson Learned
While my production database is MS SQL Server, I have been using H2 database for rapid local development. I wrote my DDL scripts as “Transact-SQL” as possible so that I don’t need to maintain multiple DDL scripts for each database. So far, it has been working out great. My web development runs against H2’s file-based Read More…
-
HTML: Creating a Default Placeholder for Image that Fails to Load
PROBLEM Let’s assume our web application relies on an external system to provide the image link, for example: employee photo link of a company. If the image link is invalid, we will get the ugly looking “x” on certain browsers. SOLUTION To fix this, we can load an image placeholder from our own web application Read More…
-
Modernizr: Detecting Touch Devices vs Non Touch Devices
Modernizr has a great feature that allows us to detect whether the browser is running on a touch device (iPad, smartphones, etc) or on a non-touch device (laptop, computer, etc). Even though most modern touch devices support “proximity” hovering (navigating without touching the device screen), the browsing experience still suffer when dealing with onmouseover and Read More…
-
Java: Invoking Secured Web Service with JSESSIONID
PROBLEM I wrote a JSP custom tag that invokes a secured web service within the same application to perform some evaluation. This custom tag is only used in the secured views where the user has successfully authenticated against Spring Security, and they have access to these views. The secured web service is also guarded by Read More…
-
Java: Performing 2-Key Lookup using HashBasedTable
PROBLEM HashMap is great to perform a simple lookup, for example:- However, what if we need 2 keys to lookup a value? For example, we need “key1” + “key2” in order to lookup “mike”. SOLUTION 1: Create combo key You can combine the keys to create a unique key:- Assuming if the keys are just Read More…
-
Jadira Usertype: Under JDK 6 it may not be possible to handle DST transitions correctly
PROBLEM When saving a Hibernate entity that contains Joda Time object, Jadira UserType throws the following warning:- This warning occurs when using this version:- SOLUTION Upgrade Jadira Usertype to the latest version, and the problem goes away:- Read More…