Archive for July, 2010

My neighbors, in light verse

Limericks count as “light verse”, right?

moss park ride ~ detritus

The woman who lives one door down:

her kids make me grumble and frown.

They trash all our plants,

drop trash for the ants,

and leave toys strewn about on the ground.



The other-side neighbor’s no better:

(I’m thinking of writing a letter)

With smoke alarms blaring,

she sits there uncaring;

a hearing aid someone should get her.

Powered by Plinky

Comments off

Morans who need to get a brain make me roll my eyes

I have no patience for the stupid. None at all.

I'm not talking about the developmentally disabled, or those who are uninformed through no fault of their own. I'm talking about deliberately ignorant, small-minded people who can't connect the opinions they've been spoon-fed with the consequences in the real world, and who don't bother to look around to see if there might possibly be another valid perspective.



Note that I'm not singling out any particular political party or affiliation; there are idiots all over the spectrum, and I have no time or interest in dealing with any of them.



People who can't learn how to properly merge onto the freeway also annoy the hell out of me, but usually engender a response somewhat stronger than an eyeroll.

Powered by Plinky

Comments (1)

Grilled Cheese Sandwiches are by far my favorite comfort food

As far back as I can remember, I've loved grilled cheese sandwiches. The combination of melted cheese with a little bit of char plus the toasted bread is really all you need.

Grilled Cheese & Sandwich

The earliest grilled cheese sandwiches I remember eating were at Friendly's, a family restaurant chain on the East coast. This must have been in the early to mid-seventies, either before we moved to California or on family visits afterward.



Since then I have definitely become a grilled cheese aficionado, and love the current trend toward "homestyle" grilled cheese sandwiches with a couple kinds of cheese and good homemade bread. We also have a panini press at home that makes the best sandwiches ever.



How to ruin a grilled cheese sandwich: overthink it. Don't put too much stuff on it! Grilled cheese sandwiches need cheese, bread, butter (or a little bit of some other creamy spread) salt and pepper. Allowable options are a small amount of mustard and a pickle and/or bowl of soup on the side. I love grilled cheese with turkey ham, but it's no longer truly a grilled cheese sandwich.

Powered by Plinky

Comments (3)

Insomnia Keeps Me Up at Night

As far back as I can remember, I've suffered from insomnia. I've tried various prescription and non-prescription remedies to varying degrees of success, but I've come to accept that it's as much a defining part of who I am as my long hair.



Oh wait.

Insomnia again

Insomnia has been a problem for me for a long, long time. I seem to have the most success with melatonin, a naturally-occurring hormone that affects sleep cycles. Lately, though, it's been somewhat less effective unless I take a double dose, which then leads to my being especially groggy and difficult to awaken in the morning.



During periods when I don't have to be up and around at any particular time (e.g. vacation or unemployment) I've found that I naturally drift into a 30-hour cycle, with twenty hours awake and ten asleep. In this cycle I don't need any help getting to sleep at all. Unfortunately, it doesn't correspond with the rest of the world very well at all.

Powered by Plinky

Comments off

Why a Web page is like a blueberry pie

Yesterday afternoon I Tweeted this:

Poking the DOM with PHP. I know YOU all knew about it but *I* just found it and it's wonderful.
@smartwatermelon
Andrew Rich

I thought it might be worth explaining what I was talking about, using a metaphor lots of people would understand. So, consider a blueberry pie. To bake a blueberry pie, you assemble your ingredients, do some mixing and combining and stick it in the oven. Let’s say, though, that after the pie is out of the oven and cooled, a picky young man with short blond hair says “but Mom, I wanted cherry pie!” Being the outstanding parent you are, you lift the top off the pie, pick out every single blueberry and replace them with cherries. (I know, just go with it.) Remember that, it’ll be important in a few minutes.

On another day, you’re preparing your pie ingredients when the aforementioned picky young man again requests a cherry pie instead of blueberry. This time, you can replace the blueberries with cherries before mixing the ingredients and baking the pie. Same result, but one is clearly easier and less disruptive on the final product.

Finally, the pie is done and you cut a slice. Look at the cross-section of that slice of pie. You have a crust, filling, berries, maybe some ice cream or whipped cream on top. That’s the structure of the completed pie that’s ready to eat.

How does this tasty metaphor apply to Web pages, and specifically to my not-entirely informative Tweet?

A Web page, like a pie, has a structure that can be examined. It has text, images, colors, different fonts, maybe some embedded video clips. These are all elements that make up the structure of the Web page. This structure is called the Document Object Model, or DOM–for purposes of this post it’s not important what that means, but where you see “DOM” you can read “bits and pieces that make up a Web page.”

Let’s say you want to change one of these elements. You could do it after the page has been loaded (the Web browser is showing the page) or you could do it before the page has been sent to the Web browser. Changing the elements of the Web page after it has been loaded is usually done with JavaScript, which is code that runs in the Web browser and is analogous to removing the blueberries after the pie is baked. Changing the elements before the Web page is sent to the browser is, in this instance, done with PHP, which is code that runs on the Web server. This is like adjusting the pie recipe before mixing the ingredients.

The major difference, and why I was excited to discover this capability of PHP, is that adjusting or changing the Web page after it’s been loaded (with JavaScript) is about as simple as removing blueberries from a fully-baked pie. It depends on the capabilities of the Web browser viewing the page and in some cases of the OS running the Web browser. It also adds to the total amount of data sent from the Web server down to the browser (all content [text, images, video, etc] plus the extra code which runs after the page has loaded) and is just generally inefficient.

On the other hand, the ability of PHP to change the contents and structure of a Web page while its still in ingredient form and hasn’t been mixed and baked means that what’s sent down to the Web server is already what I want it to be and I can tweak it as much as I need to before it’s served.

This is a drastic oversimplification, of course–there are plenty of good reasons to fiddle with the DOM using JavaScript once the page has loaded; Web applications like Gmail, Twitter and even WordPress use this capability all the time to change, add or delete elements of the page without making a round trip back to the server. There are also lots of applications where large-scale preprocessing is done on the server with PHP and final tweaks are done in the browser, often depending on the specific browser and version being used. However, the pie metaphor does make a good high-level explanation of this aspect of Web page development.

At least, I think it does. What do you think? Comments welcome.

Comments (1)