Thursday, February 28, 2008

Introducing Mixed

As far as I know, the Cheese Shop didn't have any way to handle fractions and mixed numbers... until now. Introducing mixed.
>>> print Mixed('-1 1/2') + 2
1/2
>>> print Mixed('3/4') + Mixed('1/2')
1 1/4
>>> print Mixed('-1-1/4') * 2
-2 1/2

You'll feel like you're in second grade all over again!

easy_install mixed to get it.

I hosted the code on Assembla, which has free mercurial repository hosting, so anybody who wants to polish it up is welcome to! hg clone http://hg.assembla.com/mixed_python mixed_python gets you a copy of the repository.

And all this because I was importing into a table last night and noticed some mixed numbers. A normal human being would have just converted them to floats in her head and gone to bed...

Sunday, February 24, 2008

Speaking at PenguiCon

I really enjoyed last year's PenguiCon - science fiction geekery and FOSS geekery make a surprisingly nice combination, with the SF people adding a nice lightheartedness to the atmosphere.

I'm giving a talk again this year, but this time, it will have nothing to do with Python - really! I'm going to try some of that hybrid vigor for my own talk, hoping that a fun theme will leaven a potentially dry topic.

Into the Dayta-b'hase: A First-level Introductory Adventure
April 19th, 2:00

Relational database technology underpins modern business, finance, engineering, and a lot of other boring stuff. You know you ought to learn something about databases, but how can you stay awake long enough? Come see database software used for something that actually matters: D&D characters. We'll set up a postgreSQL database, demonstrate all the fundamentals of relational databases, and advance Gruk the Unbathed to 4th level.

Northfield B
Hilton Detroit/Troy-Auburn Hills
5500 Crooks Rd
Troy, MI 48098 USA
(248)879-2100

Friday, February 22, 2008

how to spoil an OSS conference

I'm expecting to be in Washington D.C. on April 22-23, so imagine my delight when I learned of a "Military Open Source Software Conference" at that very time... in that very place! I work on a military contract! What could be better?

Now imagine my shock when I went to register. $1.945. For two days. Two days!

This, folks, is the problem with conferences run by for-profit training companies instead of volunteer organizations. No, wait, it's just one of the problems.
26 Senior Experts from: OSD, BTA, DHS, DON/CIO, AFAE, SPAWAR, FCS-BCT PO, HPCPO NGA, NASA/JPL, PEO-STI, USACE, Hill AFB, BAE, Boeing, Northrop Grumman, Lockheed Martin, Unisys, IBM, CSC, Rockwell Collins, Sun, Booz Allen Hamilton, Autodesk, SEI, and Mercury
What's wrong with this list? Not one representative of any open-source project! With a speakers' list like that, I don't know if it's even worth pilfering a hotel catering uniform and a pitcher of ice water to go eavesdrop on the talks.

Apparently, the topic is limited to decisions regarding open-source at a managerial level, rather than the actual use of the software and participation in its communities. That shows a serious lack of understanding. Breaking the separations between decisionmakers, code-writers, and users is part of what gives open source its power.

And suppose you, as an attendee, wish to suggest a topic, present a talk, or facilitate a discussion? Well, you can't. There's no provision for participation by the attendee community. Again, they very seriously do not get it, only seeing one-way relationships from paid content creators to passive content receivers. It seems that, just as "you can write COBOL in any language", you can buy proprietary software under any license.

It all makes me extra-grateful to the volunteers who run conferences like PyCon. (Register by March 7!)

Thursday, February 21, 2008

VC cloning into an existing directory

Mercurial won't let me clone into an existing directory.

This is a problem when trying to put (only) a subset of files under version control. For example, an Oracle installation includes an enormous directory structure. A few of its files really, really ought to be under version control (init.ora, tnsnames.ora, etc.); most shouldn't. I need an hg repository in the root of the Oracle software installation. Then, when I set up Oracle on a new machine, I need to clone that repository into the new machine's Oracle root... even though the new machine's Oracle root already exists and is chock-full of files.

$ hg clone src target
abort: destination 'target' already exists


I'm surprised that there's no --overwrite flag for hg clone, or anything like it, saying "go ahead and clone into that directory even though it already exists." Perhaps it's simply because VC programmers are software developers, used to working with a clean slate rather than configuring an existing directory structure? Anyway, I made up a script workaround.

