Random musings

Rust Tips and Tricks Oct 20, 2016

Rust has been seeing increased adoption, both in academia and industry, over the past few months. This is great news for the language and its community. However, it inevitably also means that a number of people with relatively little experience in Rust are exposed to Rust codebases, and, in many cases, are asked to modified them.

Choosing a Programming Language Jun 6, 2016

One of the first decisions one has to make when learning to program is which programming language to learn. In some cases, the choice is made for you, dictated either by the language used in a class, or by a framework you need to use, but often you will have at least a few options.

The Path to Rust May 25, 2016

About six months ago, I started my first large-scale Rust-based project. I’d dabbled with the language in its early days, but back then it was a different beast, and not particularly approachable. I decided to try again, and I’m glad I did. Rust is quickly becoming my favorite language for all systems work (which is most of what I do anyway), and has largely replaced both Go, Python, and C/C++ in my day-to-day.

Students' Guide to Raft Mar 16, 2016

For the past few months, I have been a Teaching Assistant for MIT’s 6.824 Distributed Systems class. The class has traditionally had a number of labs building on the Paxos consensus algorithm, but this year, we decided to make the move to Raft. Raft was “designed to be easy to understand”, and our hope was that the change might make the students’ lives easier.

Raft Q&A Mar 16, 2016

For 6.824 we are using Piazza for class communication and Q&A. Over the course of the semester, a number of good questions have been asked that may be of use to others trying to come to grips with Raft. A selection of the questions and answers are given below. These are all adapted from the questions and answers given by 6.824 students and TAs.

Instructors' Guide to Raft Mar 16, 2016

For the past few months, I have been a Teaching Assistant for MIT’s 6.824 Distributed Systems class. In the past, the class has had several labs building on the Paxos consensus algorithm. This year, we decided to make the move to Raft. Raft was designed with the explicit goal of being easy to understand, in the hope that this would make the students’ lives easier.

How the Internet works Oct 12, 2015

The Internet has become a critical part of almost every part of our society — it provides information, communication, and entertainment to billions of people every day, and enables coordination and collaboration between people and business across the globe. Unfortunately, this crucial piece of infrastructure is poorly understood by a large majority of the population; the myriad of technologies (both hard and soft) that let your laptop connect to your bank or to your mom’s Skype window could just as well be magic as far as average person in the street is concerned.

WWAN on the X1 Carbon (3rd gen.) in Arch Linux Oct 9, 2015

A while back, I got my hands on the 3rd generation Lenovo X1 Carbon. Having been a happy owner of the first generation, and intentionally skipped the second generation, I was obviously excited. With my X1 Carbon, I also chose to add the WWAN LTE card (a Sierra Wireless EM7345) so that I can work while on the road using a data SIM.

Resistance is futile Aug 31, 2015

Recently, online video streaming sites have started to dominate the scene when it comes to watching TV shows online, and is slowly surpassing the use of torrents for a large number of non-technical users. Sites like Project Free TV and Watch Series index this content, providing users with lists of seasons and episodes, along with multiple mirrors for each video.

Interactive R scripts May 8, 2015

R is a great tool for writing small programs that compute statistics or visualize data, and could potentially replace the wide usage hacked-together bash, perl or python scripts that output gnuplot commands. In particular, the ggplot2 library makes creating beautiful (and complex) plots extremely simple. However, one problem in particular is preventing this vision from becoming reality: R does not support interactive scripting.

Installing Windows 8.1 to USB drive from Linux Sep 4, 2014

Linux is great - we all know this. However, as most Linux enthusiasts painfully experience more often than they’d like, Windows is still occasionally needed for certain applications. While WINE and VirtualBox VMs takes care of most use-cases, there is still the occasional game or application that you’d really just rather run in a plain old Windows environment with no layers between the OS and the hardware. Having an external drive you can boot Windows directly from is perfect for this purpose, and as MIT offers Windows 8.1 Enterprise for free to its students, I figured I’d take a stab at it.

Permanently changing the MAC address of a Broadcom Android 4.x device May 15, 2014

