Everything In Between

The brutally honest, first-person account of Meitar Moscovitz’s life.

Archive for March, 2005

Christianity Is Too Complicated

2 comments

Via Char on IM.

I decided that Christianity has some good uses, good ideas, lousy implementation. It’s hard to disagree with “Uh, hey guys, why can’t we just, you know, be nicer to each other? Not be so judgmental? No one’s perfect after all.”

I was like, “Yeah, that’s a good idea! Rock on.” But there’re all these flippin’ rules about things like, yeah, we should be nicer to each other but only every other Tuesday when the wind blows from the South.

Written by Meitar

March 28th, 2005 at 4:25 pm

Posted in Personal, Quotables

Lower East Sorrows

one comment

Went to the NYC Graphic Design Meetup tonight. Nothing special to report. What had a greater effect on me than going to the Meetup today was the location it was held. Downtown on the lower east side, by the bowery.

I used to frequent that area quite a bit in two very different and very distinct times in my past. The first was when I was attending the MDSG (that’s Mood Disorders Support Group) at Beth Israel hospital. I was doing that for almost two years from ages fourteen to sixteen. The meetings were always held at night and for some reason I remember only the nights when it rained.

The second period was after I had turned eighteen and was frequenting fetish clubs and BDSM organizations in the area. (There are plenty.) Naturally, this was also done late at night. Similarly, for some reason, I can only remember the nights when it rained.

There were not many times when Danica and I made it all the way out to the far East of Manhattan. Nevertheless, the lower East side feels like a black hole to me, a black hole I am familiar with from the inside out. While walking towards the Meetup, passing Lafayette Street and peering up at Bond Street, it started raining lightly. I quickened my pace and found the Meetup location.

It was being held at a bar whose year-long theme was the Haiwaiin Islands. Somehow, the contrast of the environment in the bar and the dreary rain growing stronger outside made things seem even worse. Though one would guess that I had an awful time, I actually was very glad to be out at the Meetup socializing, even though I was underwhelmed by the resulting attendance. (I was one of four people who arrived, and I spent much of my time chatting nonsensically about this or that, until I started imparting some of my web accessibility knowledge to the others and inviting them to the meetups I organize.)

Afterwards, I did not want to go home. The rain was stronger now, and it seemed like either the black hole was sucking me in or I was trying to push it away. I can’t tell which.

I was carrying a letter in my bag from Con-Ed addressed to Danica (probably an old electric bill or notice) and had intended to put it in a mailbox (I had slipped it in a new envelope and supplied her new address). As I walked on West 4th, parallel to Bleeker, I kept seeing flashbacks to all the times in my life I had walked these same streets before. I saw ghosts of myself beside me and in front of me, laughing, walking, talking, joking, rushing from place to place as I knew I had in the past.

Now that I think about it I want nothing more than to leave this City and spend a significant portion of my life elsewhere. I can’t stand seeing the same places over and over again. I have a memory for every street corner on this island and tonight I feel trapped by my past.

I ended up walking up Greenwhich Avenue towards Danica’s apartment building. I figured I’d leave her the letter in the lobby on top of her mailbox rather than send it through the post. I called her but she didn’t answer at first, so I left her a message. Then, when I was a few blocks away from her apartment, she called me and tried to tell me something but her phone cut out and we got disconnected.

I left her the Con-Ed letter on her mailbox as I planned and then stood outside under the awning for a few moments, watching the rain. Somehow I had the presence of mind to snap this photo while I was there: West 12 Street on a rainy night.

You can’t see it in the photo because I’m a horrible photographer but I was looking at the small halo of light from the lampost. Streaks of rain were cutting through it and the whole scene made me feel rather heavy and depressed.

I looked down West 12th Street towards West 4th (yeah, the roads are screwy down there), then up the way I’d come at Greenwhich Avenue. I still didn’t really want to go home but I didn’t have anywhere else to go.

I think I didn’t want to go home because I still don’t feel like this place, this one bedroom apartment with a bare minimum of furniture and no personality, is my home. And you know…I don’t know if I even want it to be my home. I just don’t want to live here anymore.

So I pulled myself together, put away the camera, and started back towards Greenwhich Avenue to head for the A train to come back here. Near the corner, I realized I didn’t have much food at home, so I made a quick pit-stop into Benny’s Burritos To Go. I used to frequent this joint quite a bit back when Danica and I lived together on Horatio Street.

I knew before I entered what I was going to order: A pulled chicken burrito with black beans (not pinto beans). The same girl took my order as always.

When I left, dinner in hand (well, lunch), I passed the corner of West 13th and Horatio Streets. I looked down Horatio Street as I walked towards the subway and felt a strong urge to turn towards it and walk back to that tiny, rat-infested apartment the two of us used to live in as if when I got there all of our things would be in their place and I could sit down on the floor like I always had to do to eat my burrito.

But I didn’t. I made it to the subway and stood, waiting for the A train to arrive. I buried myself in my Information Architecture for the World Wide Web book (the book I started reading on the last day of jury duty) but found it difficult to concentrate. (I still did manage to finish the chapter I was on though, because it really is just that great of a book.)

I got home starving, ate my burrito, surfed online or a while, talked with online friends, and tried my best to shake these feelings. I did a good job of it, too. For most of the night I didn’t remember the heaviness I felt looking at the rain earlier.

Earlier today, I was surprisingly productive. I finished refactoring the CSS for the NYCwireless web site (that’s the volunteer web design work I talked about a while ago), and I set up a bunch more Meetups for myself to go to. I’m organizing the New York City Freelancer’s Meetup, which I’ve cleverly scheduled for the same place and time as the New York City Consultants Meetup. Both of these Meetups happen today (that is, the 28th of March) at eight in the evening.

