Blog


Title Capitalization in JavaScript

The excellent John Gruber recently released a Perl script which is capable of providing pretty capitalization of titles (generally most useful for posting links or blog posts).

The code handles a number of edge cases, as outlined by Gruber:

  • It knows about small words that should not be capitalized. Not all style guides use the same list of words — for example, many lowercase with, but I do not. The list of words is easily modified to suit your own taste/rules: "a an and as at but by en for if in of on or the to v[.]? via vs[.]?" (The only trickery here is that “v” and “vs” include optional dots, expressed in regex syntax.)
  • The script assumes that words with capitalized letters other than the first character are already correctly capitalized. This means it will leave a word like “iTunes” alone, rather than mangling it into “ITunes” or, worse, “Itunes”.
  • It also skips over any words with line dots; “example.com” and “del.icio.us” will remain lowercase.
  • It has hard-coded hacks specifically to deal with odd cases I’ve run into, like “AT&T” and “Q&A”, both of which contain small words (at and a) which normally should be lowercase.
  • The first and last word of the title are always capitalized, so input such as “Nothing to be afraid of” will be turned into “Nothing to Be Afraid Of”.
  • A small word after a colon will be capitalized.

He goes on to provide a full list of edge cases that this script handles.

My Perl is a little bit rusty but I worked through the code and ported it to JavaScript.

You would use the above code like so:

titleCaps("Nothing to Be Afraid of?")
"Nothing to Be Afraid Of?"
titleCaps("Q&A With Steve Jobs: 'That's What Happens In Technology'")
"Q&A With Steve Jobs: 'That's What Happens in Technology'"

I hope this code will be useful to some - I suspect that it'll be easy to plug into most blogging software (without having to worry about messing around with the server-side code), or even useful as some sort of bookmarklet.

Tags: blog, javascript

@Twitter

I'm not sure why, but I've become hooked on Twitter. I find it to be interesting because I don't get hooked on new social network-like sites very easily, but I'm stuck in here pretty good. Here's some random thoughts that I've pulled together concerning my use of the site:

  • I really enjoy the 140 character constraint. I feel as if I become more creative in my posts and choose my content more wisely. I'm intrigued by the concept of Microblogging as a whole - the result feeling completely different from normal blogging.
  • Being able to update it from your cell phone, in a pinch, is absolutely key. This is a major differentiator from normal blogging.
  • It took me a while to realize this but the major differentiator of Twitter, compared to just straight-up blogging, is that you have a feed reader integrated into your blogging engine. It's such a smart and obvious concept, once you think about it. It definitely makes the cost of starting a Twitter competitor that much higher (since you have to build a network in order for it to become useful).
  • I've often wondered if a distributed twitter would be possible - more decentralized like normal blogging. I think it would work, as long as your blogging engine was also a feed reader (actively pulling in your friends content).

Follow Me!

If you're interested, you should follow me on Twitter - I'll probably follow you back if you talk about tech/JavaScript-related stuff. I tend to post minor things that don't make it to my blog (stuff about book writing, programming, Mozilla, traveling, etc.) so it ends up being a good source of micro information.

Bitlog

I casually mentioned that I was working on a Twitter clone in my JavaScript Pretty Date post. Honestly, I haven't really touched it since last May. I figure that if I don't get people looking at it now, it'll never get released. You can check it out here, I call it Bitlog. I have registration closed right now - if you're interested in trying it out ping me with your desired username and I'll hook you up.

It's horribly buggy and incomplete (at this point, it's nothing more than a crippled blogging engine - no networking or mobile aspects) but someday I hope to wrap it up and release it, open source, for all to consume. The Ajaxy bits are pretty slick (one-page login, logout, posting, etc.) - I hope to put some more effort into them at some point. It's in PHP 4 (compatible with 5, as well) and has no dependencies - so it should be stupid simple to deploy to the server of your choice. If anyone is interested in hacking on the code, please let me know, I'd appreciate that as well.

Tags: bitlog, twitter, php, blog

Blogging is a 'Problem'

I read an article written by "Ivan Tribble" (a pseudonym) over at the Chronicle. Ivan was part of a committee, at a small college, looking to hire a new professor. It just so happened that a couple of the people vying for the position also had web logs. Ivan's argument is that the majority of web logs are highly innapropriate for someone to get a job with - and that may be the case. However, one person, in particular, caught my eye:

Professor Turbo Geek's blog had a presumptuous title that was easy to overlook, as we see plenty of cyberbravado these days in the online aliases and e-mail addresses of students and colleagues.

But the site quickly revealed that the true passion of said blogger's life was not academe at all, but the minutiae of software systems, server hardware, and other tech exotica. It's one thing to be proficient in Microsoft Office applications or HTML, but we can't afford to have our new hire ditching us to hang out in computer science after a few weeks on the job.

Now, I have a real problem with this. It seems as if the position that this person is going for is not immediately related to technology, which is fine. However, Ivan seems to think that simply because this person has a web log that discusses technology, that he would immediately run off to another part of campus. Can't a person's hobbies be different from their profession? If a person had a web log dedicated to cooking, writing, politics, or philosophy - would that person immediately run off to be with people of a similar interest? The whole notion that having interests that aren't inline with your profession, and being vocal about them on the Internet, is a negative attribute is ludacrous.

Tags: academic, business, blog, blogging, blogs, research

Idea Sling Review

I came across a blog this evening, disturbingly named Idea Sling. (Disturbingly due to the similarity in name to my current project: ideaShrub) I was very concerned that this web site was, somehow, going to be in direct competition with my work, however that does not seem to be the case.

In a nutshell: The premise is that if you have a good idea, but neither have the time nor means to implement it, you should free it up to the public. To quote their mission statement:

Creative People and Go-Getters are celebrated on this site. Those personas often don't exist in the same person.

Instead of letting your idea fester and nag you until the day you die, let it free, into the wild. Who knows it may take wings under the guidance of some industrious soul.

What this site reminds me of, more then anything, is a really slooow version of Half Bakery. Honestly, I see no advantages to using this particular service over the other long-established web site. I wonder if they even realize that Half Bakery exists? Granted, sometimes the ideas on Half Bakery are a little bit out there, it is still an excellent forum for project proposals (similar to the ones on Idea Sling).

On a closing note, ideaShrub is going to, incidentally, provide the core service of both Idea Sling and Half Bakery, and much more, giving users the ability to publish, broadcast, share, and collaborate their ideas in a much more open (or private) forum. I'm tempted to auto-create some new shrubs (using the handy API) filled with data from both of these web sites, so that people can easily browse them in a 'familiar' interface.

Tags: ideasling, review, blog, blogs, idea, ideas

Current Projects

jQuery JavaScript Library

jQuery

Comprehensive DOM, Event, Animation, and Ajax JavaScript Library.

Recent Projects

Pro JavaScript Techniques

JavaScript Book

The best techniques for professional JavaScript. Published by Apress.


Hosting provided by the cool dudes at Engine Yard.