JavaScript toggle code

I’m just saving this for myself for future design possibilities… The script that goes in the head:

<script type="text/javascript">
<!-- 
// toggle visibility 

function toggle( targetId ){ 
  if (document.getElementById){ 
        target = document.getElementById( targetId ); 
           if (target.style.display == "none"){ 
              target.style.display = ""; 
           } else { 
              target.style.display = "none"; 
           } 
     } 
} 
-->
</script>

Sample code showing usage:

<h3>Blogs I Read <a href="#" onclick="toggle('outside2');return false;" title="Toggle BlogRoll">(show/hide)</a></h3> 

    <div id="outside2"> 
        <h1><a href="http://www.google.com" title="google.">Google Search</a><br /> 
        <a href="http://www.google.com" title="google.">Google Search</a></h1> 
        <div class="dailyphoto"><!--#include virtual="/daily/dailyphoto.inc"--></div> 
  </div> 

<h3>Blogs I Read <a href="#" onclick="toggle('outside3');return false;" title="Toggle BlogRoll">(show/hide)</a></h3> 

    <div id="outside3"> 
        <h1><a href="http://www.google.com" title="google.">Google Search</a><br /> 
        <a href="http://www.google.com" title="google.">Google Search</a></h1> 
        <div class="dailyphoto"><!--#include virtual="/daily/dailyphoto.inc"--></div> 
  </div></div>

(via Joel Blain)

iTunes: “World, The” by Quest from the album Essential Chillout (2000, 4:17).

Occam’s Razor

So — what’s more likely?

That while trying to install and figure out the image-processing software that came with their new digital camera, a husband and wife accidentally opened the husbands previously hidden stash of downloaded porn, or…

That after purchasing a brand-new digital camera, taking a few pictures, and plugging it into their computer, a husband and wife discovered that there were a number of pornographic images already on the camera when they bought it?

An investigation has begun after a couple found pornographic pictures on a new digital camera they had bought.

Jackie and Eammon Gall, from Greater Manchester, discovered the explicit shots in the memory of the camera soon after they bought it for £400 at Argos.

[…]

[Mr. Gall] told BBC GMR: \”When we discovered the pictures, I was trying to get rid of them straight away, because that was my instant reaction.

\”Then for whatever reason the pictures then became part of the desktop and filled up the whole screen.

“Then I started to panic, thinking the pictures would perhaps go anywhere else on the computer that they shouldn’t.”

I know you’re not supposed to snicker at people. But come on…

(via Need to Know)

iTunes: “Child In Us, The” by Enigma from the album Le Roi Est Mort, Vive Le Roi! (1996, 5:06).

I’m too sexy for my blog

New tagline for the blog went up today. Inspiration should be blatantly obvious (at least if you’re into early 90’s one-hit wonders). ;)

Besides, I was bored.

This did, however, inspire some new shirts now available for sale through CafePress:

I'm too sexy for my blogI'm too sexy for your blog

To the left, the “I’m too sexy for my blog” t-shirt. Let your ego go wild, show of just how good you are! You deserve it!

And on the right, for those people who don’t deserve to be graced by your presence — the “I’m too sexy for your blog” t-shirt! Face it, some blogs just aren’t worth your time. Don’t be shy about it — announce it to the world!

Or not.

You know.

Whatever. ;)

I just do these things because they amuse me.

iTunes: “I’m Too Sexy (Catwalk)” by Right Said Fred from the album I’m Too Sexy (1991, 7:51).

Fish heads, fish heads, roly poly fish heads…

There’s a (mostly) amusing article in the Seattle PI today about the “War of the Fish” — that is, the “Jesus Fish” and the many variations plastered over cars all over the place.

Brothers and sisters, there’s a battle raging. It’s not a battle fought with weapons of mass destruction, Lord save us, and it’s not a battle fought in armored personnel carriers.

It is a battle, children, for the hearts — yea, verily, for the everlasting souls — of America’s trunks and bumpers. It is a battle of words and wills, and fish. Lots and lots of fish.

Hallelujah! Can I get a witness?

Amen, brother.

Personally, I’m fairly partial to this one…

Whatever Fish

…though there are certainly a lot to choose from.

One thing about the article did really bug me, though.

