Google Chrome is here!

That’s right, the new browser from Google is here! I’ve only been playing with it for a couple of minutes now but I can already tell that it’s damn fast! The Javascript Console seems good, no bugs whatsoever so far…  Grab it here: http://www.google.com/chrome 

HighlightMyCode - Syntax Highlighting on-the-fly!

I just finished a new project called HighlightMyCode. The goal is simple: to provide Syntax highlighting for your code snippets on the fly. Just paste your code, select a language and a theme and you’re done. You’ll get a small piece of javascript to embedded your highlighted snippet on your site.

It’s basically the same idea as a Pastebin, but with emphasis on Syntax Highlighting (right now there are 4 themes available, and it’s easy to submit new ones).

The site is powered by GeSHI for syntax highlighting and uses Boilerplate, a tiny CSS framework, for it’s template.

Here’s a demo:

Give it a try! It’s fun: http://www.highlightmycode.com

SilverIPE: A lightweight, cross-browser In Place Editor

I just finished the first version of SilverIPE, a lightweight, cross-browser in place editor. Some of it’s features include:

  • Cross-Browser (Tested with IE 5,6&7 - Firefox 2&3 - Safari 2&3 - Opera)
  • No dependencies. Only 1 javascript file to include, that’s it
  • Easy to use
  • Well documented

The documentation, examples etc. can be found on the SilverIPE’s page. If you have any question or comment, please leave them here for now…

Visit SilverIPE’s Page

Off Topic: Pitchfork Media reviews archive?

Well this is completely off-topic, but it’s something that’s been bugging me for a while now. I check Pitchfork Media every once in a while to discover new bands… I rarely read their reviews as I don’t really like their style (imho you shouldn’t put too much thinking into a review… just tell us what you thought of the album… no need for metaphors and poetic allegories) anyway, I do happen to find a lot of the stuff that they review good so, I keep checking back every now and then to see what’s new…

Now maybe I’m just crazy (or blind) but I could swear there was a link at the bottom of their review page that lead to more reviews… (the link was just labeled “More…” ). Now I’ve been searching for like half an hour (in vain) for a way to access older reviews… Same goes for the Best New Music section.

I’m aware that I can still use the search to find reviews… but to me it’s kind of pointless… I don’t want to read reviews about bands/albums that I already know… if I love an album, a 2.0 rating from pitchfork isn’t going to make me hate a record… (just like a good review of an album that I hate isn’t going to change my mind…). What I liked about pitchfork was basically just browsing through their archive, chronologically, so I can discover new bands that  recently released an album.

