I'm waiting for a blood test and I'm "customer number 649", and they are currently processing "customer number 541". I have dubbed this place Franz Kafka Memorial Hospital.
Anyway, I have an hour or two to kill, so writing this quicky on my phone.
Last week on the CFML Slack Channel we piloted the notion of a Friday Puzzle. It went quite well, so we're continuing it. Don't be put off by the fact it's the CFML Slack Channel: we actively encourage our community to use any language they like, or different languages from usual, as it's a good way to improve one's skills as a programmer. I'll be doing this week's one in PHP. And maybe diversifying from there into something else.
This week's puzzle is as follows (in summary):
Challenge:
Convert a flat representation of a hierarchical data into a nested tree structure.
[...]
dataset:
id parentId nodeText 1 null File 2 1 New 3 2 File 4 2 Folder 5 null Edit 6 5 Copy 7 5 Cut 8 5 Paste 9 null Help 10 9 About
Expected result:
[ { nodeText : "File", children : [ { nodeText : "New", children : [ {nodeText: "File"}, {nodeText: "Folder"} ] } ] },{ nodeText : "Edit", children : [ {nodeText: "Copy"}, {nodeText: "Cut"}, {nodeText: "Paste"} ] },{ nodeText: "Help", children : [ { nodeText: "About"} ] } ]
I've omitted the rules and expectations and stuff. Full details are on the Slack Channel. You can sign-up at: http://cfml-slack.herokuapp.com/;
Give it a go!
Oh... And they're now processing customer 585.
Righto.
--
Adam