Farmer, the Ashland fish maker, said the only word fish booksellers in his area wouldn’t carry was Tolerance.

Some fish, friends, are just too hard to swallow.

The only one they won’t sell. They’re quite happy to sell as many other this believe vs. that belief slogans as they can, but heaven forbid they actually suggest that we actually try to get along with each other! We just can’t have that, now can we?

(sigh)

iTunes: “I Sit On Acid (’95)” by Lords of Acid from the album Do What You Wanna Do (1995, 4:31).

blockquotes in TypePad and MovableType

One of the wonderful little things about a weblogging system such as TypePad or MovableType (and many others, of course) is that there are a lot of nice little usability touches that make it so much easier than having to work with all the HTML code yourself. Rather than mucking around with “ tags and the like, you just type away, and when you hit “Post”, all those niggling little details are taken care of for you.

Every so often, though, something doesn’t quite work the way you’d expect it to. Over the past few days, a few people have been posting in a thread on the TypePad User Group, trying to figure out why every so often, using the <blockquote> tag would suddenly cause display issues in a finished post.

Since I’d had to battle with this in the past, I ended up writing a small book attempting to explain just what was going on. My full post (in my usual overly long-winded style) follows.

After reading through this thread, I believe I’ve seen a couple different things going on when dealing with blockquote elements. I’ll see if I can clearly (if not terribly concisely) toss some useable answers out. ;)

I’ll start with an easier one to explain. I saw this from BJ:

It seems the problem occurs when the blockquote is within a paragraph:

<p> blah blah <blockquote> quoted stuff </blockquote> More Stuff </p>

There are a few types of tags in HTML. In this case, we need to know about two types: inline tags and block level tags.

Block level tags define a chunk of HTML code or text that is a self-contained block (I hate using a word to define itself, but that’s all I’m coming up with right now). A paragraph is a good example of this type of tag. Inline tags define a chunk of code or text that is contained within a block level tag — for instance, bold or italic text inside a paragraph.

The simplest way to visualize this is simply visualizing how a paragraph is structured: you can have bold and italic words inside a paragraph, but you can’t have paragraphs within bold and italic words, nor can you have a paragraph within a paragraph. In other words, this is a valid structure:

<p>Well, isn't <i>that</i> just absolutely <b>nifty</b>!

But this isn’t:

I'm not sure what to use here <p>as an example</p>, so I'll make something up.

Now, as long as all that made sense, all you need to realize is that a blockquote, as implied by its name, is a block level element, and therefore cannot be used within a paragraph. A properly formatted blockquote should look something like this:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.</blockquote>

See? Pretty cool, huh?

If you want to correctly code an inline quote, as in BJ’s example, you should use the <quote> HTML tag, like so:

blah blah <quote>quoted stuff</quote> More Stuff

Okay, done. And that was the simpler of the two situations!

The second (and probably the one that’s biting the most people in the butt) is the bizarre linespacing issues that crop up at times when using the blockquote element. Sometimes blockquotes work fine, sometimes they’ll go tweaky within the blockquote, and sometimes they’ll affect things after the blockquote is closed.

I struggled with this for a while myself, but I eventually figured out that the culprit is actually one of the things that TypePad (and MovableType, for that matter) does to help us out: the automatic wrapping of paragraphs in paragraph tags (the “convert line breaks” option in the ‘Text Formatting’ menu).

TP/MT determines where to place paragraph and linebreak tags by looking at the text of the post: a single carriage return becomes a linebreak (<br />); blocks of text surrounded by two carriage returns (blank lines) get surrounded with paragraph tags (“…</p>). Simple enough on its own, but TP/MT also scans for certain other tags, and when it encounters those, it does not insert paragraph or linebreak tags. I don’t know all of the tags that will trigger this, but I know that list tags and blockquote tags are definitely in the list.

Now, when a blockquote is only a single paragraph, that’s not a problem at all. For instance, given the following text entered into a post:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.</blockquote>

See? Pretty cool, huh?

TP/MT would output the HTML as follows:

<p>I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.</blockquote>

See? Pretty cool, huh?

