Custom Nerf Guns

Lately I’ve been watching a lot of videos about prop making and cosplay. I’m not sure I’m bold enough to dress up myself but I really like the idea of making amazing looking costumes and props from such cheap materials. Unfortunately living in London means our flat is tiny and there’s no space for a workshop or even a spare room. Fortunately my wife is awesome and she suggested that we take a long weekend off work so that we could scratch our creative itches. Leave was booked, craft shops, builders merchants and toy shops were visited and a number of Amazon orders were made.

My original plan had been to replicate a large rifle from Borderlands 2 using foam and PVC pipe. However after watching Adam Savage’s video where he built a custom Nerf rifle in a day I decided to give it a go.

The first attempt

Nerf Strongarm

I picked up one of the cheaper Nerf blasters on sale in a toy shop for under a tenner. It’s called a Strongarm, and it seems pretty oversized for a pistol so I thought it would probably make a pretty cool looking Sci-Fi weapon.

Strongarm colour scheme

First I had to decide how I wanted to paint it. I found a template on the web, and using a pallet of the spray paint colours I had available planned out the colour scheme. The project finally gave me a chance to use my Dremel so I got to work removing the raised Nerf logo, Strongarm branding and the safety instructions from the blaster. This left the plastic a bit chewed up so I tidied it up with a few different grits of wet and dry sandpaper.

Nerf Strongarm with black base coatNext up I disassembled the blaster making sure to take lots of pictures of how the internals fitted together. Then I sprayed the whole thing with a matte black spray paint as a base coat.

Spray paint having a bad reactionOnce it was dry I sprayed the entire blaster with a bright blue spray paint. This is where I hit my first problem. The paint started curling and creating a weird scaly texture. I jumped on to the Facebook group for The PropTarts of Punished Props (a group for fans of the Punished Props YouTube channel) to ask for some advice. Amazingly over thirty people replied to give me advice, what a great community!

It seems the most likely cause was that I had used a solvent based paint for the base layer and the blue acrylic paint had reacted to it. Lesson learned. When it was dry I smoothed out the worst of it with some wet sandpaper and it didn’t look too bad. One of the other suggestions I was given was that spray paint works best if both the can and the surface you’re spraying are warmed up first. So I gently warmed one of the two pieces that make up the slide using a heatgun. It promptly melted and deformed. Second lesson learned. After a bit of heating and bending I managed to get it to fit back on the blaster but it was still pretty mangled.

Next up I masked off the sections I wanted to stay blue leaving only the grip and the “tactical rail” uncovered and sprayed them gloss black. In hindsight I think I probably should have gone with a more matte black but it was beginning to look like my plan.

Custom spray painted Nef Strongarm

As you can see from the image above I chipped quite a lot of paint off of the cylinder while trying to fit the two halves back together. It took a considerable amount of force to get it back together and in the end I resorted to covering it with a tea-towel and hitting it with a rubber mallet. There’s got to be a better way.

With the blaster reassembled I gave the whole thing a coat of a matte clear top coat. Once it had cured I started work on the weathering, touch-ups and finer details. I was pretty proud of the end result.

Custom painted Nerf Strongarm

The second attempt

Nerf Firestrike

Having discovered what not to do and armed with some actual primer I figured I’d give it another go. So the following weekend I started work on a smaller pistol, a Nerf Firestrike Elite. It’s a single shot blaster with an integrated “laser sight”. It has a very futuristic looking silhouette and I thought I could probably get it done fairly quickly as it’s much smaller than the Strongarm above.

I looked around online for an existing template to work out the colour scheme on. I was unable to find one so I threw one up together in Illustrator. It’s not perfect but it’s good enough fo figuring out a colour scheme. Please feel free to use it if it’s useful to you, the outline image to the right links to an A4 transparent version.

Firestrike colour schemeHaving bought a few more colours of spray paint I decided to go with a lighter and more muted colour scheme this time to see how that would work out. I also wanted to break up the shapes of the gun a bit so I used the moulding of the gun to separate the sections of colours.

Nerf Firestrike prepped for spray paintingAs before I ground off the NERF logo, Firestrike branding and the safety instructions. I used a much lower speed this time and that left me with a lot less sanding to do afterwards. Then I roughed up all the surfaces of the blaster with some wire wool to give the paint something to grip into.

Spray painted Nerf FierstrikeThe whole thing got painted with a grey primer and left to dry. Once it was dry I sprayed the whole thing once again with a slightly different shade of grey spray paint. Then the masking began. It took quite a while to cover all of the sections I wanted to stay grey. I used 3M blue painters tape and a scalpel to mask as accurately as I could and then sprayed the ivory coloured sections. When I peeled off the tape I was pretty pleased with the results (and confident I could hide any mistakes with weathering later on). The grip got sprayed matte black and the barrel got sprayed silver.

I decided that I didn’t want to mask up the whole thing again to spray they cylinder at the front silver so I painted that in with a brush along with the screws and  the plaque. I did the same thing for the black dial above the grip. The handle got a matte clear coat and the rest of it got a gloss clear coat. Then I had to reassemble the blaster and reconnect the wires and laser, again taking lots of pictures before made this a lot easier than it could have been. Next up came the weathering and a final clear coat which left me with this.

