meyerweb.com

Skip to: site navigation/presentation
Skip to: Thoughts From Eric

Archive: 2004

Regular Expression Help

Some time ago, Simon Willison pointed out a very cool bookmarklet that helps solve the “I have one password for all my public sites” problem.  This is where someone picks a password they can remember, and then uses that as the password for their accounts on Amazon, eBay, Hotmail, Netflix, et cetera.  This is one of those things that security experts tell you never to do, and yet just about everyone does, because given the plethora of accounts most of us maintain, there’s no way we could keep track of which password goes with which account unless it was all written down somewhere… and that’s something the security experts insist that you never, ever do.

So the bookmarklet takes your ‘master password’, crosses it with the domain of the site, and generates an MD5-based result.  So let’s assume meyerweb had accounts.  You would fire off the bookmarklet, which would ask you type in your master password.  So let’s say your master password is ‘passwd’; this is combined with www.meyerweb.com and the resulting password is 68573552.  On the other hand, if you just use meyerweb.com, the result is 92938a6e

Now, while those aren’t the most secure possible passwords, they’re a lot more secure than ‘passwd’.  So I’d like to make use of this bookmarklet.  Fine, great.  The problem is what you just saw: the generated password changes if the full host and domain name bit changes.  This could be a problem if, say, amazon.com suddenly starts routing all logins to a server named login.amazon.com… or vice versa.  So I’d like to adapt the bookmarklet so it grabs just the domain and TLD (I probably got those terms wrong; I usually do) of a URL.  Problem is, I can’t write regular expressions for squat.  I don’t even understand how the regexp in the existing bookmarklet works.

So, a little help, please?  Given the form http://www.domain.tld/blah/foo/wow.xyz, I want the regexp to return just domain.tld.  Just leave a solution in the comments, and you’ll earn the respect and adulation of your peers.  At least those of them who read the comments.

S5 Validity

Over the past few days, I’ve gotten a few complaints about S5 breaking in one browser or another—IE6 and Safari got the most mentions, but there were others.  As an example, there was a report that the slide show would just stop working after a certain number of slides.  In every case I’ve seen so far, these problems have been caused by invalid XHTML.

The most common validation problem I expect people to run into is with the structuring of lists.  For example, suppose you want two levels of lists on a slide.  You do it like this:

<ul>
<li>point one</li>
<li>point two
   <ul>
   <li>subpoint one</li>
   <li>subpoint two</li>
   </ul>
</li>
<li>point three</li>
<li>point four</li>
</ul>

Notice how the nested list is inside the li element?  That’s correct.  You should never put nested lists between list items on the ‘outer’ list, even though a lot of people have made that a habit.  The only element that can be a child of a ul (or an ol) element is an li.  That’s it.  Anything that needs to be ‘nested’ goes inside one of the list items.

Alternatively, you can put structures after the list, if that’s what you want.  As an example:

<ul>
<li>point one</li>
<li>point two</li>
<li>point three</li>
</ul>
<pre>
...code sample...
</pre>

Nothing wrong with that, as long as you keep the side content inside the <div class="slide">...</div> element.  Or you could put your pre inside the last list item.  It’s really up to you.

Remember that S5 stands for “simple standards-based slide show system”.  That’s not just marketing: the CSS and scripts pretty much depend on valid markup structures.  If the markup is invalid, it will very likely lead to confusion and unexpected results.  In other words, violate the standards and they’ll violate your slide show.  There’s a certain poetic symmetry in that, I think.

(And yes, I do know that as of posting, this entry doesn’t validate.  Believe me, the irony is not at all lost on me.  This happened because I haven’t gotten around to fixing WordPress so it strips HTML before inserting the entry title into the title element.  I ranted about the problem a while back… and it will eventually get fixed.  Possibly when I upgrade to the next version of WP.)

Dead Letters

Mail here at meyerweb.com is, for the moment, dead.  I threw up a notice on meyerweb’s home page and was going to leave it at that, but it occurred to me I could get more data from people if I posted and let them comment.  So if you’ve gotten a bounce back from my e-mail address, or if you send me (or Kat) a test message and get a bounce, could you post the error text and relevant headers in a comment here?  It will help diagnose the problem.

Oh, and check to see if someone else has posted the same error before you post.  We don’t need a hundred copies of the same error.  If you have a different error than those already posted, though, then by all means share.  Other information, perhaps such as that divined by you command-line wizards and server administrator types, would be most welcome as well.

Thanks… and I hope this will be fixed in short order.

Update: it’s fixed.  Let the spam flow once more!

S5 Primer Online

