Categories
Uncategorized

pruning your tree

This is from a mailing list post I’ve just replied to. Since I had to look it up, it’s worth blogging. ๐Ÿ™‚

It seems like a simple task. Find all the files in the current directory, excluding .svn directories. I’ve mocked up a simple layout.

% find .
.
./.svn
./.svn/README.txt
./README.txt
./src
./src/.svn
./src/.svn/foo.c
./src/foo.c

By default, find prints out everything. But we only want files.

% find . -type f
./.svn/README.txt
./README.txt
./src/.svn/foo.c
./src/foo.c

Now, we want to exclude everything under .svn. Easy.

% find . -name .svn -prune -type f

Ooops. That’s not good. What happened here? Well, the default for find is to and two expressions together. If we or it, we get what we want.

% find . -name .svn -prune -or -type f
./.svn
./README.txt
./src/.svn
./src/foo.c

Again, not so good. The problem is that default action to print everything. Because we’ve specified no action, it’ll print out each match, and that includes the .svn directories (even though it correctly stops going into them).

The answer is to provide an explicit action instead.

% find . -name .svn -prune -or -type f -print
./README.txt
./src/foo.c

This works, because now there is no default action, and the explicit action is only associated with the -type f predicate.

Categories
Uncategorized

jslint4java status

I’ve done a few releases of jslint4java whilst this blog has been down. We’re presently at 1.4.6. It’s mostly been bug fixes and JSLint upgrades.

What’s really interesting has been paying attention to the integrations that people have come up with. It’s never been easier to have lint-free JavaScript!

Sonar

If you use the sonar code quality tool, check out the javascript-plugin-for-sonar which uses jslint4java.

HudsonJenkins

The hudson violations plugin can display JSLint errors in your project. You still have to arrange to run jslint4java as part of your build though.

Emacs

Want to run JSLint inside Emacs? Have a look at this gist.

Gradle

Do you use gradle for your builds? kellyrob99 has produced a gradle-jslint-plugin.

Mercurial

Want to run JSLint automatically when using mercurial? Take a look at Running JSLint as Mercurial precommit hook.

Netbeans

Check out Integrating JSLint more tightly into NetBeans.

Maven

Whilst there’s a jslint4java maven plugin in the works, this stackoverflow post describes several ways of integrating JSLint with Maven.

Phonegap

If you’re doing Phonegap development, the latest version of the eclipse plugin comes with JSLint.

If you develop an open source project, then you really should set up a google alert for its name. You will be surprised.

What’s coming up?

  • Update to the latest JSLint (as always). Doug Crockford recently did a major rewrite. I think I’ve got that mostly integrated now, but not released.
  • There are a few outstanding bugs that I need to pay attention to.
  • I’ve also been working on my own jslint4java-eclipse plugin, which feels nearly complete enough to release.
  • Assuming I can ever figure out the integration testing, I’ll go back and finish off the jslint4java-maven-plugin.

Plenty to keep busy with!

Categories
Uncategorized

Tap Tap Tap

Hmmm, this has been off for a while, hasn’t it.

My server (previously hosted in spare bedroom) died. โ€œFine!โ€ says I. โ€œTo the free blog hosting!โ€ If only it were that simple.

After looking at wordpress, Blogger, Tumblr and Posterous, I realised none of them would allow me to retain my existing URLs. All because I originally chose to install at happygiraffe.net/blog. Silly me. The free providers allow you to put stuff at the root of a domain only. Plus other restrictions made the choice inappropriate. So, it’s back to hosted wordpress.

Anyway, after some initial shenanigans with getting the backup restored, this blog should be back in business. Sorry about the outage.

P.S. Yes, URLs are important. Jeremy is putting his money where his mouth is. I sincerely hope he doesn’t win.