Worlds collide: Oracle and Sun JDK. Perfect start to ruin a not so bad Monday morning. Background: Need to have a Tomcat Server deployed on a Oracle Enterprise Linux 5 system. I was happy, when i saw a tomcat5 package in the repositories. Great, i thought. All i need. Well. Not. Under Windows you’ll get […]
Lately i’ve been rambling and ranting a lot on twitter about the Grails framework. To my surprise, many other developers actually read this tweets and helped me out on some problems. Thanks a lot gals and guys, i really appreciate that. Me rambling isn’t meant to be personal at any time, i guess you know […]
Not just for ruby but also the corresponding formats for Java public static final SimpleDateFormat RFC3339_FORMAT = new SimpleDateFormat("yyyy-MM-dd’T’HH:mm:ssZ");public static final SimpleDateFormat RFC3339_FORMAT = new SimpleDateFormat("yyyy-MM-dd’T’HH:mm:ssZ"); and for Oracle SELECT to_timestamp_tz(’1979-21-09T06:54:00+01:00′,’YYYY-MM-DD"T"HH24:MI:SSTZH:TZM’) FROM dual /select to_timestamp_tz(‘1979-21-09T06:54:00+01:00′,’YYYY-MM-DD"T"HH24:MI:SSTZH:TZM’) from dual / Oracle
Thinks i keep forgetting. Today: Enabling a JTree in J2SE to show different tooltips on his nodes: 1. Create a custom tree renderer like so: import java.awt.Component; import javax.swing.JTree; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeCellRenderer; public class TooltipTreeRenderer extends DefaultTreeCellRenderer { @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int […]
Just in case i do keep forgetting that stuff, here’s a regex for decoding urls like ftp://user:somepass@somehost:someport in Java: final Hashtable<String, Integer> portMap = new Hashtable<String, Integer>(); portMap.put("ftp", 21); portMap.put("sftp", 22); final Pattern urlPattern = Pattern.compile("(ftp|sftp)://(\\S+):(\\S+)@([\\S&&[^:]]+)(:(\\d+))?"); final Matcher m = urlPattern.matcher(url); if(!m.matches()) throw new RuntimeException("Invalid ftp url!"); final String protocol = m.group(1).toLowerCase(); […]