The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Tuesday, September 01, 2009

Take Five

I'm almost relunctant, seeing how it was an oversight on my part, on the same DNS server as yesterday, but given I was called before God gets up (or at the very least when I get up), I'm calling it five for five.

On the plus side, the incidents are getting smaller and smaller, but I suspect I just jinxed myself by mentioning it …

Wednesday, September 02, 2009

The quiet before the storm

It appears that things have finally quieted down at The Office. No emergencies, no “O'dark 30” phone calls. Just a peaceful day at The Office. Well, not really at The Office, since everyone at The Company works from home, so it's more of a quiet day at The Virtual Office.

Now I've really jinxed myself.


Has it really been five years since the last release?

Since it's been a quiet day at The Virtual Office, I did some work on the backend of the ol' journal here, mostly tweaking the webserver configuration (such as mod_deflate and mod_expires among other configuration changes), some changes in where certain files live and under what names (for example—the CSS now gets a unique file name for each change, which means I can set the expiration date for such files way into the future, which helps with caching and cuts down on bandwidth usage) and a few modifications to mod_blog to generate better navigational links.

It was then I noticed that the last release for mod_blog was five years ago.

Ooh.

Well, it's not like anyone else uses the codebase, but still, I felt a bit bad about that, so I went ahead and made a new tarball of the current version, just in case someone is interested in the codebase.

Thursday, September 03, 2009

Neat, but I still don't like it

I'm not a fan of tail call optimization, but still, I didn't quite realize that gcc will optimize tail calls if given the -O2 option (found while reading Hacker News).

Okay, this is something I have to try out:

[spc]lucy:/tmp>cat >forever.c
int main(int argc,char *argv[])
{
  return main(--argc,argv);
}
^D
[spc]lucy:/tmp>gcc forever.c
[spc]lucy:/tmp>./a.out
Segmentation fault (core dumped)
[spc]lucy:/tmp>gcc -O2 forever.c
[spc]lucy:/tmp>./a.out
	(several minutes go by)
^C
[spc]lucy:/tmp>

That's interesting. Not sure how it'll impact any code I write, but still, it's interesting.


Notes on a browser history mechanism, Part II

Find any page you have visited quickly and easily. Shows your browsing history as a tree of tabs, with thumbnail screenshots of the web-pages in every tab you have opened.

Via Hacker News, History Tree 1.0

I remember talking about a browser history mechanism like this seven years ago. I'm surprised it's taken this long to implement this.

I'm also surprised that there can be Firefox extensions that are operating system specific (in this case, Windows only—sigh).

Friday, September 04, 2009

Another from the “Life trumps satire” Department

JERICHO, Ark.—It was just too much, having to return to court twice on the same day to contest yet another traffic ticket, and Fire Chief Don Payne didn't hesitate to tell the judge what he thought of the police and their speed traps.

The response from cops? They shot him. Right there in court.

Via theferrett, Fire chief shot by cop in Ark. court over tickets - Yahoo! News

I give up. This is just too out there. Where do you go from here? What possible form of satire can you do when our society has fallen to such levels of … of … this?

And it's sad, in a way, that real life is just too weird for satire nowadays.

Monday, September 07, 2009

A rabbit hole to China

R seems to have weathered the changes in gambling legislation and called for some help on a website he's been working on. It involves moving a site from an undocumented overwrought PHP framework to a documented overwrought PHP framework (which is mostly done) and one of the last bits to do is the integration of a questionnaire.

How hard could it be to integrate a questionnaire?

Oh, it's 18,449 lines of non-integrated PHP code.

Lovely.

So I'm going through the code and see a bunch of stuff like this:

<input 
	type="checkbox" 
	name="followanswer_7" 
	id="followanswer_7" 
	value="1"
	onclick="checkbox_selected_fu(7)"
>

So my guess is not only is it 18,449 lines of PHP, but there's probably a nice dose of AJAXy goodness thrown in. Curious as to what checkbox_selected_fu() might be doing, I search for its definition.

Deep in a PHP function I find the following:

echo 'function checkbox_selected_fu(followup_questionsid) {'.b;
$qry = "SELECT * FROM followup_questions WHERE conditions='yes';";

If I thought 18,499 lines of PHP code was lovely, this is just peachy keen! Constructing JavaScript on the fly from PHP and SQL! Woot! Please sir, can I have some more?

Update a few hours later …

Why yes, I can have more!

That JavaScript being generated on the fly by PHP and SQL? Turns out it's generating HTML on the fly.

I can't tell you how thrilled I am to learn that.

