Search Results: "tar"

12 June 2007

Michael Prokop: Error handling: ENOSPC

Hopefully fuzz testing is well known nowadays, right? But did you check how smart your software can handle ENOSPC - the ‘No space left on device’ error? I like stress testing software (to be honest: no, not really). Yesterday I debugged a problem regarding zsh history writing on ENOSPC. Usually I use the grml Linux live-cd for stress testing (often running inside Qemu, Virtbox, VMware,…) like in:
dd if=/dev/zero of=/tmp/home.lo count=1000
losetup /dev/loop1 /tmp/home.lo
mkfs.ext3 /dev/loop1
mount /dev/loop1 /home
mkdir /home/grml
chown grml: /home/grml
Now after restarting the shell session of user grml I can play with ‘No space left on device’ situations. (Notice: I adjust the count=… according to what type of application I want to test.) Too many applications don’t really cope with the ENOSPC situation. Firefox for example is very funny, depending on the situation it either just segfaults when trying to start up, or decides to not start up at all and just exits with ‘1′. See the relevant strace output:
mkdir("/home", 0700)                    = -1 EEXIST (File exists)
access("/home", F_OK)                   = 0
mkdir("/home/grml", 0700)               = -1 EEXIST (File exists)
access("/home/grml", F_OK)              = 0
mkdir("/home/grml/.mozilla", 0700)      = -1 ENOSPC (No space left on device)
access("/home/grml/.mozilla", F_OK)     = -1 ENOENT (No such file or directory)
exit_group(1)                           = ?
Opera also just exits when already running and receiving an ENOSPC - I encountered data loss (for example the transfer history got lost) more than once. Very "funny" to see how applications like dillo, joe, wireshark,… behave in the ENOSPC situation. Not. Oh, your application handles ENOSPC just fine? Then continue testing with read-only filesystem, using NFS, removing files randomly,…

MJ Ray: Views on spelling and textarea Sizes

Update: Debian, and other stuff writes about A solution for a better spell checker in firefox : a better editor Joey Hess commented:
"I'm suprised that noone has mentioned how to get a text area to fit the whole width of the browser window, no matter what width it's set to (I prefer approximatly 60 characters wide sometimes, and nearly 120 other times..): Just put width: 100% in a stylesheet for the textarea. Unfortunately I don't know a good way to dynamically scale a textarea vertically."
That's container-width, which is not window-width for my site, but I'll give it a go.

11 June 2007

John Goerzen: "You just never know when you're dealing with rodents"

The day after Memorial Day, when I got into my car, it reeked. A strong, foul odor greeted me that morning. It had rained a lot during the long weekend, and I hadn't driven the car. I figured it was just some water sitting somewhere. It ought to evaporate soon enough. The smell seemed to be coming from the vents, so I figured I could help it evaporate by running the fan as much as possible.

I've been dealing with the smell ever since then: windows open, fan on full blast, as often as possible.

This morning I noticed a chewed Kleenex with rodent droppings attached to it in the glove box. I also noticed Kleenex bits and more rodent droppings on the floor mat below the glove box.

So I have a more sinister enemy here.

I dropped by the mechanic over lunch to make an appointment. I explained the symptoms. He looked as me suspiciously.

"But how would a rodent get in there? Hmm... I forget -- do you live in the country?"

"Yes, I do."

"Oh, well that would explain it then."

It reminded him of other rodents he's done battle with -- pack rats that have chewed up wires and hoses, including one that was still alive and in the vehicle when he started working on it.

So I asked him how expensive this was going to be.

"Well, I don't know. It could be easy, or it could be interesting. You just never know when you're dealing with rodents."

He promised to call me if it looked like it might be interesting.

David Moreno Garza: Injured

I’m injured. Yesterday, Raquel and me were fooling around and playing, so in the middle of the play, I knelt down, grabbed her legs and put her lap on my left shoulder in order to lift her. So I did. After carrying her and she screaming “put me down!”, I tried to avoid her from hitting some thing on the ceiling, so I bent to one side wildly, with her still on my shoulder and back and then I felt an awful jab and pain on my back and the whole thorax started to hurt. So, I asked Raquel, who was already safe on ground, to press my thorax in a way to stop pain. It didn’t work out. As we were on our way to the supermarket, driving was painful, even lifting my arms, heavy breathing, etc. When we came back home, I laid in bed for resting and TV watching, but most of my moves were still painful: around 3 hours after the first pain. I could barely sleep, I couldn’t stay on the same position for a while, but had to change to some other, and it was still painful. At around 3 am, I could sleep a bit better. When I woke up at 7, the pain was still there, but it wasn’t that hard; she woke up and went to the gym. So, I’m resting in bed with a back pain, on a Monday morning. Raquel went to the office after she came back and I feel like an old grandpa. I will only go see the doctor if the pain is not handleable by tomorrow morning, otherwise I will only spend money that we don’t currently have on drugs and on the doctor’s invoice, and I don’t want to; as stupid as this may seem, I don’t trust doctors. I hope I will be OK by tomorrow and ready to leave to DebConf on Saturday morning.

