Search Results: "mt"

17 January 2007

David Welton: Clockwork languages

Steve Yegge posts an article about this that, the other thing, and statically typed functional programming languages. In it, he compares Haskell to something you can:
"build beautiful, lithe marionettes with"
Unfortunately, I haven't had the time or inclination to learn Haskell (yet), but I have used Erlang professionally, so I do have a bit of experience using a functional programming language. What comes to my mind isn't marionettes, but clockwork. That's a purposefully neutral word, in case you were wondering. An enthusiast might say "a finely crafted swiss watch", and a detractor might grumble "a windup toy". In my mind's eye, the concept is that in functional languages you get this succession of things happening one after the other that happen precisely the same way, if the program is wound up just the same each time. To paraphrase:
Do this with the result of this with what this produces when given  
this input that is derived from this function which takes the  
result of this other thing after calculating the result of 
something that is derived from the output of a function that ...
And so on and so forth...tick, tock, tick, tock. While I can appreciate that in some ways, this is likely to produce clean programming, in other ways I am less convinced of its practicality. If you'll bear with a poor comparison, sometimes programming is like a song. You do the tricky section, then you go back to an easier section and catch your breath for a bit. That seems to work out in a language like Ruby or Java fairly well, depending on how densely you like your code. You get sections with DoThisAndThisAndThatWithTheResultsOfSelectThisFromTableXYZ that you have to slow down to think through. And then: GoToTheNextTrickyBit where ManyThingsHappen. All in all, you wind up with a sort of ebb and flow that works out pretty well if you're in tune with the code being written, going from intense calculations, to a line or two where you do no more than store things in a variable, take a breather, and prepare for the next important stanza. In my limited experience, I have to say that I didn't always get that sensation from Erlang (which in some ways is apparently less "hair shirt" oriented than Haskell). You always had to be writing something with an eye to where it was coming from, and where it was going. Without a doubt, this produces code that is more compact in terms of meaning and functionality, but at times it leaves a guy like me, who grew up with Basic, C, Python, and so on with the desire to say "woah there, nelly", let's take a breather and sort things out a bit in a few variables before moving on to the next bit of fancy code gymnastics. What I'm curious about is what will catch on from academically oriented programming languages like Haskell. The people working on them are without doubt very smart, and there are some interesting concepts being bandied about (pattern matching is pretty cool, just to cite one). But academia doesn't always produce things that catch on with the average Joe programmer, either, and while the more elitist out there may attribute this to simplistic reasoning such as 'well then Joe is just stupid', I think that the more thoughtful language crafters will attempt to ascertain what works, and what doesn't, and perhaps we will see the Ruby of functional languages emerge from Haskell, the Smalltalk of functional languages. What do you think?

16 January 2007

Sven Mueller

In his post “Ok, now we are getting somewhere! (Re: XML-based configurations)”, Gunnar Wolf writes that he doesn’t regard XML as a suitable standard for configuration files which need some sort of nesting (like, e.g. the apache configuration needs nesting while a config for a simple /usr/bin/sendmail replacement like nullmailer or msmtp won’t need nesting). He seems to like YAML, as you can see in his first post on the subject: Configuration files for humans and for computers. I looked into YAML a bit and to me, it doesn’t seem like a good replacement for XML in config files. Sure, the files look simpler, but I would have a heck of a problem to memorize the syntax. Sure, a colon (:) is intuitive for a direct mapping, but remembering that a pipe (” ”) marks a literal which preserves newline while the default is a scalar which maps newlines to spaces is harder. Folded style (”>”) is even harder to remember. It folds multiple lines with the same indentation into a single line unless there is a differently indented or empty line in between. More important is that I honestly hate syntaxes which rely on indentation. Indentation is dead useful when a nested config or source is read by a human, but it often causes problems when edited by a human, especially when tabs are used. A program could (and most often would) see a difference between “test” and “<8*space>test”, while a human would most probably not see a difference with default tabs. To sum it up: I see the problems with XML, most notably bad program outputs which don’t use indentation (some even put everything on a single line) and the sometimes overwhelming amount of whatever constructs, but YAML doesn’t seem to be the right solution to me neither, especially due to the indentation-used-as-syntax-element problem. What I really would like to see is a syntax that doesn’t use indentation as a syntax element and doesn’t need the name of the opening tag when closing it, but still allows to use it. In other words both of the following constructs (or an equivalent which looks less like XML) should be legal:
<x>
        whatever
</>
<x>
        whatever
</x>
While the following should raise an error:
<x>
        whatever
</y>

15 January 2007

Dirk Eddelbuettel: Too hot to Handel

