What’s the newest Python Comp. Sci. Textbook?

A Computer Science textbook that uses Python as its core language was released, I believe, this year. However, I CAN’T FIND IT! I searched google, amazon, bn.com, and used all the terms you’d normally think of using, and I can’t find this book anywhere. The book is black, and has a picture of a snake’s head on it. Can anyone help me out with finding this book?

Where Can I Go That Isn’t Twitter?

In the few years since Twitter’s launch, they have shrunk the number of ways you can interact with it, shrunk the number of hours in the day when you can reliably get or send messages through it, and, now, shrunk the number of useful web-based services by two, with the announcement that stikkit and I Want Sandy will be shutting down, as a result of their purchase of Values of N, creators of the two sites.

I only just started trying to use twitter again in the past week or so, and my desktop client has recorded at least 3 or 4 outages in the past week. Between that, and now this news, I think I’m just going to give up. What are they planning to do — add Sandy-like features to twitter? Why? To attract more users, insuring that their availability will sink to zero-nines? Blech.

Linux on Laptop = Epic Fail

I brought my MacBook Pro in for a warranty repair yesterday around noon. Since then I’ve been using a Lenovo T61 to get basic work done, and also to see if any progress has been made in the area of Linux support for my laptop. I bought this laptop specifically because a website said that it was very well supported by Linux distributions “out of the box”, including video and wireless. I was sure to make hardware choices that didn’t require special third-party drivers… I’ve been doing this for 10 years, so I have some understanding of how to buy a laptop that I plan to put Linux on. Well, this time I apparently failed.

First, I had Ubuntu installed, and I was never able to keep the wireless card working consistently. To be honest, Ubuntu is the best distro I’ve had on this thing so far. Next, I gave OpenSUSE 11 a shot, and there’s been no end to the issues. Of course, it started with the wireless card. I have an Intel 3945ABG wireless card, according to lspci and dmesg output. In fact, here’s my lspci output right here:

00:00.0 Host bridge: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub (rev 0c)
00:02.0 VGA compatible controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:02.1 Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (rev 0c)
00:19.0 Ethernet controller: Intel Corporation 82566MM Gigabit Network Connection (rev 03)
00:1a.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #4 (rev 03)
00:1a.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #5 (rev 03)
00:1a.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #2 (rev 03)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 (rev 03)
00:1c.1 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 2 (rev 03)
00:1c.2 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 3 (rev 03)
00:1c.3 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 4 (rev 03)
00:1c.4 PCI bridge: Intel Corporation 82801H (ICH8 Family) PCI Express Port 5 (rev 03)
00:1d.0 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 (rev 03)
00:1d.1 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 (rev 03)
00:1d.2 USB Controller: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 (rev 03)
00:1d.7 USB Controller: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 (rev 03)
00:1e.0 PCI bridge: Intel Corporation 82801 Mobile PCI Bridge (rev f3)
00:1f.0 ISA bridge: Intel Corporation 82801HBM (ICH8M-E) LPC Interface Controller (rev 03)
00:1f.1 IDE interface: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller (rev 03)
00:1f.3 SMBus: Intel Corporation 82801H (ICH8 Family) SMBus Controller (rev 03)
03:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
15:00.0 CardBus bridge: Ricoh Co Ltd RL5c476 II (rev ba)
15:00.1 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 IEEE 1394 Controller (rev 04)
15:00.2 SD Host controller: Ricoh Co Ltd R5C822 SD/SDIO/MMC/MS/MSPro Host Adapter (rev 21)
15:00.3 System peripheral: Ricoh Co Ltd R5C843 MMC Host Controller (rev ff)
15:00.4 System peripheral: Ricoh Co Ltd R5C592 Memory Stick Bus Host Adapter (rev 11)
15:00.5 System peripheral: Ricoh Co Ltd xD-Picture Card Controller (rev 11)

I’m running the KDE4 desktop, and tried using the default NetworkManager icon that’s in the systray to get things working. From what I saw there, it appeared that my card wasn’t scanning. I put in my network details manually, and tried to connect, and it failed with no errors. In the NetworkManager log there was lots of output, but nothing particularly useful. It just said the association took to long and that it was now marking that connection as ‘invalid’. Great. So here I am, trying to use Linux on the desktop, and only 5 minutes after the very first system boot, I’m tailing log files and debugging, and basically playing sysadmin, which is exactly what I don’t want to be doing on my desktop system. Restart NetworkManager, see what dhclient is doing, reboot, check /etc/modprobe.d, lsmod…. fail. Now what?

