Search Results: "don"

2 September 2007

Joey Hess: apache cgi fork bomb

Like Russell Coker I had to deal with an apache OOM crashing my main Xen instance yesterday. In my case, it is due to the Czech IP 88.102.6.114, which decided it would be a good idea to download the entire output of viewvc, recursively, and apparently also in parallel. After 2 hours and some 40 thousand hits, this eventually started enough instances of viewvc and svn that it used up 512 mb of ram and OOMed the system. I don't have a satesfactory fix yet. Viewvc shouldn't let itself be run dozens of times simulantaneuosly, surely. Apache doesn't seem to provide a way to limit the total number of CGIs it can launch at once, except by limiting the total number of connections. Apache's rlimitnproc option sadly only applies the limits after starting a CGI, rather that applying them to apache itself. Something that could control the number of CGIs started on a per-directory and per-vhost basis would be ideal. For now, I used ulimit -u when starting apache, which prevents many viewvc processes from running at once, but allows anyone who DOSes viewvc to also DOS all other CGIs on the system.

Antti-Juhani Kaijanaho: A tiny program

Written to count votes with the d’Hondt method, released as a single C99 source file. I know I know, why did I write it in C? Well, because I felt like it. Now you don’t have to ask that question in my comment space in a rude manner :)

Bernd Zeimetz: debconf7 flashback

debconf7 flashback Somehow I didn't find the time to blog during the last weeks, so there's a lot of stuff on my blog todo list. But let's start with a little flashback , back to Debconf7 in Edinburgh. Yesterday I got a film back from the lab with photos I've taken during the daytrip-day. As a few of you probably realized I was not on the train/boat to the island in the west, mainly because Andreas (afit), Julian (codemonk) and me decided to spend the day in Ediburgh, not only for some geocaching fun but also to see a bit more of this beautiful town and area. We've also been up on Arthur's Seat, Edinburgh, where I took this panorama: Creative Commons License It will be published on placesofinterest.info, which is currently in public beta state, but definitely worth a look (just don't use IE, but I doubt you use non-free software, right?). I'll blog more about placesofinterest.info as soon as the page is finished. As usual, the pano was created with the help of The Gimp, hugin and enblend. The only commercial software involved was the software for the Imacon scanner at university. Original resolution: 24044×2551 pixel, stitched from 14 slides. If anybody is interested - large format prints for Debconf participants are available for the cost of paper and ink.

1 September 2007

Russell Coker: A New Spam Trick

One item on my todo list is to set up a bunch of email addresses on sub-domains of domains that I am responsible for (with the consent of all people involved of course) and perform various actions to get the addresses noticed by spammers and measure how effective the various anti-spam measures are. As part of such tests I would click on every URL in every message sent to some accounts and see what difference it makes. My plan is to run a set of Xen virtual machines with different configurations of some common anti-spam measures used in MTAs and see how they fare with sets of accounts with similar publicity. I am not aware of any work having been done in this area (a quick Google search turned up nothing). There are many honeypots for tracking spam sources, matching email address harvesting to spamming, etc. But I’m not aware of any research into the effectiveness of various methods of combatting spam by setting up multiple honeypots. Please inform me via comments if I have missed something! The most common advice about spam is to NEVER click on the URL that supposedly removes you from a list. By clicking on such a URL the spammer can recognise that you actually read the email and therefore know that it’s a live address and a good target for more spam. I am not aware of any good studies proving this, which is why it’s one of the things I’d like to investigate. A counter theory (for which there is also a lack of evidence AFAIK) is that spammers used to measure delivery etc but now that bot-nets are large and cheap it’s easier to just send mail to all possible addresses. Even though I am not aware of any great evidence to support the idea I avoid clicking on URLs in spam messages. Refraining from hitting the spam web-sites can’t do any harm (it’s not as if the meager contribution to their system load caused by my web browser will cause them a problem). But today I was tricked. A spammer subscribed me to a mailman mailing list, as I am subscribed to many lists (about half of which use mailman) the fact that I didn’t recognise the list name didn’t necessarily mean that I hadn’t signed up to it. After signing in I saw the list archives which had only one post concerning spam. I unsubscribed (there was no other reasonable option open to me) and sent the mailman message to SpamCop. This technique will probably be effective for a while. People will think that they subscribes to a list and forgot about it and that it’s just another list that doesn’t have strong anti-spam measures. That should greatly increase the amount of time taken to black-list the spam server. So from now on if I receive a spam via a mailing list that I am not familiar with then I’ll send it to SpamCop immediately. Also this is yet another good reason for not subscribing people to mailing lists without their consent (a practice that is far too common - it’s really not difficult to send someone an email asking whether they would like to join the list). If you subscribe me to a list without prior discussion and the first post I receive on the list is a spam then it will be sent to SpamCop and this might result in you being black-listed.

Erich Schubert: Postfix under siege

Many people will have seen their postfix reporting new errors these days, like if is overloaded:
postfix/master[7287]: warning: service "smtp" (25) has reached its process limit "100": new clients may experience noticeable delays
This is not really because your system is overloaded. To me, it looks more like a (deliberate?) malfunction of some spammers software. When you rejected it's spam mail a few times, it starts opening up lots of connections to your system, but never sends any data. They just sit there and time out.The solution is simple: limit the number of connections per client. Make sure the 'anvil' service is enabled (default at least on Debian) and then add
smtpd_client_connection_count_limit = 10
to your postfix configuration.You should now begin to see messages such as
postfix/smtpd[21680]: warning: Connection concurrency limit exceeded: 11 from unknown[210.210.247.52] for service smtp
A corean cable IP. Yeah, I don't think this would have been legitimate mail traffic anyway.Feel free to pick the limit value even lower than 10 on really busy systems (or if these 'attacks' become stronger) - most people should never need more than 2 parallel connections (note: you can send multiple emails over one connection, there isn't much to be gained by using more than one connection).

