“Learning Ext JS” Book Review

Learning Ext JS

Learning Ext JS's Book Cover

This will probably be my last book review for a while. In December I said I wanted to do some more reading up on JavaScript and I think I’ve satisfied that itch. I’ve read 3 and a half books on the topic since then and I think I’ve gained a good amount of knowledge on the language and some of its various frameworks.

This latest book was sent to me by Packt Publishing (in exchange for a review giving my opinion on the book) and covered the Ext JS framework. Its name is Learning Ext JS and its authors are Shea Frederick, Colin Ramsay, and Steve ‘Cutter’ Blades.

Ext JS is a JavaScript framework that’s known for the eye catching user interfaces that it helps you create. It’s geared toward web application development and it was originally written as an extension to the Yahoo User Interface (YUI) library. Unlike many of the other JavaScript frameworks which are offered under permissive licenses, Ext JS is only available via the GPL, a reseller license, or a commerial license.

Learning Ext JS is a good book and I enjoyed reading it. It has a similar set up to the other Packt Publishing book I read on Dojo, however, Shea and company take a little more time to explain things, which results in a longer but better quality book. I especially liked the first few chapters since the examples were easy to follow and involved a little humor. I also liked how a lot of attention was given to grid widgets (two whole chapters). This is an especially useful widget and it’s not usually obvious how to use or set them up.

As for the flow of the book, it starts off by showing you how to get Ext JS up and running and then it walks you through a small, mostly dialog-based application. After the sample app, the book proceeds with chapters that cover a particular area of the framework – Forms, Buttons/Menus/Toolbars, Grids, Layouts, Trees, Windows and Dialogs, Effects, Drag and Drop, and Data. The last two chapters of the book are on extending the framework and on some odds and ends of the framework (like various widgets created by community members).

The book is aimed web application developers who are familiar with HTML but who may not have any experience with JavaScript. However, even though the authors hold your hand through the early chapters and give an explanation of Object-Oriented Programming in one of the later chapters, this book should really only be read by people who are familiar with JavaScript. I can’t see someone without any JavaScript experience being able to tackle a framework like this.

So if you don’t have much experience with JavaScript, I’d probably pick up a book on plain old JavaScript first. However, if you’re interested in a book on Ext JS and have some JavaScript experience, I’d recommend this book. It provides a good introduction to the framework and takes you through many of its different areas.

Also, for those of you interested in a sample chapter, Packt has Chapter 7: Layouts of the book online in pdf format. Personally I think letting a user read the first and second chapter would be much more useful, but a sample chapter is better than no sample chapter.

Generating T-Shirts?

About a month ago I had an interesting idea for my Text Ascii Art Generator (TAAG) program. Though due to being busy with work and buying a house, I haven’t had time to try it out. However, the idea is applicable to almost any web service, so I thought I’d share it with you all in case someone out there was looking for a nifty way to make some extra money off of a web app or blog without posting a bunch of ads up. I’m aware that too much commercialism can kill a website, however, I think this idea is kind of clever.

Hypothetical T-Shirt

Hypothetical T-Shirt

The idea originally struck me when I was brainstorming improvement ideas for TAAG. I thought that it might be cool if the user could put their output on a t-shirt. It’d make for a really neat way for someone to show their techiness/geekiness. After deciding I liked the idea, I then wondered if the t-shirt companies had already thought about 3rd party applications creating dynamic designs for them. After some quick googling, I discovered they had.

Both Zazzle and SpreadShirt allow you to dynamically submit designs for t-shirts which you can then sell. CNN even uses SpreadShirt to sell t-shirts of recent headlines. And you’re not limited to just t-shirts, you can put your designs on all sorts of crazy products – mugs, purses, hats, buttons, mouse pads, shoes, postage stamps, posters – the list goes on.

I’m not advocating turning your web apps or blogs into online stores, but if carefully used, this could compliment their output. An online photomosaic program that would let you buy a poster of your output might be kind of cool. And web comics that would let you buy t-shirts of your favorite comics would probably do pretty well, I had a whole bunch of Far Side t-shirts when I was in middle school.

Though as I said at the start of this post, I haven’t done any of this myself yet. I talked briefly to the FIGlet creators and they were cool with the idea, however, since I didn’t create the fonts themselves I’d feel wrong selling products with other people’s artwork on them without their permission / giving them a cut, and since there are over 300 fonts, this creates a rather complicated situation. So I may not even implement this idea (I’m still thinking about it though), but I figured I’d share the general concept, since it appears it could apply nicely in certain situations.