Where things get tweaky is when a blockquote contains multiple paragraphs. The first paragraph of the blockquote will be ignored as it should, but then the second paragraph of the blockquote gets an opening paragraph tag — and suddenly you run into a situation where two block level tags are fighting with each other. Then, when the blockquote ends, you have an opening paragraph tag, a closing blockquote tag, and then a closing paragraph tag — more confusion.

For example, given the following text put into a post:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.

Some more information that's also interesting.</blockquote>

See? Pretty cool, huh?

TP/MT will wrap the first line in paragraph tags. Because the second line begins with a blockquote tag, it will ignore that line. As the third line begins with normal text, TP/MT will wrap that entire line in paragraph tags, which is where the weirdness creeps in. Here’s how the output would look:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.

Some more information that's also interesting.</blockquote>

See? Pretty cool, huh?

Once you factor in CSS declarations into all of this, which might have differing settings for blockquotes and for paragraphs, you can see why things end up getting more than a little wonky as your browser tries to work its way through the tag soup and figure out how to format everything.

(ADDED: By the way, I should clarify that while both paragraph tags and blockquote tags are block level elements, different rules apply to them: while you cannot have a blockquote contained within a paragraph, you can have a paragraph [or multiple paragraphs] contained within a blockquote. While this may seem a little confusing from a “but they’re both block level elements!” standpoint, from a logical and English usage standpoint, it does make sense. I just can’t explain it any better than that. ;) )

There are two ways to get around this, neither of which are incredibly complex — but neither of which are incredibly easy, either.

The first is simply to switch the ‘Text Formatting’ option to “none” and type in all the paragraph tags yourself so that TP/MT doesn’t have to do it automatically. It works, but it also takes away from some of the ease of use of TP/MT.

The second option (and the one I use) is to keep in mind how TP/MT will interpret what you give it, and do a little bit of manual work to get around the issue. You’ll still be doing some manual work with tags here, but not quite as much as you might in option one. When I’m entering a two (or more) paragraph blockquote into one of my posts, I simply take into account the extra tags that TP/MT will add, add a couple of my own, and then ‘push’ a couple lines together so that the resulting code will output correctly after it passes through TP/MTs routines.

This is a bit easier to show than to describe, so — starting with the above example again, here’s the starting point:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.

Some more information that's also interesting.</blockquote>

See? Pretty cool, huh?

Now, to prevent TP/MT from munging things up, I would put that example into one of my posts like this:

I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.

Some more information that's also interesting.</p></blockquote>See? Pretty cool, huh?

Now TP/MT has only three lines to work through. As before, the first line gets wrapped in paragraph tags. Because the second line begins with a blockquote tag, it gets ignored, but as I’ve manually added paragraph tags, that’s fine. The third line, like the first, gets wrapped in paragraph tags because it starts with simple text, but because I put in the requisite paragraph tags on either side of the blockquote tag, all the tags in the resulting code balance out, like so:

<p>I found this interesting little bit of information today:

<blockquote>A really interesting bit of information.

Some more information that's also interesting.</p></blockquote><p>See? Pretty cool, huh?

And (finally), that’s that! I realize that it’s probably fairly daunting at first, but after playing with it a bit, I think it should start to make sense. Maybe. ;)

Anyway, those are the two major issues with blockquote elements that are probably causing frustration for people.

And that’s far more than enough babble from me on all this. Hopefully some of this helped some of you — as always, if I just managed to make things more confusing, feel free to post followup questions, and I’ll do what I can to clarify!

Curls?

I’m not sure how long this is actually going to go on, but so far, due only to a combination of laziness and idle curiosity, I’ve yet to shave my head this year (and hadn’t for a good week or so before Jan. 1st). I’m starting to wonder just how long I can go before I get sick of the curls and shave my head again. It could be just a few days — or it could be months.

I guess I’ll find out when I find myself in the bathroom, clippers in hand.

iTunes: “Light (Vengeance)” by K.M.F.D.M. from the album Light (1994, 5:39).

More on the iHPod

The HP iPod

More details of the Apple/HP iPod agreement are starting to come to light. Many people have expressed surprise that the announcement wasn’t made during the Macworld keynote, where it would have made quite a splash. Apparently, the simple reason for that is that the Macworld keynote was on Tuesday, and negotiations were “completed only after an extensive bargaining session that ran long into Wednesday night,” according to the New York Times.