Daniel Stone: woo firefox

6124 daniels 15 0 2109m 1.5g 18m R 1 75.4 426:30.01 firefox-bin
3000000 1486 74 1 5808 962 1427069K 60K 1427129K 6124 Django Model reference Django Documentation - Mozilla


I honestly don't understand how Firefox could consume 1.5GB of RAM, as well as 1.4GB of pixmap storage in the X server. This is a new record. (And the pixmap storage rose to 1.7GB before I killed it.)

Russell Coker: Hot-swap Storage

I recently had to decommission an old Linux server and replace it with a new machine. When I was about to turn it off I noticed a power cable of the type used for IDE hard drives leaving the Linux server and entering an NT server that was in the same rack! It turned out that a DAT tape drive used for backup had been shipped without a power cable and they had been forced to take power from another machine. Incidentally is this likely to risk hardware damage? So I had to take the NT machine down to fix it. The new cable had arrived so all I had to do was install it. One thing that wasn’t mentioned on the documentation was that the cable was designed to operate as a double-adapter and replace an existing cable. Once the phone support people had explained this (IBM support is really good - they solved the problem well within the SLA) I was able to correctly wire it. However correct wiring in this case meant having a power cable go through the side of the storage bay and a SCSI cable came from the back of the case underneath the cooling fan assembly (something like 16 separate hot-swap fans in one assembly that can be removed for maintenance). The DAT drive took up space that could otherwise have been used for three hot-swap SCSI hard drives. What I would like to know is, why can’t they make hot-swap DAT drives that use the same power and SCSI connectors as the hard drives? I don’t expect a DAT drive to be any more reliable than a hard drive, and when the system backup is mission-critical then down-time is required for a replacement. Not to mention the effort involved in the installation, my fingers are significantly longer than average, I can’t imagine how anyone with average size hands could complete the job! So IBM, congratulations on the great phone support. But please try and make everything hot-swap when designing servers. Also while on the topic, I think that servers should be designed with external DVD drives connected via USB. I really hate it when I’ve got 10 * 2U servers in a rack, my system performance is limited by the number of disks and every single server has space that could be used for at least one disk sitting idle because there is a DVD drive gathering dust. For the IBM 2U servers in question, they could design them with space for 12 disks or 9 disks and one DAT drive which were all hot-swappable if they were smart about it, the current design supports 6 disks or 3 disks and a DAT.

