Constraining images with CSS

Small details make a big difference to websites. It’s never a good look when an image is larger than its container. Fortunately, it’s very easy to fix.

Responsive websites are great; mobile-first websites are even better. However, they do sometimes present frustrating issues. One issue which props up on a fairly regular basis is the issue of images – more specifically, a question along the lines of:

Why don’t my images fit on the page?

It’s a simple question really – if text can adapt to fit on a smaller screen, why do images sometimes insist on maintaining their original size? The answer is very simple.

Here’s a fairly average piece of code for an image:

<img src="image.png" alt="Image" width="800" height="200">

When displayed on a website, that image will display at a resolution of 800 pixels wide by 200 pixels high. If you’re using a screen with a lower resolution, the text will be scaled down and the image will dwarf the rest of the content. That’s because, without any other information, the browser doesn’t know any better.

So, to get around it, you need to add the following CSS:

img {
 max-width: 100%;
 height: auto;
 }

This does two things. First, it constrains all images to the maximum screen width. If that is 320 pixels, that’s the size the image will be scaled to. Second, it constrains the image height proportionally, so the image doesn’t look like it’s been squished.

So, what if you need to constrain not just images, but videos, and possibly more besides? Easy. Change your CSS to this:

.constrain {
max-width: 100%;
height: auto;
}

Now, you can use the .constrain class on any element and it will be constrained to the intended width.

Setting a static IP address in Ubuntu Server

Networking takes care of itself in Windows, and static IPs aren’t very hard. But how do you set a static IP address in Ubuntu Server?

I’ve used Linux regularly for more than ten years. For the majority of that time, I’ve used Ubuntu, although I’ve also dabbled in Fedora (without much success) and CentOS (with marginally more).

I’m generally comfortable with Linux and when I’m not, I usually know where to look. However, if there’s one thing I always seem to have issues with on Linux, it’s networking.

When I first used Ubuntu, it was often a struggle to get any usable networking. After a while, it was just wireless (mainly WPA) which caused an issue. Latterly, the main issue I’ve encountered is networking with virtual machines (and most of those issues have been with VirtualBox – VMware doesn’t seem to encounter the same issues).

If you’re working with a server, you’ll want to set a static IP address. Once working, this makes things much easier than using a dynamic address.

If you use Ubuntu Desktop, you can edit these settings very easily from your control panel, but on Ubuntu Server you’ll need to use the command line.

In Ubuntu, your network settings are stored in /etc/network/interfaces. To edit the file, enter nano /etc/network/interfaces in a command line (or, if you have a different text editor, like vi, use that instead of nano). This will open the file in a text editor. A sample file might look like this (comments removed):

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

So, what does that mean? Well, there are two interfaces. The first is the loopback interface. Leave that be – if you mess with it, things will break. Ubuntu uses that to communicate with itself.

The second is the eth0 interface. This is your network card. You may have more than one; if you have a second, it might be labelled eth1. Your network card have a completely different designation – on my VMware virtual machine, it’s labelled ens33).

The second line in each of those blocks sets those interfaces. The first lines (auto lo and auto eth0) tell Ubuntu to start those interfaces on boot. If eth0 wasn’t started on boot, the machine wouldn’t have any networking outwith the machine, which will cause you problems!

In the example above, and by default, Ubuntu uses DHCP, so the instance will allow your DHCP server (usually your router) to give the machine an IP address and set any other settings with it.

So, how do you set a static IP address? Well, it goes something like this:

auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.1.0
gateway 192.168.1.254
dns-nameservers 8.8.8.8 8.8.4.4

Line-by-line, that configuration does the following:

  • Sets Ubuntu to configure the eth0 interface on boot.
  • Sets the interface as a static interface (rather than DHCP).
  • Gives the interface an address (in this case, 192.168.0.10).
  • Sets a 24-bit subnet mask (so the network runs 192.168.0.1 – 192.168.0.255), and the network in the line underneath.
  • Sets the gateway (router) address. The address displayed is the one used by BT routers – others may use 192.168.0.1.
  • Sets the DNS nameservers to use. I’ve used Google nameservers in this example. You only need one for things to work, but it’s better to have at least two. You can mix them too – for better redundancy, you could use one Google namerserver and one OpenDNS nameserver.

A few quick notes:

  • Once set, you need to reboot the server for the changes to take full effect. Stopping and starting the networking interface won’t cut it.
  • If you forget to add the auto eth0 line and networking doesn’t automatically come up on boot, run sudo ifup eth0 That will manually bring up the inferface. Remember to fix your configuration afterwards!
  • If you don’t set your DNS nameservers, you’ll still have network access, but you won’t be able to resolve domain names. Thus, you will be able to ping an IP address would work, but pinging an FQDN would not work. You’ll eventually notice if this doesn’t work, because things like updates will fail.

This should be everything you need to know to set up a static IP address in Ubuntu.

2016-17 NFL Playoffs – Super Bowl

Roger Goodell can’t hide any longer. He has to see the Patriots tonight. The question is, does he have to hand them the Vince Lombardi Trophy?

The end is in sight. Only two teams are left fighting for the Vince Lombardi Trophy. Will it be the Atlanta Falcons, or the New England Patriots, who end up victorious in Houston?

One thing I have learned is that it’s not worth me picking against my predictor. Twice I’ve picked against mt predictor in the playoffs, and twice I’ve made the wrong call.

