Skip to main content

Posts

Showing posts with the label javascript

Getting the last column to fit to available space in slickGrid

I wanted a quick diagnostics page in html / js and this included grid to show server logs, decided to use slickGrid . All pretty easy to use apart from one thing - last column to fill remaining space... Nothing in their examples, so here's one for posterity... Not sure if it's the preferred way, but it works - the most obivous issue for is doing a DOM search to get the Viewport element - this is tightly coupled to the current latest release. Stuck the implmentation in a Class and not provided any logic for creating Data, Columns or other grid optnios / plugins - tried to keep it simple...

Integration tests written in .Net using locally hosted node.js server

I've blogged before about hosting web services created with Web API inside a test fixture in .Net, what follows is the same idea but in this case hosting a node.js implemented web service, this is using the node.js server I created in this previous post. Jumping straight to the solution this is what I came up with: As you can I've managed to reduce the amount required to be specified for each test fixture to 3 parameters: working directory for node.js server, full path to the node executable,  node server name and any arguments (note the port number). The implementation detail has been pushed into the base class - WebServiceIntegrationFixtureBase. Before showing the implementation for this class, the test runner & fiddler outputs are shown below: The base class implementation is shown below, as you can probably guess this uses the Process class from the System.Diagnostics namespace: Loading .... As you can see there isn't much going on, the...

Building mock web service in node.js instead of Web API

I needed to build a mock back-end web service this week because the middle-ware team wasn't ready (they're useless standard Java 'enterprise' developers) and @Jason challenged me to write it in node.js . He showed me an example of how this was done before and said it shouldn't take more than 5 minutes to have something up and running, I've done this kind of requirement previously in Web API and thought it would be interesting to finally do 'something' in node. All coding contexts have been changed to protect the innocents :) The requirement was for a web service returning JSON defined resources and the idea was to map the request URL to the local the file system, where the actual content to be returned is contained in a *.json file and the actual file-name represent the HTTP code to be returned, some examples are show below: 'http://localhost:1008/examples/user/1' maps to 'd:\work\node\resources\user\1\200.json' 'htt...

Playing around with jasmine

I believe like a lot of devs that javascript is going to become more prevalent in a lot if not all areas of application development, whether that be with a server side framework like  node.js or client side with frameworks like backbone.js & knockout.js . I've built a couple of sites with backbone and I'm very interested in what Derik Bailey is doing with marionette , but with all my investigations into backbone I haven't as yet put any of the javascript I've written under as serious testing strategy. A quick search for a BDD style testing framework lead me to jasmine , I've heard good things and I thought I'd give it ago. What to put under test with jasmine? Previously I implemented a simple undo-redo framework for .Net called  undoable.net , this was pushed out to GitHub and I thought I'd port this to javascript. The important issue here is not the ported-code but how easy I found it to get jasmine up and running. First off downloaded...