Getting started with Go Microservices and Docker

What is a microservice

First, you need to learn about the go language. Do these pages in order to learn the bare basics:
https://tour.golang.org/
https://golang.org/doc/install
https://golang.org/doc/code.html

Then you’ll need to learn what docker is, read the understanding docker page:
https://docs.docker.com/introduction/understanding-docker/

And then go install docker and run their hello-world example:
https://docs.docker.com/installation/

Now hopefully you have the basics of go and docker down, so let’s grab an existing microservice and set it up.

On your docker host run:

wget https://github.com/danzel/go-docker-playground/archive/master.tar.gz
tar -zxf master.tar.gz
cd go-docker-playground-master
docker build --tag=danzel/go-docker-playground:1.0 .

This will fetch and then build this docker image which contains a simple web server. Now we can start it up with:

docker create --name=test -P danzel/go-docker-playground:1.0
docker start test

Docker will automatically expose the server on a free port (Thanks to EXPOSE in the Dockerfile and -P in the docker create command line).
To see the port it has chosen:

docker ps

Then you should be able to open it by browsing to http://dockerhostip:port

Why I haven’t merged your Pull Request

When you have a popular repository on github, you can get a lot of Pull Requests.

Some of these are good, some need work and some should never be merged. As the maintainer it is your job to figure out what category each PR fits in to, work with the original author to fix any issues and finally do the merge.

But how do you decide what PRs should actually end up in the project?

The naive view would be to merge every feature. But what if that feature is only useful to one person? Is the person submitting that PR going to stick around to maintain their code in the future or (more likely) is maintaining that code going to fall to you? Is the feature even something that other users want?

Every change adds extra weight to the project that must be carried and updated when any refactoring is done. These features also add complication to the project that can hinder further changes. Sometimes the best change is one that makes the project more extensible without adding any features itself.

 

The way I deal with PRs that I’m not certain about is to let them sit. If someone else wants them they’ll hopefully come along and comment on them. Usually this works well, PRs that add or fix urgently needed things tend to have people on there asking for them to be merged.

Sometimes your PR won’t get merged or looked at because the maintainer has other things to do. The people who maintain projects on Github are people, they only have a limited amount of time in their day and they probably have a job they should be doing.

And finally sometimes the maintainer will miss the notifications so your PR never gets looked at. So don’t get too upset when things don’t get merged, wait a while

 

TLDR

Ways to help your PR be merged

  • Explain why your change exists
  • Add tests
  • Fix build errors
  • Change anything that is requested
  • Bump it after a weeks in case the maintainer has missed it

Ways to help your PR not be merged

  • Break the build
  • Do a large amount of changes
  • Include automatically generated files

Installing RetroArch on your iOS device as a developer without building from scratch

Grab the .deb file from their cydia repo http://www.libretro.com/index.php/downloads/

Extract it with “ar xv something.deb” (I had to use a linux machine for this)

Create an Entitlements.plist like on here:
http://stackoverflow.com/questions/15634188/resigning-an-ios-provisioning-profile
(The example is missing )
Replacing the application-identifier with one compatible with your signing cert.

Save the following as r.b64 (This file gets created automatically if you build the project)

nBsaXN0MDDRAQJVcnVsZXPTAwQFBgcMUi4qXxATUmVzb3VyY2VSdWxlcy5wbGlz
dFpJbmZvLnBsaXN0CdIICQoGVndlaWdodFRvbWl0I0BZAAAAAAAACdIICQ0GI0Ak
AAAAAAAACQgLERgbMTw9QklOV1hdZgAAAAAAAAEBAAAAAAAAAA8AAAAAAAAAAAAA
AAAAAABn

Convert it into ResourceRules.plist with:

cat r.b64 | openssl base64 -d > RetroArch.app/ResourceRules.plist

Run roughly these commands:

$CODE_SIGN_IDENTITY – Your signing name, check “Keychain Access”

