-
To use localStorage in Firefox cookies must be allowed
In case a JavaScript generates a security error in Firefox when using localStorage, I found the advice to make sure the about:config property dom.storage.enabled to true.
But this is not enough! localStorage is only available if cookies are allowed for the domain that serves the web page with the script.
I find this strange, cookies are completely different things.
-
Experiences with Maven 3: Generating reports
After installing version 3 of Maven I missed the generation of the documentation site. While the documentation claims no changes to POM files are necessary to use the newer version it doesn’t behave the same.
Version 3 accepts the same POM files used with version 2, but the site goal no longer generates any output. This is because of a change in the POM structure. The configuration of reports has moved from a separate
<reporting>section to the<build>section:<build> <plugins> ... <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-site-plugin</artifactId> <version>3.0-beta-3</version> <configuration> <reportPlugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-project-info-reports-plugin</artifactId> <version>2.4</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.8</version> <configuration> <quiet>true</quiet> </configuration> </plugin> </reportPlugins> </configuration> </plugin> ... </plugins> </build>To generate the general project information reports you automatically get with Maven 2, add the maven-project-info-reports-plugin.
-
Smaller classes make better code
Tip: read In Praise of Small Classes and its follow-up Making Large Classes Small (In 5 Not-So-Easy Steps) about writing better code. Better here means:
- easier to read and understand, so easier to maintain
- less complex classes
- better testable classes
- a better class and package structure
-
Filter .svn folders in Eclipse Navigator
To hide the .svn folders from the Eclipse Navigator there’s no UI setting, you need to create a plugin. So here it is, a little plugin to hide .svn folders:
<?xml version="1.0" encoding="UTF-8"?> <?eclipse version="3.0"?> <plugin id="com.kwebble.ide.navigator.filter" name="Filter .svn folders" version="1.0"> <extension point="org.eclipse.ui.ide.resourceFilters"> <filter pattern=".svn" selected="true"/> </extension> </plugin>
Put this in a com.kwebble.ide.navigator.filter folder under the Eclipse plugins folder.
To filter files with different names adjust the pattern accordingly.
-
A trim() method for the JavaScript String class
Just rediscovered that IE still doesn’t include the trim() method on the String class. Here’s a snippet of code, based on an answer on StackOverflow, to make sure there’s a trim method available:
if (typeof String.prototype.trim !== 'function') { String.prototype.trim = function() { return this.replace(/^\s\s*/, '').replace(/\s\s*$/, ''); } }On the positive side I also found out about the debugger included in IE 8. Just like Firebug, available via F12!
-
Tip: use the axis:axis:1.4 Maven artifact if you need Axis 1.4 support
For a Java program that can be run from the command line I used the Maven Assembly plugin to generate a JAR file with all dependencies included.
Although the build was successful, running the software generated a NoClassDefFoundError, caused somewhere in Axis. After a lot of time I finally found some information about the existence of two Axis artifacts in the central Maven repository. Axis 1.4 is available under groupid axis and org.apache.axis.
The POM file of the axis:axis:1.4 artifact includes a number of runtime dependencies, which are not included in the other. Since I used the incomplete version the resulting JAR missed some necessary classes.
So if you use Axis 1.4, define a dependency on the axis:axis:1.4 artifact, not org.apache.axis:axis:1.4.
-
Google Closure tools
Google announced the availability of Google Closure Tools, a set of JavaScript tools to help development of web applications. The set contains:
- Closure Compiler: a JavaScript optimizer
- Closure Library: a JavaScript library with reusable UI widgets and controls, utilities for the DOM, server communication, animation, data structures, unit testing, rich-text editing etc.
- Closure Templates: a client- and server-side templating system that helps you dynamically build reusable HTML and UI elements.
-
Simple Cloud API
A new initiative called Simple Cloud API aims to give PHP developers easier access to cloud technologies. The project will produce a new Zend_Cloud component for the Zend Framework.
From the FAQ:
The Simple Cloud API is an open source project that makes it easier for developers to use cloud application services by abstracting insignificant API differences. One of the design goals of the project is to encourage innovation. To this end, the Simple Cloud API can be used for common operations while users can easily drop down to vendor libraries to access value-add features.
-
Showing related articles in a WordPress blog
A few days ago I made a small change to the site. On pages showing a single article, the sidebar now shows a list of related articles on the site. By exposing these articles I hope visitors will find other interesting stuff to explore on this site.
The WordPress plugins to add related articles I found seemed a bit to complex to me, so I was glad I found some PHP code to do the same. This code looks for other articles with the same tags as the displayed article. I changed it a bit into a separate part that retrieves the articles and a part to display them.
The only thing I need to do now is to tag all the older articles, since I only started tagging recently.
-
GMarker title deactivates mouseover event
Quick tip for Google Maps developers: the mouseover event of a GMarker doesn’t fire when the marker has a title. This isn’t mentioned in the mouseover documentation.