I talked to R, and we both agreed that it would probably be best to turn the questionnaire into something that runs as standalone as possible. Which we think is doable since the questionnaire was one of the last things done under the undocumented overwrought PHP framework and even the developers were getting tired of the framework (which should tell you something about the framework) and just wrote the questionnaire as quickly as possible. Which probably explains the code quite a bit …

Monday, September 14, 2009

You can't win if you don't play, but I still have my dollar. Do you?

Just The Facts

  1. The odds of winning a Mega Millions Jackpot are 175,000,000 to one.
  2. The odds, as an American Male, of being Tom Cruise are only 150,000,000 to one.
  3. You are more likely to call heads twice, roll a six and then be struck by lightning than win a regular 6/49 lottery.

Via jwz, Lottery | Cracked.com

That (and the rest of the article) is pretty much why I don't play the lottery.

I also don't gamble. I learned the “if, at a poker table, you can't spot the sucker, it's you” lesson the hard way back in college (nothing like losing an entire paycheck in a “friendly” game).

(As a digression—growing up, I preferred Mad over Cracked, which I found to be a weak imitation of Mad. But these days, the Cracked website is lightyears better than the Mad website.)

Update on Tuesday, Debtember 5th, 2017

For some reason, John Hawthorne thinks this post is pro-lottery. I want to make it clear it's not.


“Star Surfs”

I'm earwormed.

Not with Why is Captain Kirk Climbing a Mountain (link via kisrael.com), although I find it rather catchy, but with (to me) this 60s surf movie (or maybe western—it's got elements of both) rendition of the Star Wars theme (link via news from me). I can also imagine Quentin Tarantino using this in one of his films.

Tuesday, September 15, 2009

“Okay, I'm deleting records over a certain age, so the time needs to be … ”

I'm still working on the questionnaire from Hell and the approach that R and I worked out was to make the questionnaire as stand-alone as possible so it can be moved as one whole piece from the old undocumented overwrought PHP framework (217,981 lines of PHP, 34,973 lines of XSLT, 104,134 lines of JavaScript and 17,137 PNG files) to the new documented overwrought PHP framework (44,655 lines of PHP, no XSLT, 7,597 lines of JavaScript and 120 PNG files—so maybe not as overwrought as I initially thought).

It's going slowly.

R called and said there was a problem with the current site—that the server was running out of memory trying to serve up a page with all the people who took the questionnaire. I took a look at the existing, undocumented overwrought PHP framework and it's doing a database query (which is returning at least 10,000 records) and using XSLT to transform XML and the database results into HTML.

All in memory.

So of course it's running out of memory.

We discuss the issue and there are two solutions: paginate the output, or delete enough records so the page can be built in memory. We both took one look at the options (diving into 300,000 lines of code and modifying it, or a few lines of SQL to prune the database) and said “delete the records!”

Now, the database doesn't use the SQL DATETIME to store when the questionnaire was filled out. No, that would be too easy. No, it uses an INT to store the date, using the number of seconds since January 1st, 1970—it being MySQL under Linux (it's a Unix thing). So I have to figure out the number of seconds from January 1st, 1970 as of three months ago.

Fortunately, it's easy under Linux:

[spc]lucy:~>date -d '3 months ago' +%s
1245129383
[spc]lucy:~>

So anything older than that gets deleted.

mysql> DELETE FROM questionnaire WHERE answer_date > 1245129383;
Query OK, 2344 rows affected (0.10 sec)

Um … I was expecting over 8,000 rows to be … oh XXXX! I got the conditional backwards! It's supposed to be less than that number of seconds, not greater, since it's a date!

Sigh.

Backups to the rescue.

I'll be glad when this is over.

Wednesday, September 23, 2009

Notes on a Browser History Mechanism, Part III

From
<XXXXXXXXXXXXXXXXXXXXXXXXXXXXX>
To
sean@conman.org
Subject
Your web-article "Notes on a Browser History Mechanism, Part II"
Date
Wed, 23 Sep 2009 15:42:05 +0000 (GMT)

Hello Sean,

I just saw your article about the "History Tree" Firefox add-on at; http://boston.conman.org/2009/09/03.2

I am the author of History Tree and have just tested it and made it available for Linux and Mac. See; https://addons.mozilla.org/en-US/firefox/addon/13316/ The reason for the delay is that I use mostly Windows and have only recently tested History Tree other platforms.

You were of course right to be surprised that it was initially for Windows only, since its mostly written in JavaScript. However, I had to test on Linux and Mac, since I am a bit of a perfectionist in that way.

I hope you find time to try History Tree out and that you find it useful Perhaps we will then see “Notes on a Browser History Mechanism, Part III” ?

Best Regards,
Norman Solomon

