Oct
27
Hidden JavaScript
Filed Under Software Development, Computers & Tech on October 27, 2006 | 2 Comments
This is the long over-due follow-up article to JavaScript – Much more than Java’s Mini-Me which I want to get published now because I’ve just started another JS article that I think needs to come after this article. I want to finish evangelizing the good things about the JS language before I take a look at JS’s dark under-belly. The next article has the working title JavaScript and AJAX on the Web – a Liability? and should be out within a week (at least that’s the plan).
In my previous JS article I discussed fundamental language features that JS has that give it the ability to do things many other languages just can’t. These features give the programmer extra tools that the common high-level languages like Java just don’t have. In this article I won’t be looking at anything as earth-shattering as that, I’ll just be looking at some nice features JS has that tend to get over-looked by JS programmers.
[tags]JavaScript, JS[/tags]
Aug
5
JavaScript – Much more than Java’s Mini-Me
Filed Under Software Development, Computers & Tech on August 5, 2006 | 3 Comments
Something that has annoyed me for a long time is that JavaScript is looked on by many people as just being a stripped down version of Java. You take Java, you take out most of the features and you get JS. This is completely wrong. The two are two completely different languages which follow different paradigms. One is Hard Typed and Object Oriented, the Other is Loosely Typed and Object Based. To give you an idea of just how different the languages are I would say that Java is to JavaScript like C/C++ is to Perl. I.e. they are completely different languages in just about every respect but their syntax is superficially similar.
Far from being a stripped down version of Java, JS is in many ways a more powerful language and is certainly more feature-rich. And I’m not talking about little conveniences that make programming a little easier but major features that make some things all but impossible to do with Java but which JS does simply and naturally. In this article I’m going to look at some of these features. While I was writing this article, I came up with many less dramatic advantages which JS has over Java, which just make things easier with JS. Initially I had also included those in this article but they made it too long for the modern attention span. Instead, I’m compiling them into a separate article with the working title Hidden JS which I hope to publish within the next week or so. The inspiration for this article was a post by Joel Spolsky entitled Can your programming language do this? which details one of the advantages JS has over Java.
May
3
Dashboard Widgets for Web Monkeys
Filed Under Computers & Tech, Software Development on May 3, 2006 | Leave a Comment
Following on from my recent post on Dashboard Widgets for Techies, this post previews some nice dashboard widgets for Web Developers.
Regular Expressions
We’ll start with what I consider to be the most powerful widget, the regular expression widget. Regardless of what web language you end up using and what you are doing the chances are that you will need to validate user-input and that you will need to use regular expressions to do it. There are a number of Widgets for testing regular expressions out there but of all the ones I’ve tried the RegexToolbox was by far the best. It allows you to set up a list of test cases and then match an RE off them and it tells you what it matches as well as all the matches within bracketed groups. It also allows you to test substitutions.
Technical References
It’s often handy to have the full spec for things at your fingertips and the Dashboard is about as ‘at your fingertips’ as things get so it makes sense to have some API specs in Widget form.
I know I hate PHP but I still have to use it quite a bit and I know a lot of other people do too so a PHP reference widget is still very useful. There are quite a few different ones but the one I found to be the best is this one: www.apple.com/downloads/dashboard/developer/phpfunctionreference.html.
Another somewhat useful widget is the Tags – CSS widget. It sounds great and gives you a nice interface for searching for what CSS attributes there are but sadly if doesn’t give you the possible values for those attributes which is very annoying. A similarly disappointing widget is Tags – HTML.
Colour Tools
Easy access to the web-safe colour pallet is something that sounds very useful and hence you’d think there would be a very good widget for it but you’d be wrong. There are indeed many colour widgets but no very good ones. Color Safe is the best of a bad lot but it’s not perfect. I’m quite tempted to write my own Widget for this though.
Apr
22
Developing My First Dashboard Widget – Unix Time Stamp Converter
Filed Under My Projects, Software Development, Computers & Tech on April 22, 2006 | 3 Comments
I recently did a post on Dashboard Widgets for techies and am working on another about Dashboard Widgets for developers. There was one important widget missing from my list of widgets for techies, one for converting Unix Time Stamps to human readable dates and vica-versa. The reason it was missing was because I couldn’t find one anywhere on the Apple site! I find this strange because I regularly need to deal with Unix Time Stamps in things like logfiles and raw data in Databases, hence I’d have expected others to need this too and hence for there to be a widget for it. Well, I decided to remedy this omission by writing my own Widget which I’ve now submitted to Apple for addition to their Widget Downloads Page. I’ve decided to release it as GPL so you can get it on the downloads page of my home page.
So, how easy was it to develop my first widget? Trivial! I went from deciding to write the widget to a fully working first implementation in about 2 hours including all reading and experimenting that I had to do to get started. IMO that’s not bad at all, in fact I can’t think of any other platform I’ve ever used where I was able to do something useful as quickly.
So, what’s involved in writing a Dashbaord Widget? TBH very little. If you are up to speed with client-side web technologies then you’ve pretty much got everything you need. Yes, there are some extensions to these technologies involved to allow you to interact with the OS and the command-line and also for 2D graphics with Quartz if you want to get fancy but they are very easy to get to grips with and there are some excellent guides on Apple’s Developer Site.
A Dashbaord Widget is basically a web page written in XHTML that is skinned with CSS and made interactive with JavaScript. There really is nothing more to it than that. If you want to give this a go yourself the links below are all you’ll need.
- Apple’s Dashboard Developers Page
- Apple’s Dashboard Programming Guide
- Apple’s help topic on getting your Widget to flip
As I said I had a fully functional Widget in two hours, took me a little longer to get it to do cool stuff like flipping round to show the credits on the reverse side and getting it skinned in a way I was happy with but all in all that Widget was no more than 5 hours work including all the fiddly graphics and layout stuff. A screenshot of the finished product can be seen below.