Well, I opened kwifimanager, and it said that I had indeed associated with an access point. So… I *am* scanning? Hmm. I had no IP address, so I figured I had probably fat-fingered my WEP settings somewhere. Tailing /var/log/messages agrees, saying WEP decryption is failing. So I double-check everything, all looks normal and correct to me, I try again, and No Bueno. *sigh*.

Finally, I reverted to command-line tactics, and ran this little line:

iwconfig wlan0 essid <myssid> key <mykey>

Magically, it works, where all of the GUI nonsense had failed. Now here’s a question: how the hell do you get this to “just work” at boot time? Well, I had about 10 emails to send to clients, so I put that question off and fired up a browser and…. fail. WTF?

I had an IP address, pinged my router, pinged another host on the network, all good. Pinged an external IP I know by heart, fail. Ugh. Ran ‘cat /etc/resolv.conf’ — empty. Apparently, dhclient didn’t update the information it got from my router. It also didn’t update when I set the domain in NetworkManager to ‘home’, because it still said ‘search site’. I added the proper lines in there, and tried again in the browser… fail. Now what?!?

Ran ‘netstat -rn’. I don’t have a default gateway. *sigh*…

route add default gw 192.168.1.1

And I finally have internet access.

Of course, I can’t work 24 hours a day, so I went to bed, and left my laptop running so I could get right back to work in the morning. Or not.

I had foolishly chosen to use an OpenGL screensaver. Overnight, it completely locked up the machine, rendering it useless without forcibly rebooting it. So much for getting right back to work.

Well, let’s see if I can get some of these issues fixed by updating the software, since I’m now at least connected to the internet (of course, after the forced reboot, I had to do the iwconfig->route add routine again). Ran the updater, picked some extra repositories, and it goes off to set things up. Unfortunately, it also prompts me to import probably 50 or so GPG keys. Annoying. More annoying is, after all of that, it fails to update any of my software, even though it tells me there are updates available. Why you ask? Here’s what I got…

Failed to mount cd:///?devices=/dev/sr0 on /var/adm/mount/AP_0x00000001: No medium found (mount: No medium found)

Click ok. Get same error again. Click ok. Get slightly different error…

Unexpected exception. Failed to mount cd:///?devices=/dev/sr0 on /var/adm/mount/AP_0x00000001: No medium found (mount: No medium found)

Click Ok, get another message…

Please file a bug report about this. See http://en.opensuse.org/Zypper#Troubleshooting for instructions.

I go there, the URL isn’t valid. I find the Troubleshooting page on my own, and there’s a bunch of generic troubleshooting information there. More command line sysadmin-ish stuff in there. Just the kind of stuff I don’t need to be spending otherwise billable time on. I give up and decide that I’ll just deal with it in its broken-ass state for the next 10 hours or so until I can get my beloved MacBook Pro back.

Help me pick a new feed reader

I’ve been using Google Reader since it was created. I really love the *idea* of Google Reader. I like that scrolling through the posts marks them as read. I like that you can toggle between list and expanded views of the posts. I like that you can search within a feed or across all feeds (though selecting multiple specific feeds would be great).

All of that said, I’d like to explore other avenues, because I don’t like that there’s, like, zero flexibility in how the Google Reader interface is configured. My problem starts with large fonts…

I use relatively large fonts. If you increase the font twice up from the default size in firefox on a mac (using the cmd-+ keystroke, twice), and you have more than just a couple of feeds, you wind up with this really horrible side pane with the bottom half of it requiring a scroll bar, and the text wraps, and it just looks terrible. What makes this really REALLY REALLY annoying is that:

  1. I don’t use the features included in the *top* part of the side pane, ever, at all (like ‘trends’ and stuff), and
  2. You can’t resize or disable that part of the side pane.

