Kwebble : Blog

Programming

  • To use localStorage in Firefox cookies must be allowed

    Gepubliceerd op 28 juni 2011 in Programming.

    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.

    • cookie
    • firefox
    • html5
    • javascript
    • localstorage
    • tip
  • Experiences with Maven 3: Generating reports

    Gepubliceerd op 21 juni 2011 in Programming.

    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.

    • documentation
    • maven
  • Smaller classes make better code

    Gepubliceerd op 17 juni 2011 in Programming.

    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
    • class design
    • improvement
    • object orientation
    • oo
    • source code
    • tip
  • Filter .svn folders in Eclipse Navigator

    Gepubliceerd op 16 november 2010 in Programming.

    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.

    • eclipse
    • plugin
    • svn
  • A trim() method for the JavaScript String class

    Gepubliceerd op 25 juni 2010 in Programming.

    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!

    • javascript
  • Tip: use the axis:axis:1.4 Maven artifact if you need Axis 1.4 support

    Gepubliceerd op 29 december 2009 in Programming.

    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.

    • axis
    • java
    • maven
    • maven assembly
  • Google Closure tools

    Gepubliceerd op 6 november 2009 in Programming.

    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.
    • javascript
  • Simple Cloud API

    Gepubliceerd op 23 september 2009 in Programming.

    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.

    • api
    • cloud
    • php
    • zend framework
  • Showing related articles in a WordPress blog

    Gepubliceerd op 16 juli 2009 in Programming.

    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.

    • php
    • wordpress
  • GMarker title deactivates mouseover event

    Gepubliceerd op 8 juli 2009 in Programming.

    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.

    • googlemaps
    • javascript
  • « Oudere artikelen
  • Nieuwere artikelen »
  • Rubrieken

    • Artikelen
    • Foto's
    • Links
    • Media
    • Overheid
    • Programming
  • Recente Berichten

    • Stanford Web Applications course lectures
    • The importance of knowing Unicode
    • “If you are not paying for it, you’re not the customer; you’re the product being sold.”
    • Inzage in je gegevens bij Facebook
    • Tuning Oracle UCM 11 & Site Studio performance
  • Abonneren

    • Atom feed Artikelen
    • Atom feed Reacties
  • Archief

© Rob Schlüter - Contact