Archive

## Tag Cloud

3d account algorithms announcement archives arduino artificial intelligence assembly async audio bash batch blog bookmarklet booting c sharp c++ challenge chrome os code codepen coding conundrums coding conundrums evolved command line compiling css dailyprogrammer debugging demystification distributed computing downtime embedded systems encryption es6 features event experiment external first impressions future game github github gist graphics hardware hardware meetup holiday html html5 html5 canvas interfaces internet io.js jabber javascript js bin labs learning library linux low level lua maintenance network networking node.js operating systems performance photos php pixelbot portable privacy programming problems project projects prolog protocol protocols pseudo 3d python reddit reference release releases resource review rust secrets security series list server software sorting source code control statistics svg technical terminal textures three thing game three.js tool tutorial tutorials twitter ubuntu university update updates upgrade version control visual web website windows windows 10 xmpp

## Achievement Get: Upgrade Server - A writeup of my experiences

The upgrade is complete! I've managed to move practically everything over to the new server, apart from a few automated cleanup tasks here and there. There are still a few issues floating around, but they shouldn't affect this website, and I should have them cleared up soon. Although the migration went smoother than I expected, I did encounter some issues and learnt a few things that I thought I'd share here.

The first thing I found was that starting a todo list isn't a rather good idea. It sounds simple, but it's actually really useful. I found that I had a lot of small tasks I needed to complete, and I kept thinking of more things that needed doing at regular intervals. If I didn't write them down I'd never get anything done because I'd never be able to remember what needed doing first!

It also helps to do your research before you move. Make sure that you're properly reaquainted with all the software running on the system that you're going to migrate from, and that you're familiar with all the ins and outs of your particular situation. If you aren't, then you risk stumbling across some rather nasty, complicated, and time consuming problems mid-migration.

It also helps to do as much of the migration as possible without taking the old system offline. Install the software, Move the configuration files. Set up the firewall. Set up your new monitoring tools. This allows you to minimise the downtime that you have to subject your users to, which is always a good thing.

Lastly, testing is incredibly important. test everything. Make sure that every little feature after you migrate. You'd be surprised at how many issues can crop up after migration.

## C++ in Review

I started learning C++ back in September, and I think I've experienced enough of it in order to write a proper review post on it. I've been wanting to do this for a while, as I have quite a bit to say about it.

I think I should start off by saying that C++ is complicated. Very complicated. To the point that you could learn about it for years and still not be half way through everything that you could learn about it. While this offers unparalelled customisablility, it also makes it difficult for new programmmers to pick up the language. Even worse is that whilst something might work, it could easily contain a critical security bug that can be extremely difficult to spot.

It's also difficult (for me anyway) to remember what everything is and what it does. For example, a const int* is not the same as an int* const. I find myself constantly looking things up that I forget over and over again. On top of this, a large number of the core built in functions don't actually do what you'd think they would. For example, getline() doesn't get a line of text, and fail() checks to see if an error occurred whilst opening it. These names can't be corrected in a later version of C++ either - later C++ versions must be able to compile previous versions of the language, including pure C from 30 years ago. Perhaps this is what makes it so difficult to use?

The other thing that makes C++ annoying and difficult to use is how low level it is. You end up having to do almost everything yourself - even things that you'd think would be built into the language already. The standard template library (STL) provides a large number of methods and data strutures to fill in the gaps, but most of these are misnamed too (the vector class is actually similar to a C♯ List), so you end up implementing your own anyway because you can't find the class you want in the STL (only to have someone point it out later).

Thankfully, there is a reason why everyone is still using an old broken language to write important code - it's practically the fastest language out there short of assembly language. No other language comes close to rivalling C++ in speed. Is this the only reason we are keeping it?

## My favourite Atom packages

A while ago I posted about how much I like the Atom editor. A few months on, and I'm still in agreement: The Atom editor is an absolutely lovely general purpose editor. It's got a bewildering array of plugins, and I thought that I'd share a few of my favourites with you.

Termrk has to be my number one. It adds a toggleable terminal to the bottom of the screen (and presumably other sides too!). This is particularly useful for sorting out particularly nasty version control system problems, or using a quick one liner to process a few files, or starting a development server in the background. If you know your way around the console / terminal, this package is a must have.