$PROVISION – a copy of your provisioning profile file

 codesign -fs "$CODE_SIGN_IDENTITY" RetroArch.app/modules/*.dylib
 cp "$PROVISION" RetroArch.app/embedded.mobileprovision
 cp ResourceRules.plist RetroArch.app/
 codesign -f -s "$CODE_SIGN_IDENTITY" --resource-rules RetroArch.app/ResourceRules.plist --entitlements Entitlements.plist RetroArch.app
 xcrun -sdk iphoneos PackageApplication "RetroArch.app" -o "RetroArch.ipa" --sign '$CODE_SIGN_IDENTITY' --embed "RetroArch.app/embedded.mobileprovision"

Install the IPA 😀

Installing XBMC (Well, SPMC) as boot on Ouya

  1. Update OUYA to latest OS (not really required, but whatever).
  2. Log in
  3. Enter payment details (bypass http://ouyaforum.com/showthread.php?4213-How-To-Bypass-Rhe-Payment-Card-Requirement-With-A-Test-Card-Number)

Future stuff can be installed by going to make, upload. Then open that web url from a PC and drag and drop the apk files on.

  1. Install KingRoot http://ouyabrew.com/updated-one-click-root/
  2. Install SuperUser (probably not actually needed) http://www.s-config.com/root-the-ouya-google-play/
  3. Install busybox http://www.s-config.com/root-the-ouya-google-play/
  4. Install ssh server (for remote file access) https://play.google.com/store/apps/details?id=web.oss.sshsftpDaemon
  5. Install SPMC launcher version http://spmc.semperpax.com/

Now when you reboot OUYA will ask if you want to boot ouya or SPMC.

What I’ve been up to lately

I’ve spent my holiday break working on a blog series on modern RTS game techniques.

To start it off I’ve done a Flow Field pathfinding implementation, this is the sort of pathing that Supreme Commander 2 and Planetary Annihilation use.
It’s not as sophisticated as their yet, but its only a few days work 🙂

Check it out http://howtorts.github.io/

Diablo 3 – Hardercore mode

D3 too easy? Try Hardercore mode.

Start a new character on Hardcore mode. The first thing you want to do is throw away your starting weapon.

From now on, the first item that you find of each type is the item you must use for that slot, if you find a nice magic sword, hurray! If you find a blunt dagger as your first weapon, boo hoo.
At the start of each act you can choose to throw away any items you don’t want. Again the first item you find of its type is the only one you can put in its slot.

To make this a bit easier – at the start choose:
– One/Two Handed Weapon.
– Melee/Ranged Weapon.
You may only equip this weapon type.

Possible Rewards:
Beating each act boss – may replace an item with one of the items they dropped.
Gaining the Blacksmith – A single use of his crafting straight away, you must use what he makes.

Obviously no Auction house action (selling is allowed), no buying from NPCs and no twinking from your other characters.

These modified rules are pretty close to first item only ironman.

I’m going to give this a go now with a Demon Hunter. Let’s see how long I survive 🙂
I’ve chosen one hand ranged as my weapon type which I believe will give me an advantage so long as I survive till I get one. First 1 hand xbow is req level 5 , ilvl 7.

 

Level 2 – Impale. It works without a weapon, no idea how but I’m glad, this gives me my first ranged attack!

First Item – Thick Sash. Off to a good Start!

Second Item – Inferior Gloves 🙁

Thick Cloth Tunic, yeah boi!!

Killing the horder finds me my first magic item, “Hand axe of the Snake”, it’s not for me:( I do however get a Thick Buckler to up my defence!

Cloth Pants! No Thick mod on these ones, but at least I have more armor.

The boss in adrias Hut finds me a magic two handed bow with +dmg, +attack speed. Not for me though!

I don’t know if it’s on purpose, but I just realised my character punches with her shield arm more often than her free hand.

Found +4% run speed shoes in a chest. Woot!!!

Took down my first boss pack: teleporting ravenous dead (zombies), not too hard, just throw a lot of punches and use impale for extra damage.

Level 4! Caltrops finally, hope they work like they did in SC 🙂

Very slowly took down a blue pack of teleporter carrion bats, almost level 5!
Damaged bracers, almost got all the slots filled 🙂

Made it to level 7, nothing interesting to report except that elite mobs take forever to kill. Am just at the cemetery, these are going to take a while to clear, hope I can finally find a weapon in them!

Smashing the infernal orb trap (after running away from the skeletons) gets me to level 8 and drops a magical hat (I have no hat yet) +6% magic find woo!!! Smoke screen hurrah!

Crown rescued, crypts took a long time. Killing enemies is now officially taking waaaay too long.

Templar rescued, that took a bit. Still punching and impaling enemies (summoners are such a pain). Hit level 9, yay extra skill slot for smoke screen.

Killed a harvester (exploding fatty) in cathedral level 4, he dropped a Fine Simple Hand Crowssbow. +20% damage and I finally have a weapon, WOOT!

Found my first treasure gob, took him down with rapid fire.

Level 10, enemies are pretty easy now. Packs of burrying leapers hurt a lot however, few close calls there.

Lots of boring bits in here skipped, no interesting things happen.

Spider caves are quite hard, first near death experience with a waller spider pack. double smoke screen luckily gets me out of there.

Leve l 14. Find a blue shoulder off a treasure gob, +6 dex, +8 xp, woot!

Moments later a white mob drops my first ring… +5% gold from monsters 🙁
And my 2nd ring +5 Life after each kill, nice!

At Halls of Agony L1.

IronXNA – Bordered SpriteFont

I’ve been messing with XNA lately, which has been quite awesome. One of the things that I felt was missing with the built in SpriteFont was the ability to render SpriteFonts with borders (or outlines, whatever you want to call them).

My Google-Fu turned up nothing, so I wrote my own implementation based on the Text Renderer I’d written for internal Ironshod usage.

I’ve released it on Github here for everyones enjoyment: https://github.com/danzel/IronXna

Beautiful Example:

When drawing text, both the inner and outer color can be changed.

It tries hard to draw text with the same spacing as SpriteFont, but it doesn’t always achieve it.

Ironshod releases Reverse Maze

Hi Everyone 🙂

I’ve been working hard the last 6-7 months doing the coding for Ironshods latest iPhone/iPod touch game: Reverse Maze

Reverse Maze is a maze puzzler where all controls are backwards. Your goal is to get from the starting point to the exit without touching any walls or objects.

Go get it on the App store now

Defense Station Touchable Released!!!

Today I am proud to announce that Defense Station Touchable has hit the iTunes store!

Defense Station Touchable is the iPhone/iPod version of Defense Station Portable (PSP Homebrew).

Now containing 5 maps, each with 50 waves of enemies for a super happy fun time!

 

Head over to the all new Ironshod Website for details! Or jump straight onto iTunes and buy it now!

 

The PSP version should be released in the next week or 2, so keep an eye out 🙂

If you are a level designer, then go to the Ironshod Website and get the PC version to start developing and testing your levels for the DSP release. Contact me with any questions you may have.