This took me a lot longer then it should have to figure out and I thought I’d throw it up here in case anyone else wanted to do it.

The issue was that I had a list of YouTube video IDs and I wanted to see what category they were all in. I didn’t want to do a request for each video ID so I wanted to find a way to get data using one request. The way to do it is to use the YouTube API Batch Processing.

Post this XML:
<feed xmlns="" xmlns:media=""
xmlns:batch="" xmlns:yt="">

<batch:operation type="query" />

to this URL:

and that’s it. Notice the URL in each ID node: the last path item is the ID of the YouTube video.

Check out my twitter feed here:

It’ll be a bunch if sarcastic funny tweets about the world of technology.

The Pickles solution is - discovering the solution to a problem through the act of explaining the problem to somebody else.

This is very common in programming where a developer spends a lot of time on his own trying to fix a problem he’s having with no avail. He calls over another developer and starts explaining the problem. In the middle of the explanation the developer immediately then realizes what the solution is.

I think the reason this happens is that when a developer is trying to find a solution his brain breaks things down into:
-things that could be causing the problem
-things that are assumed as working

A lot of the time the problem lies in the things that are assumed working and the developer is not considering them as a possible solution to the problem.

Explaining the problem to another developer forces him to break the problem down into a series of simple statement and also forces the developer to think about both the “assumed working” and “not assumed working” parts of the problem.

As a developer I uses this tool all the time. I’ll say to another developer “come over here so I can explain this problem to you and figure out what the solution is”. I searched if anything existed naming this technique and I couldn’t find it so I’m naming it myself.


Here are instructions on how to incorporate different TokenFilters in your Lucene application.

I have a Lucene index that contains a lot of French words. Sometimes people search with an accent (Lucéne) and sometimes without an accent (Lucene) and I’d like to treat these searches exactly the same. So there’s a filter already built to handle this called ASCIIFoldingFilter. What it does is convert the é to a e along with all the other characters that contain accents. It only converts them in the index not in the actual content of the document. So the documents and your search results still contain the properly accented characters.

But I had one heck of a time trying to figure out how to actually USE the ASCIIFoldingFilter. So here’s how it’s done:

Step 1 : create your own custom analyzer and add all the TokenFilters you’d like to use :

package com.example.lucene;


import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.LowerCaseFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Tokenizer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.analysis.standard.StandardFilter;
import org.apache.lucene.analysis.standard.StandardTokenizer;
import org.apache.lucene.analysis.ASCIIFoldingFilter;
import org.apache.lucene.util.Version;

public class MyCustomAnalyzer extends Analyzer {

	 public TokenStream reusableTokenStream(
		        String fieldName, Reader reader) throws IOException {

		        SavedStreams streams =
		            (SavedStreams) getPreviousTokenStream();

		        if (streams == null) {
		            streams = new SavedStreams();

		            streams.tokenizer = new StandardTokenizer(Version.LUCENE_29,reader);
		   = new ASCIIFoldingFilter(streams.tokenizer);
		   = new StandardFilter(;
		   = new LowerCaseFilter(;

		        } else {


	   private class SavedStreams {
	        Tokenizer tokenizer;
	        TokenStream stream;

	public TokenStream tokenStream(String feildName, Reader reader) {
		Tokenizer tokenizer = new StandardTokenizer(Version.LUCENE_29,reader);
		TokenStream stream = new ASCIIFoldingFilter(tokenizer);
		stream = new StandardFilter(stream);
        stream = new LowerCaseFilter(stream);

		return stream;

I’m using the standard StandardAnalyzer and the LowerCaseFliter along with the ASCIIFoldingFilter but you can add any TokenFilter you’d like. Oh and for the love of jebus make sure you put additional filters BEFORE the StandardAnalyzer.

Step 2 : Use your custom analyzer when creating the index:

IndexWriter writer = new IndexWriter(INDEX_DIR, new MyCustomAnalyzer(), true);
//insert standard index-building code here

Step 3 : use your custom analyzer when doing the search:

QueryParser parser = new MultiFieldQueryParser(new String[] {"title","description","keywords"}, new MyCustomAnalyzer());
//insert standard lucene search code here

And you are done!

Oh download icon on the dock….why are you so close to the Trash?

If you removed it here’s how to get it back just like new:

1) Open the finder, drag the download folder back to the dock where it used to be.

2) Ctrl-Click (right click) on the folder on the dock. Under “View Content As” click “Fan”. Under “Sory By” click “Date Added”. The “display as” should be set to stack but that should be done by default already.

There you go.

You want to setup ssh connections so you just search in spotlight for the name, hit enter and you’re logged in? Like the built-in terminal program that comes in OS X and don’t want to find/install some other ssh management tool? Well I did too and this this is how it’s done.

1) edit your ssh config file:

vi ~/.ssh/config

type this in:

Host myServ
Host myServ2
IdentityFile ~/keys/myfile.key

Host is just a nickname or alias for the connection, HostName is the actual hostname. And below that you can put any ssh configuration in for that host that you want. I use it mainly to include an identity file which is normally the -i argument when you ssh on the command line. All the configurations are listed here.

Now that you’ve setup all the params required to make the connection you should be able to ssh on the command line using the alias:

ssh myServ

2) Make a file that spotlight can find.

Open your favorite text editor and type this in ssh://username@alias:

Of course change the username, or just remove it if you want to be prompted for the username.

Now highlight that entire line and drag/drop it into a folder. That will create an inetloc file. Rename that file whatever you want (or leave the filename alone) and it’s now findable in spotlight, you hit enter and you’ll be automatically ssh’ed into your server.

You can use your Google Doc Spreadsheets just like a database with this jdbc driver I built. I just wrote it so it’s bound to have some problems as this point but check it out here:

If you are using XStream to turn your Java objects to XML you may need to make some of those field values within a CDATA tag.  Here’s how you do it.

When creating a new instance of the XStream object instead of this:

XStream xstream = new XStream();

Do this:

XStream xstream = new XStream(

	new XppDriver() {
	    public HierarchicalStreamWriter createWriter(Writer out) {
		return new PrettyPrintWriter(out) {
		    boolean cdata = false;
		    public void startNode(String name, Class clazz){
			super.startNode(name, clazz);
			cdata = (name.equals("description") || name.equals("name"));
		    protected void writeText(QuickWriter writer, String text) {
			if(cdata) {
			} else {

Note on line 9, I’m specifically wrapping the “name” and “description” fields in CDATA.  Just change this to whichever fields you need.

Recently I received an email from saying:

“The domain name (mydomain).COM expired recently and we were able to secure it.”

Also were instructions how to pay them $50 so they can transfer the domain to me.   They were correct that a .com version of a .org domain name I had was available.  They were lying that they had secured it.  That domain was freely available through any provider (godaddy,  1and1, etc) with no cost outside the basic <  $10 a year charge.

So if you get an email from these guys and you want that domain name just go directly to you’re preferred domain provider.

About this blog

Nothing that notable about this blog. It's just going to be a place where we post random stuff.


  • Arv: In else case it should invoke: super.writeText(writer, text); NOT writer.write(text); [...]
  • Chand: Hi could any one suggest, if few childs should be CDATA and dynamic value... How to get this with X [...]
  • Andrew: This is definitely a great start to the solution I need, but I need CDATA tags to be added dynamical [...]
  • Ed Moore: "solving by explaining" in Greek: επίλυση εξηγώντας . https://translate.googl [...]
  • original lipodrene: Can I simply just say what a comfort to find someone who genuinely knows what they're talking abou [...]