Looking Into Ext JS

Packt Publishing, the same book publishing company that sent me the Dojo book, has offered me another free book in exchange for a review, this time on the JavaScript framework Ext JS. I don’t consider myself an expert book reviewer, however, it sounded like another a great opportunity/excuse to learn something new, so I took them up on it.

The book is titled Learning Ext JS and is written by Shea Frederick, Steve ‘Cutter’ Blades, and Colin Ramsay. So far I’ve read about 60 pages, and it’s looking like it’s going to be a pretty good book. It’s paced well and the authors seem to have a good sense of humor (they introduce Ext JS message boxes using a character from Office Space), though I still have around 190 pages left, so there’s still a long way to go.

Example Ext JS Message Box

Example Ext JS Message Box

Ext JS doesn’t appear to be too different from other JavaScript frameworks I’ve tried, though its main focus seems to be in creating slick looking web interfaces. It was originally created as an extension to the Yahoo User Interface (YUI) library, however, due to its popularity, it ended up growing into a stand alone JavaScript framework. Since it was developed with YUI in mind, it initially required YUI to be present to do the behind the scenes work. This changed over time, first with adapters being written so other frameworks (like jQuery and Prototype) could be used to do the core functionality, and then later so that Ext JS came as a complete, stand alone product. Though during this last phase they did keep the hooks in so that you could still use an adapter and have another framework to do the behind the scenes work if you wanted.

From what I’ve seen of Ext JS so far, it’s looks pretty impressive. The offical
Feed Reader and Web Desktop sample apps look especially cool. The only negative I can see, which was initially pointed out to me by Sloat, is that license for the library is the GPL. This means that apps you write using it would be under the GPL and you would have to release the code for them under the GPL. You can avoid doing this by purchasing a commercial license, though this would cost you between $289 and $18,699, depending on the license and support options you picked.

Knowing this, I probably wouldn’t write any large applications using Ext JS, unless I planned to purchased a license. However, for most of the stuff I write, I don’t mind the source code being available, so having to use the GPL is annoying but not a deal breaker. This is something you should think about before you decide to use the Ext JS library though, because this license requires that you release your source code under the GPL.

Anyway, hopefully this experience will lead me to learning a couple of new tricks and being able to create some nicer looking apps. Instead of waiting until I finish the book to do any kind of in depth work with the framework, I think I’m going to try and be a little more interactive this time and write stuff as I go. That way I don’t end up ignoring this site.

Trying Out Dojo For A Stylometry Web App

So I decided to try and build a full blown web app using the various tools Dojo provides. I wanted to try out the feed reading data store, the grid control, some of the form dijits (Dojo widgets), and the tab control. After some thought, I ended up deciding to write an application that would allow you to compare the writing styles of different blogs and see if they had the same author. This idea had been on my “backburner list” since around 2003 when I read an interesting article on the subject called “Bookish Math”.

The field of study that deals with examining artistic works to determine authorship is called Stylometry. The theory is that each of us has a unique and identifiable way of doing something. For writing, many of the newer techniques involve examining the how often we use common words. From “Bookish Math”:

“People’s unconscious use of everyday words comes out with a certain stamp,” says David Holmes, a stylometrist at the College of New Jersey in Ewing. Precisely because writers use these function words without thinking about them, they may offer more reliable fingerprints of a writer’s style than unusual words do.

“Rare words are noticeable words, which someone else might pick up or echo unconsciously,” Burrows says. “It’s much harder for someone to imitate my frequency pattern of ‘but’ and ‘in’.”

Not Really Written By Frank L. Baum

Written By Frank L. Baum?


The article goes on to talk about how frequency analysis of certain words in the “Federalist Papers” supported the idea that Madison wrote them instead of Hamilton, how an analysis on the 15th Wizard of OZ Book (billed as Frank L. Baum’s last book) revealed that it wasn’t really written by him, and how various other works can be clearly distinguished from an analysis of common words.

Since counting up common words is rather trivial, I decided to see if I could read in some blog feeds, find the frequencies of their common words, and then compare these frequencies to other blogs to see if I could determine authorship. Unfortunately, this rather naive approach didn’t come out as well as I hoped. After the app was tested, none of the numbers seemed to really stand out.

