nscgi: ns_request_cgi and REQUEST_URI change

In the “scratch your own itch” department, I decided to get WordPress working under AOLserver. WordPress is written in PHP, and while AOLserver can load PHP as a module, it doesn’t play nice when you configure AOLserver with multiple virtual servers. The other option, running PHP as CGI using nscgi and php-cgi, does work for the most part. However, there were a few issues I ran into that required changes to nscgi, which I’ll outline below.

Adding REQUEST_URI to CGI env. variables

PHP expects an additional environment variable, REQUEST_URI, to be included on CGI requests. Of course, this isn’t part of the CGI/1.1 specification. Basically, PHP expects REQUEST_URI to contain the Request-URI (from the HTTP/1.1 specification, see section 5.1.2). So, I added this in.

Mapping URLs to CGI with ns_register_cgi

In order to map an URL to be handled by nscgi, you previously had to make the change in your config .tcl and restart AOLserver. One of the great things about AOLserver is the fact that you can modify some settings at runtime, without a restart. So, I looked at whether it would be possible to add additional mappings at runtime, and it appears that under the hood, nscgi also uses the Ns_RegisterRequest C API which is supposed to be safe to execute at runtime. So, I added a new Tcl command, ns_register_cgi, which is now part of nscgi. It is just a wrapper around CgiRegister, and thus takes the same argument.

For example, if you wanted to map all requests to “/foo” (including “/foo/bar“) to a PHP script “/var/www/myfoo.php“, you would use something like this:

foreach method {GET POST HEAD} {
    ns_register_cgi "$method /foo /var/www/myfoo.php"
}

This maps GET, POST and HEAD requests to URLs starting with “/foo” to the script specified.

Caveat: It is currently possible to load the nscgi module multiple times in the same AOLserver process, for each virtual server. It is also possible to load it multiple times for the same virtual server. I’m not sure why anyone would do that, but it’s possible. In that circumstance, the behavior of ns_register_cgi is undefined–as in, I haven’t tested it. It may or may not work correctly. If you run such a configuration, where nscgi is loaded multiple times in the same virtual server, please test this carefully and share your findings. Thanks.

Where’s the code?

I’ve commited the changes to SourceForge CVS, both in HEAD (rev 1.33, diff) and the aolserver_v40_bp branch (rev 1.23.2.4, diff).

Tags: , ,

Tiger and Fudgebar, recent additions to our family

For Giftmas 2007, we adopted two cats–a brother and sister pair, originally named Pumpkin (boy) and Ashes (girl). We’ve attached additional names to them, namely Tiger for Pumpkin and Fudgebar for Ashes.

My wife did all the work of finding the cats and adopting them and without all her hard work and effort, nothing would get done around here. She also snapped off a few awesome pictures of the cats after they adjusted to the house a bit.

Here’s two pictures that she took of them that I got around to uploading:

Tiger and Fudgebar at the top of the stairs

Tiger and Fudgebar on the couch

Tags:

Life after a week of Cablevision/Optimum Online

After living with 384 Kbps SDSL for the past eight years, first with NorthPoint until they went out of business (1999–2001), then with Eclipse Internet Access (2001–2003) who was acquired by NetCarrier in early 2001, then to DSL.net who I’m still with today. Each time, I’ve been stuck with only 384 Kbps SDSL because every time we’ve moved, we’ve picked locations that are close to the end of the DSL physical limit–roughly 10,000-15,000 ft. from the telco.

The last time we moved back in 2001, I tried ordering Cablevision/Optimum Online. They gave me an install window of “sometime between 8 AM and 2 PM” which was pretty ridiculous, but whatever. By 1:30 PM, when no one showed up, we called to get a status update. We were told that they would contact the technician and get back to us within 30 minutes. At 2:00 PM, we hadn’t heard back so we called again to be told that they were on their way. By 3:00 PM, we had enough waiting and had other things to do that day, so we called back and cancelled the installation order. We left the house and did what we needed to do and came back around 4:00 PM. At 4:30 PM, the installer rolls up and I met him outside to ask, “Didn’t anyone tell you the install order was cancelled over an hour and a half ago? You realize our install was scheduled for before 2 PM.” He shook his head “no,” and I sent him away. The guy showed up in a pickup truck without a ladder or a bucket truck, which was necessary for our install anyway–how was he even going to complete the install even if he did arrive on time? We subsequently ordered DirecTV satellite for our TV service and I ordered the SDSL, and that was that.

