MongoDB usage notes (2)

Continuing prior notes from here.

Drop a database:

use databasename

List distinct property values across all docs:


Remove docs in a collection – param is a doc query. If empty doc, removes all docs:


Date range query using $gt and $lt for a range:

db.collectionname.find({ "timestamp" : { "$gte" : ISODate("2014-07-08T19:50"), "$lt" : ISODate("2014-07-08T19:52")  } })

[in progress]

(Page views: 12)

MongoDB Java Driver notes

A few notes on using the MongoDB Java Driver API:

Getting a connection:

MongoClient client = new MongoClient("localhost", 27017);
DB db = client.getDB("test");

Get a collection from connected db:

DBCollection collection = db.getCollection("example");


Find all docs in collection and iterate through results:

DBCursor c = collection.find();
try {
   while(c.hasNext()) {
} finally {


Simple findOne query, matching a doc with properyname = value:

DBObject result = collection.findOne(new BasicDBObject("propertyname", "value"));


Find all, sort on property ‘example’ ascending (1=asc, -1=desc), and limit to 10 results:

DBCursor c = collection.find()
    .sort(new BasicDBObject("example", 1))


Serialize results of a cursor to JSON (tip from here):

JSON json = new JSON();
String jsonString = json.serialize(c);

(Page views: 11)

WildFly 8.2 WELD-001408 Unsatisfied Dependencies error

If you see an error like this:

WELD-001408: Unsatisfied dependencies for type [typename] with qualifiers @Default
at injection point [BackedAnnotatedField] @Inject [propertyname]

… then you’re probably missing a default beans.xml file to initialize CDI in the container. The file doesn’t need to contain anything else than this:

<?xml version="1.0"?>
<beans xmlns="" xmlns:xsi=""
xsi:schemaLocation="" />

and drop it in /META-INF/ or /WEB-INF/

More info here and here.

(Page views: 14)

AngularJS Tutorial – notes (1)

Random notes from following through the AngularJS tutorial here.

My first time (several months back) working through part of the tutorial I struggled getting node.js up and running on Windows. Useful thread and comments on this post here.

Installing on Mac OS X, no problems.

Useful Tutorial Steps – Tools Install and Setup

(not intended to be a comprehensive set of steps, just mainly for myself to backtrack and see what I’ve done so far in the tutorial)

Install git (already have)

Clone the tutorial source project:

git clone --depth=14

Download and install node.js from here.

npm install – install the development tools.Note: the tutorial is not specific where you run this, but you must run this inside the clones angular-phonecat dir.

Useful scripts setup with the tutorial project:

  • npm start : start a local development web-server
  • npm test : start the Karma unit test runner
  • npm run update-webdriver : install the drivers needed by Protractor (run this once, and first before running Protractor)
  • npm run protractor : run the Protractor end to end (E2E) tests

Interesting note: no issue with the default config on Mac OS X and running the dev server on port 8000. This was an issue on my Windows machine and needed to change the default port to something other than 8000.

Errors Starting npm run protractor

All the other scripts ran first time for me, but protractor would not start, giving an error about ELIFECYCLE. Seems similar to this issue. I ran these to steps:

npm update
npm run update-webdriver

but then the error changed to something more verbose, about couldn’t find an .exe file:

util.puts: Use console.log instead
Using ChromeDriver directly...
[launcher] Error: Could not find chromedriver at /Users/kev/angularjs/angular-phonecat/node_modules/protractor/selenium/chromedriver.exe

A quick Google found this issue, and the steps described by jpaljasma fixed the issue:

  • edited package.json in the root of the tutorial project, changed devDependencies.protractor to be “*”, removed node_modules, ran npm install and npm run update-webdriver

Now the e2e tests supplied with the project run as expected.

(Page views: 18)

UK Computer Games Industry – History Documentaries

Early 80s in the UK was prime time for the 8bit home computer games industry. I posted a few links of some interesting computer history documentaries on YouTube a while back, including the TV Drama ‘MicroMen’ which covered the rivalry between Clive Sinclair and Chris Curry at the time.

Here’s a couple more:

(Page views: 77)

Amateur Radio Packet – Using Outpost with a software modem

My current packet setup is using the UZ7HO modem software – it seems to work pretty well, and as a software based packet modem it seems to work better than AGWPE since that seems to be a bit temperamental.

I’ve been experimenting using Outpost as a message client via UZ7HO. In the settings (Setup/TNC) on the AGW tab, you can enter an IP address of where your AGW software is running. This is an easy option to connect Outpost with UZ7HO since it can run in network mode. I also typically run a laptop running UZ7HO in my office where my radio is, and then I can connect to it from elsewhere in the house on another laptop.

The first issue I’ve noticed is that if I already have a terminal connected to UZ7HO remotely using my regular call, I can’t connect with Outpost using the same call. I guess this makes sense, and this is where the use of the ‘-number’ suffixes comes in that you commonly see on packet. This is what the error in Outpost looks like if you try and use the same call with no unique suffix:

3/4/2015 10:21:18 PM -- (N2) AGWPE Registration failed. Check for: 1. missing or invalid remote logon/password 2. station ID already in use by another AGWPE application

Ok, so to fix this you could put a number suffix on your call, but then when you connect to a local packet BBS to pick up messages, this doesn’t work as it appears to look for message sent to that matching call+suffix, so I’m guessing the callsign you configure in Outpost really does have to be your real callsign. This means you have to close any other connected terminal apps that you are running at the same time, or, configure the terminal to use a suffix on your call (maybe that makes more sense).

The next issue I’ve run into is that when I connect to a BBS using a terminal app directly, I have the ‘OP’ setting (‘output pause’, I think) set to some sensible number, like 10 lines, so I get the continue/cancel prompt when reading messages, or listing the messages on the BBS. It seems Outpost doesn’t know how to handle this, and will pause forever on message download, eventually timing out and disconnecting. There might be another way to configure this, but the only way I’ve found so far is to connect to the BBS directly, set ‘op 0′ and disconnect. Now when Outpost next connects, it downloads all your messages without interruptions.


(Page views: 103)

The computer on the shelf in WarGames

I’ve just finished reading the first 3 chapters of Fire in the Valley, a history of the development of the PC. These first chapters were history prior to development of the Altair (which was before my time, but I’m familiar with the history), and centered on IMSAI and development of their 8080 computer.

Not having any personal experience with an IMSAI these first chapters were rather dry and slow going, but on the last page of chapter 3 it mentions IMSAI’s one and possibly only claim to fame was that an IMSAI 8080 was used as a prop in the background of WarGames when Matthew Broderick’s character was seen using his computer at home. Given that WarGames is one of my favorite films, this suddenly brought some conext and interest to this first part of the book. I always though that was an Altair on the shelf in the background, but apparently it’s an IMSAI 8080. More info on their site here.

(Page views: 100)

Java Posse Podcast – now officially ended!

If you spotted this post on the Java Posse’s Google Group, then you might have already seen this link to a photo on Twitter from Devoxx 2014. If you were at Devoxx 2014 and attended the live Java Posse session, then you already know this too. Of course, if you regularly listen to the podcasts then you would have noticed that the regular podcast sessions dropped off noticeably last year.

The Java Posse’s final podcast session (#461), recorded from Devoxx 2014 is now live on their feed.

I’ve listened to the majority of their podcasts (and the early Javacast episodes) since the first sessions in 2005, it’s definitely the Java related technology podcast that I’ve listened to and followed the most, and so it’s sad that the guys have finally decided to call it quits and not continue the series any more.

Thanks to the guys for producing the session all these years, you’ll be missed!

So where are they now?

What am I listening too now? I’ve listened to a couple of episodes of the Java Pub House, which is ok, and on my todo list is Java Enterprise Newscast. But I don’t think you can replace The Java Posse. Thanks again guys, and good luck in your other endeavors.

(Page views: 170)