For blogs that should be similar (like this one and my livejournal), I found the common word frequencies to vary somewhat significantly. I only had overlap on around 10-20% of the words, and I wasn’t sure if that was a statistical coincidence. I also used one other person’s professional and personal blog and found similar results. I then tried to do a little original research and implemented the following alogrithm:

  • Find the frequencies of the 50 most common words in the blog’s first 1,200 words.
  • Find the frequencies of the 50 most common words in the whole document.
  • Compare the two lists and dub the words that have similar frequencies “pattern words” – words that the person seems to use with a consistent frequency.
  • Compare the “pattern words” in different blogs and see how well they overlap.

That worked a better, but I still couldn’t get completely accurate results. So the algorithm still needs a lot of work. Below you can see a small sampling of the frequency results from this blog vs my old livejournal. A frequency of 1% would mean that word makes up 1% of all of the words that were typed.

As for the Dojo side of things, I ended up really liking the slick look of the dijits. I also liked how I didn’t have to host any of the Dojo files myself, I could simply use the ones posted at the AOL Developer Network.

However, I wasn’t too happy that Dojo caused the page to take 3-4 seconds to load. And the odd sudden change from normal widgets into dijits in front of the user was kind of odd. I’m not sure if there’s a way to avoid that. This might be because I’m using a lot of Dojo tools and the Dojo library is 1.6MB gzipped. Not everything is downloaded, only what you use, but I ended up using quite a few of its tools.

Other issues I ran into were:

  • There’s a bug in the grid control that effects IE7 users. The grid text doesn’t appear in IE7 if the div containing the grid has anything other than “left” for the “text-align” style property.
  • You can’t create Dojo grids in divs that have their “display” property set to “none”. This bothered me because I originally wanted the grid containing the frequencies to “fade-in” after the user hit the “Process Data!” button.

Despite the short comings of my algorithm and some of app’s bloat, I decided to post it up anyway. You can view it here: Blog Stylometry Tool (note: I commented out the analysis side of things – so all it does is spit back a table of word frequencies)

I’ll most likely end up slimming down on the amount of Dojo that it uses to increase load time. Either that, or I’ll try and figure out a way to defer some of the load time. The majority of the loading time is coming from setting up the grid.

“Learning Dojo” Book Review

So I’ve finished reading my copy of the book Learning Dojo By Peter Svensson. It was a pretty easy read and contained a lot of good info. Overall it’s an okay book, though there are parts where it seems a little rough around the edges, however, I’ll get to why I think that in a bit.

So what is Dojo? Dojo is a free JavaScript toolkit similar to YUI and jQuery, though it bills itself as being larger in terms of features and functionality than the existing JavaScript toolkits. Visually, the widgets it provides (which Dojo refers to as Dijits) are pretty slick and easy to use. You can see a demo of many of them here (this link is unrelated to the book).

Dojo is for people who know JavaScript and who want to add more gagets to their development tool belt. Even though Dojo offers alternative ways to do certain things (like inheritance and finding elements by their ID), you can’t really use it unless you have a decent understanding of JavaScript. Well, you could, but you wouldn’t get very far.

Learning Dojo appears to be aimed at giving web developers a broad introduction on what Dojo can do. It starts off with a two chapters introducing Dojo and then follows them by having chapters dedicated to a particular area of interest – like Forms, Dijits (what Dojo calls widgets), Layouts, Ajax, etc. The author even provides the Layout chapter online as a preview for the book, it’s located here. That chapter gives a good sampling of what the author’s writing style is like.

Overall I thought the book was decent. It’s not something I’d rave about, but its a solid book and contained a lot of info and examples. I feel like it gave a nice introduction to what Dojo is and how it could be used in the real world. I found the chapter on “Data, Trees, and Grids” useful. I had been wondering about easy ways to do grids and to read RSS feeds (the book didn’t discuss RSS feed reading, but it mentioned a library that could do it), so I was pleasantly surprised to come across this info.

My only criticisms of the book were some formatting, editing and spelling issues I ran into. Around 5% of the code examples had indentation issues. The tabs would be aligned incorrectly in certain parts of the example. I’m guessing its because a mixture of space and tab characters were used. However, I don’t know, and these examples were still readable. This was mostly just an annoyance. Also, at the very end of Chapter Two, the “JSON” section had 3 small examples where the code was not printed correctly and it was unreadable. This was upsetting, though it was the only place where I encountered this.

Anyway, if you’re looking for a book on Dojo, Learning Dojo, while rough around the edges, does provide a decent introduction and contains some handy examples.

