ASP: VBScript vs. JScript

The fight is on!

No, ok, really it's not. I have yet to find many ASP developers who use server side JScript. Which sucks for them, because, you guessed it, VBScript is just about the most horrific language to work with if you actually want to do anything other than spit something out onto a page.

Ok, maybe that's a bit harsh. Let's just say I don't really enjoy working with VBScript (or VB, for that matter). I'll let you come to your agreements with your VB-loving self.

I do have a point. Stick with me. (Ever notice I say that a lot? Most people think it's the ADD. Me, I think it's the ADD, to hell with what everyone else thinks. Though it could just be senility. Or Mad Cow.)

Anyhow.

One of the cooler things about (classic) ASP is the ability to utilize multiple languages within a single page. Which means you can write classes and shtuff in JScript, include them (or inline them), and use VB in the body of the page, calling the classes, functions, and variables you wrote in JScript from the VB portion of the pages. Once of the interesting things about doing this (and, actually, a rather large caveat) is that all the JScript on the page is executed first, then the page is handed off the VB engine.

Why's that interesting? Well, imagine you have a simple page like so:

  1. <html>
  2.         <head>
  3.                 <title>Fun with ASP, JScript and VBScript</title>
  4.         </head>
  5.         <body>
  6.                 <%
  7.                         myNumber = 5
  8.                         Response.Write( "<!-- Hello from the land of the Ebil VBScript -->" )
  9.                 %>
  10.                
  11.                 <script language="javascript" runat="server">
  12.                         myNumber = 10;
  13.                         Response.Write( "< !" + "--Hello from the land of the Server Side Javascript --" + ">" );
  14.                 </script>
  15.                
  16.                 The value of myNumber is: <%= myNumber %>
  17.         </body>
  18. </html>

(Note that wordpress seems to want to sanitize my code above - there are some additional spaces on some of the server side tags)

So, what do you think the value of myNumber is when it gets spit out to the page? If you payed attention above, you'll get it right.

That's right. The value of myNumber is 5.

Try executing that on a Windows server somewhere. Or you can view the output here. You'll note that the JScript comment is right at the top of the page output (view source, baby), not inline in the page as the VBScript comment is.

Eeenteresting.

Stay tuned. I'll be back tomorrow with some of the ways this can be uber useful.

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati

MOD Gets a Mod

MOD Remodded Big release at work today - we launched the reskinned/refunctionaled/re-wickeded MuchOnDemand section of MuchMusic.com earlier today. It was a fun and wild ride, and I'm uber glad to have been involved with the awesome and incredible team that put it together (you know who you are, of course - I'd name names but I'm notorious for missing people). It was a really fun project to work on, though stressful (granted, practically everything has a wee bit more stress when you're hooked to a live TV show, but nevertheless...).

I'd love to hear some feedback from the 4 people who read my blog (and don't work with me). Consider that solicitation of the commenting kind. Look, I'm not going to beg you. Just click the links and post some feedback. Is that so much to ask?

Check it out @ muchmusic.com/mod/

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati

Last.fm is a kick in the head

Wow. I hadn't realized quite how much Theory of a Deadman I'd been listening to recently until I pulled this up on a Google. I suppose I could have just logged into my Last.fm account, but, hey...life wouldn't be as much if there weren't all these little things we don't think of that just kind of happen and then...

Well, anyway, I've been on a roll lately, and I'd have to thank the Theorists noted above, because, to be fair, they're practically all I've been listening to.

And, no, that's not sad. They rock like ... rockers. Definitely music to program to.

Have a look at what I'm listening to @ last.fm/user/flashobject/.

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati

Flashers: Protect Yourself From the Evil IE ActiveX Update!

By now, you've all heard about the Eolas Patent suit against ye ol' Microsoft Corp. And by "by now" I mean a long time ago (unless, of course, you've been living under a rock or otherwise have little to no interest in that thing we all affectionately call the InterWeb). And you are, of course, shaking in your wifi-enabled loafers, wondering just how you will deal with the utter catastrophe that Microsoft's IE Update will cause when it's released. Nothing like a good bit of FUD with your morning coffee.

Now, I don't seek to take sides on the underlying issue. Personally, I think it's more or less a load of crap, but apparently some judges don't agree with me (go figure, right?). Microsoft, however, are playing the CYA game (which makes a boatload of sense), and you probably think you're going to be the one that pays the price. Or, rather, your users. Because now they won't be able to immediately interact with your Flash/Quicktime/Windows Media/etc content without clicking into it first.

Say it ain't so, broth-uhs and sist-uhs!

Verily, it ain't so.
(more...)

Share me: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Technorati