I’ve used folders and some other features to try to alleviate the issue, but it’s just a compromise, and I’d rather not do that if something else would work better for me. I’ve had a couple of quick glances at just a couple of other readers, but I thought I’d get some input from the lazyweb to see what your thoughts are. Is there a browser-based feed reader that has some of Google’s niceties, but perhaps with a little bit nicer/more configurable interface? Out of curiosity, are you using a Mac-compatible fat-client reader that just totally r0cks in some way? If so, let me know in the comments.

MacBook Pro: Should I Just Get a Refurb?

I hate glossy screens. I’ve tried them. I don’t like them. It’s true that it would probably be good for my eyes in some way, since I do a lot of reading on the laptop and things *are* sharper with the glossy screen. However, there’s just no way I can deal with having a glossy screen all the time, because I don’t have control over the lighting when I’m out and about at client sites or working from a coffee shop or something. If there’s a really busy background, or a huge window at your back, the screen becomes distracting and in some cases unusable due to its highly reflective nature.

Maybe this is a ploy by Apple to actually sell off all of their refurbs and clearance items in a hurry, and then they’ll offer the option on the new MBPs.

This experience has shown me something interesting about myself and my stance toward Linux on the desktop. I’ve run Linux on desktops for about 10 years. In the past 2 years it’s been less often, because that’s around the time I started making friends with the Mac. Over that time, I have apparently reached the point where I will sooner deal with the glossy screen nonsense than go back to using Linux on the desktop full time.

If Apple provides nothing else of value to the Linux community, they at least serve as a proof of concept that, if hardware compatibility is removed from the equation completely, UNIX-based machines can be extremely successful desktops.

Boto 1.5b glitch, and workaround

Boto is a Python library for interacting with Amazon’s web services. I’ve used it in the past, and am currently using it for an ‘s3get’ implementation based on a simple example I found buried in a post on Patrick Altman’s blog.

While testing my code, I noticed I was getting import errors from boto/connection.py, because I didn’t have a module on my system named ‘hashlib’. Then I found an svn trunk commit that clued me in to the fact that I wasn’t supposed to have hashlib, because I was running a pre-2.5 version of Python. They had put in a fix for pre-2.5 users, but somehow it wasn’t being obeyed.

Then I noticed that the import errors weren’t from utils.py, where the fix was committed, but from connection.py, which was explicitly importing the module itself. Closer inspection revealed that it was also importing utils.py, which itself imports hashlib. I commented out the explicit import in connection.py (and, later, in boto/s3/key.py), and stopped getting import errors.

If you’re still having issues with Patrick’s s3get.py code, it’s probably because you need to change this line:

if name == 'main':
       main()

To this:

if __name__ == '__main__':
    main()

MySQL Problem and Solution Posts: r0ck.

Taming MySQL is… challenging. Especially in very large, fast-growth, ‘always-on’ environments. It’s one of those things where you seemingly can never know all there is to know about it. That’s why I really like coming across posts like this one from FreshBooks that describes a very real problem that was affecting their users, how they dealt with it, why *that* failed, and what the final fix was. Post a link to your favorite MySQL Problem and Solution post in the comments (oh yeah, and “subscribe to comments” should be working now!)

On Remote Workers and Working Remotely

I’ve been on both sides of the remote worker relationship. On the manager side, I’ve managed some good-sized projects using an all-remote work force. Indeed, I’ve hired, managed, fired, and promoted workers without ever knowing what they look like. On the worker side, I do most of my work remotely, and I have for some time now. Judging by the amount of repeat business I get, I’d say that I’m more than acceptably productive working remotely.

In dealing with various clients, recruiters, prospective employers, business owners, and talking to friends who manage people for a living, I’ve heard pretty much every excuse/reason there is for not wanting to deal with a remote work force. I’ve heard and experienced successes with remote workers as well, and they all have a few key things in common, which are missing from the stories of failure. I’ll talk about them in a minute.

I first want to just say that I’m not some kind of fanboy who thinks remote workers are the answer to every problem. There are valid reasons for not having remote workers. For example, it’d be hard to build cars with a remote work force. Some things (some!) just require a physical presence. Whoever maintains the printers at your company really has to be around to change out ink cartridges and stuff like that.

There are certain classes of jobs, though, that are well-suited to working remotely. There are even classes of jobs that are necessarily performed remotely to some degree (field sales and support technicians for example), that could be made 100% remote with the proper tools and processes in place.

