The case of the failing ant copy filterset

I wanted to set a couple of Windows environment variables from Ant. The environment key-value pairs are stored on the HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment key in the registry. As a starting point I used the registry editor to export all keys. I called the file environment.reg.template and modified it to look something like this:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment]
"BAR"="@[email protected]"

My ant script contains something like this:

<copy file="environment.reg.template" tofile="environment.reg"
    <filter token="FOO" value="${foo}"/>
    <filter token="BAR" value="${bar}"/>
<exec executable="regedit.exe">
  <arg value="/s"/><!-- "silent" -->
  <arg value="environment.reg"/>

I ran the ant script and looked in environment.reg. It still looked just like environment.reg.template! Running again obviously didn’t work, but I had to try! 🙂 When did a cut & paste of the above and sent to a colleague he could not reproduce the issue. I thought hard about it and then it dawned on me: the registry editor exported a file in Unicode format. I used notepad to convert it to ANSI and then everything worked fine. Case closed.

Making a demo login with restful_authentication

In order for someone to give The Project (Min Packning) a try it was required to register an account and provide a valid e-mail address. This is an obstacle, so I wanted to add a way for people to try the service without registering. It was actually very easy. I created a demo user account, added a demo method to SessionsController and added suitable routing. Now visiting will give a logged in session as the demo user.

In app/controllers/sessions_controller.rb:

  def demo
    params[:login] = 'demologin'
    params[:password] = 'demopassword'

In config/routes.rb:

  map.demo '/demo', :controller => 'sessions', :action => 'demo'

referer: junomsg://

My web server examines the the referer to deny deep linking to images on my sites, so I get log messages about that. When I browsed the logs today a few of those log lines caught my eye. They looked like this:

client denied by server configuration: /directory/image, referer: junomsg://028985E8/

(I replaced the filesystem path to the image with /directory/image.)

What kind of protocol is junomsg? I did some research and it seems like this comes from the “Juno offline email client”. Someone probably received a link to my site by mail and the offline client seems to run in Internet Explorer. Case closed.