February 2013
1 post
3 tags
Fill shape with rotated pattern using Canvas
I was looking for a way to fill a shape with a rotated pattern using the HTML5 Canvas tag. It’s easy to fill a shape with a repeating pattern with the createPattern() method, but I had more trouble with figuring out how to get a rotated pattern. Turns out that’s very easy too. Just rotate the canvas  before calling the fill method. You can see a working sample here.             var...
Feb 15th
1 note
September 2012
1 post
8 tags
Scaling our product - CDN
I’m writing a series of posts about how we scaled our product at Floorplanner.com. We started with a single server, then we created application servers in the cloud and after that we moved our databases to the cloud. This post is about our next step, about how we improved the delivery of our static files. What files? The floorplan drawing tool (the Editor) is a very important part of our product....
Sep 6th
July 2012
1 post
5 tags
Scaling our product - Cloud database
This is the third post in a series about how we scaled our product at Floorplanner. The first one was about how it all started with one dedicated server. In the second post I talked about how we reduced some of the risk by running two application servers on separate machines in the cloud. This post is about our database. The application servers and the load balancer were running in the AWS...
Jul 4th
June 2012
1 post
7 tags
Scaling our product - Application nodes
In my previous post I talked about how we started out with only one dedicated server. This was of course a big risk. The first step we took to reduce this risk was to use multiple servers instead of only one. If there is one thing we’ve learned, it’s that a single points of failure is evil. And we had a bunch of those. OK, but how do you split up a running system with a small team? We couldn’t...
Jun 4th
May 2012
2 posts
8 tags
Scaling our product - How it all started
Scaling is tough. At least, that is my conclusion after doing it for a while. According to the Startup Genome, you must be able to grow your company in five core dimensions if you want to be successful. The five core dimensions are:  customers, product, team, business model and funding. I’m going to write a bit about one of those: how we scaled our product. I assume that there are companies out...
May 11th
2 tags
Why Startups Fail - Infographic
May 2nd
1 note
December 2011
2 posts
7 tags
MongoDB and GridFS versioning
A few months ago we still used Amazon’s S3 service to store floor plan in a XML based file, which we call FML (Floorplanner Markup Language). There were a few big issues with using this method. First of all, what happens when S3 goes down? We don’t have access to the data and our whole application will be useless. Another problem with S3 is that it’s slow, especially when using...
Dec 28th
Wrong event scope in Raphael.js (and jQuery)
Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. While playing around with this nice SVG JavaScript library Raphaël.js, I stumbled upon an issue with the event scope. Raphael doesn’t allow event handlers to run in any specific scope. This is a problem when you want to work with its event system ‘eve()’ in combination with...
Dec 14th
November 2011
1 post
Zooming in Flash Builder 4.6
In most of the apps I make there is some kind of zooming. Now that I’m playing around with the latest Flex SDK release, Flex 4.6 SDK, I need it again. So to keep myself from reinventing the wheel over and over again, I’m posting my (conceptual) zoom code here. It’s using the TransformGestureEvent which is available for Flex Mobile Projects in Flash Builder...
Nov 3rd
April 2011
1 post
Floorplanner.com is hiring!
Floorplanner was founded in 2007 with a mission to be the easiest, quickest, and best looking way to create and share interactive floor plans online. We are a small and highly innovative company based in Rotterdam, The Netherlands with a no nonsense attitude. We have over 2.5 million registered users and we are currently growing with almost 5000 new users every day. We are building the new...
Apr 11th
March 2011
2 posts
Canvas vs Canvas vs SVG performance on iPad
Last week I created two simple tests to get some insights on the performance of Canvas and SVG on iDevices. The test is a blue square bouncing from left to right and back again, it’s repositioned every frame. The faster a browser can render a frame, the better the performance is on the device. Well.. at least in this particular case. In the Canvas test, the scene is cleared (by using...
Mar 15th
Canvas vs SVG performance on iPad
I’m doing a bit of HTML5 performance testing, specifically on the iPhone and iPad. When doing interactive stuff, it seems that most of the resources are used for updating the scene (clearing and drawing), and not so much by doing calculations in JavaScript. I created two very simple tests to see if the performance is different using Canvas or SVG. It’s a fabulous blue cube bouncing up...
Mar 7th
November 2010
2 posts
Merge sort in JavaScript
Whenever I have a couple of minutes of spare time, I’m trying to learn more about algorithms . The first two algorithms were selection sort and insertion sort. Next up is merge sort. Merge sort is a bit different than selection and insertion sort. Selection and insertion sort are based on a loop inside a loop. That way you compare each value of a collection (one by one) to all the other...
Nov 11th
Server-side PNG rendering of SWF images using...
The problem We need to display thumbnails for 2D images, which are SWF files. Option 1. Use embedded Flash Pros: quick drop-in solution; Cons: requirement for clients to have Flash installed in their browsers; thumbnail displaying logic depends on what we are displaying (2D, 3D, photo) = additional complexity; requires additional markup for embedding Flash; is slow to load and...
Nov 2nd
October 2010
2 posts
Selection sort in JavaScript
In my quest to learn more about algorithms, I came across another sorting algorithm. This one is called Selection sort. The collection is sorted from beginning to end. While looping over the elements, it first finds the smallest element between the current position and the end of the collection. Then the smallest element and the current element exchange places. This way all elements are sorted...
Oct 29th
Insertion sort in JavaScript
I started reading Introduction to Algorithms to educate myself on the subject. There are books on algorithms that are rigorous but incomplete and others that cover masses of material but lack rigor. Introduction to Algorithms combines rigor and comprehensiveness. In order to motivate myself reading it cover to cover, I thought it’d be a good idea to blog about my progress. Beside me being...
Oct 27th
August 2010
1 post
Interactive SVG on the iPad
It’s difficult to find any decent samples about interactive SVG on the iPad and iPhone. SVG is used more and more these days, but it’s still rather unknown. The combination with touch and gestures on an iDevice is even rarer. Since I’ve been playing around with it a bit, I’d like to share what I’ve learned. This post describes the steps involved to create a blue...
Aug 30th
1 note
July 2010
1 post
Rails and the Google Apps Marketplace
For a couple of weeks we wanted to get Floorplanner on the Google Apps Marketplace. After my struggle with it I’m happy to say we succeeded. Before we get started you probably already found out that Ruby GData client library is very limited and proper documentation and examples are pretty hard to find. I will try to explain how the mechanism works and how you can use it in your Google Apps...
Jul 27th
June 2010
1 post
Lessons Learned: Changing data storage
We’ve been in this internet startup game for a couple of years now. Every now and then we find ourselves in a situation that feels awfully familiar. Especially when we just broke something in the same way we’ve broken it before. Yes indeed… learning it the hard way. I thought it would be nice to write down a thing or two we have learned while running the Floorplanner business....
Jun 2nd
March 2010
3 posts
Blender 2.5 alpha 2 - Collada export bug
Blender 2.5 is a great application to create 3D stuff. Best of all: its free! Even better: Blender 2.5 alpha 2 seems to have a much enhanced Collada importer/exporter. Blender versions before 2.5 used a python script for import and export. That script was okay, but failed on more complex scenes using rigs / animations. I believe Blender now uses Collada DOM or OpenCOLLADA. But after trying the...
Mar 27th
getDefinitionByName error: "Variable ... is not...
I wrote this post mainly as a reminder for myself, but it might be useful for anybody dealing with the same issue. In ActionScript3 you can get a class by its name like this: import flash.utils.getDefinitionByName; ... var myClass = getDefinitionByName("MyClass") as Class; When you only use the name of the class, you will get an error: “Variable … is not defined”, because the...
Mar 14th
Ant script to build Flex Library project
Ever wondered how to create an Ant build script for a Flex Library project? I did, and although it’s very easy (when you know how) it’s very poorly documented. This is the solution Dusan and I found after some trail and error. Save this script as build.xml in the root of your project, run ant and your project will be build.
Mar 5th
February 2010
3 posts
Flex Formatter
I use Eclipse 3.4.2 in combination with Flex Builder 3.0. An important feature that is missing in FB3 is a formatter. I’m very glad I found this project on SourceForge by Ernest Pasour: Flex Formatter. Installing it is easy. Download it, unzip it, move the files to the plugins folder of Eclipse and restart Eclipse. You now see a couple of new icons in your Flex perspective, with the most...
Feb 24th
RESTful uploading of files using XML
After searching for too long to find any documentation on this topic, this is just as a reminder for myself. Hopefully, it’ll solve somebody else’s problem as well. To send a file to a Rails application, using a RESTful XML API call, use the following XML snippet: base64-encoded file contents The file contents should be base64 encoded, and may be encapsulated in a CDATA...
Feb 15th
Flex SDK 4.0.0.13875
On Friday 29 January Adobe released a new ‘stable’ version of the Flex SDK, version 4.0.0.13875. One of the nice things about it was the addition of the Flex 4 TitleWindow. Peter deHaan uses the new TitleWindow in one of his articles on his excellent blog: Constraining the movement on a Spark TitleWindow container in Flex 4 When using the new SDK we encountered quite an annoying...
Feb 4th
January 2010
7 posts
Two practical examples of Rack middleware in Rails
After Rails moved to Rack as server interface, the ability the use Rack middleware was one of the most touted advantages. At first, it wasn’t very clear to me why this was such a big deal. However, I have applied Rack middleware in the last month on several occasions. I thought it might be interesting for other Rails developers to see some practical examples of middleware, to see where they...
Jan 29th
Introducing js3ds - a Javascript parser for .3ds
Came home very tired today and saw this tweet by @Sirokos. Now, that of course was a challenge! In the near future I’m planning to do some experiments with WebGL and Javascript. Of course I need to be able to load some cool 3DS models then. So… started coding an hour ago and presto! Basics are done within the hour! I admit: I’ve done a Actionscript version some years ago (coded...
Jan 26th
Introducing ASBlender
As all 3D modelers probably know: exporting models from 3D applications and use them in Flash (Papervision3D etc.) can be frustrating. Stuff like animations, matrices, etc. sometimes don’t work as expected. So I thought: why not read the native file format of a 3D app instead? That way we get access to the native data as used by a 3D app. Not some ‘twisted’ data as presented by...
Jan 24th
Ode to Array#pack and String#unpack
Remember my last post, where I representing a pixel with a Fixnum, storing the R, G, B and A value in its 4 bytes of memory? Well, I have been working some more on my PNG library and I am now trying loading and saving an image. Using the PNG specification, building a PNG encoder/decoder isn’t that hard, but the required algorithmic calculations make sure that performance in Ruby is less...
Jan 17th
Memory efficiency when using Ruby
I have been spending some time creating a pure Ruby PNG library. For this library, I need to have some representation of the image, which is composed of RGB pixels, supporting an alpha channel. Because images can be composed of a lot of pixels, I want the implementation to be as memory efficient as possible. I also would like decent performance. A very naive Ruby implementation for an image...
Jan 14th
Request-log-analyzer 1.6.0
Bart & I just released request-log-analyzer 1.6.0. New features since the 1.5.0 release: PostgreSQL query log support; Delayed::Job log support; Small fixes in the Rails file format; Various other small fixes and improvements. As always, run the following command to install or upgrade to the latest version: sudo gem install request-log-analyzer
Jan 8th
Faster RESTful XML processing in Rails
The Floorplanner API uses XML-formatted requests and responses, so our servers process a lot of XML. In Rails, most XML parsing is done using the Hash.from_xml method. This method allows for different backends, but the current backends are either slow or buggy. I decided to fix this situation myself. I fixed bugs in the current libxml and nokogiri backends, and I added some new SAX-based backends...
Jan 3rd
November 2009
3 posts
Request-log-analyzer 1.5.0
Bart and I just released request-log-analyzer version 1.5.0. New features include: MySQL slow query log format support to analyze what queries are slowing down your database. Format autodetection: with all those supported file formats, remembering the right --format parameter gets tricky. With format autodetection, this usually is not needed anymore! As always, run the following command to...
Nov 18th
Case-insensitive validates_uniqueness_of slowness
Watch out when using validates_uniqueness_of :field, :case_sensitive => false. Rails transforms this in a query that cannot be supported by an index, which will really slow validation down if the underlying table grows larger. For example, we use validates_uniqueness_of to check for duplicate e-mail addresses. Because email addresses are case-insensitive, adding :case_sensitive => false...
Nov 17th
Database replication in 5 easy steps
Running an online service like Floorplanner is not without risks. There are a lot of things that can go wrong. One of them is downtime of your service due to a crashing system. It doesn’t have to happen of course, but when it does, it can have some nasty consequences. A good way to reduce the risk of a crashing system is to set up a redundant system. In short, a redundant system is an exact...
Nov 9th
October 2009
1 post
Evaluating static ParseTree subtrees
ParseTree is a very useful to gem that can translate Ruby code into a syntax tree. I recently needed to evaluate a static part of this tree to return the original hash it represented. I wrote a simple method called ParseTree.eval_static_tree for this purpose. The method can only evaluate trees that have a static value composed of hashes, arrays, strings, symbols and numerics. You can however pass...
Oct 3rd
September 2009
4 posts
Request-log-analyzer 1.4.0
Bart and I have been working a lot on request-log-analyzer lately, our tool to produce performance reports for web applications based on their log files. Today, we released version 1.4.0, which boasts many new features since I last blogged about a release. The changelog contains all changes we have implemented recently with some additional information, but these are the highlights: New and...
Sep 30th
Adyen payment services for Rails
Michel and I have been playing around with integrating Adyen payment services in Rails applications. We have assembled some of the pieces of code we have written, combined them, written specs for them and released the result as a gem. The package is also included on the Adyen support site. Currently, the gem provides the following: Simple configuration and setup. Uses Adyen’s test or...
Sep 27th
Performance tweaking of Ruby algorithms
I have been working on request-log-analyzer quite a lot recently. One of the things I focused on was improving the parsing performance: because it parses log files that often are very big, processing times tend to be long. So all savings are very welcome. Improving the performance of a command line application that does a lot of processing is very different from optimizing the performance of a...
Sep 27th
Build ActionScript3 projects with TextMate in 5...
The text editor of choice of our Rails team is TextMate. Our Flash team is a bit divided between Eclipse+FDT and FlexBuilder. I wanted to see if TextMate is a good alternative for building Flash/ActionScript projects. There are a couple of good sources on using TexMate for ActionScript projects, but it’s a little fragmented and sometimes outdated. I found pixelate’s blog post and...
Sep 5th
August 2009
1 post
New version of Scoped search
After an almost complete rewrite, I am proud to present version 2.0 of scoped_search, the ActiveRecord plugin that makes it easy to find records using a simple query language. This new version support a new query language that supports more complex constructs, and can therefore be used to conduct more fine-grained queries on your models. New query language Logical operators: AND (&,...
Aug 31st
May 2009
3 posts
Papervision3D 2.1 - alpha
Just committed rev. 911 to the Papervision3D SVN trunk. Rev. 911 and upwards will become Papervision3D 2.1 because the changes made are quite big. Major changes where made to the DAE, MD2 and animation classes. NOTE: This revision is considerably different then previous revisions. Use with care! At this point its not advised to use rev. 911 for production. This revision fixes several issues...
May 26th
Debug your web service with HTTP Client
The last couple of weeks we’ve been working on a big integration project. The largest real estate portal of The Netherlands, Funda, uses Floorplanner to deliver interactive floor plans to their clients. They use our API’s to seamlessly integrate the Floorplanner into their back end system and front end website. One of our API’s is our RESTful web service. With it one can manage...
May 26th
Load, modify and save local images with Flash...
// window.onload = function() { swfobject.embedSWF("http://tehblog.floorplanner.com/wp-content/uploads/2009/05/main.swf", 'thumbr', '280', '265', '10.0.0'); } One of the cool new things about Flash Player 10 is that you now have access to the local file system. This means that you can load, modify and save files directly on the client side without any server interaction. Mike Chambers wrote a...
May 4th
April 2009
1 post
Unproject with useProjectionMatrix = true
I just updated Papervision3D to allow the CameraObject3D#unproject method to work when CameraObject3D#useProjectionMatrix = true. Papervision3D has two methods of ‘projecting’ vectors onto the screen: useProjectionMatrix = false, this is the default ‘fast’ method useProjectionMatrix = true, this is the method where projection is done by a matrix Note that...
Apr 28th
March 2009
2 posts
Counter feedback
This week, request-log-analyzer obtained its 100th watcher on GitHub! Bart and I have worked hard to make r-l-a a useful product for many people in various situations. The fact that more than 100 people are following the project’s progress and that at this moment, the gem has been download almost 200 times, shows that we are somewhat successful in this regard. Numbers like these, in...
Mar 28th
Floorplanner API, ASP.NET and Authorization
For those struggling to (Basic) authenticate (as I have been…) with the Floorplanner API using ASP.NET, here’s a snip to get you going: VB.NET: ' This snip shows how to add a new user, ' see floorplanner.com/api for details Dim uri As Uri = new Uri(ADD_USER_URL) Dim request as HttpWebRequest = CType(WebRequest.Create(uri),HttpWebRequest) ' Build XML for the POST body (in this case...
Mar 13th
February 2009
5 posts
Creating a REST API for a Flash application
We have been working hard to implement an XML-based REST-style API for Floorplanner and some of our partners are using it already to access their users and plans. We now have started to use this API ourselves. The Floorplanner Flash application communicates with our servers to load and save projects and designs. The backend for this functionality used to be written in PHP. Eliminating this PHP...
Feb 25th
Umair on Constructive Capitalism
This might be a little off topic, but I found it interesting enough to share it with you all. It’s about the future of capitalism: Constructive Capitalism through the principles of Renewal, Peace, Equity, Meaning and Democracy.  It’s a presentation Umair Haque gave at Daytona Sessions last month. Umair Haque is Director of the Havas Media Lab, a new kind of strategic advisor that...
Feb 20th
Write JAVA, publish SWF
Ted Patrick (Senior Manager Developer Communities at Adobe Systems) has posted an interesting article about the first milestone of the Eclipse E4 project. It seems that the SWT project has added compilation support for SWF from JAVA. Write your app in JAVA and publish as SWF to Flash Player. The cool part is that you get full JAVA development in Eclipse with all debugging and tooling but you get a...
Feb 15th