Wi-Fi devices all have a (mostly) unique address burned into them when they are manufactured so that a meaningful media access control (MAC) protocol can be developed. This MAC address needs to be unique on your network so that your Wi-Fi access point knows which device is sending it data, and which device it should reply to.

Running Dungeon Keeper on Linux Feb 2, 2014

After reading this great post on how in-app purchases are ruining the gaming industry, I felt an urge to play Dungeon Keeper again. Since I run Linux, however, playing games is not always such a trivial affair. WineHQ (unhelpfully) told me that Dungeon Keeper does not run very well under wine 1.5, but given that 1.5 was released early last year, I figued I’d give it another shot.

Incremental plotting in gnuplot Jan 29, 2014

If you have ever had to plot something, chances are you’ve come across gnuplot. It’s a very versatile plotting tool, and once you get used to the syntax and quirks, you quickly start using it from everything from throwaway data visualization to plots included in papers.

Generating combinations for N-dimensional searches Jan 27, 2014

Problems involving searches are very common in computer science, and they are often N-dimensional, meaning you are looking for a combination of values that yields some outcome. For example, you might be looking for all pairs of numbers whose sum is 50. This is trivial to express in most modern programming languages, and would usually be done with a nested for loop like this:

Game Dev Tycoon on Linux May 1, 2013

Yesterday Game Dev Tycoon went viral with its decision to punish pirates in an unusual, but quite ingenious way. Helping their popularity was probably the fact that the game is available for both Windows, Mac and Linux, and so users were downloading it like crazy! Unfortunately, the Linux version seems to be riddled with bugs at the moment, and for some users getting the game to run in the first place seems to be causing massive headaches.

Why don't people ask questions? Jan 11, 2013

You probably know me. Or someone like me. The guy who always raises his hand in class or who has a question or comment regarding whatever idea is being discussed. You might find people like me annoying. I’ve never understood why there seems to be so few of us though. Ever since I was a kid, I’ve wanted to question things; to figure out why or how. Unfortunately, it seems most people don’t. Or rather, it seems as though people are afraid of asking questions. Whether it is from fear of showing that they don’t know or from not wanting to take up other people’s time or something else entirely, I’ve never been able to understand. I do know, however, that it disturbs me.

Coding is boring, engineering isn't Jan 3, 2013

I’ve always considered myself a programmer, a coder. I came up with ideas, or other people did, and I wrote the code needed to make them work. Only recently have I realized that not only is programmer not sufficient to describe what I do, it is not even what I want to be doing.

Decrypt home partition on login Oct 23, 2012

After switching to systemd a while back, I have been annoyed by having to enter the decryption key for my /home partition on every boot. My root partition is unencrypted, as are all the other partition except /home, but having to enter the key makes the boot process seem slower than it really is since the password prompt appears in a plain white-on-black tty. Also, due to the concurrent nature of a systemd boot, the password prompt is often intermangled with other boot messages. This happens even with the “quiet” boot parameter since fsck results are still printed. For a while I tried to ignore the problem, but one lazy afternoon I decided to come up with a somewhat prettier solution.

Handling swipe and click with JavaScript Mar 26, 2012

