HTML5 WebSocket w/ Relative URL
I have been toying with the new WebSocket APIs in HTML5. This is a fantastic feature of the latest generation web standards that gives developers the ability to do two-way, streaming network communication directly in the web-browser from JavaScript. WebSockets have the potential to revolutionize performance of web applications, and so, revolutionize the ability of developers to offer rich, user-friendly and useful solutions to our clientele.
The current state of WebSocket development is that modern web-browser makers are all providing excellent WebSocket functionality. I tested with Microsoft IE 10, Mozilla Firefox 20, Google Chrome 25. All three browsers worked identically without any special cross-browser hacks. The server-side prognosis also seems good. Most of my dabbling has been with Tomcat's built in WebSocket support, but it seemed very solid. I was less pleased to learn that Apache HTTPD does not support proxing WebSocket requests via AJP or mod_proxy.
Tip of the day:
One of the quirks of the WebSocket API is that in order to create a new WebSocket object, you MUST pass a FQDN URL such as:
wss://my.domain/MyWebSocketService
However
window.location.href.replace(/^http(s?:\/\/.*)\/.*$/, 'ws$1/SpikeWebSocketServlet')
Backing-up PostgreSQL Databases
I was excited to learn this morning that PostgreSQL has released a RC1 in the 9.2 line. This is one more step on the way to the 9.2 stable release. The news inspired me to update my development server, and once again I had to figure out how to use pg_dump.exe to backup my data. So here's the one-liner that took me five minutes to work out. Posting it here so I don't have to spend another five minutes!
bin\pg_dump.exe -f C:\_projects_\tmp\pg-20120901 -F d -v wlv.co
Adding a Linux User
Adding a user to a Linux system is a task I do frequently enough that I wanted keep the steps handy:
Add the user account:
sudo useradd [USER_NAME]
Lock the user account:
sudo usermod -L [USER_NAME]
Setup the user's initial password:
sudo passwd [USER_NAME]
Add the user to a group (optional):
sudo usermod -a -G [GROUP_NAME] [USER_NAME]
Require the user to immediately change their password upon first login:
sudo chage -d 0 [USERNAME]
Unlock the useraccount:
sudo usermod -U [USERNAME]
Fixing Eclipse Tomcat WTP Startup Issues
The Eclipse WTP tools seem to have problems when the JDK in use changes. There does not appear to be any UI feature that allows a user to tell the WTP server which JDK to use, causing it to fail to start with various error messages. Thankful to this blog post, I have found a fix that has reliably worked. I keep referring to the page, so thought I'd regurgitate it here...
Solution : delete the [WORKSPACE_NAME]\.metadata\.plugins\org.eclipse.debug.core\.launches\[WTP_SERVER_NAME].launch file