Custom painted Nerf Firestrike

…and the rest

So I got a little carried away and won an eBay auction for someone’s Nerf collection. So now I have thirteen more blasters of varying styles and sizes to work on. I’m sure I’ll post the finished versions online as I get them finished.

The Nerf Arsenal

Solid, practical and cheap(ish) laptop

I’ve been fortunate enough to be supplied with MacBook Pros for my last few jobs, including my current role. I passed my own (now aged) MacBook Air on to my Wife when we met and since then I’ve been pretty much using my work machines for personal stuff too.

I was thinking about buying a cheap, reliable laptop for web browsing, coding and other odds and ends. Unfortunately the requirement that it should be cheap pretty much disqualified all Apple products. So I thought I’d look through eBay and see what I could find.

The keys feel very similar to, or possibly better than, those on the MacBook Pro.

In the end I settled on a Lenovo ThinkPad T430 (circa 2012). I chose it because it was available under £250, had a reasonable spec, solid build quality and a very, very nice keyboard. The model I bought was an i7 2.90Ghz with 8GB of RAM, NVIDIA NVS 5400M graphics, a 500GB HDD, DVD-CDRW and a 1600 x 900 antiglare display.

The first modification I made was replacing the optical drive with a HDD caddy and relocating the original HDD there. I then installed the cheapest 240GB SSD I could find as the boot drive.

ThinkPad DVDRW & HDD Caddy
I mean seriously, who needs an optical drive in 2017?

Next up I installed Windows 10 Pro and dual booted it with Linux Mint. I followed an online guide to setup a development environment in Windows, although I expect the Windows partition will mostly be used for coding C# in Visual Studio. I set up the Linux partition as I’ve never experimented with Linux before and this seemed like a good opportunity.

The trackpad was showing its age and had that weird spotty texture that only seems to exist on ThinkPads. It turns out the entire surface is just a sticker. So I peeled it off and replaced it with a smooth trackpad surface made to fit the T430.

Hey that’s smooth

So now I had a machine that ran the OSes I was interested in playing with, held a good charge, had a usable trackpad, a secondary drive for storage and booted up quickly thanks to the SSD. The one remaining and somewhat unexpected issue was the screen. The antiglare TN panel fitted to the T430 is one of the worst displays I have ever seen. It had to go.

A bit of research later and it seems that I was by no means alone in my assessment of the display. Several other users had investigated alternative displays. Sadly it seems there are no IPS displays that are a straight swap. The best alternative appears to be the AlienWare M14X R2 glossy display. The first one I ordered from eBay was a bust as they lied in the description and shipped me the same antiglare panel I already had. In the end I found the panel from laptopscreen.com. The difference is night and day, it’s still not an IPS display but the viewing angles are significantly better and the image is so much sharper.

All in all I’m pretty impressed with this ex-corporate brick. It boots up almost instantly thanks to the SSD. The fingerprint scanner is a surprisingly handy addition and works flawlessly with Windows Hello. The discreet graphics, although old, have turned out to be surprisingly capable. I’ve played Darksiders, Tony Hawks HD and Grid 2 at reasonable frame-rates without issues. On the flip-side rendering in blender is pretty lacklustre, the BMW scene renders in 38 minutes. However for under £350 all in it’s a pretty competent all-rounder!


The things I wish I’d known before I started

You can use sellotape to remove the HDD if it has lost its tab
If you watch any of the many YouTube videos on changing the HDD in a ThinkPad you’ll see how you simply undo one screw, slip off the plastic cover, fish out the tab, give it a tug and you’re done. Sadly it turned out that when I tried this my HDD had no tab to tug.
I contemplated a few approaches to retrieving the stubborn storage device, needle-nosed pliers, supergluing wire to it, even disassembling most of the laptop to get better access. Eventually I figured I should try using some tape. It was pretty fiddly to thread the tape between the HDD and the edge of the enclosure, and then to get it to stick to the HDD but I managed it on the third try. One gentle tug and the drive was out.
The standard display on the T430 is truly an abomination
If I had realised how bad the screen was I would probably have spent the extra for a newer ThinkPad that came with an IPS display. I genuinely hadn’t realised how spoilt I had been by the screens on the Apple laptops I’ve had over the years.
Replacement screens are harder to find than I anticipated
I bought an allegedly 1600 x 900 glossy screen from eBay. I removed the screen that was in the laptop and then fitted the new one. Only to discover that when I removed the protective film it wasn’t a glossy screen at all. It was exactly the same antiglare (matte) screen that I had replaced. After a bit of arguing with the supplier, swapping the screens back over and a trip to the post office I managed to get my money back. I then managed to source a replacement from laptopscreens.com. I suppose scarcity of parts for a 5 year old laptop is to be expected but you need to be careful when buying screens online, there are a lot of misinformed dishonest sellers out there.
Make sure you disconnect the battery before swapping displays
In the interests of full disclosure the machine pictured in this post is not the machine I’m using. It’s an i5 model that I did all of the upgrades on. Unfortunately in my excitement to get rid of the awful display that came with the machine I forgot to disconnect the battery. I took the old display out, swapped the new one in and booted it up. The screen showed an image but it was only visible under a very strong light. Some research online led me to believe that I blew a fuse on the motherboard that controls the power to the backlight.
Disassembling the entire machine and a quick continuity test with a multi-meter seemed to confirm my suspicions. I considered my options, a new motherboard would have been around £100, the proper tools to replace a surface mount fuse would have been well over £100 and neither would guarantee a working machine. So I went back on to eBay and bought a second ThinkPad (the i7 mentioned above) and transferred all of the upgrades over to the new machine. I’m hoping I can sell the other one for spares/repairs.

