html

Re-Think Medium Independence

Software engineering has introduced the paradigm of the separation of the View (visual representation) from the Model (business logic) long time ago. In the realm of the Web, this principle was re-emphasized. In the late '90s and early 2000s the separation was used to accommodate for differences between physical mediums that a web-page could be viewed on: from the lame WAP browsers to incompatible HTML ones of all kinds. Or at least, this is how it was commonly explained. I, for one, have rarely seen any actual web-application that would cleanly and transparently render to WAP and HTML from the same engine. Also, the WAP mess disappeared long before most developers would start to feel its pains. But that's a different story.

These days tiny gadgets (think: iPhone or Blackberry if you are "uncool") have better, more compliant browsers than some desktop systems (would that be Windows?). Is the need for MVC - the separation of Model and View gone?

On the contrary. The peak of the so-called Web 2.0 is characterized by the flood of widgets of all kinds. Widgets for iGoogle, "applications" for Facebook and even - web-enabled widgets for Desktop systems like OS-X Dashboard. Large companies of the kind of New York Times produce widgets for all of these mediums. Obviously, something like that can be a huge expenditure if you are writing each widget from scratch each time and do not re-use anything but the database.

Therefore, the Web Question of 2009 becomes: can your website's source code output a widget instead of a full-fledged website with very little code change?

Think about it.

Syntax-Highlighted Textareas with HTML and Javascript

As web applications become increasingly smarter and powerful, we start to spend more time in a browser window than in any other desktop application. MS Office-replacement suites like Google Apps, are first to come to mind, but there are many other cool apps. Web-based collaboration is especially web-centric. Wikis, blogs and community sites are all authored using text-areas in a browser. In most cases a WYSIWYG editor is provided. Geeks like us, however, prefer to mess with raw code (HTML?) directly. Nice and dandy, but then you are stuck with boring black-on-white listing. Or maybe not...

Codepress is an absolutely amazing Javascript library that provides syntax-highlighting for programming code, including the ones written on PHP, Javascript, HTML, CSS, Java, Perl and SQL. It's very solid and performance is great.

I must confess, back in 2003, I did try to create something similar but failed miserably. It was either because I did not have enough time or Javascript was not powerful enough, yet, or I was not that good at it, depending who use ask. Either way, I am double excited now to see that somebody else was able to deliver this very useful and much appreciated tool.

P.S. I am going to look-around if anybody has already integrated it into Drupal and if not - you bet it is going there ;)

Spam-Free Mailto Link

By now, we've all learnt that simply putting a link to your e-mail address on a website means exposing yourself to spammers. Bad idea! For this reason, contact forms with captcha are often used instead. But sometimes we do want to display an e-mail address.

What to do?

Well, security through obscurity may not be 100% reliable but still helps. Some people take it too easy and write something like: smartypants AT yahoo dot com. First of all, it is not user-friendly. It is not a link you can click and send e-mail from. Do you expect your users to be deciphering it? Secondly, I am sure most spam bot algorithms can decipher it by now quicker than humans.

So, here is a little more sophisticated obsfuscation which renders proper link and has been working quite well for me, so far:

Syndicate content