Nvidia drivers on Windows 10 Insider Preview

I’ve installed the Windows 10 Insider Preview, but after installation the display driver was just a generic driver, and I couldn’t increase my resolution to the 1920×1080 on my LG monitor.

Nvidia have Windows 10 drivers available, but when I ran the installer it said that my GeForce 6150SE was not supported. In other posts elsewhere, someone suggested to just use the latest Windows 8 driver. The latest driver for the 6 series is here. I downloaded it and ran it, and everything looks good, it even detected the highest resolution for my monitor and set it for me. Very cool!

First thoughts on 10? The Spartan browser crashes randomly, it just closes without any errors, When it is open and running, page rendering seems pretty snappy, although rather than showing a progressive page load of elements, it seems to be rendering everything in the background and then swapping in a fully loaded page when it’s ready. At least that’s what it appears to be doing. Rather than seeing a page progressively load, pages delay for a while and then instantly appear. Not sure if I like that approach.

The new Start menu with the Metro tiles embedded in it is one approach to keep the Metro stuff around if that’s your thing, but moving it into the Start menu instead of a full screen. Maybe a better approach would be to just throw that stuff away and go back to a normal looking Start menu. Do I need to see news headlines in my Start menu? No. If I want to see news do I want to have it pop up in a tiny unreadable tile in the Start menu? No. Terrible idea if you ask me. Seems like MS really doesn’t want to do away with the Metro UI. “Ok, so we’re not removing it, so where can we put it?” … “I’ll let you put it in the Start menu” … “Really? That’s terrible, but ok then”.

Creating test data in MongoDB using node.js

I need to create a fairly large number of test documents in my MongoDB to test some functionality that will be retrieving pages of data, ordered by date.

Rather than doing this by hand, using the Node.js driver for MongoDB makes this pretty easy with only a few lines of code. This is a starting point, in my case I need to add some additional logic to increment a date value and create some other random values on each doc, but this is a rough outline of an approach:

Assuming Node.js already installed, install the MongoDB Node.js driver with:

npm install mongodb

Then the code to install multiple docs in one shot looks something like this:

[code language=”javascript”]

var MongoClient = require(‘mongodb’).MongoClient,
test = require(‘assert’);

var ObjectId = require(‘mongodb’).ObjectID;

MongoClient.connect(‘mongodb://localhost:27017/databasename’, function(err, db) {
test.equal(err, null);

var col = db.collection(‘collectioname’);
var docs = [];

//update this for how many docs to insert

for(i=0; i<10; i++){
docs[i] = {a:i}; // create doc here using json
}

col.insertMany(docs, function(err, r) {
test.equal(err, null);
console.log(r.insertedCount);
db.close();
});
});

[/code]

Run the script with:

node scriptname.js

Additional info in the MongoDB Getting Started Guide for node.js.

Testing for an empty JSON document

I have a RESTful service that performs a search and returns the results as JSON, and if there’s no results I return an empty document, {}.

Calling this search from AngularJS with $http.get(), I get the returned JSON result and everything is good if I have a document containing data, but an empty document took a bit more Googling to work out how to detect it.

From this similar question, I don’t want to use jQuery in my AngularJS app if I can avoid it (although doesn’t AngularJS have a “jQuery lite” api that maybe I can use?), so I used this approach instead:

[code]
if(Object.keys(data) == 0) { … }
[/code]