What happened to No Man’s Sky?

Like a lot of people I had been looking forward to No Man’s Sky for some time. However I didn’t preorder it, and when it was announced that it would not be a multiplayer game I decided it wasn’t for me.

During the week of launch a friend of mine bought it. Having seen the opening of the game and then reading some articles online my wife thought it sounded like something she’d enjoy, something akin to minecraft in space. So I bought it for her as an anniversary gift (‘cos I’m romantic like that) and she’s been playing it on and off for the last week.

Now I will stress that besides a quick ten minute stint of a bit of mining and a bit of flying I have not played the game. I have however been excitedly following the progress of the game since E3 2015 and I’ve also seen my wife playing the game (a lot) for the past week. As far as I can tell the game whose progress I had been following and the game that she’s playing seem to only share graphics.

While the procedurally generated planets do have some variety, it seems the variety is largely in the things you don’t need to interact with. The main resources that you are required to mine seem to take on a fairly similar, if not exactly the same, appearance on all the worlds she’s visited. The fauna and flora beyond that all seem to only yield carbon and there seems to be no reason to interact with any of it, other than the financial reward for discovering new species.

The planets, at least the ones I’ve seen her play through seem quite sparse and very repetitive. Every building that she’s come across appears to be exactly the same as the last. Sometimes it has one of aliens in it with the choose your own adventure question, sometimes it’s a computer asking you to figure out the next number in a sequence and sometimes they’re devoid of life. The buildings themselves though seem to be exactly the same on every planet, in every galaxy that she’s visited.

One of the standout features was the ability to seamlessly leave a planet and travel through space and that works as previously demoed, but it seems vastly watered down from the experience I had been looking forward to. So far I’ve not seen a single space battle, and whilst there are other ships out there you don’t seem to be able to interact with them. The huge space stations are all identical and consist of just two rooms and a hangar with one alien at a desk and some other random aliens flying in and out. The sum total of interaction with other characters seems to consist of picking the right answer, buying resources, selling resources or buying their ship.

It just feels so unfinished. Part of me wondered in a game world universe so large perhaps she just hasn’t come across any of these events yet. So I read some reviews online to see what other people thought.

With an average score of just 65% – ignoring Eurogamer, who also published a video called “Where did No Man’s Sky go wrong?” despite recommending it – it seems I’m not alone in my criticism. The core mechanic of the game is mining resources to power and upgrade your suit, mining tool and ship. As a passive viewer it feels that the game’s unfathomably huge, open universe becomes merely a backdrop to a fundamentally tedious activity. One that ultimately has no reward except to make the tedious activity a bit quicker.

Once you start earning upgrades for your equipment, tasks like mining start feeling less like a tedious chore. There’s no worse modern game design convention than “this task sucks until you upgrade to make it suck less”, and that’s a convention No Man’s Sky is oddly invested in, sadly. — Alex Navarro (Giant Bomb)

It really feels like Hello Games invested all of their energies and innovation into building a vast game world and somewhere along the line forgot to actually add the game to it. I’m left feeling quite conflicted; part of me appreciates the enormity of what they have achieved. Creating this huge open-universe game where you can transition between the planet you’re on and the planet or moon that you’re looking up at without a loading screen is genuinely impressive.

However they must know that this is not the game that they had previously demoed. They must know that some people will have preordered it and will now be massively disappointed with what they have received. I hope that with the influx of cash they have surely received since launch that they can continue to patch the game. That they can add the factions, the meaningfully different ships, the space battles, maybe even some missions and I hope that one day they can make a multiplayer version of the game that they demoed, because after all that is the game that people were excited about.


No Man's Sky Refund
This is probably not what you want to see as the top search suggestion a week after release…

Building a PC for Blender

I’ve been playing with blender for a while now and I’ve reached the point where my laptop is just not up to the job. I have increasingly found that I abandon projects as adjusting materials and lighting requires hour long renders to see the difference. Having considered all the options;

  • Buying a newer Mac
    This doesn’t really make sense as it may not actually be an improvement as Apple tend to use AMD graphics cards and Blender seems to work best with NVIDIA cards.
  • Buying a secondhand Mac Pro and upgrading the graphics card(s)
    Having spent some time researching this route there doesn’t seem to be much useful information available. It seems that the graphics cards might need flashing to make Mac OS recognise them and the risks involved were too large. Plus the cost of a recent, pre-dustbin, Mac Pro and a good graphics card was equivalent to building a new PC from scratch.
  • Building a Hackintosh
    There’s tons of information out there for people that want to go down this route. I had a very cheap netbook running Mac OS X a few years back and it mostly worked fine but there were enough issues that made me not want to rely on it.