Guido Trotter: Ganeti

Just a couple of days ago we finally opensourced Ganeti, a cluster virtualization platform based on Xen. In the last few months I joined the Ganeti team, which is based in Zurich, and worked with them on the development of this software! I’m really happy now to be able to share the result of what we’ve been doing with the rest of the world! For more information you can have a look at the project page! Of course an ITP has been filled! (ok, actually two because I didn’t notice someone in my team had already done one!) PS I’m away for the weekend, forgot my charger and am running out of battery! I’ll be back online on monday, I guess! :)

31 August 2007

Simon Richter: Carbon emissions

Russell thinks that trading emission "rights" individually would decrease emissions. The global emission market has shown quite the opposite happening, countries that have no industry and did not contribute to the problem now sell their rights to industrial countries, with the net effect being as if all these countries suddenly became industrialized over night. I don't think anything different would happen at an individual level. The fundamental problem is this: emission rights trading happens only when buying rights is cheaper than actually reducing your emissions. When this is relatively cheap, you remove any incentive to develop better processes in individual companies; if it is more expensive, most industries will remain at the status quo (no emission trading) while those where it still makes sense fiscally now have an alternative, which diminishes the market for technology companies specializing in filtering technology and process optimization (i.e. it becomes even more expensive to behave environmentally conscious). At the same time, the cost of buying these rights from individuals will be passed on to the consumer, the only way to get this money back will be to sell off their emission rights. From a macroeconomic perspective, no money ever changes hands, but you have effectively transferred the individual emission rights over to the industry. Looking at individuals, you are penalizing those that behave environmentally conscious and neither use their "rights" nor sell them. So, emission rights trading is a really bad idea.

Pierre Machard: Install Debian on Dell Vostro200

Recently, at work we changed our desktop computers. I’ve been faced to difficulties with a Dell Vostro200. Vostro had no OS. The hardware is still very recent. After 2 days I finally succeed in it. : The content of my box : (lspci and lspci -v).

migus@dazibao:~$ lspci
00:00.0 Host bridge: Intel Corporation 82G33/G31/P35/P31 Express DRAM Controller (rev 02)
00:01.0 PCI bridge: Intel Corporation 82G33/G31/P35/P31 Express PCI Express Root Port (rev 02)
00:19.0 Ethernet controller: Intel Corporation 82562V-2 10/100 Network Connection (rev 02)
00:1a.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 (rev 02)
00:1a.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 (rev 02)
00:1a.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 (rev 02)
00:1a.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 (rev 02)
00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02)
00:1d.0 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 (rev 02)
00:1d.1 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 (rev 02)
00:1d.2 USB Controller: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 (rev 02)
00:1d.7 USB Controller: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 (rev 02)
00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 92)
00:1f.0 ISA bridge: Intel Corporation 82801IR (ICH9R) LPC Interface Controller (rev 02)
00:1f.2 IDE interface: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 4 port SATA IDE Controller (rev 02)
00:1f.3 SMBus: Intel Corporation 82801I (ICH9 Family) SMBus Controller (rev 02)
00:1f.5 IDE interface: Intel Corporation 82801I (ICH9 Family) 2 port SATA IDE Controller (rev 02)
01:00.0 VGA compatible controller: ATI Technologies Inc RV516 [Radeon X1300/X1550 Series]
01:00.1 Display controller: ATI Technologies Inc RV516 [Radeon X1300 Pro] (Secondary)
02:01.0 FireWire (IEEE 1394): Agere Systems FW323 (rev 61)
So let me explain how I did.
  1. First, I used a netboot. I downloaded a recent netboot.tar.gz (from Debian website). I downloaded a daily image and use a Netboot PXE.. Not all the netboot.tar.gz are working… (That is to say, that I am not sure that all daily snapshot are working). I used this tarball:
    http://migus.nerim.net/vostro200/netboot.tar.gz
    I tried to build my own netboot.tar.gz without success. IRQ conflicts always vanished the debian-installer. I wish I had included the lastest e1000 drivers in my netboot…
  2. I had a problem of network hardware (Intel e1000 included in vostro 200 is too recent). So
  3. I decided to plug the time of my install an old 10OMb/s Ethernet card (e100 with PXE).
  4. Very quickly I had IRQ conflicts that blocked the disk detection. (SATA Controller had timeout).
  5. I passed the following arguments to the install command line acpi=off  irqpoll  vga=791
  6. Everything went well. The installer finished its work. The box rebooted.
  7. I downloaded module assistant, kernel-headers, gcc : aptitude install module-assistant gcc linux-headers-2.6.21-2
    and the e1000 driver from http://sourceforge.net/projects/e1000/. I just run make install
  8. (for lspci I ran a update-pciids (8)).