Git Plus is also really useful. As you might suspect, it brings git integration to atom. It has a gui for all the common git commands - committing, branching, pushing, pulling, and more. If you use git, install this package.

Minimap and friends are awesome. If you didn't know about the map mode for the scroll bar in Visual Studio (go to tools and search for "map"), this package brings that to Atom. It has a bunch of plugins, too - which let you preview other points on the minimap, or show the current selection, or show changes since the last git commit. Its appearance is simple and uncomplicated, with one 'pixel' for each character - coloured according to that character's colour. I've been finding it to be just what I need when you're dealing with a large complex codebase. (and minimap-titles is an awesome extra too)

If you use multiple computers, sync-settings is worth a look. It synchronises your settings and installed packages by using a Github gist. I use it as a backup for my settings, but it'll be also useful when I finally get around to setting up a portable installation of atom on my flash drive.

There are a ton of other brilliant packages out there that I've found and I could write about them all night, but that would make this post way too long :) If you're interested in which packages I've got installed, I've uploaded a list to pastebin.

## Happy New Year 2016!

Welcome to 2016!

I wanted to write this post to wish you a very happy new year! I also wanted to thank you for being a part of the first full calendar year for which this website has been live. Out of curiosity, I counted the number of posts I've made on here this year, and the total came to 104, which works out to roughly 1 post every 3½ days.

Just a few of the highlights of 2015 include Rob Miles' Coding Conundrums series, continued website improvements and better spam defences, and the EcmaScript 6: Features and Learning Prolog series.

In this new year I'll be continuing my learning Prolog series, and probably posting a bit about networking and 3D stuff, since I'll be taking a module in each of these areas.

## My thoughts on Basecamp

For the last few months I have been using basecamp to coordinate and communicate with my group for a (rather large) piece of coursework. I've had a reasonable amount of time to get used to basecamp and how it works, so (upon request) I thought that I would share thoughts on it here.

To start with, the summary page gives a quick overview of what has been going on recently, without giving you that feeling of information overload. The discussions are good too - they are arranged in chronological order with the avatar of the most recent commenter next to each post. The files section is ok, but it feels rather cluttered and would be more helpful if you could upload a new version of someone else's file.

The problems start in the "To-do lists" section. You can create multiple lists of items, but you can't create subtasks or tasks that depend on other tasks. This makes basecamp rather unsuitable for software development as I often find that in order to fix one issue I have to fix another first. I also like to categorise my todos (which basecamp doesn't support either) - GitHub issues do this very well. The ability to assign multiple people to a task would also make working in a group much easier. I also found that once I'd created a few todo items, it quickly got to the point where I couldn't tell them apart - it just looked like a big wall of text, but that is probably just me.

The last thing I haven't mentioned yet is the events tab. Here you can create events and have basecamp automatically email (optionally selected) people, which is nice, but a special field to specify the location of the event would be welcomed as I found in my group that the venue of our meetings kept changing. A number of different views on the calendar would make it even better - the month view displays too much time, and I always get times mixed in the agenda view.

To conclude, Basecamp is a good project management tool that you can use when working in a group, but is still a bit rough around the edges. I wouldn't use it for software development, but I'm not ruling it out for other kinds of projects (although I think that trello would probably better float my boat, depending on the situation).

## Thoughts on GitHub's new theme

The other day, I got a notification on GitHub asking me to try their new website redesign. Now that I've had time to think about it, I thought that I'd make a post on what I think about it.

To start with, the design as a whole feels more modern and a little bit more 'flat'. I'm not sure if this is a good thing or not yet, though it does make the interface feel less cluttered. This makes the content that the interface is presenting easier to digest.

The only exception to this is the top of the repository page, especially the code view (the view that you see by default). Having the different sections of the repository along the top rather than down the side makes it feel like there is more going on than there was before - and it can feel a little bit overwhelming at times. Add to this the new "Add file" and "Find file" buttons, and it really starts to feel rather crowded.