So what makes a remote worker success story different from a story of failure?

Always be prepared…

The number one difference I’ve seen between success and failure in managing a remote work force is that  successful managers spent the time to prepare the managers, the team, the department, the organization, and the remote workers themselves to work remotely.

If you don’t prepare for a remote work force, you will fail miserably. As a result, I’m a big advocate of treating “Let’s go remote!” as an internal project with goals and milestones just like any other project. Preparing an organization to manage a remote work force takes a good deal of forethought, with a focus on communication and collaboration tools, reporting, accountability, scheduling, etc. In addition, you have to prepare the remote workers themselves, to insure they know what’s expected of them in terms of reporting their status, scheduling, communication, etc. They also need to know *about*, and *how to use* the tools they’ll be expected to use from home.

You have to plan this. You have to prepare, or you’re going to be like the HR manager who told me their company no longer allows for remote workers because “we tried it once and the guy made a complete mess of things”. When I asked the HR manager why he attributed that to the geographic location of the worker, he said “good point, he could just as well have made a mess here in the office”. You need good workers no matter where they’re going to work. The workers need expectations and goals from the manager, and the manager needs feedback and communication (and results!) from the worker. Tools help to facilitate these things. This is already a long post, so I’ll probably make a tools list in another post.

Communicate, and set expectations

Before the tools come other higher-level decisions and communication. For example, one problem I’ve heard more than once about remote workers is “we can’t hire a remote worker full-time, because then everyone will want to work from home”. As if they didn’t already all want to work from home! Everyone would love to have the option! Even if they didn’t take advantage of it, they’d consider it a really cool perk! They’d tell all of their friends about it, because it would make them jealous, and guess who their friends will contact first when they start to look for other opportunities?

You have to start somewhere, and you can’t just swing the barn doors open and let everyone go their own way on day 1. If you have an existing corporate structure in place with assets and services and regular meetings and the like, then you have to decide who can make the most benefit from a remote situation the soonest, make them the pilot group, and manage the expectations of the rest of the organization while the pilot group prepares to move to a remote workspace.

1, 10, 100, 1000

A common software application rollout strategy is to make it accessible to 1 user, then 10, then 100, then 1000, then… move up from there. In preparing your organization or department, you might consider a similar strategy.

I work for a client right now where I’m the “1″. If I can work effectively with the rest of the team (in the office), if I can produce results, remain accessible as-needed during working hours, manage the expectations of my team with regards to my presence (appointments happen), and overall be an asset to the team, then the management may decide that it can work on some larger scale – even if ‘larger’ means 2 instead of 1. It might also be useful to do a ‘remote rotation’ so that glitches can be caught early before making a physical presence in the office optional.

Success, of course, means getting together with the team and figuring out what tools will be used to best emulate an office working environment. We use IRC for 99% of our communication, falling back to email when we need to cc managers, we have a wiki for documentation and status updates, we have a trouble ticket system, everyone has everyone else’s phone number, blackberry PIN, or whatever. We’re a technical group doing system administration. It’s working wonderfully.

“But if the sysadmins work from home, the developers will want to work from home!” Maybe so. That’s where you have to manage expectations, and communicate with your workers to let them know that the company’s ‘office optional’ project is in an early alpha stage, that it’s being tested on the group most familiar with the technologies involved, and most capable of exploiting those technologies successfully to produce results. Once the geeks work out the shortcomings, and management is able to evaluate the effectiveness of the plan, the tests will become more widespread.

Really, it’s not a whole lot different from doing anything else that affects the whole company: changing payroll providers, healthcare options, software and desktop hardware upgrades and replacements… it just takes communication. The process has to be managed, just like every other process.

There’s more than one way to do it!

There’s no one solution out there. When I joined php|architect Magazine in 2003, it was run by Marco Tabini, and I was a remote editor. A couple of months after joining, I became editor in chief, and was in charge of remotely managing the magazine. I did it differently from Marco, but he still remained involved and engaged through good communication.

Python Magazine was created and managed by me, and for the entire lifespan of the magazine, I have not seen anyone else involved in its production in person. Ever. Design, production, web site admin, executive administration, tech editors, authors, accountants… time lines, budgets and planning documents… all remote, and mostly delegated. I started the magazine with the thought that at some point someone more engaged in the community and with Python should take charge — I was just a “temp” to get the vision off the ground. Sure enough, when I handed the magazine over to Doug Hellmann, he did things differently from me, and it’s working out wonderfully for him as well!

