Planet Linux Australia

Syndicate content
Planet Linux Australia - http://planet.linux.org.au
Updated: 27 min 42 sec ago

Tim Connors: An open letter to Peter Ryan regarding police treatment of cyclists

Mon, 2014-08-25 02:26
Hon Peter Ryan,



I am writing because I am concerned at the number of recent incidents where a driver has collided with a cyclist, and the case hasn't been followed up by the police. Such incidents and the publicity surrounding them does nothing to encourage road users to obey the law when they realise that they will most likely get away with not doing so.



A week ago in Ballarat, a 13 year old boy was hit by a car, and the police said the boy had the right of way[1]. Despite this, the article linked states that the police will not charge the driver. This, despite her having broken Australian Road Rule 67 to 72, 84 or 86 depending on circumstances at the stated intersection, or perhaps 140 to 144 if travelling in the same direction. She was likely negligent in allowing the collision to happen in the first place, which, by my understanding, is a criminal offence, especially since there was serious injury involved. If she used the usual excuse that "she didn't see him", then that's an admission of guilt in failing to obey ARR 297 - driver having proper control of vehicle.



Also recently, there was a highly publicised case where Shane Warne had an altercation with a bicycle rider. In that case, the fact that Warne hit the cyclist from behind (ARR 126) after overtaking unsafely (ARR 144) is undisputed[2]. The fact that details were not exchanged following the collision is also undisputed (ARR 287). It is also well established that Warne was stopped unnecessarily in a bike lane (ARR 125; 153)[3]. And yet the police will not investigate[4].



Going back a number of years, I also have not had good experiences getting the police to follow up on cases. In my most recent case (11/10/2005; I do not know the case number sorry, all I know was that I was attended to by Angove & Auchterlonie from Boroondara police), the driver also failed to obey ARR 287 (as well as a slew of other offences, such as ARR 46 and 148 - changing lanes without indicating sufficiently and without due care). The police refused to prosecute the driver, and also would not hand over the driver's details or insurer details, based on some misguided privacy policy, asking me instead to fork out for a freedom of information request. Given that I was a broke student at the time, this was not a feasible thing to do and I never did receive compensation from the driver for damage to my bicycle, clothes, and large out of pocket expenses for travel to medical care for several years that the TAC didn't cover. The police also displayed a lack of knowledge of the law, initially thinking that I had broken ARR 141.



I can't imagine why the police aren't investigating these cases, because in each case, clear evidence is at hand, and not disputed. The identities of all parties are known. It should be an open and shut case. Without the police making charges, the rider in each case will have a much harder time claiming from the driver's insurance (if the boy was not admitted overnight, his TAC excess will be an enormous burden to his family). The driver in each case will not be discouraged from driving in a similar fashion next time. And other drivers also know that they will most likely get away with any offences they commit if a bicycle is involved. This is a perverse reversal of the situation that we should have, in which drivers should be encouraged to take due diligence around cyclists. It almost seems that the police always assume a cyclist is at fault unless proven otherwise in Australia, whereas most other countries with an established bicycling culture assume that the driver is at fault unless proven otherwise as they hold the burden of driving the more deadly vehicle and so should be required to take due care.



If the laws weren't adequate enough to prosecute to the driver in the above cases, has your department been contacted to update the laws, and what is being done? Keep in mind that cyclists have no protection other than by the law, and as the more vulnerable road user, the laws should focus on their safety and ensuring that transgressions are dealt with effectively.



Can you please encourage the police in each of these cases to follow them up to the full extent that the law currently allows.





Sincerely,





[1]

http://www.theage.com.au/victoria/teen-cyclist-struck-by-car-20120110-1ps85.html



[2]

http://theage.drive.com.au/motor-news/warnes-tirade-triggers-bike-rego-call-20120118-1q5k0.html



[3]

http://www.cyclingtipsblog.com/2012/01/cyclist-versus-warnie-the-cyclists-story/



[4]