Also, like I mentioned in a previous post, I was sent this book for free by the publisher with the only condition being that I write a review of what I thought. I don’t get any money if you buy it.

And lastly, if you want to play around with Dojo, you can download it for free at their website.

2008 Is Coming To A Close…

The end of 2008 is approaching. It’s been a good year for this site. I’ve learned a bunch of new things, and the site grew significantly in its content and daily traffic.

Right now I’m enjoying the holiday, so I don’t have any new content to add, however, I figured I’d post up my patorjk.com-Related Goals for 2009:

  • Get good at JavaScript. It’s been a while since I’ve felt like I was really good at a particular language. At work, I was referred to as a “language person” by my boss several times since I seemed to be able to dive into any language they threw at me. Versatility is good, but sometimes I feel like I spread myself too thin. I could possibly get really good at Tcl, since I do a decent amount of Tcl programming at work, however, Tcl isn’t that fun of a language and it doesn’t easily do the things I would want to do (I could rant on and on about the pros and cons of Tcl, but I’ll spare you all).
  • Learn jQuery. Right now I’m learning Dojo, but I’d also like to learn jQuery, since I know my company uses and it appears to be the most popular JavaScript framework. Being familar with a couple of these frameworks is probably a good thing too.
  • Develop More Web Apps. I only released 4 total this year (not including ones that were re-done). This is well under the number I wanted to release. In the future I hope to release one a month, however, I don’t want to set myself up with an impossible goal, so I’ll just say I want to make more.
  • Read At Least 4 Programming Books. I’m going to leave 2008 having read 2 completely and 4 part way through. Books can be a great motivator and a good source of learning.
  • Join A Programming Community. I wasn’t able to relaunch the patorjk.com forums this year, however, I do still miss the community of the old forums.
  • Write A WordPress Plug-In. WordPress is the name of the blogging software I use. I’ve played around with it a bit, but I haven’t really tried writing my own plug-in.
  • Release Some Programming Examples. It’s been too long since I released one.

It’s 3:30AM right now, so there may be a few I’m missing, but I think those sum up my mind set right now. Professionally I think I’d like to get back into .NET programming (I miss VB, but for a hobby, I want to stay focused on something, and right now I’m more into web programming than I am into Desktop apps). However, I have no idea what I’ll be doing this next year or even how much I’ll be able to say about it.

2009 year should also be a big year for me personally. Right now I’m looking for a house with my girl friend, so I’m really excited about that. Also, my awful case of tinnitus (constant ringing in the ears) has gone down by about 75%-90% thanks to my switching toothpastes from one that contained Potassium Nitrate to one that didn’t (sensitive toothpastes typically have Potassium Nitrate), and I think it may go completely away. If you know anyone with tinnitus, be sure to pass on this bit of info.

Anyway, I hope you all are having a happy and safe holiday and I hope you keep checking back in!

The Dojo Toolkit… Hrm…

A few days after I posted my previous entry on the JavaScript books I was reading, I got an email from a book publishing company asking if I was interested in a free review copy of their latest JavaScript book. I was a little skeptical at first, however, after a brief chat, the only string attached was that I write blog entry on what I thought of the book. This seemed like a fair deal, so I decided to take them up on it.

Since I’m getting something for free, I figured the honest thing to do would be to open about it so people don’t think my opinions are biased, since I do tend to gush about stuff I like (YUI, Google Alerts, etc.). When I don’t like something, I usually just don’t write about it. However, if this book ends up sucking, I will be brutally honest about how much it sucks. Though based strictly on chapter 1, the book appears as if it will be a pretty decent read.

Anyway, the topic of the book is The Dojo Toolkit. Dojo is a free open source JavaScript library that provides a number of widgets and utilities, much like jQuery and YUI. Right now I’m unsure of how it compares to these other frameworks, but it looks very promising based on what I’ve seen so far from various Dojo websites. The charting package looked particularly interesting.

Hopefully I’ll learn a lot of cool stuff about Dojo. I wont pretend to be a JavaScript expert, so the review I’ll write will most likely be in the same style as my last review – though probably a bit more thorough. For those of you who are curious, the book is called “Learning Dojo” (that’s the book’s actual website, this is not a sponsored link and I don’t get anything if you buy the book – not that you shouldn’t buy it, I just want to be clear since that page is mostly about buying the book).

After I finish this new book I’m going to get back to my JavaScript Design Patterns book (which it’s really good so far – though I’d only recommend it to hardcore JavaScript developers). And after that I’m going to get back to writing stuff for this site. Hopefully all of this reading will pay off with some nicer apps, tutorials, and programming examples.

