Posts

  • Migrating an ASP site to a static Apache site

    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])
  • Convert TIFF to JPEG on Linux

    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.

  • Evolution Hangs on Startup

    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

  • Connecting to Apple Remote Desktop on Linux

    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.

  • OpenAustralia DevLive 0.0.5 and Git Repository

    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.

subscribe via RSS