Picking the Patriots as the winners of the AFC Championship game was relatively easy, but my predictor correctly predicted the Falcons would see off the Green Bay Packers – and they did it very easily. The Packers’ defense couldn’t stop the Falcons’ offense, and the Packers didn’t generate much offense of their own for much of the game.

The Patriots, meanwhile, made mincemeat of the Steelers and were never really tested. I suspect the Falcons, with their ability to generate pressure upfront, and their much more potent offense, will do a better job in the Super Bowl. But will it be enough?

In truth, I don’t really know, but the stats suggest the Patriots are the more likely winners in this contest. Whilst the Falcons generate pressure, the Patriots are good at restricting opponents to field goals, whilst neither offense is easy to stop. It should be a great game.

The Patriots have won 6 out of 7 games against playoff opponents this season, whilst the Falcons have won 4 of 6. Both teams lost to the Seattle Seahawks. On the road, the Patriots were 2 of 2, whereas the Falcons were 1 of 2. The Falcon’s home loss was to the Kansas City Chiefs.

My own view is that it’s easier to see the Patriots putting up 30 points on the Falcons, than the Falcons putting 30 points up on the Patriots. And, whist the Falcons lead the league in points rank, the rank comfortably behind the Patriots on everything else.

For the Super Bowl, as there is no real home and road team, I designed a new predictor, by comparing home and road data for the two teams. I compared the following:

  • Average road scores
  • Average home scores
  • Average allowed road scores
  • Average allowed home scores
  • Comparisons of the above

I won’t bore you with the technical details, but if they’re evenly matched, they should win 6 games each in this table.

BasisRoadHomeR-PredH-PredWinner
NE-RPatriotsFalcons28.516.5Patriots
NE-HFalconsPatriots16.530.5Patriots
ATL-RFalconsPatriots3425Falcons
ALT-HPatriotsFalcons3037Falcons
NE-R-ADJPatriotsFalcons31.4525.9Patriots
NE-H-ADJFalconsPatriots26.530.25Patriots
NE-R-ADJFalconsPatriots32.128.6Falcons
NE-H-ADJPatriotsFalcons36.12529.5625Patriots
Road-OFFPatriotsFalcons28.534Falcons
Home-OFFAtlanta FalconsPatriots3730.5Falcons
Road-DEFFalconsPatriots16.525Patriots
Home-DEFPatriotsFalcons3016.5Patriots

As you can see, the Patriots win 7 times, the Falcons 5. So it’s not a big mismatch at all. What is interesting is margin of victory.

Without adjustment, the Patriots win on average by 13 points, whereas the Falcons win by 8.

If looking only on offense, the Falcons should win, by 6 points. If looking only at defense, the Patriots should win, by 11 points.

When making adjustments for the Super Bowl opposition, the Patriots win on three of the four scenarios. Taking the Falcons’ base averages at home and adjusting for the Patriots’ road averages, the Falcons lose, by 6.56 points. Which is funny, because the Falcons are the designated home team in the Super Bowl, if that matters at all… which I doubt.

Anyway, if you add up all these match-ups you get the grand total. So what does it say…?

It says the Patriots will win 29.54 – 26.84. So let’s call that 30-27.

My pick: Patriots.
Predictor says: Well, it doesn’t predict neutral games, but if the Patriots are the road team, it confidently predicts the Patriots by 5 points. If they’re the home team, it’s less confident, but it still picks the Patriots by 5.

I’m sure Tom Brady would settle for another Super Bowl ring, and picking up the MVP car from Roger Goodell and let Matt Ryan keep his league MVP award.

Roger Goodell? He might not enjoy that so much.

2016-17 NFL Playoffs – Conference Round

We’re left with four teams and one of the number 1 seeds has been knocked out – so who will make it to Houston?