ComponentsI decided that I would bite the bullet and build a Windows PC. Despite the fact that I haven’t used Windows regularly for nearly twenty years and I’ve never built a PC before. So after about six months of research I placed my order and the next day many, many boxes arrived.

The full list of components is on PC Part Picker but essentially the build consists of a water-cooled Intel i7 3.3Ghz 6-core processor, 32Gb of RAM, an NVIDIA GTX 980ti, two 240GB SSDs and two 3TB HDDs.

What do I do with all of these things?

With all of the parts in hand and an entire day to myself I set about trying to put the machine together. I’ve watched countless hours of LinusTechTipsJayzTwoCents and the Awesomesauce Network over the last few months, I thought I was ready.

It turns out that building a PC is a lot more fiddly than the professionals above make it look. I intentionally bought a case that has a reputation for being easy to build in and I’m glad that I did. The instruction book that comes with the case walks you through what to install, how and in what order. Nearly every component I ordered came with a fairly hefty manual or installation guide.

Despite all of the instructions I still hit a few snags. I didn’t connect a cable to the 8-pin power connector at the top of the motherboard before installing the H110i’s radiator. This meant some very careful manoeuvring to get it out without having to disconnect everything.

I also didn’t appear to have a 4-pin cable for my power supply. On my motherboard there’s a 4, 8 and 24-pin socket for power cables. The manual makes it very clear that you must connect all of them for it to operate correctly. I looked around online and it seems that I was not alone in my confusion, plenty of other people could also not find their 4-pin cable. Apparently the 4-pin socket is optional and is only necessary for people that want to increase the voltage to their CPU for hardcore overclocking. So I didn’t connect one and the PC seems to be working fine.

I found cable management more difficult than I expected too. I chose to go all out and had some white, individually sleeved CableMod PSU cables to compliment the build. They look nice enough but I found trying to get them to look neat pretty challenging. Ordering some cable combs and a bit of fiddling seem to have solved that issue now though. Cable management in the back of the case was also a little hairy. I had planned on making it a work of art back there but after fighting with spaghetti for half an hour I decided it was neat enough and the side panel fitted without too much resistance so I called it a day.

Building the PC took me all day in the end, including clearing up all the packaging, manuals, screws, and other ephemera. I’m sure if I were to build another machine it would take a lot less time and I’d be aware of the potential pitfalls along the way. Considering how it turned out I’d say it was a pretty good days work.

Even the fans are black and white
Yes it has a window, yes it has lights
Yes it has a window, yes it has lights, try not to judge me…

 Bringing it to life

I’m not going to lie, I was pretty sure that it wouldn’t boot first time but surprisingly it started up fine. I inserted my Windows 10 flash drive and happily clicked through the install. It went without a hitch and pretty soon I was greeted by a Windows desktop. As the machine has no optical drives I plugged in an Ethernet cable and was pleasantly surprised to see that it automatically connected with no issues.

I got to work installing drivers for the motherboard, the graphics card, the cooler, everything went fairly smoothly. Until I rebooted. On booting up the machine asked for the password I had set a few minutes ago. I entered it and it resolutely refused to accept it. I know the password that I entered was correct but Windows refused. I tried the reset password option and Windows helpfully asked me to insert the CD I didn’t have. So I booted back to the installer, formatted all the disks and went through the whole process again. Fun times.

I read/watched a bunch of tutorials on oveclocking and eventually managed to get the CPU stable running at 4.3Ghz and the graphics card also saw a modest increase that got an additional ten fps in the Heaven 4.0 benchmark. I definitely don’t know enough about it to explain it to anyone else though so lets move on to the big question…

Will it blend?

Mikes BMW benchmark

On my laptop the BMW benchmark scene above takes over half an hour to render. On the new PC with an overclocked CPU and GPU the same thing renders on the GPU in 30.29 seconds! Even on the CPU it only takes one minute and twenty seconds!

I am so happy with how it all turned out the machine runs brilliantly, blender works superbly and it’s still pretty quiet. Hopefully I’ll be sharing some new work soon.

Rendering Minecraft in Blender

I’ve been having an on and off love affair with Blender for three years now. While it’s true that the interface is bordering on user-hostile once you begin to understand the Blender way of doing things it is an incredibly capable piece of software.

Recently I stumbled upon Mineways, a free, open-source program which allows you to export sections of your Minecraft worlds for rendering or 3D printing. Being quite a fan of Minecraft (my wife and I had our Minecraft avatars on our wedding cake) I thought I’d have a play with it and see what I could make.

I did it Mineways

The Mineways program itself is incredibly easy to use. Open up a world file, chose the maximum height and depth you would like in the final scene, ctrl-click (right-click) and drag over the section you would like to export and then export an OBJ file for rendering.