So, you’ve got a list with overflow:hidden, and you want to make it scrollable with touch? And perhaps you don’t want to include a library such as [iScroll]((http://cubiq.org/iscroll-4), you just want simple scrolling with as little code as possible. Perhaps you even stumbled across the fairly simple solution proposed by Chris Barr on his blog, so you start using it (replacing all .pageY with .pageX for horizontal scrolling), and your content scrolls like never before!

Ice Cream Sandwich: Death by paper cuts Mar 7, 2012

I’m a big fan of Android. I have written a few apps, have two phones running it, and I happily recommend it to friends. There is one problem though; the Android experience is riddled with paper cuts. Seemingly minor annoyances that all together make for a frustrating user experience. Google attempted to mitigate some of these in Ice Cream Sandwich, but they somehow managed to introduce a slew of new ones.

Developing applications for Android – gotchas and quirks Jul 17, 2010

Over the past couple of days, I have developed my first two applications for the Android Market; Tuples and PencilWise. The first is a simple tool for storing key-value pairs, or tuples, of information you need to remember such as your bank account numbers, your PGP fingerprints, etc.. The second is a mobile version of the puzzle page by the same name.

Windows 7 login screen only showing last logged-on user and "Other user" Jun 24, 2010

Ever since my initial install of Windows 7, there has been one thing nagging me. The Windows welcome screen only ever displayed the avatar for the last logged on user and a blank image with the label “Other users”. When the latter was clicked, two text fields would appear prompting for username and password.

RSS feed for AlertBox Jun 17, 2010

For those of you concerned with web usability, there are few better sources than Jakob Nielsen’s AlertBox.

WPA2-Enterprise wireless with netcfg Jun 17, 2010

At Bond University the IT department has now finally taken the step from an open wireless network with a login proxy to a proper WPA2 Enterprise setup.

Using WordPress as a website backend May 19, 2010

How often have you found yourself creating a great new website design for a friend, family or a client, just to realize after all your HTML and CSS is done that the thing will need an administration panel? Way too often, the administration comes as an afterthought, and thus it ends up being incomplete, hard to use or in some cases absent. Two months down the track you end up being contacted again to do some “site updates”, and these just keep coming.

Random lag spikes in Windows 7 Mar 9, 2010

Update: It turns out the issue is even more general than I thought at first. It is in fact not just the HTC mobile sync program that causes these freezes; it is in fact any mobile syncing application. After launching the Sony Ericsson PC Suite today, I noticed that the issue returned immediately. I killed the process, and it ended again. Seems as though Windows 7 has issues dealing with mobile syncing software if the device is not connected..?

Inline website administration Dec 29, 2009

Almost all modern websites require some sort of administration, and this usually involves creating a separate administration page where articles can be added and users managed. Lately, I’ve been making quite a few new websites that will be released in the upcoming year, and all of these have been quite simple sites with a single user and where the administration consists mainly of adding simple news updates and updating page text. For these sites, a full blown administration panel is not necessary, and is also quite inconvenient as the user will have to go back and forth to see the results. So, what are the alternatives?

Developing for the modern web Dec 17, 2009

Update 2015-05-04: Note that much of the advice here will become outdated with HTTP 2, where there should be little to no performance degradation when serving many smaller files, and where compression might be on by default!

Browse the web with PHP Dec 16, 2009

Ever so often, you come across a website that you would like to check regularly. Usually, this website is placed behind some sort of login, and therefore, you think, you might just as well forget it. A while ago, I found myself in the same situation. My university in Oslo published grades online, but gave you no warning when the exam results where published, so you had to check every now and then to see if you had any new ones. I figured that this was a bit bothersome, and wanted to find a way around it.

Setting up a virtual development server Dec 14, 2009

As a web developer, I often come up with interesting new concepts that I want to try out. Occasionally, these require more than simply HTML, CSS and JavaScript, at which point I need to begin uploading my PHP (my language of choice) files to a remote server running apache, test the page there, make adjustments in my local code, upload and test again. This is quite slow compared to the very efficient development cycle of plain old HTML where you can preview what you’re doing instantly in the browser.

Downloading a mms://video stream Dec 13, 2009

Have you ever wanted to watch a video online, but due to a slow connection or frequent dropouts, streaming is impossible to watch. In these cases, there is rarely a “Download” button that allows you to download the entire thing and watch it in full when it’s done. Evidently, this is a real-world application of Murphy’s law.

My web Nov 25, 2009

We all use the web differently, and all have the pages we cannot live without. Following is a list of the top websites I cannot live without. What are yours?

SPeeDY - The new HTTP? Nov 25, 2009

Google have been coming with a lot of new cool projects lately - From Chrome and Chrome OS to Wave and Social Search. Following this innovative trend, they have now announced that they’re working on a possible replacement for HTTP. Actually, it is not as much a replacement as it is an augmentation or “fix”. SPDY will still be using the headers and basic structure of HTTP, but will treat that structure quite differently and introduce several enhancements to make it more efficient and more suitable for the contemporary web context.

Surveying Social Search Nov 21, 2009

Google recently published a new feature on their Labs Search Experiments page: Google Social Search. By enabling this service, Google attempts to locate your friends and connections through online communities like Twitter, Facebook, GMail and Google Reader, and present you with search results that are not only relevant to your search phrase, but also to your social circle. For instance, searching for a restaurant will provide you not only with the regular search results for that restaurant, it will also give you blog posts, tweets and other publicly available messages from your friends, and their friends about what you search for. This may be a review, a comment, images or anything else that Google finds relevant.

Jump-starting tricks for aspiring web developers Nov 17, 2009

So, you want to make websites, do you? Becoming a web developer is both very easy, and very hard at the same time. Mocking up a simple page online with some text and images is easy. Not only are there several WYSIWYG website editors (What You See Is What You Get) out there, but there are also several websites that allow you to create your page online directly through point and click. This is not web development.

Recovering data from a Mac drive from Linux Nov 15, 2009

The Mac of a friend of mine crashed the other day - complete harddrive failure. He turned it into the Apple store, and they decided to give him a new disk because they said they couldn’t recover the old one. Somehow, he managed to talk them into leaving him with the old drive so he could try to get at least some of his data back. My friend then came to me, and asked me to have a look at what I could find.

Yahoo Pipes Nov 15, 2009

Ever wanted to grab some data from a webpage, or perhaps several, manipulate it in one way or another, and then format access the data through, for instance, JavaScript? Earlier, you would have to write such a script in PHP, ASP, Perl or another scripting language on your web server, and then get the data from that script through JavaScript. This meant you had to run a web server in the first place, and that it would have to support not only fetching data remotely, but also the scripting language you chose to use. And if you didn’t know any scripting languages apart from JavaScript, you would be out of luck.

RSS and XML Nov 15, 2009

One of the greatest merits of the web, and at the same time, one of its greatest vices, is its decentralization. Data is scattered all over the place; and although this makes for a diverse and ( to a large degree ) uncensored source of information and news, it also means that you have to go to several different sites whenever you wish to see what has happened since you were last online.

Portfolio live Nov 12, 2009

Finally, my long-awaited ( on my part at least ) portfolio is live!

Drop-in PHP folder gallery Nov 9, 2009

Update 21/11/09: The script now supports thumbnails for video and text, as well as timecodes for video and audio. FFMpeg is needed though..

Hot-swapping drives in Windows 7 Nov 9, 2009

I have recently bought two external SATA docking stations - one internal ( i.e. it fits in a 5.25” bay, and loads the drive from the outside like a large floppy ), and the other one completely external and connected through eSATA. For the first couple of weeks, I thought hot-swapping was not possible with these, and kept rebooting if I wanted to swap out a drive, however one day I came across a setting in BIOS describing how SATA drives should be treated. It was set to “IDE compatible”.. The other options were “Enhanced” and “AHCI”. I tried googling this, and soon found that AHCI is actually a technology that enables plenty of the cool features of the SATA technology - most notably hot-swapping!

Using a multi-monitor wallpaper in Windows 7 Nov 9, 2009

Ever wanted to use a multi-monitor wallpaper / background image in Windows 7 ( or perhaps Windows Vista ), and found that it ends up showing a scaled down version of it of both screens? I did, and for a long time, I tried to find a piece of software that would enable me to stretch the image across both screens instead. For a while I gave up, finding no viable solutions. A couple of days ago though, I was playing around with the wallpaper controls in Windows 7, and just for fun I tried setting the background to “tiling”. And guess what? Suddenly, my multi-screen wallpaper stretched across both screens! “Stretch” and “fit” both seem to stretch the image across each screen individually, so you end up with the same image on both screens, but when tiling, if the image is large enough, the image will actually be put across both screens the way it is supposed to!

University posts Nov 3, 2009

You may notice that every now and then there appears a post that seems forced, or not in line with the kinds of posts I usually make such as the Javascript and DOM references post. This is because one of my university courses at Bond University is running a Blog Assessment in which we are given certain topics to blog about every now and then. Since these assignments are compulsory, I cannot refrain from writing them though they clutter the rest of the blog entries.

Google Docs Nov 3, 2009

As a part of an university assignment, I am required to have a look at Google Docs, which I have been using for some time now. Perhaps not so much using it as having an account and creating one document, but still, I have had my look around, and as with most Google products, I am quite impressed with what I see.

HTC Hero and Android updates Oct 29, 2009

I have long been anticipating Android 1.6 ( nicknamed Donut ) for the HTC Hero, but HTC have been unusually quiet as to how far along they have gotten. This has been quite annoying as my new piece of software for the Android requires Android >= 1.6 to work.

New portfolio under development Oct 27, 2009

As some of you may have noticed, my current portfolio is, mildly speaking, lacking a proper design ( http://thesquareplanet.com ). Over the last couple of days I have decided to do something about this, and have started to build several prototypes of a new design..

Finally live Oct 19, 2009

My first completely self-produced website has now been released to the public!

JavaScript and DOM references Oct 19, 2009

Today, I will give you three great references for working with JavaScript and the Document Object Model.

Daily delight Oct 15, 2009

As any proper geek, I am quite fond of comics, and especially those related to mathematics, computers, dry humor and sarcasm. Although I follow several different stripes, there is one in particular that is almost always to my taste: xkcd. xkcd is, according to the site, “A webcomic of romance, sarcasm, love and language”, but also sports some computer-related stripes.

Developing an application for Android Oct 15, 2009

A couple of weeks ago, I came up with a great idea for a piece of software for the Android platform ( i.e. for my HTC Hero ). I have programmed quite a bit using Java before, but the Android SDK is quite complex, and frankly not entirely well-documented, so there were quite a few issues to stumble across.. Developing the whole thing took the better part of a weekend, only for me to discover that it would not work properly on Android 1.5 ( Cupcake ) which my phone uses, since I had developed it for Android 1.6 ( Donut )… In theory, there should be no relevant differences, but everything is tossed around when I run the program on my phone or a 1.5 emulator.

Effectively downloading torrents on the Bond Network Oct 10, 2009

The first thing I noticed at Bond, and which continues to confuse me to this day, is the extremely low speed ( and quality - but that is a discussion for another day ) given to each user on campus. Wherever you log onto the network, your connection speed is limited to 1 Mbit/s, which is far below the 20 I am used to back home. The connection is also rather unstable, so you are lucky if you get much more than about 70-80% of that. This makes all downloads a real pain, as even leaving the computer online over the night is not enough.. Several days are often required, depending on what you download ( only legal material of course……. )

A quick introduction to CSS Oct 1, 2009

Before I dig into the CSS 3 draft, I am going to give a quick introduction to the basics of CSS for those who do not feel entirely comfortable with the apparent complexity of Cascading Style Sheets;

The prospects of HTML 5 Sep 24, 2009

As a webdeveloper, feature additions and updates to commonly used libraries and languages are always exciting. Unfortunately, there is one core language of web development which has not received a proper update in years - HTML. Sure, we had XHTML, but in my opinion, that was more of a structural change than it was a rewrite of HTML. XHTML merely enforced a XML structure as well as standardize the elements used for various types of content.

MP4 video in Premiere Pro losing audio after moving to new computer Sep 22, 2009

As you might have gathered, my roommate and I have been setting up a new computer for the last couple of days. This is quite a beast, which it has to be as he will be working with some heavy video editing on it through, amongst others, Adobe Premiere Pro.

HTC Hero Sep 21, 2009

I just received my brand new HTC Hero today, and full of excitement I immediately unwrapped and booted the new phone. This was a pre-update phone, so the first order of business was to update the firmware.

Dual booting Windows 7 and (Arch) Linux, and the hassels involved Sep 18, 2009

This week I have been setting up my new computer - a complete beast with Intel Quad Core i7 processor, 12 GB memory, 4 * 1TB drives in RAID 1+0, etc. On this computer, I decided to put both Windows 7, which is provided for free through the MSDN Academic Alliance and Arch Linux ( which I fell in love with the first time I tried it ).

Blast from the past Sep 13, 2009

I have been working with computers and software development for about six years, mostly web based, but also desktop applications.