Marcos Placona Blog

Programming, technology and the taming of the web.

Category: Technology (page 1 of 7)

All of the general techie / technology talk that will not fit on any of the other specific categories

A first look at Dart

Reading time: 7 – 11 minutes

A few weeks ago, I went to a Google sponsored event called Dart Flight School. The aim is to promote the language by doing a road trip and presenting use-cases and samples. The presentations were brief, and mainly focused on discussing the language’s functionalities, and its seamless integration with AngularJS (also maintained by Google)

I had a chance to look at Dart before, and was interested in finding out more things about it. Turns out the language (and platform) are pretty slick, and the development tool-set is pretty complete. The IDE is pretty good (and free), and their package management system is pretty similar to NPM’s in NodeJS.

Dart is also very (very, very) fast, and is in fact faster than V8 (VM used by NodeJS). A performance comparison can be seen below.

Dart vs V8 Engine

Data gathered from

It comes bundled with an out of the box converter to JS, which means you can write your entire application in Dart, and then convert it to JavaScript. I must say I was initially sceptical about this conversion, but upon looking on the performance page, it seems even after conversion, JS generated by dart still manages to be faster than V8 (purple line above). The JS converter is a Dart application written in Dart, which means you could then convert it to a JS application using itself…. bewildering eh?


From a language point of view, dart seemed to be very readable, and compliant with contemporary languages such as Java and C#. It is a class based language that allows you to fully use object orientation, and has some very nifty functionalities embedded in it, where you can for example define a method using shorthand syntax as such:

Data Structures

Its core library also provides you with Lists, Sets and Maps, which basically means no imports, as you get that straight out-of-the-box. So for example if you wanted to create a Map and iterate through it, you could simply do:

Unit Tests

A big part of writing great code lies with the ability to provide unit tests that will make sure your code remains awesome even after refactoring. With dart, you can as easily create unit tests by importing unittest

And obviously I could have just as easily grouped my tests in a single group to have them maybe organized in smaller units. I’ve also used shorthand syntax to define my tests here


Is supported by a library called Mirrors (enough said?). Though I feel I haven’t played with that enough to give you any better example than this.


According to Dart’s own website, a Future represents a means for getting a value sometime in the future. When a function that returns a Future is invoked, two things happen:

  1. The function queues up work to be done and returns an uncompleted Future object immediately.
  2. Later, when a value is available, the Future object completes with that value (or with an error).

Why would I use Futures instead of simply calling my expensive processes and waiting for them to complete?

I like to think that the people who read my blog know better than asking the question above, as it makes me feel fuzzy and warm. However if you thought of asking this question but were ashamed to actually do so, I will take you through it, and we will pretend this never happened.

It turns out, that if you do that, you will lock the thread until your application becomes responsive again, which can range from a few milliseconds to God forbid a few seconds. Meaning your users will stay put (or most likely leave) until you finish processing their request and show them some meaningful content. Think of it as “waiting ’till Friday is upon us”.

Seth Ladd gives a great example of the power a Future can have in your application

You can read more here.


Need I say anything? Need I?


In this day and age, you want to be able to work with a language that offers you integrated package management. I have worked with numerous languages in the past, and managing third party packages has always been the pain of my life. The first time I looked at Ruby, I immediately fell in love with its package management system. Granted some languages try to accommodate for this by adding capabilities to builders such as Gradle, Ant or Maven. But I digress….

Dart comes with a package manager called Pub, which means all you need is a yaml file inside your project where you can specify any libraries your project needs, as well as which version you would like to be locked to. that way, you only need to package your application with what it really needs, and all the external libraries will be downloaded on the time you deploy your project. This makes your application lean and easy to maintain.

A pubspec.yaml file would look something like:

Then run the following from terminal to download all dependencies:

Cool Factor

Dart is a cool language and very simple to pick up, but as with all the things in life (although you don’t always like to admit it), the known is always a lot simpler, and Dart strives to offer simplicity, which means if you have done any proper language in the past, you’ll be able to read and write Dart code with ease. Dart themselves state

“We did throw in some nice syntactic features such as this. constructor args and => for one-line functions, but we’d agree that Dart chooses familiarity over excitement”

Final Verdict

It’s very exciting to see such fresh language being supported and built by Google. In my opinion, the language offers everything the “cool kids platforms” offer and more. It also has capabilities that allow you to run Dart on the server side, client side and even natively on the browser. According to their documentation, the engineers behind Dart have an Android and Google App Engine integration on the back of their heads, and even though they say it’s not completely down to them, they mention on their FAQ’s you’d need to ask the team. But I’d say the fact they have thought of it is already half the battle won.

From a language perspective, I found nothing that would put me off writing code on it (and I’m pretty fussy about semantics). Instead I have found I genuinely enjoyed writing code in Dart, and was left with a nice after-taste after attending Dart Flight School. Even though I understand we had a much cut-down version of the even here in the UK.

From Here

New TeamCity agents the right way

Reading time: 2 – 2 minutes

TeamCity Logo

At work, I’m gradually moving our CI server from Hudson to TeamCity.

Nothing against Hudson really, but I feel that TeamCity is a much more robust CI Server when it comes to integrating with .Net. It allows you to publish artifacts from your builds, and has a killer integration between developers IDE’s and itself, which is amazingly helpful to help developrs make sure they’re not going to break the build… well before they break it.

