Snowflake

Random ramblings about random stuff

HTTPS!

This blog now supports HTTPS connections, thanks to the Let’s Encrypt initiative!

Monitoring your node.js (with Express) application using websockets

I’m currently developing a node.js based application and I need to deploy it on a cluster where I can’t obtain console logs from. While I develop and test on my local computer, there are always things that can go wrong on the cluster (for example caused by differences in software versions).

So I quickly threw some components together that allowed me to follow my node.js app logs in real time. Nothing special at all, but possibly interesting for someone who wants to do the same.

(more…)

Almost there!

I’m currently working on my final papers for college. It has already been three years – next month I will be graduating. It seems odd that it has been so long, I can recall the day I started as if it were yesterday. Anyway that’s all :P

Dynamically accessing data fields in LINQ using Expression trees

For a certain project I’m working on I needed a way to filter data in a LINQ query (LINQ to Entities) based on input given by the user. The user has to be able to select a certain property and compare that to given values.

The property names are fetched from the entity class using reflexion and listed in a dropdown input control. The next step would be to somehow use the selected value in my LINQ query as a property name. That however didn’t seem to be so trivial at first .. until I discovered expression trees.

Expression trees allow you to build expressions in the same way that you can use Lambda to build expressions but on a more verbose/dynamic way. It allows you to continue where lambda expressions can’t go thus giving you much more power.

(more…)

Rendering fractals using CSS3 and HTML (without the help of JavaScript)

Screen Shot 2015-01-26 at 14.56.45

Some time ago I was captivated by the capabilities of CSS3. Although I didn’t (and still don’t) like designing websites and messing around with CSS (seriously, who likes spending hours trying to center objects properly) I noticed that the language itself had quite some power. That was when all sorts of mad ideas started popping in my head. Would it be possible to create a turing machine with only CSS and HTML? Could you program Tetris with it that way? What about rendering fractals, would that be possible?

Regarding the Turing machine, I haven’t successfully gotten that to work (I’m lacking a way to access (and store) data easily, it would help if I could use the attr method on alternate attributes other than data). In any case, I did manage to render some (simple) fractals.

Many fractals are defined in function of themselves, in other words they are recursive. CSS rules can be applied to children of a HTML object that already have the rules applied. If we build a specific HTML node tree, we can achieve some sort of semi-recursion.

(more…)