Apr 06, 2007
— Filled in Code
and tagged as
I just stumbled upon a short yet excellent post on Dean Edwards blog. It shows
running on IE in a secure and very short way.
Further down in the post’s comments someone named Lucky propose the use of a
Moreover Dean also shows in one of the comments how to check for the rendering
path used by IE (quirks VS strict modes)
While is not very wise to abuse the sniffing of browsers vendors it’s also true
that sometimes it’s required to split the code path in order to support the
incompatibilities among browser vendors and versions.
Mar 20, 2007
— Filled in Code
and tagged as
really powerful tool it’s quite easy to get shoot on your own feet if you are
found it lacking some modern features available in most recent versions of regex
engines used in many languages like .Net, C++ Boost, Perl, Ruby or PHP. The
feature I miss the most is the ability to use look behind assertions, with
JS just supporting look ahead ones. Another feature I miss are named groups
and then one very useful new feature is the /x modifier (also known as ignore
whitespace) which allows regular expression literals to span over multiple lines,
ignoring white space, new lines and embedded comments!
Writting it is not difficult but modifiing it or even understanding it becomes
an issue. Using the Perl /x modifier it would look like this:
Much easier to understand, isn’t it? At least I really think so. To imitate this
the regular expressions passed as arguments and returns a new one. This allows
to break a complex regex into smaller pieces and comment them.
Please note that the same thing can be done by concatenating strings manually,
however regexes syntax is terse enough without having to double escape all the
tokens. That’s why I preffer to write them out in their literal form (between
slashes) instead of using quotes.
Using the given function the above example would look like this. Note that you
can use the regexp literal notation or just pass a simple string. The last
argument can optionally pass the modifiers for the regular expression.
Been a quite long time since the last update. I’m a bit ashamed for not keeping
the blog updated regularly but I must confess that I’ve been expending my time
on other affairs more important to me.
Anyways, in this weeks I’ve been working again on TextAreaPlus, actually I’ve
been busy making a full rewrite of the lexing scanner and optimizing the
implementation to the limits of my knowledge. The algorithm used is described
in the project wiki.
Today I was re-installing the PC at work since it broke havoc yesterday. After
finishing the installation of almost all softwares I decided to have a look for
a notepad replacement which was more feature packed than Scite and a bit
faster than Notepad++ to perform some minor editing of config files mainly.
In the search I found a couple of new editors which I didn’t knew about but which
seem to be gaining momentum. Both seem to be based on a successful Mac text editor
called TextMate, which I have heard about from Ruby-on-Rails evangelists but
given my allergic reactions to anything mac related lately I didn’t check before.
Today, trying those two new editors I got interested in TextMate and I’ve been
learning about it in the last hour.
So long history short, I thought I had invented the sliced bread with my
implementation and design ideas for TextAreaPlus but it turns out that Allan
Oddgaard, the TextMate developer, already implemented it in a very similar way
a couple of years ago. My feelings are a bit conflictive right now, in one way
I feel sad because I just reinvented the wheel but in the other I feel reassured
to have come up with a solution which turns out to be proved and successful.
I’ve written a couple hundred words with a couple of links in this post using a
lame browser textarea, in moments like this I wish I had already a production
ready version of TextAreaPlus. Lets hope I don’t keep wishing for it too long.