Eric TF Bat's Journal

It's People Like You What Causes Unrest

Lazyweb: Batch Image Processing
the-dark-batpup-returns
[info]etfb
I have a bunch of photos I'd like to post on my website, but I need to make thumbnails. Obviously I don't want to have to do each one manually; I'd like a command-line utility that will do image conversions for me. As a benchmark, I'd like something to do this:

Given an image file in some format, say JPEG or Windows Bitmap...
Resize it using some kind of smooth scale algorithm so that the height is no more than 120 pixels and the width is no more than 100 pixels, maintaining the original aspect ratio...
Place a grey 50% opaque watermark bar at the bottom, with my name in black 6 point Verdana, right-aligned...
Put a 1 pixel black border around the outside...
Resize the canvas to 128 pixels square, transparent, with the bordered image centred on that...
Put a semi-opaque black shadow of some sort on the image...
Save as a PNG in a directory called thumb, relative to the file's original directory.

Anyone know of a tool that can do all that in batch mode? For reference, here's a typical result, done by hand (though the shadow isn't what I was hoping for, but it will do):

Tags:

Pythonistas! Lazyweb Wants YOU!
the-dark-batpup-returns
[info]etfb
Working on debugging [info]boutell's Tags From 10,000 Feet, the unwieldily-named but relatively simple LJ tagging program that seems to stop working once you reach a certain unstated limit of entries and tags. Unfortunately, I don't have the idiomatic knowledge of Python 2.x to allow me to be maximally efficient, so I'm working gingerly, making changes in small steps and hoping not to mess anything up. If there are any Python experts around, feel free to comment to answer any or all of the following questions:

Questions hidden to save boredom for the rest of you )

LazyWeb: Illicit Photographers?
the-dark-batpup-returns
[info]etfb

You read about people in third world countries being arrested and harassed for taking photos all the time but I haven't heard anything about the legal situation in Oz. So: photographers, and people who know the law: what's the legal situation in Australia for the following?

  1. Alice stands on a public footpath and takes a photo of Ben, who is an ordinary civilian, without asking Ben's permission first or offering him an opportunity to review the photo before it gets printed or published.
  2. Charles stands on a public footpath and takes a photo of Constable Dawn, who is an on-duty police officer walking on that same footpath.
  3. Ellen stands on a public footpath and takes a photo of Constable Fred, who is at that moment standing beside a car that he evidently just stopped for speeding. The driver, George, is not visible from Ellen's vantage point.
  4. Harry stands in a shopping mall and takes a photo of a part of the mall in the general thoroughfare of the mall, say the (unattended) information desk.
  5. Iris stands in a shopping mall and takes a photo of Jim, who is standing in a shop, say a Starbucks, inside the mall.
  6. Kevin stands on a public footpath and takes a photo of a government office's front door, including a clear view of Lisa, a public servant who is entering the building.
  7. Mary stands on a public footpath and takes a photo of a government office's front door, including a clear view of Neal, a security guard at the government office's reception desk.
  8. Oliver stands on a public footpath and takes a photo of a military installation, say a Navy ship in dock.

My belief is that in none of those cases should anyone have the right to demand that any of the photographers surrender their camera, erase their photos or come down to the station for questioning. But I know that at least some of these may be grey areas (the shopping mall stuff, for a start) so I wonder if anyone has any links or knowledge to clarify.

Note: I'm not intending to do any of this; I'm just curious.


When The Going Gets Tough, The Tough Get Blogging?
ping-my-cheese
[info]etfb
My Beloved made an interesting point tonight. A friend of ours got some unexpected attention on his non-LJ blog when he ranted about a particularly clueless doctor and a bunch of mundanes wandered past and proceeded to side with the doctor over him. My Beloved commented to the effect that, if you blog, sooner or later you attract the attention of total futtocks who seem to forget that they're dealing with human beings. And therefore, she opined, the only people who can stand to blog for any length of time are the ones with really, really thick skins.

I, obviously, am one of these.