I may also get to see an old friend tonight at nine, after the Meetups. I’m anxious about that because I’m looking forward to seeing him for the first time in many months and because I don’t know what impact certain other events may have had on the matter. (I should probably write about this but, eh, not now.)

As usual, hours are going by and I’m still not in bed. I hope sleep will come quickly and mercifully now. I really need to feel like time is moving forward and things are happening. I just don’t want to stay in this…place my whole life.

Written by Meitar

March 28th, 2005 at 4:39 am

Why Web Pages Need Not Be Compressed

5 comments

There has long been some talk about compressing CSS files to make them smaller and thus use less bandwidth. While compressing files transffered over HTTP is all well and good, some people have taken the ability to do this as a license to create badly-designed, bloated style sheets that inevitably turn into nightmares. What these people don’t realize is that optimized web pages shouldn’t need to be compressed.

(It should be noted that the folks over at FiftyFourEleven are not folks whom I believe are using CSS improperly. The referenced article merely provides additional information for compression techniques.)

When I optimize web sites, utilizing HTTP compression techniques (especially with PHP) is one of the last steps I take and sometimes it isn’t even necessary at all. If your CSS is so large you think you need to compress it, then quite frankly, you’re not using CSS properly.

It’s very, very rare that even large web sites’ CSS files will ever get so big that they need compression if they are written properly the first time. (I’m talking like 25 kilobytes and up here, and even that’s not considered “huge.”) Why is this? Because good CSS should include a couple of distinct characteristics which cuts down on their size dramatically:

  • High-level DOM selectors should be used to take advtange of CSS inheritance.
  • Duplicated and default-declaration rules should be omitted and grouped (as should selectors).
  • Shorthand properties and value replication should be utilized as often as possible.
  • Use the cascade to supply global rules for alternative styles and medias (screen, print, etc.).

Finally, CSS is cached (or should be). That means it’s only sent down the pipe on the first request for it, and using modularized CSS by following the above guidelines means you can re-use these cached files over and over again in many different ways without using a touch more bandwidth.

Thus, it is always a bad idea to rely on compression rather than to do things right the first time. (Band-aids don’t actually correct technological problems.) Thinking that it doesn’t matter how much code you write because you’re going to compress it anyway is foolish (though frighteningly common), and can cause serious problems later on in the course of maintaining and updating or redesigning a web site.

Furthermore, some of the main reasons some sites take so long to show up on a user’s display has very little to do with bandwidth. For instance:

  • Complex tables will tax a user’s CPU by forcing the browser to perform many calculations to configure the table’s display area, slowing rendering speed.
  • To make matters worse, in many cases browsers can’t display any part of a table until the whole table has been processed. If your entire page is contained within one big table, then you’re going to make people wait for the entire page to finish being processed. (Ouch.)
  • On the same note, really long pages can quickly turn into usability nightmares for other reasons, as users easily lose their initial context and relevance, so it is advised to limit the vertical length of most web pages for usability as well as optimization reasons.
  • Page load time increases exponentially for each distinct object (like images, multi-media, even JavaScripts and style sheets) that you place on a page. Reducing the number of HTTP requests is far more important than compressing the content of HTTP transactions because a delay caused by network latency is indefinite.

So what have we learned? If you’re really that concerned with the bandwidth your CSS (or HTML) is eating up, I’m not going to tell you not to compress it, but I am going to tell you that you should probably be dealing with other, more pressing concerns. Let’s talk image optimization, for instance! That, however, is a discussion for another time.

The bottom line is that CSS was designed with bandwidth in mind. Using CSS intelligently drastically cuts your bandwidth use which saves you money and headaches because it reduces code bloat for both style sheets and HTML files. HTTP compression is great and useful, but not as a band-aid to fix a problem it can’t solve.

Written by Meitar

March 27th, 2005 at 3:51 am

Polyamory and Nonmonogamy Resources for Beginners and Newcomers

4 comments

A brief run-down of poly resources and other things I don’t want to forget about. The fact that I was asked about such resources twice recently makes this quite blogworthy, too. I should probably put this in a wiki, but since I haven’t got one running at the moment, this will have to do.

I’ll probably add stuff every so often as I find it and deem it helpful. Be aware that some of these resources are decidely local to New York City, since that’s where I am. If you live elsewhere, however, there are certain to be polyamory groups near you. (I know of quite a few around America and even in Europe, so feel free to ask me for the links if you’re interested.)

Sorted in order of (my) perceived quality and introductory importance so that a newcomer can simply run down the list, the polyamory resources are:

Online Poly Resources and Sites on the Web

Polyamory? What, like, two girlfriends?

The must-read intro about what is (and is not) polyamory. This is the single most immediately beneficial document I have ever read on the subject.

Additionally, xeromag.com has a whole bunch of other extremely well-written and informative guides to polyamory. They are each very helpful. I guarantee you these documents will help create an important foundation for talking about and dealing with polyamory and the concept of “open” (or perhaps “not-quite-normal”) relationship(s).

