Posts tagged Javascript
Selected (belated, extended) Saturday Links
Mar 28th
The past two weeks haven’t really left time to compile my selected links, though there have been many. A few days at SxSWi (on which more, later) followed by travelling with the family and the inevitable work backlog moved blogging way down the priority list. So here’s a mammoth selection to get me caught up. Particularly interesting has been the discussion around the future of newspapers (represented here by Clay Shirky, Steven Johnson and Russell Davies), which seem to have finally pushed beyond “how t ind a good business model for papers” to looking at where the real value for society lies and how we can preserve and extend that in a changing landscape.
-
Making a jQuery Plugin Truly Customizable » Learning jQuery – Tips, Techniques, Tutorials
Some nice tips for managing options, and a reminder to find _useful_ customisations not just load with customisation options without much thought about/consultation with other potential users
-
iPhone Coding For Web Developers
Presentation slides from the internet's Matt Biddulph
-
Rack::Test released: Simply test any Rack-compatible app — Bryan Helmkamp
There's a _lot_ to like about increased adoption of rack. "With Rack::Test, we hope to make it easy for frameworks to encourage their users to write tests by making it trivial to provide a testing environment. We’d like to foster compatibility between Ruby web app testing environments (especially important as ideas like multi-framework apps become more prominent). The philosophy is the library should stay small and extendable so frameworks can layer on additional functionality they want to offer without modifying Rack::Test’s core behavior or resorting to monkeypatching."
-
Newspapers and Thinking the Unthinkable « Clay Shirky
"That is what real revolutions are like. The old stuff gets broken faster than the new stuff is put in its place. The importance of any given experiment isn’t apparent at the moment it appears; big changes stall, small changes spread. Even the revolutionaries can’t predict what will happen …. Ancient social bargains, once disrupted, can neither be mended nor quickly replaced, since any such bargain takes decades to solidify." … and a a lot more
-
russell davies: newspapers and all that
"If we are going to create a new news ecosystem involving advertisers (and a lot of people would be grateful for that money) then we're going to have to do something about that institutional bifurcation between content and commerce. We're going to have to design the relationship between the two with the care of a good experience designer." – a response to Ben Hammersley asking if anyone talking about the future of newspapers had talked to anyone in advertising
-
Streams, affordances, Facebook, and rounding errors – Laughing Meme
"Simon Willison asked this week about best practice for architecting activity streams. And the answer is, “It depends.” Depends on the scope, scale, access patterns, and affordances you’re building — your contract with your users.
Which is a long way of saying think hard about the promises you make to your users, implicitly or explicitly.
And, Facebook, my friend, what the HELL are you thinking? You managed to negotiate the best deal in the business, talk about a racket, and you threw it away for a piece of Twitter’s pain? Are you stupid? Well, best of luck with that."
-
SXSW Interactive Videos and Podcasts | SXSW.com
Most of the sessions were recorded and this is the place to get hold of them.
-
SXSWi: Location-based service is the trend at Austin, Texas |
"Predictably, location-based services were a major feature this year, with launches that included Foursquare, a social, location-based game by the Dodgeball creator, Dennis Crowley, and a new Facebook application for the location management tool Fire Eagle. While early adopters such as the SXSWers have been exploring location-based services for some time, it is inevitable that more consumer and privacy-friendly versions will start to creep into the mainstream."
-
stevenberlinjohnson.com: Old Growth Media And The Future Of News
"I think it’s much more instructive to anticipate the future of investigative journalism by looking at the past of technology journalism. When ecologists go into the field to research natural ecosystems, they seek out the old-growth forests, the places where nature has had the longest amount of time to evolve and diversify and interconnect. They don’t study the Brazilian rain forest by looking at a field that was clear cut two years ago." … and …" Measured by pure audience interest, newspapers have never been more relevant. If they embrace this role as an authoritative guide to the entire ecosystem of news, if they stop paying for content that the web is already generating on its own, I suspect in the long run they will be as sustainable and as vital as they have ever been. The implied motto of every paper in the country should be: all the news that’s fit to link."
-
On running a panel
A mixup over bus times meant I didn't make it to Andrew's panel at SxSW, but I heard many good things. It's really great to see this kind of debriefing-in-public going on. Hopefully it'll make for a stronger set of talks and panels next year.
-
Guardian API Maps – Home
"This is a site that lets you search the Guardian's new API and add location information to articles. All the place data we collect is being made available to anyone who wants it."
-
Foursquare, Hot New Phone App, Is Dodgeball on Steroids | The New York Observer
Quite a few people seemed to be playing with Foursquare at SxSW but most of the Brits were excluded as we didn't want to use that much data and it wasn't available in the UK iTunes store. One to watch, though.
-
A few notes on the Guardian Open Platform
I saw Simon present the Guardian Platform at SxSW and it looks like a great achievement. Waiting to see what developers build on it, and how they roll some of the ideas back in
-
Taking remote imagery offline to Nigeria :: High Earth Orbit
Andrew's notes on trying to source good map data for use in Nigeria. It's a useful overview of a variety of services and ways to use them, though highlighting the absence of really accessible, high-quality data.
-
Pulse Laser: The Utility of the Unfinished
"One technique that S&W has been using recently to illustrate design work is placing sketches or wireframes in situ. Whilst wireframes themselves are incomplete artefacts, designed to be work in progress, they still suffer for being uniformly incomplete. Wireframes themselves can be almost too beautiful, and this means that it becomes all-too-easy to criticise them as only wireframes, rather than as part of a product that exists in the world. Contextualising the sketches into the photograph places the design into the world. This enables the design to be understood within the world, and also (importantly) to highlight the seams between the unfinished design and the finished world around it"
-
Spike: a log file viewing & (if we’re being generous) analysis tool for Rails developers.
Looks like a handy addition to the toolkit
-
Generation Open | FactoryCity
"Sharing and giving away all that you can are the best defenses against fear, obsolescence, growing old, and, even, wrinkles. It isn’t always easy, but it’s how we outlive the shackles of biology and transcend the physicality of gravity." – Perhaps an overly optimistic piece, but it connects together a number of current themes and we can hope…
-
Testing Facebook with Cucumber | opensoul.org
For those faced with the unpleasant task of writing facebook apps, some people are working on making sure they can be thoroughly tested.
-
scraplab : instant sinatra deployment with heroku
A lot of people seem to be excited about heroku lately, and it does look like a nice simple way to put up quick ruby apps. Must play soon.
-
How to speed up gem installs 10x « The Budding Rubyist
Handy little tip, particularly for server environments: turn off ri and rdoc generation in your .gemrc file, and speed things up considerably
-
Facebook in 2010: no longer a walled garden – O'Reilly Radar
A more positive spin on facebook's changes from David O'Recordon, who suspects they're going to pull down the walls around their garden and become a proper citizen of the open web.
-
Facebook blinks, copies Twitter, still gets it wrong. – broadstuff
Critical commentary on facebook's recent changes. I'm not sure I entirely agree with statements like "By 2009 it was clear no one gives a sh*t about the Social Graph" but facebook really do seem to be finding that their approach is overly complex and quickly trying to shift to a more twitter-like "web of flow" (to steal Stowe Boyd's phrase)
-
Acquia Search goes public beta | Acquia
Hosted solr for drupal: "Acquia Search can be installed as a module on any Drupal 6 site, and enhances a site's search experience with faceted search navigation, content recommendations, and configurable results weighting, all delivered through a redundant hosted service infrastructure.".
-
Oauth using pecl/OAuth
Looks like a nice simple way to interact with oauth from a PHP app
Book Review: Pro Javascript Design Patterns
Jan 20th
According to wikipedia:
In software engineering, a design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Algorithms are not thought of as design patterns, since they solve computational problems rather than design problems.
Design patterns, and particularly their application in dynamic languages can be a controversial topic, and every now and again another round of blog posts bubbles up appalled at the way a new group of programmers have become infatuated with design patterns. Applied without care design patterns can quickly lead to over-engineered code that seems designed as much to draw on as many of the established patterns as possible as to solve the intended problem. But if applied with care, and with consideration of how a pattern applies in the context of your chosen language they can be a helpful way to draw on the wisdom of the coders that came before you, and make your code easier to understand to those who may inherit it.
Written by Dustin Diaz (of Google) and Ross Harmes (of Yahoo), Pro Javascript Design Patterns builds on experience of building complex, high profile javascript applications. That experience shows as each pattern is introduced with solid examples and sample code and then refined to provide looser-coupling, more flexibility and/or better performance.
Early on in the book I was concerned that some of the solutions could become too heavy and the early introduction of interfaces hinted at something akin to the early approaches to pattern usage in PHP, which often looked more like an attempt to turn PHP into Java than a way to use PHP’s own features better. As the book goes on the usefulness of those interfaces, particularly for large development teams, becomes clear and most of those concerns are allayed, especially as the authors offer pros and cons for the use of each pattern and are clearly focussed on how these patterns can help produce more robust solutions.
Most of the patterns will have a fairly immediate impact for developers new to them, and even for those who have used them in other contexts it is helpful to see how they have been applied in JavaScript. Most modern JavaScript libraries rely on several of these patterns to abstract out handling of different browser quirks or adding new event types, and even if you rely heavily on one or more of the major libraries this guide may well help you understand their internals better.
I’ve sometimes been skeptical about books claiming to be targeted at an advanced target. Labels like “pro” are often handed out far too easily. But in this case it seems deserved. While the book does a good job of quickly introducing approaches to object-oriented programming in JavaScript, that’s based on an assumption of a solid knowledge of the language and of OO development in at least one language. If you’re a newcomer to JavaScript or just looking for a way to add a few fancy features to your web pages this isn’t be book for you. But if you have some serious JavaScript development experience and are needing a way to tighten up your code to make it more modular and more maintainable, this book is well worth your time.
Disclaimer: I was sent a copy of this book for review by the publisher. You can find it at apress, amazon US, amazon UK and all sorts of other places.
Book Review: Learning jQuery
Oct 14th
As a rails developer most of my experience with javascript libraries has been with prototype and scriptaculous, but I’ve never been quite happy with them. The helper methods built into ActionView make simple tasks a breeze, and I’ve played with the UJS plugin to improve the separation of content and behaviour, but even then the weight of the libraries and the comparable simplicty of tasks like iteration offered by jQuery has always made the grass over there look quite a bit greener.
So when Karl told me that he and Jonathan Chaffer were working on a book about jQuery and offered to send me a copy that seemed like the perfect opportunity to begin making the switch. (that comment should be taken as a disclaimer, by the way.) In the end the timing was fortuitous as I’ve ended up working on a couple of drupal projects (jQuery is included with drupal from version 5 onwards) and having to integrate some jQuery code into a rails project, so I’ve needed to take the lessons learned from the book and quickly put them into practice.
The book takes a gradual pace, introducing the library, and how it handles selectors, events and effects, before moving into DOM manipulation, AJAX and handling forms. Standardistas will be pleased that there is a strong emphasis on progressive enhancement, always starting with pages that achieve their basic intent and then using jQuery to improve the user experience. The authors place considerable emphasis on the importance of providing all users with a solid basic experience and show how jQuery makes it very easy to do so.
More experienced javascript developers may find the pace of the book a little slow (and might prefer to look out for the companion reference volume). The core audience is likely to be those who may have dabbled with the odd snippet, or perhaps used tools that generated javascript for them, but want a step-by-step tutorial that shows how to use jQuery to do things cleanly while building general understanding. Nevertheless, the coverage of more advanced topics like closures is solid and a good reminder even for the more experienced developer.
There were a couple of areas that could have done with a little more exposition, such as the fairly cursory coverage of the difference between GET and POST in HTTP requests (being a purist, I was really looking for mention of PUT and DELETE too), and the fact that without more work one of the shopping cart examples could leave the user thinking their updates had been saved when there was no mechanism to actually make the updates on the server-side. That said, hopefully by that point in the book most readers will be alert to such things and know that the examples are not necessarily production code.
If you’re looking to consolidate your javascript skills and like the look of jQuery, or, like me, you find that sometimes sitting down and reading a book is the best way to familiarise yourself with something, Learning jQuery is well worth your time and money. You can find it at packt, amazon US, amazon UK and all sorts of other places.
Solvent: Semantic data from almost any page
Oct 30th
Spending a weekend in Chicago last month and looking for a non-starbucks coffee shop in the loop, I was frustrated to find that the otherwise very handy delocator.net didn’t have an option to limit a search to a radius of less than 5 miles or to plot a group of results on a map. We eventually gave up and went to one of the many Starbucks highly visible in our immediate vicinity.
Of course, I could have written a scraper to pull the data off delocator’s results page and produce a map from it, but it would likely have taken more than the 5 minutes I had available. What I needed was Solvent. According to its creators at the Simile project, Solvent is “a Firefox extension that helps you write Javascript screen scrapers for Piggy Bank” and their screencast displays someone solving exactly the problem I found myself faced with.
As the screencast shows, extracting data from any page that has some structure to it is as simple as firing up the plugin, highlighting a few lines and selecting an appropriate description for them. The interface will feel familiar to anyone who’s worked with javascript debuggers, and it only takes a couple of minutes to get the data off the page, into PiggyBank and—thanks to PiggyBank’s google maps integration—onto a map.
For those who are comfortable with the DOM and Javascript, this is a fantastic tool. Along with the growing suite of microformats and the Greasemonkey scripts Mark Pilgrim is writing to parse them, this project shows that we’re rapidly moving towards a world where a decentralized store of semantically-rich information is possible.
Simile even have a companion project, Semantic Bank, that provides long-term storage of the captured data. It would be nice if users were prompted to set up an account with that (or other semantic banks) when they first install Piggy Bank. Coupled with some UI developments to make both Solvent and Piggy Bank more accessible to the non-technical user, and we could quickly see publishing data to the Semantic Web become as simple as blogging.
More WiFi Google Mapping
Jul 1st
There has been much jubilation since Google announced their javascript-based maps API yesterday. I’ve been playing with it a little and have updated the Grand Rapids WiFi google map to use the new API. The web pages produced this way are much more responsive than those using the old hacks, and it’ll be great to see what people produce now we have official support.
I’m hoping to shortly release a new version of the WiFi site which allows search results to be plotted on a map (or viewed as a list as at present). Until then, this implementation remains ‘experimental’.