We went to see a performance of Too hot too Handel [1], a Gospel/Blues/Jazz/Rock rendition of the Messiah, at the Auditorium Theater on Saturday. Two choirs comprising 120 singers, a full jazz (big) band with drums, electric and acoustic bass, electric organ, piano and about twenty brass instruments as well as an equal number of strings in the symphonic section, plus vocalists Rob Dixon (tenor), Victor Trent Cook (counter tenor) and Alfreda Burke (soprena) made for a very full sound in this beautiful theater. For apparent scheduling problems, the performance was moved from the Christmas season (in which Haendel's original Messiah is rather popular) to the Martin Luther King birthday weekend, which is appropriate enough. Even though quite a few seats were empty, the musicians had little problem to get the audience onto their feat with a fine performance, and a rousing finale. Recommended. [1] Not sure where the Umlaut went missing there. Oh well.

14 January 2007

Jordi Mallach: Phone-before-SMTP

Today I woke up with a strong determination to do some badly needed house cleaning. A series of rushed travels have left a few rooms full of stuff all over the place, after I emptied a bag or two to be able to pack on time. Just before going to Tunisia, I decided my wallet was way too fat so I got rid of shopping receipts and other random shit I had in it. That included quite a few PGP keys from people I had been collecting in previous travels, and I had forgotten about. So, armed with my willingness to get rid of all of those dust puppies, first thing I find in the living room is the pile of wallet papers, and my clever procrastinating mind apparently thought it was time to postpone real cleaning; instead I needed to sit down and sign all of those really old PGP keys. Many of you reading this will have got a few emails from me this morning. It was about time! Some of the silly strips of paper dated back to the Open Source World Conference 2004 in M laga, when a decent group of Debian Developers gathered in a really small hacking room and talked about some Debian topics. Signing the keys has let me identify a few non-revoked ids which really should be, as the accounts are no longer valid, etc.; many others have greylisted me for a while and finally accepted my email. There was one mail recipient which may have gone a bit too far with the anti-spam policies, though:
9323170A74B     4007 Sun Jan 14 17:55:38  jordi@nubol.oskuro.net
(host mail-dtag.reichmann.net[62.104.43.214] said: 421 call 09001000057 for admin support (in reply to MAIL FROM command))
                                         alexander@schmehl.info
Alexander, I'm not doing calls to Germany to send your key, but I can resend if you want, once you open up your mail server... (my tries to knoepix.org also failed). It seems I have misplaced a few keys from the Ubuntu Summit in Sydney, but I think I know where to find that sheet. More in 2 or 3 years! PS: dust puppies are alive and well, they managed to survive yet another tough day.

Manoj Srivastava: Mail Filtering with CRM114: Part 3

Uphold, maintain, sustain: life in the trenches Now that I have a baseline filter, how do I continue to train it, without putting too much of an effort? There are two separate activities here, firstly selecting the mails to be used in training, and secondly, automating the training and saving to the mail corpus. On going training is essential; Spam mutates, and even ham changes over time, and well trained filters drift. However, if training disrupts normal work-flow, it won't happen; so a minimally intrusive set of tools is critical Selecting mail to train filters There are three broad categories of mails that fit the criteria: 1. Misclassified mail This is where human judgement comes in, to separate the wheat from the chaff. 2. Partially misclassified mail This is mail correctly classified overall, but misclassified by either crm114, or spamassassin, but not both. This is an early warning sign, and is more common than mail that is misclassified, since usually the filter that is wrong is wrong weakly. But this is the point where training should occur, so that the filter does not drift to the point that mails are misclassified. Again, the mlg script catches this. 3. Mail that crm114 is unsure about This is Mail correctly classified, but something that mailreaver is unsure about -- and this category is why mailreaver learns faster than mailtrainer. Spam handling and disposition Spam handling schema. At this point I should say something about how I generally handle mails scored as Spam by the filters. As you can see, the mail handling is simple; depending on the combined score given to the mail by the filters. The handling rules are: So, any mail with score less than 15 is accepted, potentially after grey-listing. The disposition is done according to the following set of rules: In the last 18+months, I have not seen a Ham mail in my realspam folder; chances of Ham being rejected are pretty low. My Spam folder gets a ham message every few months, but these are usually spamassassin misclassifying things; and mlg detects those. I have not seen one of these in the last 6 months. So my realspam canary has done wonders for my peace of mind. With ideally trained filters, spam and realspam folders would be empty. mail list grey I have created a script called mlg ("Mail List Grey") that I run periodically over my mail folder, that picks out mails that either (a) are classified differently by spamassassin and crm114, or (b) are marked as unsure by mailreaver. The script takes these mails and saves them into a grey.mbox folder. I tend to run them over Spam and non-Spam folders in different runs, so that the grey.mbox folder can be renamed to either ham or junk, in the vast majority of the cases. Only for misclassified mails do I have to individually pick the misplaced email and classify it separately from the rest of the emails in that batch. At this point, I should have mail mbox folders called ham and/or junk, which are now ready to be used for training either crm114 or spamassassin or both. Processing these folders is the subject of the next article in this series.

11 January 2007

Ian Murdock

Forget the iPhone—I want an iPhone Shuffle!

9 January 2007

Erich Schubert: SVN $Date$ to ISO 8601 in XSLT

I'm keeping my homepage in a SVN repository; I'm using the $Date$ variable to automatically track the last modification date (though it will also change on minor modifications). For the HTML "Date" meta tag, the W3C recommends using ISO8601 date format. This is the (non-XSLT-2, so no regexp) hack I use for conversion:
<xsl:value-of select="concat(substring($string,8,4),'-',substring($string,13,2),'-',substring($string,16,2),'T',substring($string,19,8),substring($string,28,5))" />
Did I mention I hate XSLT? It's lacking so many standard functions, like date-time processing, regular expressions, exceptions, ... - granted, a lot of stuff was added for XSLT2, but it still sucks badly. Especially the syntax. Here's how to format the date according to RFC 2616, as used in the last-modified meta tag and HTTP/NNTP/SMTP headers:
<xsl:variable name="day" select="concat(substring($string,8,4),'-',substring($string,13,2),'-',substring($string,16,2))" />
<xsl:variable name="time" select="substring($string,19,8)" />
<xsl:variable name="timezone" select="substring($string,28,5)" />
<xsl:value-of select="date:day-abbreviation($day)" />
<xsl:text>, </xsl:text>
<xsl:value-of select="date:day-in-month($day)" />
<xsl:text> </xsl:text>
<xsl:value-of select="date:month-abbreviation($day)" />
<xsl:text> </xsl:text>
<xsl:value-of select="date:year($day)" />
<xsl:text> </xsl:text>
<xsl:value-of select="date:time($time)" />
<xsl:text> </xsl:text>
<xsl:value-of select="$timezone" />
Note that this does not include any error handling and is not very robust. You also need an XSLT processor with some of the ">">">http://exslt.org/dates-and-times extensions such as xsltproc. (Which unfortunately doesn't do XSLT2 yet and doesn't have a regexp extension). [Update: Joel Wreed pointed me to his libxslt plugins, a regexp and a exsl.org/dates-and-times plugin. These would help a lot, though IIRC the date-parse exsl.org spec doesn't support the date format I'd need. (So I can't just say date-format(date-parse(...),...)). Also he said that they basically are unmaintained right now. It would be nice if they could be merged into libxslt, though...]

5 January 2007

Michael Janssen: Setup will complete in approximately: 39 minutes

Hardware evils

I've had quite the unfortunate week, hardware-wise, here. Nothing on my end is broken, but [lj user=ceilingsarecool]'s computer is screwed but good. It all started near the beginning of this week when I started to look into her machine. It had been loud for a while, and was being unreliable in regards to applications. Running memtest86+ on it via a handy System Rescue CD I always keep around discovered a couple of stuck bits on the memory that otherwise had been perfectly fine. However, I have had sticks die before, so I called Crucial and am having the memory replaced. (thank you Lifetime warranty). While I was taking the Memory out I noticed the couse of the loudness. Apparently there was ailing fan on the south bridge, which explained her issues with USB-connected devices. No problem - I'll just order a replacement motherboard. The old FIC AD11 was getting pretty bad anyway.

The new motherboard (a PCCHIPS M810LMR) arrived yesterday, so I went through the lengthy process of removing the old motherboard and moving the CPU from one to another. Just one problem: the new motherboard didn't start up. After checking that I had everything connected right, I thought the board was DOA. This would be my first DOA ever, but as usual the place I bought from has a DOA replacement policy so I thought I just wasted 2 hours and a bunch of time replacing. Unfortunately, this isn't even the end of this sad tale of brokenness. When I put the CPU back in the old motherboard, it didn't start either. So now I'm left with two motherboards for a processor that doesn't work, I assume. I don't really have another one that I can test it out on, and I can't test the motherboards with another CPU because I don't have one.

Luckily, I have some old towers sitting here that were about to be dragged out to the dumpster. I rescued them. They're ancient, even more than the machine that was in use was. I had to burn a Maxtor MaxBlast4 CD just to get them past the 65GB barrier, and of course I need to do a "repair" install of Windows because all the hardware changed since I installed it.

Lesson of this tale: Almost-broken computers are a delicate ecosystem. Just buy a new computer - you'll have to do that in the longrun anyway. Currently I'm looking at replacing the mainboard and CPU with this combo from newegg. It's got mixed reviews, but is reasonably priced, and if DOA I am sure that newegg will replace it. I'm debating between doing this and just saving up to get a decent new motherboard and CPU (generally around $150-$250, $300 easily with new memory) later in the year. I feel pretty bad because every computer that I've given [info]ceilingsarecool to use has had issues like this. She tells me that she doesn't really care that much, and she does have a laptop which works well when the desktop has issues like this, but it's still like a poison apple.

Windows XP Setup

It doesn't seem to matter what you are installing Windows XP on. It can be 500MHz or 1.2GHz or 3.0GHz, the first time estimate that you get for finishing the install is 39 minutes. When XP was first released, I never ever had a computer that would finish that fast - it consistently took an hour or more from that state, and then I jumped to fast computers that come under the mark most of the time (although not by much). At least the estimate is monotonic, not going up to an hour. I can at least assess the progress a little more. Installing a couple times in the last few weeks has got me wondering about the origin of that estimate, and if it was going to be so inaccurate as to just guess and be constant at the beginning of the install, why include a time estimate at all?

4 January 2007

Clint Adams: Slush puppies

Erin and Andr s are fagging it up downtown, Colette's watching movies dubbed into French, Jim is scheming to sneak into Cuba, and I'm getting escorted out of a cathedral for crimes against humanity. Rotate. Lenore is eating a duck's foot. There are some lies about mistranslation. Rotate. Colette seems confused about why I would think the dog understood Flemish. The dog neither confirms nor denies its proficiency in Flemish. Rotate. Collette is playing with her dirty thumbnail. Ew.

2 January 2007

Evan Prodromou: 11 Niv se CCXV

What a great day it was in the Bay Area today -- just beautiful. It's Rose Bowl weather, of course -- Nature blesses California on the day of the Rose Bowl, just so people in the rest of the USA say, "Damn those Californians and their great weather!" Still, there's something so rejuvenating every year around the 10th-11th of Niv se. I wonder what it is? Oh, and: no, we don't have the Rose Bowl in northern California. It's just one of the few times of year that San Franciscans are happy to share the state with their southern neighbors. tags:

Fruitcake So, there's a comedy tradition around the holidays that marks the crappiest possible gift you can get for Christmas as a fruitcake. This is stupid; fruitcake is delicious. Candied fruit + nuts + cake + rum = hooray for fruitcake. My parents got a couple of fruitcakes for Christmas, and they tasted great. I've been noshing on them a bit at a time all week. Great stuff! Rumtastic. Anyone who says otherwise is full of malarkey. In conclusion, fruitcake is delicious and Carthage must be destroyed. tags:

New Year's Eve Maj, Amita June and I had a hard New Year's Eve. Our friends Earl and Sue have an NYE party in Walnut Creek every year, and a lot of our friends from Pigdog Journal are there every year. We had planned to have a room at the nearby Embassy Suites, and have friends over before the party to see Amita June (who needs to be asleep by New York midnight, i.e. 9PM PST). But Maj is feeling really sick -- flu-y and nauseous -- and we had to cancel this pre-event. Bad feelings about this; we've missed seeing this group of friends a few times since the baby was born, and some of them have never met her. Eventually, we all managed to go to Earl and Sue's party together, then left early so Amita could get to sleep. A pretty good solution all around. I got to see a lot of old friends, including Sam and Shannon who just announced that she's blogging for two now. (Congrats!) Tjames was there with his ladyfriend Robyn, which was really nice. They made out a lot, which makes me pretty happy. We saw Dan, Johnny, Randy, Dave, and of course Earl and Sue themselves. A really good party. tags:

All is quiet I had a pretty mild shom-pan-yah hangover this morning, so we were fully able to go see friends Zach and Wendy in El Cerrito for brunch. We hit delicious Picante off of Gilman Street, which is a massive Mexican restaurant, near the Berkeley Gourmet Ghetto and showing some of the foodie-ism of the weird East Bay scene. I had a really good plate of chilaquiles, and Maj had some huevos rancheros and made a pretty good dent in them -- the first food she's really eaten in a few days. Amita June got a great quesadilla with queso fresco that tasted really good. Then, everyone was ready for a nap, so we said goodbye and cut the visit short by heading back to Los Altos Hills. tags:

Ads on Wikipedia So, there's been quite a dust-up on Wikimedia Foundation lists about their recent fund-raising drive. The WMF is having its annual fundraising drive (and, if you can, please help with a donation), and the Virgin Group's charity organization, Virgin Unite, set up a matching fund a few days ago so that all donations to the WMF were effectively doubled. All fine so far, right? But a small logo in the donations notice -- seen by non-logged-in users on every page of every WMF site -- was considered by many Wikipedians and other WMF editors as dangerously close to the line on advertising -- or over it. There have been several prominent users who have left the project because of it. I'm not sympathetic with these folks; in fact, I'm in solid opposition. I think that Wikipedia's huge amount of Web traffic is a resource that the Foundation is squandering. Traffic like Wikipedia's is worth tens of millions if not hundreds of millions of dollars in ad revenue per year. That's money that could go to disseminate free (libre and gratis) paperback pocket encyclopedias to millions of schools and millions of children, in their own language, around the world. It's irresponsible to abuse that opportunity. Brion Vibber's defense of the logo on the Wikimedia Foundation's mailing list is really interesting and instructive. tags:

29 December 2006

Russell Coker: email disclaimers

Andre Pang blogs about the annoyance of email disclaimers. For a while I had a .sig indicating that it was a condition of sending email to me that the sender agrees to legalistic terms in their .sig being inapplicable to me.

220 smtp.sws.net.au ESMTP Postfix - by sending email to this server you agree that any legalistic sig in your message does not apply to anyone who receives the message through this service.

Now I have changed my Postfix greeting to the above. Anyone who sends me mail agrees that their .sig does not apply to me. Suggestions for improvements to the above text are welcome.

25 December 2006

Jose Carlos Garcia Sogo: Python tips for vim

I am using Vim a lot to code in Python. One of the most important thing in Python is indent code properly as t uses indent to mark code blocks, and making that right is a bit painful, as you usually end mixing tabstops with white spaces, which makes code almost unreadable when you open it with an editor with a different tabstop setting. To avoid that, using whitespaces is recommended, but it would be nice that those could be inserted automtacally, and that is what the following lines of code added to your ~/.vimrc file make.
" Tip: set indent parameters for python files.
" Version: 0.1
" Date: 13 May 2006
"
" Description: most python scripts use four spaces for indenting, but
"              sometimes you will end up editing a script where tabs
"              are used; in these situations it can be useful to
"              automatically detect whether spaces or tabs were used,
"              and set some parameters (or call some functions) consequently.
"
" Usage: you can put this script in you vimrc and call the PyIndentAutoCfg
"        function with an autocmd associated to python files, or call
"        it manually, or put it in the python.vim syntax script, or... :-)
" Function to set parameters for python scripts that use
" spaces for indention.  This is also the default.  YMMV.
function PySpacesCfg()
  set expandtab " use spaces in place of tabs.
  set tabstop=8 " number of spaces for a tab.
  set softtabstop=4 " number of spaces for a tab in editing operations.
  set shiftwidth=4 " number of spaces for indent (>>, , ...)
  set smarttab
  set autoindent
  set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
endfunction
" Function to set parameters for python scripts that use
" tabs for indention.  YMMV.
function PyTabsCfg()
  set noexpandtab
  set tabstop=4
  set softtabstop=4
  set shiftwidth=4
  set autoindent
endfunction
" This function returns 1 if the file looks like a python script
" that uses tabs for indenting, or 0 otherwise.
function PyIsTabIndent()
  let lnum = 1
  let max_lines = 100 " max number of lines to check.
  let got_tabs = 0
  let got_cols = 0 " 1 if the previous lines ended with columns.
  while lnum = max_lines
    let line = getline(lnum)
    let lnum = lnum + 1
    if got_cols == 1
      if line =~ "^\t\t" " at least two tabs, to prevent false-positives.
        let got_tabs = 1
        break
      endif
    endif
    if line =~ ":\s*$"
      let got_cols = 1
    else
      let got_cols = 0
    endif
  endwhile
  return got_tabs
endfunction
" Check the file, and run the relative function.
function PyIndentAutoCfg()
  if PyIsTabIndent() == 1
    call PyTabsCfg()
  else
    call PySpacesCfg()
  endif
endfunction
" Call the PyIndentAutoCfg function.  Uncomment this line if you've copied
" this script in the python.vim syntax file or something like that.
" call PyIndentAutoCfg()
au BufNewFile,BufRead *.py call PyIndentAutoCfg()
Also, if you want to convert a file using tabs to spaces, you can do it by using the following Vim commands.:
:set expandtab
:%retab
Update: Stefano posted about using filetype hook files instead of au groups. I think it is smarter, and I didn't knew about after/ dir in ~/.vim. So following Stefano's advice, you should put the ebove script in ~/.vimrc/after/ftplugin/python.vim, so it gets loaded automatically when you open a Python file.

24 December 2006

David Welton: Apples, Oranges, and Culture

Apples and Oranges A number of people wrote irate comments after my article about Ruby's eBay API beating PHP hands down. They complained that I was comparing apples to oranges, because the Ruby library I was using was nicely crafted, whereas the PHP one was some crufty crud that just happened to be one of the first things you find when you go to developer.ebay.com. First things first, let's look at some better PHP code:
require_once 'EbatNs/EbatNs_ServiceProxy.php';
require_once 'EbatNs/EbatNs_Logger.php';
require_once 'EbatNs/GetItemRequestType.php';
require_once 'EbatNs/ItemType.php';
$session = new EbatNs_Session('config/amd.ebay.config.php');
$cs = new EbatNs_ServiceProxy($session);
$cs->setHandler('ItemType', 'handleItem');
$req = new GetItemRequestType();
$req->setItemID(5652664344);
$req->setDetailLevel($Facet_DetailLevelCodeType->ReturnAll);
$res = $cs->GetItem($req);
echo "<pre>";
if ($res->getAck() != $Facet_AckCodeType->Success)  
echo "we got a failure<br>";
foreach ($res->getErrors() as $error)
 
    echo "#" . $error->getErrorCode() . " " .
    htmlentities($error->getShortMessage()) . "/" .
    htmlentities($error->getLongMessage()) . "<br>";
 
  else  
//#type $item ItemType
$item = $res->getItem();
echo "ShippingTerms : " . $item->getShippingTerms() . "<br>";
print_r($item);
 
versus our Ruby code:
require 'rubygems'
require 'ebay'
include Ebay
include Ebay::Types
require 'localconfig'
ebay = Ebay::Api.new
begin
  response = ebay.get_item(:item_id => '110011765264')
  puts "ShippingTerms : # response.items.shipping_terms "
rescue Ebay::RequestError => e
  e.errors.each do  error 
    puts error.long_message
  end
end
So, they get closer with that, but the Ruby code is still clearer and more concise. If you look around at some PHP5 based examples, they start to be decent as well. As one tutorial writes:
These components combine to create a kick-ass tool that PHP 4 can't replicate without lots of work, if at all.
Leaving aside the fact that a lot of people are still more or less stuck on 4, I think there is something more important to be learned. Culture There are a lot of really smart people who work with, and on PHP. As much as anyone grumbles about any language, it's not easy to create one, let alone create one and make it as popular as PHP. However, as I've said elsewhere, one of the things that made PHP so successful was its ability to "scale down". Part of its value is that it made it much easier for more people with less advanced skills to create things. That is, without doubt, a very fine accomplishment, but it does bring some baggage with it. Namely, that there are a great deal of PHP programmers who do not write very nice looking code. Going back to the eBay example, the code featured on their site is not very tasteful, if you ask me. My bet is that in Ruby-land, that sort of code would not be displayed very prominently. Why? It's not the computer, it's the culture that has grown up around the different languages. Computers do not care one bit about programming languages. They interpret bits and bytes, whatever language is used, so it's really all the same to them. Programming languages matter only to people, because they are the tool we use to comunicate our instructions to machines. This means that they are a very human thing in some ways, and that human aspects of them matter a great deal. What this means is that it's important not only to design a cool language, but to create a good culture around it. To take aim at something nearer and dearer to me than PHP, one of the major failings of the Tk toolkit was that there was little to no attempt to create a good design culture around it. Anyone who was using Linux 10 years ago will surely remember some of the truly horrible things that were created with Tk. Why? Tcl and Tk made creating a GUI an order of magnitude easier than with C and Motif (or whatever windows used at the time), and turned them loose with no instructions or idea whatsoever of how to go about creating a good, intuitive user friendly one - the Tk docs themselves make little to no mention of usability, and even the best Tcl/Tk books pay almost no attention, even in the form of recommended reading, to what to make with this beautiful tool whose hows are explained very well. The unixy community also wasn't exactly a wellspring of creativity and critique in terms of good guis, either. So, yes, I know that it's possible to write good, clever, readable PHP (or Perl, or FORTRAN) code, and bad Ruby (or Tcl, or Python, or whatever) code. However, I'm also convinced that culture counts. People who value clean, beautiful code gravitate to cultures, and, where possible, workplaces where they find other like-minded people. Others, not having as many options, find themselves staring at 13000-line PHP files that grow malignantly by dint of cut and paste, wondering how to tame that which others have wrought!

Marc 'Zugschlus' Haber: A christmas wish for exim

Dear Lazyweb, dear Santa Claus, One thing I wish for exim is a patch for Exim Bugzilla Issue #66, which will incidentally fix Debian Bug #244724, which has become a recurring issue in various complex ISP configuration schemes. A patch solving this would add an option to an SMTP transport which allows the transport to set the authentication credentials instead of the authenticator. The transport still knows the host name given to it and can look up the right authentication credentials, while the authenticator only knows the IP address that we are connected to and thus needs to rely on reverse DNS information to look up the credentials. Which leads to numerous kinds of confusion regarding CNAMEs and broken reverse DNS on the ISP side. So, please dear Santa, give me a patch for that. It shouldn’t be too hard to do.

19 December 2006

David Pashley: Backing up PostgreSQL

I decided it was probably time that I started backing up my PostgreSQL databases and ended up writing a quick script to do just that. I did have a look at pg_dumpall, but it appears to only write to stdout, meaning I couldn't have a file per database like I wanted.
#!/bin/bash
set -u
set -e
dumpdir=/var/backups/postgresql 
date=$(date +"%Y-%m-%d")
mkdir -p $dumpdir
find $dumpdir -name "*.sql" -mtime +10 -exec rm   \; 
for database in $(su - postgres -c "psql -l -t"   cut -d' ' -f 1   grep -v template0); 
do 
        su - postgres -c "pg_dump $database" > $dumpdir/$database-$date.sql; 
done
su - postgres -c "pg_dumpall -g" > $dumpdir/global-$date.sql
Just stick that in /etc/cron.daily/postgresql-backups and you should end up with 10 days worth of backups. I'm not sure if postgreSQL can have spaces in database names. I'm assuming it can't. The only other issue to deal with is not storing it on the same machine as the database server, let alone on the same physical hardware or even worse, the same partition. Update: Corrected typo and added dumping global objects to the script. Sorry to anyone that got spammed by my change to pyblosxom earlier today. I changed the base url, which changed the link of the entries. I should sort out having proper guids.

Manoj Srivastava: Mail Filtering With CRM114: Introduction

I have a fairly sophisticated Spam filtering mechanism setup, using MIMeDefang for SMTP level rejection of Spam, grey-listing for mails not obviously ham or Spam, and using both crm114 and spamassassin for discrimination, since they compensate for each other when one of them can't tell what it is looking at. People have often asked me to write up the details of my setup, and the support infrastructure, and I have decided to oblige. What follows is a series of blog posts detailing how I set about redoing my crm114 setup, with enough detail that interested parties can tag along. I noticed that the new crm114 packages have a new facility called mailtrainer, which can be used to setup initial css database files. I liked the fact that it can run over the training data several times, it can keep back portions of the training data as a control group, and you can tell it to keep on going until it gets a certain number of mails discriminated correctly. This is cool, since I have a corpus of about 15K Spam and 16K ham messages, mostly stored on my previous train-on-error practice (whenever crm114 classified a message incorrectly, I train it, and store all training emails). I train whenever crm114 and spamassassin disagree with each other. This would also be a good time to switch from crm114's mailfilter to the new mailreaver, which is the new, 3rd Generation mail filter script for crm114. It is easier to maintain, and since it flags mails for which it is unsure, and you ought to train all such mails anyway, it learns faster. Also, since the new packages come with a brand new discrimination algorithms which are supposed to be as accurate but also faster, but may store data in incompatible ways, I figured that it might be time to redo my CRM mail filter from the ground up. The default now is "osb unique microgroom". This change requires me to empty out the css files. I also decided to change my learning scripts to not send command via email to a 'testcrm' user, instead, now I train the filter using a command line mode. Apart from saving mails incorrectly classified into folders ham and junk (Spam was already taken), I have a script that grabs and saves mails which are classified differently by crm114 and spamassassin from my incoming mail spool and saves it into a grey.mbox file, which I can manually separate out into ham and junk. Then I have a processing script, that takes the ham and junk folders and trains spamassassin, or crm114, or both; and stashes the training files away into my cached corpus for the future. In subsequent blog postings, I'll walk people through how I setup and initialized my filter, and provide examples of the scripts I used, along with various and sundry missteps and lessons learned and all.

18 December 2006

Biella Coleman: VIVA ZYPREXA!

I am about 2/3 over with my haul from Edmonton to San Juan, PR (laying over in the beautiful JFK) and am too tired to blog anything much of substance but do check out Furious Season’s impassioned and excellent commentary on the recent NYTimes article (and this one )that reveal how Eli Lily knowingly downplayed the risks of Zyprexa. And if you read the second article, you will find out what Viva Zyprexa means. Here is Eli Lily’s press release, which I have included on the next page as these things tend to vanish… Statement from Eli Lilly and Company: Response to The New York Times Article from December 18, 2006 December 18, 2006 INDIANAPOLIS, Dec 18, 2006 /PRNewswire-FirstCall via COMTEX News Network/ — Eli Lilly and Company (NYSE: LLY), vigorously objects to the characterization of company practices in a New York Times article based upon selective documents illegally leaked by plaintiffs’ lawyers. “At Lilly, we do not engage in off-label promotion - as alleged in The Times article,” said Dr. Steven Paul, Lilly’s executive vice president, science and technology. “Lilly is committed to the highest ethical standards and to promoting our medications only for approved uses. We have clear guidelines and extensive training for our sales representatives to help assure that they provide appropriate promotional information that is within the scope of prescribing information approved by the FDA.” Lilly works to bring Zyprexa to physicians who are confronted with the need to diagnose and treat serious schizophrenia and bipolar disorder wherever they practice. * About half of medical care for serious mental illness takes place in a primary care physician’s office. This is due to the fact a large number of people in the United States have no access to a psychiatrist or do not seek psychiatric care. * Our experience in mental health has taught us that primary care physicians are asking for education on severe mental illnesses, since they see many of these patients in their offices. * We believe that it is absolutely appropriate to discuss Zyprexa and its indicated uses with primary care physicians in the interest of meeting a critical medical need. * It is important that the public understand that physicians can and do prescribe medications outside of their approved indications to meet the needs of their individual patients. “While it is accurate to say that mental illnesses like schizophrenia and bipolar disorder begin early in life — with a higher prevalence during early adolescence and childhood — it is simply untrue to assert that these diseases somehow end — and therefore prescribing for them ends — in young adulthood,” added Paul. “To dismiss the devastating impairment of these disorders throughout a patient’s life is wrong. “Bipolar disorder and schizophrenia are often treated in the offices of primary care physicians. In fact Lilly did research with primary care physicians and found that they were challenged in making the diagnosis of bipolar disorder. Many primary care physicians appreciate the educational outreach Lilly provides in mental illness,” he added. The Times failed to mention that these leaked documents are a tiny fraction of the more than 11 million pages of documents provided by Lilly as part of the litigation process. They do not accurately portray Lilly’s conduct. As part of Lilly’s commitment to patients and healthcare professionals, many high-level Lilly physicians and researchers — along with researchers from outside Lilly — were engaged for a number of years to study the issue of Zyprexa and diabetes. Leaked documents involving these discussions do not represent an accurate view of company strategy or conduct. Lilly deplores the illegal release of select confidential documents. This illegal and selective disclosure of incomplete information will cause unwarranted concern among patients that may cause them to stop taking their medication without consulting a physician. This is the unfortunate result we saw when plaintiffs’ lawyers aggressively advertised about Zyprexa in recent years while searching for clients. Lilly, a leading innovation-driven corporation, is developing a growing portfolio of first-in-class and best-in-class pharmaceutical products by applying the latest research from its own worldwide laboratories and from collaborations with eminent scientific organizations. Headquartered in Indianapolis, Ind., Lilly provides answers — through medicines and information — for some of the world’s most urgent medical needs. Additional information about Lilly is available at www.lilly.com. C-LLY Zyprexa (olanzapine, Lilly) (Logo: http://www.newscom.com/cgi-bin/prnh/20031219/LLYLOGO ) SOURCE Eli Lilly and Company Tarra Ryker, +1-317-276-3787, mobile: +1-317-332-7502, or Marni Lemons,
+1-317-433-8990, mobile: +1-317-532-7826, both of Eli Lilly and Company http://www.prnewswire.com Copyright 2006 PR Newswire. All rights reserved News Provided by COMTEX

Manoj Srivastava: I am now an Ikiwiki user!

Ikiwiki
Well, this is first post. I have managed to migrate my blog over to Ikiwiki, including all the historical posts. The reasons for migration was that development on my older blogging mechanism, Blosxom, entered a hiatus, though recently it has been revived on sourceforge. I like the fact that IkiWiki is based on a revision control system, and that I know the author pretty darned well :-). One of my primary requirements for the migration was that I be able to replicate all the functionality of my existing Blog, and this included the look and feel (which I do happen to like, despite wincing I see from some visitors to my pages) of my blog. This meant replicating the page template and CSS from my blog. I immediately ran into problems: for example, my CSS markup for my blogs was based on being able to markup components of the date of the entry (day, day of week, month, etc) and achieve fancy effects; and there was no easy way to use preexisting functionality of IkiWiki to present the information to the page template. Thus was born the varioki plugin; which attempts to provide a means to add variables for use in ikiwiki templates, based on variables set by the user in the ikiwiki configuration file. This is fairly powerful, allowing for uses like:
    varioki =>  
      'motto'    => '"Manoj\'s musings"',
      'toplvl'   => 'sub  return $page eq "index" ',
      'date'     => 'sub   return POSIX::strftime("%d", gmtime((stat(srcfile($pagesources $page )))[9]));  '
      'arrayvar' => '[0, 1, 2, 3]',
      'hashvar'  => ' 1, 1, 2, 2 '
     ,

The next major stumbling block was archive browsing for older postings; Blosxom has a nice calendar plugin that uses a calendar interface to let the user navigate to older blog postings. Since I really liked the way this looks, I set about scratching this itch as well; and now ikiwiki has attained parity vis. a vis. calendar plugins with Blosxom. The calendar plugin, and the archive index pages, led me start thinking about the physical layout of the blog entries on the file system. Since the tagging mechanism used in ikiwiki does not depend on the location in the file system (an improvement over my Blosxom system), I could layout the blog postings in a more logical fashion. I ended up taking Roland Mas' advice and arranging for the blog postings to be created in files like:
 blog/year/month/date/simple_title.mdwn

The archives contain annual and monthly indices, and the calendar front end provides links to recent postings and to recent monthly indices. So, a few additions to the arch hook scripts, and perhaps an script to automatically create the directory structure for new posts, and to automatically create annual and monthly indices as needed, and I'll have a low threshold of effort blogging work flow for blog entries, and I might manage to blog more often than the two blog postings I have had all through the year so far.

17 December 2006

Erich Schubert: Spammers bypassing greylist filters?

A few weeks ago, some spammer sent out a spam wave abusing one of my domains (fortunately one I havn't been using much). I quickly reacted by rejecting all mail to this domain. However, I'm still seeing frequent mail delivery attempts. Apparently spammers have "discovered" the email address one of them invented, and are now spamming these addresses. Great... that's like... spammer masturbation? making up your own email addresses to spam to... And worse: apparently they're now trying to bypass greylisting. Looks like we've now hit the point where greylisting will lose much of it's effectiveness we all love it for. :-( thats really bad news. Here's an excerpt from my logs (addresses removed to protect the invented):
Dec 10 14:58:54 postfix/smtpd[25738]: NOQUEUE: reject: RCPT from unknown[89.129.198.153]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<random@random.tld> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<mail.001sm.com>
Dec 10 15:00:25 postfix/smtpd[15969]: NOQUEUE: reject: RCPT from unknown[89.129.198.153]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<random2@random2.tld> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<mx1.cnm.cn>
Dec 10 15:02:35 postfix/smtpd[15139]: NOQUEUE: reject: RCPT from unknown[89.129.198.153]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<random3@random3.tld> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<mx2.fr.clara.net>
Dec 10 15:04:40 postfix/smtpd[10646]: NOQUEUE: reject: RCPT from unknown[89.129.198.153]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<random4@random4.tld> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<mail.1-shops.com>
Dec 10 15:06:46 postfix/smtpd[20414]: NOQUEUE: reject: RCPT from unknown[89.129.198.153]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<hisyn@0reality.com> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<aspmx2.googlemail.com>
Dec 10 15:09:48 postfix/smtpd[20608]: NOQUEUE: reject: RCPT from efi235.internetdsl.tpnet.pl[83.14.242.235]: 550 <agricolaapocalyptic@mydomain.tld>: Recipient address rejected: Spammers invented this address, it does not exist.; from=<random5@random5.tld> to=<agricolaapocalyptic@mydomain.tld> proto=ESMTP helo=<efi235.internetdsl.tpnet.pl>
Yes, that is one host retrying for 8 minutes (usually enough to bypass a greylist), another one a few minutes later, and a third one 5 days later (not included in the log); hosts that didn't make it past the RBL are not included. All in all I count 148 email delivery attemts to this address. And all on a random email in my domain that never existed, and is not a dictionary address like sales@domain.tld; but this probably means I won't be able to enable a catchall for this domain ever again or face loads of spam. OTOH, my spam filter can probably learn that "agricolaapocalyptic" is a sure indicator for spam and just discard all of it. P.S. this effect makes it more plausible that spammers are grabbing the Outlook address books of Windows users to use for spam; it's plausible the spam-address was auto-collected by outlook and then in turn collected by the next spammer. Maybe we really need to create random addresses until they give up on having sane databases sometime? Or at least blacklist our domains for their email collectors...

15 December 2006

Jan Wagner: Reduce spam significant

With policyd-weight you are able to reject mails before the body is received by your MTA, here postfix. No bounce mails, less wasted bandwidth and cpu time. policyd-weight scores characteristics of the mail positive or negative, is a defined value reached, it got rejected. The scores are currently:
- DNSBLs/RHSBLs
- HELO argument
- MAIL FROM: argument
- Client IP address
- DNS client/HELO/FROM entries (A/16 A/24 A/32), PTR/FQDN and Parent Domains (MX/16 MX/24 MX/32) for their correctness respectively whether they match.

It’s available in etch and bpo, installation is really easy:
aptitude install [-t sarge-backports] policyd-weight
Remove unnecessary reject_rbl_client and reject_rhsbl_client checks from main.cf and insert the check_policy_service:
smtpd_recipient_restrictions =
        permit_mynetworks,
        ...
        reject_unauth_destination,
        check_policy_service inet:127.0.0.1:12525
        ...
You can create a “/etc/policyd-weight.conf” if you would like to adjusting scores or other policyd-weight parameters. You can get the defaults with “policyd-weight defaults”. For more informations have a look at “/usr/share/doc/policyd-weight/documentation.txt.gz” or http://policyd-weight.org. A normal day on a backup MX with ~500 domain:
backup:~# zgrep -e "postfix.*: connect from" \
      /var/log/mail.info.0   wc -l
29936
backup:~# zgrep -e "policyd-weight.*decided action=5" \
      /var/log/mail.info.0   wc -l
22738
backup:~# zgrep -e "postfix.*status=sent" \
      /var/log/mail.info.0   wc -l
5570
, , , , , ,

Next.

Previous.