Having said that, cutting the design down to use a single column makes the interface a bit more consistent with the mobile view. This is a good thing - although I found that reducing the width of the page caused a horizontal scrollbar to appear - perhaps it would be better to allow the new design to resize to fit smaller screens? It also opens up more space that can be used to display other things - like the list of a repository's issues, or the network graph in the "Graphs" section (there's a bug with the network graph by the way - it appears to be cut off just before the edge of the box).

Having a single wide column also makes a repository's README (and other markdown documents) easier to, um, read. It makes them feel more like a webpage and less like a file that someone's uploaded, though this wasn't a huge issue for me before.

All in all, GitHub's new interface is an improvement. It's an improvement overall, which makes the interface feel more modern. The top of the repository view feels rather cluttered and definitely needs rethinking.

## My thoughts on SVN (or how to use git-svn to avoid it)

My university uses SVN as their preferred source code control system, and I came into contact with it for the first time the other day. For one of the modules I'm taking this year all the lab work is located in a special SVN repository. The ACW (assessed coursework) also has to be submitted through this SVN repository.

I found that (after some simple mistakes) it's not particularly difficult to pull down a repository - just a little bit fiddly (you have to create the directory to clone a repository into first). The trouble started when I tried to commit my changes. I found it almost impossible to just do a simple commit that contains all of the changes I'd made so far, though I might be missing something.

SVN itself feels rather clunky and outdated in the way it works. It doesn't have an inbuilt fork system, and you can't commit if you are offline (or if the central master repository is offline). Git, by comparison, supports both of these things. In addition, git apparently has better support for branching and merging, though I haven't come into contact with it yet.

My solution for this for now it to use git-svn. To check if you have it installed, simply run the command git svn --help. If it's installed, you will get a help message. If not, you'll get a harmless error message. On Linux you can install it via sudo apt-get install git-svn. On Windows you should have it installed by default.

With git-svn, you can clone an SVN repository much like you would for a regular git repository: git svn clone https://path/to/svn/repo. This clones a remote SVN repository down into a local git repository.

From here you can do any number of git commits as normal. When you are ready to push your changes back up to the remote SVN repository, simply run git svn dcommit. This will push all of your git commits up to the remote SVN repository as revisions.

Update: If you need to pull down remote changes from the server, simply run git svn rebase.

## Ubuntu: Second Impressions

I've had my laptop dual booted with Ubuntu for a while now, and I've been using Ubuntu in a Virtual Machine and as a live CD, but I've only just gotten around to rearrenging my partitions and reimaging my Ubuntu partition with Ubuntu 15.04. Previously, I had a bunch of issues with ubuntu (for example my laptop kept heating up), but I seem to have solved most of them and I thought that I'd post here about the problems I encountered, how I fixed them, and what I think of the latest version of ubuntu.

Firstly, I installed ubuntu from a live CD iso on my flash drive. Annoyingly, I used the 32 bit version by accident, and had to do it again. It would be nice if it told you which version you were about to install. Anyway, I found the installer to be rather temperamental. It kept freezing for ages, and all I could do was wait.

After the installation finished, I was left with a brand new, and very buggy, 64 bit Ubuntu 15.04 installation. As soon as it booted, the first job was to stop my cursor from flickering. Because I have an Nvidia GeForce 550M GPU, Ubuntu didn't recognise it properly (it detected it as a second 'unknown display') and so custom drivers were needed to fix it. I found this post, which guided me through the installation of both bumblebee (to control which of my two GPUs I use), and the official Nvidia drivers for my graphics card.

After banishing the flickering cursor, I found my laptop cooler, though it still wasn't right. Next up was to install thermald, indicator-cpufreq and lm-sensors. This trio of packages automatically controls the frequency of your CPU to both save power and prevent overheating. Normally, linux doesn't pay any attention to the frequency of the CPU of it's host system, leaving to run at it's maximum speed all the time - which causes battery drain and overheating.

Now that my laptop wasn't overheating too much, I could focus on other problems. When in Windows 7, I have something called SRS Premium Sound. It is brilliant at tweaking audio just before it reaches the speakers to improve it's quality. I quickly found when I got this laptop that it was essential - the speakers are facing downwards and the output sounds 'tinny' or 'hollow' without it. Since linux doesn't have SRS, the next best thing was PulseAudio, which provides you with an equaliser to tune your sound output with. Note that PulseAudio does actually work with Ubuntu 14, even though some people have said that it has been discontinued (I don't think it has?).

