Office365 and SharePoint iPad Friendly

I have been doing some work for a company who have a user base who primarily use iPads to access the SharePoint site. There was a requirement to allow those users to easily access the team site without getting their screens filled with the quick launch and the bloated title.

Initially, I solved this using by using JavaScript to set the page to full screen;

window.onload = function () {

    //alert('has loaded');
    SP.SOD.executeOrDelayUntilScriptLoaded(goToFullScreen, 'sp.js');
    // For use within normal web clients
    function goToFullScreen() {
    	//alert('goToFullScreen');
    	var isiPad = navigator.userAgent.indexOf('iPad') != -1;
    	if(isiPad) {
    		setTimeout(goFullScreen, 500);
    	}
    }

    function goFullScreen() {
    	SetFullScreenMode(true);
    }

    SP.SOD.notifyScriptLoadedAndExecuteWaitingJobs("sp.js");

};

The problem with this approach was the short delay from the page loading to the screen resizing to remove the side bar etc which was undesirable.

I was asked to find a better way to remove the menus that was more instantaneous so I turned to css media queries.

To achieve this, I looked at what the SharePoint SetFullScreenMode function actually did. I found that in addition to setting the cookie, it also applies the ms-fullscreenmode css class to the body element, which led me to the following CSS in the master page;

<style>

	@media only screen and (min-device-width: 768px) and (max-device-width: 1024px){

		#navresizerVerticalBar{
			display:none;
		}
		#navresizerHorizontalBar{
			display:none;
		}
		#s4-titlerow {
			display:none !important;
		}
		#sideNavBox {
			display:none;
		}
		#contentBox {
			margin-left:40px;
		}
		#contentBox {
			margin-left:0px;
		}
	}
</style>

TMA470 first assignment returned

I got the result and feedback for the first assignment of the final Open University project today. Its been a long week waiting for it, not least because a significant number of others on the course have been reporting back very low marks.

The difference with TM470 assignments is that they are a little more wooly in what is required. For the past 3 years, the assignments have been a series of questions that need answering in a specified order and within a specified structure. With this course we’re expected to guide the project, determine what is relevant for the content of the assignment and hope that we got it right.

I eventually got my mark, 60%. It’s work 5% of the overall module so it can be used as a learning experience. The tutor did give me some good feedback which will help when writing the next assignment for the middle of April.


OU Final project finally started

At the eleventh hour I finally settled on the project that I am going to be working on for the next 8 months. I had previously intended to work on a project that would allow me to play with some javascript graph layout and visualisation libraries. Unfortunately this intention didn’t have enough of a clear direction to make it a solid proposition for a successful project.

So, the project I’m working on is based on my dad’s job in modern tram systems. The focus of the project will be to provide a software library that can be used to assist in the validation of chose routes for a tram system. Basically a route is made up of a series of segments that can be straight, curved or a transition from straight to curved. Along the route there may be platforms, crossing, traffic lights etc but essentially these three segment types cover most of it.

When a tram is travelling through a curve there are a number of factors which dictate the speed the tram can travel. Sections of track may have environmental factors which dictate a maximum speed (eg; an area of high pedestrian traffic). The library will seek to provide a journey time for each type of tram through the route by calculating the permissible speed through each segment of the route.

I’ll update as I go, you might think its a dry subject, however the calculation logic should make for some interesting challenges.


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.