Remi Vanicat: A solution for a better spell checker in firefox : a better editor

I’ve recently complain here about the iceweasel Spell checker, and the fact that it is less effective than Aspell for proposing correction for French misspelled word. I also lake the nice key binding for correction available in Emacs with flyspell. There seem to be a solution to all my problem, and it is a comment made by Josh Triplett on the MJ Ray blog that give it to me: the It’s All Text Firefox(and Iceweasel) extension give me the possibility to use my preferred editor for editing text in edit box (and yes, it is editor agnostic: you can use vi, vim, or even ed). So, thank you Debian planet, MJ Ray and Josh Triplett. I now have to try it to see if it’s really effective.

David Welton: Dunbar's number and online communities

It's widely known that online communities tend to follow a certain pattern if they are successful. They get larger, and beyond a certain point, they start degrading. Slashdot, digg, reddit, usenet - there are countless examples. My idle thought for the day: how might one go about reconciling the vastness of the internet with Dunbar's number.
Dunbar's number, which is 150, represents a theoretical maximum number of individuals with whom a set of people can maintain a social relationship, the kind of relationship that goes with knowing who each person is and how each person relates socially to every other person.
The ideal system would work to expose you to all the new and interesting things you can find only by interacting with a large group of people, yet keep the actual community aspects (comments, for instance) small, in order to facilitate happier, more interesting and productive communities, rather than the vicious circle turd-flinging matches that a lot of popular sites seem to descend into. I don't have a clear idea of how that might be accomplished at a practical level, but the idea interests me as a way to create something that grows a lot, yet doesn't become unpleasant.

MJ Ray: Views on textarea Sizes

Matt Palmer wrote:
"Aaah, OK. I have no idea whether [pingbacks] work or not; they're deeply in the black magic category -- never used them."
They're just a remote procedure call. Shouldn't be black magic at all, but a surprising number of blogs seem to do them brokenly, while supporting the more complicated (but just as spammable) comment and trackback systems. On size:
"40x20 would be a good size for me. I'm not sure why people would complain that the comment box is too big, unless perhaps it interfered with the good layout of the page."
I don't think it interfered with the layout. I'll increase the size again Real Soon Now. Josh Triplett commented:
"For me, the size of the edit box doesn't matter much, because I don't use it. I just click the little "edit" button next to it that the Firefox^WIceweasel extension It's All Text provides, and then type my comment in Emacs. :)"
James commented:
"I use the resizeable form fields extension so I don't have a problem with small textareas, but http://www.sabadelli.it/edoardo/projects/javascript/form.element.resize has a script that'll make it resizeable for everyone."
Well, everyone who lets web site scripts use their CPU and electricity... Thanks for all the helpful comments.

John Goerzen: Tourists

Today as we were getting ready to head out, Terah said to me, "There are people on our yard with cameras and I don't know who they are!"

I looked out and they looked friendly, so I went on out and said hi.

I'm glad I did, too, because these weren't just any random people with cameras. The group included Ed, who grew up in what is now our house. He's probably in his 70s or 80s now. His wife, son, and daughter-in-law were along, too. They had all driven up from Oklahoma and wanted to see the old farm. Ed's family had sold it to my grandparents back in the 40s.

They apologized for tresspassing. I told them, "I don't mind as long as you share a few stories."

Ed told us that he remembered the second story and kitchen being added on to the house when he was about 10, shortly after it was moved to its present location. He remembered his dad building the elevator that still stands on our property. It is quite the marvel of engineering and craftsmanship. I learned that its first power source was an engine from a Model T.

Ed kept looking at the house smiling. A few years ago, maybe 2 or 3, he got to see the place for the first time in 40 years. But it wasn't doing so well then already. He said we had done a wonderful job restoring it. He remembered, back before there was a sidewalk, sitting on the porch letting his feet dangle in the mud. Or sitting out there Sunday evenings making ice cream.

