Read my book

I wrote books about Webpack and React. Check them out!

Sunday, September 26, 2010

PromoteJS! - Let's make it easier to find proper JavaScript documentation

JavaScript JS Documentation: JS String lastIndexOf, JavaScript String lastIndexOf, JS String .lastIndexOf, JavaScript String .lastIndexOf

I just came by this interesting initiative that aims to increase awareness of proper JavaScript documentation. There's a lot of material out there and not all of it is that good. This campaign hopefully boosts the findability of proper material (click the image for an example).

You can find more information about the campaign at promotejs should you want to plug it. :)

Tuesday, September 21, 2010

Crude Painting Application in RightJS

I just came up with a crude little HTML5 canvas based painting application using RightJS. Instead of boring you with some blabber let's just dive into implementation and figure out how the thing works. Here's some code then:



My initial implementation was considerably shorter as you can see from the revision history at GitHub. In this version I separated painting related functionality to a plugin of its own. In addition I extended RightJS with a offset function that returns the location of mouse relative to the element (canvas in this case).

If you have used canvas before the painting code probably looks quite trivial. It probably would make sense to abstract painting a bit but I guess that would be overkill in this case.

The initial code should provide a nice basis for further exploration. It might be nice to hook up a color or size selector with the code. There are certainly a lot of ways to extend it. :)

Book Review - JavaScript Testing Beginner's Guide

Disclaimer: I received a digital review copy of this book from the publisher, Packt Publishing.
This time I will be taking a look at "JavaScript Testing Beginner's Guide" by Liang Yuxian Eugene. As can be inferred from the title, the book is a part of Packt's "for beginners" series. In this case this means you can pretty much dive in without any specific JavaScript or testing related knowledge. The examples are explained with quite a bit of detail.

Monday, September 20, 2010

Sidebar in RightJS

I came by RightJS, a JavaScript framework, during the last week. The project just reached an important milestone as version 2.0 was released earlier today. Those familiar with jQuery will probably be able to pick up the library fast. Compared to jQuery RightJS provides some additional functionality (classes, utilities) and syntactic sugar. So far I have liked it!

As an experiment I decided to implement a simple sidebar using the library. The basic idea is that a sidebar contains a main area and a handle. Clicking the handle either opens or closes the sidebar depending on its current status.

It's possible to vary this behavior in various ways (ie. by making the handle draggable) but just this simple case is enough to demonstrate the usage of library. Let's have a look at the code then:


Most of the code probably looks quite straightforward if you have used jQuery before. It's just a matter of selecting appropriate element, assigning an event handler to it and then animating it a little bit. To keep it simple I separated the "toggle" behavior to a generator.

I am aware that JS 1.7 contains support for. That's something I'm not willing to count on, however, so I ended up implementing a small class encapsulating the idea.

The example isn't probably enough to actually convince someone to check out the library. I guess the showcases available do better job at that. Have fun exploring RightJS, apparently the right JS framework for various little apps. :)

Monday, September 13, 2010

PacktLib - Packt's Alternative to O'Reilly's Safari

Apparently Packt Publishing has just opened an online digital book library, PacktLib. The service provides access to over 400 books published by Packt. Compared to 9000+ books of O'Reilly's Safari that's a bit puny in my opinion. This fact is reflected in a major price difference between the services.

A yearly subscription to PacktLib costs around 130 euros whereas similar access to Safari costs around 473. It's important note, however, that Safari provides more subscription options. PacktLib provides currently only yearly subscription while it's possible to subscribe to Safari on monthly basis.

In addition Safari provides a limited version that allows the subscriber to access ten books fully per month. In that case the price of a yearly subscription is just around 199 euros which provides quite good value as compared to Packt's current offering.

Nevertheless I find Packt's initiative refreshing. It's nice to see some competition to Safari! If you read a lot of Packt's books and prefer digital, easily searchable format, 130 euros sounds like a good deal to me.

I do think that it would be nice to have more subscription options. This would be more feasible alternative particularly for students.

Both services offer a trial which I recommend checking out in case you are into digital books.

Sunday, September 12, 2010

Book Review - jQuery 1.4 Reference Guide

Disclaimer: I received a digital review copy of this book from the publisher, Packt Publishing.
This time I will be taking a look at "jQuery 1.4 Reference Guide" by Karl Swedberg and Jonathan Chaffer. As you might already know jQuery is one of the most popular JavaScript libraries available. It simplifies common operations (traversal, animation, CSS manipulation, ...) somewhat and takes care of cross-browser compatibility.

As can be inferred from the title, the book is meant as reference. Don't expect to learn fundamentals of jQuery by reading it. It's better to pick up some other title (jQuery in Action, Learning jQuery 1.3) for that purpose. The book does, however, excellent work at providing solid examples of each function jQuery provides. It is important to note that the reference does not cover jQuery UI! In addition to function reference the book provides a look at the plugin architecture of jQuery.

Saturday, September 11, 2010

A Quick Peek at R - a Statistical Computing Platform and Language

I had a nice change to learn a bit of R this week as I took an intensive course on it. R is an environment and a language for statistical computing and graphics. It's open source (GPL) and fairly widely used as far as I know.

I ended up using RKWard frontend. I didn't have any particular reason for picking it amongst the others but in retrospect it wasn't that bad a choice.

In this post I'm going to show you some tricks I learned and share some resources on R. Reading it won't make you an R guru but will probably get you on the right way should you decide to become one.

Wednesday, September 1, 2010

Book Review - Python Multimedia: Beginner's Guide

Disclaimer: I received a digital review copy of this book from the publisher, Packt Publishing.
This time I will be taking a look at "Python Multimedia: Beginner's Guide" by Ninad Sathaye. It's a part of Packt's "Beginner's Guide" series that focuses on learning by doing. The idea is that a complete newcomer should be able to pick the book and start rocking. This is apparent in the highly detailed explanations of the book. You certainly won't be left to your own devices!

The book shows how to perform various multimedia (still images, video, audio) related tasks in sort of a recipe form. The freely available example chapter and articles [1][2][3][4][5] illustrate the approach chosen. Table of contents gives a nice overview on issues covered.

I believe those new to Python and multimedia in general have the most to gain by studying the examples shown in the book. They should provide enough inspiration for tackling more difficult problems. I do think, however, that it's a bit lacking from an advanced user's point of view. Some may also find the approach and writing style used problematic.

I will expand on these thoughts next as I share my impressions with the book with you next.