Archive for the 'Javascript' Category

A short update

I’m not doing so hot at updating this blog regularly, am I. :) School’s keeping me busy (seems like I say that a lot) but I’ll try to figure out a focus, something that’ll get me writing. (And be interesting to read.)

In the meantime, I think I want to master regular expressions next. I’m familiar with them and have used them often, but there’s a lot of power in them there regexes. In other news, I’ll be coding a family website in Rails over the next few months. It’ll be a good testing ground for my Beyond work. And at work, it looks like this web app I’m working on will be almost all Javascript. Not what I expected, but I’d much rather work in Javascript than ASP.NET. :)

Goodbye, OpenLaszlo

After a month of OpenLaszlo, I’ve had enough. Coding in XML just isn’t my style, I’m afraid. (And yes, I know you do half the coding in JavaScript, but that doesn’t change anything.) I don’t think that means XML-based programming languages are inferior or anything like that — if I spent more time wrapping my head around OpenLaszlo, I could probably feel better about it (or I’d have one heck of a sore head). But I don’t have that kind of time. Nor was I getting enough of a “coolness” factor, the way I do when I work with Lisp. This experiment leads me to suspect that I probably wouldn’t like Flex much, either.

So, I’m going back to the basics. Simplicity is good, and so I’ve taken the app I’m working on and pared it down as far as possible. So far, in fact, that I’m pretty sure I’ll be able to do the whole thing with Javascript, HTML, and CSS, with a web service providing a connection to the server (written in ASP.NET most likely, though I’d prefer Python and may end up going that route), and anything else in Python. I might use MochiKit or Dojo to make the Javascript end easier to code, but I’m not sure yet if I really need it. (Why not Rails? Well, the server is unfortunately a Windows box running IIS, and I’ve heard that Rails doesn’t perform all that well on IIS. I wish I could get the server moved to Linux, but that’s probably not going to happen anytime soon. In the meantime, Python is still very nice to work with, and I haven’t caught wind of any performance issues with it on IIS.)

At any rate, this stack feels a lot better. When I was working with OpenLaszlo, I felt like I was in a straitjacket. Not much fun. Or “open.” (Again, keep in mind that these are subjective impressions; who knows, maybe OpenLaszlo is your style.)

In the meantime, I’m reading Paul Graham’s ANSI Common Lisp and liking it.

OpenLaszlo

I’ve been tinkering around a bit with OpenLaszlo, since here at work I’m about to start writing an RIA for doing online extraction of genealogical records, and it would be really nice not to have to re-invent the wheel. :) The advantages of OpenLaszlo are that it’s free, it compiles to Flash (which is on pretty much every computer out there) and soon DHTML, and it looks like it’s conducive to fast development. And there are a lot of high-profile apps using it (like Pandora).

So I spent half an hour throwing together a quick prototype of our app — no functionality, just the layout — and I think I’m liking it. It’s basically XML with a healthy dose of Javascript. Using XML this way feels almost like Lisp somehow, incidentally. :) So far I haven’t run into any huge roadblocks, so we’ll see if OpenLaszlo works for what I need.

First steps in Javascript

I haven’t been in much of a coding mood lately, thus the scarcity of posts. But I think that’s changing. Today I made my initial foray into Javascript coding. At work we’re porting our genealogy extraction software to the web, so I’m writing some code to manage the thumbnails. Right now I’m not using any extra Javascript libraries (Prototype or Dojo or whatnot), because I want to get a feel for what plain Javascript is like. Then I can actually appreciate the benefits of the other libraries. :)

My first impression is that Javascript is actually pretty fun to code. Easy, too. I should’ve started learning it years ago…

Back to the thumbnails, the next step is to implement a draggable preview. On top of the thumbnail image we overlay a slightly transparent rectangle showing which part of the image is in the viewport. The user can draw a new rectangle on the thumbnail, which then moves the viewport to show that part of the image. Kind of like the rubberband select in fluxiom. I’ve got to figure out how they did that…

Come to think of it, though, I wonder if this thumbnail navigation is even useful. I don’t think I would ever actually use it — the normal navigation via the main viewport would be enough (along with keyboard shortcuts). The thumbnails would mainly be useful for choosing which image shows up.

Well, enough thinking aloud. :) It’s been forever since I did anything with Ruby or Rails, and that needs to change. Finals are this coming Wednesday and Thursday, so life’ll be a little hectic, but then I’m done with classes till September. ~sigh of relief~

Update: I forgot to mention how incredibly helpful Firebug has been so far. In fact, I can’t imagine what web coding would be like without it. Seriously.

Storage and Javascript

From Software As She’s Developed, I came across Wanted: Massive Local Storage this morning:

Local storage - beyond 2KB cookies - is now a step closer with the latest Firefox effort…. The fantastic thing is Brad Neuberg’s Dojo work means we can code independently of the local storage mechanism. Since IE also has local storage, as well as Flash, most bases are covered, or soon will be: Anyone with EITHER IE or Firefox or Flash will have local storage. (Incidentally, we had a discussion in the comments on Ajaxian about the possibility of S3 and other remote bindings as well, which I’m guessing Brad will implement at some point.)

Quite interesting — I’ll have to look more into this…

As for Dojo, I browsed through the website and I get the feeling that I’d prefer Prototype+script.aculo.us. (But then again I haven’t actually coded in any of them yet, so this is based more on an extremely superficial glance.)

Having said that, I googled “dojo prototype scriptaculous” and found Jon Aquino’s comparison:

Prototype is more of a Porsche, whereas Dojo is more like a Hummer. Prototype is pure programming bliss (feels very much like Ruby), whereas Dojo is very much engineered (feels like Java) — possibly a little overengineered in some places (IFrame-based workarounds) in order to offer what no other toolkit offers (asynchronous file uploads; AJAX back-button handling; javascript “include” mechanism).

From Jon Tirsen’s comment on “Dojo or Prototype or …?”:

Prototype+script.aculo.us is really the way to go for Rails apps. Prototype makes JavaScript look more like Ruby (without loosing the essence of JavaScript itself) and script.aculo.us goes hand in hand with the convention over configuration/sensible defaults philosophy of Rails.

Dojo is interesting but quite frankly I think it’s slightly over-designed. There’s a significant learning-curve associated with it where as you can use script.aculo.us completely out of the box and get results really fast.

And finally, from Raible Designs:

I really like the idea behind both projects, but I can’t help but think Script.aculo.us is a little better. Why? Because its creator is a designer (vs. a developer) and its development is driven by one of the most popular web frameworks and it was built from a real-world application rather than a consolidation of libraries.

I think I’ll stick with Prototype+script.aculo.us. :) (I’m not a big fan of overengineered projects, nor do I like Java very much. Ruby is the way to go, and if it feels like Ruby, that’s what I want.) Even just comparing the script.aculo.us website to the Dojo website, script.aculo.us comes across better.

Now to start coding so I can base my choice on more than just surface skimmings…