The other thing that needed changing was my touchpad. I felt like I had to hammer it in order to get it to recognise my touch, whereas in Windows it picked up the lightest of touches. My solution was to add the following to my .profile:

synclient FingerLow=2
synclient FingerHigh=3
synclient AccelFactor=0.145
synclient MinSpeed=1.25
synclient MaxSpeed=2
synclient CoastingFriction=30

This improved the responsiveness of my touchpad a whole lot to the point where I could actually use it without getting frustrated :)

That covers the main problems I came across. As for what I think, I'm finding Ubuntu to be a great operating system to work with - now that I've worked most of the bugs out. Things like indicator-cpufreq and thermald ought to be automatically installed on systems that support them at install time. You should also be prompted to install bumblebee and the offical nvidia graphics drivers at install time too, as a system with multiple GPUs (i.e. integrated graphics and a graphics card) are pretty unusable without them. Sensible default settings would be nice too - nobody likes hammering their touchpad just to get a response.

The Ubuntu unity desktop developers seem to have remvoved a bunch of configuration options from the GUI in recent releases. Hopefully they wil readd them - it's rather annoying to have to enter the terminal to change something as simple as the login screen background.

On the plus side, Ubuntu seems to load much faster than Windows 7, and is more responsive too. I also feel like I have more screen space to work with as there isn't a task bar taking up space at the bottom of the screen. The customisability is amazing too. I am finding that there are far more things that you can tweak and fiddle with in Ubuntu compared to Windows.

To finish off this post, here's a list of smaller problems I had, and a link to the appropriate post that fixed it for me:

## Windows 10: My thoughts

Welcome to another review post here at starbeamrainbowlabs.com. Sorry for the lack of posts lately, I have been busy with my Programming 2 coursework (there will be a post about this soon!). This post, however, is going to be all about my thoughts on Microsoft's new operating system, Windows 10. Brace yourselves: this might be a long post.

Recently I have obtained a copy of Windows 10 though Microsoft's DreamSpark program for university students. After a managing to download it (I had at least 1 failed attempt), I had to try it out in a virtual machine and write this blog post.

### Positives

Lets start with the good aspects of Windows 10. After using Windows 8, the ability to use the 'metro' apps (Yes I do know that they changed the name, but I don't know what they changed it to) in the windowed mode is really nice. Even though I liked the idea of using them in full screen mode, it got confusing quickly when multitasking.

I also noticed the new "Storage Spaces" option in the Control Panel. It look like you can pool the storage space on multiple drives to create one larger drive. I think it's a nice idea to make an interface to allow the average user to create RAID setups. It is also intelligent enough to put the most frequently used files on the SSDs in a setup, which is awesome.

The new (returning!) start menu is also a huge improvement. Although I haven't used it enough to know if your most frequently used programs appear at the top of your start menu (it really should), it still looks cool.

The other cool thing are the multiple desktops. You can create and remove desktops at will by pressing WIN + TAB. In this menu you can also manage the programs that you have open, just as you could before. Linux has had this feature for ages - it is good to see it finally landing in Windows 10 too.

### Negatives

Now that I have talked about the positives, I would also like to mention the negative things about windows 10. Sadly, this list is rather longer than the list of positives.

Firstly, when freshly installed, Windows 10 takes up about 10.1GB of space. I wanted to include this - I don't really know if this is better or worse than Windows 8.1. The first real bad thing about Windows 10 that I found was that the operating system's interface looks even flatter than the interface of Windows 8.1. What I mean by this is that the number of colours that have been used in the interface has been reduced again. Although it gives it more of a 'minimalist' feel, I don't think they have got it quite right. Google have it right with Chrome, but I think that Windows 10 takes it just a bit too far. That is just my opinion though.

The search box takes up a lot of valuable space on the taskbar, leaving less room for the program I have open. This shouldn't be a huge issue for those with large wide-screen monitors, but many of us (myself included) don't have one so quickly find that we have run out of room on our taskbars. The search box, in my opinion, belongs in the start menu and not the taskbar.

Another small tweak I found most annoying is that I couldn't set windows update to check for update but let me choose when to download and install them. You see, I prefer to check what is going to be installed before it happens - that way I can check on the internet to make sure that there aren't any major bugs in the updates that I am about to install. There is a workaround for this - you can set your internet connection to be a "Metered Connection" (another new feature of Windows 10), but that feels clunky and makes the metered connection setting feel useless to me.

The Apps, though improved, also have several issues associated with them. I would like the option to choose which apps I install at first during the setup - I found that a lot of (for me) useless apps got installed when I first installed Windows 10. That way I can save on hard drive space.

It would also be nice if your installed apps were shown in the "Programs and Features" section of the Control Panel (currently they are not shwon there). That would provide an easy mechanism with which I can remove the ones I don't want.

The apps don't freeze / hang as much as they did in Windows 8, but I still feel like they are a little bit too unstable - they can take a long time to load. This loading time feels even longer without a determinate progress bar to show that the app hasn't crashed. I feel that it is important to let your user's know that your program (and operating system!) is actually doing something. Advanced users may also like it if the operating system told you what is doing in addition to the fact that it is doing something.

I found that I couldn't remove OneDrive app (I assume that it's one). Since I don't use OneDrive (I have a different backup system in place), I didn't want OneDrive starting every time Windows started. I did (eventually) find that you can actually prevent it from starting with the operating system through the "Start up" tab of the task manager.