Some of the other articles at xeromag are:

  • Never Do This: Poly Mistakes: How to screw up a poly relationship even if you are compassionate and well-intentioned.

    This is the other must-read guide, written in negative form. It’s also got some great refridgerator-worthy items. It informs you (the easy way) about some of the pitfalls you might fall into when trying to build stable, happily non-monogamous relationships. (Reading this over recently made me sad…for obvious reasons.)

  • Dos and Don’ts for Poly Relationships: A guide for poly relationships outlining the fundamental dos and don’ts that every poly relationship needs.

    When I get a printer, I intend to put some of these on my refridgerator because they’re useful for every-day relationships as well.

  • Poly Myths: Debunking the myths about polyamory.

    This is a good place to point people when they start talking about why polyamory can’t ever work, and how the whole thing is just thinly-veiled promiscuity or sexual greediness. Believe me, you talk about this stuff enough and someone’s going to tell you these things. Of course, whether or not they read (and hear) it is up to them.

  • Poly Relationships for Monogamous People: What it might mean if your partner just told you that they’re polyamorous.

    Obviously, this is a good article to point your spouse or partner to if you’re coming out as polyamorous. It’s written in that same question-and-answer format as all the other articles and has some very good advice for what could come next.

  • What Your Partner Wants You to Know: …but might not be able to articulate.

    This article is not a substitute for your own words, but it does do a good job of helping you formulate your thoughts and provides a good vocabulary from which to draw.

alt.polyamory home page

The original polyamory resource, which grew out of the old alt.polyamory usenet newsgroup. The most immediately beneficial portion of this site is right at the top of the home page where the FAQs are listed. These are long-standing documents which are frequently pointed to. They’re also very beneficial for newcomers and serve as helpful reminders for folks in polyamorous relationships. These are important to know.

Loving More FAQ And Terms

Polyamory has many names, because many people have moved towards the idea on their own and in their own way. There is no “one true way” to love. This is a online magazine published by one such group of people who term the concept “Loving More” (or LM). Their FAQs are helpful, too.

Polyamorous-NYC

There is only one best way to learn about anything, and that is by doing. When you’re ready to interact with others who are polyamorous, this is a great place to go to meet people and learn more. Note that it is not a sex club, but rather an educational organization intended to nurture a prosperous polyamorous community in New York City.

How to Educate Your Therapist About Polyamory

Published at the Electronic Journal of Human Sexuality in Volume 5 on April 16, 2002, this document is an outline of a talk given to the Society for the Scientific Study of Sexuality and includes some important notes for physchologists and therapists as well as their clients.

Tristate Poly

This is an online organization similar to Poly-NYC (above), though there is no “membership” per-se. I’ve found that this means that not everyone here will be truly polyamorous; I’ve met swingers there as well, and swinging has very little to do with polyamoroury. (Swingers can be polyamorous, and polyamorous people can be swingers, but there is a huge distinction between these two concepts and one should take care not to mix the two.) Nevertheless, it is good to know that this community exists and is somewhat active as well.

PolyMatchMaker

This is an online personals site devoted to helping polyamorous folk meet one another. Note that it is not a sex or porn site (very much unlike the FriendFinder network of adult personals sites); that means no profanity or sexually explicit material is allowed on PolyMatchMaker. This site is about meeting people, not finding random sexual encounters. Swingers should go elsewhere.

Spice!

Spice! is an online comic strip that portrays the life of a polyamorous family with children. It’s the only comic I’ve ever found of its kind, and it’s not that bad either. The artwork is cute, and the jokes are decidely poly-centric. (Like this one, and this one, and this one for instance.)

LiveJournal Polyamory Community

This is a community of online diarists who write about their experiences and thoughts with and on polyamory. People post new entries frequently, and many members comment on others’ entries offering support, advice, and feedback.

Subspace

Subspace is a web site for and by people who practice both BDSM and polyamory. They have a collection of articles, links to other articles, a decently active message board, and even a poetry archive.

Books and Other Printed Literature

These are polyamorous resources published in books or other printed literature. Some cost money, some do not, but they are all helpful. (Some book listings borrowed from Franklin Veaux’s poly links page)

The Ethical Slut by Dossie Easton and Catherine A. Liszt

The definitive guide to infinite sexual possibilities and polyamorous relationships. Includes an abundance of background information, supportive validation, and practical advice on how to deal with the realities of a poly relationship (yes, including jealousy).

Polyamory: The New Love Without Limits by Deborah M, Dr. Anapol

An excellent resource for polyamorous people. Focuses more on polyfidelity than on other kinds of polyamory, but another all-around recommended read.

The Myth of Monogamy by David P. Barash and Judith Eve Lipton

Written by a husband and wife team of behavioral scientists, this book explores non-monogamy from a behavioral, genetic, and moral standpoint. The book is not hostile to monogamy, but it makes the statement that in humans, a relationship model is a matter of both biology and choice. It argues that monogamy is not more inherently “natural” than non-monogamy.

Movies and Video Material

When Two Won’t Do (directed by David Finch, circa 2002)

This real-life documentary made by a couple (and inspired by grappling with issues in their own relationship) takes you on a trip across America with them as they discover first-hand how people have “open” relationships.

If you know of a resource I’ve not listed here which helped you a great deal (especially when you were first learning about polyamory) then please drop me a line. (You can either comment on this entry or email me as meitar at a domain called maymay dot net.) Naturally, I also hope that this page might some day help others find what they need.

Written by Meitar

March 26th, 2005 at 11:21 pm

Posted in Polyamory

My Teeth Are Nuclear Batteries

3 comments

So I’m headed to the periodontist today. That’s the dentist who will be spending a good hour or so today cutting my gums open and drilling into my jaw bones to create a pocket where he can lodge a small metal implant that will hopefully hold a crown for my upper-right canine tooth. I’m really not looking forward to this today.

Yesterday, I got to bed at around 8:30 PM. I had spent the previous night awake because I had woken up at six in the afternoon on Monday. I had to stay awake for all of Tuesday because I can’t afford to be tired at the periodontist’s today.