I invited them to take a quick look inside. They politely declined, not wanting to impose. Terah and I assured them that it would be fine, though we did need to leave in a few minutes. They came inside and Ed started describing the place to his family.

He pointed to the oak floor in the living room. "Is that original?" I told him, "Yes, it is; we added on about 2 feet to it but the rest of it is original." He said that he helped lay that floor. I asked him something I had been wondering for awhile: did they put the oak floor on top of a pine floor? He smiled and said, "Yes, we sure did!"

We came to the office. He asked if the wood ceilings were original. Yes, I told him they are. He confirmed what I had heard about the reason for a burned spot on the office floor: that someone had opened a wood stove and a live log fell out. He also asked if we had taken out the chimney. Yes, we did, but we saved the bricks. "Ah! We had a chimney fire in there one time! We all thought the whole house might burn down." I told him that the bricks still were marked from that.

He told me of one time he was standing on the north side of the house, idly throwing stones at it. His sister was playing piano at a window, in what is now the office. One of Ed's stones went through the window and hit her (but didn't hurt her seriously). "Boy did I ever hear about breaking that window!" One of his relatives asked, "What about hitting your sister?" "Well, that wasn't as bad as the window."

This isn't the first time something like this has happened. It's really neat to hear stories about the place and learn about its life before it came to be in my family.

I was glad I went out and said hi to our visitors instead of ignoring them or chasing them off.

Good things can come from strangers sometimes. I think I'm going to gather up a batch of photos and send them to Ed and his family, along with a few questions for them!

Joey Hess: unpacking boxes

A few people have asked what I meant in my "boxes" comic. Other just look at me strangely. Some hackers have enjoyed the comic, so I thought I'd try to unpack the meaning of it a bit for the layperson. Of course this will spoil the joke, but what the hey. A hacker who looks at the comic probably thinks about things like recursion, fractals, unicode, fonts, and bugs. fonts A font is how the computer knows how to draw the letters on its screen. Before computers, a font was a bunch of metal bits that could be arranged and fed into a printing press. As with most things involving drawing on a screen, font technology is much more complicated these days than you'd ever imagine. Fonts and the programs that draw them (font engines) are something of a mystery even to most hackers. unicode Unicode is an absurdly complicated version of the alphabet. Or rather, of every alphabet and similar thing used by anyone on earth or in Star Trek. It's not a font, it's a way for the computer to store text internally, by basically assigning a unique number to each letter. Since most hackers grew up in a world without unicode, and suffered through the (still continuing) transition to it, they're familiar with lots of quirks and weird and broken behaviors you get from it. One of these quicks is what to do when the computer wants to display a particular letter from unicode, but that letter is not available in the font. Since unicode contains effectively an infinite number of symbols, and each symbol in a font is carefully crafted by hand, this occurs pretty often. Handling of this situation varies, but often the computer will just display a little empty square box for the letter that it doesn't know how to draw. Some font engines go a step further and write the number of the unicode character in little tiny numbers inside the box. Presumably so that a hacker can look at it and tell what character is missing. The numbers are typically written one in each corner of the box, and you'd have to squint to see them. fractals A fractal is a special kind of picture, where parts of the picture repeat over and over at different scales. You've probably seen pictures of the most famous fractal, the Maldebrot set. That one is generated by a kind of formula, but there are much simpler ones, like the Koch snowflake. Hackers love fractals, because they're pretty, and complex, while based on very simple math. recursion "Recursion: See recursion." Ha! That's the best hacker joke ever, a true classic. Recursion is when the computer sees an instruction like that and mindlessly repeats it over and over. This actually turns out to be useful, and hackers see a kind of beauty in it. bugs Bugs are what happens when a computer program, which is supposed to be internally clear and simple, and have well-defined behavior, instead turns out to exhibit unintentional complexity. Kinda like a fractal. This begs the question of whether hackers like bugs, or not. Most of them spend most of their time creating more, so you be the judge. The bug I'm alluding to in the comic is this: What if the computer, when drawing some word, stumbled over a unicode character that was not in the font. And then say it went to draw the little box instead, and fill in the numbers to indicate what character it was. Except it turned out that its font didn't tell it how to draw the numbers either. And thanks to a really unlikely bug, it then proceeded to recurse, drawing smaller and smaller boxes for these characters that it didn't know how to draw. Until it drew a fractal instead. See: It's just hilarous once I've explained it. (And that explanation of the word "cat", by the way, is why I don't try to write most of the technical posts in my blog in a form that a layman could understand.)

