Monday, 28 October 2013

This Week In Dart #14

Apologies for the slight delay in this edition of TWID - I was doing a sponsored cycle at the weekend! I was also putting Crouton back on my Chromebook. Some more installing still to do. If you have any feedback on TWID such as the schedule or content, please leave a constructive comment! Also let me know if you have created or found something that deserves to be covered.

The Dart Editor was updated to version 0.8.5_r28990 and the Dart SDK to version 0.8.5.1_r28990. This release includes performance, stability and features updates. Polymer has had drastic changes - see the mailing list for advice on porting - sure a complete guide will pop up soon. The usual samples have been updated and other docs are on their way. One very positive change is the reduction of the JS produced when deploying a Polymer application. For more details see the announcement.

Packages are at the core of Dart and to aid understanding, pub commands are being renamed:

  • pub install is now pub get
  • pub update is now pub upgrade
  • pub deploy is now pub build

    Naoto Hc's blog has a post regarding usage of symbols whilst implementing Conway's Game of Life in Dart. Source Code available. This is a good example of a non-Polymer/non-WebUI web application written in Dart.

    Just a short TWID this week - back with another demo before TWID15 if this install goes well!

  • Saturday, 19 October 2013

    This Week In Dart #13

    No update to the Dart Editor or Dart SDK this week. There was a lot of activity on the mailing list trailing upcoming updates to Polymer.dart and Dartium. The main points for Polymer.dart: size of the output JS will be dramatically reduced, initialisation has changed and main() will be going away. The next release will be very significant!

    Video Discussion - iForms Autopsy and discuss of Dart, Dart Web Toolkit and Polymer:

    If you are in the SF area, there is a StageXL Hands-On Codelab
    "Whether you're looking to build the next Angry Birds or just find interesting ways to display your company's financial data, StageXL & Dart offer everything you need for 2D graphics or games. The StageXL library gives you access to all the best techniques & tools traditionally used by Flash™ & Starling developers"

    WebGL continues to be popular with Dart. Check out this Dart/WebGL port of the Processing sketch "Untangle" over on Paul Sanderson's blog.

    After all that, if you need to unwind why not play a game of EyeBurst - a Halloween inspired web game. Dart source code is available too. Some nice bat animations there!

    Saturday, 12 October 2013

    Binary Clock Revisited

    The Binary Clock HTML5 Canvas demo has proved to be one of the most popular demos on this blog. I thought it would be interesting to visit it again in a Polymer project. It is a fairly simple rewrite as custom Polymer.dart element. I didn't see the need for databinding it. Some initialisation is carried out as required - I am still clearing up in my mind the lifecyle of a custom element. All a learning process!

    The code is available on Github. It is part of a larger Polymer project, rather having a repo per demo. It was a little tricky to deploy to HTML/JS and there's important optimisation bugs which the Dart team are still working on. Once these are cleared up, there'll be a nice demo site with all the examples from the blog on it. Not too far in the future!!

    This Week In Dart #12

    Are you ready for a Polymer.dart heavy edition of TWID? Let's go...

    The Dart Editor was updated to 0.8.1_r28355 and the Dart SDK to 0.8.1.2_r28355. This updated includes performance, stability and features updates. The find feature (always an important part of a text editor!) has key binding fixes. Dartium now provides a Dart REPL at all times - not just when a breakpoint is reached. Polymer.dart brought fully up to date with Polymer.js which brought some important changes and updates.

    The DartLang site has an extensive tutorial - Define a Custom Element - Create a custom HTML element using Polymer. If you are looking to move onto Polymer from Web UI then stop on by Matt Butler's blog for 12 tips for porting 'Polymer Plunge'. If that isn't enough for you, check out Seth Ladd's 47 mini samples for Polymer over on GitHub.

    vdrones 0.12.0 shows some impressive 3D visuals. Watch this short video then pop along to the website to fly around for yourself!

    Diving down from the UI level, the core of Dart has been making advances as shown in this benchmark for Sudoku solving that was shared on G+. Prolific Dart blogger Chris Strom hit a milestone of 900 daily blogs in a row - an impressive benchmark for us other bloggers to follow!

    Finally Happy Birthday Dart! Yes Dart turned 2 years old on 11 October - many happy returns.

    Tuesday, 8 October 2013

    Minecraft Screenshot Viewer Server in Server Side Dart

    Dart and Minecraft are my favourite two time sinks right now so when I had and ideas to combine the two I just had to try it out! Previously I had written a wxPython screenshot viewer and it was a fun project that proved popular on my old Python blog. For non-players of the game, pressing F2 takes an instant screenshot (and saves it into your .minecraft) folder but there is no built in way to view them. This results, for me anyway, in a lot of great screenshots I never look at!

    Currently I don't know of any desktop GUI library for Dart so it has to be a web app. On the plus side this means displaying png graphics files is going to be very easy.

    Dart makes it very easy to build a HTTP server. As we are working Server side we can use dart:io which also includes file access. HTTPServer is the key class and we are provided with a HttpRequest object which gives the URL (e.g. http://divingintodart.blogspot.co.uk ) that the web browser requests a resource with. For the full code see GitHub.

    If you don't have the game and want to try out this code, just change the path to point at any folder containing png files (no sub-folders are read).

    I have quite a few ideas to extend this - leave a comment if you have a suggestion!
    TODO

  • Caching files in memory instead of reading from the disk every time.
  • Recording some statistics for access.
  • Refresh images shown without restarting the server.
  • Showing the files date.
  • Test on Windows.

  • Saturday, 5 October 2013

    This Week In Dart #11

    The Dart Editor and SDK was updated to version 0.7.6_r28018. There's a number of new features for the Editor - REPL in Dartium, a new HTML/CSS editor, faster dart2js and new Polymer.dart samples. The official Dart site has a good round-up of the features with graphs & screenshots.

    And whilst you are over at DartLang.org, you should cast an eye over this article The Event Loop and Dart. It does get a little confusing with a few notes on Dart bugs that complicate things but there's key Dart concepts here.
    If you are feeling a little lost, Seth Ladd's Path Finder example might get you back on the right track! As usual the code is available on GitHub.


    The Polymer.dart revolution continues but there was an important clarification on the mailing list re:WebUI support:
    One thing to keep in mind is that Web UI is still maintained. We're not adding new features, but we're ensuring it still works.
    
    See here for the full post on Google Groups.

    This resource doesn't seem new but I stumbled across it for the first time this week and bookmarked it quickly. synonym.dartlang.org gives Dart Code examples and there equivalents in Python, Javascript and C#.

    That's it for this editon of TWID. Build something great with Dart in the week ahead!