First attempt at a Force Directed Graph

For the final project of my open university degree I am looking at creating an application to bring together a proprietary dataset of information about available workers and cross it with social media data.

The project is in the early stages (very early) but I started playing with the graphing capabilities of D3 and some random data I made up about employees and their links.

I’m sure there will be more to come, but this is what I have so far.r

Example network diagram

var width = 960,
height = 500;

var color = d3.scale.category20();

var force = d3.layout.force()
.charge(-120)
.linkDistance(50)
.gravity(0.1)
.size([width, height]);

var svg = d3.select("#example").append("svg")
.attr("width", width)
.attr("height", height);

d3.json("contacts.json", function (error, graph) {
force.nodes(graph.nodes)
.links(graph.links)
.start();

    var link = svg.selectAll(".link")
        .data(graph.links)
        .enter().append("line")
        .attr("class", function (d) {
            return d.type;
        })
        .style("stroke-width", function (d) {
            return Math.sqrt(d.value);
        });

    link.append("title")
        .text(function (d) {
            return d.type;
        });

    var node = svg.selectAll(".node")
        .data(graph.nodes)
        .enter().append("circle")
        .attr("class", "node")
        .attr("r", getRadius(d))
        .style("fill", function (d) {
            return color(d.type);
        })
        .on("dblclick", dblclick)
        .call(force.drag);

    node.append("title")
        .text(function (d) {
            return d.name;
        });

    force.on("tick", function (e) {

        var k = 6 * e.alpha;
        graph.links.forEach(function (d, i) {
            d.source.y -= k;
            d.target.y += k;
        });

        link.attr("x1", function (d) {
            return d.source.x;
        })
        .attr("y1", function (d) {
                return d.source.y;
        })
            .attr("x2", function (d) {
                return d.target.x;
        })
            .attr("y2", function (d) {
                return d.target.y;
        });

        node.attr("cx", function (d) {
            return d.x;
        })
            .attr("cy", function (d) {
                return d.y;
        });

    });

    force.drag()
        .on("dragstart", dragstart);

    function getRadius(d) {
        switch (d.type) {
            case "company":
                return 15;
            case "manager":
                return 10;
            case "person":
                return 5;
        }
    };

    function dblclick(d) {
        d3.select(this).classed("fixed", d.fixed = false);
    }

    function dragstart(d) {
        d3.select(this).classed("fixed", d.fixed = true);
    }

});

DIY Plyo box

Since November 2013 I’ve been working out in my garage with a cross trainer and timed interval training.

I did have a membership to Virgin Active, but between my commute, Open University degree and family I just don’t have time to get there. Having the garage I can go straight in there when I get in from work and get up in the morning.

I’ve recently found a need for a plyo box but didn’t want to spend upwards of £60 for one when I figured I could probably build one.

It was quick to make and very easy… I used a sheet of 18mm structural plywood 1200 x 2400mm from B&Q, going at 7pm on a Friday meant that the guys in on the cutting machine didn’t mind cutting my exact dimensions.

2 x 700x600mm
2 x 500x566mm
2 x 700x500mm

The prefer you to have an idea of the specifics of your cuts and it helps if you’ve already taken into account the 3mm blade width requirements. The guy who cut mine even overlooked my cut count exceeding the free limit.

When I got it home, it was just a case of gluing the sides together, clamping and putting a load of screws in then gluing the top and bottom and screwing together. Whole thing too about 30mins to put together and now I can jump at different heights, tricep dip off it and lots of other body weight exercises.

I also put up a pullup bar this weekend, but the less said about that the better.


rhn_register crashes while starting

I’m setting up a tactical farm of Linux servers on some desktops till we can get the permanent kit installed in the data center.

The new servers are running on trader desktops so they’re reasonably good kit. Too satisfy security requirements we need to use a customised build of Red Hat 5 and I’m on the last of the 6 machines.

While trying to run rhn_register on this last machine, it kept starting then crashing straight away with no really error. I dug into the log file and found the following error.

FatalErrorWindow(screen, e.errmsg)
exceptions.AttributeError: SSLCertificateVerifyFailedError instance has not attribute 'errmsg'

I’m sure you’ll agree that from this exception it’s obvious what the problem is? No? Well chances are, its the datetime of the machine. In my case it thought it was 24th October 2010.

A quick date -s and all was sorted.


SharePoint 2010/2013 Developer Dashboard

The SharePoint developer dashboard, when switched on, will render at the bottom of the page in SharePoint 2010 and appear as an icon in the top right hand corner of SharePoint 2013. If the DisplayLevel is set to OnDemand for SharePoint 2010 then the behaviour will be as SharePoint 2013, that is the developer dashboard will be visible at the click of the icon on the ribbon.

SharePoint Developer Dashboard

####Activating in PowerShell

$d = [Microsoft.SharePoint.Administration.SPWebService]::ContentService.DeveloperDashboardSettings
$d.DisplayLevel = 'OnDemand'
$d.TraceEnabled = $true
\$d.Update()

####Activatin using command line and stsadm

stsadm -o setproperty -pn developer-dashboard -pv OnDemand

Partitioning a large disk in RedHat

For the project I am currently working on, we have an order for a Hadoop Appliance from our supplier to be placed in the Mega Data Centre for processing all of our log files. The order is in, but with all the red tape its going to be a while before it’ll be up and running.

In order for this delay not to impact the project, we’ve been given dispensation to host a small cluster of machines running Cloudera in one of the local server rooms. This will give us our processing capability while we wait for the main appliance to be commissioned.

This week I’ve been installing the corporate approved build of Red Hat onto the old trader spec desktops that we’ve managed to get our hands on. Its basically standard Red Hat Enterprise Server but with some slight modifications made to harden it.

We have bought 3TB disks for the data storage in these boxes, given their size they’re using GPT partition tables and initially it’s been difficult to get fdisk to partition the disks correctly. In the end, the following steps were all that were needed to get things working and create the 3TB partition.

\$ fdisk -l

# find the correct device name, in my case /dev/hdc

\$ parted /dev/hdc1
(parted) mklabel gpt
(parted) unit TB
(parted) mkpart primary 0 3

# check the partition

(parted) p
(parted) quit
\$ mkfs.ext4 /dev/hdc1