March 19, 2010

I'd rather have a big solid bar of Dairy Milk.

There was an advert on TV last night for Disney DVDs. It described them as being 'perfect Easter gifts'. None of the movies mentioned were about religious persecution and/or nailing people to crosses, so presumably that's  'perfect' as in how come November everything from socks to 50" TVs is labelled as being the 'perfect' or 'ideal' Christmas gift.

It's not the first time I've heard something referred to as an 'Easter gift'. I once saw an advert by some board game manufactures describing it's products as 'easter gifts'. Over priced hollow egg shaped chocolate aside, since when did the concept of Easter gifts exist? It's as if some marketing people are so desperate to increase sales that they would like to see Easter turned in to the mindless orgy of commercialism that Christmas long ago became.


March 16, 2010

Now with CSS3 bits

Follow-up to Image gallery thing using ImageMagick polaroid operation from Mike's blag

Subsequent to creating the above linked, I discovered the CSS3 transform and box-shadow properties. (The W3.org site currently says this regarding box-shadow: "This feature has been removed from this module for further discussion, and should reappear in another CSS module (or a later version of this module) in the near future.") CSS3 is still a work in progress, so support varies and in the case of transform and box-shadow is done using vendor specific prefixes on the properties. E.g. Firefox supports box-shadow by way of -moz-box-shadow. Chrome supports it via -webkit-box-shadow, though Safari currently doesn't. Opera apparently supports it via -o-box-shadow as of 10.5, but I haven't tested it. Internet Explorer Explorer, unsurprisingly, doesn't support box-shadow and nor does it support transform, but all of the other aforementioned browsers do.

Anyway, two notable attributes of the thumbnails in my previous gallery example are that they are rotated and that they have a shadow. Which means I can do a version of that just uses CSS3 features. (HTML generation script)

Pros over the other version:

  • The area of the page that needs to be clicked to display a particular image matches the visible outline of the images.
  • Uses less bandwidth. The thumbnails are now done using one single jpeg image which is ~10KB rather than using two images totalling ~60KB
  • Much simpler. There's no Javascript used (though this might be necessary/desirable if I'd done the different colour border on mouse over for each image as I did in the other version). Thumbnails are created simply by creating a smaller version the original photo, which is a trivial operation.
  • More flexible. The white borders and the shadows are done with CSS rather than having been applied using ImageMagick prior to uploading, so they can be quickly altered without having to regenerate the thumbnails.


Cons:

  • Very varying results depending on browser.
  • The thumbnails don't quite look as nice. With the png version the thumbnails are not entirely flat, the ImageMagick polaroid operator puts a bit of curve on them. Firefox on Linux does a distressingly poor job of rotating the images, they look far worse than they do in Firefox on Mac OS X. I've been unable to find any discussion on this discrepancy in quality. (Mac screengrab. Linux screengrab.)

March 14, 2010

Image gallery thing using ImageMagick polaroid operation

Writing about web page http://go.warwick.ac.uk/mikewillis/polaroidgallery/gallery.html

I used to tinker with HTML/CSS/Javascript a lot. I've done very little of this over the last [indeterminate period of time]. Then a few days ago whilst tinkering with ImageMagick I had an idea for a potentially pleasing method of presenting photos on a web page. The somewhat rough implementation of the idea is linked above.

All photos are taken from the University Media Library. Display of the large versions of the photos is handled by Lightbox2 (as seems to be very much the fashion these days). Bash script used to generate images and to generate the HTML.

Bad things about the gallery:

  • Because (alpha) transparency is required the thumbnails are png rather than jpeg. This means the file sizes of the thumbnails are rather large at ~60KB each including the overlay image that is used when the mouse is over the image to change the border colour. This isn't that big a problem I guess given the speeds of most people's Internet connection these days, but the part of my mind that remembers when 56k dial up was the norm keeps telling me that each image would take a minimum of ~12 seconds to load over such a connection. There are various programmes that will reduce the file size of a png a bit, e.g.optipng (in Ubuntu and openSUSE repos), and the most effective one I found, pngout. I could only get a reduction of a few percent, though some people claim to have got higher. I guess it depends on the png. I'd already told ImageMagick to strip out profiles when creating them.
  • The area of the page that needs to be clicked to display a particular image does not exactly correspond with the visible outline of the image. The area that needs to be clicked for any given image is rectangular because of course the images themselves are rectangular, but the use of transparency means they don't look rectangular. This could be solved using an imagemap, but it would only work if you collated all the pngs in to one big image and then mapped that. Otherwise parts of an image's map would be obscured by the image to the right. Collating all the images in to one big one would be a bad idea for various reasons (e.g. load time, lack of adaptation to different window widths).


