Ideas Into Software

Musings on writing code

Fine-Grained Reactivity Via Mongo Projections

MongoDB's find method allows us to specify a projection, i.e., what fields should be included in or omitted from the result set. Meteor, connected to a database on both the server side and client side, can benefit from using projection in two major and different ways. Published Cursor Projection (Server-side) The benefits of using projection on a published cursor

How To Crash Your Meteor Server: Unlimited Cursors

When it comes to determining what goes where from the server, Meteor does some pretty cool optimisations to be fast and effective. Yet, I’ve found in certain special cases - especially if you’re deploying to RAM-tight environments such as Heroku or DigitalOcean - it can be surprisingly easy to kill your server if you’re not a bit

Opting Out of Contenteditable Reactivity in Meteor

It's a sad fact that Blaze (Meteor's reactive UI library) doesn't play particularly well with contenteditable elements. The corresponding ticket in GitHub is marked as closed but the issue itself is unfortunately far from resolved. This makes implementing e.g. autosave for contenteditable elements quite annoying - say you're throttling the keypress event and saving every two or three seconds.

Git: Detached HEAD State For Dummies

Alright, let's call things as they are: Git can be intimidating. Or, well, downright scary. Zillions of flags and oh-my-goodness-look-how-many configuration options! Consider git push - you can't even tell what it does unless you look at your git settings. For experienced developers, people with PhD in rocket surgery or power users: nirvana. For others: muddy pool full of crocodiles.

Limiting Parallelism In Meteor

In the latest blog post we've touched the topic of parallelism in the Meteor framework using node-fibers. We've shown how to do multiple HTTP requests at the same time. As we've seen, unbounded parallelism in Meteor is relatively easy. There are, however, cases when you wish to limit the degree of concurrency (akin to async's eachSeries). For example when issuing

Parallel Execution In Meteor

Meteor's async execution model is based on fibers which is essentially a patch to V8 providing blocking calls making it somewhat harder for a programmer to release zalgo. Fibers work in a way similar to ES6 generators/coroutines (even though generators are syntactically more explicit); when an asynchronous call is made, the running fiber voluntarily gives up execution, suspends and