Skip to main content

Posts

Loading Google Maps API asynchronously with RequireJS

With Single Page Web Applications becoming more and more popular, I decided to understand the concepts of various Javascript frameworks a little better. There are literally hundreds of them, but I decided to start with a really nice tutorial written by Alex Young. Cornerstones in this tutorial are BackboneJS, Underscore, Bootstrap and RequireJS. After been through the tutorial I decided to roll my own project based on the same setup. I wanted to use Google Maps for this, and searched for a way to load the API using RequireJS. Turned out that there are a few different approaches, but the most common seems to be to use the async-plugin created by Miller Medeiros. Jason Wyatt has another interesting solution which caught my attention. Being new to all this, I really didn't feel like start involving plug-ins from remote repositories. It might be the most natural thing to do, but one step at a time is more my melody. Jason's solution had some drawbacks mentioned in the comm...

Greasemonkey to rescue!

Greasemonkey is an add-on to Firefox that seems to prove to be really useful, so I wanted to give it a spin. Basically, what it does is to modify webpages on-the-fly as you load them - using JavaScript. Many times I guess people use it to get rid of nasty ads and so forth. There are plenty of other add-ons able to do that - like removing a specific element each time, which doesn't require any coding. What fun is that? Nonetheless, my first Greasemonkey-script does just that - removes an ad. But for the site in question - www.di.se (all in Swedish) - it isn't as easy as removing an element. The site is divided into 3 rows using a frameset that looks like this:   <frameset frameborder="no" framespacing="0" rows="0,210,*"> <frame class="noprint" frameborder="no" framespacing="0" name="historyFrame" noresize="" scrolling="no" src=""></frame> <fram...

Fighting Dell!

Ok - so I've been having trouble with my Dell Latitude e5410. What kind of trouble, you ask? Well, I discovered it when listening in on my favorite tunes on Spotify. Intermittent there was a "buzzing" sound for a brief moment, like if my headphones weren't properly attached, or poorly fitted into the jack. This happened 5-10 times per song and was really annoying me, but I couldn't really figure out what it was. Tried a couple of things, like testing with different headphones, downloading new audio drivers, but it never when away. It even occurred when listening without headphones. And no matter if it was streaming media or music on from my local library. So I gave up. Sigh! Stopped listening on music while working, that is. Half a year later, and some hours to kill, I started searching for a solution (again). But how do you Google it? "Dell sound noise"? "Dell e5410 audio buzz"? No luck. Turned out the magic word was "music",...

Getting filters to play nicely with Spring

After having some struggle with getting filters to integrate well with my Spring context, I decided to write down a small tutorial for it... To begin with, filters are defined in web.xml and are therefore not automatically part of the Spring application context, which is normally set up using the DispatcherServlet. A good way to abstract away all this is to use the DelegatingFilterProxy, which is a Spring utility class that acts as a filter, but will delegate the doFilter-method to a Spring-managed bean - normally a class extending GenericFilterBean. As a filter is defined in web.xml and looks for the bean defined in the Spring context in applicationContext.xml, it's not really the set up that I want. Filters are part of a web application and should have access to what's usually defined in webmvc-config.xml, as part of the DispatcherServlet set up. To be able to use, e.g. request scoped beans in applicationContext.xml, you need to defined them as proxied objects in order to hav...
A quick note on something that's been bugging me while using SpringSource STS with the GWT-plugin on my MacBook Pro... Sometimes, when shutting down the internal devmode server I get an error dialog saying it wasn't able to shut down the process fully (even though it looks shut down in the console window). When starting it again, it reports port 9997 to be in use already - and consequently fails to start up again. I haven't found a way to find the process within SpringSource STS, even though there are probably several ways of doing it (which I do not know about). Anyhow - I solved it using the " lsof " package (List Open Files). To find the PID of the process using port 9997, type "lsof -i :9997" in a Terminal window. A simple "kill -9 &ltpid&gt" will take care of the rest. I'm not sure if this happens on other platforms etc, but at least, now you know how to handle it if it hits you!

Styling individual (and nested) tabs using GWT

I've read several forum entries trying to explain how to style GWT TabLayoutPanels, and there seems to be several ways to do it. The three most common ways are to: 1) Edit the standard.css-file and update the .gwt-TabLayoutPanel, .gwt-TabLayoutPanelTabs, .gwt-TabLayoutPanelTab, .gwt-TabLayoutPanelTabInner and .gwt-TabLayoutPanelContent. 2) Override the styles by putting your own css-file as part of html hostpage. 3) Override the styles in the ui-binder file using the @external keyword. None of them really fit my needs... I want to be able to style indidividual tabs, including nesting tabs within tabs (with different styling). The methods above changes the globally set stylenames, and applies to all tabs being used in you application. What I'm looking for is to style the tabs using defined styles in the ui-binder file. This way, the styles will be obfuscated and possible to apply within it's own namespace - hence only applied to individual tabs using that namespace. ...

Using SmartGWT with Jersey RESTful backend on Spring Roo

I decided to give SmartGWT a run, and specifically the RestDataSource functionality using Jersey. To make things easier, I'm using Spring Roo to set up my project and scaffold much of the boilerplate code, configurations etc. My approach is to have my domain objects exposed as RESTful web services and create a matching SmartGWT DataSource in order to show them in a GUI. Let's get started, shall we? First of all, you'll need Spring Roo (unless you just download the project source code and want to run it directly). I'm using the following Roo script to start things off: project --topLevelPackage com.technowobble persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY entity --class ~.domain.Message field string --fieldName value controller class --class ~.ws.MessageResource --preferredMapping rest dependency add --groupId com.sun.jersey --artifactId jersey-server --version 1.3 dependency add --groupId com.sun.jersey.contribs --artifactId jersey-s...