Showing posts from July, 2013

Anonymous Functions vs Named Functions for Node.js

I am a fan of anonymous functions, it just makes like easier and I find the syntax of passing functions around more expressive. Only problem I have found though is that when you have a bug, anonymous functions can give you a bit of a headache when tracking down what went wrong.

In the first example createServer is passed an anonymous function that gets called back. If something goes wrong you the error message is something like:

C:\Node\imageshare\server.js:14         route(pathName);         ^ TypeError: undefined is not a function     at Server. (C:\Node\imageshare\server.js:14:9)     at Server.emit (events.js:70:17)     at HTTPParser.onIncoming (http.js:1610:12)     at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:91:29)
    at Socket.ondata (http.js:1506:22)     at TCP.onread (net.js:374:27) Which although is easy enough to track down in this example, you can see that the name of the function is not listed because it doesn't have one... Server.. As the pr…

Time for PC power boost

I have been having problems with my current SSD randomly hanging for some time now. Its been giving me some real jip but I haven't done anything about it. It only really came to a head when I had an emergency that meant I had to remote onto my PC. Problem was my PC had crashed. Oops.

The other problem is, even with extra hard disks storing most of my program files, the 128gb SSD I have just fills up constantly.

With this in mind, the new 256gb SSD and 16gb ram should help! Pow!

I plan on installing Windows Server 2012 as the base OS and then virtualising all my bits and bobs such as IIS, SQL Server, Linux stuff. Hopefully this should keep my main computer nice and clean and will allow me to move my virtual computers next time I need to do a reset.