Mineways

Once Mineways has finished exporting you’ll be left with several files:

  • An OBJ file which we’ll open in Blender
  • An MTL file which specifies the materials for the model
  • Three PNGs of Minecraft textures in RGB, RGBA and Alpha versions

It’s probably good housekeeping to put all of those files into a folder to keep everything organised and then we’re ready to get into Blender.

Will it blend?

So first up you’ll need to download and install Blender (the current version is 2.74 at the time of writing). Next if you are completely unfamiliar with the software I would recommend you go and make a mug to get up to speed with navigating the interface. You may also find that using a mouse makes it easier to navigate although it is possible with a multitouch trackpad (which is how I use it).

Now that you have Blender installed and you know your way around it a little lets get started. Create a new file in Blender, you should have a scene with a cube in the middle of it. Right click on the cube to select it, press “x” on the keyboard and click on the delete option that appears under your cursor. This should leave you with an empty scene ready to import your model. To import the OBJ file select File > Import > Wavefront (.obj) and then navigate to the OBJ file created by Mineways.

You should now see your model in all it’s greyish beauty. To see a textured preview change the viewport shading mode to texture by pressing “alt+z” (option+z), to switch back press “z” to go to Wireframe mode and “z” again to get back to Solid mode.

Blender Viewport Shading Modes

Now to see how it renders we need to set up at least one light and one camera. Fortunately the default Blender scene contains a camera and a sun lamp so you should be nearly ready to go. Adjust your view by rotating, panning and zooming until you have a good view of the model. Then from the View menu at the bottom left of the panel you’re working in select View > Align View > Align Active Camera to View.

Now we’re ready for our first render. Select the camera icon from the panel on the right to access the render settings. Set your resolution in the panel and then press the Render button. The output may look a little like this.

Blender internal renderer

My render came out particularly strangely as the world file I was working from came from a modded version of minecraft (ATlauncher). Mineways is only designed for “vanilla” (non-modified) minecraft worlds so it converts blocks it doesn’t recognise into bedrock. In this case it also got confused by the variety of trees available and made some trunks out of coal ore and some leaf blocks into wood blocks.

It’s fair to say that I was a little disappointed with this render but worry not things will get better. Blender has two built in renderers – the code that computes how the final image should look. Currently we are using Blender Render which is the original renderer for Blender and our other option is to use Cycles. The differences between them are many but essentially it boils down to Cycles being based on the physical world and therefore generally creating more realistic looking renders.

A new Cycle

There are definitely things we could do to improve the output in Blender Render but I’m going to suggest we jump ship to Cycles and get this render looking nice and smooth. Unfortunately however you can’t just switch to Cycles and carry on rendering. You have to recreate all the textures in your scene using nodes.

For most objects you just need to create a diffuse shader that uses an image texture as an input for the colour and then assign filename-RGBA.png as the texture. You can either do this in the materials tab on the right or in the node editor.

minecraft-diffuse-texture-nodes-cycles

For objects that have transparency (leaves, flowers, grass, etc.) you’ll need to add a mix shader between the diffuse shader and the material output. Then you’ll need to connect a transparent shader to the first shader input of the mix shader and control its factor with filename-alpha.png.

minecraft-texture-nodes-cycles

Having made those changes you should get something like this.

Full colour Minecraft render

It takes a while to get all the materials set up and the render can take a long time (this image took about seven hours with a thousand samples) but the results speak for themselves.

If you want to increase the “realism” you can experiment with lighting and add emission shaders to textures that should be light sources. In the image below the environment is set to black, the lava is a mix of diffuse and emission shaders and there is a dim moonlight from above.

Lava Emission Shader in Cycles

Switching to cycles won’t solve any issues with incorrect or missing textures though, so for now it’s probably best to stick to vanilla minecraft worlds. I’d really like to make some nice renders of the particle accelerators and nuclear power stations that my friends and I have built in the previous games so it may become the subject of a future post.

Beyond Minecraft

If you want to experiment further you can make your own textures and assign them to whichever objects you like. I tried another version using a mix shader that combined diffuse and glossy shaders to produce a material similar to a hard plastic.

Hard white plastic cycles nodes

I then added a plane beneath the minecraft model, scaled it so it expanded beyond the view of the camera and assigned the same texture to it. I also used a plane out of shot to the right with an emission shader to simulate the light of a soft box. The result is the bright and clean renders below.

minecraft-white-render

Close up of Mix shader in Cycles

A quick bonus

The day after I posted this I found a YouTube video that explains how to render minecraft items in Blender. It’s really quick and easy to follow, best of all you can use it with cycles by creating a diffuse shader with the colour input set to the image.

Minecraft Iron Sword

Peeking behind the curtain

Recently I’ve begun experimenting with things I would have thought impossible a few years ago. The python script I wrote last week and the data scraping project that I’ve yet to write about have both made me realise that none of this stuff is witchcraft. With my hosting renewal coming up I started wondering about moving from shared hosting to a VPS.