hg clone $1 $1_clone_temp
cp -r $1_clone_temp/* $2/
rm -r $1_clone_temp


Or, in Windows,

hg clone %1 %1_clone_temp
xcopy /e /s /h /g /y %1_clone_temp %2
rmdir /s /q %1_clone_temp


Thanks to the Linuxchix irc channel for helping me figure out the syntax.

Dayton Oracle SIG

At last, it's time for DAY-O to meet!

Meeting of Dayton-Oracle SIG (DAY-O)

March 10, 2008, 5:30 pm
A hands-on, cooperative, laboratory-style meeting. Bring a wireless-enabled laptop if you have one. This meeting's topic will be Flashback.
Mary-Ann's Kitchen
33 N Ludlow St
Dayton OH 45402 USA
(937) 222-3663

Wednesday, February 13, 2008

Access forbidden. Attempted work detected.

The forbidden-content blocker at my worksite is more stupid than the one at your worksite. Doubt me? "Computing/Internet" is one of its forbidden categories. Blogs, another forbidden category, are the biggest problem because, as you know if you're reading this, most of the good code samples in existence these days are on blogs. We aren't allowed to appeal categories, only individual sites.

When I whined about it to my boss, he reminded me that I've done some work with web-scraping, and that I could probably write a Python script to make an exemption request for thousands of blogs at once, including ones I've never seen but might Google up someday. It'll benefit thousands of geeks across the organization, and maybe even convince somebody that they should turn the "stupid" dial down a notch.

I love my boss.

Here's the plan:
1. whitelist and blacklist of known legit and non-legit sites, respectively
2. count words. Words that appear much more frequently on whitelisted sites than on blacklisted are positive scorers, and vice versa.
3. apply the scoring vs. unknown sites. Hand-check a lot of results. Beef up the whitelists and blacklists and repeat until the scores against new sites are reliable.

Oddly enough, the hardest part of the process is gathering a long enough blacklist. I'm not just talking porn - I need harmless but non-work-related stuff, blogs where people are writing about their Irish setter instead of their SQL queries. (I need bunches of them - dozens, at least - so don't just comment to tell me, "My blog is useless and banal!")

One of the best sources I've found so far has been googling for "typical stupid blog".

Friday, February 01, 2008

TechFest 2008

If you're near Dayton, and you have a child, or know a child, or can find a child, or feel like a child, then you really need to get to TechFest!

Hands-on science and technology family fun
Feb. 16, 10 AM - 6 PM; Feb. 17, 11 AM - 5 PM
Sinclair Community College - Ponitz Center
444 W. Third St., Dayton, OH

I'm afraid the information technology people haven't traditionally brought stuff with quite the "wow" factor that the physical scientists and engineers bring. What's something we computer geeks could do that would compete with the chemists' goo-making or the physicists' pneumatic implosions? Have to think about that one.

in school, not even a Smurfette

So far, I've taken my smashing-planets introduction to Python to two groups of college students: the Wright State chapter of ACM and an OO programming class at University of Dayton. It's been lots of fun. I appreciate the chance to show young people something I really love, something I think can make their computer work more productive and more fun. My thanks to the folks who decided to invite me and the students who gave me their attention.

But. If I don't see a woman student in computer science soon - just, for crying out loud, one woman student - I am going to... I don't know. I'm going to have to research "how to go berserk".

What's going on in this country? I think I'd see better gender balance in a classroom in Iran.

Packet from table 6

I wish I knew more about networking. I have a technical need that I can barely describe, much less name.

For our new Dayton Oracle SIG, we want to run interactive, laboratory-style meetings. We'll meet in a place with wireless, one member will bring a laptop running an Oracle server and Oracle Application Server, and other members will use their laptops to access it and muck around.

This requires the computers using the wireless network to access not just the internet, but each other. I'd call this "peer-to-peer" networking, but it's really "peer-to-router-to-peer".

If I connect to my wireless at home and issue ifconfig, it reports eth1 ... inet addr:192.168.1.45. For other machines connected to the same router, that IP address is as usable as anything on the internet. If Oracle and Apache are running on the machine, I can use 192.168.1.45:1521 and 192.168.1.45:80 to log into the database or view webpages from other machines. If I go into my router and set Port Forwarding to ship incoming traffic to 192.168.1.45, then those become visible to the wider internet... but, to access them within the wireless network, I don't even need to do that. (In fact, I don't see any way I could turn it off even if I wanted to.)

So all we need is a meeting location that allows the same thing. It's not that simple, though. As far as I can tell, the wireless at Panera Bread (my first choice) doesn't permit this kind of inter-machine connection. That locally assigned IP address doesn't produce any response from other machines in the same network; it seems the router simply doesn't route traffic between machines. For security's sake, that kind of makes sense; I wouldn't want somebody hacking my database from the next table over. (Actually, if they did, I'd invite them to the SIG, but that's me.) But it removes some really neat possibilities for interaction.

I've found one place so far - the Hope Hotel in Fairborn - where the wireless does allow connections between machines. I was all ready to declare the hotel restaurant our meeting location, until my boss reminded me that it's full of GIANT TELEVISION SCREENS BLARING SPORTS and some people don't tune that out as automatically as I do.

I suppose there's always the option of bringing a router with me... but then I'd have to bridge people's traffic up to the internet somehow. I'm sure it can be done, it's just something I've never developed the skills for, nor do I own a particularly portable router. Hmm...