The agreement…represents a significant departure for both companies. For the first time, Mr. Jobs has stepped away from the self-enclosed Apple-only strategy he has pursued since he returned to run the company in 1997. Meanwhile, Hewlett, the second-largest computer maker in the world, has put its software partner, Microsoft, on notice that it will not necessarily follow its lead in every case.

The back of the HP iPod

Additionally, one (and only one) report — that at the moment, doesn’t seem to be taken terribly seriously by most people — claims that HP “will be working with Apple to add support for Microsoft’s superior Windows Media Audio (WMA) format to the iPod by mid-year.” Now, first off, the claim that WMA is a “superior” format is questionable in and of itself (I’ve seen people on both sides of the WMA vs. AAC argument being equally rabid), and tossing that adjective into a single-sentence rumor shows enough bias that many people are discounting this rumor immediately. Additionally, the rumormonger is none other than Paul Thurrott, author of the WinInfo Super Site, who has been known to make some highly questionable claims when comparing Mac OS X and Windows in the past.

However, I’m not sure that this would be an entirely bad move on Apple’s part, if it’s true and if HP can talk them into it. Just as their partnership with HP will be opening up more potential avenues for the iPod and the iTunes Music Store, allowing Windows based iPod users to mix in previously-imported or downloaded WMA files along with their .mp3/.m4a library could give Windows users even more reason to jump on the iPod bandwagon. I wouldn’t be suprised at all if Apple has lost some iPod sales simply because there were people who were interested, but already had a large library of music encoded in WMA format, and would rather go with a competing .mp3 player than face having to re-import their entire music library.

While this may be nothing more than a Windows fanboy’s rumormongering, I’m not so sure that it should be dismissed so casually and out of hand. There may not be any way of knowing the truth until an official announcement is made one way or the other, but I think that there are potential upsides worth paying attention to.

(via MacMinute and MacRumors)

iTunes: “ToriMix v2” by DJ Wüdi from the album Difficult Listening Hour (2001, 46:37).

Kodak moments

Mr. Man says he hears a knock.

Yup, it’s a faint knock.

I open the door a crack and it’s Eric. Eric is from the Sierra Club “our nation’s oldest environmental group” and did I know the Bush administration is a total disaster environmentally and the Bush administration’s policies are “raping our forrests and …”

ME: One question.

ERIC: Sure.

ME: Did you vote for Nader in 2000?

ERIC: Yes sir!

ME: Get off my fucking porch.

The good news is – Mr. Man learned a new word tonight.

Picture me, standing up and applauding.

On the one hand, I have more respect for someone who votes — even if they voted for Nader — than for someone who doesn’t vote. I also can’t really argue with someone voting their conscience, if they cast their vote for the candidate they truly thought would best lead the country.

However.

Last election (and the three years since then) should serve as an example to any and everyone. Much as people may wish that a third-party candidate could come out of nowhere and win, realistically, it’s not going to happen. At this point, any vote that does not go to help the Democratic nominee gain the Presidential office will just help Bush retain his position, and that’s the last thing we need right now.

I’m a Dean supporter. But in the event that Dean doesn’t get the nomination, the bottom line is simply anybody but Bush. And by “anybody”, I mean anybody who can realistically have a chance of defeating Bush — and by that, I mean the Democratic nominee.

It’s got to happen.

ecto beta available

The creator of blogging client Kung-Log has rewritten, updated, and renamed it, and has just relased the first public beta of ecto, which I’m playing with now. While I was never completely pulled in by Kung-Log, ecto so far seem to be fairly impressive. Quick response time, supports about everything I’d want it to (trackback pings, categories, file uploading, etc.), and has a decent number of useful extras (an option to prevent uploading posts that don’t have a category set or a summary written, and a live preview that can even tie into your site’s stylesheet so that it actually looks the way it should once posted), plus some “fun” goodies (like the ability to automatically insert what track iTunes is currently playing).

I’ve gotten so used to just using the web interface that I’m not entirely sure if I’ll be coaxed away from that or not, but I’m always willing to give one of these things a try. We’ll see how it goes.

(via Lane)

iTunes: “Difficult Listening Hour – 02v2” by DJ Wüdi from the album Difficult Listening Hour (2000, 1:04:41).