Everything written by "Bryan J Swift":

2007-12-31 01:43:16

Posting By Committing: An Experiment

September 22, 2008

After seeing a post on the github blog about David Baldwin using github as his blog I got to thinking about how much easier it would be to create my markdown posts offline and then commit them to some repository and have them show up as blog entries.

The comments for the github entry point out a number of people using various solutions to achieve an effect similar to what I want however I am somewhat loathe to give up on a web interface in general and Wordpress in particular. But this did get me thinking, what about a post-commit hook so after every commit a script examines the changed files and creates or edits posts as necessary. Google didn’t turn up much of anything in the way of making this happen and so I started thinking about how I would write my own solution.

As of right now I’m just in the planning stages but I did realize it would have to be a pre-commit hook on account of wanting to track the post id somewhere and the most logical place seems to be as some meta information at the top of the post. Currently I have the pre-commit hook reading the information I need to send about the post out of the file, the next step will be to figure out creating an XML object to send to the xmlrpc.php file of my Wordpress installation. In addition to dealing with hooks and xmlrpc1 I’m writing the script using Perl in order to get some hands on experience with it.

I’ll admit I’m not 100% sure I can make the script do what I want it to do but I’m certainly going to give it a shot because looking at the solutions eluded to in the comments of the post on github there doesn’t look to be a solution to satisfy me yet.

My initial planning has the username, password and xmlrpc url being stored as config options via git config username|password|xmlrpc while post related information is stored in the actual post file. I think the most likely hang up will be modifying the file which is about to be committed (by adding the post id) because I believe I’d actually have to create the post via xmlrpc, write the response into the file, stop the commit, add the post file back to the index and re-commit. There may also be a problem with the way xmlrpc expects the categories.2 Time will tell.

  1. which I’d never done before 

  2. xmlrpc wants category ids rather than category names 

Toilet Paper Researchers

September 18, 2008

Finding things like an article about toilet paper research is part of what I love about twitter. I don’t spend enough time reading news, off-beat or otherwise, and twitter tends to point me at articles I would otherwise never see. This gem is courtesy of a tweet by Dan Cederholm.

If two-ply toilet paper is good, then three-ply tissue must be better. At least that’s what toilet-paper researchers in northeastern Wisconsin hope.

Thanks Dan.

Transparent PNGs in IE6 Without JavaScript

September 18, 2008

Most people developing complex designs for the web are making use of transparent 32-bit PNG images which are fantastic and beautiful and crisp in every modern browser. Sadly not all browsers in wide use are modern, namely Internet Explorer 6. In order to make transparency work in IE6 there are a number of JavaScript solutions available which generally work wonderfully well. However I recently had need to support a page in IE6 whose designs required transparent PNGs but for circumstances beyond my control did not permit me to use JavaScript at all.

After some consideration I had a realization, I didn’t need my CSS to validate either. Since I was able to use invalid CSS I could make use of some dirty hacks in order to achieve my goal. The trick was that none of the images could be inline, so they were all implemented as background images. For each element which had a background image which was a transparent PNG I set the background image normally and then in the IE6 hack changed the background image to a blank.gif1 and then set the proprietary filter property the the element. The code ended up looking something what is shown below and it worked like a charm under these admittedly narrow circumstances.

#selectorId {
	background: url(/path/to/image.png) top left no-repeat;
	_background-image: url(/path/to/blank.gif);
	_filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src="/path/to/image.png", sizingMethod="scale");
}
  1. a 1 pixel transparent image