This leads me into the final point I wish to make: I think that they have tried too hard to make it 'integrated' with their other services such as their Microsoft Accounts and OneDrive. This reduces the number of choices that the user has and make the user feel as though they are forced into something that they perhaps do not want.

### Conclusion

All in all, Windows 10 looks like a definite improvement on Windows 8.1, but it still isn't quite right. I feel as though Microsoft isn't providing it's users with the choice that it used to - this is one of the key reasons I am using a Windows operating system now (I find Windows 7 to be both easy to use and flexible). For most purposes, Windows 10 will be a splendid operating system for the average user. I feel that advanced users will begin to grow frustrated by Microsoft's new operating system due to the lack of choice that is beginning to creep in.

Wow. That was a long post! Anyway, in the next post I will (hopefully) be releasing both the code and the binaries behind the coursework I have recently done.

## Language Review: Lua

I have recently tried writing a bit of Lua. I ported an implementation of a maze generation algorithm I came up with from Python to try it out:

-------------------------------------
-- Maze generation script
-------------------------------------
-- A test by @Starbeamrainbowlabs

---------------------------------------------
-- Intelligent table printing function
---------------------------------------------
-- From http://coronalabs.com/blog/2014/09/02/tutorial-printing-table-contents/

function print_r ( t )
local print_r_cache={}
local function sub_print_r(t,indent)
if (print_r_cache[tostring(t)]) then
print(indent.."*"..tostring(t))
else
print_r_cache[tostring(t)]=true
if (type(t)=="table") then
for pos,val in pairs(t) do
if (type(val)=="table") then
print(indent.."["..pos.."] => "..tostring(t).." {")
sub_print_r(val,indent..string.rep(" ",string.len(pos)+8))
print(indent..string.rep(" ",string.len(pos)+6).."}")
elseif (type(val)=="string") then
print(indent.."["..pos..'] => "'..val..'"')
else
print(indent.."["..pos.."] => "..tostring(val))
end
end
else
print(indent..tostring(t))
end
end
end
if (type(t)=="table") then
print(tostring(t).." {")
sub_print_r(t,"  ")
print("}")
else
sub_print_r(t,"  ")
end
print()
end

if arg[1] ~= nil then
width = tonumber(arg[1])
else
width = 36
end
if arg[2] ~= nil then
height = tonumber(arg[2])
else
height = 16
end

----------------------------------
-- function to print out the world
----------------------------------
function printspace(space, w, h)
for y = 0, h, 1 do
local line = ""
for x = 0, w, 1 do
line = line .. space[y][x]
end
print(line)
end
end

