Category Archives: Geek

New side project

I had an idea for a website over the Christmas holiday, took a few hours over a few days and got some proof of concept code up and running. I bought a domain for it, and am now making it robust to handle some traffic. Today I played around with MongoDB and got it up and running and it works great. I’ll be hosting it on OpenShift (for now anyway). I’m hoping to launch the site later this month.

In the meantime, if you use Goodreads and Overdrive, let me know if you want to be a beta tester.

Apache Directory API with Active Directory and ObjectGUID

Recently I needed to access an Active Directory server via Java and get some info out of it. After poking around, I decided to see if I could use the Apache Directory API to get the job done. I hit some problems pretty quick because some of their docs out of date. The docs are unclear as to how to do the bind and I couldn’t figure out the magic incantation to get it to connect/bind until I did it this way:

1
2
3
4
5
6
7
8
9
10
11
12
  LdapConnection connection = new LdapNetworkConnection(SERVER, PORT);
  connection.setTimeOut(0);
 
  BindRequestImpl request = new BindRequestImpl();
  request.setName(USERNAME);
  request.setCredentials(PASSWORD);        
  BindResponse response = connection.bind(request);
 
  if (!connection.isAuthenticated()) {
      System.out.println("Failed to connect/authenticate");
      return;
  }

Continue reading

Using ant to exec mysql .sql files via a fileset

In trying to automate our DB development, we decided to use ant and Jenkins to run our SQL scripts for a deploy. We had a hard time getting ant to work and after much trial and error (and cussing and fussing) we finally got it to work. The key really was the addsourcefile=”false” attribute and the redirector. Since mysql can run sql from a file using redirection (< ) you have to use a redirector (which is poorly documented). The ant apply task can apply an executable to every file in a fileset, so this will use the mysql executable to exec every *.sql file it finds. Continue reading