Unfortunately, I still didn’t get as much sleep as I would have liked. I have a small but persistent eczema rash on my thigh that itches like hell. (It still does!) It woke me up at around one in the morning and I had a lot of trouble falling back asleep. Nevertheless, I did manage to sleep for a few more hours until about four in the morning.

I was starving, so I made myself some garlic and herb risotto and did the dishes. Now I’m waiting for the banks to open so I can deposit a few checks (which I need to do urgently) and then I’ll head out to the morning’s periodontist appointment. Augh.

On the brighter side, I’ve been somewhat productive lately, managing to continue work on my own web site as well as start the outlines for a whole new one (also of my own). I have been learning a ton about various things lately and was extremely proud of my little PHP script which implements a hierarchical navigation system based on solid URI design. One of the reasons I’m so impressed with myself is because I’m coming up with more and more solutions to problems quickly and easily that utilize fundamental principles in clever ways—the sign of truly complete understanding.

Yesterday, I assembled both of my cabinets. I put the black one in a corner of my bedroom and the white one in a corner of my living room, for now. Here’s the white one. (Yes, that’s toilet paper on top of it.)

White cabinet with toilet paper rolls on top in the corner of my living room.

I have no idea what to put in it for the time being. I’ve got a lot of work to do to get this place really set up nicely. I’m not even really that motivated to get myself any furniture because I spend all my time sitting at my computer coding or reading or doing something online. Though I would definitely like to be able to set up a nice server rack somewhere in here.

Written by Meitar

March 23rd, 2005 at 7:01 am

Posted in General, Personal

Polyamory Will Save the World

2 comments

At this late hour, I haven’t the wits to add much value it, however this entry by Dave Pollard on the topic of polyamory is such a compelling read that I encourage you to drop what you’re doing and read it right now.

(Here is the first article in the series.)

Written by Meitar

March 21st, 2005 at 8:37 am

Posted in Polyamory

Using Good URL Design to Create a Breadcrumb Navigation System In PHP

5 comments

One fundamental aspect of any good navigation system is a mechanism to let users know where they are in relation to the rest of the content. On the Web, one of the most popular and thoroughly studied ways to reflect this information is in a so-called breadcrumb navigation trail or bar. This navigation bar lists the categories and subcategories (or sections and subsections) of the page which the user is browsing.

(Quick-minded readers will be quick to point out that the term breadcrumb navigation trail, which originates from the Hansel and Gretel story, is not entirely accurate. In the story, Hansel and Gretel left a trail of breadcrumbs as they wandered through the forest so they could retrace their steps back home. On a web site, the breadcrumb navigation trail reflects the current page’s position in the site hierarchy, not the path the user has taken through the site.)

Defining the Requirements of Breadcrumb Navigation

When I started looking for ways to easily implement a breadcrumb navigation trail on my web site, I immediately saw the potential complexity of the project. The hierarchical navigation system needed to:

  • Accurately reflect a page’s position in the hierarchical information architecture of the site and not the physical location of the page in my web server. (This is important for me because I’m constantly moving things around.)
  • Present a nicely formatted label for each level of depth.
  • Automatically adjust itself for new pages, so I would never have to deal with it when adding new sections to my site.
  • Not require any “heavy” database or large application to use and scale.

Additionally, the module should:

  • Produce semantic, valid HTML marked up as a list.
  • Link all elements in the list to their appropriate page level.
  • Not link the last level, which should display the current location of the user in the site. (We don’t need a link back to the same page we’re already on.)

Searching for Inspiration

The first thing I, like any good programmer, went to do was search for existing code. Unfortunately, there is an appallingly small amount of information on implementing breadcrumb navigation out there. Sure, they’ll tell you what it is and what it’s good for, even convince you why you should have it, but as for actually implementing it goes…sorry, you’re on your own.

Every tutorial I found on the matter was decidely sub-par or completely failed to meet my requirements, listed above. Most sites stated the need for databases to create truly scalable and customizeable breadcrumb trails. Of course, nothing can compete with a fully integrated RDBMS solution, but with intelligent information architecture you can come pretty darn close.

Using the URL to Our Advantage

Thankfully, there is already a system of hierarchical navigation readily available to us. In fact, there are two!

  1. Directory trees on your web server. The folders in which your files are stored are probably already sorted somewhat logically and categorically.
  2. The URL of the requested page. The address bar in your browser drills down through these categories to get to the final page.

Both of these systems provide a basis from which we can draw upon to create a simple, self-organizing breadcrumb navigation system on a web site of almost any size. However, there are a few problems with the first method. (If you want to implement that method anyway, here’s a tutorial based around using a directory tree.)

  • It doesn’t scale. If you’ve got a huge web site, you’re not going to keep all that data on static files on your web server. It would also be a full-time job to categorize and sort that content on said server! Oi, vey!
  • It’s dependant on your organization system. If you’re anything like me, you don’t necessarily have folders within folders within folders just to store files, and if you do, you probably change them around pretty often to suit your needs. Unfortunately, basing breadcrumb navigation on your view of your information as opposed to your visitor’s view of the same information is a recipe for disaster in all but the smallest web sites.

Thus, the only remaining solution was to rope the URL of the page into service to serve as the basis for a breadcrumb navigation system. Even so, there is one huge obstacle to overcome with this method. The URL itself must not be attached to a physical filesystem on the web server.

Otherwise, we’re just basically using the filesystem hierarchy, which we’ve already seen is not adequete for our needs. So we need a way to abstract, or detach, the URL from the filesystem itself. Enter mod_rewrite, stage left.

Abstracting the URL from the Filesystem