Everyone has their own management style. Don’t think that just because your management style is a little unique you can’t handle remote workers. Good managers are creative, and aren’t afraid to execute on creative solutions.

Reunion with Drupal, Break from Django

My Drupal Reunion

I started using drupal maybe 3-4 years ago. At the time I wasn’t all that impressed. I liked it better than Joomla (Mambo, at that time), and it was a little more featureful than PHP-Nuke. But even back then I hated that this thing was really making some sweeping, grand assumptions about what I would be using my Drupal site for. I used Drupal for LinuxLaboratory.org, and it was ok. I left Drupal once, to give MediaWiki a shot, but the truth is I didn’t want a wiki, so I went out and tested a bunch of other applications, and wound up back at Drupal. The 5.5 release was quite a bit better, and it got the job done.

About 2 weeks ago (maybe less?) I downloaded version 6.6. I poked. I prodded. I looked for new themes and found lots of them, and they were pretty cool. I looked for theme and module-building tutorials, and there were lots of them, and even entire books were published on each of the topics – even specifically for version 6 of Drupal. I looked for modules, and found a few useful ones who actually showed a trend of following the Drupal releases pretty closely. I also found that a couple of things I had used as modules in earlier releases were now built-in.

I fiddled on and off for a few days and was able to get a site together for my company’s web site that’s way, way better than the wordpress site that was there before. I’m also redoing the main LinuxLaboratory.org site using Drupal.

What about Django?

I know that lots of you were encouraging me to keep moving ahead with Django. I *will* be moving ahead with Django at some point, but what I found is that doing example projects using the dev server and deploying a real application using Apache are such vastly different beasts that doing the former doesn’t really help make you qualified to perform the latter. When I had my site ready to go, and I had it working on my locally-installed dev server, I found myself completely lost when it came time to get it working on my webfaction account. It really shouldn’t be that hard, but it is. Or it was for me.

You can all take comfort in knowing that I still hate PHP and consider it a necessary evil. For the moment, though, I have a couple of projects involving PHP coming up. By the time those projects end, I hope I can be more skilled with Django, and with Django deployment. I’m not even going to mess with the dev server anymore. It’s just a damn tease. I’m going to sit down and spend some time with Django on Apache with mod_* and finally come up with answers to all the questions I had that nobody anywhere seemed to have any reasonable answers to. When I figure them out, I’ll post here and you can all flame me or learn something new, perhaps depending on your own skill level :-)

In the mean time, while I don’t typically do book reviews, I’d recommend that anyone using Django 1.x stay away from the book “Practical Django Projects”. It’s specifically non-1.0, and you’ll be tripped up from the very first sample app, and it doesn’t get better from there. If you want to learn from the book (and there’s learning to be had from it), download 0.96.x, and use that to go through the book. When you’re done with the book, read the release notes for Django 1.0. You’ll have to make some alterations before moving your apps to 1.0, but overall you’ll be just fine.

To PyWorks Speakers and Attendees

I’ve gotten several emails over the past couple of days about meeting up at PyWorks. This is reasonable, since I was the main engine initiating contact with prospective speakers back in the June-August timeframe. However, much to my disappointment, I won’t be attending PyWorks this year.

The story is basically that, in September, the startup I was working for was bought out, and I was thrust into managing projects to migrate the various components of our infrastructure to their new home with the new company. I was also executing a good number of migration tasks myself. This is not to mention the meetings and phone calls and long email threads, all while still maintaining the production site on a day-to-day basis, which is no small challenge.

Life just became a little nightmarish there for a while, and for the good of the conference and my sanity, I told Marco (Tabini, of MTA, who runs the conference, and Python Magazine, and php|architect… the list goes on) to turn over the conference organizer responsibilities to someone who could commit themselves fully to the tasks at hand.

So, I won’t be there. I’m not happy about it, but in the end it was better to turn over the conference than to destroy it altogether.

I’ll see you next year, and I guess there’s still a small chance I’ll make it to PyCon. I expect things to be settled before then.