For those who aren’t sure how to tackle creating an S5 presentation, I’ve put a basic primer online.  In addition to explaining the basics of an S5 presentation, it links to a ZIP archive of a “blank” presentation, so you can use that as the basis for any presentations you create.

I’m planning to write in the near future a short guide on how to switch themes.  It isn’t quite as simple as it first sounds, mostly because of the possibility that an author would create a theme package containing only the files that need to be replaced, instead of everything that usually goes in the ui/ directory.

Like it says at the end of the primer, let me know if anything’s missing or unclear.

S5 1.0

Okay, folks, here it is: S5 version 1.0.  In addition to a few minor tweaks to make the system more robust, I’ve created a couple of themes to add to the ones Martin Hense created.  I have links to them all on the new S5 Themes page.  Share and enjoy.

One of the more notable tweaks is that the URL of slides.css is now read by the JS at document load, and used from then on.  Thus, you can point to a slides.css that’s in a different location than the rest of the UI files, if you so desire.  Another change is that the introductory slide show now contains some images, including one that maps out the file structure.  These were added so that new users would have some inkling of how to put images into a slide show.  There may of course be other ways of accomplishing the same task.

There were a number of good ideas and code contributions, but they were also too last-minute to be included in v1.0.  I’ll add them to a “to do” list for v1.1.  As to the suggestion that the project be moved to SourceForge, it’s certainly an idea I’ll explore further.  I don’t know enough about SF to know how such an arrangement would work; I only ever go to SF to download stuff, and find the site to be somewhat annoying in that it’s never immediately clear to me what I’m supposed to download, not to mention finding detailed information about whatever I’m downloading seems much harder than it should be.  For now, I’ll keep S5 local to meyerweb.  It can always be migrated over to SF later on, if that turns out to be a good idea.

There are still limitations in the system.  For example, if the slide show assumes 1024×768 and your window is 800×600, then you’re likely to have content cut off by the footer.  So edit the CSS to assume 800×600 (the easiest step is to lower the font-size of the body element).  Or set things up so that scrollbars will appear on the slide content if it overflows the slide.  You get the general idea, I think: this is very much a DIY-type system, at least for now.  The JS works, and the core styles help it work, in a cross-browser fashion.  Anything after that is up to the theme author.

There may one day be routines that automatically scale text, or dynamically break up slides, in order to solve the clipping problem.  There may also be features that let you trigger animations by hitting “next”, let you easily integrate SVG content, allow the use of the navigation menu in Opera Show, permit dynamic theme selection, and so on and so on.  For now, we have a good standards-based slide show system, one that should suffice for a great many people.

And my deepest thanks to all those people who have contributed, directly or otherwise, to S5, including those who made suggestions I haven’t yet folded into the system.  You have made, and will continue to make in the future, S5 better than I ever could have made it on my own.

Broken Bluetooth

So I just noticed that my PowerBook no longer realizes that it has a Bluetooth module installed.  I get a little “broken B” icon in the menu bar, and when I open the menu it says in greyed-out text “Bluetooth: Not Available”. I fired up the Bluetooth setup assistant and it said it couldn’t find any Bluetooth hardware either.  The only two noteworthy things that have happened recently are I installed the latest Apple security update, and I let the laptop drain itself of power in order to reset the power level calibration.  I haven’t ever run a Bluetooth firmware update, so that doesn’t seem like it’s the problem (unless of course the problem is that the security update requires a firmware update, but nobody said anything about that).

Oh, and no, I don’t have a Bluetooth device with which I can test the Mac’s module.  It still bothers me that the computer seems to have lost some of its hardware.  I’d sort of like to have it found again.  Has anyone else seen this problem, and if you fixed it, how did you fix it?

Update: thanks to Daniel Bergey, whose friends just recently moved to my home state, I’ve solved the problem and the Bluetooth icon is back to normal.  See the comments for details and a link to a description of the procedure I followed.

Stripped Down Style

I was recently honored with a request to contribute to Design In-Flight magazine, and so the latest issue contains a piece titled “Stripped Down Style”.  The article is an expanded version of Really Undoing html.css, accompanied by some screen shots and containing a copy of Tantek’s undohtml.css.  The magazine also includes an article from Jon Hicks about his icon design process, focusing on the icons he’s created for NetNewsWire 2; a piece from Keith Robinson on public speaking; a how-to guide for mapping out the structure of your style sheets by Yasuhisa Hasegawa; and a good deal more.

It does cost a few bucks to get a copy the magazine, but they really are a very few—certainly several less than you’d spend on a comparable magazine in print.  You can also get a yearly subscription of four issues for ten bucks.  Having read the first two issues of the magazine, I’m definintely feeling an urge to subscribe.  Editor Andy Arikawa has proven a master at pulling together some great content from interesting authors, and at covering a diverse set of topics.