Everyting work well since :-) Conclusion :
1) Install an old PCI Ethernet card with PXE
2) Install DHCP + PXE
2a) Find a netboot.tar.gz that work without freeze. (the tarball on my website works)
2b)Do not forget to plug your USB keyboard in the usb connector just bellow your ethernet connector. (If you don’t for an unknown reason, when you type on a key, Your box get it twice….)
3) Tune the installer command line : acpi=off  irqpoll
[let’s the installer worked]
4) Download e1000 driver
5) Remove your old PCI Ethernet Card.
6) Be happy
6a)If you want to enable acpi into your desktop, once you installed your system you can try acpi=noirq irqpoll.

Russell Coker: Interesting Ideas from George Monbiot

Here is a transcript of a lecture by George Monbiot about climate change and what we need to do. The latest scientific evidence suggests that we need to cut emissions to zero by 2030 to avoid significant increases in the sea level over the next century, George describes some options that will form part of a solution to this problem. Below are my comments on what I consider the most interesting (the ideas that I hadn’t heard of before), I recommend reading the full article for the rest.
  1. Have a carbon ration for each citizen. Wealthy people who want to use more resources could buy carbon rations from poorer people on an open market. That way people who use less than their ration still have an incentive to save more because the extra savings are worth money! As everyone would then have a financial incentive to reduce emissions there would be a lot of new development of methods and technologies for eliminating or compensating for carbon emissions, capitalism works!

  2. Build battery powered cars with interchangeable batteries. The idea is that you rent a battery from a fuel company, and whenever it runs low you go to a service station and swap it for a fully charged battery (for a small fee). If doing this the service station could use cheap night-time electricity to charge the batteries, and the batteries that are charged could be used to put electricity back into the grid at times of peak demand. A common idea is to have Prius+ type vehicles charge from the grid when not being used and then sell electricity back to the grid at peak times. Implementing such a system for millions of homes is technically challenging and expensive. But having a much smaller number of service stations sell larger quantities of electricity back to the grid is easier to manage.

  3. Reduce air travel by 90%. I wonder how much of this can be achieved by using high-speed trains for all national travel systems and for most travel within the EU. I have often travelled between Amsterdam and London by train, it’s much more civilised than flying.

  4. Classic quote from George on John Howard: “if Howard believes a slight reduction in consumption is a recessionary measure he ought to see what a total reduction of land area would be as a result of the melting of the west Antarctic ice sheet. The two things are just completely out of proportion..”

George Monbiot also has recently released a new book Heat: How to Stop the Planet from Burning.

John Goerzen: The Story of One Barn

img_2575

About 80 years ago, a Kansas family -- the Janzens -- built this barn.

About 60 years ago, my grandparents moved onto the farm. Their cattle were kept right here. I remember Grandpa's red tractor being parked in the barn.

So many memories have this barn in the background. We had a visit from one of the Janzens that lived here as a child. He had fond memories of this building. My dad and his siblings once played in the deep snow in front of this barn.

Here's one memory from those times:

078.jpg

That's my grandma and grandpa on their 25th anniversary in 1970. It was a working barn back then, so they probably weren't standing right next to it for this picture, if you get my drift. But they were on the yard.