Abstracting the URL from the filesystem is the critical step to enabling truly scalable, self-organizing breadcrumb navigation using such a simple foundation. This is essential because the URL of your page is the thing that will always be live; if the URL changes, so has your page! This change will then be reflected automatically in the breadcrumb navigation trail.

There are a number of other benefits to abstracting the URL of a page away from the physical filesystem it represents. I’ve even talked about some of them before when I blogged about playing with Apache and when I suggested tips for improving search engine rankings of CMS-generated content.

The basic prerequisite for a good URL schema, however, is solid information architecture. This means having a well-defined and clear structure to your site so information is easily findable and properly labelled, categorized, and placed within the system you use. Only after you create a sound URL design schema free of any unsightly cruft which succinctly encodes the hierarchy of your site will you be able to leverage them to their fullest potential. (Phew, that was a mouthful!)

So, since this is not a post about URI design (see these resources for articles on that), let’s assume you’ve done all that and are ready to implement your schema. The tools you’ll need are:

  • The Apache web server.
  • Its mod_rewrite module.
  • Access to the server configuration file or the ability to use .htaccess files.
  • Later on, you’ll also need PHP, for the coding thing.

To make things simple, I’ll use my site as an example.

For my own site, I have several sections (“About,” “Services,” “News & Weblog,” etc.) and several top level pages that stand on their own (“Home,” “Contact”). Additionally, each section has an index page to ensure that no hierarchical level of my site is without its corresponding landing page.

This was going to be represented with straight-forward URLs that looked like this:

  • The “Home” page would have this URL: http://www.maymay.net/maymaymedia/
  • So-called “top-level” pages would look like this:
    • For the “Contact” page: http://www.maymay.net/maymaymedia/contact/
    • For the “About Us” page: http://www.maymay.net/maymaymedia/about/
    • For the “Services” page: http://www.maymay.net/maymaymedia/services/
  • Second-level pages would have URLs such as these:
    • For each service:
      • http://www.maymay.net/maymaymedia/services/web-programming/
      • http://www.maymay.net/maymaymedia/services/web-accessibility/
      • http://www.maymay.net/maymaymedia/services/web-site-optimization/
    • For each “About” page, for instance:
      • http://www.maymay.net/maymaymedia/about/accessibility/
      • http://www.maymay.net/maymaymedia/about/philosophy/
      • http://www.maymay.net/maymaymedia/about/technology/

My files are stored pretty simply on my web server. Some pages, like the “Contact” page are stored in the maymaymedia directory but not in their own sub-directory. Other pages, like the “Services” and “About” pages, are stored in the services and about directories, respectively

This created filenames like maymaymedia/contact.php and maymaymedia/about/index.php. That .php stuff had to go!

Writing Your .htaccess File

Using the magic of mod_rewrite, a few relatively simple lines added to your .htaccess file is all it takes to turn these filenames into these beautiful cruft-free URLs.

Creating the sections was easy enough. Some of the work was already done by keeping the pages in their own directory (such as “Services,” for me) so I didn’t even have to do anything. Of course, to be safe, I could future-proof my site to abstract these directory trees using additional lines in my .htaccess file, but for the sake of simplicty we’ll leave it as is.

Here are a few relevant snippets from my .htaccess file:

RewriteEngine On
RewriteBase /maymaymedia/
[…]
RewriteRule ^about/technology/?$ /maymaymedia/about/tech.php
RewriteRule ^about/philosophy/?$ /maymaymedia/about/philosophy.php
RewriteRule ^about/accessibility/?$ /maymaymedia/about/access.php
[…]
RewriteRule ^services?/web-site-optimization/?$ /maymaymedia/services/wso.php
RewriteRule ^services?/web-programming/?$ /maymaymedia/services/webprogramming.php
RewriteRule ^services?/web-accessibility/?$ /maymaymedia/services/accessconsult.php
[…]
RewriteRule ^contact/?$ /maymaymedia/contact.php

These merely map simple URL’s onto the appropriate files for the specific page on my server, creating the nice breadcrumb-like URI structure we can now use to automate the process of generating our hierarchical navigation bar.

There are two main points to keep in mind when creating such URL schemes.

  • Use a standardized syntax.

    Don’t mix and match symbols. Choose one syntax and stick with it. I used a hyphen (-) to simulate spaces, since spaces are not allowed in URIs. You could also use the underscore (_) if you wanted, but hyphens don’t require users to press the shift key.

  • Make the URL descriptive.

    Since we’re going to be using these URLs as our breadcrumb navigation labels, they need to be as descriptive as possible. Keep them short enough to easily type but long enough to provide context. For instance, I could have used wso instead of web-site-optimization but how many people know that that’s what WSO stands for?

    Besides, including the whole phrase boosts our search engine rankings by embedding our keywords into the URL itself! A nice bonus which also enhances usability.

    If you’re really worried about optimizations (for instance, because you’ll have to write all your links like href="/services/web-site-optimization/") then you can use a redirection script and point your links at something like href="/r/wso/" which would then automatically redirect to the expanded URL.

Coding the PHP Breadcrumb Navigation Bar

Now we’re ready to leverage the inherent advantages of good URL design to create our scalable PHP breadcrumb navigation script. I use a special PHP script called navbar.php to dynamically generate all of my navigation, so that’s where the code will go. navbar.php can then be SSI‘ed or include()‘ed on our page template so it will be present in all the pages we create from here on out.

The breadcrumb navigation script needs to do a few things. The code flow looks like this:

  • Grab the requested URI and break it into its path components.
  • Initialize (or remove) the first (“top”) element.
  • Count the remaining elements.
  • Check for trailing slashes on the last element, and remove it if necessary (such as if its empty or it’s just a query string).
  • Loop through all the elements, placing them within <li></li> HTML elements as well as <a></a> if we are not at the last level.

