Thursday, September 5, 2013

The most famous Ponzi scheme

The USA has run a Ponzi scheme ever since Bretton Woods in 1944 when they were awarded the privilege of being the reserve currency. That meant that other countries and financial institutions would hold the dollar in reserve. The USA were supposed to back their dollar with gold, but printed and spent far more dollars than they had gold to back them with. 

If I gave you an IOU for a bottle of beer and you held onto that IOU forever, I would have a free bottle of beer. That is what the USA has done to the tune of 17 trillion dollars. The USA wriggled out of Gold backing the dollar in 1971 and used the military to back it with oil in 1973 (birth of the petrodollar). Without the petrodollar, the USA would see a flood of unwanted dollars (IOU's) coming back for payment. That would crash the dollar. This is already happening anyway as China and Japan have started offloading treasuries. 

Tuesday, March 26, 2013

Undo delete with AngularJS

An example of how to develop "undo row deleted" functionality using AngularJS and ng-grid.

At last, with angularjs, you can write code that even backend developers can learn to appreciate and love ;)

Monday, January 28, 2013

AngularJS rocks

Great, so now I needed to build a web GUI using pure JavaScript. What to do? There are plenty of frameworks to help you out there, among the most popular: Knockout, Batman, Backbone and Angular.

I looked around and settled for AngularJS after reading

So here's a small but completely functional application written using Angular and Twitter bootstrap. In less that 70 lines of code I managed to access LastFM's APIs and show the list of top artists by country returned from the service. From there we can navigate to see the top albums for each artist and the top tracks. Can you do that as easily with other frameworks? Maybe, but doing it with Angular was easy and fun. I really recommend AngularJS to anyone looking to develop a web based interface.

So what does the code look like?

In angular you start off defining your modules, some factories or/and services and configuring which URLs will trigger which controllers. You also define which templates will be used when a controller is triggered.

Angular provides nice AJAX abstraction in the form of a $resource service that provides means to interact with RESTful server-side data sources. And now for the controllers:

As you can see each controller has its scope and you just inject the resources/factories/services that you have defined previously. This DI has the nice side-effect that it makes your code easy to test. Angular comes with some pretty serious testing facilities so now you can easily unit test your javascript code!

As usual here's the app in action on Heroku and the whole source code.

Sunday, January 6, 2013


Neoflix is an example app using the Neovigator visualization. It uses the Movie Lens dataset and the work of Marko Rodriguez as shown on his blog entry "A Graph-Based Movie Recommender Engine" with some tweaks as shown in this post.

I ported the work of Max de Marzi using Neo4j and Neography shown in the above post series from Ruby to Groovy and JAX-RS. You can see the code here and the live application on the Heroku site.

My version is querying Neo4j using Cypher which is currently slower than Gremlin which is the query DSL used in De Marzi's example. In the next major release of Neo4j query times will likely be much faster.

Tuesday, October 23, 2012

Working with Gremlin

If you want to learn more about graphs or graph databases you might want to check out Gremlin.

Gremlin is a graph traversal language that can be used for graph query, analysis, and manipulation. 

As a simple example, if we have this simple graph:

And we want to answer the question "Who are marko's codevelopers?" then we could write the following query in Gremlin:

That would give us "peter and josh"

With Gremlin it's possible to work with any graph (database) that implements the blueprints property graph data model., i.e Neo4J which is probably the most popular graph database right now.

The easiest way to start working with Neo4J is to start it in embedded more but a more production-like scenario would be to send Gremlin queries to a Neo4J server using the REST API and Spring's Neo4J template.

Check out Gremlin's Web Console if you want to try out Gremlin without installing anything.

Tuesday, October 9, 2012

Empty rituals

Most so-called "agile" teams follow the following routine every morning: they gather round and, one by one, answer the following questions:

* What did you do yesterday?
* What are you going to do today?
* Is there anything hindering you?

Actually most teams that I've encountered just ignore that third question completely.

In the worst case (people sitting during the meeting), what you see is that this meeting becomes almost absurd, people just answer the questions and go back to their smart phones when their turn has passed. In the meantime, the scrum master, team lead, etc writes/types ferociously trying to capture what people are saying. These notes will kept/posted somewhere where no one (other than the scrum master) will ever look.

If asked why they do it I guess the answer would be the same as when you ask people why they chose a relational database.

Anyway, here's a way to make this hopefully less meaningless by Jeff Sutherland.

Starting with the highest priority Sprint Backlog Item (SBI) that is not yet completed in each Daily Stand-Up, the entire Team discusses their collective contribution toward completing that SBI. They then estimate their collective contribution’s complexity in Story Points as if the previous day’s contribution had been presented during the Sprint Planning meeting as the entire goal of the body of work. The Team then collectively plans the fastest and most effective way to share the work in order to move that SBI into the Done column as quickly as possible. Finally, we discuss anything that blocks the work or has the potential to slow it down for any reason.  
So the restructured Daily Stand-Up questions become:  
1. What did WE achieve yesterday on Priority 1?
2. What was OUR contribution on Priority 1 worth in Story Points?
3. What is OUR plan for completing Priority 1 today?
4. What, if anything, is blocking US or has the potential to slow US down today?  
These questions are then repeated for each lower Priority remaining in the Sprint Backlog until either all SBIs have been discussed or the 15 minute allotted time has elapsed, whichever comes first. 
These modifications serve several purposes. Shifting the focus from the individual to backlog priorities helps people to function more as a Team. It encourages consideration of how to effectively subdivide the work for quicker completion, overcoming the technical silos that specialists tend to prefer. We also find better quality updates and more attentive participation from all Team Members as a result of question 2. 
Because each Team Member now has a need to understand the complexity that has been resolved in order to vote on it, updates on the order of “Yesterday, I worked on SBI 1. Today, I will keep working on SBI 1. No impediments.” are no longer tolerated by the Team. 
They become a self-policing group, both demanding quality updates and full attention from all Team Members to keep the meeting efficient.