There is nothing wrong with being a perfectionist. And I would like to thank Norman for emailing me about the new version of History Tree.

I've tried it out, and I like it. It does what I described seven years ago, only it looks a lot better, and definitely has more functionality that I expected. But seven years ago I wasn't using tabs. I am now, and my only complaint about History Tree is how it handles tabs.

[History Tree screen shot]

The screen shot shows the history for four tabs I have open in Firefox, with the second tab having quite a bit of historical branching (the red box is the current page being displayed). My issue is that the second tab was opened from the most recent page in the first tab (which is off the bottom of the screen), and the third tab was opened from … well … I forgot which page in the second tab I opened it from. Same with the fourth tab. That's my complaint—there's no indication of which tab was created from which page.

I am at a loss as to what Norman can do for this. Drawing lines showing which page a tab was created from would get horribly confusing. Perhaps if you mouse over the first page in a tab, it could change the color of the page which created the tab in the first place? And then what to do when said page isn't visible?

But other than that, it's a very nice piece of work.


So called “alternative energy sources”

What about electric cars? What about 'em? Present battery technologies do NOT support 200 miles at freeway speeds for two people and luggage. Fifty or a hundred miles, just maybe. That takes care of a short commute and a trip to the grocery on the way home every day. And then you have to plug it in and recharge it. And where, dear reader, does that electricity come from? 77% of it comes from powerplants that burn those nasty hydrocarbons like coal, oil and natural gas. Another 10% comes from nuclear, and 7% comes from hydro, you know, those dams that are killing our rivers? And when you plug in your eco-friendly electric car, that's where the electricity comes from. Except for the 7% that's lost in the lines bringing it to your house. Short answer? If everybody goes to electric cars, we're gonna need more electricity. And right now, more electricity is going to take more carbon.

The whole energy/carbon/ecology discussion is filled with little corners of knowledge like these that I've just dipped into briefly. Many of us out here in the blue states know about this stuff and we know how bad policy, based on bad science is going to hurt this country.

Folks, another thing to consider is that energy, synonymous with carbon, already costs. You pay for it. The people who run the factory have to pay for it to give you what you want, and YOU pay for the energy. And now Obama and the eco-whackos are trying to make it more expensive to use energy. and guess who will pay. Can you afford it?

Mostly Cajun, All American and Opinionated » Carbon and more

Mr. Cajun works for the power industry, so he knows this stuff. And what he's saying is scaring me. But his article is just the tip of the iceberg. Years ago, Steven Den Beste wrote a series of articles on energy production and what we, as a society, realistically need. It's a lot to read, but the entire series below is really worth reading.

But there is a synopsis of the articles below for those that want to get to the meat of the argument. Basically, it boils down to:

In order for “alternate energy” to become feasible, it has to satisfy all of the following criteria:

  1. It has to be huge (in terms of both energy and power)
  2. It has to be reliable (not intermittent or unschedulable)
  3. It has to be concentrated (not diffuse)
  4. It has to be possible to utilize it efficiently
  5. The capital investment and operating cost to utilize it has to be comparable to existing energy sources (per gigawatt, and per terajoule).

If it fails to satisfy any of those, then it can't scale enough to make any difference. Solar power fails #3, and currently it also fails #5. (It also partially fails #2, but there are ways to work around that.)

The only sources of energy available to us now that satisfy all five are petroleum, coal, hydro, and nuclear.

My rule of thumb is that I'm not interested in any “alternate energy” until someone shows me how to scale it to produce at least 1% of our current energy usage. America right now uses about 3.6 terawatts average, so 1% of that is about 36 gigawatts average.

chizumatic.mee.nu

That was true in 2003 (when the original articles below were written), and it was true in 2008 (when the above was written) and it's still true today.

Anyway, the full set of articles:

Two more articles that were listed in my links along the Den Bests articles:

And as a refresher course, a slang definition of the Three Laws of Thermodynamics:

  1. You can't win.
  2. You can't break even.
  3. You can't even leave the game.

Tuesday, September 29, 2009

“If you wish to make an apple pie from scratch, you must first invent the universe”

The title is a quote from Carl Sagan, and yes, he's using the exteme definition of “scratch.”

But even using a less rigorous definition of the word “scratch” can still require a bit of work, just as this BLT that Jared Dunnohew made (link via Michael Ruhlman via Jason Kottke). Not only did he grow his own tomatoes and lettuce, baked the bread, made the mayonnaise, but smoked his own bacon and even harvested his own salt!

He must really like his BLT fresh …

Obligatory Picture

Trying to get into the festive mood this year

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

Obligatory AI Disclaimer

No AI was used in the making of this site, unless otherwise noted.

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.