Adam Monsen

October 5, 2011

Link Checker Wishlist

Filed under: Default — Tags: , , , — adam @ 7:00 am PST

Link checkers spider through your website and make sure that links work. I want an awesome link checker. Ideally, it would espouse as many of these attributes as possible:

  • easy to learn
  • easy to configure/customize
    • example config: don’t hit URLs on other servers
  • sensible default behaviors
    • example: respects robots.txt and ‘nofollow’ link attributes
  • scriptable / embeddable
    • useful from command line
    • useful from within CI servers like Jenkins
  • recurses (parses HTML, follows links)
    • and smartly avoids checking the same pages twice
  • fast
  • thrifty with memory
  • pluggable
    • example plugin: run jslint on all JavaScript
    • example plugin: validate HTML 5
    • example plugin: validate CSS
    • example plugin: compute accessibility score
    • example plugin: JUnit XML output
    • example plugin: OpenDocument spreadsheet output
    • example plugin: Excel output
    • example plugin: CSV output
    • example plugin: JavaScript engine
    • example plugin: follow hashbang URLs
  • beautiful source code
  • FLOSS

September 19, 2011

offline HTML 5 validation

Filed under: Default — Tags: , , , , , — adam @ 11:05 am PST

HTML 5 logo

I’m liking Henri Sivonen’s Validator.nu service. I’ve got it running locally, and it works well. I can use it as a web service and validate HTML from within Vim, using quickfix to rapidly resolve errors. My Jenkins CI server uses the same validator via phpunit tests.

Warning: it took me a very long time to get it running locally. Technically easy (just run a build script), but it downloads tons of libraries and files before it can do its job.

July 26, 2011

Debugging web tests on remote servers

Filed under: Default — Tags: , , , — adam @ 8:01 am PST

I run “web tests” on a remote server. I use Selenium to act like a person interacting with a website, viewing and entering data. Selenium is pretty awesome, it can drive a real web browser like Firefox.

Even better is to have these web tests run automatically every time I commit code. I use Jenkins for this. Jenkins even fires up a headless desktop so Selenium can run Firefox.

When a web test breaks (especially in some way I can’t reproduce on my local desktop), sometimes it helps to actually see what Jenkins sees as it runs the test. Here’s a quick guide for doing so on an Ubuntu GNU/Linux server.

  1. Connect to the remote server using SSH. Install VNC server:
    sudo apt-get install vnc4-server
  2. On the remote server, become the user tests run as. For example:
    sudo su - ci
  3. Set a password for the VNC server using the vncpasswd command.
  4. Start headless X server by running vncserver. Note the given display. If example.com:1 is included in the output of vncserver, the display is :1.
  5. Figure out which port the VNC server is using. I usually do something like

    sudo netstat -nape | grep '^tcp.*LISTEN.*vnc.*'

    Here’s some example output:

    tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      107        3099855     13233/Xvnc4     
    tcp6       0      0 :::5901                 :::*                    LISTEN      107        3099858     13233/Xvnc4

    By trial and error, I figured out that 5901 was the port I should use.

  6. Port-forward VNC to your local machine.

    1. Disconnect from the server.
    2. Reconnect, including -L10000:localhost:5901 on your SSH command line.
    3. Leave this connection open.
  7. On your local machine, connect a VNC client to localhost:10000. An X terminal should be displayed.

  8. In the X terminal, run your web tests.

  9. When finished debugging, kill the X server using the display noted earlier.
    vncserver -kill :1

May 22, 2009

simple AJAX/JSP example: sum of two numbers

Filed under: Default — Tags: , , , , — adam @ 10:31 pm PST

It’s been a while since I’ve done any front-end Web programming, so when Eva proposed a friendly challenge to quickly create a simple AJAX calculator, I gladly accepted. It took her about 20 minutes on an ASP.NET stack, and took me… *cough* …a couple of hours using JSP.

The challenge was fun because I played with and gained respect for JQuery and the Eclipse WTP. I think it took me longer than Eva because I first looked for tiny AJAX examples in Ruby on Rails and Django. After a couple of aborted attempts, I decided to use JSP after finding this nice example.

I’m sharing my result since I wasn’t able to find one quite as succinct. You can throw the war file in a Tomcat “webapps” directory or import it into Eclipse (ideally the Java EE version with WTP) to hack it. The WTP even has a nifty HTML WYSIWYG design view.

February 28, 2009

Migrating from Github

Filed under: Default — Tags: , , , , — adam @ 12:32 pm PST

Github is an excellent service. Love it. No complaints.

However, it may come to pass someday that I need to migrate my code (and history/branches/tags/etc.) elsewhere.

If/when that time comes, gitosis sounds like a decent way to host a git repository. Nice!

May 1, 2008

Mayday Programming Brain Teaser

Filed under: Default — Tags: , , — adam @ 7:18 am PST

Thanks to Sam for the idea.

int k = 0;
k = k++;

After both lines execute, what is k equal to?

(more…)

January 31, 2008

Multitaskcraptastic

Filed under: Default — Tags: , , — adam @ 5:44 am PST

There are just too many shiny objects out there. Here’s how I ended up looking at some of the strangest C code I’ve ever seen.

  1. Started on the gslug mailing list, reading about a new keyboard layout. I continue to be drawn in to rumors that the QWERTY layout is a conspiracy to slow down typers, so hearing about a new keyboard layout called Colemak piqued my curiosity.
  2. Progressed quickly from colemak.com to the Wikipedia entry on Colemak. Cool, Colemak is supposed to be easier to switch to than Dvorak.
  3. The Colemak entry on Wikipedia mentions digraphs. I’ve heard of digraphs because I use them in Vim, but you can use them in C, too? Strange.
  4. The digraph entry on Wikipedia also mentions trigraphs. Trigraphs!

Sheesh. Interesting, but talk about distracting. I sure hope it isn’t true that multitasking kills your brain.

January 26, 2008

What’s wrong with the GNU autotools?

Filed under: Default — Tags: , , , — adam @ 2:39 pm PST

The GNU build system (aka Autotools) is/are too fricking hard to use. But I’m split… when the conventions of autotools are embraced, the product is quite portable. Though not very maintainable. Is it impossible to be infinitely adaptable and still be user friendly?

Ian Lance Taylor captures what’s wrong with autotools quite nicely. Ian says Cmake isn’t a suitable replacement, but perhaps it could evolve into one.

Here’s a nice comparison of several alternatives.

December 14, 2007

Elegant Lead Sheets are Back!

Filed under: Default — Tags: , , , , , — adam @ 6:17 am PST

As the holidays are fast approaching, many musicians will be called forth to back a multitude of sing-alongs. Be prepared! Musicians that care memorize or use sheet music, and nerdy musicians love Chordie!

Chordie turns text files with embedded chord names into beautiful, stafless PostScript lead sheets.

Chordie is a fork of Chord, and is written in under 5,000 lines of K&R C. Chordie currenly only runs on *NIX-like operating systems, but there may be ports to other operating systems someday.

UPDATE: Chordii is the new name for this project.

Powered by WordPress