10 June 2007

loldebian - Can I has a RC bug?: I has supercow powerz

I has supercow powerz I has supercow powerz.

Pierre Habouzit: git 1.5 on alioth

thanks to Rapha l again. git gc, nice hooks, branch tracking, ... all this is yours. Now that git-gc is on alioth, as alioth has a gitserver (and hence provides a not dumb transport like http), please run git gc from time to time so that repositories keeps beeing small (hi XSF ;p) FWIW I also will maintain git-core backports on bpo starting ... now. [sorry for the closed comments, I can't stand spam on my blog anymore]

Joachim Breitner: Arrived at DebConf7

After about 18 hours of public transport, I arrived tired but savely in Edinburgh. Chairs in DB night trains are not the same as chairs in CityNightLine trains, but if you have only two people in a compartment, you can atleast spread out on three seats. I still didn t get too much good sleep. The Eurostar train from Paris to London behaves as if it were a plane: Long queues before check in, security and passport checks. The benefit of taking a train (hassle-freeness) gets somewhat lost there, and it feels as if it was the marketing department s descision. The train itself is comfortable and has power plugs nice.In London I had to take the underground from Waterloo International Station to Kings Cross. If I had bought a simple one way ticket paid in cash, they would have charged me 4, but with the so-called Oyster-Card, it s only 1.50. But please, if you put ads and leavlets for that card all over the place, mention somewhere that the card itself is basically free! Well, I had to ask to find that out and got myself the cheap ticket.The train to Edinburgh was not different to German trains, besides the fact that it offered on-board wireless network. Pricy, but still reasonable, and not entirely secured.In Edinburgh I tried to go to the hostel first, but walked too far and ended up in Teviot, where the DebCamp is happening, just in time for Dinner. My first brief impression of Edinburgh is: Massive, Dark, Old. Not bad! Also the room I m sitting in right now, the Hack Center, looks lik an old curch, with coloured glass and a balcony around it.

MJ Ray: Please Stop Abusing the Redways

There are 1988 and 1989 papers by Cyclecraft Author John Franklin about poor accident records of the Milton Keynes Redways which are often cited by cyclists as showing why cycle facilities are dangerous or "farcilities". But I grew up riding the Redways and I think the closest I came to seeing a Redway-caused injury was when we accidentally rode onto an under-construction stretch by mistake and met a road roller. I journeyed to work all the way along the north-west edge when I was employed in MK one summer. (The cross-city Redway I used was fairly quiet on the journey to work around 0700 but quite busy on the return - looked like "school run" traffic.) I lived three miles from the MK boundary for a decade and so I've had some time to think about this. I think condemning the Milton Keynes Redways as dangerous farcilities is simplistic and misguided. Here's why: Milton Keynes was one of the first English cities to have cycle routes designed in from the start. This means that there are cycle tracks of types and in spaces that we hadn't seen before. Where else did you get a network of both low-friction surface high-speed cycle routes with sweeping bends and grade-seperated junctions and connecting routes to every estate? How many places have that added since? Almost nowhere. Milton Keynes is a massive cycle track experiment. In the 1989 paper, Franklin comments that it was "constructed with few limitations of space or finance" which simply doesn't ring true - the experiment didn't go completely to plan and the "secondary grid" of Redways between district centres mentioned in the 1998 paper has simply never appeared. Nevertheless, there are things that work amazingly well, but there are others which are now obviously stupid, like not protecting the sight lines at some junctions and putting late-80s estate routes alongside feeder roads, where they have more frequent and busier level junctions. I believe some of the London data also suggests that the non-separated junctions are one of the three most dangerous places, which suggests that Milton Keynes is not a cycle track advocate's perfect design in the first place. I'll continue to explain what else I disagree and agree with from the Franklin articles over a few more posts. If you have comments about the Redways or these articles, I'd like to hear them: please use the comments form at the bottom of my page.

Chris Lamb: Sudoku solver in PostScript

There seems to have been a bit of fuss over this Sudoku solver implemented in SQL. In Easter 2005, when Sudoku fever kicked off in a big way in England, my Dad started writing a solver implemented in PostScript which I then modified so that it could perform backtracking. I also wrote a C# solver for my phone around the same time and later sneakily won a competition with it - I am now barred from entering competitions in that paper. Anyway, here is an example PostScript board (PDF version). It was labelled “Fiendish” in The Times. The board can be easily changed at the top of the PostScript file. NB. Best results are achieved if you view the PostScript directly in a viewer such as gv or GSview as you actually see the process of backtracking in solving the puzzle, the recursion depth and the set of possible symbols for each square — most PDF viewers are terrible at displaying the process as they seem to render inside the wrong thread. (In terms of solving the puzzle, we both found that by enforcing the simplest constraints and then ‘guessing’ was far easier and more efficient than performing any of the complicated constraints typically employed by human solvers. I’m certain I am not the first to notice that attempting to emulate the brain’s method of solving a problem is usually a short-sighted approach for a computer.) There are few other goodies in the file: replacing the final autotest with autotestR will recurse using the right-most possible symbol - if you get the same board with both of these then the initial board has a unique solution. Also, if you can get your hands on a true PostScript printer, printing the file will mean the puzzle is solved in hardware. Enjoy :) . I’m looking forward to DebConf7! UPDATE: Added PDF version.

Gustavo R. Montesino: btsutils 0.1.1

I've recently released the first version of btsutils, a python module to interact with debbugs servers (such as the Debian Bug Tracking System). The btsutils is part of my Google Summer of Code project, the bug triage and forward tool.

Currnetly, the btsutils can query the bts based on bug number, source package, package, maintainer or submitter.

A Debian package of btsutils 0.1.1 is already waiting to be processed on the NEW queue.

Some useful links:

Kai Hendry: Debconf7

Tech team Trip involved a lot of waiting. I arrived too early at London City Airport. It was really easy to get to from Tower Hamlets, so there are some advantages living in East London. Since I am of Scottish ancestry and it is the first time I am in Scotland, I was almost hoping for some welcoming party. Sadly, nothing of the sort and I ended up waiting at Edinburgh Airport for another DD, however his plane was late. Thankfully I discovered the multi-denominational “Prayer room”. After visiting some amazing mosques on my travels, I know it is quite permissible to go in a Islamic mosque and take a little nap, which I did. I wish they made Christian churches a little more comfortable in that respect. Laying down on the floor of a typical Western church and admiring the architecture would probably be bad for one’s health. Ok, I’ve started tagging debconf7 on my flickr uploads during my time here. I wonder if Aigars will do the same. ;) Edinburgh reminds me a little like Calcutta, with the soot stained buildings. Teviot house where the debcampers are is a great building. Up the road near a mosque was a cheap Indian eatery. I had a great chicken curry, nan and pakora. Fantastic.