For the last decade my personal sites and email accounts have been hosted with the same shared hosting company. They have always provided me with excellent service for a reasonable price and I’ve always been happy to recommend them to my clients. Now that my requirements have reduced a little and I’ve been seeing VPS offered for a fraction of the cost I thought it worth investigating.

It’s probably worth noting that none of my sites are high traffic or high importance. They consist of this blog and its predecessor, a domain I bought for my wedding, a development server and my mostly dormant company site. I’m not sure that I’d be confident deploying a client’s site on a VPS yet but for my needs it works just fine.

New adventures in hosting

For my first foray into configuring my own hosting I chose to go with Digital Ocean’s $10 VPS. I had some teething troubles with their one-click WordPress installer so I decided to roll my own by following their excellent documentation.

All of that got this site up and running and allowed me to use WordPress’ auto update feature. The only thing left to do was to get a mail server set up. I decided to take the easy option and went with Zoho. All you have to do is create a CNAME record for the domain to prove to Zoho that you own it and then you need to set two MX records and it’s good to go.

The whole kit and caboodle

Having been encouraged by getting this blog working I span up another droplet and went through the first three tutorials again to get a LAMP stack up and running. This time I remembered to create a snapshot of it so in future I can just create a droplet with my preferences in one click.

Once it was up and running I looked at the content I needed to migrate:

  • Company site: A few php files
  • Old blog: A WordPress site
  • Development server: Several sites, mostly php but a few also require MySQL databases
  • Wedding site: A holding page

I guessed that it would be possible to host all of these on one droplet, as they’re all fairly low traffic sites. I looked into setting up virtual hosts in apache and was relieved to find that again Digital Ocean’s documentation didn’t let me down.

I had decided that there was no point continuing with the old blog as I hadn’t posted in it for over a year. However I wanted to be a good net citizen and not break any old inbound links. So I decided to import the content of the old blog here and set up a redirect for old links. To redirect all requests from one domain to another all you need is these two lines in the .htaccess file on the old domain.

RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]

Having set up four virtual hosts, transferred all of the required files, set up my .htaccess file and pointed my name servers at Digital Ocean my hosting was done. Setting up Zoho for each domain was a little laborious but as they provide free mail servers I’m not about to complain.

Was it worth it?

Compared to standard shared hosting you’ll have a lot more passwords to keep track of, you’ll spend most of your time in terminal rather than a web based control panel and you are your own tech support. It’s definitely not for everyone and your mileage may vary but I learnt a lot from the process and have cut my hosting bill by about 66%.

Over-engineering #firstworldproblems

I have finally backed a kickstarter campaign for the first time. It’s a 3D printer called Tiko and I’m really excited about receiving it. So excited in fact that I would really like to get it earlier than the February ETA I originally pledged for.

Some of the early backers have been concerned about the lack of updates, photos and videos from the Tiko team and have been cancelling their pledges. This has opened spaces in the pledges with earlier estimated shipping dates. The other day I was fortunate that I refreshed the page at just the right moment and managed to change my pledge to one with a January shipment. That got me wondering if I could come up with something that would alert me when the slots opened up.

It turns out I was not alone in my thinking as there is a project on github that automates the whole process, including managing your pledge. The author notes that it is somewhat dubious and probably goes against kickstarter’s T’s & C’s. So I decided that I’d have a go at rolling my own version that would just alert me.

Everything I read said that for scraping Python was the way to go. Having never written a line of python I thought it would be an interesting project to play with a new language. I quickly found BeautifulSoup and after a few visits to a number of tutorials I had a script that would output the info I wanted to the command line.

Automating and alerting

This first script would have been fine if I was always sat at my laptop but ultimately isn’t anymore useful than hitting cmd-r on the kickstarter page itself. So I needed a way for the script to alert me. I remembered playing with PushOver a while back to get alerts from my minecraft server. I created an account with them and set up an application, looked at their python documentation, installed the iOS app on my phone and that was that.

All that was left was to automate running the script. I’ve heard of cron jobs but had never needed to create one until now. A quick google lead me to a simple tutorial and I was up and running.

Putting it all together

The cron job triggers the script, the script scrapes for all of the reward info from the kickstarter page. If there is a reward with a ship date in November and there are currently less than the maximum number of backers it triggers a PushOver notification. My phone then receives the notification and pushes it to my pebble.

Within five hours of launching the cron job my pebble buzzed to tell me the November slot was available and after some over-excited mashing of the keyboard I secured the slot.

Win!

The script itself

As I mentioned earlier I have never written a line of python before this project. The code below works but it definitely could be refactored and improved (try not to judge me).

import requests
from bs4 import BeautifulSoup
import httplib, urllib

url = "https://www.kickstarter.com/projects/tiko3d/tiko-the-unibody-3d-printer/description"
r = requests.get(url)

soup = BeautifulSoup(r.content)

rewards = soup.find_all("li", {"class": "NS-projects-reward"})

print "nn"

