Feed on
Posts
Comments

I recently needed to move a very simple ASP site to Apache for archival purposes. There was nothing of importance that the dynamic ASP was doing and as it was just for an archive, it made the most sense to turn it into simple HTML (as the whole site probably should have been in the first place). All of this was easy enough with wget -m, etc. but I came across one major stumbling block.

The files mirrored from the original site had a question mark in the file name due to them being queries and the fact that Unix supports question marks in file names. This wasn’t a problem for most modern browsers as they encode the question mark before doing the request and Apache happily serves up the file. After doing a test migration of the site I noticed heaps of 404s coming from visitors to the site via search engines.

I got around this with some painful mod_rewrite hacking:

RewriteEngine On
RewriteCond %{QUERY_STRING} .
RewriteCond %{REQUEST_FILENAME} \.asp$
RewriteRule ^(.*)$ http://example.com$1\%3F%{QUERY_STRING}? [NE]

In semi-human-speak:

  • Turn the mod_rewrite engine on
  • Look for queries that have a query string (i.e. a ? and anything after it)
  • And where the filename requested is a .asp file
  • Rewrite the whole request to http://example.com
    • Then the original request (sans query string)
    • Then %3F (question mark encoded)
    • Then the query string and make sure there’s no other query string appended (the ? at the end)
    • Also, don’t encode the stuff we’re throwing back to the client (the [NE])

I wanted to convert some high resolution TIFFs that Lisa took of Bill’s paintings recently and came up with this quick and dirty conversion into JPEG:

for i in *.tif; do tifftopnm "$i" | pnmtojpeg > "${i%.tif}.jpeg"; done

That’ll convert all .tif files in a directory to JPEG (using default processing setting).

I didn’t have exiftool installed, and no internerd or media to install it from, otherwise I would’ve looked at doing the metadata too.

I’ve had Evolution hang on start up a few times lately, I keep forgetting what I’ve done to fix it so I’m noting it here. All I’ve needed to do is to kill evolution-data-server and try to start Evolution again, so to fix this issue:

killall evolution-data-server-2.28

Apple Remote Desktop allows you to graphically administer remote OS X machines, including OS X Server. Apple uses some custom encryption over the top of the standard VNC protocol so if you are connecting from a Linux client using vncviewer you’ll get the following error message:

Server did not offer supported security type

To set the Apple Remote Desktop server to use “legacy” VNC mode (i.e. unencrypted passwords), you can SSH into the server (if it’s remote) and execute the following command:

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate -configure -access -on -restart -agent -privs -all -clientopts -setvnclegacy -vnclegacy -yes -setvncpw -vncpw somesecretpassword

Remember that you’re now using VNC in it’s normal mode where passwords are transmitted across the wire in plaintext so if the network you’re connecting across is untrusted, tunnel the connection using SSH or similar.

v0.0.5

I’ve created another incremental build of OpenAustralia DevLive. Version 0.0.5 simply makes the web application’s directory the twfy git source tree so you can now use the source control features of git (like resetting after making changes).

You can download the 429 MB VMWare image from SUSE Studio for the next week or so (let me know if you want it after this as I may have to initiate a rebuild to make the download available again).

Git Repository

All of the files used to create OpenAustralia DevLive are now hosted in a GitHub repository so you can now build your own if you’d like.

As a proof of concept, yesterday I moved our Confluence installation to Solaris under VMWare from it’s current home on a Linux box. I won’t go into the background as to why I was doing this (most people would be shocked hearing I would move anything from Linux!) but the reason it was a proof of concept was the fact that Confluence isn’t officially supported under VMWare.

A few points:

  • There are lots of Solaris things I don’t like after coming from Linux. Packaging first, and the tools it ships with (I want GNU grep and tar, dammit!)
  • To allow an unprivileged user (our confluence user in this case) to bind to privileged ports (i.e. TCP < 1024), run this as root with the user logged out usermod -K defaultpriv=basic,net_privaddr confluence
  • Use prstat, not top on Solaris
  • When Atlassian says don’t use Solaris’ version of tar, they mean it. I spent about half an hour debugging only to find that Solaris had untarred the file incorrectly. Grrr.
  • I love open formats and the *nix way. I did a mysqldump from our old server and found that our DB tables were using the MyISAM engine (not recommended by Atlassian), so I switched to InnoDB by a simple, quick sed through the dump. Brilliant. I love it.
  • To stress test the application after the move I used siege, which worked a treat. It’s probably packaged for your Linux distro too