Christine Spang: And Straight On Til Morning

My internal clock is finding it hard to believe that it’s light outside right now, which might have something to do with the fact that I’m sitting in Shannon, Ireland. Since I only got maybe two hours of sleep on the plane, I wonder if I’m going to crash horribly later today. I haven’t flown internationally since 2000, so I was a little paranoid about it being a horrible nightmare, but so far it hasn’t been. I haven’t managed to trip any metal detectors yet, though I did accidentally leave my laptop in my bag when I sent it through the scanner at Logan. The security people were nice enough about it, however. I’m not carrying much in terms of carry-ons, so things have been smooth. I completely forgot that “long-haul” flights serve meals. Aer Lingus has a standard meal offering consisting of “chicken” or “beef”, neither of which are very good for vegans. Apparently if you call their reservations office in advance of your flight you can order special meals, of which vegan vegetarian is an option. But I definitely don’t remember this being mentioned at all (or at least very prominently) during the booking process, so I never thought of checking. I had just written off being able to eat the airline food and brought granola bars and snacks. Apparently this was a wrong assumption. I was originally going to FlyGlobespan, but ended up changing my mind after experiencing their entirely broken website which didn’t allow me to make a booking, and waiting a week for a response to their “feedback form” and never getting any, all the while watching their fares creep up as every day passed. Luckily the flight I ended up getting wasn’t too much more expensive, and even allowed me the flexibility to fly into London and out from Glasgow, making it easier to accomplish my plans of visiting Dafydd Harries, Hanna Wallach, and Matthew Garrett in the “other” Cambridge before ending up at Debconf!

Evan Prodromou: 20 Prairial CCXV