http://www.heraldsun.com.au/news/more-news/warne-blasts-cyclists-on-twittershane-warne-clashes-with-cyclist-on-way-home-from-training-session/story-fn7x8me2-1226246735306

Tim Connors: Breaking windows

Mon, 2014-08-25 02:26
Another letter in The Age today. Unedited text below:





Ian Porter (Without car manufacturing, we are on the road to ruin, The Age, 13 Jan) believes that the government needs to keep throwing money at the car industry in order to support other industry in Australia. I'm surprised as an industry analyst, he hasn't heard of the broken window fallacy.



Throwing good money after a bad unsustainable industry that can't adapt is just a waste. It's exactly identical to sending soldiers to dig holes only to fill them back up again just to keep them employed and off the streets. The money could be better spent on doing useful things that will remain useful into the future. Yes, paying people to break windows and then paying the glazier to repair them will keep people employed, but couldn't the glazier be better employed building things that then keep other people employed into the future?



Why don't we do something useful with the money instead? Like built modern intra- and inter-city rail infrastructure? This won't become stranded assets when cheap oil becomes unavailable. We won't be left with vast tracts of useless motorways - we will continue to be able to use the rail infrastructure well past these boom times.

Tim Connors: Police a bit rich

Mon, 2014-08-25 02:26
Hrrrfm. The Age didn't publish my letter:





I find it a bit rich that the police union are upset that information

alongside a photograph was distributed about one of their members, without

his consent. I understand that truth is not not considered a defence to

libel in Australia, so it was perhaps unwise to distribute such a photo.

But it is common police practice to photograph protesters without our

consent, and to store these photos with profiles in national databases

without a right of appeal or review. I probably find myself on some

watchlist now just for attending some of last night's Occupy Melbourne

general assembly.



Maybe there would be no need for a photograph to be distributed if police

correctly wore their own name badges (and if the name badges weren't

deliberately too small to read). Or if there was some accountability, as

opposed to the protectionism that police have demonstrated in the past

with the likes of their disgusting behaviour at the APEC protests.

Tim Connors: on the hardships of living with minimal amounts of RAM (4GB or so)

Mon, 2014-08-25 02:26
I just got 200MB/s read/write rate from my swap device on my laptop. Fast laptop eh? OK, so I'm cheating by using the compcache/zram module from the staging tree.