About 25 years ago, Grandma lost her battle with cancer. At some point or another, Grandpa had eased out of farming, so the barn had a lot less activity. I remember exploring his outbuildings when I got bored at family gatherings. And I used to mow the lawn next to it every summer when Grandpa went off to be a cook at a camp. I didn't mind mowing next to the barn. But I always tried to go past one corner of the house as fast as I could, because there were wasp and hornet nests right there.

About 7 years ago, it was time for Grandpa to move off the farm. It was getting to be too much to keep up the old house, the barn, the yard, and deal with things like freezing water pipes and water getting in through the windows. He moved to an independent-living duplex in town. He was always worried about what would happen to the farm. Over the next few years, the farm would sometimes be vacant, sometimes have renters. Some renters did some work on the house, but the barn sat. Grandpa would eventually move into the nursing home because of his Parkinson's.

Two and a half years ago, Grandpa passed away. I shared some memories from Grandpa's place at the funeral.

But what of the house, the farm now? Renters went, and it sat empty. Nothing was in great shape, and the house needed a lot of work. Perhaps the whole place would be leveled and turned back into the prairie that it once was, or used as farmland. Perhaps someone would have an interest someday.

A year and a half ago, Jacob was on the way. Terah and I had occasionally thought of buying Grandpa's place, but we never talked about it seriously. We figured that we better finally decide what we're doing, before we have a baby around, or a child in school. So in April 2006, we went out to the farm and checked it out. The picture at the top of this post is from that visit. Terah and I checked out the house, the barns, the granary, the pasture, and the creek. As we walked past one of the barns, a pigeon flew out. Terah jumped with a shout. I grew up around barns and didn't really notice it. In the big red barn, besides Grandpa's tractor, we found some remnants from years ago: some old bales, corn cobs that raccoons had found long ago, several generations of electric fencers, old appliances.

And we decided to go for it and buy the farm. This was right at a year after Grandpa died.

The family always liked to get together for Easter. What would happen for 2006? Well, they decided to have a picnic out at the farm. It was vacant, and a bit eerie. Yet they knew that we were working on buying the place and moving in. All but one took a last look through the house before our renovations began. The one person who didn't was my great aunt, Grandma's sister. She said, "I haven't been in this house for years. I remember how it looked back then. I don't want to remember how it looks now, run down like this. So I'm not going in. But once you have it all fixed up, THEN I'll go in!"

In June of 2006, we bought the farm.

One month later, we lost this barn, and two other buildings, to a fire at our yard. This is what the beautiful red barn looked like that sad afternoon last year:

IMG_3630.JPG

As I wrote back then, nobody got hurt, the barn was insured, but "somehow, despite all these things, it still feels like we lost a little bit of Grandpa today."

2006 was a hot, dry summer. We had a patch of debris, then a patch of dirt, where the barn once stood.

7 months ago, Terah, Jacob, and I moved out to the farm. For the first time in 80 years, someone could stand in the farmhouse in the evening, look to the west, and see the colorful Kansas sunset over the pasture; the trees down by the creek; and even the neighbor's barn off in the distance. It was a beautiful sight, but it was also sad; that's not the view we had expected.

But then a surprise. This spring and summer, plants started coming up where none had grown for 80 years. But only where this barn stood -- not where the other two buildings were.

We watched as they grew tall. I'm sure decades of animals hanging out there were well appreciated by the plants.

As they grew, it looked like we might be seeing Terah's favorite flower: wild Kansas sunflowers.

And sure enough, they were.

Last weekend, Terah, Jacob, and I went out to the old barn. I took some pictures of its new appearance.

img_3429.jpg

This one stands where Grandpa's tractor used to be parked.

img_3401.jpg

And here we see a lifetime of flowers, from the old and withering, to the young just about ready to bloom.

img_3462.jpg

At the edge of the sunflowers, there's an old plow next to them. Though you might think it's barn-colored.

img_3411.jpg

Animals continue to be attracted to the area. Here's one of the smaller visitors.

img_3447.jpg

And here's a picture of almost the whole patch, right where the barn used to stand. I still mow right up to it.

I still miss the old barn. But somehow it still seems to be full of surprises and worth exploring. I wonder what next year will bring.

And I wonder if, a few years from now, Jacob will tell his friends about mowing right up to the sunflower patch, going fast to try to avoid any trouble with the bees.

