Musings of an anonymous geek

August 17, 2007

Vacation

Filed under: Me stuff — m0j0 @ 4:28 pm

I relinquished control of my house to my friend and neighbors for the coming week, and I’ll be in Martha’s Vineyard until August 27th with my wife and daughter, along with my mother- and father-in-law, sis-in-law, and her fiancee. We have lots of activities planned, including tuna fishing (if they’re running).

So, if you don’t see me on IRC, or I don’t reply to your email, or I don’t show up to a meeting, or whatever, that’s why 🙂

August 15, 2007

My Gatorade Attacked Me And All I Got Was… the thirst quenching of a lifetime?

Filed under: Me stuff — m0j0 @ 10:25 pm

I just want to ask the folks who do the marketing for Gatorade to stop coming up with beverage names that border on being downright threatening.

No, really.

I went into the refrigerator to look for something to drink just now, and way in the back I noticed a bottle of something I’d never seen before. I was pretty sure I didn’t want it, because it was blueish purple, and I’m not aware of anything that color that I’d want to ingest, but I wanted to know what it was, anyway. I noticed it had a Gatorade logo on it, and so I figured maybe it wouldn’t be so bad, because nothing Gatorade makes is anything like a normal color, and some of it isn’t bad. But then I saw the name of this stuff:

“Fierce Grape”

Now, for my money, I say give me some peppy grape, or maybe something a little stronger like “heavy grape” or something. If I’m feeling spry I might go so far as “aggressive grape”. But even there, there are still a whole bunch of levels of grape you have to pass through before you get into the same ballpark as the grape that is called “Fierce Grape”. You leap straight past even “intimidating grape”, and even that is too rich for my blood. Certainly no human would consider introducing one’s innards to something more grapy than that, would they?

There’s just no real need for my grape to be fierce. What kind of person needs their grape to be fierce I wonder? Have people gotten so aggressively competitive in every aspect of their lives that now even their beverage of choice has to be somehow more kickass than everyone else’s?

Well, I’m now relaxing with a Poland Spring, and I’m staying away from the dangerous-looking drink in the back of the fridge with the chip on its shoulder.

August 5, 2007

Catching up, Part 2: Python Magazine Update

Filed under: Python,Technology — m0j0 @ 6:45 am

So, it’s been 1 month since we officially announced Python Magazine’s existence. I’m very happy (and even more relieved) to report that things are going wonderfully so far.

In these early days prior to the actual release of the first issue, the focus is primarily on content development. This is also called “getting articles in the door so we can publish a magazine”. The goal here is to avoid the scenario where you wake up on September 1, say “hey, I need content for the issue coming out on October 1!”.

It’s nearly impossible to attract authors, get good proposals, get authors to write articles, edit those articles, validate the code samples that come with the articles, format the articles, and compile them into a magazine you’d actually want to read… all in 30 days. This is why magazines (and even online publishers) shoot for a backlog of articles. Depending on the size and scope of the publication (and some other stuff like how time sensitive the material is), that backlog can be anywhere from 1 month (for online stuff, mostly) to a year. We’ve chosen a magic number of 4 months.

The initial goal was to commission 4 months worth of content before September 1. This means we’d like to have signed contracts with willing authors agreeing to write at least one article for us. As it turns out, we not only commissioned 4 months worth of content by *August* 1, but we’ll probably have almost 4 months worth of content *delivered* by September 1.

And darn good articles they are! Keep an eye out on the Python Magazine web site for a couple of things of interest:

  • An editorial calendar – this is where you can see what kind of content is coming up in future issues of the magazine.
  • A sample article! Sometime before October 1, we’ll probably post a sample article that is more or less representative of the content we’ll have in the magazine. I have my eye on an article we might use for such a purpose now – but you’ll have to watch the PyMag site for updates.

As usual, if you’d like to write for Python Magazine, drop us a line, and/or join the authors mailing list by sending a blank email to authors-subscribe at lists dot pythonmagazine dot com

Catching up, Part 1: New Job!

Filed under: Technology — m0j0 @ 6:26 am

Ok, I have lots of blogging to do now. I haven’t blogged in at least a week, and plenty is happening.

First, I have a new job. For those who didn’t know, for the past 6 years I was working for the Computer Science Dept. at Princeton University. I’ve moved over to work in an environment that will provide me with challenges that simply cannot and will not exist in the CS environment. It’s the hardest decision I’ve ever made, because Princeton is such a wonderful place to work that most people never leave.

Anyway, I now work here –> http://www.gfdl.noaa.gov

July 24, 2007

Looking for the Twitter Kool-aid

Filed under: Technology — m0j0 @ 7:09 am

So, *another* person asked if I’m “on twitter”, so I went and got on there. Whatever. As far as I can see, it’s a useless distraction, but people seem to be obsessed with it. I’m convinced that these people don’t have any real work to do.