In the Wild Card round two weeks ago, all four home teams won. Last week, only two of the home teams won, with both the Kansas City Chiefs (#2 in the AFC) and the Dallas Cowboys (#1 in the NFC) sent packing, by the Steelers and Packers respectively. So, can either of them repeat their road wins again this week?

First, let’s look at last week’s predictor predictions:

GamePredictionResult
Seahawks - FalconsFalcons by 9Falcons by 16
Packers - CowboysCowboys by 7Packers by 3
Steelers - ChiefsSteelers by a hairSteelers by 2
Texans - PatriotsPatriots by 22.5Patriots by 18

In the Wild Card round, my predictor picked all games correctly. Last week, it picked 3 out of 4 – that’s still a decent 7 of 8 so far in the playoffs. More importantly (to me), the margin of victory seems to hold up quite well.

It predicted the Steelers – Chiefs game would be very tight, and suggested the Steelers would win by a whisker. And they did.

It predicted the Seahawks would lost by more than a score – even though I tried to come up with reasons why that would be wrong. And they did.

It predicted the Patriots would win by three scores. And they did. Not that you’d think that from the media reaction after the game… I’ll come back to that.

It also predicted the Cowboys would win by a score, and they didn’t. The Cowboys’ defense looked awful in the first quarter, and that really cost them as they fell behind quickly. They did really well to recover, but that sideline catch to set up the winning Mason Crosby field goal was really something special.

Anyway, I’ll refer back to those games as we look at the Conference Round games.

Pittsburgh Steelers at New England Patriots

Make no mistake, the Steelers were up against a good team last week. The Chiefs have a good defense and an offense that whilst not explosive, is well-balanced and doesn’t often turn the ball over. It was always going to be a tough game. But they won it, and they played well.

That said, they scored six field goals and no touchdowns. For a team with Le’Veon Bell, Ben Roethlisberger and Antonio Brown, even up against a strong redzone defense like the Chiefs’, has to be a little disappointing.

It was the Chiefs’ lowest home score of the season, so the Steelers’ defense deserve credit, but offensively, the Chargers, Saints, Buccaneers and Titans had all gone to Arrowhead and scored more. To win at Gillette Stadium, the Steelers will need to turn some of those field goals into touchdowns. The Patriots allowed only 27 touchdowns in the regular season – ranked #2 in the NFL, behind only the Giants, so that’s not an easy task.

The Patriots won their game by 18 points. It says a lot that despite winning by three scores, their performance was questioned.

Let’s be clear. The Patriots never really looked like losing this game. Yes, as a Patriots fan, it was frustrating to watch, but the Texans didn’t ever look like winning. Don’t believe me? Let me remind you:

  • The Patriots took the lead with 9:27 left in the first quarter with a dump-off pass to Dion Lewis. After that, the Texans never got back on terms with the Patriots – the closest they got was 14-13 with 10:49 left in the second quarter.
  • The Patriots scored 34 points – that’s higher than their season average.
  • The Patriots allowed 16 points – their season average is between 15 and 16 points.
  • All Houston’s points came from turnovers (2 INTs, 1 FUM, for 13 points) or drives kept alive by penalties (a 15-yard unsportsmanlike penalty on what would have otherwise been 4th and 8, resulted in a field goal).
  • Brock Osweiler’s QB Rating was 47.6.

Essentially, the game looked closer than it was at halftime because the Patriots made uncharacteristic mistakes – yet they still led. So, in truth, anyone with a brain knew they would go in at halftime – leading by 4 points – and sort themselves out.

And they did. They came out in the second half, made fewer mistakes (except Dion Lewis, who kept coughing up the football), and outscored the Texans 17 – 3. When they Did Their Job, the game was over.

One thing they will have to watch this week is looking after the football. The Steelers recovered 10 fumbles in the regular season (10), and if New England has been bad in one area this year, it’s fumbling the football – they gave away 9, compared to the Steelers, who gave away only 3.

Normally, after fumbling twice in a week, Bill Belichick wouldn’t start you the next week. As Dion Lewis did that but also scored three touchdowns, it’ll be interesting to see what happens to him this week…

The key to the Steelers winning is to stop the Patriots scoring. I know, it sounds obvious, but they won’t win if this becomes a shootout. If their defense makes this a low-scoring game, it’ll be a proper slugfest. If not, they will probably struggle. Turnovers will be key.

So, let’s predict this one.

The Patriots are 5 of 6 against playoff teams in the regular season. The Steelers are 4 of 7. Of those, the Patriots are 3 of 4 at home, and the Steelers are 1 of 2 on the road.

The Steelers have a good road defense. They have allowed no more than 20 points in 6 of their 9 road games. They’ve also scored 24 points or more in five of their nine road games, but all five of those games were against teams that didn’t make the playoffs.

My predictor tells me that overall, these teams are ranked closely for this matchup. However, the Steelers have been inconsistent on the road, and so it predicts a Patriots win. With the Patriots in the top 5 for scoring offense, overall offense, passing offense, scoring defense and rush defense, and the Steelers not appearing in the top 5 on any official metric, it’s hard to disagree.

However, the Steelers are, according to my own rankings, the third-best team in the NFL, and top two of those teams still left in the playoffs. The problem? The Patriots are the number one.

Pick: Patriots.
Predictor: Patriots, with 50% confidence, by 10 points.

Green Bay Packer at Atlanta Falcons

Forget the hype: according to my stats, neither of these teams are as good as their AFC rivals – despite what the experts and fans say. Too many people have been too quick to say the winner of this game will win the Super Bowl. They may, but the stats say if they do, they’ll win as underdogs.

My ratings measure seven metrics, in addition to the overall home/road ratings for each game. On each of those seven ratings, the teams are ranked from #1 to #32, with #1 being the best. So, the best possible score for a team is 7. The worst possible score is 32*7, which is 224. So, what are the numbers for the remaining teams?

TeamScoreRankRelative
Patriots14110
Steelers29316
Falcons51620
Packers56724

Of the seven metrics – which are Overall Rating, Home Rating, Road Rating, Points For, Points Against, Points Difference and Cumulative Median (I’ll explain that one another time), the Patriots lead the NFL in 5, and the Falcons lead in 1. The Patriots and Steelers outrank both the Falcons and Steelers on 5 metrics.

The Falcons lead the NFL on Points For. Green Bay are #4, ahead of the Patriots at #5 and the Steelers at #13. The Patriots lead the NFL on Points Difference, followed by Atlanta (#2), Pittsburgh (#4) and Green Bay (#6).

The relative ranks between just the four teams left are also shown in the table above, but essentially, the categories suggest the AFC teams are stronger.

So, the key question then is, of the Packers and Falcons, which is stronger? To be honest, my rankings suggest they’re very evenly matched, and I’d agree with that.

The Falcons are a more balanced team, with a good running game, a great deep threat with Julio Jones (and plenty other receivers besides), and a defense which seems to be peaking at the right moment.

On the other hand, you have a Packers team which doesn’t have a brilliant defense (bad news when playing the Falcons, but which has Aaron Rodgers, who will undoubtedly find holes in the Falcons’ defense. So expect a high-scoring affair.

The Packers aren’t a great road team, but they’ve won so many games on the bounce now (the last three against playoff teams, and the last game against the #1 seed in the NFC), I can’t see it affecting them.

I’m tempted to say whoever gets the ball first wins. But they Packers have won 7 of 9 games against playoff teams this season, and the Falcons are 3 of 5. I’ve gone against the Packers two weeks in a row. After *that* sideline throw last week, I’m not doing it again. They have a winning swagger and last week was the proof they are a very good team.

Plus, I’d love to see a Patriots – Packers Super Bowl. Rodgers and Brady in the same Super Bowl? Yes please!

Pick: Packers.
Predictor says: Falcons, with 80% confidence, by 5 points.

2016-17 NFL Playoffs – Divisional Round

We’re only two wins away from the Super Bowl, so who will be left standing after the Divisional Round this weekend?

In the Wild Card games in last season’s playoffs, all the home teams were knocked out. However, this season it was reversed, with all the road teams knocked out. So, what can be expected this week in the divisional round?

Last week, three of my picks (the Texans, Steelers and Seahawks) were correct, and one (the Giants) was incorrect. However, my predictor went one better, scoring all four correctly:

GamePredictionResult
Giants - PackersPackers by 8.5Packers by 25
Lions - SeahawksSeahawks by 9Seahawks by 20
Raiders - TexansTexans by 2.5Texans by 13
Dolphins - SteelersSteelers by 12.5Steelers by 18

As you can see, all four games were settled by margins larger than predicted – although the predicted margins were on the whole larger than most other people would have predicted.

The only exception to that would be the Raiders – Texans game, where most people would have expected the Texans to win by more than 2.5 points, but that was mainly down to the injury to Derek Carr, which my model doesn’t take into account.

All in all, my prediction model worked very nicely. So, how will it stack up this week? Let’s see.

Houston Texans at New England Patriots

Let’s get this game out of the way first. Let’s be honest – this is the biggest mismatch of the weekend. Despite being in the playoffs, and even getting through to the Divisional Round, the Texans are the twenty-third ranked team in my rankings.

They are a team that does two things well: they win at home, and they don’t allow many points – at home.

The trouble is, they’re playing on the road, where they allow, all things being equal, ten points a game more, score six points a game less, and lost three quarters of their games.

They play the meanest defense in the league, and an offense that can score on the ground or through the air almost at will.

A sidenote: I know people say the Texans have the league’s best defense. They don’t. The Patriots do. The Patriots allow fewer points per game than any other team (by two points a game). Give out awards for yards a game if you like, but last time I checked, you win based on points scored. That matters a whole lot more.

So, who’s going to win? The Patriots. By how much? Anywhere between 10 and 40 points. I could cloud you with more figures, but I won’t bother – apart from this:

My predictor is 35-3 in games this one-sided this season. One of those was the Cardinals beating the Seahawks in week 16. Another was the Bills beating the Patriots 16-0 in week 4, when the Patriots didn’t have a fit quarterback. The final one? The Texans – Chargers game in week 12. Unfortunately for Houston, they were meant to win it, and they lost – San Diego’s only road win of the season.

Pick: Patriots.
Predictor says: Patriots, 83% confidence, by 22.5 points.

Pittsburgh Steelers at Kansas City Chiefs

This is an interesting matchup. If the Steelers were at home, they would be clear favourites, but a trip to Arrowhead makes this much harder to pick.

Undeniably, a team with Ben Roethlisberger, Le’Veon Bell and Antonio Brown are not a team you can write off. Nevertheless, the Chiefs’ defense is tough, they have a quarterback who doesn’t tend to turn the ball over, and they also can run the ball. Add on to that a bye week to rest, and Andy Reid’s 16-2 record after a bye week, and something has to give. So who’s it gonig to be?

People will tell you the Steelers are poor on the road. Well, they’re not the best team, but they are 5-3 on the road, and the Chiefs are only marginally better at home (6-2), so there’s not a lot to choose there.

Intriguingly, their average points per game are almost identical (23.47 to 23.81), as are their points allowed (18.76 to 18.81). However, the Chiefs are marginally better scoring on the road than at home. The Steelers are the third-rated team on the road, behind only the Patriots and Cowboys. So, are the Steelers edging towards victory?

The Chiefs are 2-2 in their last four home games, which have been the toughest of their home games. The Steelers are 4-0 in their last 4 road games, and haven’t allowed more than 20 points in any of those games. They’ve also scored at least 24 points in all those games. That’s a significant turnaround compared to their first four road games, where they scored fewer than 16 points in 3 games, and allowed more than 20 on 3 occasions.

The Chiefs are 1-0 in home games against playoff teams this season, whilst the Steelers are 0-1 in road games against playoff teams.

I’ve flip-flopped on this all week, and I’m not confident. But I’m going to back the Steelers’ recent road form.

Pick: Steelers.
Predictor says: Too close to call. Based on previous similar matchups, it suggests Steelers.

Green Bay Packers at Dallas Cowboys

I refuse to get carried away with how good this Green Bay Packers team is. Yes, they are good, but they’re not really good. Last week, they were flattered by a New York Giants team which had plenty of opportunities to take a big first half lead, but didn’t take them. The Giants paid for that in the second half, but the game could have looked very different had they taken those chances. I suspect the Dallas Cowboys wouldn’t have wasted those chances…

The Packers still have two main weaknesses. First, their defense is not great, especially right of the hash mark. I expect the Cowboys to exploit this. Second, they struggle to run the ball. There’s only so long you can rely on Aaron Rodgers. You need more than him to win a Super Bowl. The Cowboys’ defense aren’t great, but they aren’t bad either, and allow 6 points fewer per game than the Packers. It’s definitely advantage Cowboys.

The Packers give up too many points on the road. They allowed 47 against the Titans, 42 against the Redskins and 33 against the Falcons. Yes, they’ve also scored 30 points three times, but who against? The Falcons (terrible defense), the Bears (just terrible) and Lions (average).

The Cowboys have allowed 20 points at home 5 times, but never more than 26. They have only once scored fewer than 20 points at home, have surpassed 30 three times, and on one of those occasions, they scored 42 (against the Lions).

The Packers are 1-1 in road games against playoff teams this season. They beat the Lions and lost to the Falcons. The Cowboys are 1-1 in home games against playoff teams – they beat the Lions and lost to the Giants.

But, looking at the season, the Cowboys always do the business when they should – except against Eli Manning. Tom Brady knows all about that. The Giants just defy convention.

Pick: Cowboys.
Predictor: Cowboys, with 83% confidence, by 7 points.

Seattle Seahawks at Atlanta Falcons

Although there are three cracking games this week, this is for me the most intriguing, because it’s a battle of relative strengths and weaknesses. It’s hard to know what will win out.

On one hand, the Falcons have an explosive offense, up against a team that whilst not as good as it has been, is hard to beat in the air. On the other, you have a Seahawks team which has struggled to score consistently, up against a Falcons defense which has more holes than emmental.

I suspect the end product may end up disappointing, as I’m coming to the conclusion the Falcons will likely be more able to score against a tough Seahawks defense, than the Seahawks will be able to take advantage of the Falcons’ ropey defense. I do hope I’m wrong though.

The Falcons have allowed 29 points or more 6 times at home this season, and have scored 30 points or more 6 times too. Their lowest scoring home game featured 54 points, a 41-13 win against San Fransisco. They have lost at home to Tampa Bay, San Diego and Kansas City, but all needed at least 25 points to win. Can Seattle score that many?

It’s hard to know. They can, but they don’t consistently. They scored 31 against New England on the road, but they also scored a combined 24 in Los Angeles, Arizona, Tampa Bay and Green Bay. Those four games combined would be enough to get a tie against Atlanta in their lowest-scoring game.

This is the Seahawks’ problem: against balanced teams, they’re a good matchup. They don’t create massive mismatches. Unfortunately, that’s their downfall this week. The rest of their game probably can’t make up for the mismatch of Julio Jones. I think any thoughts to the contrary are probably wishful thinking on my part.

Pick: Falcons.
Predictor: Falcons, with 62.5% confidence, by 9 points.

2016-17 NFL Playoffs – NFC Wild Card

Following on from my insight into the AFC playoff race, here’s your guide to the NFC playoffs.

New York Giants and Green Bay Packers

This game is easily the juciest game of the weekend. One team on a 6-game winning streak against another known for shutting down opposing offenses. Even better, the Eli Manning is 2-0 in the playoffs when playing at Lambeau Field, so this really should be the game to watch…

The Giants are 3-2 against playoff opposition this seasom. The Packers are 5-2, including a win against the Giants at Lambeau Field. The only playoff team the Giants have beaten on the road is the Cowboys (week 1). The only playoff team the Packers have lost to at home is the Cowboys (week 6).

The game isd essentially two teams’ weakenesses matched against each other on one side, and their strengths on the other. Are the Packers’ offense (ranked #4 on points) better than the Giants’ defense (#2)? Are are the Packers’ defense (#21) worse than the Giants’ offense (#26)?

At some point, Aaron Rodgers has to turn the ball over. At some point, the Packers’ run must end. At some point, Eli Manning and Odell Beckham Junior will connect and show that the Giants’ offense can be better than that #26 ranking.

The Giants’ pass coverage and the Packers’ issues in coverage, especially down the field on Clay Matthews’ side, mean this matchup is built to expose these. It may not happen, but this is the best chance the Giants will get.

I’m not confident picking this game, not least because both teams have been inconsistent this season. Despite the Packers’ impressive six-game winning streak, only the win against the Seahawks was unexpected. The other five were weak opponents. They’ve given up at least 24 points in each of their last three games, and that makes me think they’re not quite as good as others think, and that the Giants have just enough hope they can overcome their ropey road form to pull this one off.

The Giants and Packers met at Lambeau Field in week 5. The Packers won 23-16.

My pick: Giants
Predictor says: Packers, 80% confidence, by 8.5 points.

Detroit Lions at Seattle Seahawks

Let’s cut to the chase here: the Detroit Lions are the only playoff team not to have beaten another playoff team this season, and it’s not for lack of opportunity. They have lost to the Packers at home, and on the road to the Packers, Cowboys, Giants and Texans.

That really should tell you all you need to know. Against non-playoff teams, the Lions are 9-2. Against playoff teams, they are 0-5. They’ve had a good season, but it ends here. They’ve hit their glass ceiling. That shouldn’t disappoint them, they just need to accept they’ve hit their maximum potential this season.

The Seahawks, on the other hand, whilst inconsistent this season, have played well against playoff opposition, winning three out of four games. They beat the Falcons and Dolphins in Seattle, and beat a Brady-led Patriots team on the road in an impressive week 10 win. Their only loss was an odd road loss to the Packers 38-10 in week 14.

The real differentiator here is that whilst both teams score around 20 points a game, the Lions give up around 21, whereas the Seahawks are closer to 17 points a game. I don’t see the Lions running many points up on the road in Seattle.

My pick: Seahawks
Predictor says: Seahawks, 80% confidence, by 9 points.

Bye Week: Dallas Cowboys

If the New England Patriots are the best team in the NFL, most people would agree the Dallas Cowboys are the next best, and the best in the NFC. The regular season definitely suggests that, although come the playoffs, they will have to beat quality and experienced opposition to get to the Super Bowl.

The question mark the Cowboyd have to answer is this: when facing up to the Seahawks, Packers and Giants, do they have the poise to beat teams with quarterbacks like Russell Wilson, Aaron Rodgers and Eli Manning, who between them have five Super Bowl appearances, four of those on the winning side? No matter how good the Cowboys are, they will be up against teams who have proved they can win in the postseason, even if they’ve been merely average in the regular season.

Outside of experience, the Cowboys only have one obvious weakness to exploit: defense. They won 7 out of 8 games at home, their only loss was in week 1, to the New York Giants, and even then only by a point. Furthermore, four of their wins were double digit wins. However, they give up a median of 20 points at home, which whilst not the worst of the playoff teams, is not league leading either (though it should be pointed out, the three teams leading the league on this all missed out on the playoffs).

If you can slow down the Cowboys on offense, they’re beatable, because their defense allows scores – every road team scored at least 14 points this season against the Cowboys, compared to the Patriots who allowed three road teams a combined 13 points, whilst piling on 94 points at the same time.

Bye Week: Atlanta Falcons

If the Cowboys’ defense is a weakness, the Falcons’ defense is positively ugly. They allowed 29 points or more in 6 of their home games this season, which would put road teams in the top 10 for scoring in the NFL this season.

Of course, the reason Atlanta are in the playoffs is that they lead the league in scoring, comfortably, with an average of nearly 34 points a game.

That’s great, but what happens against quality opposition? Well, their two closest games this season at home came against two playoff teams. They played the Green Bay Packers in week 8, winning 33-32, and played the Kansas City Chiefs in week 13, losing 29-28.

In fact, despite all their scoring, five of their home games were one possession games. They beat three teams by two, three or even four scores, but those teams were the Panthers, Cardinals and 49ers, none of whom were great teams this season.

It’s hard to put 40 points up against a playoff team, and when you concede an average of 25+ points at home, you don’t have much margin for error. In short, this team gives up too many points to win the Super Bowl.

And the bad news? The most likely visitors to Atlanta next weekend are the Seattle Seahawks. To me, that’s the worst possible matchup for this team.

2016-17 NFL Playoffs – AFC Wild Card

With the postseason about to start, you’ve been dying for a low-down on the AFC race. Wait no longer.

There’s one thing I love about January: the NFL playoffs. There’s also one thing that disappoints me about January: the NFL season is nearly over. So, if it’s nearly over, let’s enjoy it while it’s still here.

Looking at my detailed statistics, fine-tuned for the 2016-17 season and more accurate than ever due to my top-secret new formula, I’ll take you through the AFC Wild Card games…

Oakland Raiders at Houston Texans

Last season, the Houston Texans won their division and hosted an AFC West team in the playoffs. They lost. If the Oakland Raiders had won in week 17, this would be a rematch with the Kansas City Chiefs, and I suspect they would lose again.

As it is, the Raiders’ star quarterback is out for the season, their backup is also injured, and they travel to Houston for an intriguing match up.

On paper, this Raiders team (12-4) is better than last season’s Chiefs (11-50, whilst the Texans are again merely an average team winning a poor division. So what are they good at?

The Texans are very good at home, going 7-1 in the regular season. They even beat the Kansas City Chiefs 19-12 in week 2. They have allowed fewer than 15 points at home in half of their home games, although their opposition haven’t been particularly strong.

Still, you can only beat the teams in front of you, and four of their seven wins were by seven points or more – not bad considering they haven’t scored 30 points in a single game at home all season.

Their other strength, as you may have picked up, is their defense. Overall, their defense ranks 10th in the league for points allowed, but at home, only the Chiefs, Patriots and Seahawks have meaner defenses.

In short, they may be an average team, but that’s averaged out between a good home team and a poor road team. Only the Seahawks have a larger disparity between home and road performance. Good thing they’re at home then!

So, what of the Raiders?

Let’s be honest, if Derek Carr wasn’t injured, Oakland would be hot favourites. But, he is injured. So is their backup. They will likely need to start their third-string quarterback, rookie Connor Cook.

Good news for Oakland: the Texans average around 20.5 points at home, and the Raiders average around 22.5 on the road. However, the Raiders’ road defense is as bad as the Cleveland Browns on the road, and as I’ve mentioned, the Texans are in the top 10. Everything points to a home win.

My projections give it to the Texans by 2.5 points, before you account for the Raiders’ quarterback issues, despite being ranked #26 in points difference in the whole NFL – ahead of only the Jaguars, Jets, Bears, Rams, 49ers and Browns.

The teams met in week 14 in Oakland, where the Raiders won 27-20.

My pick: Texans.
Predictor says: Texans, 100% confidence, by 2.5 points.

Miami Dolphins at Pittsburgh Steelers

At the start of the season, people talked of the Steelers as potential Super Bowl champions. After the first couple of weeks, it all went a bit wrong.

After winning four of their first five games, they lost four on the bounce, including to the Cowboys, Patriots and Dolphins, before winning out in their last seven games.

The trouble is, only one of those final seven games was against playoff opposition (the Giants), although in week 3 they did hammer the Chiefs 43-14 at home. So, overall they are 2-3 against playoff opposition.

The good thing for the Steelers? Their two losses at home were to the AFC and NFC #1 seeds, so they only lose to really good teams. And the Dolphins aren’t really good.

The Dolphins are 1-3 against playoff opposition. The Patriots beat them comfortably in Foxboro back when Tom Brady was suspended in the interests of trying to stop the Patriots winning. They were squeaked out by the Seahawks in week 1 when the Seahawks looked very lost. And in week 17, they were annihilated by the Patriots.

Don’t get too excited by the 9 wins in 10 games between weeks 6 and 16 either. Yes, they beat the Steelers, but that was at home, and their other wins were against the Bills (twice), Jets (twice), Chargers, Rams, 49ers and Cardinals. The Steelers aside (who are 3-5 on the road), none of those teams even went .500 this season. This is a team flying high on a weak schedule, who get beat against quality opposition.

The Dolphins are 4-4 on the road, and are middling at best in terms of points scored and points allowed. They average 19 points on the road (the Steelers average 28.5). They don’t give up any more points on the road, but it won’t be enough to save them.

Points difference gives this to the Steelers by 12.5.

The teams met in week 6 in Miami (another reverse fixture!), where the Dolphins won 30-15.

My pick: Steelers.
Predictor says: Steelers, 100% confidence, by 12.5 points.

Bye Week: New England Patriots

The Patriots are the best team in football, even without Gronkowski, and without Jamie Collins. Forget the hype around the Cowboys, Packers and Seahawks – they’re all good, but the Patriots are the team to knock off the top of the perch.

The Patriots may not win the Super Bowl – plenty of favourites don’t – but they are by far the team to beat. The Dallas Cowboys look very good, but their rookie quarterback will need to step up a gear in the playoffs to hold off two of the Falcons, Packers, Seahawks and Giants to just get to the Super Bowl (don’t worry about the Lions, they’re toast).

So why are the Patriots so good? Well, we know all about Tom Brady and Bill Belichick, but the standout reason the Patriots are so good this year is that they give up fewer than 16 points a game – that’s two points a game fewer than the next best team (the Giants). They win their games by an average of 12 points – nearly 4 points more than the next best team (the Falcons).

People questioned trading Jamie Collins to the Browns. Things might change in the playoffs, but they haven’t looked like they’ve missed him much so far.

Then there’s Martellus Bennett. The Patriots have a second tight end who can win any matchup – with one upside on Rob Gronkowski. He’s not a walking hospital case.

Finally, there’s the run game. The Patriots aren’t known for the run – or at least, they weren’t. But with Dion Lewis, LaGarrette Blount, Brandon Bolden, James White and James Develin in the backfield, this Patriots team can run the ball down any team’s throat.

And that’s why they’re the team to beat.

Bye Week: Kansas City Chiefs

The Kansas City Chiefs secured a bye on the back of Oakland’s bad fortune. They’ll be glad they did, as a trip to Houston would have been tricky, having lost there in week 2.

If any team in the AFC can beat the Patriots to the Super Bowl, this is probably the team to do it. They won 6 out of 8 on the road on the back of one of the toughest schedules in the league. Of their road games, four were against playoff teams, and two more were against last year’s Super Bowl teams, and they were 4-2 in those games.

So, if they get to to the AFC Championship and it’s in Foxboro, they have certainly shown they’re good enough to compete. The question is, can they get there?

Their home form hasn’t been as good as it should be. They’ve only played one home game against playoff opposition – against the Raiders, which they won. They lost twice, to Tampa Bay and Tennessee, both games by two points. Six of their games were decided by one possession.

Their most likely opposition in the Divisional Round is the Pittsburgh Steelers, and that would be juicy match-up. They’ll be glad to get this week off to prepare.

Reviewing Politics, 2016 Edition

It’s the end of the year, and what better way to end it than to look back on how foolish you were at the start of the year?

You may remember, at the start of the year I wrote my 2016 political predictions. Like many others, I suspect, most of these I now wish I hadn’t, as they turned out to be so badly wrong. So, I thought it would be fun interesting to review them…

Scottish elections
I predicted the SNP would win a majority in the Holyrood elections, that the Conservatives would win more seats than Labour and that the Green Party would win more seats than the Liberal Democrats.

Overall, a good start, I’d say. The SNP didn’t win a majority, of course, although they came very close. I was surprised how many constituencies they lost to other parties – the Liberal Democrats won four and the Conservatives seven, whilst Labour clung on in three.

Winning more constituencies, combined with a slight fall in their share of the list vote, meant they overall lost seats compared with the 2011 elections, although with the Green Party picking up seats overall, their is an overall majority for pro-Indy parties in the chamber.

In the end, the Conservatives did more than make gains on Labour – they passed them, comfortably, although with fewer seats than Labour had in 2011. The results were terrible for Labour, but they’ve not quite reached the bottom yet… that will be in May’s local elections.

The Greens did indeed beat the Liberal Democrats, by one seat. It would have been more, but the Liberal Democrats managed to win four constituency seats. Their local campaigns must have been exceptional, as their campaign nationally was abysmal, and all I remember of it is two randy pigs…

Verdict: Mostly correct.

The EU referendum
 I still don’t really understand this. People don’t usually vote to make themselves poorer, which is what they chose to do in this referendum. I guess, all in all, they decided it was worth it, or that it wouldn’t make them poorer.

More than six months on, we’re still none the wiser what will happen and how it will pan out, but 2017 will give us an idea. How much sovereignty will the UK get back? Is it willing to pay the price, or will it become a poor man’s Norway?

In essence, we settled on an answer to the question, but we still don’t understand the question very much.

Verdict: Abject failure

Jeremy Corbyn
Well, he did survive as Labour leader, but his MPs did try to stick the knife in. They just didn’t succeed, thanks mainly to their National Executive Committee. Once Jeremy was confirmed as being on the ballot paper, he was never going to lose.

Well, apart from those pesky elections outside the internal Labour Party. He’s still losing those. Badly. Although not as badly as the branch office in Scotland…

Verdict: Half-right.

Hillary Clinton
It turns out that whilst none of the Republican candidates were electable, she was even less electable. Quite an achievement really.

That said, I don’t think any other candidate would have lost to Donald Trump. Familiarity and contempt cost her. Any other Democrat candidate probably would have beaten Trump. Would any other Republican candidate have beaten Hillary? No one will ever know.

I still would much rather be seeing Jeb Bush as President-elect, but that ship has sailed.

Verdict: Not completely wrong – the Republican candidate is a crackpot.

London mayoral elections
I was half right on this one. Sadiq Khan was the winner, but it wasn’t the closest election yet. Indeed, it was the largest margin of victory since the first election in 2000 when Ken Livingstone won as an independent.

Verdict: Half-right.

2017 predictions
Let me have a think about that. It might be better to use a fake news generator as it may be just as accurate.

Changing directories in the Windows command prompt

Everyone knows how to change directories in the command prompt, right? Sometimes you know less than you think.

I’ll admit, this one does seem a little basic. However, it’s something that’s often struck me as odd, yet I’d never bothered to look into further until this week, when my curiosity got the better of me.

In Windows, as in Linux, it’s really easy to change directories when in a command prompt. Say you’re in C:\Users\User, and you want to change to C:\Users\User\Desktop, you would put in the following:

cd Desktop

If you wanted to switch to C:Windows\System32, you would put in the following:

cd C:\Windows\System32

Simple, right? So, if you store files on another drive (as I always do, because it makes backups and sharing much easier for me), and you want to switch to, say, D:\Websites\Website\, you would put in the following:

cd D:\Websites\Website

The trouble is, it doesn’t work. I would always have to do the following:

D:\
cd Websites\Website

Until now, I’d never been bothered enough to look at what i need to do to make it work. It turns out, when switching drive letters as well as directories, you need to use a switch, /D. so, to do it in one line, you need the following:

cd /D D:\Websites\Website

To be honest, I can’t really see any reason why you would need a switch, since nothing happens at all if you don’t use it, but I’m sure someone, somewhere, will know why it’s implemented like that. Although come to think of it, I’ve never really understood why Windows still uses drive letters, as the Linux model of folders relative to root seems much more logical to me!

WordPress updates with SSH2 in Ubuntu 16.04

I’ve had a few issues upgrading WordPress recently. I thought I was going mad, but it turned out to be a really annoying bug.

Recently, I upgraded my virtual private server (VPS) to the latest Ubuntu release (Ubuntu 16.04). I did this for two reasons.

First, it’s good to be on a recent release, and Ubuntu 16.04 is a long term support (LTS) release, meaning it’s supported for longer than other Ubuntu releases, and aimed more at stability for things like servers, rather than all-new features which might be a bit sharp around the edges.

Second, Ubuntu 16.04 came with PHP7 out of the box, which provides drastic performance improvements which, on a VPS, is very useful as CPU resources can be a little constrained.

It also gave me a chance to burn the old install to the ground as over the past three years or so, I’d tested a lot of things out on it and I wanted everything to be nice and uniform, putting into practice some of the things I’d come up with along the way, like my automated website creation script.

Anyway, on my Ubuntu 14.04 install, which used PHP 5.6, I had automatic updates set up on my WordPress installs. They worked nicely and provided good security, as I used SSH2 for the updates, meaning the files and folders the WordPress install lived in were not modifiable by the web server itself.

I host multiple websites on my server, and to enhance security, each site is owned by a different local user, and each database has its own user, so if one site is compromised, it’s harder to compromise the rest.

The web server shouldn’t really have write access to local files, but it needs write access to update WordPress automatically. By using SSH2 for WordPress updates, the web server can get the access it requires without having direct rights. It works well.

The problem is, it’s broken in PHP7. No matter what I did, I could not get updates to work. I came across various error messages, and after a lot of hunting around and double-checking, I was sure it wasn’t because I was doing anything wrong.

And it turns out I was right to be sure. A problem with the php-ssh2 breaks updates for WordPress. If you have this problem, you’re probably not going mad. Fortunately, I can offer a solution: SSH SFTP Updater Support.

This plugin uses a different library and I found that once I’d uploaded the plugin manually and activated it, my updates worked perfectly, first time (because my settings were correct, obviously!)

Once I’d fixed this, I decided to see if I could find any more information about this package, so I had a look at the information attached to the package in my installation:

php-ssh2

So this is an unreleased git snapshot and should be used with caution? Doesn’t seem like the kind of package that should appear in a long term support release…