Stepping Through the Code

First, we start our HTML by providing a header (which we can later set to display:none; in our CSS) and starting the list element. Due to the specific nature of my site structure (the site starts in a sub-directory of my main site), I also chose to always print the main “Maymay Media Home” link. You don’t have to do this.

<h3>Hierarchical Navigation</h3>
<ul id="hier-nav">
<li id="hier-homeLnk"><a href="/maymaymedia/" title="Maymay Media Home">Maymay Media</a></li>

Next, we start the PHP magic, grab the URI the browser requested and break it on the slashes with explode().

<?php
$url_parts = explode('/', $_SERVER['REQUEST_URI']);

Now the $url_parts variable contains an array, each element of which is a segment of the path from the requested URI. Since a URI request always starts with a leading /, the first element of our $url_parts variable is an empty string. That’s somewhat useless for us, so we’ll get rid of it.

array_shift($url_parts); // first item always empty in URLs

In my particular case, the second element will always correspond to the maymaymedia sub-directory I have my site in. Thus, the second element of this array is also useless to me, since I chose to always print this “top level” link before we even started the conditional code. Thus, I get rid of the second element, too. (You may not want to do this in your script!)

array_shift($url_parts); // second item unneeded since always contains "maymaymedia" due to my site structure

Now we need to count how many elements are left in our array which will tell us how many list items we need to make and where to find the end of our array so we can identify the last element. Remember, we’re going to need to check if the last element is empty or not because we don’t know if the visitor entered a trailing slash in the address bar.

If the last element is empty like the first one then we don’t need it. We also don’t need it if all it contains is a query string, so in either case we can pop it off the end of our array and decrement the variable we use to store the size of our array.

$num_parts = count($url_parts);
// remove last element if empty or if a query string
if (empty($url_parts[$num_parts-1]) || $url_parts[$num_parts-1] == '?'.$_SERVER['QUERY_STRING'])
{
    array_pop($url_parts);
    $num_parts--; // decrement to keep track
}

Now we have all the data we need to construct our breadcrumb navigation list. The first step is to start the second list item and insert a separator (I chose a “>” character), and then to format our URL strings into a more human-readable format. Basically, that just means replacing all of the “-” characters with spaces, and then capitalizing the first character of all the resulting words.