for reward in rewards:
    rewardCost = str(reward.find("h5").find("span").text)
    shipDate = str(reward.find("time").text)
    numBackers = str(reward.find("span", "num-backers").text)
    x = int(numBackers.replace(" backers", "").replace(",", ""))

    # backersClean = backers.rstrip()
    if shipDate == "Nov 2015" and rewardCost == "$179 USD":
      if x < 2500:
        conn = httplib.HTTPSConnection("api.pushover.net:443")
        conn.request("POST", "/1/messages.json",
          urllib.urlencode({
            "token": "[TOKEN]",
            "user": "[USER]",
            "message": "$179 reward now available",
            "device": "iphone",
          }), { "Content-type": "application/x-www-form-urlencoded" })
        conn.getresponse()
    if shipDate == "Nov 2015" and rewardCost == "$139 USD":
      if x < 400:
        conn = httplib.HTTPSConnection("api.pushover.net:443")
        conn.request("POST", "/1/messages.json",
          urllib.urlencode({
            "token": "[TOKEN]",
            "user": "[USER]",
            "message": "$139 reward now available",
            "device": "iphone",
          }), { "Content-type": "application/x-www-form-urlencoded" })
        conn.getresponse()
    if shipDate == "Nov 2015" and rewardCost == "$99 USD":
      if x < 100:
        conn = httplib.HTTPSConnection("api.pushover.net:443")
        conn.request("POST", "/1/messages.json",
          urllib.urlencode({
            "token": "[TOKEN]",
            "user": "[USER]",
            "message": "$99 reward now available",
            "device": "iphone",
          }), { "Content-type": "application/x-www-form-urlencoded" })
        conn.getresponse()

UPDATE: Disappointingly it looks like my Tiko is never going to arrive as the creators seem to have run out of money.

What’s my motivation?

Why am I writing?

I wanted a new project, I have an interest in the web and I wanted to improve my writing. I had been thinking about learning a new programming language for a while and it occured to me that perhaps I could do that and write about it as I went along.

I mentioned the idea to one of the Ruby developers at work. I was fairly sure that as I’m a newb I would have nothing useful or interesting to say. His response inspired me to write everything on this site. He said, “There is always someone that started learning a week after you”.

So I plan to spend 2015 learning Ruby and blogging about my experiences. I aim to write at least one post a fortnight but I hope to exceed that. I will post my code to a public github as I go along for others to play with, advise on, improve or maybe even use.

What have I done?

I have been making websites since I was about thirteen. I started playing around writing HTML in Notepad on the family computer back in the mid-ninties. I received an original iMac in exchange for my first “paid” website about three years later and started taking it a little more seriously from then on.

I have worked as a freelancer on web and graphic design projects on and off around day jobs since then. I have a design company called Image Circus and still take on occasional projects when time allows.

Primarily I have built sites on top of WordPress, Drupal and Concrete5. The projects mainly involved a lot of front-end design and leaving the CMS to do the heavy lifting.

Last year I decided to roll up my sleeves and learn PHP. After about eighteen months I got to a place where I felt quite comfortable with the basics and confident that I could find my way through the things I didn’t know as they arose. I built an eCommerce site, a gallery for my wedding photos and a tool to generate avatars from minecraft usernames.

I learned from Treehouse, a couple of books and a lot of googling. Handily my brother is a senior developer and despite living across the pond he gave me plenty of advice and suggestions to improve my code. I am also priviledged to work with an amazingly talented bunch of designers and developers. All of whom have helped me out with various questions along the way.

Who am I?

“He’s just zis guy, you know?” Gag Halfrunt

I’m a recent immigrant to the capital from the wilds of Kent. I work in a non-technical role for an awesome public sector web agency near the hallowed roundabout. I get to meet all sorts of interesting people that I had never expected to work with and I get to have meetings in some of the most awesome buildings in London. Most importantly I believe that the work we do makes a difference and it feels good to be involved in improving the public sector for everyone.

In my spare time I like to tinker with code and occasionally electronics. I’m interested in multirotors and the potential applications of aerial platforms. I also love video games but rarely find time to play them.

I’m married and live with my wife and our two cats in North London.

Cheap HTPC Remote

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

For a few years now I’ve run a Mac Mini as my main source of media. Originally I just used it as a server and had a jailbroken Apple TV running Plex for the front end. Recently I’ve found that I watch a lot more content online and it’s more convenient just to connect the Mac Mini directly to the TV although this raises the issue of controlling it.  Screen Sharing does a good job but for convenience I wanted a dedicated remote.  Apple’s wireless keyboards and trackpad are insanely expensive so I turned to the web for a cheap HTPC remote.  DX.com had me covered, always a bastion for cheap chinese electronics they have a veritable smorgasbord of bluetooth keyboards and trackpads available.

I opted for the succinctly named “Genuine Rii Mini I8 Wireless 92-Key QWERTY Keyboard Mouse Touchpad with USB Receiver – Black”, for under £20 it was worth a try.  It was delayed in delivery due to some other items in my basket being on backorder but after a few weeks it arrived.  It comes packaged in a fairly generic box with some poorly translated english instructions and a USB to Mini USB cable.

Cheap HTPC Remote Keyboard Views

Construction and Design