Once you sign up, the only thing you can really do is send email to your friends to recruit them. How egomaniacal do you have to be to send email to all of your friends saying “hey, come and see what I’m doing at any moment in the day – because I *know* you’re interested in that”…..?

Maybe there’s some hidden useful purpose that I haven’t found yet. I’ve at least set up the IM gateway so I never have to go to the web page. More on this as I dig.  In the meantime, if you’re doing something with twitter that’s actually useful, please let us all in on it!

July 21, 2007

Where does that Python DB handle go?

Filed under: Python,Scripting,Technology — m0j0 @ 11:33 am

UPDATE: Well, that didn’t take long. My solution works, but there’s a better way. Create the connection in main(), and create separate *cursors* for each Host. Cursors are cheap, and you reuse the connection. Thanks to Brend on #python (irc.freenode.net) for the enlightenment.

Python has been a wonderful language to get to know so far. However, one thing I didn’t really miss about Java and C++ were the decisions that are kind of forced upon you when you have various objects working together in a program, controlled by code in a “main” function. Here’s one decision I was faced with that took more thinking than I’d like to admit to make.

I have a class, we’ll call it “Host”. Of course, there are also methods for that class, like Host.record_name() and Host.update_mac() and the like. These methods are just wrappers around some SQL.

I also have, of course, a “main” function, which is where we create instances of Host and call the methods we need on the objects.

The question now is, where exactly should we create the handle to the database? There would appear to be 4 choices (without getting overly absurd):

  1. In main() and then pass the handle to the class’s ‘init()’
  2. In main(), but pass the handle to each method of any object that needs it.
  3. In Host.init(), so methods can refer to it without creating it themselves.
  4. Inside the individual methods themselves.

I chose option #3. The only part that bothers me about it is that a new “Host” is created, and then destroyed, for each of a couple thousand lines of a file. Hence, there is the overhead of setting up and tearing down a database connection a couple thousand times every time this script is run. I’m not sure (yet) what the cost of this will be.

Certainly, the cost will be less than if I did it for each *method* that was called, so that insures that option 4 is probably not the right way to go.

The semantics involved in creating the handle in main() and passing it to Host’s init seemed less than straightforward to me. It seemed there was the potential for main to pass in a copy of the handle at object instantiation time, have the object be destroyed when it’s done doing its work, taking the connection with it, and then main still thinks it’s a useful handle and tries to pass it to the next object that needs to be created. If that’s not the case, then what is the status of this thing that main created? What will happen if main tries to pass it to another object?

Of course, this problem would also exist if we passed it to each method that needed it. It would also be more overhead, and it would seem needlessly draconian, especially since *every* method of the object in question would need it.

If I’ve misunderstood something, or have made a poor choice, feel free to clarify/flame/enlighten me in the comments 🙂

Technorati Tags: , , , , , , ,

Social Bookmarks:

July 19, 2007

Why you should write: common myths debunked

Filed under: Big Ideas,Productivity,Python,Technology — m0j0 @ 8:38 am

I give a talk that advocates writing. I do this because I owe my career to people who wrote down what they knew and made it available in one form or another; either free on a web site, or in a book that I bought.

When I started editing, one of my jobs was to encourage people to write for whatever publication I was working for at the time. I’m now Editor in Chief for Python Magazine, and I’m back in the role of encouraging people to make their knowledge available for others (including me!)

Python Magazine is going well in terms of authorship, but with all of the Python coders out there, I should be overwhelmed with article proposals! When I talk to people who clearly know what they’re doing, or are doing something cool, and ask them to write, the responses are, by now, pretty predictable – and mostly based on misunderstandings, myths, and other untruths. I thought I’d take a few minutes to address the most common ones here:

“I can’t write”

The king of reasons for not writing is this one. The problem isn’t really that the person literally cannot write. The problem is twofold: first, the person has absolutely zero confidence in their ability to write. Second, the person doesn’t understand what an editor is supposed to be doing to earn his keep.

I’ll tackle the second part of the problem first: an “editor” is not some gray haired guy with a cigar screaming about deadlines and rejecting 99% of everything that hits his desk. An editor is someone who works *with* writers. It’s not *supposed* to be an adversarial relationship – and it *is* supposed to be a relationship. It’s supposed to be a working relationship where the writer tries to relay concepts in a way that the *editor* can understand. In return, the editor asks questions, pokes, prods, and makes suggestions that help morph the article into something the *readers* will understand.

Further, the relationship may begin before a draft is ever submitted. I’ve helped lots of writers develop their *abstracts*, so that by the time they sit down to write the article, they have some clear idea where they’re headed. And the word is *helped*, not *dictated*. It’s not me passing back a marked-up copy and saying “fix this and do that”. It’s me writing back saying “I’m a little confused in this part, how does this work?” or “can you provide a use case in which someone would find this useful?”

