tpot (at) frungy . org
|
Thu, 18 Dec 2003Please select your job function:
Wed, 17 Dec 2003Python comes with a nice mixin class, UserDict.DictMixin for emulating container (dictionary) types. All you have to do is provide __getitem__(), __setitem__(), __delitem__(), and keys() and the mixin class does the rest. Here's my implementation of a tdbdict from the SWIG bindings for Samba's Trivial Database: import tdb, os
from UserDict import DictMixin
class tdbdict(DictMixin):
def __init__(self, name, hash_size = 0, tdb_flags = 0,
open_flags = os.O_RDWR | os.O_CREAT, mode = 0600):
self.tdb = tdb.tdb_open(name, hash_size, tdb_flags, open_flags, mode)
def __getitem__(self, key):
result = tdb.tdb_fetch(self.tdb, key)
if result is None:
raise KeyError(key)
return result
def __setitem__(self, key, value):
tdb.tdb_store(self.tdb, key, value, 1)
def __delitem__(self, key):
tdb.tdb_delete(self.tdb, key)
def keys(self):
result = []
while 1:
if len(result) == 0:
k = tdb.tdb_firstkey(self.tdb)
else:
k = tdb.tdb_nextkey(self.tdb, k)
if k == None:
break
result.append(k)
return result
The DictMixin class implements all the other dictionary
methods (values(), items(), has_key(),
get(), clear(), setdefault(),
iterkeys(), itervalues(), iteritems(),
pop(), popitem(), copy(), and
update()) without any additional effort. posted at: 17:24 | path: /computers/programming | permanent link to this entryTue, 16 Dec 2003From the Washington Post (warning: irritating registration required): Patenting Air or Protecting Property? Information Age Invents a New Problem By Jonathan Krim Washington Post Staff Writer Thursday, December 11, 2003 Universities, corporations and tens of thousands of Web site providers across the country probably never imagined they would be rooting for the pornography industry. ...Ha ha. Almost as funny as "router". posted at: 15:15 | path: | permanent link to this entry I enjoy reading Joel Spolsky's Joel on Software column. The latest edition is a review of esr's The Art of UNIX Programming from the point of view of a Windows programmer. His main point is that it is only cultural differences (i.e GUI vs command line) that separate us as programmers. However he nicely provides a counter example to his other point, that "Raymond all too frequently falls into the trap of disparaging the values of other cultures without considering where they came from". He then exclaims that that "the Unix world is so full of self-righteous cultural superiority, 'advocacy,' and slashdot-karma-whoring sectarianism". Wow. It's a shame that people emphasise the adversarial nature of Windows and UNIX as the two systems can co-exist quite nicely serving complementary roles within an organisation. Most of this is probably due to Microsoft's continuous output of FUD on the topic which tends to spill over into the mindset of developers on both sides. Of course it's easy to see that there is bias in both camps, and esr is perhaps not the most restrained of commentators when it comes to pointing out the good and bad points of the two cultures. It's kind of sad to see Joel take esr's UNIX superiority complex at face value though. posted at: 12:08 | path: /software | permanent link to this entryMon, 08 Dec 2003The Python Cookbook in the ActiveState Programmer Network has a bunch of neat Python patterns. I've just discovered a whole bunch of them by one guy, Alex Martelli. They have a simple elegance to them that is very characteristic of Python. Here are my favourites: Assign and Testhttp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66061
Determining Current Function Namehttp://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062import sys this_function_name = sys._getframe().f_code.co_name this_line_number = sys._getframe().f_lineno this_filename = sys._getframe().f_code.co_filename Multiple ConstructorsFinally, here's a a nice pattern from Skip Montanaro for having multiple constructors for a class a la C++:
Go Python! posted at: 13:59 | path: /computers/programming | permanent link to this entryWed, 26 Nov 2003Programming Interview Question What does the following code do?
I had to ask someone wtf was going on here. (-: posted at: 14:41 | path: /rants/c++ | permanent link to this entryTue, 25 Nov 2003Tridge, and a handful of others on the Samba Team, have been working on a rewrite of Samba. Slashdot trolls notwithstanding, it's coming along very nicely and at a much greater speed than I had expected. There are a number of interesting design patterns that have emerged.
Mon, 24 Nov 2003More nice things about Subversion The more I use Subversion the more I like it. My favourite feature at the moment is the easy learning curve when migrating from CVS. The command line and the output produced by commands is very similar to CVS and quite Unixy. The built-in help is consistent and useful. There are even little hints when you use CVS syntax. For example when diffing two respository versions, Subversion gently tells you that you can't use two -r options ala CVS but rather -r REVISION:REVISION2. Nice. posted at: 13:02 | path: /software/subversion | permanent link to this entry "Avoid the slashdot effect, don't read the articles!" posted at: 10:29 | path: /internet/sigs | permanent link to this entry Thu, 20 Nov 2003The cost of operating system integration I see several problems with integrating "non-core components" in to an operating system. My example in this case is Internet Explorer.
Tue, 18 Nov 2003From http://satya.virtualave.net/msmatrix.html: Like Keanu Reeves, most people's eyes will hurt when they first look at the real world, because they've never used those eyes before. But I've chosen that real world, because while the Matrix of Linux has rules and regs every bit as stern -- and often sterner -- as the Matrix of Windows, that Big Difference pops up: unlike the Microsoft Matrix, you can hack the Linux Matrix from the inside, change that reality if you don't like it, and no-one will stop you -- they'll even applaud. You can unplug the steel tubes, squelch out of the nutrient pod, and make your own way in the world. And having that option -- even if you never use it -- makes a huge difference.posted at: 11:48 | path: /rants/microsoft | permanent link to this entry Sat, 15 Nov 2003It's probably too much to expect spammers to learn about word wrapping. From: "Larry Moore."... I have been diagnosed with prostate and esophageal cancer that was discovered very late due to my laxity in caring for my health. It has defiled all form of medicine and right now, I have only about a few months to live according to medical experts.Heh. posted at: 15:12 | path: /internet/spam | permanent link to this entry Fri, 07 Nov 2003Traditionally people have been saying that email is unusable because of spam. I have received more complains from users who have subscribed (presumably posted as well) to the samba mailing list and have immediately started receiving viruses. At least spammers are content to send you only a handful of emails about penis enlargement for each email address. Microsoft viruses just keep on sending you copies of themselves. There's no inherent rate limiting in the process. My conclusion here is that spam produces less traffic than Microsoft viruses, hence email is rapidly becoming more unusable because of them. posted at: 02:19 | path: /rants/microsoft | permanent link to this entry Thu, 30 Oct 2003Checking out a repository: svn co svn+ssh://ozlabs.org/home/mbp/svn/ipmimsg/trunkAdding files to the .cvsignore equivalent: svn propedit svn:ignore .Subversion is very neat, but I haven't really used it enough to remember how to do things I can do without thinking in CVS. posted at: 15:54 | path: /software/subversion | permanent link to this entry Thu, 23 Oct 2003There are 6 critical updates for you to install "A security issue has been identified that could allow an attacker to remotely compromise a computer running Microsoft® Windows® and gain complete control over it" is a registered trademark of Microsoft. posted at: 10:10 | path: /rants/microsoft | permanent link to this entry Tue, 21 Oct 2003I tried another mailing list (the ethereal developers list) and a posting under a previously unused email address resulted in viruses delivered to that address. Unlike the Samba users' list, the first virus didn't arrive until a couple of days later. posted at: 13:04 | path: /internet/spam | permanent link to this entry Mon, 20 Oct 2003We have been doing some landscaping to our front garden over the last couple of weeks. The grandson of the last owners came around to collect a crabapple tree we saved. It was a gift to the grandparents when the grandson was little. He is going to replant it on his property in Murrambateman. I hope it survives. posted at: 11:04 | path: /garden | permanent link to this entry Wed, 15 Oct 2003Another handful of virus laden emails have arrived at my honeypot address including this one: If there's blame to be handed around, surely Telstra and other ISPs forwarding on known virus infected emails should get some. I don't know why they think this is a good idea. posted at: 17:24 | path: /internet/spam | permanent link to this entryOct 15 06:32:45 dp postfix/cleanup[24928]: 915AB2C05F: discard: header Content-type: application/x-msdownload; name=Q878311.exe from mta08bw.bigpond.com[144.135.24.137]; from=<rosebery@XXXXXXXX.com.au> to=<asmithee@samba.org> proto=ESMTP helo=<mta08bw.bigpond.com> Recently a number of patrons of the Samba mailing list have been complaining that they have signed up and shortly afterwards been inundated with virus emails. It turns out that the person in question has actually posted to the list as well. Various stupid theories on why this is happening and how it is all the fault of the Samba Team have been proposed (including one threat of "we should be able to sue you for this"). While I now ignore the clueless rants of whingers who don't understand how mail works, this problem intruiges me. What seems to be happening is someone makes a post to the mailing list using a valid email address. The fraction of the membership of the mailing list that is currently infected with the latest Microsoft virus of the month receives the email and starts propagating itself to this new address. Martin pointed out that this sort of email is much worse than spam. In general spammers aren't interested in sending you too many copies of advertisements for penis enlargement pills. I only receive a handful of duplicate spams, most of which have been sent to different addresses which are delivered to the same inbox. The current crop of viruses don't seem to have any self limiting property that prevents multiple emails being sent to the same address. As an experiment, I made a post using a new email address to the Samba list. I will keep track of all replies to this address and see if there is one or many list subscribers that are sending virus emails to list posters. It may be possible to determine whether this is malicious or accidental. As I have been writing this entry, there have already been three hits on the email address since the posting about 15 minutes ago: The first log entry is the posting record from mailman, the second an autoreply - only merely annoying. The last two are viruses, perhaps different ones. Interestingly enough, there is no-one currently subscribed to the Samba mailing list from iprimus.com.au although it could have been sent from a virtual host. posted at: 14:15 | path: /internet/spam | permanent link to this entryOct 15 03:32:18 2003 (25821) post to samba from asmithee@samba.org, size=2214, message-id=<20031015032935.GA25510@proforma>, success Oct 15 03:31:31 dp postfix/smtpd[3279]: B8F7A2C2C4: reject: RCPT from mx10.kentrox.com[192.228.33.31]: 550 <asmithee@samba.org>: User unknown in local recipient table; from=<XXXXXXXX@kentrox.com> to=<asmithee@samba.org> proto=ESMTP helo=<mx10.kentrox.com> Oct 15 03:45:38 dp postfix/cleanup[4584]: 51D5B2C07F: discard: header Content-Type: application/x-msdownload; name="Install9.exe" from smtp01.syd.iprimus.net.au[210.50.30.52]; from=<cwkd@iprimus.com.au> to=<asmithee@samba.org> proto=ESMTP helo=<smtp01.syd.iprimus.net.au> Oct 15 03:53:01 dp postfix/cleanup[5577]: 3E6272C018: reject: body <iframe src=3D"cid:brrygfk" height=3D0 width=3D0></iframe> from smtp02.syd.iprimus.net.au[210.50.76.52]; from=<cwkd@iprimus.com.au> to=<asmithee@samba.org> proto=ESMTP helo=<smtp02.syd.iprimus.net.au>: Message content rejected Thu, 09 Oct 2003As they say on Slashdot, YOU FAIL IT! posted at: 16:35 | path: /internet/spam | permanent link to this entryTo: admin@samba.org From: wrong_address@entran.com Subject: YOUR EMAIL WAS REJECTED! IMPORTANT NOTICE!!! Your email to Entran was not received - the email address used is incorrect, please check it carefully. Wed, 08 Oct 2003Get out of your parent's basement! From the Guardian Unlimited: Aaron Caffrey, 19, is alleged to have brought computer systems to a halt at the Port of Houston, in Texas, from his bedroom in Shaftesbury, Dorset, in what police believe to be the first electronic attack to disable a critical part of a country's infrastructure.Yep, IT infrastructure is so crappy it can be DoS'ed by a bored teenager from his bedroom. Bruce Schnier has pointed out on many occasions the woeful state of computer security is not really going to improve unless we can effectively protect it from slightly motivated teenagers. Also: Caffrey was arrested in January last year and told police he had used the nickname Aaron X. He denied targeting the port's system but admitted to knowing what a "denial of service" attack was and that they were "easy to perform".posted at: 17:24 | path: | permanent link to this entry Mon, 06 Oct 2003The power went out just now followed half a second later by a huge clap of thunder. Obviously something was hit by lightening. Using the light from the laptop screen (heh) I fumbled around to find the box of candles and emergency stuff from under the bed only to find there was nothing to place the candles on! There's nothing like actually testing your emergency procedures to see whether they actually work. I'm surviving by reading cached pages in Mozilla by candlelight. posted at: 21:24 | path: | permanent link to this entryFri, 03 Oct 2003"Blame India for that jobless recovery" From The Sydney Morning Herald: ... Surely large and inappropriate on-costs aren't being used as an excuse to "offshore" (aargh - another perfectly good adjective converted to a verb) workers to countries with cheaper labour costs? It must cost a lot of money to run those Gulfstreams though. The title of the article is a bit emotive though. How about "Blame inefficient accounting for that jobless recovery"? I don't think that would sell many newspapers though. posted at: 11:53 | path: | permanent link to this entryC/R: Fighting spam by creating more of it. I love the complaint of how he is receiving automated junk-emails in his automated junk email. You would also think that since he is paying money for this service (the address was one from Spamarrest) that they would not send out challenges to mailer daemon addresses.
I can't believe people pay money to have someone annoy others on
their behalf! posted at: 08:27 | path: /internet/spam | permanent link to this entryThu, 02 Oct 2003For the last 18 months I have been a happy subscriber to Emusic. It's a neat little operation where you pay a small monthly fee (less than the cost of one CD) and can download mp3's from large range of recording labels. The files you can download are not Top 40 or latest release stuff, but rather old back catalogs of less popular artists, 60's jazz, blues, weird electronica and much more. About 3 months ago Emusic decided to change the method of downloading tunes to require a proprietary binary-only download manager. Previously, downloads occured either directly through the browser, or by using Zinf. As you can probably predict, the Linux version of the download manager was a complete disaster. Apart from the many cosmetic bugs, it had the annoying tendency to segfault whenever the C library was upgraded. The solution was to download an old version of glibc and use $LD_PRELOAD - not really something your average Linux user is expected to be able to do. After a couple of months of procrastination and waiting to see if the bugs would be fixed, I contacted customer service. The helpdesk offered to release me from my contact and wouldn't be drawn into a discussion of the technical issues or provide any information on the status of the Linux download manager whatsoever. Basically, I was told if I didn't like it I could go away. )-: So I did. I'm pretty sure all the things they want to do such as limiting the number of concurrent connections, the number of consecutive downloads, watermarking (what is that random junk that mpg123 complains about seeing at the start of the mp3 files?) can be done server-side. There's no apparent technical reason why this should require a proprietary piece of software running on the client. posted at: 14:58 | path: /internet | permanent link to this entry Mon, 29 Sep 2003It was refreshing to read through the developer guide for Judy. Occasionally there's an example of terrible engineering humour I'm sure people are already familiar with: "Judy IV turned out to be enormous and time-consuming... Obtaining a ~2x improvement in speed and space required ~5x lines of code and ~10x complexity, but we only lost 3-4 engineers to malnutrition during the implementation phase." "Real programs don't eat cache." Apart from the lame jokes, Judy looks like a very interesting piece of software. It has a clean and simple API that seems to defy the complexity that lies under the hood. Inserting nodes into the tree causes Judy to create different species of sub-nodes whose format adapts to the type of data being inserted. The authors claim large memory and speed benefits over traditional data structures (arrays, sparse arrays, hash tables, B-trees, binary trees, linear lists, skiplists) for almost any type of data. Bonus marks given for mentioning Recursive Make Considered Harmful. It's nice to see people within HP doing some real engineering rather than reselling Microsoft kit and announcing .NET related joint ventures. The developer's guide is called a "Shop Manual" which is pretty cute. posted at: 12:16 | path: /computers/programming | permanent link to this entry Fri, 26 Sep 2003Idea for a bandwidth efficient MTA Postfix is great. We use some of the niftier UCE extensions on samba.org to reduce our spam and virus load. Originally we had a body_checks rule that rejected all messages containing a particular string in the message body that corresponded to the header of a .EXE file. A more advanced rule can be written with Postfix 2 using the mime_header_checks table to block all attachments of a particular type. # Handle dodgy attachment types. For the latest virus DISCARD
# them but perhaps this should be changed to REJECT later on.
/^\s*Content-(Disposition|Type).*name\s*=\s*"?
(.+\.(lnk|asd|hlp|ocx|reg|bat|c[ho]m|cmd|exe|dll|vxd|pif|
scr|hta|jse?|sh[mbs]|vb[esx]|ws[fh]|xl))"?\s*$/ DISCARD
(Remove linebreaks to make the above appear on just one line) Postfix 2 also allows the administrator to DISCARD a message matching a table check rather than REJECT which produces a bounce message. Generating a bounce, while the correct thing to do according to the RFC, is pointless and counterproductive when the From header is known to be incorrect. Using the above entry as a MIME header check allowed samba.org to weather the last couple of Microsoft viruses/worms/malware (Blaster, SoBig) and as a bonus, is relatively future-proof as other viruses relying on email to propagate are automatically blocked. For example the expression did not need to be updated for the Sven worm. Other people have come up with similar configurations for Exim and other mailers. However the whole idea of server side filtering is based on the idea that bandwidth is essentially free. In Postfix expressions in the header_checks table can be done with only the overhead of a SMTP HELO and transfer of SMTP headers. The body_checks and mime_header_checks require the DATA portion of the SMTP protocol exchange to be completed, or at least started. In some countries bandwidth is anything but free and customers pay by the byte. Why isn't teergrubing integrated into MTA software? The idea isn't particularly new. A host initiating a SMTP exchange is throttled down to an arbitrarily slow speed which has the effect of saving bandwidth for the receiver. No RFCs are harmed during this process, and resources are expended on the sender's system. Unfortunately the reverse is also true - the receiving system also has to consume system resources to keep track of the connection. I propose an extension to an MTA that incorporates teergrubing on an IP based level. A baysean filter or a table of regular expressions could be used to match against message headers or bodies. Once a particular IP address sends a spam or virus mail they get (say) a ten second penalty. For further offences the speed and latency of the connection can be adjusted. The receipt of legitimate mail can act in a positive way so as not to penalise one-off offences. posted at: 13:48 | path: /internet/spam | permanent link to this entry Wed, 24 Sep 2003One of the more interesting Slashdot trolling pastimes is the impersonation of famous personalities. The idea is to masquerade as someone related to the parent story and go trolling. Today's slashdot imposter is Seth Finklestein. Witness this example of the art. posted at: 11:51 | path: /internet/slashdot | permanent link to this entry Fri, 19 Sep 2003
Thu, 18 Sep 2003The Net Interprets Verisign As Damage... and routes around it, to paraphrase John Gilmore.
I don't think sitefinder is going to last very long. posted at: 09:04 | path: /internet | permanent link to this entry Wed, 17 Sep 2003This was an amazing little space opera type game from my childhood that is chockers full of jokes, great old-skool tracker mods and very engaging game play. My brothers and I used to play it for days at a time and start the traditional fights over whose turn it was to use the computer next. The original authors released the source code for the 3DO version as open source and it has been taken up and ported to the PC (it was originally only available on PC as a DOS program). Go get it here. Joey Hess has packaged it for Debian so now it's a simple matter of going apt-get install uqm rather than having to download random bits of SDL from CVS to get it to work by hand. There is also a win32 installer for Linux-impaired systems. "What is this game called frungy? How is it played? Who's ahead in the frungy championships?" posted at: 15:28 | path: /computers/games | permanent link to this entry FP! Hello to random other web logging poseurs on the internet. posted at: 15:28 | path: | permanent link to this entry | ||||||||||||||||