I must also admit to some amusement at how the title of this issue, “Not Your Father’s CSS”, echoes (most likely coincidentally) the title of my radio show.

S5 Final Candidate

Thanks to the efforts of many people, the slide show system I’ve been working on is just about ready for prime time.  Thus, I hereby dub it S5 and place it into Final Candidate status, complete with documentation of the markup format and a map of the files that are used for an S5 presentation.

There is one thing I’ve found that needs to be addressed before exiting the FC stage, and that’s the handling of slide titles that contain markup.  If you look at the slide show S5: An Introduction, the navigation menu entry for the title slide is ” 0: Snull: An Introduction”.  It should be ” 0: S5: An Introduction”.  I know this has something to do with walking the DOM tree and collecting the appropriate bits, but I’ve yet to figure out how to do that efficiently.  Assistance, as always, is appreciated.

There are a few limitations that will exist even after S5 goes to v1.0.  These are summarized on slide 8 of the introductory slide show, but I’ll explain them in a little more depth here.

  • Only one author can be listed in the metadata — This limitation is largely inherited from OSF 1.0.  Mark Schenk and I have talked about ways to get around this limitation, but have agreed to postpone fixing it until later; for now, it will be better if S5 1.0 and OSF 1.0 are as compatible as possible.  When I start working on S5 1.1, I’ll come back to this, and will probably kick around some ideas in public for your comment.  But that’s for later.
  • Links from within a slide to another slide will probably fail — Henryk Plötz created routines to fix this limitation, but I don’t have time to analyze and understand how they work before going to v1.0, and I’m very much against just dropping things into the JS unless I understand what they do, and how they do it.  I expect to get this functionality into S5 1.1.
  • The navigation controls are limited to the footer — This is in some ways a matter of convenience, and also a matter of consistency.  If the controls are known to be in the footer, then theme authors can write their CSS accordingly.  I may—and note I say may—relax this restriction in a future version of S5.  For now, it stands.  (Update: by “limited to the footer”, I mean it’s limited in a structural sense.  You can still visually place the controls anywhere CSS will allow.)
  • Slide content is expected to be static and atomic; that is, there is no capability to trigger dynamic slide content by hitting the “next” command — It would be nice to allow a slide author to trigger a slide animation (or whatever) by just hitting a “next” key, the way Powerpoint does.  It’s probably easy to do.  It won’t make it into 1.0.  So the expectation is that any given slide is a set of text and/or images, and that when you advanced you go to the next slide.  Of course, an author can still embed a Flash file or a QuickTime movie or an animated GIF or whatever.  There just isn’t the ability to click the mouse button or hit the space bar and have new content revelaed on the same slide.
  • Fonts are not scaled based on display resolution and available pixels; manual CSS editing is required — Again, largely a matter of convenience.  I tried dynamic font scaling and discovered that Firefox had major problems with what I’d done.  I’ll worry about it in a later version.  For now, if you create your slides assuming 1024×768 and find yourself in an 800×600 projection environment, you’ll have to edit the CSS directly to change the font size (and anything else that has to be changed).

There’s one other limitation I didn’t put on the slide, but I’ll briefly cover here.  As yet, it is not possible to embed all of the CSS and JS into the presentation file (that is, the XHTML file) and have the system work as widely as it does when they’re external.  The culprit again was Firefox, although it’s as likely that the real culprit is how I scripted things.  For that matter, it will never be possible to have complete standalone S5 files for any presentation that includes images or other external resources, because IE/Win doesn’t support data: URIs.  (Okay, never unless this capability gets added to IE/Win.  Don’t hold your breath.)  I do intend that a future version of S5 will allow the embedding of the CSS and JS.  Version 1.0 will not.

One other note: to keep things more consistent with OSF 1.0, I altered the S5 format to use h1 elements for slide titles, whereas before they were h2 elements.  I’ve also dropped the currentSlide, header, and footer divs into a layout div.  You can get a more detailed look from the reference.

All right, I think that’s enough from me for the moment.  Please try out the introductory slide show (also available as a ZIP archive), check over the documentation, and let me know if you find anything broken (fixes always welcome!) or incorrect.  Other feedback on the documentation, or on the content of the slide show, is also welcome.  Suggestions for new features or ways to fix the known limitations are not prohibited, but they will be shelved until after version 1.0 goes to final release.

December 2017
SMTWTFS
November  
 12
3456789
10111213141516
17181920212223
24252627282930
31  

Archives

Feeds

Extras