Finally, this excuse may have foundations in a perceived language barrier. If English is not your first language, you may feel like you’ll never get published in an English publication. Not true. If you have the knowledge, and can write enough English to relay the concepts, a good editor will work with you to develop it into something suitable for publication. It may take a bit more time, but that’s usually not a problem. In technical publishing, knowledge trumps prose every day of the week.

“I don’t know what to write about”

One day while you’re coding, just stop. Stop and take stock of what you’re working on. In all likelihood, there’s an article in there. If you’re thinking “there are a thousand articles about this already, in addition to the online docs”, you need to know three words: “Fresh, relevant content”.

A thousand articles have been written about just about everything! Why do you think that is? In the tech world, it’s because technical people tend to pay close attention to the date of publication to figure out if the content is fresh and relevant to the current version of whatever they’re using. Because technology evolves, there is often a need to get updated information to the readers.

The other part of this objection is the idea that the reader can get the same information from online documentation, or that what you might write about is just too easy for anyone to find useful. This is usually based on an assumption that because the writer learned it in an hour reading online docs, that everyone can/will/wants to learn that way. I hate online documentation, especially for programming languages. So do lots of other people. That’s why people buy enough technical magazines for my publisher to let me head up another one!

Also, people read about things in magazines that they may otherwise never read about if it were online, and they get inspiration from these things on occasion. Why? Because it’s there. When I go to get my oil changed, I bring a magazine with me to read while I’m waiting, and I read stuff I wouldn’t normally seek out online because I have time to kill. When you see people at the DMV (or MVS, or wherever people go to get their licenses renewed or cars inspected), a lot of them have magazines with them. They have time to kill. Inspiration can come from the strangest places. So whatever it is you’re doing, write about it, and inspire someone to take whatever it is you’re doing and do something else cool with it. Even if it’s, say, the Python tempfile module or something mundane like that 🙂

There are three things I tell people about where to find article ideas:

  • Write about stuff you know/do – this is a gimme.
  • Write about stuff you *want* to know/do – You don’t have to be an expert on Twisted to write an article about it. If you’ve done some network programming with Python at all, and are wanting to get into Twisted, research doing what you want to do with Twisted, figure out if it’s a good choice, do a proof of concept, take some notes, and write an article based on what you’ve done!
  • Write about stuff that is not done, or often done wrong – Best practices documentation is severely lacking. There are a trillion articles that talk about different ways to do similar things, but very, very few articles that say “Here are three common ways this is done, and here’s why this fourth way might be better” or “Here are the pros and cons of doing this using 2 different methods”. Because best practices documentation is lacking, things are quite often done in a suboptimal way. Articles like “How not to do web programming with Python” might cover why you don’t want to use the split() function to parse URLs, for example 😛

More on the way

I’ll expand on these and address more common reasons for not writing in future posts. In the meantime, if you’d like to give writing a shot, and you write a decent bit of Python code, I invite you to come and write for Python Magazine. I look forward to working with you!

Technorati Tags: , , , , , , ,

Social Bookmarks:

July 12, 2007

My first interview

Filed under: Me stuff — m0j0 @ 6:42 am

I was interviewed by Tony Mobily of Free Software Magazine! You can see the interview here.

Also, if you’re tired of Slashdot and Digg, Tony also works on Free Software Daily.

July 11, 2007

Python 2.5’s “partition” saves my bacon

Filed under: Python,Scripting,Technology — m0j0 @ 8:42 pm

So I was on more than one IRC channel today asking a question that I got lots of answers to, all of which looked really messy to me, so I dug into the documentation and found that in Python 2.5, strings have a new method, called “partition”.

Here’s the trouble I had, and why “partition” helps:


>>> m = "parent:child"
>>> x = m.split(":")[1]
>>> x
'child'

This is actually pretty close to what I want. I want to split m, and assign the second element in the resulting list to x. The problem arises when there is no “:”. In that case, that second line is actually trying to assign to x by referencing an index that is beyond the end of the list. You get an “index out of range” error.

So you’re left with a number of options. You can use an “if” to check for the existence of the colon.


if ":" in m:
x = m.split(":")[1]

I guess. But then I have to use another “if” to check and see if x was ever defined, or I have to initialize x ahead of time. At this point I’m onto at least three lines of code for something that takes 1 line in Ruby, Perl, or PHP. That just *can’t* be right!

You can also go ahead and just add the “:” explicitly to “m”:


>>> y = m + ":"
>>> y
'parent:'
>>> x = m.split(":")[1]
>>> x
''