30 August 2007

Steve Kemp: I gotta be cool relax, get hip

Fighting Spam Lots of people get spam and don't want to fight it themselves. Many of those people elect to use a service such as Google Mail, which does an adequate job of filtering most of the time. For people who wish to host their own mailservers, and off-load their anti-spam support to another entity, there are big companies such as MessageLabs. But if you can't/won't pay for somebody else how would you handle it? Right now I run my own mailserver and mostly it rocks. However I also manage a couple of servers for other people, and this mostly means that I have identical configuration(s) scattered across other machines. (Or as I recently discovered "mostly identical" setups scattered across N hosts.) After viewing a recent thread upon the forums of my employers I'm wondering how hard it would be to setup an anti-spam mail host. The idea being that users of domain example.org would continue to run their own mailserver (+optional POP/IMAP server). However this server wouldn't be listed in an MX record. Instead the MX record would point at the antispam server, which would then process and forward the mail on. (I'm assuming that the mailserver at example.org would be firewalled such that it would only accept SMTP connections from the anti-spam host). The only challenges I see would be: The last one is the killer point which makes me wonder if I'm wasting my time on the general case; I don't believe I could persuade people to pay for such a service (on the grounds that I wouldn't!) and if ever a mail were dropped I'd be the first person who would be blamed. And probably rightly so. The simple solution would be to always accept mail - but just tag it. Then you still have the same issue, but you have the excuse that "I still delivered your mail; just tagged wrongly". The downside of that is that the recipient still has to filter the mail; and still eats the bandwidth cost. The main gain is the lack of spam-processing CPU that is eaten locally. Anti-spam, and to a lesser extent anti-virus, topics are very interesting to me, and I'd love to hear any thoughts - or even what you use for yourself. Right now I'm 50/50 on setting up my main mailserver as the proxy for a few domains I have to manage (family, friends) to see how it works, but I'm not quite convinced yet. (Single point of failure == bad. Though centralised configuration == good.)

Daniel Burrows: Seattle LUG meeting

The Seattle Linux user's group has been defunct for the last two years or so, but an effort is underway to renergize it. This Saturday, the group will be meeting for the first time in years. The meeting will take place at the North Seattle Community College beginning at high noon -- check the official Web page for more details. TBH, the presentations don't look that interesting to me, but it's always fascinating to meet people who actually use Linux...

Yes, I'll be there, but I'm not giving any of the presentations, so please don't let that keep you away. ;-)

Russell Coker: Is SE Linux only for Linux?

I have just been asked for advice on whether SE Linux is Linux specific, and therefore whether code related to SE Linux should always be stored with other Linux specific code instead of being in the main branch of certain free software projects. One example of SE Linux access controls being implemented on a different OS is the work to port SE Linux to Mac OS/X. Here is a paper on the topic presented at the SE Linux Symposium 2007, and the main site is at http://sedarwin.org. One thing I have been doing is trying to get some friends interested in doing similar work for GNU Hurd (there are some similarities between Darwin and HURD so the work done on Mac OS/X “Darwin” will help the HURD effort). I believe that The HURD has the potential to offer significant security benefits due to the micro-kernel design. One significant problem area in computer security is kernel security flaws, if the kernel can be split into a set of independent processes that run with minimal privileges then the scope of such problems is dramatically decreased - and the possibility of upgrading parts of a kernel on a live machine is provided. As people such as Linus point out there is a performance overhead to micro-kernels, but most machines are idle most of the time anyway. I believe that reliability and security are more important than getting the last 10% of system performance for most machines. The success of Xen is evidence that features other than maximum performance are desired. Another example of SE Linux access controls on a non-Linux platform is the MAC framework in the TrustedBSD project. This implements SE Linux access controls on top of FreeBSD. From reading the documentation it seems that the amount of changes required to the SE Linux code base for implementation on TrustedBSD was significantly smaller than the changes required for Darwin. Sun is also apparently considering adding type-enforcement to Solaris. It’s yet to be seen whether this happens and if so whether it is compatible with SE Linux. So it seems that a significant portion of the SE Linux code base is portable, and in particular the user-space code should port well. The interfaces for and methods labelling files etc should port well between platforms. Therefore I recommend not having SE Linux code split into Linux specific trees and instead having a compile option to enable SE Linux support.

Michael Janssen: In my own head consume, I sit down in my room

Lately I have been tasked with a lot of writing to do. I'm writing a chapter for a book on the field that my research is in, which is a good thing for me to get done, but I started it quite late. I had to finish a 9,000-12,000 word chapter in 2 weeks. Here's how I set it up:
  1. For the first week, write 2,000 words each day.
  2. For the second week, edit the words already written.
The first half of the schedule was easier than I thought it would be. In general, writing in my field doesn't usually happen that fast, but the subject is something I'm pretty versed in, so it was not too hard to get 2,000 words out. I had a clear defined goal for each day that once I met, I could feel okay about not working on the project for the rest of the day. I also only had to write 6 days, and I was able to take the seventh day off. Both of these combined made it a lot easier to not feel guilty about being behind. Editing is a bit more abstract and ongoing than the writing part, so it's hard to tell how well it's really going. There are some easy parts like fixing grammar and proofreading to make sure you don't repeat yourself, but there are also a good portion of hard parts as well, like which sections to cut a bunch of words in, and which word choice should be made in a particular spot. I'm at the point where some things NEED to be cut because the document is too long, so I have to make some hard choices. I also met with my advisor last week and we discussed my progress toward finishing my Ph. D. I had been thinking about this problem for a while now and was glad that it was also on his mind as well. We agreed that I would set the goal for having my orals done by the end of this year (christmas). I am thinking I will use a similar tactic to the chapter that I am writing, but on a much slower schedule, so next week I will start writing 500 words a day, and do that for a couple months. This will leave me with 30,000 words that I will then edit down by quite a bit, reducing it by almost half. Hopefully this will make the process easier as it has for the chapter. If writing my thesis proposal works well this way, I hope I can use a chunk of it for the final thesis, which I want to finish one year after my orals, putting me on track for graduating at the end of 2009. I'm looking forward to that.

John Goerzen: Technology

Two days ago, I was out by the road digging a hole for our mailbox.

Along comes a guy on a tractor. The tractor was built in maybe the 1960s. It had no cab, and was loud, as tractors are. Attached to the back was a mower. It had long since lost any part of paint that was on it, and appeared to be made of rust.

The farmer driving this tractor was wearing a bluetooth earpiece for his cellphone.

(I don't think there would be any way to use a phone while driving that tractor due to the noise, but hey.)

Now, the rest of the story...

This being rural Kansas, the farmer saw me and stopped to chat, turning off the tractor first, of course. He introduced himself as "that crazy guy from south of town", and of course had a pretty good idea of who I was. After all, he's lived around here for decades and knew my grandpa.

I told him why I was digging the hole for the mailbox. There's going to be a second house down our mile, so now the post office will actually deliver to a mailbox at our driveway, rather than one almost a mile away. I thought he looked confused, so I pointed down the road and said that's our mailbox on the corner.

"Oh, I know. I probably shouldn't say this, but I knew when you moved in because I checked your mailbox one day and it didn't have 40-year-old ads piling up anymore."

We chatted a few more minutes, about the neighbor's goats, how annoying it is that he can't get DSL, why he wishes he could still use DOS instead of Windows. Then he went off towards home.

He had stopped his tractor in the middle of the road. But it wasn't a problem. Nobody drove by that whole time anyway.

Russell Coker: Identifying the Distribution of a Linux System

I just needed to test something so I mounted the filesystem of one of my Xen domains in the Dom0 and chroot’d into it (I didn’t need the overhead of running a DomU for a quick test). Then strangely I found that my chroot environment had no apt-get and no dpkg installed. After a small amount of thought I realised that I had accidentally mounted the filesystem for a Fedora image instead of a Debian image. It seems to me that it might be a good idea for distributions to have shell scripts replacing the package tools for other distributions. For example dpkg on a Fedora box could be a shell script that runs echo “This system is running Fedora, you want to use rpm instead of dpkg”. Such a command would have saved me a couple of minutes of thinking. This may sound trivial, but if you consider the number of people who make such mistakes (and the even larger number of people who don’t realise that there is even more than one package tool in existence) then wasting a few K of disk space on every system to help them seems like a good idea. The minimum size of new hard drives that you can purchase seems to be 36G nowadays. So it’s not as if this would really cost anything. Please leave comments to tell me if I’m being sensible or silly. If the idea is regarded as good I’ll start filing bug reports.

Joachim Breitner: Haskell Syntax Gem

Often when creating text from a program, you encounter this situation: You have a value, e.g. first_name, that might be empty (depending on your programming language, this means undefined, NILL, None, nil or Nothing) or contain a string. In the latter case, you want to surround it by some markup, in the former you want to do nothing. Here is how I d code that in Template::Toolkit:
<table>
[% IF second_name %] <tr><th>Second name</th><td><b>[% second_name %] </b></td></tr> [% END %]
[% IF first_name %] <tr><th>First name</th><td>[% first_name %]</td></tr> [% END %]
</table>
And here in python:
output = "<table>"
if second_name:
output += "<tr><th>Second name</th><td><b>%s</b></td></tr>" % second_name
if first_name:
output += "<tr><th>First name</th><td>%s</td></tr>" % first_name
output += "</table>"
I really don t like entering each variable name twice, when I basically want to do one thing with it.Here is how you can use Haskell s flexible syntax to help you out. First we define a unconditional insert here operator ++!++ and then a conditional one, named ++?++:
(++!++) :: String -> String -> String -> String
pre ++!++ post = \ins -> pre ++ ins ++ post
-- Or more haskell-style:
-- pre ++!++ post = (pre ++).(++ post)

(++?++) :: String -> String -> Maybe String -> String
pre ++?++ post = \ins -> maybe "" (pre ++!++ post) ins
-- Or more haskell-style:
-- pre ++?++ post = maybe "" (pre ++!++ post)
Note that the first line of each function, the type declaration, could be left out as Haskell can figure it out by itself. Also note that these function are not restricted to strings (as lists of characters), but can be used for any kind of list.Now I can write the code up there as:
output = "<table>" ++
         ("<tr><th>Second name</th><td><b>" ++?++ "</b></td></tr>")  second_name ++
         ("<tr><th>First name</th><td>" ++?++ "</td></tr>") first_name ++
         "</table>"
I think that s a nice display of the flexibility of Haskell s syntax, in this case, using symbols for function names and infix application.

Pablo S. Torralba: Shell date and time tricks

One of the things I hate the most when programming is dealing with time and date functions and all the special cases which exists. Even more, I have the feeling I'm walking a path many times walked before, so it becomes one of the most unpleasant tasks for me.

Fortunately, it's true, so many others walked before that path so here are some quick tricks for shell programming using the wonderful date UN*X program:
  1. Converting epoch:
    1. From epoch to anything else: date -d @$epoch_value +FORMAT (where FORMAT is of course as described on date(1), and '@' makes the actual undocummented trick).
    2. From anything else to epoch: date +%s
  2. Calculating times
    1. One day forward: date -d "1 day"
    2. One day backwards: date -d "1 day ago"
    3. Just imagine "1 month", "3 months ago" and the like. Not only google is so friendly with human language ;-)
  3. More format conversion: '-d' option accepts several other formats as input, even with calculations:
    1. date -d "1977-08-19 30 years", yeah! my 30th birthday was on sunday. Thanks date, and it was (as epoch): date -d "1977-08-19 30 years" +%s... 1187474400 :-D
    2. Funny ls:

      ls -l while read perms links user group size d t name
      do
      echo $perms $links $user $group $size $( date -d "$d $t 1 day" ) $name
      done
      You can, of course, change the way date is shown. That's because 'YYYY-MM-DD hh:mm' is also a valid input format for date as it is 'YYYY/MM/DD'.
So '@', '1 day' and 'date' saved me the day.

Update: This features and more are indeed described in the coreutils info manual. Thanks mp for pointing it out.

Next.

Previous.