Archive for August, 2005

UniqueProperties.java

Friday, August 19th, 2005

We had a properties file that had massive numbers of duplicate property definitions. Since the Java convention is that the last definition of a property is the one that will be used, I created a simple utility that outputs a properties file with non-final definitions skipped:

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;

/*
 * File UniqueProperties.java
 * Created on Aug 19, 2005 by jstell
 *
 */

/**
 * Simple utility to remove the non-final
* occurrences of a property in a
 * properties file. The unique content is
* written to Standard Out.
 */
public class UniqueProperties
{
  public static void main(String[] args)
    throws Exception
  {
    if (args.length != 1)
      System.err.
       println("USAGE:n java " +
               UniqueProperties.class.getName() +
               " [props file]");

    String in = args[0];
    BufferedReader frIn =
      new BufferedReader(new FileReader(in));

    int lineNum = 0;
    ArrayList linesToSkip = new ArrayList();
    HashMap propLines = new HashMap();
    String line = null;
    // figure out what lines to skip
    while ((line = frIn.readLine()) != null)
    {
      lineNum ++;
      if (line.indexOf('=') > 0 &&
       !line.startsWith("#"))
      {
          String pName =
          line.substring(0,
                         line.indexOf('=')).trim();
          Object prevLine =
          propLines.put(pName,
                        new Integer(lineNum));
          if (prevLine != null)
          linesToSkip.add(prevLine);
      }
    }
    // start over, output skipped lines
    frIn.close();
    frIn = new BufferedReader(new FileReader(in));
    lineNum = 0;
    while ((line = frIn.readLine()) != null)
    {
      lineNum ++;
      if (!linesToSkip.
           contains(new Integer(lineNum)))
        System.out.println(line);
      }
    }
} // UniqueProperties

del.icio.us linkroll

Friday, August 5th, 2005

del.icio.us has (at long last) added JavaScript link roll functionality. Just add a JavaScript include to the page, and your del.icio.us links appear. A good set of options, including filtering by tag, in case you only want to show links tagged ‘website’ or ‘public’.

Right now, del.icio.us still seems to be predominantly tech, GTD/productivity, web stuff (take a look at the most popular tags)– much of which I find interesting. The signal to noise ratio (for me) is tolerable. I wonder what will happen when the masses jump on the bandwagon and the most popular tags become more general interest… I suppose at that point I’ll need to start filtering/ignoring out some of those tags.

It would be interesting if del.icio.us started suggesting items bookmarked by users with similar tags and bookmarks. Actually, I’d be surprised if they haven’t already started looking into this.

I wonder when a big player (Google, M$, Y!, Fox, etc.) is going to make a move to acquire del.icio.us?

Update: I suppose I could’ve poked around a bit more. Here is a blog post listing all kinds of del.icio.us tools. For instance, Outfoxed is a tool that lets you specify trusted "informers" to help make decisions about interesting/safe links.