So, opening it up to the Galleria della Peanutti: what do you say? Is it possible to put yourself out there on teh intarwobs and blog in public without developing a hide like a Kryptonian hippopotamus? Or does the endless tide of drivel eventually lead all but the real thickies (like me) to hang up their keyboards and go do something less confrontational? Is it possible to get criticised, unfairly or otherwise, on a blog without wanting to go hide in a cupboard? Can one disconnect one's perception of humanity from one's experience with the limited subset who spew their alphanumeric pukery onto one's text boxes? Or does the sheer volume of cluelessness turn everyone away in the end?

What say you?
Tags: ,

Have You Seen This Curtain?
the-dark-batpup-returns
[info]etfb
Help me demonstrate teh powerz of teh intarwebz here, people.

We popped in to Spotlight and picked up some curtains to finish our de-horribilization of The Bestiary. Unfortunately, the ones we got for the master bedroom are a little too good: they match perfectly, they look spectacular... but we only got five of them, and we need six. Spotlight in Queanbeyan didn't have any more, but perhaps some of you can help. If you chance to be popping in to your local Spotlight in the next little while, can you keep an eye out for one of these curtains? The package says it's "made exclusively in China for SPOTLIGHT" so don't bother if your local fabric shop is a Lincraft or whatever.

The package is shown here, with a close-up of the pattern, adjusted to get it as close as I can manage to the real colour. It's "La Scala" brand, a "Button Tab Top Curtain", 145x170cm including tabs (although if you can only find the other size, 140x225, that's fine, since we'll be hemming and adjusting it anyway). The bar code bears the highly informative code number 321748-108980, "Key 15".

If you find one, buy it immediately, then let either of us know. We'll cover the cost and the postage.

Thanks, y'all!

Lazyweb: Editing Video Files
the-dark-batpup-returns
[info]etfb
Hey, Lazyweb! Especially the Linuxy bits of the Lazyweb! I have a problem, and I demand that you fix it free of charge because that's what free s0ftwarez is all about, rite!!!!1!!!eleventyone!!!

Ahem

I have a bunch of AVI (video) files containing cartoons. Each one has about half a dozen eight-or-nine minute episodes plus, in many cases, a long advertisement for similar kiddystuff at the end. I want to chop them into individual files, one per episode, discarding the ads. Also, in some cases the tracking is off, so the sound and picture are out of synch by as much as three seconds, so I'd like something that will let me adjust this to work properly.

Any suggestions? I don't have access to a MacOS machine, so it will have to be Linux or, in a pinch, Windows.

RSS Feeds
the-dark-batpup-returns
[info]etfb
A HOWTO and a question.

I used to have a bunch of blogs stored in my del.icio.us account, with a link on my Firefox toolbar so I could load them all in one go and read them. Unfortunately, the toolbar's RSS menus maxed out at ten or twelve items, so I couldn't keep very many in there before it started dropping some off. About a year ago then, I took [info]thelancrewitch's advice and started used RSS feeds instead.

