Blog

As a developer it is important for me to reflect on my practices, reflection on the process allows me to draw the greatest understanding possible. Having not learnt from a mistake makes the mistake not worth having been made; the same could be said for successful actions too.

logd-html  Aug. 28, 2016

It's been a while since I have posted an entry here, or updated any code on github. This is mostly due to working long days now that I have moved to a full-time programming job. I do still want to work on my own projects though and I have finally started getting back into it.

For a while I resisted the idea of using dub to manage my D projects. This was because I valued being able to compile my own projects letting me develop solutions that require only the bare-bones to run.

I recently gave dub a go and I am super happy with it's ability to manage dependencies, build configurations and produce sublime text project files.

Part of my goal with this project was to configure continuous integration along with unit testing to develop some useful and robust open-source software. For continuous integration I have opted with Travis CI for automatic builds and Coveralls for test coverage.

I have now converted the d logger I have written about previously to library and added it to the Dub package repository, called logd-html. This makes it easy for me to include in future projects, the first of which is my game engine joshDeng.

Writing a game engine is no simple task, even a small basic engine requires a large amount of infrastructure. As I can only work on this project in my, currently limited, free-time, it could be some time before I get a usable build going, but my intention is to put together a system at a time and add extra modules, such as audio and physics, as I need them. My aim is to have the engine included in the dub packages also so it can be easily pulled into different projects.

That's it for now, but I should have more coming soon.

dieRoll.sh  Feb. 18, 2016

I have been learning a bit of bash scripting at my new job to help automate tasks and manipulate files so created this simple script which lets you roll a dn die m times

gist

It's quite simple and has a tidy output but I felt it a great little problem to help cement parts of my understanding.

Colour-coded Logger  Dec. 6, 2015

So I implemented a nice logger in D today. It is based off of Patrick's Denj Logger but I embellished it a little so that it outputs a html file. I allowed for different html tags to be used, so I could output

headers

and bold text.

I also added a level system so that I can have coloured output.

Log(Level.success, "SDL initialised");

outputs green text to represent a successful event.

Log(Level.update, "Drawing to screen");

outputs white text that isn't really important but lets me know how the flow of the program progresses.

Log(Level.warning, "Could not load image");

outputs orange text for cases where a task failed but isn't critical to the running of the program.

Log(Level.error, "SDL could not initalise");

outputs red text for times when a failed task could stop the program from running or if there isn't a point in running the program any further.

Log(Level.event, "Application closed");

outputs yellow text that signify a single event occuring that's reasonably important but doesn't have a success or failure result

Log(Level.user, "SDL initialised");

outputs cyan text. I will use this one the most when debugging code to check specific events in flow and to check if lines of code are being hit properly.

example

2HR Make-A-Thing  Oct. 29, 2015

Heading to PAX Australia for the weekend, so that I can immersive myself in the industry I want to be a part of. On the flight down, as a challenge, I decided to spend the trip recreating Breakout in JavaScript. This was partially because I have just started taking a look at using HTML5 canvases and JavaScript to make simple 2D games or for prototyping concepts, and partially because the laptop I brought with me doesn't have any other compilers on it.

In 2 hours I managed to get some draw code running, the ball bouncing around the screen, bricks drawing in a grid and the start on so because me simple collision detection between the ball and the bricks. I found this to be a pretty great exercise because I had no internet to refer to and I had to remember the functions I needed to call. I have come to greatly appreciate documentation.

Progress

You can grab the file below and run it in your browser to see my progress. I plan to keep working on this project over the weekend to see how far I can get.

Download Here

Dynamic Development  Oct. 27, 2015

It's kind of funny how often I discover some bug or unintended behaviour in my new website, stuff I haven't realised would happen when I add more content. This time it was with content on my homepage. I added a fairly lengthy blog post, which had an image in it and a chunck of syntax highlighted code.

There two problems, firstly the image stuck out of it's column, this was because the image is being added via a link in markdown when I write a post. Secondly displaying all of the text in the post was ridiculous. My solution was to write a bit of javascript and to integrate Readmore.js to shorten the text div.

The javascript was as follows:

window.onload = function() {
 //Integration with readmore
 $('article').readmore({
   moreLink: '<a href="#">More</a>',
   lessLink: '<a href="#">Less</a>',
   collapsedHeight: 500,
  });

  //Make sure images have bootstrap's responsive class added
  $('img').addClass('img-responsive');
 }

Index