I remember seeing the word “more” in the URL when I was browsing the archive so I gave it a try ( http://www.pitchforkmedia.com/page/record_reviews/more ) but apparently this leads to what seems to be one of their first review page… (with reviews dating from 95-96… ). While I did enjoy reading some those old reviews (Beck Odelay, Smashing Pumpkins, Weezer etc..), it’s not really what I was looking for…

So please anyone let me know if I’m missing something obvious… HOW THE HELL DO I BROWSE THE REVIEWS ARCHIVE BY DATE (from recent to old)… and WHERE IS THAT CONVENIENT “more…” LINK… the one that used to be at the bottom of both the Review pages but also the Best New Music pages…

Can’t believe that it just dissapeared and no one mentioned it (I searched google, blogs etc. for any word about that but couldn’t find anything… am I really crazy?? Did that “more..” link ever existed??)

SilverAjax: Because the world needs more XMLHttpRequest wrappers…

Well, I decided to put together my own XMLHttpRequest wrapper. Not because we don’t have enough choice already but mostly because:

  • I needed some Javascript practice (without using a framework like mootools)
  • I wanted to learn more about the XMLHttpRequest object
  • I love mootools and prototype’s XMLHttpRequest wrapper and wanted something similar without having to use a whole framework
  • I was bored
  • The current star alignment told me to do so

It’s still an early draft but so far it features:

  • Support for most browsers (Firefox 2&3, IE 5, 6 & 7, Opera, Safari 2 & 3)
  • The ability to securely evaluate JSON responses
  • POST and GET requests
  • Timeout
  • Pseudo-Events (i.e. you can provide callbacks for onComplete, onSuccess, onFailure and onTimeout)
  • Add/Remove custom headers
  • Update any element with the response text

The code, partial documentation and more can be found at my wikidot:
http://silverscripting.wikidot.com/silverajax

A demo will follow shortly…

IE’s Function.apply() doesn’t like null

Well, after trying to find what the problem was with my script (it was working well in Firefox, but not in IE, sounds familiar??) I realized that Internet Explorer doesn’t like null to be passed as the second parameter to Function.apply…

According to Mozilla’s documentation, the second parameter to Function.apply should be:

An argument array for the object, specifying the arguments with which fun should be called, or null or undefined if no arguments should be provided to the function.

Since I was using apply only to bind this I decided to pass null as the second parameter… apparently IE doesn’t like that… After a bit of searching I found out that with IE, if you want to use Function.apply and not pass any parameter, you should just omit the second parameter or else IE will throw a “TypeError” if your parameter is not an array. So basically just use:

myfunction.apply(this);

Instead of:

myfunction.apply(this, null);

It will work in Mozilla since, as they mention in their doc, the second argument can be null or undefined so… all is well, and everyone is happy!…

Programming Fonts

Well, I know it’s been done before, more than once, but why not do it again! Programming fonts… a topic worth revisiting.

So 2 days ago I decided it was time for a new font and, it seems that each time I do that, I waste a whole day trying out different ones, at different size, without ever being completely satisfied.

Finding a suitable font can really depend on what platform or even which editor your are using. Mac OS X’s font rendering looks quite different than Window’s ClearType, some think that OS  X fonts are too blurry, and I gotta admit that before I had to spend some time on a Mac, I was of that opinion. After a while though, I got used to it, to the point that I can say that Monaco in Textmate is one of my favorite font/editor combo…Unfortunately, anyone who tried Monaco with Windows editors (E Text Editor or Intype) will quickly realize that, without the “blurry”, bolder OS X rendering, it really doesn’t have that same impact.

Monaco

That being said, I spend most of my time developing in Windows, and Monaco is different to the point that I don’t really like it with ClearType.

There are several options, depending on what is important to you… for some, the ultimate criteria for a programming font is to fit as much text as possible on the screen, while still being readable. For that purpose, bitmap fonts are the best option. There are a bunch of good, free ones out there and here is a brief list of the most popular one:

As I said, Bitmap fonts are particularly effective if you want to have as much text as possible on your screen since they look their best at small (sometimes tiny) points (9pt, 8pt… sometimes even 7pt) and are still easy to read.

Personally, I don’t really mind having a font that can display 50 lines instead of 72 if I like that font better. I don’t mind having to use the scrollbar or the incremental search, which is why I prefer traditional (i.e. non-bitmap) monospace fonts. Again, there are a bunch of options in this category and I’m only going to list a few (mostly those that I’ve tried). They are somehow in a preference order, the top ones being the ones I like the most…

  • Envy Code R I tried that one before and although I liked it, I thought the coma “,” and the dot “.” were too similar. Well this has been fixed in the latest release (Preview 7) and it is now my main programming font. It reminds me of Pragmata (which I LOVE) but it’s free! It looks good no matter the size but personally I think it looks its best at 10pt.
  • Consolas is a very popular choice and it’s easy to understand why. The font looks gorgeous, it’s very easy to read, it works well with ClearType and it has some style too!I really love the double-loop “g” (I know that most people prefer a single loop). I still switch to Consolas every once in a while.
  • Pragmata is also one of my favorite, but I can’t really say that I love to work with it since I never bought it, so I can only judge from what I see on the site.Unfortunately I find the price to be a bit steep (although I know that quality fonts usually come with a high price tag). I just think that with all the free options available, you really need to have something special to charge 90euro for a programming font.
  • Another great one is Anonymous, a free TrueType version of Anonymous 9 (a Mac font). I love the style and personality of Anonymous and I use it from time to time, however, it is a bit different than what I am used to.
  • A lot of people like Inconsolata, released under the Open Font License (OFL), it is inspired by Consolas and TheSans (both from genious type designer Luc(as) de Groot). Although I love Inconsolata and used it for a while on XP, I always found it to be kind of blurry with ClearType turned on. I think it has been fixed in the latest versions though and if that’s the case, Inconsolata would definitely be among my favorite fonts.
  • Of course it’s impossible to forget Bitstream Vera Sans Mono (or the extended version DejaVu Sans Mono). If I’m on Linux, it is my font of choice for programming. They are easy on the eye, they look good for a monospace font and they are both free and available on most linux distribution nowadays.
  • Another interesting free/open alternative is LuxiMono, originally designed as an X Window System, but I think it hasn’t been updated in a while (unless I’m mistaken..?)
  • Finally, it’s impossible to write about programming fonts without mentioning Courier/Courier New. It’s available on any windows installation and it will usually be the default monospace font in a lot of Windows editors. Personally I don’t like coding with a serif font so I usually avoid it but a lot of people still swear by it.

So, to sum it up. Right now I am switching between Envy Code R and Consolas when on Windows. On a Mac I use Monaco as I think it looks gorgeous with OS X’s font rendering. When on Linux, I use Vera Sans Mono or DejaVu Sans Mono. As for the size, I usually switch between 10pt and 11pt, depending on the editor/font/OS…

I’m sure there are a lot more great programming fonts and I would love to hear people’s opinion about that as I always love to try out new ones!

Mootools 1.2 Upgrade Reference

I started to put together a (long) list of changes between MooTools 1.1(1) and MooTools 1.2. Hopefully this will help people porting their script to the new MooTools version.

Personally I think that nothing beats spending an hour or two reading the new documentation but apparently some people don’t have the patience to do it! :P For those people, check it out, it’s still incomplete and it will probably take a while to cover everything but hey, it’s a start!

The list can be found here: http://silverscripting.wikidot.com/mootools-upgrade:from-1-1-to-1-2

It’s a wiki page so people can contribute to it too… (please do…)

MooSlides: Sliding panels for mootools 1.2

Well I just finished a first working versions of mooslides, a sliding panel widget for mootools. It was inspired by all those sites (gamespot, tv.com etc.) using flash sliding panel widgets. I’m pretty sure a similar widget already exists for mootools, haven’t looked actually, but eh it had been a while since I had some fun with mootools and I wanted to try out the new 1.2 version.

An example can be seen here:
http://www.silverscripting.com/mooslides/test.html

This one is using images but you can pretty much put anything you want in the panels (images, text, form etc.).

The full documentation, download and more info at:
http://silverscripting.wikidot.com/mooslides

NAWTE0.4: Finally! MooTools1.2 compatibility…

Well I’m pretty much done porting nawte to MooTools1.2… I still haven’t updated nawte’s main site, but the latest source can be grabbed at nawte’s git repository located at http://github.com/SilverTab/nawte/. If you are not familiar with git, you can just browse the source and grab it from there…

Besides 1.2 compatibility there’s also one small change. I merged the insertBefore and insertAfter functions to create the insert function which takes a where parameter (eighter before or after).

The site and the doc should get updated soon…