Reading Up On Javascript

Shortly after finishing the beta version of my Typing Speed Test I started to feel like my knowledge of Javascript had some holes in it, especially in the event handling area. It’d been a long time since I’d read a book on Javascript, so I figured I’d pick one up one to help fill in the holes in what I knew.

I looked around a little bit before selecting “ppk on Javascript”. I chose this book after reading some of the author’s online articles. They were easy to read and contained a lot of interesting tidbits. I don’t want to turn this entry into a book review, so I’ll just say I enjoyed the book and would recommend it. However, the book admittedly doesn’t cover certain topics like OOP in Javascript. Though even with its omissions, it still ended up covering a lot of ground. The major things I took away from the book were:

  • Event Bubbling vs Event Capturing – I feel bad I didn’t know about this. It answers the question: If an element and one of its ancestors have an event handler for the same event, which one fires first?
  • location.href vs location.replace – It’s best to use “replace”. This is because replace doesn’t create a new history entry in the visitor’s browser. This is a good thing, since you don’t want to make a user’s back button useless.
  • The navigator.userAgent string has an amusing story behind why its value is so convoluted.
  • getElementsByTagName – I didn’t know about this DOM function. It looks like it could be really useful though.
  • DOM Tree Text Nodes – When you create an HTML document, the text between tags and the text inside of a particular tag become text nodes. IE doesn’t support empty text nodes while other browsers do, this appears to make modifying the DOM tree a pain.

There were other things too, but those are what stick out in my head while I type this. I’m really glad I read that book. It reminded me of how useful programming books are (I had gotten too use to just Googling whatever I didn’t know).

Right now I’m a little more than 50 pages into “Pro Javascript Design Patterns”, which covers design patterns and OOP in Javascript. So far it’s really good. I had been meaning to read up on design patterns for a while so I’m pretty excited about this new book. I’m averaging almost 20 pages a night, so I should finish up pretty quickly. Once I finish, I’m going to get back to creating content for this site. I may make some posts in the meantime, but I figured I’d give you all a heads up as to what I was doing so you didn’t think I had forgotten about this site.

Scaling Back Ads

I figured I’d announce that I’ve decided to scale back the ads on this web site. Something about putting ads on this blog has always felt a little odd to me. The extra revenue is nice, but I’m not sure its actually worth the commercialization ads bring.

There are still two ads on the site, the Google Custom Search box on this blog’s sidebar, and an ad on the Text Ascii Art Generator (TAAG). The search box is actually functionally useful and the ad on TAAG will still allow a little bit of change to trickle into the site. I don’t plan on adding any more ads until I need to upgrade hosting services.

Part of me wanted to justify my decision with the idea that “ads turn away visitors”, so I decided to make a chart pitting TAAG (which has an ad) and against the VB Array Tutorial (which doesn’t have any ads). Surprisingly, it appears that the ad on on TAAG didn’t have a noticeable negative impact on the number of visitors it received:

This might be like comparing apples to oranges, since both pages probably appeal to a different group of people. However, TAAG’s ad was added in April, so if it bothered visitors I’d expect its growth to go down after April, but instead it seems to have continued on with the normal growth of this site (the spike in June is due to it being popular on StumbleUpon for a few days). This doesn’t change my opinion on removing ads from the blog, I still feel they add an unwanted commercial element to a personal outlet, however, I figured I’d post up this chart for those of you interested in how ads may/may not effect site growth.

Live.com’s linkfromdomain Operator

Most people are pretty familiar with Google’s Advanced Search Operators. You can use them to more preciously search for web pages or particular data. Anyway, earlier today I discovered that Microsoft’s search engine, live.com, has an amusingly useful search operator that Google doesn’t have. It’s called linkfromdomain. Now, this isn’t new news. I did some Googling and the operator has been around since late 2006, however, since not very many people use live.com, I figured some of you might find this info useful.

The linkfromdomain operator allows you to search the websites that a particular website links to. For example, if you search for “linkfromdomain:patorjk.com“, you’d get a list of all of the sites I link to throughout this website. At first glance this may not seem that useful, however, it allows you to ask some interesting questions as an individual and as a webmaster. Here are some examples:

I don’t think Google currently has the ability to answer any of those questions, which is a little surprising. Anyway, there are probably lots of other neat questions you can form using the linkfromdomain operator. It’s definitely something to keep in mind when you’re surfing the web.