This is carlo.log, the weblog of Carlo Zottmann — coder, gamer, runner and husband from Munich, Germany. There's an RSS feed, too.
February 25, 2009.
This is a reblog of a post from my new Ruby-themed tumblelog. I know it’s kind of cheap to repost your own stuff, but who cares.
I’ve spent a couple of hours today pulling my hair out while trying to get one of my background job scripts to work with god, the “easy to configure, easy to extend monitoring framework written in Ruby”.
Well, it took a while to make it work, tho. Yes, god is cool and simple and gets the job done. But there are some things that cost me hours and which I found out only by reading the source code.
So, I just want to quickly jot down some gotchas before I forget them again, running the risk of falling into the same traps again in the future.
My script used the constant LOG to keep my Logger instance. Logging worked fine when I ran the script by itself, yet when god took over, it didn’t anymore. Actually, the script died rather quickly. As there was no logging at all going on, and all STDOUT output was suppressed, I came rather close to losing it. Turns out god itself is declaring a LOG constant of its own, which was done before my script had the chance, so when it attempted to initialize it, it would actually try to re-declare an existing constant, and we all know how well that works. ;)
Once that was done, my script was logging just fine, but it didn’t produce any output whatsoever. Raah! Teeth were gnashed… there was definitely teeth gnashing going on. Even telling “my” Logger (the one inside my script) to write to a file didn’t produce anything. That was a fun hour, really. The reason for this behaviour: god is closing all open file descriptors when it sets up monitoring a script. Which included my script. Awesome! On the upside, it meant I could get rid of the part of my code dealing with different logger behaviours. Meaning less LOC! It doesn’t get any more agile than that, folks.
In case you actually want to capture anything your original script is sending to STDOUT, there’s the not-really-documented God::Watch#log. Set it inside your God.watch block to specify a log file. (See example below.)
If you need to set ENV variables, God::Watch#env is your friend. Accepts a hash with arbitrary key/value pairs. For example, I declare a few God.watch blocks, one for each value of an array (think “worker 1 to 5″), and I use God::Watch#env to pass the current value to the worker script. Works well.
When you do a sudo god stop <watch>, make sure to give it a few moments before running sudo god start <watch> again, or you might end up with orphaned unmonitored scripts running rampant in the background.
Running sudo god log without any further arguments will tell you that “You must specify a Task or Group name”. That’s actually a lie, as it only accepts task names. (A group is a number of related tasks. A task is a single monitoring watch.)
So, yeah.
Don’t get me wrong, please: It might not look like it, but once I had figured it all out, I’ve decided I actually like god. I like the feature set, it’s really easy to set up, and it works. I’m happy it exists.
January 09, 2009.
Damn, Mookie tagged me. Well, why not.
I’d like to tag everyone who feels like participating in this crazy new meme. For example Mike or Hendrik, who would both really surprise me would they take this thing and run with it. I doubt it, but you’ll never know. So… It’s a FFA. Find the rules over at Mookie’s place.
January 06, 2009.
As mentioned earlier, Yahoo! decided to shut down its entire Munich engineering department. So since January 1st, I am officially out of a job.
What a downer… or is it?
After some deliberation and discussions with Dana, I’ve decided to concentrate on the bright side: I have a few ideas for products (read: websites), and now I finally have the time to work on them. I’ve always contemplated building them in my spare time while still being employed, but apart from a few small experiments (which were fun to write but are hardly my personal “next big thing”) that concept didn’t work out so well.
Thus, I’ve decided to concentrate on my own stuff in 2009 — full frontal self-employment. That’s right, I’m an entrepreneur now.1
I plan on spending about half a year to bring my ideas to life, and then taking on freelance jobs later on to bolster the income these site will (hopefully) generate. My ideas are related to gaming, both because it’s something I love and because I am definitely seeing a market there. I think my concept is sound, and I know I can build this …thing. It won’t be easy, but I have no problems working for my money. ;)
I don’t know whether it will work out or not, but I want, nay, need to try. The time certainly is as right as it gets. Actually, one could argue that I’ve waited a bit too long with my idea, since a “contender” appeared on the scene a short time ago.2 But I don’t see this as a showstopper, quite the contrary — it’s good to have competition as it keeps you on your toes. :)
So, 2009: it’s going to be my year. It’s a grand experiment, and while working alone I won’t be alone, as my wonderful wife and my friends are supporting me. Still, I don’t know yet whether I will succeed or if this kind of thing will be working for me. Quite honestly, this makes me a wee bit nervous.
Nonetheless, full steam ahead!
Yes I can.
Actually, officially not yet, as there’s still a bit of paperwork to work through with a small number of different parties, but this won’t have any effect on the decision already made. ↩
I could say he stole my idea, but that’d be bullshit: I didn’t tell it anyone, and besides — ideas are cheap, they only count when you pursue them. ↩
January 02, 2009.
I didn’t write as much as I had planned on doing, but nonetheless, here are a few of my “better” posts (subjective opinion, YMMV).
Have a good 2009.
December 04, 2008.
That said, these are gruesome times for publishing, and a lot of folks are not as well-positioned as I am. Imprints have vaporized, layoffs have begun, and it’s better-than-even odds that a number of authors and books are going to get shaved off of publishing lists. 2009 is also likely to be a singularly lousy time to be an aspiring debut author, as publishing houses consolidate their lists and focus their resources on established avenues (i.e., spend their money on people who are already bestsellers) rather than seeking out new folks. Basically, life’s gonna suck in publishing for the next year or possibly two.
I love my ebook reader (Stanza on the iPod as you can’t get the Kindle here in Germany yet), and I’d like to buy more ebooks. It’s a distribution channel which (I think) would be a pretty good way for the publishers to make additional money …if many of these files wouldn’t cost me as much or more than the dead-tree versions.
I mean, really: I like good novels as much as the next guy, and I am definitely willing to spend money on them. Also, I don’t like hardcovers for the price tags (yes, I think $25 is a lot of money). One would think that a digital version would cost substantially less than the hardcover, but it’s not always the case. Case in point: “Zoe’s Tale” by John Scalzi, currently on sale for $25 (ebook, FictionWise) and $17 (hardcover, Amazon).
I have no problems with paying $7 or $8 for an ebook, but anything over $10 is highway robbery.
Do not misunderstand me: yes, I am tempted to buy it, but I will fight the urge, because quite frankly, John’s a great writer, and I enjoy his novels very, very much. Also, I don’t think he’s the one dictating the price — so who’s responsible for these insane prices which seriously keep me from spending money?
(BTW: Yes, you might say “get the paperback”, but this is not my point. My point is: I want the digital edition, because it’s the version I prefer for various reasons.)
Anyways, I believe right now the publishing industry is facing the same problems as the music industry — they’re shooting themselves in the foot because they are either ignoring the possibilities of using a great distribution channel or actively sabotaging it by asking for completely disproportionate amounts of money.
Angry Carlo is angry.
(This is a slightly longer repost of a comment I’ve left on Whatever. After posting I wanted to make some clarifications, but couldn’t edit the comment, so here we go.)
You look like you have no time, but still need to find some Xmas gifts, but have no idea what to get them, right?
Then try my new site, random.li: fast-paced, crack S.W.A.T. team-style gift finding.
Go go go! No time to waste! :)