The easy way to use RSS is to set your home page to iGoogle. Go to Google, click the iGoogle link at the top, then click Sign In. Make yourself a GMail account if you're the last person in civilisation to still not have one. Now you'll be presented with your new Google homepage. Make that your default page (in Firefox on Windows it's Tools | Options | Main | Use Current Page; in Firefox on Linux it's Edit | Preferences | Main | Use Current Page; Gods know what it is in Safari or Opera; and nobody uses Internet Explorer so I won't bother telling you how to do it there). Now click the close boxes on the default set of widgets on your page, and go to Add Stuff to add new ones. The one you particularly want is Google Reader. Type it into the search (what did you expect - a directory? This is Google!) and click the Add It Now button.

Now you're ready to add feeds. Go to each of your favourite blogs, and click the orange RSS logo that appears either on the page or on your address bar. Follow the prompts to add it to Google Reader (note: not Add To Google Homepage; it does the wrong thing). Once you get to the Google Reader interface, just shut it and move on to your next blog; rinse, repeat. You can worry about categorising into groups later, if ever.

Now, when you want to keep up with your blogs, open your default page. All the latest entries are there: you can read them in a popup window on the Google page, or click the links to see them in their original form. Much more efficient, and you don't have to weed out the people who don't post regularly, because Out Of Sight is Out Of Mind.


So it's good. Much more efficient. I have a hundred subscriptions, apparently, and they're all easy to manage. My question is this: what shall I add to my list? Are there any blogs out there that people like and think I might like too? I can't see an easy way to publish my current subs so you can skim them, but that's OK: this is partly to get new stuff to read, and partly to see what people think I might like. If you happen to guess ones I already have, that's bonus clever points for you...

Edit: [info]smangesable suggested NetVibes instead of Google Reader, and I have to say it looks like a winner. If iGoogle gives you the steaming irrits, check out NetVibes, because it seems to be a clone that's an actual improvement. More as I examine further... tomorrow!
Tags: ,

Python PDF Generation Libraries? Anyone? Anyone?
the-dark-batpup-returns
[info]etfb

As part of my ongoing efforts to stave off living in a cardboard box in the middle of a lake, I took on a project for a friend and former cow-orker last year, to produce PDF files from a database for a client. I did it in PHP, because that was the only tool available that looked like it might work, but I now regret it. Apparently, when it tries to generate the whole 400-odd page on the friend's server, it crashes Apache and the whole server needs to be rebooted (!). Even running on my laptop causes interesting side-effects, often requiring a Level Two Diagnostic*. I suspect the third-party library really isn't up to the sort of contortions I put it through, sadly.

So I'm looking for an alternative. Mr Death, the aforementioned friend, has control over the server, so he can install whatever I need, but I really should try to stick with languages that other people know. That and the Linuxness of the system mean no Delphi, no Common Lisp and no hand-coded PostScript. My best bet is probably Python. So if any Pythonistas out there can recommend a good, fast, open-source PDF generation library for Python, please let me know. The features it needs, in increasing order of trickiness, are:

  1. Scaled images in the text
  2. Table-based layouts in some sections
  3. Header and footer definition
  4. Widow/orphan prevention, so that if a paragraph is going to be broken before the end of its column, it "moves" to the top of the next column.
  5. Two columns per page in some sections
  6. Image watermarks behind the text
  7. Multiple font styles within the one fully-justified paragraph
  8. Page numbers in the form "Page X of Y", filled in after you actually find out how many pages there are.
  9. Out-of-order page generation, since I'll need to create a table of contents on the fly and then stick it at the start of the document.

The library I used (and extended) had these features, but it got horribly slow, largely because the widow/orphan control forced it to generate nearly every paragraph twice. The underlying library didn't have caching of pre-calculated paragraphs, and the code is so badly written that I couldn't begin to add that sort of feature.

Can anyone advise? I'm already aware of ReportLab, and I've asked on their mailing list if it can handle the last and greatest of those features, but actual experience from real live users would be nice too.


* For those of my audience unfamiliar with the ways of system administration:

Level One Diagnostic: is it plugged in?
Level Two Diagnostic: have you tried rebooting?
Level Three Diagnostic: we've reformatted your hard disk for you; would you like it back?


To Heron, Or Not To Heron
the-dark-batpup-returns
[info]etfb
Quick question for the Penguiphiles of the Lazyweb: I haven't been impressed with the stability and reliability of Ubuntu 7.10, Gutsy Gibbon, but I hear that 8.04, Hardy Heron, is an improvement. What do you think: should I go ahead and upgrade now? Is it going to make my life and my laptop a living hell, or is it relatively painless? By "upgrade" I really mean "archive everything off, reformat my hard disk and install the new version", because for all that I love Mr Spaceman's little toy, I don't trust him to get an upgrade process to work even as well as Windows does it, which is not well at all. So: install Heron, or suffer through broken USB support and weird suspend/hibernate and an apparently braindead multi-monitor setup and all the other (minor) aches of the Gibbon? What say ye?

Agincourt Mystery
the-dark-batpup-returns
[info]etfb
The Agincourt Carol has been around for a good six hundred years now, and I am forced to ask: how is it that this song has remained so popular when it is utterly impossible to sing it without sounding like an octogenarian sheep in a tin bucket?  I've looked on YouTube, and all the recordings there are of people whose skills at singing are exceeded only by their talent for sound recording and Latin pronunciation.  I've heard it performed by the rather awful singers of a certain nearby barony, who make such a dirge of it as to leave me yearning for a good long crumhorn solo.  To the best of my knowledge, nobody has ever managed to sing the song in my presence with sufficient skill to reveal to me the tune.  All I ever hear is warbling and bad Latin.  So how has it survived?

I can only assume it's some kind of conspiracy.  But why bother?  Answers on a postcard, please.  
Tags:

Technical Advice Wanted: Singing and Recording
the-dark-batpup-returns
[info]etfb
Hey, Lazyweb!  I will shortly be releasing The Known Words (First Ethereal Edition) as a PDF download.  When I do, I'd like to encourage people to submit recordings of the various songs so that I can put together a CD and a set of downloadable sound files to help spread the songs far and wide.  But there should be minimum standards of quality, so I'm wondering if anyone out there has done something like that and can help me formulate some rules. 

The obvious would be: record a whole song, in tune and with no irritating background noise or distortion due to crap technology.  But what format?  What bitrates?  What's a reasonable file size for a one-to-two minute a cappella folk song?  What technology should they be using? 

Also, what's the appropriate content license to use: Creative Commons, presumably, but which one?  Note that the songs will be distributable only to SCA people - there'll be an honour system to "enforce" that - and some of the songs are filks, so the tunes are already owned. 

Come to think of it, where do I stand with copyright for filks?  I know Weird Al Yankovic always asks permission before he releases a filk of someone else's work, but I think I read somewhere that he does this as a courtesy, not because it's legally required. 

Can anyone advise?

Operation: Nailgun - Day Two: Comics, Anyone?
the-dark-batpup-returns
[info]etfb

I have a large collection of comics. Some, like the complete run of Flash, Legion of Superheroes and the James Robinson Starman, I intend to keep, because they're good stories and stand up well to re-reading. Others, including a complete set of Superman from 1986 to around about the Infinite Crisis/One Year Later mess, could quite happily go to a better place. If it's DC Comics from just after the original Crisis until now, I probably collected it - except the Batman titles, oddly enough. And also Valiant, just about every title from the start until nearly the end. And since they're just sitting in boxes in the Green Shed, I think it's a bit of a waste for me to hang on to them. So: if you're interested in comics and want to add to your collection, let me know. My criteria for disposing of them will look something like this:

  • I'm not expecting to make money here. If you give me a tenner for a complete run of two hundred-odd comics, I'll consider that a good price. More likely I'll talk you down to a fiver, because if you spend too much on one set you might miss out on taking home something else.
  • The words "Mint" and "Condition" do not get a look in. These comics have been opened, read, often even re-read; they've been stored on shelves or in boxes for years. They're not torn or stained or anything like that, but they're pre-loved. You won't make anything reselling them. They're for reading, in other words.
  • Given the above, I'd rather get rid of complete sets: all my copies of Green Lantern, say, rather than just the issue #47 that your dog chewed.
  • If two people are fighting over a particular set, and one can demonstrate either (a) that their kids are interested in reading them too, or (b) that they just love the characters and the stories, then that will help me choose. Not that I expect to hear from anyone at all in response to this (well, maybe [info]ethanthescribe, but that's about it) but I guess it helps to have contingency plans.
  • If nobody on my friends list (or friends of friends, ad infinitum) shows any interest, they'll be going to op shops or Freecycle.

So: any takers?

Tags:

Lazyweb: Odd Linux bugs
the-dark-batpup-returns
[info]etfb
I have prayed to Google for guidance, but in Her wisdom She has chosen to reply in an information-sparse fashion.  I therefore call upon the assembled disembodied heads of my loyal reader base to help me.


I suspect many of these don't have answers, but I'm asking anyway.  Feel free to speculate; I welcome guesses from geeks with better-informed intuition.

Lazyweb: Rural Broadband?
the-dark-batpup-returns
[info]etfb
One here for Smithfielders and [info]infoaddict, I suspect, but anyone can play.

Picture if you will: a semi-retired couple, living on a farm outside Murrumbateman, about half an hour out of Canberra. They have a computer, and their dial-up internet is state of the art for 1987. They want to get dragged, kicking and screaming, into about 1998, and get some sort of broadband internet. Their options are many and varied -- satellite, wireless broadband, two cans and a length of string -- but they're not exactly surrounded by geek-turned-farmer friends, so they don't know which of Telstra's lies to believe.

Can anyone offer advice? Present it to me and I'll translate it into short words and simple concepts so their heads don't explode, cos the older generation are so iggerant, doncherknow.
Tags:

Lazyweb: What's a mAh?
the-dark-batpup-returns
[info]etfb
Hey, Lazyweb! The battery on my laptop seems to be dying, so I'm pricing replacements. What confuses me is that my current model, the PA3399U-2BAS has a label with "DC 10.8V 4000mAh" on it, but there are alleged replacements with up to DC 10.8V 8800 mAh. So what's a mAh? And is more better? I never understood electricity. People talk about volts and ohms and amps and something about pipes and diameters and volumes of water and my eyes glaze over like a Mac user in room full of AUTOEXEC.BATs. Can someone give me the potted revelation on this topic?

Also: if you have a laptop battery that used to last for a couple of hours and now dies three quarters of the way through an hour-long bus trip, how do you diagnose the problem and/or fix it? Any ideas?



ETA: [info]subtle_eye suggested a trick to find out some info about my battery, and this is what I got:
poet@manticore:~$ cat /proc/acpi/battery/BAT0/info
present:                 yes
design capacity:         1364 mAh
last full capacity:      1364 mAh
battery technology:      rechargeable
design voltage:          15000 mV
design capacity warning: 0 mAh
design capacity low:     0 mAh
capacity granularity 1:  0 mAh
capacity granularity 2:  1364 mAh
model number:            PA3399U-2BAS/BRS
serial number:           8A74
battery type:            Li-ion
OEM info:
poet@manticore:~$

That's bad, right? I mean, it says 4000 mAh on the battery, so what's with the 1364 mAh?



Right; I've ordered a replacement battery. I'd been meaning to anyhow, just because it tends to be a good policy. We'll see if it's an improvement.

Home Schoolers?
the-dark-batpup-returns
[info]etfb
I hadn't realised that the eerily braintacular (and cute) [info]aryanhwy was home schooled, but it makes sense. You don't keep that much of a love of pure knowledge well into adulthood unless the school system has been thwarted in its efforts to beat it out of you. But I'm fairly sure there are at least a couple of other former home-schoolees on my f-list, and one or two parents who are home schooling their own munchkins. So 'fess up: who are you, where are you, and why did you do it?

And are there any home-schooled personages who got into it for religious reasons, ie because mundane schooling would have exposed you to too much that was sinful/unscriptural/fun? I've always wanted to meet some people like that and see if they were serial shag-rats with serious drug problems or not...
Tags:

A Python question
the-dark-batpup-returns
[info]etfb

Not this

Not this either

I'm planning to teach the Elder Daughter of DOOOM some programming this year. I gave her a bit of a rundown of Lisp last year, but ran into some trouble because (+ (* 1 2) (/ 3 4)) doesn't look an awful lot like the 1×2 + 3÷4 that she's used to. So I figure Python is the next bet. To that end, I've been translating a short game from the book that taught me to program, from the original BASIC. It's not a big job -- it's a very small program -- but I have a question I'd like to ask any Pythonistas who may be watching. This isn't a big thing, and I could work around it any of a dozen ways, but I'd like a quick, simple method that won't confuse my daughter or make the program less readable. Here it is:

In BASIC, which is focused very much on keyboard input and plain text output, there's a command to print some text, sensibly called PRINT. So if I say PRINT "Hello, world" then I'll get the traditional greeting, right there. And Python has the same thing, although it spells it print. But BASIC has the logical inverse, a command to take in data rather than to print it out: this is the INPUT command, as in INPUT x,y which will ask for two numbers, comma separated, and place the first of them in the variable x and the second in the variable y. Does Python have anything like this?

The solution I first thought of went something like this, from memory:

f = open('/dev/tty')
raw = f.readline()
x,y = line.split() # space-separated, not comma, but that's OK
# something to convert x and y to integers

I have a nasty feeling I'd be using a list comprehension somewhere to change the strings to integers, which is not something I want to expose the EDoD to at this stage. Obviously I can put it into an importable library file, and probably will because there'll be a lot of this sort of thing over time, but really I'd like something simpler.

Now, C has a sscanf function, which one uses like this:

int x,y;
sscanf(line, "%d %d", &x, &y);
/* do something with x and y now */

... so maybe there's an equivalent in Python? Anyone? Bueller? Bueller?


ETA: I think this will do nicely; I'll stick it in a library file to keep the implementation from messing up the pristine purity of hurkle.py:

def input_numbers():
    return [int(x) for x in sys.stdin.readline().split()]

Usage:
x,y = input_numbers()

Thanks to [info]catsidhe and [info]uniqueid!


Canberra: Looking For Accommodation For A FOAF
the-dark-batpup-returns
[info]etfb
While [info]rococoabean was over in a fictional African country, she got to know Dr S___, a woman with two kids who is now moving to Canberra to start at the ANU this year. S___ is in need of a place to live, ideally close to schools and childcare if such a thing exists, and on the bus route past the ANU (which basically means: near any of the interchanges, or else in the Inner North). If you know of suitable options, please drop me a line and I'll pass the lead on to S___ directly. Feel free to pass this around among friends and cow-orkers; think of it as doing your bit to undo the years of xenophobia encouraged by our former leaders.
Tags:

Lazyweb
the-dark-batpup-returns
[info]etfb

Hey, Lazyweb - here are some questions I'm stumped on. Even praying to Google has not turned up answers. Can you help?

  • Who described a rainstorm as "not so much rain, more a vertical ocean with slots in it"? It's either Pratchett or Adams, but in which book? [info]lauredhel came through! It's from Truckers, and it's an upright sea, not a vertical one: The sky rained dismal. It rained humdrum. It rained the kind of rain that is so much wetter than normal rain, the kind of rain that comes down in big drops and splats, the kind of rain that is merely an upright sea with slots in it.
  • I think it was Adams who wrote that, "no matter how fast your body travels, your soul travels no faster than a walking camel". But where? And what's the exact wording? It was "However fast the body travels, the soul travels at the speed of an Arcturan megacamel", and it was in the radio series, not the books, which explains why it was hard to find (that and the fact that Google doesn't translate "Arcturan Megacamel" as one of its replaceable synonyms for "camel", oddly enough). Thanks to [info]arthwollipot.
  • A different topic entirely: a cow-orker here at work insists on leaving the TV in the lunch room because -- he says -- it uses more power to switch it on than to leave it on. I'd heard that about computer monitors, but learned that it ceased to be true by the mid-eighties. Mythbusters did a test and debunked it regarding light bulbs, but a TV is a lot more complex than a light bulb. Short of bringing my power meter into work, is there a definitive statement on this?

All answers welcome; accurate and complete ones win a no-expenses-paid trip around the sun, starting on the day of your choice and ending twelve months later.


Thinks To Himself...
the-dark-batpup-returns
[info]etfb
I never got into Yum Cha until I moved to Sydney and met the Marigold restaurant in Chinatown. A couple of people mentioned Yum Cha on their LJs and I find myself wondering: where does one go for that particular cultural experience here in Canberra? I'm guessing Dickson (Canberra's Little Chinatown) but where in particular? And... if it's suitably far in the future (I'm booked this coming weekend) does anyone want to get a party together? I think it would be fun to introduce the Elder Daughter of DOOOM to the chicken feet and the dessert tentacles and the White Wobbly Cubes of Dubious Deliciousness.

There are only three things I miss from Sydney. The various restaurants, cafes and takeaways are one; the functional public transport system is another; and the all-night Kinko's copy shops are the third. Sure the people were generally nice, but there are nice people anywhere. But a good takeaway Indian curry, a train that will get you where you want to go and a colour photocopier at three in the morning when the deadline for heraldic submissions is looming? Priceless.

Home