Notable/Nice things about the gallery:

  • The images used to cause the border colour to change when the mouse is over a thumbnail are not merely the same image but with a different border colour. The image is generated twice, once with the white border, once with the other colour. The second image then has most of the actual photo replaced with a transparent rectangle. (Example) This reduces the file size by roughly a third.
  • The colour the border is changed to for a given image is determined by reducing the colours in the image to just one then inverting that colour. I found this gives a more pleasing effect that using the same colour for each photo. It also avoids the need to expend effort on finding a single colour that looks generally pleasing for all photos.
  • Because each photo is an individual element, they automatically flow to fill the available space. (Try resizing the browser window whilst viewing the page.)
  • Because the thumbnail images are pngs with transparency, you can stick any background you want behind them.



March 01, 2010

Staring at the

Writing about web page http://sohowww.nascom.nasa.gov/data/realtime-images.html

SOHO image wallpaper script grabs one or all of the latest SOHO images once an hour and sets it/them as your GNOME wallpaper. I was going to make it work for Mac OS X as well but by the time I'd found out how to set the relevant properties from a script I couldn't be bothered. (Mac OS X doesn't provide a way to set the background colour or the placement  (introduced in Snow Leopard) from a script. You have to alter the plist file and then restart the Dock as described here.)

Example screenshots:

$ ./soho_image_wallpaper

SOHO image wallpaper (all)

$ ./soho_image_wallpaper blue zoom

SOHO image wallpaper (blue zoom)


February 25, 2010

Dressed like a pumpkin.

Mildly concerning things to hear a three year old in another room say, number one;

Uncle Mike! Uncle Mike! Where did all this water come from?


February 22, 2010

Citrix ICA Client seamless windows vs Compiz

If you've ever tried using the Citrix ICA Client with seamless windows whilst using Compiz, you've probably discovered the problem where the Citrix ICA Client window disappears if you switch workspaces. (See Google.) It's one of those annoying problems that has been around for a time span that can be measured in years, through multiple versions of the software involved with no sign of anyone fixing it. It appears to be one of those standoff situations where the people responsible for each piece of software think the problem is caused by a bug in the other piece of software and hence it's not them who need to fix it.

The best solution I've been able to find suggested is to switch to Metacity (or to word it a different way, disable desktop effects). This is a rather annoying workaround though. The client doesn't work with the window manager that you use all the time? Oh well, just switch to a different window manager when you want to run it. Yeah... If you're still reading you'll probably be interested to know that I've found a workaround that doesn't involve simply not using Compiz. Two actually. I'll start with the one I like best. (Tested on SLED 11 and openSUSE 11.2)

Workaround 1: Make the Citrix ICA Client window visible on all workspaces.

Right click on the Citrix ICA Client window's entry in the taskbar and select 'Always on Visible Workspace'. The downside of this is that the window is of course that the window is always on your current workspace, but you can get it out of the way by minimising it.

To save yourself having to manually set that on each Citrix window you can set up a Compiz rule that does it automatically:

  • Run ccsm (not installed in Ubuntu by default but it's in the repos)
  • Select Window Management
  • Enable Window Rules and open it
  • In the field marked Stick enter 'class=Wfica_Seamless' (without the quotes)

If you want to enable this by default for all users of a machine or machines, then you can do so using this script.

#!/bin/bash
# implements workaround for citrix client windows vanishing when
# you switch workareas in compiz by setting such windows
# to be visible on all desktops by default.
# not ideal, but better than the windows vanishing
# requires xmlstarlet

# add a rule that makes windows of the relevant class 'Sticky'
tempfile=$(mktemp);
filetomod=/usr/share/compiz/winrules.xml
xml ed -u "/compiz/plugin[@name='winrules']/screen/group/option[@name='sticky_match']/default" -v 'class=Wfica_Seamless'  $filetomod > $tempfile && cat $tempfile > $filetomod
# using cat ensures permisisons on $filetomod are not changed
rm -f $tempfile;

# ensure that the window rules plugin is enabled by default
filetomod=/usr/share/compizconfig/global.xml;
plugintoadd="winrules"
# if winrule is already in the list then don't need to add it, so exit
if [ -n "$(grep "<value>${plugintoadd}</value>"  ${filetomod})" ];then
exit 0;
fi
tempfile=$(mktemp);
xml ed -i "/compiz/core/display/option[@name='active_plugins']/default/value[1]" -t elem -n value -v $plugintoadd $filetomod > $tempfile && cat $tempfile > $filetomod
rm -f $tempfile;

XML file manipulation is done using XMLStarlet because I still haven't got around to learning Perl. (XMLStarlet is not installed on Ubuntu by default but it's in the repos, it's not included in SLED 11 but included in the SLE-SDK).

Note that the changes the script makes may be over-written by a compiz update. You could run the script during boot and/or shutdown or whatever suits your set up to ensure the modifications remain in place. Also note that the modification that adds winrules to the default list of active plugins will not affect any users that already have compiz configuration in the home directory (~/.config/compiz). This is because the config compiz writes to the user's home directory includes a list of active plugins which then takes precedence over the global list.

Workaround 2: Set a Size Rule

I don't like this workaround, but someone else might. Whilst reading up on the problem I found a reference to it being cause by the reported width/height of the Citrix ICA Client window. I forget where I saw this and am too lazy to go looking for it. This led me to wonder if the problem could be worked around by somehow setting a width/height that Compiz doesn't choke on.

  • Run ccsm
  • Select Window Management
  • Enable Window Rules and open it
  • Click on the 'Size rules' tab
  • Click 'New'
  • In the Sized Windows field enter 'class=Wfica_Seamless' (without the quotes)
  • Set Width and Height to some suitable positive values

This will force a width/height upon the Citrix ICA Client window. The downside is that you can't re-size the windows, but the upside is that you can leave the window on one workspace.


February 17, 2010

SeeSaw (see what they did there?)

Writing about web page http://www.seesaw.com/

So apparently this new website called SeeSaw has just gone live. Think of the BBC iPlayer website but with programmes from Channel Four and Five as well and with entire series of stuff that hasn't been shown on TV recently available. Oh and with adverts before the programmes. There's no mention of ITV, though Kingdom is listed, which I've never seen but know was shown on ITV.

It looks pretty good. It uses Flash so it's multi browser/platform friendly. I had to disable AdBlock to get it to work though. Here's some words someone at the BBC wrote about it.


February 11, 2010

Article about Facebook logins confuses stunningly stupid people.

Writing about web page http://www.readwriteweb.com/archives/facebook_wants_to_be_your_one_true_login.php

Someone publishes an article that has the words 'Facebook' and 'login' in the title. People find the article and despite the glaringly obvious indications that it isn't, are apparently under the impression that it is the Facebook login page. The site the article is on allows comments to be posted using Facebook credentials so the article acquires lots of comments from people complaining about the new Facebook login page.

It's stuff like this that makes the future as portrayed in Idiocracy seem plausible.


February 07, 2010

synchronicity (maybe)

Today I got in my car, put a CD in and went somewhere. Just now as I pulled up outside my house, the CD ended. This has happened a few times before with different CDs and destinations. It's oddly pleasing and when it happens I find myself briefly wondering what the odds of it happening are. But only briefly.

Today the music was the Uptime part of Uptime/Downtime by The Kleptones. Get it, it's free so you might as well. Get 24 Hours too whilst you're there, it's very good. The destination was friends, one of whom had made delicious rainbow cake for my pseudo-niece's third birthday.

Rainbow Cake is rainbowlicious.


February 05, 2010

Finding the path of a Firefox profile

The other day I found myself needing to be able to determine the path of a user's Firefox profile. It was one of those tasks that seemed very simple to start with but then got more complicated the more I thought about it. Some people have more than one Firefox profile. So it needs to be determined which one is the default, which requires working it out by looking at the user's profiles.ini file. profiles.ini may contain details of one or more profiles. If it contains details of more than one profile one of them will be marked as the default, but if there is only details of one profile it won't be marked as the default. If a profile is marked as default then the line which marks it as default isn't always in the same place in relation to the other information about the profile. The path to the profile that appears in profiles.ini might be relative to the location of profiles.ini, or it might not be. In the end I realised that rather than it being a case of writing a couple of lines in the script I was writing, it was a task best suited to being broken out in to a separate script which I can re-use in future.

Anyway, in the admittedly unlikely event that you've been looking for a way to find the path to a user's Firefox profile, here's a Script to find path of default or specified Firefox profile. It's written for Linux. It will probably work on other *nix systems (e.g. Mac OS X) by changing the value of $firefoxprofiledir and maybe making a few other tweaks.


Search this blog

Tags

RSS2.0 Atom
Not signed in
Sign in

Powered by BlogBuilder
© MMXXIV