The build quality was considerably higher than I expected, no flimsy plastics, squeaks or creaks. The plastic has a smooth finish, feels slightly rubberised and fits well in your hands. It’s about the size of an Xbox 360 controller but much thinner. The back of the device has a panel that slides off to reveal a lithium ion battery and the USB dongle.  The top edge of the device has a simple on/off slide switch and a mini USB port for recharging.

The lower two thirds have a fairly standard keyboard layout and the upper third has a trackpad flanked by some function buttons and two circular pads with media and navigation controls.

Functionality

Retrieve the USB dongle from the back of the device, plug it into the Mac, switch on the device and it’s ready to use. The trackpad is responsive and easy to use. The layout of some of the buttons is a little questionable but you get used to it quickly. Typing on the keyboard is okay although I’ve noticed several missed key presses. It’s not a deal breaker as I only need to type in the odd searches now and then. The “Win” key maps to the Command key on the Mac and shortcuts work reliably. The navigation buttons on the top right work in Plex and Safari and the media buttons at the top left trigger iTunes.

Conclusion

Overall I’m very impressed with the device and I have found that I rarely use Screen Sharing any more. The Mac Mini is running a Minecraft Server, the Plex Media Server, my main iTunes library and a few other services.  All of these can easily be administrated with this wireless keyboard. For under £20 I think you’d be hard pressed to find a better remote. As I mentioned at the top of this post DX stock a huge array of these devices and I imagine that they probably all have the same electronics inside so you can pick based mainly on aesthetics and layout.

Tekkit Classic with Minecraft 1.6.2

Note: This post was originally published on iamianwright.com it’s been moved here for archival purposes.

Following on from my previous post I wanted to write a little more about the issues I found trying to get all of the Tekkit Classic mods working with Minecraft 1.6.2.

Having discussed everyone’s requirements, my friends and I agreed that we wanted all the features of Tekkit Classic with the additions of Stargate, Twilight Forest, Archimedes Ships, Useful Foods, Treecapitator and a few others. I read a lot of guides and figured out how to set up a custom Forge server for Minecraft 1.6.2.

Now we can install any mods we want but there are some caveats. Firstly not all mods work with Minecraft 1.6.2 and secondly not all mods work with each other. This is where we hit the first problem, Tekkit Classic is built on Minecraft 1.2.5 so all of the mods that come with it are designed for that. Some of them have been updated to 1.6.2 but unfortunately not all.

Mod Name 1.6.2 Download
Balkon’s Weapon Mod Yes Here
BuildCraft Yes Here
BuildCraft Additional Pipes No
ccSensors No  
ComputerCraft Yes Here
IC2 Charging Bench Yes Here
Dimensional Anchors Yes Here
Equivalent Exchange 2 No
Ender Storage Yes Here
Industrial Craft 2 Yes Here
IC2 Advanced Machines Yes Here
IC2 Compact Solars Yes Here
IC2 Nuclear Control Yes Here
Immibis Core Yes Here
Inventory Tweaks Yes Here
Iron Chests Yes Here
MAtmos Yes Here
Modular Force Field System Yes Here
Not Enough Items Yes Here
Nether Ores No  
Power Converters Yes Here
Railcraft Yes Here
Red Power No  
Rei’s Minimap Yes Here
Tube Stuff Yes Here
Wireless Redstone WR-CBE Yes Here

Of the modules missing the Additional Pipes for Buildcraft and the Sensors for ComputerCraft were no big deal as I don’t think any of us have ever used them.  Equivalent Exchange 2 not being available is a bigger problem as one of my friends is very keen on that mod.  EE3 is available for 1.6.2 but it is arguably not as good (or perhaps it’s just more balanced). Nether Ores are no big loss either as none of us really mine in the nether.

Red Power is an issue though as it includes so many features. There are some modders working on creating similar mods for 1.6.2, Immibis has RedLogic and I came across a few others.

Unfortunately I was unable to get RedLogic or Equivalent Exchange 3 to install with the other mods on my server.  I’m hoping there will be some updates that may resolve that in the near future as they make up a large chunk of the features of Tekkit Classic.

This is my final set of mods, including what I could from Tekkit Classic and the additional ones that we wanted.

  • Advanced Repulsion Systems 56.0.0
  • Advanced Machines 56.0.0
  • Arhimede’s Ships 1.6.2
  • BuildCraft 4.0.2
  • ChickenChunks 1.3.3.2
  • CodeChickenCore 0.9.0.5
  • ComputerCraft 1.5.6
  • Dimensional Anchor 56.0.1
  • Dyeable Beds 1.6.2
  • EnderStorage 1.4.2.2
  • Greg’s SG Craft Mod 1.6.2
  • Immibis Core 56.0.5
  • Immibis MicroBlocks 56.0.5
  • Industrial Craft 2
  • Infinitubes 56.0.1
  • Iron Chests 1.6.2
  • IC2 Charging Bench 1.90
  • Not Enough Items 1.6.1.3
  • Teleport Pipes Mod 1.6.2
  • Timber! 1.6.2
  • Twilight Forst 1.19.3
  • Useful Food 1.6.2
  • Weapon Mod