When I bought my 2 laptops, I was upgrading from 256MB to 4GB. I thought that would be enough to last me for years. The video card on that first laptop came with more memory than the system memory of the machine I was upgrading from. Alas, I forgot to factor in opera and firefox (we're now in the era when Emacs is officially lightweight). And being laptops with the particular chipsets they have, 4GB is it, I'm afraid.



And the fact that Linux's VMM, for me, has never really handled the case of a machine running with a working set not all that much smaller than physical RAM. If I add up resident process sizes plus cache plus buffer plus slab plus anything else I can find, I always come up about 25% short of what's actually in the machine. Ever since those 256MB days (whereas about half the ram went "missing" on the 128MB machine prior to then). And even when your working set, including any reasonable allowance for what ought to be cachable, falls far short of RAM, it still manages to swap excessively, killing interactive performance (yes, I've tried /proc/sys/vm/swappiness). When I come in in the morning, it's paged everything out to make backups through the night marginally faster (not that I cared about that - I was asleep). Then it pages everything back in again at 3MB/s, despite the disk being capable of 80MB/s. Pity it's not smart enough to realise that I need the entire contiguous block of swapped pages back in, so it might as well dump the whole wasted cache, and read swap back in contiguously at 80MB/s rather than seeking everywhere and getting nowhere.



What I really wanted, was compressed RAM. Reading from disk with lots of seeks is a heck of a lot slower than decompressing pages in RAM. I vaguely recall such an idea exists if you're running inside VMWare or the like. But this is a desktop. I want to display to my physical screen without having to virtualise my X11 display.



But the zram module might be what I want. Pretty easy to set up (in the early days, it required a backing swap device and was kinda fiddly). Here's the hack I've got in rc.local along with a reminder sent to myself that I've still got this configured, at reboot:

echo 'rc.local setting zramfs to 3G in size - with a 32% compression ratio (zram_stats), that means we take up 980M for the ramfs swap' | mail -s 'zram' tconnors echo $((3*1024*1024*1024)) > /sys/block/zram0/disksize mkswap /dev/zram0 swapon -p 5 /dev/zram0

It seems to present as a block device of default 25% of RAM size (but I've chosen 3GB above), and as you write to that device, compressed versions of the page end up in physical memory. Eventually you'd run out of physical memory, and hopefully you have a second swap device (of lower priority) configured where it can page out for real. In my case, I'm using the debian swapspace utility. Be warned, if you plan to hibernate your laptop, not to forget to have a real swap partition handy :)



zram_stats tells me I'm currently swapping 570MB compressed down to 170MB, for a compression ratio of 28%. That 170MB has to be subtracted from the memory the machine has, so it appears to really only have 3.8 or so GB. No huge drawback. At that compression ratio, if I were to swap another 3GB out, physical ram stolen by zram would only be 1GB. My machine would be appearing to have 3GB of physical ram, 3GB of blindingly fast swap, and a dynamic amount (via swapspace) of slow disk based swap. I'd be swapping more because I had 1GB less than I originally had. But at least I'd be swapping so quickly I ought not notice it ('course, I haven't bench marked this). And I'd be able to have 2GB more in my working set before paging really starts to become unbearable.



So, with an uptime of 4 hours, I haven't even swapped to disk yet (I know this, because swapspace hasn't allocated any swapfiles yet). The machine hasn't yet thrashed half to death yet. That must be a recent record for me.





Yes, the module is in the staging tree. It's already deadlocked on me once, getting things stuck in the D state. And the machine has deadlocked with unexplained reasons a couple of other times recently (with X having had the screensaver going at the time, so no traces, and no idea whether it's general kernel 3.0 flakiness or zram in particular; I had forgotten until tonight that I even had previously configured zram back in the 2.6.32 days).



What I really *really* want, since I lack the ability to add more ram to the machines, is a volatile-ram ESata device, used purely as a swap device, reinitialised each boot (ie, having a battery backup is just pointless complexity and expense, and SSD is slow, fragile and prone to bad behaviour when you can't use TRIM, for the amount of writes involved in a swap device). There is the Gigabyte i-Ram and GC-RAMDISK and similar devices, but they're kinda pricey, even without the RAM included in the price. Why is SSD so much cheaper than plain old simple RAM these days? I thought the complexity involved would very much make it go the other way around.



What I really *really* **really** want, is for software to be less bloaty crap.

Tim Connors: We do things differently, here

Mon, 2014-08-25 02:26
Another slightly edited letter published in The Age today. Maybe I should become a media mogul. Original here:



I've just come back from a tour of Europe. Wind farms are everywhere. Near tourist attractions, and along roads where it is particularly windy. Anywhere appropriate, and especially near townships and individual houses, because that's where the consumers of electricity are. No one seems to have a problem with them. People there don't suffer from increased rates of cancer or bogus self-imagined inflictions. They don't ban building windmills within 2km of towns. They don't ban the building along a windy stretch of road because tourists happen to drive along there.



They also don't develop in green wedges, allow cattle to graze in their national parks, or try to make it easier to log old growth forest and make it harder to protect such lands.



Europeans seem to have no problem accepting that, despite their per-capita emissions being way below ours, that something has to change. It's a pity we are not lead by leaders. The best I can manage out of my local member, Ted Baillieu, is a form letter in reply to my concerns, uttering vague niceties about planning and the economy, and attacking the opposition.

Tim Connors: Failed and now discarded Victorian cycling strategy

Mon, 2014-08-25 02:26
I've always been a crazy cat man who sends letters to the editor and his local parliamentary representitatives. Except that I have no cat. Anyway, a shortened version of this letter was published in The Age today.





Dear Sir/Madam (CCed my State local member, and The Age letters),



The auditor general's report into the Victorian government cycling strategy said "the Department of Transport and VicRoads had not ... addressed conflicts and delays where cyclists crossed busy roads, and where cyclists and pedestrians shared paths." ("No way to spin it, the wheels are off", The Age, Aug 18). It's not just busy crossings that cause unnecessary delays to people not in the precious car.



A trip along Southbank is usually hampered by 2 traffic light controlled crossings where up to 100 pedestrians and riders are waiting at the lights with an average waiting time of around 5 minutes between them. That's 10 minutes per return trip wasted. We wait for just an occasional car (each with just one person in them) and empty tram to pass. The cars are frequent enough to make running ("jaywalking") across the road a little unsafe, but not frequent enough that the road is anywhere near capacity and that adding more frequent red lights for the car traffic is going to harm the flow into and out of the city at all. And it will help the 100 waiting pedestrians.



In the land where cycling is taken seriously, Holland, they want cyclists to have to wait no more than 15 seconds. And they're experimenting with microwave sensors to extend the green cycle to let cyclists cross safely. Here, the Southbank story is repeated across the city. Outside Swinburne University, a pedestrian light regularly sees several dozens of students wait several minutes at lunchtime to cross while a small handful of cars (each with just one person in them) cross just frequently enough to make a quick dash across the road down from the lights, impossible. The vehicle sensor loops at Camberwell Junction have, for years, been tuned to not even be sensitive enough to detect cyclists, so you can wait at 11pm for 2 cycles of the lights to completely bypass turning green on the road you're travelling on, while no cars cross the other legs of the junction at all before you give up and cross illegally (completely safely, because there's no traffic at all at that time of night and you can see for miles).



Given that you can't continue to keep encouraging people to get in their cars because it's been conclusively proven over the last 40 years that you can't build your way out of car congestion, perhaps it time to promote other forms of travel?

Tim Connors: New Media

Mon, 2014-08-25 02:26
The Age published an article about http://theconversation.edu.au/, a new media outlet run by the former chief in editor of The Age. Not only have I seen intelligent articles on it, their editors and authors understand Creative Commons licenses.

Tim Connors: Mary Poppins

Mon, 2014-08-25 02:26
Small country towns and petrol. I should have learned by now. I was running short of where I expected to run low[1], but the maps told me there was a little town up the road with fuel, so I stopped there. It's Sunday. In a small town. That's OK, I've got 36km of fuel left according to the onboard computer, and a guy reckons a town 20km back there had fuel. I didn't see it, and it was a very small town, so I decide to push my luck and head over the mountains, where I know a town 63km away (Mansfield) has fuel. I've stopped before when the computer reckoned there was 7km left, and I really had 1.5L of fuel left, which should be good for 30km. So 36+30km should get me there with 3km to spare! Except that mountains take juice. So I absolutely babied it over. Then thought I was lost because of a GPS stuffup (problem exists between touchscreen and bike seat). I never went above 80km/h hour (and associated with the want not to have to roll on the throttle, is the want to not put on too much brake to waste too much energy. Not braking and mountains aren't really a clever mix). And it should have been a really fun road. I still hadn't reached the top of the mountain when the computer said there was 0km left. I couldn't listen to music, because I had to listen to the telltale signs of the engine missing or other signs that I should immediately turn off the ignition lest the fuel pump bearings burn up. Anyway, 20km later, no signs of trouble, and I roll into the fuel station. 1.5L left still.



I've got a Mary Poppins fuel tank.



Anyhoo, that blew the cobwebs away. 2 days ought to be enough holiday between jobs, right? Wish me luck tomorrow! I've reccied where it is that I'm working, so now I've just got to find out what I'm actually doing. Oh, and find a house.



[1] At Caltex in the main street of Wagga Wagga, I got the worst quality fuel I've ever got (5.8L/100km, for premium grade, despite traveling most of the time at the speed limit, and riding pretty conservatively (compared to the rest of my trip in NSW!). The previous fuel was 5.1L/100km, and the next fuel was 5.4L/100km despite only having the lower grade available)

Tim Connors: The wrong politic

Mon, 2014-08-25 02:26
It seems that Senator Carr didn't like the frank and fearless advice his public servants were offering him, and the Chief Scientist's position became untenable. Sure, you're not meant to offer that frank and fearless advice through the media, but what's the point of a having a chief scientist or indeed any publicly paid scientist if they're only allowed to tow the party line, and not allowed to tell the public what they need to know? We see this time and again. CSIRO researchers have been completely barred from making any public comments without going through the central media office. What's the use of public funding if the public research isn't allowed to be told?



Tony Rabbit wanted to remove the Chief Scientist's office because it was too political (I did read this in the SMH a few months ago, but can't find the cite). Senator Carr wanted to remove the officer because she was the wrong politic and was telling too much truth.

Tim Connors: Why I don't donate to natural disasters in Australia anymore

Mon, 2014-08-25 02:26
I donated towards the Black Saturday fires, and then the donation policy of Red Cross became "we'll forward donations to people with insurance and people with holiday homes that got burned down". I wanted my money to go to people who can't afford to pay for insurance, and certainly to people who can't afford holiday and investment homes. Insurance will cover those who can afford it. The rest truly deserve a break. The Qld flood donations are going to people who simply won't need it.



And as to who would pay for it, and whether Australia should postpone bringing ourselves back into budget surplus: If we didn't dump the mining rent resources tax, we'd be fine. Not only would the annual amount generated by the tax neatly match the amount that needs to be spent repairing Qld, but if it was framed ideally (ie, applied to all mining companies) it would come from companies that were largely responsible for the worsening of these severe storms. I.e., they wouldn't be able to externalise their costs onto the rest of society so much anymore - those that actually consume more would end up paying for the damage it does, which would then partly fund the mitigation costs we all endure. Actually, it should come partly from farmers too. What did you expect would happen when you clear the land of its natural ability to regulate water flow?



The guy who texted into JJJ talkback that we should just drop the National Broadband scheme instead, on the basis that it would be obsolete by the time it was built, made me laugh. Yes sure, if we don't build something, then the next thing we can't build would be even better!

Tim Connors: Wrong technological fixes to problems vol. #8123

Mon, 2014-08-25 02:26
Arizona state apparently spent $1B to attempt to automate the detection of people crossing a 53 mile section of the Mexican border.



If we expect the lifetime of such a project to be 15 years before the infrastructure completely falls apart and needs to be renewed, then in that same 15 year period, we can employ 33333/15=2222 staff at what seem to be typical US wage rates (neglecting inflation. But since the US economy is a basket case, I might be justified in doing that). In that 53 mile space, we could space 2222 guards every 40 metres in a line, or a bit more sparse if you wanted a grid of guards to detect tunneling.



<hint of sarcasm="maybe">

I'm sure most government spending is useful, and I'm sure the expense of the project could be entirely justified. I'm sure the article is just ill-informed.

</hint of sarcasm>

Tim Connors: Vale Purrple

Mon, 2014-08-25 02:26
I'm not having much luck selecting cats for longevity rather than character. Still, I'd rather character than longevity.







Purrple has been living with mum since Phred died, because cats always deserve fellow playthings, and I wasn't about to get another cat. The signs of her (presumably) cancer started showing in October, but the tests the vet did didn't reveal anything (he wasn't searching for cancer though). On Monday this week, she started showing other signs - that of kidney failure. In the end, she went the same way Phred did.



I didn't get to see her in the end - the curse of long distance part time veterinaries. He made the call, it could either be sew her back up, give her drugs, and transport her back to us, or put her down.



And it's only just hit me. I had to type that up.

Tim Connors: Reqium for a species

Mon, 2014-08-25 02:26
Yikes. I'm reading Clive Hamilton's "Requiem for a species. Why we resist the truth about Climate Change". (all tyops are mine)





To date, governments have shunned geoengineering for fear of being accused of wanting to avoid their responsibilities with science fiction solutions. The topic is not mentioned in the Stern report and receives only one page in Australia's Garnaut report. As a sign of its continuing political sensitivity, when in April 2009 it was reported that President Obama's new science adviser John Holdren had said that geoengineering is being vigorously discussed as an emergency option in the White House, he immediately felt the need to issue a "clarification" claiming that he was only expressing his personal views. Holdren is one of the sharpest minds in the business and would not be entertaining what is now known as 'Plan B'— engineering the planet to head off catastrophic warming — unless he was fairly sure Plan A would fail.





It is far easier, on the face of it (and certainly, politically), to perform geoengineering than to slow down the generation of CO2. So cheap that one country can afford it, instead of it being such a huge (political) task that not even all of the worlds countries acting cooperatively will be able to pull it off. So great, lets go servo the eco-system. Control Systems are easy, right? They never break into unwanted oscillations while you're still learning their response function.





The implications are sobering. In August 1883 the painter Edvard Munch witnessed an unusual blood-red sunset over Oslo. He was shaken by it, writing that he 'felt a great, unending scream piercing through nature'. The incident inspired him to create his famous work, The Scream. The sunset he saw that evening followed the eruption of Krakatoa off the coast of Java. The explosion, one of the most violent in recorded history, sent a massive plume of ash into the stratosphere, causing the Earth to cool by more than one degree and disrupting weather patterns for several years. More vivid sunsets would be one of the consequences of using sulphate aerosols to engineer the climate; but a more disturbing effect of enhanced dimming would be the permanent whitening of daytime skies. A washed-out sky would become the norm. If the nations of the world resort to climate engineering as an expedient response to global heating, and in doing so relieve pressure to cut carbon emissions, then as the concentration of carbon dioxide in the atmosphere continued to rise so would the latent warming that must be suppressed. It would then become impossible to stop sulphur injections into the stratosphere, even for a year or two, without an immediate jump in temperature. It's estimated that, if we did stop, the backup of greenhouse gases could see warming rebound at a rate 10-20 times faster than in the recent past, a phenomenon referred to, apparently without irony, as the "termination problem". Once we start manipulating the atmosphere we could be trapped, forever dependent on a program of sulphur injections into the stratosphere. In that case, human beings would never see a blue sky again.





Please read his book. The book goes down many paths -- human pyschology, politics, science. It's bloody depressing, but people need to understand why we not going down a better route.

Tim Connors: Health and Safety

Mon, 2014-08-25 02:26
It has always frustrated me that the medical profession and unions and the like are always pushing the health and safety barrow so much without critical thought.



Putting up safety fencing to the point that no one pays attention anymore, because they assume the safety fencing will always be everywhere (I am reminded here of work. You have to pay a lot more attention now lest your attention lapses when you go near a fence with a hole in it because the engineering simply makes it impossible to make everything safe). (I could rant how the unions have forced legislation on how brightly lit my office has to be, to the point where it hurts my eyes if I don't wear sunglasses, but I'm going offtopic here)



Putting sensors in cars that are so safe that you don't need to pay attention anymore, so that most people drive like they're driving a Volvo (I fear and loath the research into automatically driven cars − unless those cars all limit themselves to 40km/h or they legislate against cyclists and kangaroos from roads, the research will be a failure, safety wise). Rear view cameras being mandated in cars simply because a few people in 4wds are too stupid to look backwards before running over their spawn? How is that going to protect against a child that is lying underneath the car?



But when it comes to mandatory helmet legislation, it seems the medical profession are just blind and dogmatic, and lack any critical thinking skills.



The head of Montreal’s trauma unit, Dr Raziz, really needs to come out to Australia and have a look in the trauma unit of Melbourne's hospitals some time. There he'll see that helmets do very little against cars that hit helmeted cyclists; after all, the standards only test to impact speeds of 19.5km/h - a fall of 1.5metres without any additional velocity components of heavy blunt metal. Helmets do nothing when a cyclist is ejected over the handlebars face first into the tarmac, because their handlebars got caught in the wheel-well of an excessively high 4wd. Cars are driven recklessly by drivers who have never gotten used to, nor tolerated cyclists because most cyclists had been driven off the road 20 years ago precisely because of the legislation that people like him were trying to push. When you only look at one small part of the picture, you only see a very small part of the picture. Get out there and look at the big picture. Getting more people cycling is the solution.



Something that makes people feel safer, but is not actually safer (bicycle helmets) just leads to risk compensation. Forcing people to wear helmets is anything but safe. The choice to wear helmets should be your choice, and your choice only (or your parents, if you are of an age that it is deemed that you can't legally decide for yourself).



A far more effective piece of legislation to introduce would be to ban vehicles from having a bonnet of height more than that of your typical sedan. The aggressivity ratings of 4WDs is unacceptably large, so they have poor crash compatibility with other road users. If only the legislation worked to minimise risky practices rather than forcing passive safety and adopting other practices that lead to risk compensation.

Tim Connors: Conga line of suckholes

Mon, 2014-08-25 02:26
I've got a higher respect for ex-leader of the ALP, Mark Latham than I currently do have for Prime Minister Julia Gillard and Attorney-General Robert McClelland.



Conga line of suckholes indeed.

Ben Leslie: Google Maps Fun

Mon, 2014-08-25 02:26
Google maps is fun. Google maps API is even more fun!



Just so many cool things to do. My first Google maps hack lets you draw routes on the map (or sat image) and print out the distance associated with it. I've got some other cool things coming up, but I thought I'd get that one out now.



Oh, it is currently centered on work's new building, but zoomed out to see most of the city.

Ben Leslie: Python Generators

Mon, 2014-08-25 02:26
Didn't understand the coolness of python generators today. I wanted to generate a list of

files in a directory. Previously I had to write a class and do __iter__ tricks. Now I can

simply do this:



def file_walk(path): for dn, ignore, files in os.walk(path): for fn in files: yield dn + os.sep + fn

Ben Leslie: Python decorators

Mon, 2014-08-25 02:26
I love Python because it is so easy to write unreadable code in.



I wanted to handle sub-commands and didn't want to go to all the hassle of

maintaining a dispatch dictionary. So I decided I could be really seedy and

do:



globals()[args[0]](args[1:])



However this sucks if someone picks function that wasn't intended as a subcommand.



Python decorators to the rescue! My main problem with the dispatch dictionary was

having to update commands in two places. So with decorators I can do this:



commands = {}



def command(fn):

commands[fn.func_name] = fn



@command

def foo(args): pass



and then



commands[args[0](args[1:])



and I don't have to be so seedy. Of course I'm sure people still won't understand

what I'm doing, but thats ok ;)

Ben Leslie: Hoary Hedgehog

Mon, 2014-08-25 02:26
Today I decided to join the droves trying out hoary. I would love to say it was simple seamless experience, but it wasn't.



Not that it was particularly painful find you, just a couple of little annoyances.



Firstly SATA didn't quite work for me. My BIOS has somethign called "combination mode", which seems to make the SATA disks appear like normal ATA disks as well as SATA disks. Which confused the hell out of the kernel. By setting it to "Normal" mode in the BIOS this problem went away.



The other problem was buggy media. The CD seemed a bit scratchy but after retrying about 5 times it finally worked.



Anyway seemed to work and let me get at a terminal. I haven't got rid of the GNOME stuff and installed ratpoison yet, but this will mainly be a remote

login box anyway, so I don't care too much about the GUI.