-- Initialise the world
start_time = os.clock()
math.randomseed(os.time()) -- seed the random number generator with the system clock
world = {}
for y = 0, height, 1 do
world[y] = {}
for x = 0, width, 1 do
world[y][x] = "#"
end
end

-- do a random walk to create pathways
nodes = {} -- the nodes left that we haven't investigated
curnode = 1 -- the node we are currently operating on
cx, cy = 1, 1 -- our current position
table.insert(nodes, { x = cx, y = cy })

world[cy][cx] = " "
while #nodes > 0 do
io.write("Nodes left: " .. curnode .. "\r")
--print("Nodes left: " .. #nodes)
--print("Currently at (" .. cx .. ", " .. cy .. ")")

local directions = "" -- the different directions we can move
if cy - 2 > 0 and world[cy - 2][cx] == "#" then
directions = directions .. "u"
end
if cy + 2 < height and world[cy + 2][cx] == "#" then
directions = directions .. "d"
end
if cx - 2 > 0 and world[cy][cx - 2] == "#" then
directions = directions .. "l"
end
if cx + 2 < width and world[cy][cx + 2] == "#" then
directions = directions .. "r"
end
--print("radar output: '" .. directions .. "' (length: " .. #directions .. "), curnode: " .. curnode)
if #directions > 0 then
-- we still have somewhere that we can go
--print("This node is not a dead end yet.")
local curdirnum = math.random(0, #directions)
local curdir = string.sub(directions, curdirnum, curdirnum)
if curdir == "u" then
world[cy - 1][cx] = " "
world[cy - 2][cx] = " "
cy = cy - 2
elseif curdir == "d" then
world[cy + 1][cx] = " "
world[cy + 2][cx] = " "
cy = cy + 2
elseif curdir == "l" then
world[cy][cx - 1] = " "
world[cy][cx - 2] = " "
cx = cx - 2
elseif curdir == "r" then
world[cy][cx + 1] = " "
world[cy][cx + 2] = " "
cx = cx + 2
end

table.insert(nodes, { x = cx, y = cy })
else
--print("The node at " .. curnode .. " is a dead end.")
table.remove(nodes, curnode)
if #nodes > 0 then
--print("performing teleport.");
curnode = math.random(1, #nodes)
--print("New node: " .. curnode)
-- print("Nodes table: ")
-- print_r(nodes)
cx = nodes[curnode]["x"]
cy = nodes[curnode]["y"]
else
--print("Maze generation complete, no teleportation necessary.")
end
end
--printspace(world, width, height)
end

printspace(world, width, height)
end_time = os.clock()
print("Generation completed in " .. (end_time - start_time) .. "s.")


I originally wrote it in Python 3 (I might post about the game it is part of at some point). After trying Lua for a bit I thought it would be a good idea to write up a language review about it.

Firstly, it is really easy to get started with. I was able to compile Lua from source using my MinGW on my Windows 7 machine. Lua is also really lightweight (500kb in total!).

The problems begin when you start looking at Lua's equivalent of arrays: tables. I found that they feel clunky and outdated as there appears to be a lack of manipulation functions. Those that do exist (table.insert() and table.remove() use a lot more characters to use than the equivalent in other languages, such as Javascript (e.g. table.insert(tablename, "somestring") is 40 characters, compared to Javascript's tablename.push("somestring"), which is only 28` characters - a 30% saving!)

Lua's tables also start indexing from 1, not 0 - I found this to be a source of much confusion when I was experimenting with it.

The other thing I found annoying is that strings in Lua are immutable - which means that you can't change them once you have declared them. This can lead to lots of nasty performance issues in programs that do a lot of string manipulation if you are not very careful since every time you re-set a string variable's contents, you are creating more work for the garbage collector.

All in all, Lua looks like an interesting language to learn for fun - you should definitely check it out, if only to see how odd a language it is. I love how lightweight it is. I also managed to build the Lua interpreter from source too, which is always a plus. I can't see myself using it for any real project any time soon though - it just feels too clunky to work with for my purposes, although this is probably more down to my lack of experience and the other languages that I know than the design of the language itself.

Art by Mythdael