Month: January 2014

Microsoft’s Task Parallel Library and the principle behind node.js

I wanted to see how Microsoft’s Task Parallel Library compared with node.js in so far as passing the next method in to the current to chain the calls indefinitely. So I created a method that iteratively adds itself to the current executing Task. The initial test was to see if the code would fail with a StackOverflowException but what I… Read more →

Sql Server Shrink Log File

Easy with Simple Recovery DBCC SHRINKFILE (“<FileName>_Log”, 1); GO otherwise USE AdventureWorks2008R2; GO — Truncate the log by changing the database recovery model to SIMPLE. ALTER DATABASE AdventureWorks2008R2 SET RECOVERY SIMPLE; GO — Shrink the truncated log file to 1 MB. DBCC SHRINKFILE (AdventureWorks2008R2_Log, 1); GO — Reset the database recovery model. ALTER DATABASE AdventureWorks2008R2 SET RECOVERY FULL; GO Read more →

node.js calling multiple web services in parallel var http = require(‘http’); // Add helloworld module var helloworld = require(‘helloworld_mod’); http.createServer(function(req, res) { res.writeHead(200, { ‘Content-Type’ : ‘text/xml’ }); try { // Bypass function call to “Google Maps API” getFromGoogle(req, res); } catch (e) { res.end(“Try again later”); } }).listen(1337, ‘’); console.log(‘Server running at’); console.log(‘Type the URL in address bar’); console.log(‘’ + ‘address=1600+Amphitheatre+Parkway,+Mountain+View,+CA&sensor=false’); function getFromGoogle(mainreq, mainres)… Read more →

Extract details from an Expression

I wanted to come up with a way of establishing the type name and property name when applying general validations within my code. So, for example for this validation:. var bool = Requires.IsNotNull(user.lastName) I have to explicitly code the exception: throw NullReferenceException(“User.lastName”) What I’d like is for all this to happen when I declare the test, without double typing the… Read more →