Confluence seems to be running fine on the new VM and withstood my siege, it’s only small (50 MB) so that might be a factor but it’s worth testing if you need to make this move yourself.

The new version of OpenAustralia DevLive is now available. Version 0.0.4 adds search functionality so you can test and hack on search related features and bugs.

After the appliance boots, build the search index by opening a terminal and running:

/srv/www/openaustralia/twfy/search/index.pl openaustralia daterange 2007-09-19 2007-09-21

The 416 MB VMWare image can be downloaded from SUSE Studio for the next week or so. If you have any issues downloading or using the appliance, please leave a comment.

It was harder than it should have been to find the URL to use for the OpenID provided by your Google Account, so for future reference, enter this in the address box of OpenID enabled sites:

https://www.google.com/accounts/o8/id

I’m running a proof of concept at work of the Google Search Appliance (GSA). Work’s very much a Microsoft Windows shop and for the demo I wanted the SMB search results to link to the files on the SMB share, not the GSA proxy that is the default.

You can hack this with this small change to the XLST, a git-diff as follows:

diff --git a/gsa-original b/gsa-smb
index ba1c66f..73751ab 100644
--- a/gsa-original
+++ b/gsa-smb
@@ -2680,8 +2680,7 @@ for (var j = 1; j &lt; p.length; j++) { url += "&amp;" + p[j]; }}
</xsl:when>

<xsl:when test="$protocol='nfs' or $protocol='smb'">
- <xsl:value-of disable-output-escaping='yes'
- select="concat($protocol,'/',$temp_url)"/>
+ <xsl:value-of disable-output-escaping='yes' select="concat('file://', substring-after(U, '://'))"/>
</xsl:when>
<xsl:when test="$protocol='unc'">
<xsl:value-of disable-output-escaping='yes' select="concat('file://', $display_url2)"/>

Now, after you collect your jaw from the floor when you realise that this will create URLs like file://servername/path/to/file, please remind yourself of the earlier caveats of hack and Windows. This actually took longer that it should have to debug as Firefox on Linux isn’t insane enough to make this work.

If the POC works out and we decided to go ahead with the GSA use, I’d be searching for something a bit more robust (and if I’m working on it, I’ll share the details of what we decide to do!).

mySociety, the people that originally built TheyWorkForYou, which OpenAustralia was built from, are running a call for proposals for ideas for new projects or features for mySociety to work on. These are my favourite ideas so far, in no particular order:

The People’s Think Tank – I find this idea interesting considering this week’s stoush between the government and opposition on their different climate crisis policy proposals. The treatment from both parties of each other’s policies has been pretty brutal and it struck me as very non-constructive. With this idea, you could potentially mash up the proposals and crowd-source the development of the policy.

Me MP – I like this idea for the same reason as a lot of local government 2.0 ideas – that you generally want to do the same basic things and reinventing the wheel is wasteful. This idea applies that principle to running for office and has the potential to disrupt the two-party system.

Where Does It Go – I don’t have a comprehensive idea of where public money goes, do you? I see this proposal as applying to the budget, what OpenAustralia applies to the Hansard.

AreTheyOnTime – Crowd-sourcing public transport running times, there’s not much to say on this one – Sydney-siders would love it! If it was able to kick off, this could be really interesting in a real-time information kind of way – i.e. you could find out pretty accurately how late the service you were waiting for was going to be (could also be applied to buses). That is until we finally get GPS tracking, a al Auckland.

Hear Hear – This sounds like a quick, simple system for the government to get feedback on ideas. It could become a focal point for the ‘good’ and ‘bad’ ideas of the moment.

Now, what say you?

Older Posts »