But anyway, one thing that was slightly annoying me with TeamCity, is the fact that the build agents would often get disconnect, and all my builds would stay in a queue until I went and manually restarted the agents.

The “Build Agent Disconnected” quickly became very annoying, and by quickly looking up on Google, I found lots of people had the same issue, and while there were lots of responses or people claiming they found a solution to it, I never actually found anything of much use other than the screenshot this guy posted.

When you add build agents on TeamCity, you get the option of adding them as a windows service, or simply as an agent that runs with TeamCity. I had tried to add multiple build agents as windows services before, but for a very strange reason, I would always end up with only one agent no matter what I did. TeamCity’s documentation wasn’t much help to be honest, and I ended up figuring this out after a couple of hours of trial and error. So here’s how you do it properly.

Continue reading

Easy unsubscribe with

Reading time: 2 – 3 minutes

I’ve created a new website over the last weekend and would like to share it here with you.

I’ve spent an entire day without checking my emails on Saturday, and when I finally got around to do it, there was a ton of useless crap in it. My spam filters are pretty good, but won’t pickup on things I (un)intentionally subscribed for.

The very act of purchasing something online will sometimes auto-subscribe you to the store’s monthly, weekly and daily newsletter until the end of era.

By osmosis, I will normally delete all the email from my inbox and just get on with my life.

This time though, I decided I’d also unsubscribe from some of them. Some were easy enough, as every good citizen knows to add an unsubscribe link to the bottom of the email.

Some others though, will make the assumption you love to get their newsletters about their huge selection of garden hoses.

While unsubscribing, I though maybe some other people may want to make use of the unsubscription links, so I decided to collate them all, and put them together on a collaborative website.

The idea is very simple, find what you would like to unsubscribe from, and the link will take you straight to their unsubscription page.

What if my link isn’t there?

You can just add it. Simply go ahead to the GitHub page, fork the project, make your changes, and send me a pull request.

Adding a new URL is as simple as:

Adding a new URL to

And you can also collaborate with the project itself, but changing any of the files, adding new functionalities or making the layout look a bit prettier.

So check out!

And fork me on GitHub

UK Top 40 albums & singles JSON

Reading time: 1 – 2 minutes


So I had this idea for a little application and wanted to get the UK’s Top40 singles to use in it. I started by writing something that would scrape Radio 1′s Top 40 chart and return me a list of songs since I couldn’t find any feeds that would give me that.

I then thought this could be of use to somebody else, so turned it into a little service (built using Ruby and Sinatra) that returns a JSON object with all the singles and some useful information about the number of weeks it’s been there, how much has it moved, and which direction (up or down) it’s gone.

On the root of it, it returns the chart date as the current date and time, and the retrieval date to indicate which date it’s been last retrieved. I am caching the feed to play nice with Radio 1, so I’m only making one HTTP request a day to their website.

Check it out at

Also feel free to fork it, and collaborate by adding your country’s top 40

Managing your dotfiles the right way

Reading time: 3 – 4 minutes

It’s no secret that on the UNIX world, dotfiles play a very important part when it comes to making your terminal look good. Be it on Linux, be it on a Mac. Dotfiles are there so you can configure your favourite software to look just the way you like it.

I especially use dotfiles to customize the look on my terminal, and to manage bundles I use with Vim. One thing that normally annoys me, is the fact that whenever I rebuild my machine (or build a new one) I need to copy over my dotfiles, and obviously make sure they are kept up-to-date on all my devices when I change something.

I’ve heard about people adding their dotfiles to GitHub, and even noticed GitHub themselves encourage you to do the same. I decided to give it a go, and will describe here what you need to do in order to have your dotfiles stored there, and most importantly, how to quickly load them up on any other computers boxes you may have.

Start by creating a folder called “dotfiles” on your home directory, and move all your dotfiles into it.

In the example above, I’m only covering my vim and bash dotfiles. You can cover as many as you like by simply moving your files into the dotfiles directory.

Now it’s time to create your install script also under our ~/dotfiles directory. You should use this script every time you want to install your dotfiles on a given machine. So let’s open vim (or your favourite text editor) and create the following file:

The file is pretty simple, as it contains a list of files which you want to have copied, and a loop to put them on the right location and create symlinks on your home directory.

Now, it’s really important that you name this file correctly, as you want to be able to execute it. And after having created it, we need to give it execute permissions, as we want to be able to run it

If you run this file now, you should see the following happening on your screen:

Good. We’re ready to push this to GitHub, so we never have to go through this process again.

Go ahead and create  a new repository on GitHub called dotfiles.

Now, back to your terminal and run the following commands:

From top to bottom we’ve done the following:

  1. navigated to our newly created directory
  2. turned it into a local git repository
  3. added all the files it contained into our local Git repository
  4. committed all the added files into the new local repository
  5. hooked up our local git repository with the GitHub repository
  6. pushed our files to the remote (GitHub) repository

If everything went OK, you should now be able to browse your remote repository (mine is and see all your dotfiles (as well as your installer) listed there.

Now, the beauty of it, is the fact that whenever you want your dotfiles in any other box, you can simply do the following:

All your settings will be copied and applied.

As previously mentioned, my dotfiles are in, so fell free to fork it, modify and maybe even collaborate.

Older posts