Nothing wrong with that except I still think I just shouldn’t have to do that. I should be able to, as a last resort, go with regex and do a one-liner that assigns everything after “:” to x, and if there isn’t a “:”, then x would wind up being empty. Something along the lines of x = re.search(“:.*”, m) – or something like that.

Well, partition solves the problem rather nicely. From the documentation:

Split the string at the first occurrence of sep, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings. New in version 2.5.

Here’s what I did with it:


>>> y
'parent:'
>>> x = y.partition(":")[2]
>>> x
''

Of course, I got an empty string in this case, but “partition” did what I wanted “split” to do – namely, assign ” or None to “x” if the separator didn’t exist. I guess what makes this possible with “partition” is the fact that it returns a fixed-length tuple no matter what, while split returns an arbitrary-length list, which would introduce ambiguities in cases where multiple splits are done to a string.

Technorati Tags: , , , , , , , ,

Social Bookmarks:

July 6, 2007

On the demise of SysAdmin Magazine

Filed under: Big Ideas,Sysadmin,Technology — m0j0 @ 12:57 pm

CMP recently announced that they will cut 200 jobs, and shut down more than one magazine in the process, folding their content into other existing magazines. There has been a lot of buzz in the sysadmin community (which I know largely as a loose collection of people who belong to LOPSA, SAGE, USENIX, or local groups of various kinds) about how sad and unexpected this is and how it’s a sign of the times or something.

You Can’t Sell a Generalist’s Mag to a Market of Specialists

I actually think SysAdmin’s demise was a long time coming – in part because, well, I’m involved in the publication of a couple of magazines, and read lots of others, and know people who work in publishing on other magazines as well as large online media outlets (some of whom I also write/edit/consult with). The plain fact of the matter is that it is extremely difficult to cover a topic like system administration in a generalist sort of way when your audience no longer consists mostly of generalists.

For example, the last two issues of SysAdmin magazine I remember getting were about Database Management, and Linux, respectively. The database management issue talked about Oracle and MySQL, and then had 3 or 4 articles on things not really directly related to databases at all, if memory serves. The Linux issue is probably of no interest to the admin who was all revved up for the Oracle articles, because that admin is probably not so much a sysadmin as an “Oracle admin”. Meanwhile, the average Linux administrator is probably uninterested in the Oracle RAC Primer.

Most admins aren’t generalists anymore unless they work in academia, research, or a company small enough that there are only a couple of people to handle the entire infrastructure. Even people who would like to be more general aren’t doing generalist things in production. I know several people who work *only* on {Oracle, sendmail, websphere, whatever-other-service-you-like} at work, and nothing else, but they run Apache, Bind, Postfix, and a few other services at home. That knowledge is nice to have, but it’s hardly something you can use to market yourself as a production generalist administrator.

So the market is flooded with mail administrators, backup administrators, storage administrators, cluster administrators, network administrators, database administrators, websphere administrators, exchange administrators, desktop administrators… the list goes on and on and on. The magazine market has mostly followed suit. There are magazines about cluster computing, DB2, AIX, SQL Server, Linux servers, Windows servers, and lots of other specialized areas. Note in that list that there are two separate magazines for two separate database products, but no “DBA’s Journal”. In killing SysAdmin Magazine, CMP is just following along with market trends.

Programming has mostly gone in the same direction. Dr. Dobb’s Journal is no longer available on your local bookshelf, but you can find php|architect, a magazine about nothing but PHP, doing well. Others exist for .Net, Cold Fusion, C/C++, Java, and now even Python. I’m sure Ruby and Lua aren’t far behind.

“I know, let’s start our own magazine!”

There are lots of naysayers out there who seem to think you need a huge staff, tons of money, and loads of other resources to start a magazine. Not true. You need a few dedicated, motivated people, and a small amount of seed money, and some time and hard labor.

An example is php|architect. It started with two guys: the publisher (who was a software development consultant as well), and his business partner, who also knew Quark pretty well – plenty well enough to do the layout. Then I came on board. So after the first issue came out, the rest were all tech and copy edited by the publisher and I, and the layout was done by the other guy. That’s really minimizing the amount of work we did, but the point is you don’t need an army.

When you’re as big as CMP and you’re looking at cutting a million bucks or something from your operating expenses, you go ahead and cut away! A small outfit isn’t playing with these kinds of numbers. A full-time editor at a company like CMP probably makes a 6-figure salary. A guy like me who edits as a side job makes something like… far less than that. At that rate, you can add another editor, a tech editor, a couple of columnists, all part time, and the advertising revenue will still cover the costs.

So if you want to see a sysadmin magazine, get some dedicated people who have half a brain and go do it!

Good luck.

Technorati Tags: , ,

Social Bookmarks:
« Previous PageNext Page »

Blog at WordPress.com.