So, we put up with our slow SDSL for so long because it has been really stable–I’d say close to 99.99% uptime or less than one hour of downtime per year! It was also business-level service with static IPs and I could host my own servers off the link as part of the agreement. Other than the speed, I was and still am very happy with the service. But, it would be nice to get more bandwidth, so I reconsidered doing cable broadband. Things couldn’t be as bad as they were 8 years ago, could they?

Fast-forward to last week, January 16th, to our Cablevision install date. I ordered Optimum Online for business with Boost and Static IP. The install window this time was “sometime between 11 AM and 2 PM.” Again, at 1:30 PM, there was no installer in sight, so I called to ask for status. I was called back and told that he was running late. He finally showed up close to 3:00 PM, but at least he had come with a ladder to get up the pole and do the outside wiring required. Around 5:30 PM, he’d completed the installation and everything was up and running. Not the greatest experience, but this time I at least had low enough expectations that unless they didn’t show up at all on the day of the install date, I wasn’t too bothered.

Over the next few days, I’d cut over DNS and mail and web over to the new static IP range I was assigned. After two days, the old DSL link went quiet indicating all changes had propagated. I’d set up bandwidth accounting to get an idea of how well the new cable link was doing. Here’s a snapshot of the graph from a recent time period:

rrd graph of 30Mbps/5Mbps Optimum Online link, from 2008-01-21
(click to enlarge)

The link is advertised as being close to 30 Mbps down and 5 Mbps up, and as you can see, the max the link saw over the past 12 hours in that graph was 24 Mbps down and 1.23 Mbps up–fantastic throughput, for sure. My laptop, connected to my network via wireless 802.11g at 54 Mbps, seems to get 5.0 Mbps down and 4.6 Mbps up using Cablevision’s SpeedCheck. Those numbers are a bit misleading as they only reflect speeds over your cable modem into their network–speed tests to sites on the open Internet come out noticably lower, probably due to Cablevision’s peering speeds or some other rate limiting or traffic shaping they have in place, would be my guess. Still, this is a far cry better than the 384 Kbps SDSL, right?

One thing I noticed about cable is the incredible amount of ARP chatter that comes down the pipe. My guess is there isn’t enough to materially affect the amount of available remaining bandwidth, but it’s interesting to see that kind of leakage. Another thing is the latency: on the SDSL link, latency was almost always ~20 ms, whereas on the cable link it fluctuates between ~20ms to as high as ~80 ms at times. While this probably isn’t noticed by your typical customer, I wonder how much jitter it causes on realtime applications such as VoIP or interactive SSH sessions. I guess I’ll just have to see.

All in all, I’m happy with the new cable link and will likely be shutting down the SDSL or keeping it as a backup if DSL.net will make me a great deal as it’s quite costly (around $130/month). Relying completely on the cable link makes me extremely uncomfortable, but the cost saving and additional bandwidth certainly makes it attractive. We’ll see how reliable this link over the next few months, as I’ve got the link monitored and bandwidth accounting set up, etc.

Tags: , ,

del.icio.us/dossy links since January 14, 2008 at 09:00 AM

del.icio.us/dossy (RSS) links since January 14, 2008 at 09:00 AM:

Today’s geek news: Sun acquires MySQL AB

Sun + MySQL = ???

After yesterday’s yawner of a Macworld Expo, I wasn’t really expecting today to yield much interesting news. Of course, I wake up to the news that Sun acquired MySQL! Both Jonathan Schwartz and Kaj Arnö share with us some of the best-laid plans of mice and men.

My first reaction was most definitely “WTF?!?” After the initial shock subsided, I wondered if it was April already. Checking my calendar, I realized it wasn’t. Ah, maybe I’m still sleeping and this is just a really lucid dream? Nope. Okay, so how do I get from “denial” to “acceptance” as quickly as possible?

