VGTech is a blog where the developers and devops of Norways most visited website share code and tricks of the trade… Read more

Are you brilliant? We're hiring. Read more

The Gathering Contest

The Gathering LogoLevel Up, VG and Prisjakt join forces and have a joint booth during annual easter LAN-party The Gathering, which is located in Hamar Olympic Hall. The booth will be open from 8:00 a.m to 10:00 p.m throughout the event. Here you can get some refreshments, play games or just chill out.

Not only will we have a amazing booth – you can also participate in our awesome competition with a first price of 30 000 NOK! (more…)

Comparing your privates in PHP


While working with some code that should compare two different instances of the same class I discovered a “hidden” feature in PHP.

I was going to compare several private properties between to objects and started making a piece of code to perform the actual comparison using getters for the properties. I felt the approach sucked, and started looking into alternatives way to do this. (more…)

Visualizing the most read articles on VG


Article visualizationD3. Behind this name is a pretty neat concept, called Data-Driven Documents. I took a look at the framework last year after seeing a lot of cool demos using it. It’s really flexible, and is not tied to a specific form of presentation - you can use D3 to generate an HTML table from an array of numbers, or use the same data to create an interactive SVG bar chart with smooth transitions and interaction.

After looking through different layout algorithms available in D3, I found the treemap algorithm particularly interesting. I’ve seen it used before in both profiling tools and disk usage analyzers and found them to be very efficient for visualizing the difference between numbers. An idea popped into my head: “Maybe this can be used to visualize which articles are being read the most?”. I decided to give it a try. (more…)

Xcode Plugins


If you haven’t done so already it’s time to check out some Xcode plugins. How about managing cocoapods from inside Xcode or getting a Todo-list window generated from your code comments? Clang-formatting your code, install new colorthemes or getting a minimap-view like in Sublime text? (more…)

Deploying apps in openshift


After you’ve set up openshift with a node or two, deploying an application is as easy as it gets.

You can do lots of stuff in the broker console, but rhc is the way to go:

rhc is a rubygem installed like all others:

Show code
~$ gem install rhc

To set it up:

Show code
~$ rhc setup --server


Swagger docs in ZF2 with examples – Part 2: Swagger UI


This blog post on Swagger UI is a follow-up on my recent post on Swagger annotation parsing in ZF2. If you’re not already set up with Swagger annotation parsing in you ZF2 app I recommend that you read part 1 first.

In the last post we got ZF2 set up with annotation parsing and everything, and the only thing missing was Swagger UI for the neat presentation. I skipped that previosly but today we’ll add the last piece. (more…)

OpenVPN configuration files + Ubuntu’s network manager


OpenVPN has feature that exports client configuration files. While it is definitely possible to run OpenVPN from the command line, I prefer to have a GUI that allows me to easily connect/disconnect from VPN. Ubuntu’s network manager and the .ovpn configuration files exported from OpenVPN does not play well together, however.

There is a workaround which involves cutting and pasting parts of the configuration file into separate files and adding some references to them in the configuration. After having done this a couple of times and helped other people with the same issue, I decided I’d write a simple tool to do the job instead. (more…)

Swagger docs in ZF2 with examples – Part 1: Setup and annotations


So everyone is building APIs now – parsing and outputting JSON is not that hard. Some people even build truly RESTful APIs, or something not to far from that.

Before, when building APIs was about SOAP with XML schemas and WSDL specifications, people spent so much time building their APIs that they had the time to think. Now, building an API is so easy and fast that the documentation is often suffering. Either because not much documentation is written in the first place, or because the API is evolving and nobody takes the time to update the documentation.

Swagger is a popular project providing auto generated API docs based on a service specification. This spec is based on annotation comments in the controllers and models, giving the developer a fairly easy, and close to the code way of keeping the API docs up to date.

In this two-part article on Swagger I will try to cover what you need to get your API docs up and running with Swagger + Swagger UI in ZF2. (more…)

VG+ 2.0: From Native to Hybrid App.


VG+ is VG’s premium subscription based digital product and VG’s third editorial product, it consists of the best content from the printed VG newspaper with the best content from VG’s free news site Context aware content tailor made for each platform ensures the ideal reading experience per device. The user can quickly and easily gain news insight on their mobile while enjoying a more immersive experience on the iPad.


The first version of VG+ was released in 2011 as an iPad app. It was a native application that won multiple awards including the ‘Best paid app’ at the World Association of Newspapers – WAN IFRA Cross Media Awards in 2011.

In 2013 we ditched our native apps and created a new set of VG+ Hybrid Apps (Android, iPhone and iPad). The goal was to combine the best of web technology with the best of native technology. We also created a new set of editorial tools that are tailor made to the needs of our editorial team and to creating interactive and instantly available content for mobile devices.

So why did we scrap the native apps and build hybrid apps?


Building your own PaaS


In this series, I’ll go through installing, using and extending Openshift Origin, a Platform as a Service (PaaS), developed by RedHat. Check it out at

What is Openshift?

In short, Openshift consists of two things: A broker, and a node. (or two brokers for redundancy and hundred nodes for scaling) Each can run on whatever; baremetal, vmware, ec2…..

The management is done on the brokers. It controls the automation and orchestration of the nodes.

The user created applications runs on the nodes. You can install broker and node on the same host, but I wouldn’t recommend it as You’ll get in trouble if your node gets too much traffic.

On the nodes the applications are separated into “gears”. These are SElinux hardened containers which are given a set of hardware resources(ram,cpu,disk) though linux cgroups.