What a great day. The weather in Montreal has been fantastic the last few days -- we've had sunny, hot, clear days with showers at night to clean up the air. It's been really spectacular to be out. Of course, this is the time of year that Montreal really shines -- festival season. It kicks off this weekend with the Grand Prix du Canada, which includes a giant party in the downtown area, on St. Laurent, and in the rest of the city as well. In my neighborhood (old and new), we have the Nuit Blanche sur Tableau Noir, a street fair that closes down av. Mont-Royal for auto traffic from June 7 to June 10th. There are huge murals painted on the street itself, and every business, retail outlet and restaurant expands onto the street, while people rove up and down all day and all night. And soon we get the International Fireworks Festival, which kicks off in only two weeks. One of the hallmarks of summer in this city is that just about every Wednesday and Saturday there's a gigantic fireworks show on le Ste. H l ne, at La Ronde amusement park. You can see the lights all over the city, and feel the thumping in every house and bar. It's disconcerting and awe-inspiring. We've already started having Piknic lectronik events, with another going tomorrow. Wow. tags:

SXSW talk online So, my talk at South by Southwest 2007 is now available online as a podcast. You can get the audio at the sxsw.com site and you can follow along on the OpenOffice.org or Powerpoint slides at Talks/SXSW07. I liked listening to this recording, although I realize that I need to do some speech practice for future talks. I say "ummmmm..." after every sentence in this talk, which would probably drive me crazy if I were listening to it. I'm surprised that the applause at the end is so strong -- I'd probably have thrown food at this guy. tags:

Wikimania On that note, I'm glad to point out that my and Maj's talk for Wikimania 2007 was accepted. I guess that means we'll be going to deliver it in Taipei. The subject is Extending wikis with social networking tools. We're going to cover Wikitravel Extra: our motivations for it, implementation issues, and results. It's going to be pretty interesting. tags:

Russell Coker: submissions for LCA and other conferences

In this post I recommended that job seekers not publish their CV. In a comment Gunnar suggested having a special CV for conferences. I think that Gunnar’s idea is good and have started writing my conference CV at http://etbe.coker.com.au/conferences. When I complete it I will make it part of every submission for speaking at a conference. The LCA 2008 call for presentations is now open. One of the most interesting, noteworthy, and slightly controversial items is the suggestion that people submit a video. I think that the video submission is a great idea, either a video or testimony from audience members from past presentations should be required for all submissions (NB I’m not involved with organising LCA2008 so my opinion means little in this regard). The reason is that I have attended many presentations which fell far short of their potential due to poor speaking skills. I’ve been to great presentations by people with strong accents, by people with speech impediments, by people who are incredibly shy, and by people who just don’t have a clue about public speaking. However my observation is that if a speaker has more than one of these disadvantages then the presentation is likely to fail. I have previously written at length about how to give a good presentation to a technical audience (such as is found at LCA). Dave Hall blogs about Should I do a presentation at LCA 2008. He mentions lack of a web-cam as a disincentive, but I am happy to lend him my digital camera (which makes really high quality movies) to solve this problem. In fact I have considered recording some short Linux talks at the SGI office during lunch breaks (Dave and I both work for SGI). Dave also mentions a nightmare scenario about a laptop not working with presentation hardware. My post about getting laptops working for presentations will hopefully help some people in this regard. I’m not sure if I’ll make an offer for LCA this year, I haven’t been doing much cutting-edge work recently. Maybe I’ll just offer some talks for mini-confs, I could probably get several offers accepted by mini-conf organisers if I try.

Russell Coker: putting HTML codes and other special characters into a blog entry

I often want to write blog posts about HTML code and about source code in various languages. One problem I have is that the characters I want to use have special meanings (EG < and >), another is that I indent source code to make it readable and I don’t want the spaces trimmed from the start of lines. I initially wrote a simple Perl script to replace characters such as < with HTML codes. I then had to extend it to escaping quote characters because Wordpress tries to get smart and change quotes in a way that might look nice when dealing with plain text, but is just a pain when dealing with code. The next problem I had is that when I used the <PRE> tag around some text to preserve the white-space Wordpress would double-space the text (IE insert a blank line between every two lines of code). This was annoying when reading it and in some situations would change the meaning of the code! The solution I have found to these problems is to use the below script and not use the <PRE> tag. Also I tried using the <CODE> tag, but it made no difference to the end result as far as I could see. The below script is what I am currently using. It is working well with shell scripts, HTML, and XML so far. Update: The way that -- is munged by Wordpress to – is something that I find particularly annoying. I already had this in the script but forgot to mention it in the post.
(more…)

Next.

Previous.