Sure, the next phase set in quick: anger. How dare they do this? First, Sun gives up the legacy of their SUNW ticker symbol in exchange for JAVA. Now they’re going after my beloved MySQL database? Please don’t tell me the next press release to come out is the announcement of a renamed MySQL into some craptastic “Sun Enterprise Data Management Suite,” codenamed “Monkeybutter.”

Fine, I’m being completely irrational, I know it. Things can’t get that bad, that quickly, right? I mean, if we’re all supportive and positive, things will just keep getting better for both Sun and MySQL, right? I mean, Sun infusing more money into MySQL will inevitably make it a better product, right? Just let some good come out of this situation, please?

Oh, what’s the use? Companies are struggling so hard to find MySQL talent, and it’s allegedly “the world’s most popular open source database” according to MySQL itself. Sun bet the farm on Java and subsequently we’ve watched the company fall into the pit of irrelevancy. Who really cares what happens to either of these companies any more?

You know who? I do. I love Sun hardware and I love using MySQL databases. If there’s some benefit to be had here, I’m sure Jonathan Schwartz will find it and exploit it to the benefit of his customers. In any business, if I had to bet on someone, I’ll always pick the guy with the pony-tail and T-shirt to win. If you’ve ever seen me in person, you’ll know exactly why. :-)

Ten months later, and BlogJet 2.0 is starting to really suck

Last March, I had nothing but great things to say about BlogJet 2.0. It’s still a great blogging tool for the Windows platform–that is, if it were still March 2007. It’s January 2008 now, ten months later, and the fact that there hasn’t been any real bug fixes or improvements in all that time, really sucks.

Today, I finally narrowed down the simplest test case for a HTML generation bug in BlogJet that has been annoying me since I bought this software. I just posted a message about it in the “troubleshooting” forum, but in case you don’t check the forum, I’m repeating it here.

I’m using BlogJet 2.0.0.10 on WinXP Home SP2 and IE6. (No, I haven’t upgraded to IE7, yet.) Here are the steps to reproduce:

  1. Start a new blog post.
  2. In the post body, type:

    This is “a simple test.”

  3. Select the words “a simple test” (not including the double quotes).
  4. Press Ctrl-K to turn the selection into a hyperlink. Enter the following URL in the “Address” field. Click “OK”.

    http://test/?foo=bar&baz=bing

  5. View the generated HTML source by pressing Ctrl-Tab.

What you get is:

This is "<A href="http://test/?foo="bar&amp;baz=bing"">a simple test</a>".

That is wrong. What it should have been is:

This is "<A href="http://test/?foo=bar&amp;baz=bing">a simple test</a>".

Where did the extra pair of double quotes come from? (e.g., around “bar&amp;baz=bing“)?

This might not seem like a big deal, but if you find yourself linking to phrases within double quotes and the link destination contains query parameters, this bug is going to bite you.

Please, someone, develop an open source replacement to BlogJet in 2008 and let me know about it. Hell, I’ll even help develop it …

Tags: ,

Tcl is alive and well with Tcl 8.5

Tcl logo

As much as people wonder “who still uses Tcl?” or “what the heck is Tcl?” … it’s still alive and well and under steady new development. The long-awaited release of Tcl 8.5 happened this past December 20, 2007. You can download it from here.

The discussion on Slashdot about it shows that there’s still a lot of misinformation and outright FUD being spread about Tcl, now 20 years old. Of course, the Tcl community seems to focus more on excellence in engineering than evangelism and PR, so Tcl will likely remain “a well-kept secret, sitting out in plain sight” for the next 20 years.

For people who are already familiar with Tcl but would like to know what significant changes were introduced in Tcl 8.5, Michael Cleverly has a fantastic write-up on it. I highly recommend reading what he wrote if you’re looking to take advantage of Tcl 8.5’s new features.

Tags:

del.icio.us/dossy links since January 7, 2008 at 09:00 AM

del.icio.us/dossy (RSS) links since January 7, 2008 at 09:00 AM:

Reproducible crash bug in FeedDemon 2.6

Well, that didn’t take long. I have a reproducible crash bug in FeedDemon 2.6, already–what was that, in my first 10 minutes of use?

Reproducible FeedDemon crash bug screenshot

I simply go to a folder that has more than 10 items in it, thus having more than one “page” in the newspaper view. I read some items, hit Ctrl-D to go to the next page, then Ctrl-M to mark the items as read, then I get the error popup you see in the screenshot above. I’ve restarted FeedDemon several times and each time I can reproduce the crash with the same exact steps.

Of course, the customary advice of “well, don’t do that, then” isn’t very useful here, as this is exactly the kind of reading workflow I prefer. It’s going to be hard to make it through the week-long trial …

I hope FeedDemon 2.6.1 isn’t too far away from being released. And, I hope it includes a fix for this crash bug.

Tags:

FeedDemon, the price is finally right

Two days ago, widespread announcement was made that all of the consumer NewsGator products are now available for free. I’m not surprised that it happened, just that it took so long to happen.

One of my requirements for a desktop feed reader is that it sync. and integrate with a web-based reader, which FeedDemon does thanks to NewsGator Online. Since the price is right (free, as in beer!) I decided to give FeedDemon 2.6 another look.

Right off the bat, the use of MSIE for rendering HTML inside the application makes me very uneasy: there’s a reason why I haven’t used IE in over a year, in favor of Firefox 2. I’m sure it won’t be long before someone figures out how to exploit the embedded IE inside FeedDemon through a specially crafted feed entry. Perhaps it’ll involve a prefetched link or malicious image file enclosure. Now that it’s free, and a lot more people start using it, it’ll eventually become a target.

Importing my current feed subscriptions OPML from Google Reader into FeedDemon worked perfectly. All the items I’d already read in Google Reader showed up as unread in FeedDemon, naturally, and I dreaded having to go through and mark them all read again. However, one awesome feature of FeedDemon is the Panic Button: it lets you mark things as read in bulk across all your subscriptions. It’s not very flexible–after all, it is a panic button–but it’s convenient. Nice job, Nick.

As far as feed reading goes, FeedDemon does an adequate job. The newspaper styles that ship with it aren’t going to wow you, but they work. I’m glad that the typical vi-style keyboard shortcuts are mapped (e.g., “j” and “k” for next and previous item, respectively). It’s great that Ctrl-K brings up a dialogue that lets you customize your keyboard shortcuts. However, I would make a usability improvement change and add the keyboard shortcut to the tooltip in the newspaper view:

FeedDemon newspaper tooltip screenshot

Sure, I can hit Ctrl-K and see that the keyboard shortcut is “c” to clip an item. I might even be brave enough to guess at it and mash a few buttons. Or, it could just display it in the tooltip, like: “Add to clippings folder [c]”–there, no guesswork and it saves me a step from having to look for it in the keyboard shortcut list. Of course, this assumes you can find it in the keyboard shortcut list–in this particular case, “Add to clippings folder” doesn’t even appear in the list, while “Clip item” and “Clip item to default clippings folder” do. Want to take a guess as to which one the “Add to clippings folder” button invokes? Heh. (It happens to invoke the “Cliip item” function. Would you have known that without experimenting?)

Another nice feature of FeedDemon is the “Dinosaurs” report, which gives you a list of your subscribed feeds that haven’t updated in “X” days, where X is either 10, 30, 60 or 120. This is really handy for feed management when you have lots of subscriptions like I do.

I’m going to try to use FeedDemon exclusively for a week and see if it doesn’t drive me crazy. I might have to hack on my own newspaper style (which seem to be pre-processed XSLT files in the FeedDemon\Data\Styles directory, yay!) because all of the out-of-the-box styles really suck, IMHO. I’m so glad that Nick implemented the newspaper styles this way; not being able to customize the dispaly style would really suck, unless they were incredibly good to begin with.

Are you a FeedDemon user? Got any tips or tricks to share with a newbie like me? I’d love to hear about them. Help me get through this week!

Tags: , , ,