for ($i=0; $i<$num_parts; $i++)
{
    echo '<li> &gt; ';
    $p = ucwords(str_replace('-', ' ', $url_parts[$i])); // format 'things-like-this' to 'Things Like This'

(Of course, advanced CSS coders will note that inserting a physical character in the HTML markup is unnecessary since we can use a CSS rule such as #hier-nav li:before { content: ">"; } to create this presentational separator instead. Unfortunately, Internet Explorer does not support this level of CSS yet, so we must resign ourselves to use a physical character in the markup for now.)

Then we make a quick check to ensure we’re not at the end of the trail. If indeed we’re not, then we need to turn our text into a link and point it to go to the appropriate level. Otherwise, since we’re at the end of the trail, we just print the text and end our list item.

Creating the link looks complicated, but it’s really not. Our array stores all the path components for us, so all we need to do is slice off the end of it so all that remains is the first elements we’ve already looped through.

Once we’ve done that, we merely reassemble our URL by reversing the formatting process we used before. Namely, we implode() our array to turn it into a single string connected with the slashes, replace all spaces with dashes (-), and then turn the whole thing lowercase. We can do all of it on one line.

Also note that due to my particular site structure I’ve hard-coded the links to point to the root directory of this site. You’ll probably want to remove that on your own script.

    // only link if not last time through loop
    if ($i != ($num_parts-1) )
    {
        echo "<a href=\"/maymaymedia/".strtolower(str_replace(' ', '-', implode('/', array_slice($url_parts, 0, $i+1))))."/\" title=\"Go up to $p\">$p</a></li>";
    }
    else // last time through loop, so don't do the link
    {
        echo "$p</li>";
    }
}
?>
</ul>

That’s it! After closing our list element, we’re done, and we now have scalable breadcrumb navigation based on an intelligent URI schema on every single page. Was it good for you too?

Additional URI Design Resources

(Some segments shamelessly swiped for my own easy reference from Pixelcharmer.)

A list of resources that argue for and suggest best practices in URI construction.

By the way, here’s the difference between the two: What is a URL? What is a URI?

Written by Meitar

March 21st, 2005 at 6:38 am

14 Hour Coding Session

4 comments

Oh my god, fourteen hours playing with XHTML, CSS, and PHP to get Maymay Media to what it is now. (And it’s still not done, though I’m constantly looking for feedback!)

Much, if not most of that time was spent writing and editting new content, and beating down CSS bugs in Internet Explorer. Those of you who know my work habits are likely to be surprised by the fact that I could spend 14 hours dealing mostly with client-side coding issues.

Normally I can’t spend more than a few hours—at the most—dealing with CSS problems because browser bugs tick me off too much. (Ahem, MicroSucks.) Nevertheless, for some miraculous reason, I kept swatting bug after bug after bug this session and the enthusiasm just fueled more coding. Needless to say, I was very very productive last night.

I also didn’t sleep a wink, however, so now I’m dead tired. Here’s a short recap before my memories fall down behind the waterfall in my mind.

Last Night’s Call-a-thon and Digital Departure

  • Last night I was Mr. Popular. I got literally countless phone calls (I can’t remember them all) from folks who wanted to chat it up. I spoke to a few Meetup group members, Danica, my parents, and others. Christine called and wanted to hang out today but she canceled this afternoon. (I didn’t mind, I’m exhausted.)

  • Danica came over from about 8:30 PM to 10:30 PM so that she could give me back the apartment keys and transfer her digital posessions (computer files) off of my computers and onto her own. She also gave me a Moldy Peaches album to import into my iTunes Library. (Cool.)

    So that’s pretty much it. We said goodbye, she seemed sad, and I asked her to call me so I knew she’d gotten home okay. She did, and we said goodbye again. And that’s that; we are finally going our separate ways and have no more connection to each other whatsoever.

    I’m not even thinking about the future, but I do admit that remaining friends is something I’d probably like—if it were not emotionally draining. We’ll see what happens, but the path for right now is very clear: I’m trekking it solo yet again!

The Geeky Parts

  • Back to the tech realm, I’ve implemented my dynamic relevancy message API on this blog. What does that mean for you? Probably nothing, but it does mean you’ll likely see relevancy messages change and grow in abundance over time. As always, use a modern browser to see the full effect.

  • Still in the tech realm, I squashed a number of annoying IE CSS bugs on this blog with the somewhat-magical application of position:relative;. This means visitors using IE will finally get a near-perfect browsing experience, with no annoying vanishing backgrounds anymore.

  • Also, Google SiteSearch has been implemented, so you’ll be seeing that on the top banner for the time being. It’s nothing special, just a way to make it look like you can do more than you can here. It might also make me some more money via clickthroughs, but that’s unlikely. (Oh, which reminds me, those ads on the right side of the window, yeah, if you click on those I get money. Don’t be shy.)

  • A not-so-new but still interesting point of note is that I’ve started using MyBlogLog.com to keep track of which hyperlinks people are clicking on. This has been somewhat informative because it means I get to see which hyperlinks induce clicks and which don’t. Anchor text is important, and this is a useful tool to learn how you can manipulate the effect of a link.

Flickr Photos from the Past!

Finally, I’ve been wanting to get more value out of my digital camera. I haven’t been taking pictures, but backing up and transfering a bunch of Danica’s things last night inspired me to dig through some of my old photo collections to see what could turn up. Well, here it is:

  • Here’s me almost a year ago, during last year’s Passover at my mother’s:

    Me sitting at the table during Passover, 2004

  • Me at San Francisco’s Exploratorium with Danica during the Summer of 2004, on my trip to meet her family. Look at the face I’m making, I had so much fun there.

    Me sitting on the big chair at the San Francisco Exploratorium.

  • Yeah, I was gonna eat that piece of toast. Obviously, my dinner plans were foiled.

    I look at the camera sadly, holding burnt toast in my hands.

  • This is what happens to my face if I don’t shave.

    Me smiling, sunlight clearly showing my unshaven face.

Written by Meitar

March 19th, 2005 at 7:13 pm

Journaling Jury Duty

2 comments

I spent both yesterday (Wednesday) and today’s morning (Thursday) sequestered at jury duty at the New York Supreme Courthouse downtown. It was not fun, but it was a novel experience and by that virtue alone I managed to have a good time.

Trial by Journal

I was called once, sent to the jury box and spoke a little bit about myself, answering questions from a sheet of paper in a narrative form. Ultimately, I was excused from the trial and that was the furthest towards being a juror I got. I spoke to several other people, all of them women and all of the older than I am, during my time at the courthouse. One of the women I spoke with, a graduate student studying neuroscience, was selected for the same case that I was excused for.

A few folks have asked me why I wasn’t selected. I can only say that I don’t really know, and I’m not really concerned with the matter. If I had to hazard a guess, however, I’d say that it’s because very few people know what to make of me when they hear me present about myself.

Case in point, during the voir dire (French for “see and say,” the part of juror selection where you speak a bit about yourself), plenty of folks turned their heads at me in surprise. First, when I mentioned that I have completed neither college nor high school, again when I said I am barely making a living doing web consultancy work, building, maintaining, and developing web sites for clients, and finally when I mentioned that My brother was mugged once and had his glasses stolen.

The truth, the whole truth, and nothing but the truth. And yes, we were under oath. The only semi-direct question I was ever asked was by the (very creepy looking) defense attorney who said, Mr. Moscovitz, you have no prior jury experience, and I answered a very plain, No, I have not.

So why didn’t they pick me? Who the hell knows. They didn’t pick a bunch of other people either, so perhaps they didn’t like my hair for all I know.

What I do know is that I am supposed to be compensated for my time with eighty dollars from the State of New York sometime in the next eight to twelve weeks. Even better, I spent the vast majority of my time reading my tech books and working on my web site. If I could keep getting paid forty dollars a day to do that, I’d volunteer for jury service! (Um, provided I don’t actually get selected to sit on a case.)

Some New Furniture

Anyway, that is that, as they say, and it was certainly an educational experience. On Wednesday afternoon, after we were released for the day I went to see my father who offered to buy me some cheap cabinets. I have two of them now, each with four shelves, one white and one black, leaning against the wall waiting to be assembled.

He also bought me a demented laundry hamper (its legs are twisted out of shape and for all I know it’s almost broken already) and a toaster oven. I’m looking forward to utilizing the toaster oven, but I don’t know exactly what for yet. First comes groceries, then comes toasteries, then comes the maymay with the dinner…cabbage?

Random Thoughts and Impulsive Musings

Tired

Bah, I’m tired. I’m pretty much convinced I have DSPS (an acronym for Delayed Sleep Phase Syndrome), a condition which basically fucks with your ability to get to sleep at any reasonable hour, despite exhaustion. This is very different from insomnia, which never really rung true for me.

Supporting a Friend

Another noteworthy point to mention is that an acquaitance from the Bipolar Disorder Meetup Group (who is quickly becoming a friend) called me Wednesday night at around nine o’clock. I could instantly tell that something was wrong. She told me she needed to talk to another bipolar, someone who won’t think I’m just totally crazy, y’know and I happily obliged.

We spoke for a half hour about mood swings and triggers and other people’s perceptions and ways to deal with it all. In fact, I wish I would have recorded that conversation because it would have made a great podcast. Which reminds me, I should learn more about podcasting.

More Website Donations

On another front, my father donated an incredible fifty dollars to my web site fund through my PayPal donation form. He said, part jokingly, that he was so embarassed not to have been the first contributor that he put in extra cash. (See how great your donation was, Chris?)

Snail-Junk-Mail

Last and probably least, I keep getting weird mail addresse to various different people in my inbox. It started off a week after I moved in here with a single, small letter. Then there were two letters, then three and a magazine, and it has continued to grow until now I’m getting a full-sized cardboard box that I’m somewhat leery of touching.

Which also reminds me: Find out how to forward mail. I don’t want to keep getting this stuff because I keep hoping it’s for me and then it’s not. The only mail I get are bills, which is more than a little depressing.

Photos of The Gates and More

And on that note here are a few recent photos fresh off the compact flash card.

  • View of the snow-covered park from my window sill.
  • Christo's 'The Gates' in Central Park on a sunny afternoon.
  • My brother, Shir, in front of one of The Gates.
  • Carrots being prepped for juicing in my sink.

Written by Meitar

March 18th, 2005 at 2:31 am

All Day, All Nighter

one comment

More full days on no sleep whatsoever. This reminds me of my regular routine, which I think is a good thing. At least I feel productive!

Marvelous Meetups

Yesterday, I woke up sometime around five o’clock in the afternoon. Shortly thereafter, I left the house to attend the Bipolar Disorder Meetup Group’s monthly meeting. Predictably, it was terrific.

Being social in a setting which allowed individualism and conversation was a wonderful mood boost. The conversation was intelligent and personal, a very sharp contrast from the previous night’s experience out in the clubs. I had breakfast (yes, at eight in the evening), talked with folks both familiar and new, and generally had a wonderful time.

Danica’s Stay

Upon arriving home, I discovered Danica sleeping in my bed. She had left me a note which stated she wished to be woken up, so I tried to do just that. However, since she had obviously crashed and was somewhat out of it, I let her sleep and got her some glasses of water.

She stayed the night, since she awoke far too late to make it to her apartment at a reasonable hour. I ordered her some Chinese takeout for dinner and she appreciated my generosity very much. In a way, I was glad to have her company, though I was also looking forward to the moment she would leave.

After dinner, she retired to bed and I stayed at the computer for the night. I didn’t go to bed until after sunrise, though since she was laying there and woke up when I laid down, we ended up talking and I didn’t go to sleep at all. (That’s why I’m so tired now.)

Some time after she awoke she went to grab breakfast. We ate, she packed a few extra belongings, and then I called a taxi for her. We parted on good terms, and are seeing less and less of eachother as we continue to go our separate ways.

The previous night, she told me a lot about how miserable she is most of the time. In the morning, to prevent myself from softening and acting on too much compassion, I purposely asked her about Randy, and was both relieved and angered (for lack of a better word) when she told me she was seeing him regularly. (He wants her to come to China with him during the month of May, on a trip he will be taking.) She said she is happy when she’s with him, and speculated that she may be entering into a very codependant relationship but didn’t know what to do about it. ( -_- No comment.)

Jury Duty Preparation

After she had gone, I decided to spend the rest of the day awake in preparation for an early morning tomorrow. I have been summoned to jury duty and need to be hours away from home by 8:45 AM. I have mixed feelings about the whole affair; on the one hand I’m annoyed by the inconvenience, yet I’m also intrigued and somewhat nervous about it.

This means I’ll grab a good nine hours or so of sleep tonight, hopefully awake earlier than I have to and thus have time for a shower, some breakfast, and some online shenanigans. Easing into my days in that manner always helps me have better days. I plan on bringing several books and my laptop with me so that I can read, write, or do some work while I’m waiting for the selection process to progress.

Money at my Mom’s

Just after 1:30 PM, I went to my mother’s to pick up laundry, my child support check, and return her Metrocard she had lent me for the previous days subway travels. (She is homebound recovering from the flu, so her unlimited-ride Metrocard was not of any use to her yesterday.) I stayed until just past five o’clock, doing my best to stay awake. I also needed to sign my tax forms.

While I was there, I kept myself busy to keep from passing out. One very notable event was that for the first time ever, a reader has contributed a monetary donation to my web site! A big shout-out and thank you goes to Chris O’Byrne for his generous $1.00 donation. (I mean it when I say every little bit counts!)

Chris had actually donated several days ago, but I was unable to accept his contribution due to Paypal’s slow confirmation procedures. I finally managed to accept the donation today, while checking the status of my account at my mother’s. (Apologies for the tardy thank-you, Chris.)

Bedtime

At this late stage in the game, my mind is drawing blanks whenever I try to start a new sentence. There were events I wanted to record, things I wanted to say, and stuff I wanted to do that just won’t happen because of the mental gaps this lack of sleep has caused. That’s the sign that I need to stop, relax, and stop wasting my days trying to prolong them uselessly.

And so on that note, I will go and collapse in bed.

Written by Meitar

March 15th, 2005 at 7:00 pm

Posted in General, Personal