TECH BLOG

Blog Articles

Independent Software is always researching new technology to apply to our projects. Sometimes, during this process, we write a short article about things we have discovered. We’ve published full tutorials and many short tips. An overview is below.

dBASE File Format (with coding details): DBF and DBT/FPT file structure

AUG 6, 2018

Recently I was developing a .NET reader for dBASE files. It turns out how little (authoritative) information there is on earlier dBASE file formats like dBASE III and dBASE IV - most of the info is on dBASE 7. In this post, I bring together information from various sources and my own findings in order to provide a good file format specification for FoxBase, Visual FoxPro, dBASE III and dBASE IV formats, all of which are similar.

Hercules CGA Emulators: How do they work?

AUG 2, 2018

In the old days, there was the Hercules graphics cards (HGC). It had a whopping 64KB of memory - more than most - and was all but unsupported by game developers. Still, it was possible to make your CGA games run on your Hercules card by installing a memory-resident program. How did that work?

Trizbort.io: View, draw, edit and generate code for adventure game maps

AUG 1, 2018

Trizbort.io is a browser-based tool that lets you easily map adventure games. Drag rooms into your map and link them up using connections in all compass directions. Add a list of objects present in each room. Finally, export your map straight to your adventure game toolkit of choice: TADS, Inform, Quest or Alan.

Drawing LDraw control lines with OpenGL ES 2.0 using a vertex shader

JUN 1, 2018

LDraw is a standard for defining LEGO parts and models that can be drawn in 3D on the screen using software. LDraw has been around since 1995 and contains specificatons for tens of thousands of parts: everything from the 2x4 LEGO brick we all know to ultra-specific LEGO Batman gear.

The LDraw standard describes a file format for defining the 3D mesh of a part and its subparts. The format has features for triangles, quads and lines, and a very special kind of line: the optional line. In this tutorial, we are going to see how optional lines can be drawn in OpenGL ES 2.0 for Android using a vertex shader, thus offloading the math onto the GPU.

Jekyll: Generating a sitemap.xml without a plugin

MAY 25, 2018

You’re working on a website built with the Jekyll static site generator, and you need to automatically generate a sitemap.xml to submit to Google’s Search Console. There are plugins for this, but this process is in fact very easy and you can add generation options exactly to your liking. In this tutorial, we’ll look at how a sitemap can be generated by Jekyll with simple Liquid tags.

Removing Google AdSense AutoAds from your website

MAY 25, 2018

So you’ve added Google AdSense AutoAds to your website and now you’re sorry you did it. A dozen AutoAds show up all over your pages, including in your header and footer… most everywhere you do not want them. What is more, you’re getting a warning from the Google AdSense team that some of the ads on your site are violating Google’s T&Cs - weird, because Google placed them there to start with. Whatever the case, here’s how you get rid of those pesky AutoAds!

HTML Canvas Drawing: Determining coordinates on a bézier curve

MAY 25, 2018

The HTML 5 canvas API allows you to draw bézier curves and quadratic curves out of the box. The API is easy to use, and the curves come out beautifully. But what if you wanted to draw something else at the halfway point of a curve? You’d have to know the coordinates of a point on the curve to be able to do so. And, if you wanted to draw an arrowhead halfway down the curve in the direction of the curve, you’d have to know the coordinates as well as the angle of the curve at that point.

In this tutorial, we’ll show you simple code that allows you to calculate the coordinate and angle of any point on a HTML 5 canvas bézier or quadratic curve.

Google Image Search: Bringing back the direct image download link

MAY 13, 2018

Up until recently, on Google Image Search, it was possible to access any image directly, without having to view its containing web page first. This had advantages, because the image might have been removed from the website but still available in its files, and it saved you a ton of time scrolling through the source websites to find the images.

However, it appears that Google has received complaints the European Comission on behalf of Getty Images (as reported by the BBC). Since Getty, and many companies like it, made it their business to sell images, they don’t enjoy it when people download their images without permission.

The art of: Edgar P. Jacobs

MAY 13, 2018

I always find that the work of comic author Edgar P. Jacobs - known for his Blake and Mortimer series - is somewhat overshadowed by the fame of other authors, like Hergé, who actually have a very similar style. Edgar P. Jacobs’ work stands out because of his mastery of drawing detailed landscapes in constrast to heavy machinery and vehicles using only a few strokes of the pen, letting light and dark areas provide most of the effect.

Recursion in Handlebars with Depth Level

APR 24, 2018

Logic-less templates in Handlebars.js are fantastic when you are making templates for JavaScript components, or doing code generation using JavaScript. Handlebars is easy to use, and its features are necessarily limited. One feature that is really missing is recursion. Although Handlebars a helper for traversing an array, it is difficult to implement recursion with, let alone recursion with a depth level. In this guide we’ll show you how to implement recursion with a depth level in Handlebars.js.

Creating a WordPress Theme from Scratch: Content and the WordPress Template Hierarchy

MAR 2, 2018

In this second part of our guide to creating your own WordPress theme from scratch, we’ll look at content types and how you can display them in your theme. We’ll look at the WordPress Template Hierarchy and the WordPress Loop.

Creating a WordPress Theme from Scratch: Theme Files, Styles, Header and Footer

MAR 1, 2018

Ready to build your own WordPress theme from scratch, with all the bells and whistles? This guide helps you get started from the very beginning with step-by-step instructions and helpful tips. In this first section, we’ll create the files for the new theme, set up its basic styles and create a header and a footer.

Setting up a WordPress Development Environment on Windows with IIS

FEB 28, 2018

In order to develop a WordPress site on your own development machine, you’ll need to setup a local web server and run WordPress on that. Why not use the Internet Information Services server, which comes with your Windows installation? This guide explains how to setup IIS, PHP, MySQL and WordPress hassle-free.

Google Analytics: File Download Tracking Without Writing Any Code

FEB 2, 2018

Google Analytics tracks a lot of things, but not file downloads – at least, not out of the box. Depending on the nature of your site, it can be very useful to see which downloads were most popular. File downloads can be tracked using events, and better yet, the whole process can be automated entirely withing Google Analytics without changing a line of code of your website using Google Tag Manager’s Auto Event Tracking.

New Android App: Stylus Portable Reference

JAN 29, 2018

Independent Software has released a new app for Android: the Stylus Portable Reference. This handy tool lets you look up Stylus CSS syntax as you work, with many examples to help you out. Best of all, the app comes with all the documentation built-in and requires no further download, so you can use it off-line.

New Android App: GW-BASIC Portable Reference

JAN 29, 2018

Independent Software has released a new app for Android: the GW-BASIC Portable Reference. This handy tool lets you look up GW-BASIC syntax as you work, with many examples to help you out. Best of all, the app comes with all the documentation built-in and requires no further download, so you can use it off-line.

CSS 3 Overdrive: Amazing Creations in CSS

JAN 29, 2018

It’s easy to underestimate the power of CSS, as we’ve shown you before. There are still developers who think of CSS as merely a way of positioning and styling elements on a web page, but the possibilities are nigh endless, especially with the new features that CSS 3 offers. Take a look at the following demos created by people who have delved deeply into CSS 3 and show their latest cutting-edge techniques. Get inspired, and learn much about CSS 3 in the bargain.

Tileable, repeating high-resolution terrain textures for download

JAN 27, 2018

Looking for high-resolution, tileable textures of various terrains for your game development projects? We ran some hi-res photos of grass, stones, rocks and sand through PhotoShop recently to create some for you, free for download. Happy developing!

Android: Speeding up canvas.drawBitmap

JAN 23, 2018

If you’re developing a game for Android that uses canvas drawing, you’re probably calling Canvas.drawBitmap to draw many bitmaps to the screen. You also may have noticed that as your number of bitmaps per frame increases, your framerate drops significantly, to the point of your game becoming unplayable. You’ll also find that your game runs fast on some devices, and slowly on others (in particular, phones versus tablets). In this article on speeding up Canvas.drawBitmap, I’d like to point out some pitfalls you can avoid, based on my own experience developing an app with heavy canvas drawing.

Cannot import Avada options: wp-admin/options.php not found

JUN 26, 2017

So you’re trying to copy the website you just developed using the Avada theme to a webserver. Upload done, all you need to do is export the local Avada theme options to a JSON string, and import them again on the server. And then it fails: You land on a 404 page that says that options.php could not be found.

Moving a WordPress website: Custom post type attachments not found

JUN 26, 2017

I recently developed a WordPress website with various custom post types. Some of these CPTs had a metadata field called attachment, and it would store the URL and filesize of a PDF file attached to the post. All was well until I uploaded the website to a new server, with a different domain name. All of a sudden, none of the thousands of custom posts had an attachment.

JavaScript Objects: Three approaches to object creation

MAY 26, 2017

Objects are JavaScript’s most important data type. They behave much like associative arrays (or hashes) in other languages in that they allow you store and retrieve values by name. In this tutorial, we will look at what a JavaScript object really is, and at three different ways of creating them and the advantages of each approach.

7 FontAwesome tricks you probably didn't know about

MAY 26, 2017

We’re sure you’re using the fantasic FontAwesome CSS library in all your web apps. Great icons and easy to use! But are you using all the tricks that make FontAwesome even easier to use? Check out these 7 FontAwesome tricks that you may not have spotted in the documentation.

Matroid: Trainable video detection

MAY 26, 2017

Originally, a Matroid is a mathematical structure in combinatorics. It is now also the name of a company that detects people and objects in video feeds, and allows users (and devs) to build their own custom detectors.

Slim PHP Microframework: Trouble setting HTTP headers

MAY 25, 2017

I had been using the Slim PHP Microframework with great success building an AngularJS single page web application with a REST backend. Everything was fast, only minimal amounts of data was exchanged between client and server — and then I ran into trouble. Most of my REST responses would set a HTTP content type of application/json. While this worked fine on IIS on Windows, on Apache/Linux the content type would always revert to text/html.

Coding an Amazon Alexa skill: Trips & tricks for game development

FEB 12, 2017

Amazon’s Alexa is celebrating her second birthday, and there are over 8 million Alexa devices now in American homes. The UK and Germany are joining this market and Alexa is leaving Apple’s Siri and Microsoft’s Cortana behind. Now Amazon is looking for developers: there are 7,000 skills available in the Alexa skill store but most of them are simple gimmicks. There is nothing that sells a device better than games, so that’s what Amazon wants now.

For indie game developers, this is wonderful. Voice-based gaming is a whole new user interface metaphor which presents a fantastic challenge. Which types of of games will work, which won’t? What are the limits of Alexa as a gaming platform? Is Alexa’s voice recognition accuracy good enough to offer a good gaming experience? In this article, I’ll share a few important things I’ve learned developing an adventure game engine for Alexa.

Cataclym: Dark Days Ahead - Surviving the Early Game

JAN 20, 2017

Cataclysm: Dark Days Ahead (C:DDA) is a tough game. Thrown into a post-apocalyptic world with nothing but the clothes on your back and no survival skills to speak of, you must find food, water, and shelter, all the while battling zombies and mutated wild animals. This guide helps you get through the first (and hardest) few days of your life in Cataclysm:DDA.

Portable, animated text background fill using CSS and SVG

SEP 29, 2016

The webkit-specific CSS properties webkit-background-clip and webkit-text-fill-color can be used to add a fill pattern to a text string and animate it, degrading gracefully for any non-webkit browser. However, it’s possible to make this effect work in other browsers (including, without animation, in Internet Explorer) using a solution that combines CSS and SVG.

Firefox 3D CSS limitations: maximum element count and close positioning

SEP 28, 2016

While exploring the possibilities of 3D CSS transformations, we ran into an interesting limitation (bug?) in Firefox. We were building an experiment that takes a heightmap and converts it into a 3D terrain. It turns out that Firefox chokes when the number of elements in the 3D animation exceeds about 80, and that overlapping elements cause flickering.

In this project, we take a small 10×10 grayscale heightmap and turn it into a 3D landscape using pure CSS.

Pure CSS 3D animated contour terrain

SEP 28, 2016

This experiment shows how simple CSS transformations and transparent images can be leveraged to show and rotate a contour terrain generated from a height map in the browser with good performance.

Pure CSS hyperdrive effect

SEP 25, 2016

This pure CSS 3 demo shows a hyperdrive effect with stars streaming by the viewer, leaving light trails across the screen. It illustrates the use of repeating keyframe animations and animated box-shadows.

Deconstructing CSS 3: Making of the CSS 3 Solar System Animation (3D Transformations)

SEP 23, 2016

In this article we continue our CSS 3 deconstruction of how Julian Garnier’s 3D Solar System was built. This time, we’ll rotate the entire solar system 3-dimensionally so that the planet orbits become elliptical and the planets actually move behind the sun.

Deconstructing CSS 3: Making of the CSS 3 Solar System Animation (Keyframes and Shadows)

SEP 23, 2016

In this article we continue our CSS 3 deconstruction of how Julian Garnier’s 3D Solar System was built. We’ll look at how to use CSS keyframe animations to make planets move in orbit around the sun, and apply dynamic shading to the planets that change according to their current position around the sun.

Star Wars intro scroller in pure CSS without JavaScript

SEP 23, 2016

CSS 3 has come a long way and it is now possible to construct complex animations without a line of JavaScript. This guide shows how to implement the Star Wars (1977) intro scroller in pure CSS.

Deconstructing CSS 3: Making of the CSS 3 Solar System Animation

SEP 23, 2016

The animation of the solar system in pure CSS 3 by Julian Garnier is an amazing piece of work. In this article, we’ll take an in-depth look at how it’s done. We’ll analyze the CSS piece by piece and show you what makes the solar system tick, and you’ll learn all about base64 image encoding in CSS, keyframe animations and CSS 3D transformations.

Faster Firefox: Sweet cheat sheet with all the shortcuts

SEP 20, 2016

Use Firefox much? Bet you didn’t know you can open a link straight into a new tab with a single shortcut. Or how about recalling a tab you accidentally closed? This Firefox cheat sheet infographic shows you all the shortcuts you really need to know to work faster with Firefox.

Stretching the limits of CSS 3: Amazing creations in pure CSS

SEP 15, 2016

It’s easy to underestimate the power of CSS. For those coming from a CSS 2 background, CSS was a way of styling elements of a page and nothing more. Now, with CSS 3, new properties supported by modern browsers open up new possibilities that you could only dream of before. From element styling to complete animations, much is now possible without resorting to Adobe Flash. This article shows off a number of CSS demos made by different people who have delved deeply into CSS 3 and show their latest cutting-edge techniques. Great stuff to learn CSS 3, and great inspirations too.

Adblock Plus now serves ads anyway

SEP 15, 2016

In a complete contradiction of terms, the popular web advertisement blocking browser extension Adblock Plus will now start serving advertisements of its own, which it considers “whitelisted”. The so-called Acceptable Ads Platform is Adblock Plus’s very own ad network.

hover.css: Quick guide to using hover.css effects

SEP 14, 2016

Hover.css is a great little CSS library that adds hover effects to your HTML links and buttons. In this tutorial, we’ll bring you up to speed quickly on how to use hover.css.

Velocity.js tutorial: Accelerated JavaScript animation

SEP 13, 2016

jQuery is great, but it’s slow when you’re doing animations on your website. Enter Velocity.js: bypassing jQuery and directly using JavaScript animations (which are fast), Velocity offers superfast animations by synchronizing the DOM and the tween stack and caching values to minimize DOM queries. Also, it uses hardware acceleration. This tutorial will show you how to use Velocity.js.

Must-know computer tricks: Save time with shortcuts and loopholes

SEP 12, 2016

Do you use shortcuts to speed up your work? Great. Here’s a list of awesome computer hacks that speed you up even more. Have the task manager pop up using a short cut, quickly clear your browser cache, and a oneliner to enable the context menu on websites where it’s disabled.

HTML 5: Syntax simplifications

SEP 8, 2016

There’s much to love about HTML 5 (microdata, canvas animations, and a slew of new APIs), but at its core it also revisits the HTML syntax and makes it simpler. When you’re building web apps you need to juggle HTML, CSS, JavaScript and PHP/Ruby/whatever around in your head, and whatever gets easier is a plus. In this article we review what’s simpler in HTML 5: the new doctype definition, optional link/script attributes and a less rigorous syntax.

HTML 5: 5 Tools for Microdata Validation

SEP 8, 2016

Using microdata on your site? Great! It will help Google and other search engines to better understand and index your web pages – but only so long as the microdata is properly formatted. How can you test that? This article presents 5 online tools for microdata validation.

Introduction to PSR-1: the PHP Standard Recommendation

SEP 7, 2016

PSR is the PHP Standard Recommendation. You may have heard of it. But what is it? Should you care? Googling for it, I couldn’t find many pages that explained, without being overly long, what PSR is and how I can or should use it in my PHP projects. This introduction looks at the first standard, PSR-1, and summarizes what it’s all about.

jQuery: Switch stylesheet by browser width

SEP 7, 2016

In these days of mobile friendliness and responsive design, our websites have to actively change the way they present themselves depending on the width of the visitor’s browser. While a website can offer a widescreen view on a desktop screen, it will have to be vertically oriented on a mobile phone screen. In this tutorial, we’ll explore how you can use jQuery to load a different style sheet with CSS rules that apply to the current browser width.

There are various ways to do responsive design: it can be done in pure CSS using media queries, or it can be done through JavaScript. In this article we’ll show three JavaScript approaches.

GMap.NET Beginners Tutorial: Adding polygons and routes to your map (updated for VS2015 and GMap.NET 1.7)

AUG 31, 2016

The GMap.NET control is a popular control for .NET that allows you to put interactive maps on your Windows Forms. In this third and last part of our GMap.NET tutorial, we show how you can add clickable polygons and routes to your maps, and how to style them.

GMap.NET Beginners Tutorial: Adding clickable markers to your map (updated for VS2015 and GMap.NET 1.7)

AUG 30, 2016

This tutorial explains how you can use the GMap.NET control for .NET Windows Forms to put interactive maps on your forms, complete with clickable markers that can be styled and responsive tooltips.

GMap.NET Beginners Tutorial: Maps markers, polygons and routes (updated for VS2015 and GMap.NET 1.7)

AUG 29, 2016

Since we published a tutorial for GMap.NET: Maps, markers and polygons back in 2013, it’s been viewed many times and GMap.NET remains a very popular .NET component. Over the years, it’s become better and more stable and now that it’s at stable version 1.7, it’s time to update the beginners tutorial to using the GMap.NET control to create maps, markers and polygons in your .NET/C# application. In this fresh three-part tutorial, you will learn how to place the GMap.NET control on a form, how to configure it to show a map at the coordinates you want, how to add markers to a map, and how to show polygons.

Fallout 4: Inventory Management Tips

AUG 22, 2016

Fallout 4 by Bethesda is a huge game, in particular if you play it on Survival mode. In Fallout 4 Survival Mode, fast travel is disabled and the total weight you can carry is severely limited. Everywhere you want to go, you’ll have to go there the old-fashioned way: on foot (or in a Vertibird, when you’ve unlocked that possibility). Also, since Fallout 4 is the item collector’s dream, everything can be taken and everything is useful. So, inventory management is king.

Visio Tips: Hiding parts of a shape on demand using shape geometry

AUG 20, 2016

When you’re designing a smart shape for Microsoft Visio, you’ll often want the user to influence the behavior of the shape through actions in the shape’s context menu. Creating context menu actions in Visio was explained in a previous post. This time, we want to create an action that shows or hides part of a single shape (no grouping allowed!).

Visio Tips: Adding a context menu option to a custom smart shape

AUG 20, 2016

When you’re developing your own smart shapes for Microsoft Visio, you’ll often want to give the end user of your shape the ability to change some options. You may have a preset selection of colors, or you may want parts of the shape to appear and disappear when the user selects an option. In general, you’ll want to make your shapes configurable to avoid adding many copies of your shape to a stencil with only small variations.

In this short tutorial, I’ll show how to use the shape sheet to add an option to a shape that enables a user to change its border thickness by selecting a thickness from a preset list of options.

Visio Tips: Enabling the Developer Ribbon

AUG 19, 2016

If you’re thinking about doing some development in Microsoft Visio, like creating your own smart shapes, custom macros, or writing Visual Basic code for Visio, you’ll need access to the Developer Ribbon.

Bootstrap Stencils for Visio 2013

AUG 16, 2016

I’ve always liked Microsoft Visio for drawing quick diagrams. Its smarts shapes click together like legos so I can work fast and get results. Visio comes with some user interface stencils, but they’re very limited, and not suitable for designing web application interfaces. That’s why I went and looked for Bootstrap stencils for Visio on the web. There were a few results, but what I found were stencils with shapes that weren’t smart: the shapes didn’t scale well, and had no built-in functionality.

Adding a thousands separator in Avada's counter box

MAY 25, 2016

The Avada theme by Theme Fusion has a sales pitch: “Our #1 priority is you, the user. We believe in our product and hold ourselves to the highest standards. We truly care about your site as much as you do, which is why we offer amazing support at our dedicated support center. In addition, we offer free updates with new features requested by our users. You can count on us.”

Nevertheless, there’s a feature request that they won’t implement, and funnily enough it’s to do with counting: the possibility to add a thousands separator to the values appearing in Fusion’s counter boxes.

TADS 3 Components: A customizable elevator

APR 6, 2016

TADS 3 is the latest version of “The Adventure Development System.” It is a powerful programming language for the development of text adventures. Out of the box, TADS comes with a base programming language (which is geared towards text adventures but could well be used for other purposes) and an adventure library. It is the library that provides lots of classes that make text adventure development possible. There are classes for rooms, items, non-player characters, buttons, levers, even smells and sounds.

Korenvliet: A text adventure remake

MAR 29, 2016

It was back in the middle years of the 1980s that text adventures were at their height. They’d never again become as popular as they were then; in fact, the text adventure market all but collapsed around 1987. Companies like Infocom, Level 9 and Magnetic Scrolls authored many unforgettable games, and made millions – only to lose them again when the market went bust.

Setting up Android RenderScript in Android Studio 1.3

AUG 11, 2015

Android Renderscript has been around for a few years, but it’s still in need of a lot of documentation. What documentation and tutorials are floating around on the internet focus on getting Renderscript set up in Eclipse, but Eclipse is out – and Android Studio is in (at least as far as Google is concerned).

Moreover, Renderscript’s API changes fast and this affects how you must configure your app when you want to use Renderscript. I had just moved from Eclipse to Android Studio 1.3 and needed to write an app using Renderscripts. Having gone through various tutorials, I thought I understood what Renderscript did and I was ready to start playing with it. Unfortunately, this wasn’t so easy. The tutorials, when implemented in Android Studio, didn’t seem to compile the RenderScript .rs scripts, and the Java code consequentely couldn’t find them. Also, I didn’t know what the latest Renderscript libraries were called so I didn’t know how to import them (they do come with the Android SDK, so rest assured that they are there).

Extending the JavaScript Array prototype with Ruby methods

AUG 6, 2015

In a previous post on extending the JavaScript Array prototype, I showed how methods could be added to the Array prototype to make it (mostly) consistent with the Ecma 5 standard across all browsers using a technique called polyfilling. In this article, I will further extend the Array prototype with methods borrowed from Ruby, which in my opinion has a very useful Array toolkit.

Extending the JavaScript Array prototype with polyfills

AUG 6, 2015

The latest Ecma 5 specification adds various interesting methods to the JavaScript Array prototype. Sadly, most browsers do not implement these methods yet, or at least not all of them. Internet Explorer is usually the worst culprit, while the other browsers are still in the process of implementation. So what do you do when you want to use some of these methods on an (older) browser that doesn’t support them yet?

JavaScript utility libraries like jQuery and Prototype implement some of these methods, but more typically a set of different methods. If you would like to standardize your methods with the Ecma 5 specification, then you’ll need to do more work.

Fabric.js: Loading an SVG image

AUG 5, 2015

The fabric JavaScript library is a nifty piece of code that superpowers the HTML 5 canvas element. It allows you to treat elements of your image as objects, moving them, scaling them, rotating them, and even let users perform these operations. Fabric opens the way to interactive web applications with canvas. Drawing tools come to mind, as well as games. An interesting feature of fabric is that it is able to load SVG files into a canvas.

Creating custom GeoJSON maps for Highmaps with QGIS

JUL 17, 2015

Highcharts is a powerful framework for displaying and manipulating interactive charts in an HTML canvas element using JavaScript. Apart from charts, the framework also offers a mapping implementation, with builtin maps of many countries as well as the possibility to use your own maps. Maps can be produced using any GIS software that allows export to GeoJSON (such as QGISor ArcGIS) which is the format that Highcharts can read.

In this post, I’ll have a quick look at how you can draw a custom map for Highcharts/Highmaps using QGIS, how to export it to GeoJSON and how you can get Highmaps to display it.

Ruby on Rails: Running multiple instances of an application from the same code with a different database

SEP 14, 2014

I had a fairly complex Ruby on Rails application that I wanted to deploy on my server, and with a very specific requirement. I needed to create a number of subdomains, and each of those subdomains would run the same application but with a different database and showing a different logo, so that I ended up with self-contained websites for each subdomain. I did not want to create a separate copy of the application code on the server for each domain, since that would be hard to maintain.

3D Studio Max: Modelling a Grundig 2440 antique radio

JUN 27, 2014

I am currently doing a website project for the “forum of community radios” of Mozambique. While struggling to think how to visualize this concept, I decided to model an actual radio to feature at the top of the site. After thinking some more, I settled on an antique radio which I felt would be instantly recognizable as a radio, and some of these radios are probably still in use in rural communities.

So I set about modelling an actual Grundig 2440 radio (from this sample photo). Since I need the radio in extreme closeup, I needed to add lots of details. Texture maps were used for the fabric grille over the loudspeakers, and for the reflective dial plate.

3D Studio Max: Subdivision modelling using editable polygon

JUN 18, 2014

I’ve discovered a couple of gotchas while trying to model a toy wooden airplane using 3D Studio Max 2012. In order to give the wooden pieces a rounded look, I was looking to use MeshSmooth. In fact, there’s a good example of using MeshSmooth here. However, my models always came out far too round. Playing with MeshSmooth’s parameters didn’t help at all.

As it turns out, MeshSmooth is not a catch-all solution to round off your models with no further work. I ended up experimenting with Editable Poly to get more hands-on experience.

3D Studio Max 2012: Modelling a vintage lamp post

JUN 17, 2014

I’ve been trying my hand again at 3D Studio Max. I love modelling, but texturing and lighting can be a real pain. Still, you can’t have one without the other. In recent efforts to redo the old Procurion 9 Awakening game (test renders will be posted in the future), I’ve been playing with photometric lights in Mental Ray. I love the possibilities.

3D Studio Max: Wrapping books

JUN 14, 2014

The images for the original Dream Prisoner game were created in 1994 using 3D Studio 2. Things were definitely simpler then, although it’s fair to say that even back then, I barely scratched the surface of what was possible with 3D Studio 2. Let alone, then, what’s possible with 3D Studio Max 2010.

I started out doing rendering with Persistence of Vision, a tool which requires you to specify the scene to be rendered in a plain-text source file. It was something I had seen featured in a 1993 PC Format magazine, and – for those who actually managed to create beautiful images with it – was very difficult to use. With 3D Studio you could actually visually place your objects in a scene. Still, the only tools I really used were “create box” and “compound object” which yielded very heavy scenes that would all but lock up my old 386 computer.

3D Studio Max: High-poly furniture models for download

JUN 14, 2014

Independent Software recently created some office furniture models in 3D Studio Max 2010, and we’d like to share the source models here for download. The models use mostly calculated metal textures, except for the wood and the book covers in the wooden office cupboard.

You can click each model image to download the .max source file straight from this website. The models include groups for easy insertion into your own scenes. The coffee maker uses tricky glass textures that will eat up lots of processing time when rendering, but the effect can be interesting when it’s placed in front of other objects so that it causes refraction.

A working RTF to HTML converter in PHP

MAY 12, 2014

In a recent project, I desperately needed an RTF to HTML converter written in PHP. Googling around turned up some matches, but I could not get them to work properly. Also, one of them called passthru() to use a RTF2HTML executable, which is something I didn’t want. I was looking for a RTF2HTML converter written purely in PHP.

Since I couldn’t find anything ready-made, I sat down and coded one up myself. It’s short, and it works, implementing the subset of RTF tags that you’ll need in HTML and ignoring the rest. As it turns out, the RTF format isn’t that complicated when you really look at it, but it isn’t something you code a parser for in 15 minutes either.

Developing a generic count() method for Idiorm/Paris

APR 3, 2014

The minimalistic object relational mapping libraries for PHP, Idiorm and Paris, are wonderful stuff. They have a very small footprint and make your code a joy to read. They allow you to build queries using method chaining, avoiding tedious string concatenation. They’re safer than string concatenation too, since they use parameterized PDO queries under the hood.

AngularJS & Slim Microframework: Developing a REST-powered AJAX table control (part 3)

MAR 26, 2014

Welcome to the third part of a hands-on tutorial on writing reusable user interface components with AngularJS. In this tutorial, we’ll write a table control that asynchronously loads data from a server, display it, and allows the user to sort the data by clicking table headers. The sorting is done client-side. We’ll show how to write a REST-server in PHP, how to define custom HTML elements in AngularJS, and how to setup a controller for the elements. To top it off, we’ll write CSS for our table in such a way that it can be dropped into a user interface in a snap, and scales fluidly with the space allotted to it.

AngularJS & Slim Microframework: Developing a REST-powered AJAX table control (part 2)

MAR 25, 2014

Welcome to the second part of a hands-on tutorial on writing reusable user interface components with AngularJS. In this tutorial, we’ll write a table control that asynchronously loads data from a server, displays it, and allows the user to sort the data by clicking table headers. The sorting is done client-side. We’ll show how to write a REST-server in PHP, how to define custom HTML elements in AngularJS, and how to setup a controller for the elements. To top it off, we’ll write CSS for our table in such a way that it can be dropped into a user interface in a snap, and scales fluidly with the space allotted to it.

AngularJS & Slim Microframework: Developing a REST-powered AJAX table control (part 1)

MAR 24, 2014

Welcome to a hands-on tutorial on writing reusable user interface components with AngularJS. In this tutorial, we’ll write a table control that asynchronously loads data from a server, display it, and allows the user to sort the data by clicking table headers. The sorting is done client-side. We’ll show how to write a REST-server in PHP, how to define custom HTML elements in AngularJS, and how to setup a controller for the elements. To top it off, we’ll write CSS for our table in such a way that it can be dropped into a user interface in a snap, and scales fluidly with the space allotted to it.

Awakening: A game that never was

JAN 7, 2014

Back in the day, together with my good friend Alexander Lentjes I would spend many, many hours developing games that we hoped would take the world by storm. Unfortunately, we were both 12 and our skills were not nearly sufficient to develop anything good (actually, I’m speaking mostly for myself here). At the time, our great example was Space Quest III, and we desperately wanted to make a clone.

Operating System Development: First and Second Stage Bootloaders

OCT 25, 2013

It’s finally time to put together the first and second stage bootloaders we’ve seen so far and make them work – although if you’ve been programming along with the past few installments of this series, you may already have done so. In the last few sections, we looked at the Intel 80386 processor’s protected mode and what’s required to get to it.

In this part, we’ll take a short break and put everything we’ve done so far together to see it run. Might as well have a little payoff for all the work, right?

This article is going to repeat all the code presented in the previous articles to see how it all goes together. You can read through it, or you can grab all the source code here.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Jumping to Protected Mode

OCT 24, 2013

In the previous section of this tutorial for writing your own toy operating system, we discussed memory and focused on the 21st address line (the “A20 line”) that must be enabled before we can have access to the full 4GB of memory, which is a prerequisite to entering protected mode. Now it’s time to jump to protected mode.

In fact, all we’ve done in the last few articles is prepare for entering protected mode. We’ve set up a global descriptor table (GDT), an interrupt descriptor table (IDT) and enabled the A20 line. All that remains is actually jumping to protected mode where we’ll finally be able to execute 32-bit code so we can focus on our kernel.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Enabling the A20 Line

OCT 23, 2013

Here we are again, with yet another step in the process of building a second-stage bootloader for our own toy operating system. In the previous sections we learned how to create and set up the global descriptor table (GDT) and the interrupt descriptor table (IDT), which the CPU uses to access and control memory and execute interrupts calls. Both of these structures are necessary to switch the CPU to protected mode. In this tutorial, we’ll see how to enable the A20 line.

We are now actually close to reaching that holy grail now. Only a few more preparatory steps are necessary to switch to protected mode, which will finish off our second-stage boot loader and allow us to start writing our kernel in C (which will be a relief from all the assembler code).

In this article, we will talk a little more about memory (we had already done that extensively in the past), but there’s a final hoop we need to jump through in order to have the the full 4GB of memory at our kernel’s disposal.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Setting up the Interrupt Descriptor Table (IDT)

OCT 22, 2013

In the previous section of this tutorial for writing your own bootloader for a toy operating system, we looked at protected mode. In particular, we examined the global descriptor table (GDT), which is a structure the CPU uses to determine access to memory and to allow a flat memory model, rather than a segmented one like in real mode.

We analyzed the structure of the entries in the global descriptor table, and looked at some code to set up a simple GDT with three entries, which is all we need to run our kernel. In this section, we’ll look at another, but very similar structure: the interrupt descriptor table (IDT). But before that, we’ll need to see what interrupts actually are and what they are used for.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Protected Mode and the Global Descriptor Table (GDT)

OCT 21, 2013

In the previous section of this tutorial for writing your own toy operating system, we discussed the 8088/8086 processor’s real mode memory addressing system, only to conclude that we really should leave this mode and enter protected mode, which brings us many benefits. What these benefits are will be discussed below.

This is not to say we don’t need a good understanding of real mode, since this is the mode that all Intel processors start up in. Our entire boot sector code has been written in real mode 16-bit assembly code!

This article is part of a series on toy operating system development.

View the series index

Forgot WordPress password, but password reset mail not arriving

AUG 9, 2013

I forgot my WordPress password. For the life of me, I couldn’t remember what it was, because it had always been stored in the browser cache and I never bothered to write it down anywhere. In order to reset it, I clicked the “Forgot password” link offered on the WordPress login page. However, apparently my server can’t send emails, since the password reset mail never arrived. What now?

Sending a DHL package to Mozambique

JUL 22, 2013

I’ve used DHL before from time to time. Sending a package from Mozambique to the Netherlands was a breeze. I hand the contents in at DHL in Maputo, pay for it, and 4 days later it gets delivered to the doorstep and the receiver signs for it. Easy! As it turns out, it’s not so easy at all to send something to Mozambique. In fact, it’s a nightmare and DHL does absolutely nothing to make it less painful. When I see a DHL commercial with a smily guy running up to a door to deliver something and get a signature, I now know reality isn’t quite like that. At least, not in Mozambique. Here’s how it went.

GMap.NET Tutorial: Calculating the area of a polygon on the map

JUL 19, 2013

If you’re using GMap.NET to add maps to your .NET application, then the time may come when you want to calculate the area of a polygon on your map. In my case, I have an application that allows users to actually create polygons using a GMap.NET control, by placing and connecting markers to shape their polygon. Since the map system is used to indicate the limits of an area occupied by a rural community, it’s necessary to calculate how many hectares the delimited area occupies.

MySql.Data. MySqlClient.MySqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding

JUL 18, 2013

When writing a database application that accesses a remote MySQL database, some of your queries might take a long time to execute, either due to latency or simply because you’re receiving a lot of data. Though it’s always a good idea to limit the quantity of data you request to a reasonable size in other not to make the user wait too long, sometimes there’s no way around it.

Creating MySQL InnoDB table with NHibernate

JUL 18, 2013

When you create a new table in MySQL without specifying the table engine to use, it’ll be MyISAM (MySQL configuration notwithstanding). This is all well and good, unless you want to use foreign keys and find it that these are only supported by the InnoDB table engine. No problem – you switch to InnoDB. But what if it’s out of your hands?

NHibernate: Fast loading of data from multiple tables into a tree structure

JUL 18, 2013

Nhibernate is a great Object Relational Mapping library. It allows you to forget about your database and focus on writing classes that interact with each other without any tedious CRUD code. It works beautifully, up until the point where you need to optimize your code.

Loading data with NHibernate can take a long time when you need to join results from multiple tables for a master-detail view. You can read all the records from the master table in one go, but when you access the fields of the resulting object instances to get at the child elements, then each access will result in a separate database query. Worse – if your mappings are not configured to use lazy loading, NHibernate will execute these queries even before you access the child fields, so let’s assume that you’ve configured NHibernate to use lazy loading, at least. If you’ve got 100 master objects, with 10 detail objects each, then you’re looking at one query to load all the master objects, and 100*10 = 1000 queries to load all the detail objects!

.NET: Translating an enum in C# using the Description attribute

JUL 18, 2013

It’s always a good idea to use enumerations for properties that have a limited set of valid values, rather than a number. This allows your code to check whether you’re assigning a valid value to the property, and the individual values have easy-to-read names. However, the names you use cannot contain spaces or other non-alphabet characters, and are limited to the English language (you cannot use characters like á, õ etc.)

Removing grass from a terrain in Unity

JUN 27, 2013

Using terrains in Unity brings you several advantages, one of which is the possibility to scatter trees and grass or other foliage over the terrain with a paint brush, rather than positioning foliage models by hand. You can, in fact, add thousands of grass billboards by painting the terrain, and these will be drawn using only very few draw calls.

The grass billboards will event sway gently in the wind. In the same way, you can paint huge numbers of trees onto your terrain, all of which vary slightly so that no two trees look exactly the same. Similarly, you can liberally scatter rocks around as well.

Lightmap baking in Unity does work

JUN 27, 2013

So you’ve built a wonderful terrain with lots of trees and other models on it, and now you’d like to bake a lightmap onto it? You’ve probably found that in Unity Free, realtime lighting (hard and soft shadows) is unfortunately not supported. But the option to bake a static lighting onto your terrain exists (and definitely works), and it adds a huge chuck or realism to your game. However, there are some caveats that you should bear in mind, or your baked lightmap will not appear.

GMap.NET: Getting rid of the red cross in the middle of your map

JUN 16, 2013

When you first slap a GMap.NET control on your Windows form, there will always be a red cross in the middle of the map, clearly to indicate where the map center is should your application allow people to indicate something on the map. Sometimes, though, you’re really just showing a map and the red cross has to go.

Visual Studio: The process cannot access the file debugfile.exe because it is being used by another process.

JUN 14, 2013

Visual Studio might throw the error “Unable to copy file ‘objx86Debugfile.exe’ to ‘binDebugfile.exe’. The process cannot access the file ‘binDebugfile.exe’ because it is being used by another process” to you one fine day and leave you wondering how to get rid of it.

It is actually Visual Studio itself that is keeping the file open, and a subsequent project build cannot overwrite it. Also, there is seemingly no cause. The error just happens, and then refuses to go away until you restart Visual Studio, which will cause the lock on the file to go away.

MySQL Error 1062: Duplicate entry for key 'primary'

JUN 14, 2013

An unexpected glitch occurred today on a MySQL server that’s been running for ages. It contains a database used by a content management system, and that CMS stores a visitor record for each visitor that enters the website. So far, it had stored 311669 records. And on inserting yet another record, it failed with #Error 1062 – Duplicate entry ‘311670’ for key ‘PRIMARY'.

C# .NET Automation: Opening the running instance of Microsoft Excel or Microsoft Word rather than a new one

JUN 13, 2013

When developing export capabilities for my .NET application to Microsoft Word and Microsoft Excel, I noticed that whenever I created a new document through COM automation, a new instance of either Microsoft Word or Microsoft Excel would be opened, resulting in many instances living in the Windows taskbar.

Realtime Landscaping Architect 2: Cabinet file setup11.cab has an invalid digital signature

MAY 23, 2013

So you’re trying to install Realtime Landscaping Architect 2, and the installation fails on the third CD because of an invalid signature in the setup11.cab file. What now? This problem seems to happen on Windows 7 and is actually is not an indicator of your setup file being corrupt, and can be circumvented.

TreeListView does not like NHibernate

APR 16, 2013

I love ObjectListView. It’s a solid, well-written control, and what’s more, it plays nice with NHibernate. When you use NHibernate to lazy-load a long list of items, any non-lazy proxy fields will be loaded by NHibernate as the ObjectListView accesses them.

Weifen Luo DockPanelSuite: Tutorial and Cookbook

MAR 13, 2013

WeiFen Luo’s DockPanelSuite is an open source window docking library for .NET Windows Forms. There are a lot of docking window solutions out there, but most are proprietary (and expensive), and DockPanelSuite is the only open source implementation I found that was decent. It suffers from one major problem though – lack of documentation.

Forcing NHibernate to use MySQL InnoDB

MAR 13, 2013

NHibernate is an Object Relational Mapping library that can create a MySQL database for you from your code, using mapping information that you provide. As it does so, it will create foreign keys as necessary to reflect that data integrity that your code requires. However, MySQL only accepts foreign keys for its InnoDB table format. This means that any foreign keys that NHiberate creates are silently ignored. Your MySQL EER diagrams will not show any associations, since there aren’t any.

.NET: String formatting in C# cheat sheet

MAR 8, 2013

String formatting in .NET C# is easy – the hard part is looking up what all the formatting specifiers do. I find myself constantly checking the (rather wordy) .NET documentation just to format a date or a currency value. This cheat sheet brings all the String.Format formatting specifiers together in one easy overview.

GMap.NET Tutorial: Routes

MAR 7, 2013

Continuing from the previous GMap.NET Tutorial – Maps, markers and polygons on this site, this article shows how you can show a route on your map. It is assumed that you know how to setup a GMap.NET project, and set your map to your desired location (if not, read through the other tutorial first).

GMap.NET Tutorial: Maps, markers and polygons

FEB 21, 2013

The following is a tutorial for using the excellent GMap.NET control. This text will explain how to place a map control on a form, how to initialize it to show the coordinates you want, how to add markers to it, and how to add polygons.

Automated conversion of many Visio drawings to PNG

FEB 18, 2013

I had a project where I needed to draw a lot of UML diagrams, and decided on Microsoft Visio for the drawing work. The diagrams had to be included in various project outputs, such as a design report and a project wiki. This would require exporting files from Microsoft Visio to PNG format whenever a change was made to any diagram.

What I needed was a way to automate image export from Microsoft Visio. Since all the diagram files live in a single folder, a script would go through that folder, find all VSD (Visio) files, and export them to PNG.

Android: Cannot create multiple database tables

FEB 13, 2013

I ran into a problem with an Android application, where I needed to create multiple database tables. There’s a small catch to remember that may save you a headache – but it’s just a matter of coding the database access layer right.

Euro-5 by Bert Benson

FEB 1, 2013

A series of books that I loved to read when I was very young is “Euro-5”, written by Bert Benson. These are science fiction stories of a time when men were men, curse words were unknown (except for “By Jupiter!” and “Blimey!”), and basically nothing was known about the universe. The Euro-5 series is food for Trekkies. It was available in Dutch. I don’t think it was ever translated to English. If I had the time, it would be on my to-do list.

I haven’t actually read all the books. Only some were available in the public library at the time, and searching the web now yields next to no results… until now! I found the entire Euro-5 series online and I’d like to share. Below are all the covers with titles translated to English, as well as links to downloadable EPUB versions of the books. Happy reading!

A practical guide to URL rewriting for IIS (and Apache)

JAN 30, 2013

I use my own PHP-based CMS for almost all my web development. This is great, because since I know the code inside and out, I can make whatever the client wishes happen. It has a lot of nice, reusable features (plugins) that make development of a generic website pretty short. Still, all was not well because one of the things it didn’t support was URL rewriting. In this blog post, I’ll set out to describe how this is done, what pitfalls there are and how they can be avoided.

Dream Prisoner: Walkthrough

JAN 25, 2013

I’m posting the walkthrough for the game “Dream Prisoner” that I recently converted to Flash. This walkthrough is complete solution, so don’t look at it if you want to play the game yourself first (rather use the hint sheet if you’re stuck).

Dream Prisoner: Hint sheet

JAN 25, 2013

With the release of Dream Prisoner for Flash, I remembered that I have a hint sheet lying around. This can be useful for those who want to figure out the game on their own, since the hint sheet was written in such a way that it doesn’t give away the complete solution (it’s not a walkthrough), similar to Level 9’s hint sheets.

Dream Prisoner: Released for Flash

JAN 25, 2013

It’s been almost twenty years, but I finally sat down and converted Dream Prisoner to Adobe Flash. This game has been around since 1995, and was the only game I ever really finished – core game, intro, extro, music, game menu, the works. This was in the days that interactive fiction was hot, and the original game is still floating around on the IFDB boards, and at Mobygames and Giant Bomb.

Operating System Development: Memory and How the CPU Accesses it

OCT 21, 2012

In the last section of this tutorial for writing your own boot loader for a toy operating system, we had put together a first-stage boot loader that manages to find on disk and load a second-stage boot loader, which at this point simply prints “Hello, world” on the screen.

For the boot loader, this was one of the major hurdles. The first-stage boot loader will always have to be small enough to fit in about 450 bytes of code, and that’s simply not enough to do all we need to do to load our future kernel. Since there is no limit to the second stage boot loader’s size, we now have the space to do whatever we need to do to launch our kernel.

There is, in fact quite a lot to do still. The main challenge that we face in our second-stage boot loader is switching the CPU to the so-called protected mode. This is essential for modern operating systems. In the following sections, we will discuss what protected mode is and why we want to use it. This part is going to be a bit heavy on the theory, but it will be a necessary foundation for our next steps.

This article is part of a series on toy operating system development.

View the series index

MySQL Error 1067: Windows error 87 - ERROR_INVALID_PARAMETER

APR 20, 2012

The strangest thing happened to a MySQL server (running Windows Server 2003) I set up today. MySQL would install with no problem, work all day with no problem, then fail after a reboot.

Operating System Development: Using Makefiles and the Second-stage Bootloader

APR 13, 2012

In our endeavor to write a boot loader for a toy operating system, we’ve come far already. Now it’s time to look at the second-stage boot loader. While we’re at it, we’ll introduce makefiles to make smooth out our compilation cycle. Our boot loader does the following so far:

  • Setup data segments
  • Reset the drive system
  • Write a “loading” message
  • Find the kernel file on disk, using parameters found in the boot sector
  • Read the FAT table into memory
  • Read the kernel file into memory, using the FAT table
  • Reboot gracefully if the file could not be found or if reading fails

We are now in a position to put all the code fragments together and compile our boot loader. We’ll also add some initial code to our kernel, so that it can say “Hello”.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: File Allocation Table (FAT) and Reading from Disk

APR 12, 2012

In the previous parts of this guide, we wrote assembly code for a simple boot sector and set up the GNU toolchain we use for compiling it and writing it to a floppy disk image. We then used the Bochs IA-32 emulator to boot from that image and see it run.

Our current boot loader resets the drive system, writes a “loading” messages to the screen, waits for a keypress and reboots. It’s now time to make it do what it’s supposed to do: find our kernel file on the disk, so it can be loaded into memory and run.

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Setting up a Toolchain and Using Bochs

APR 11, 2012

In part 2 of this guide to writing your own toy operating system, we set out to write our own (floppy) disk boot sector in assembly code. We ended up with a piece of code that writes a message to the screen, initializes the drive system, waits for a key press, and reboots. Before we move in, let’s create a development environment: a toolset that we can use to compile and test our code repeatedly (and when fiddling with low-level assembly code, you’ll find that “repeatedly” is the operative word here).

Our code so far was written in for the GNU assembler, as, although we use the Intel syntax (which GNU supports) as this is easier on the eyes for most people (I like the GNU syntax, but if you’ve never used it, you’ll find that it requires looking at everything upside down). The GNU assembler is free, and any other tools we’ll use will also be free.

We’ll also use Windows as our development platform, which we’ll require some extra work to set things up.

This article is part of a series on toy operating system development.

View the series index

Simple XML yields ClassNotFoundException on Android

MAR 13, 2012

I’m writing an Android app that uses Simple XML to parse XML directly into class instances. Simple XML works wonders, but a problem occurs when using polymorphism. My application stores and retrieves surveys. A survey contains a list of questions, and questions can be of various types. There are text questions, numeric questions, list questions etc. Polymorphism is used to implement all these question types.

Android: My app does not scale on a Samsung Galaxy Tab

MAR 13, 2012

I had built an Android app requiring a minimum Android SDK of 3 (Android version 1.5), in order to make sure that it would run on as many platforms as possible – and it does. It even runs on a Samsung Galaxy Tab, so I rejoiced. However, on the tablet, the app shows up very tiny, using the resolution it would have on a mobile phone.

Engrish in Mozambique

JAN 11, 2012

I’m an expat in Mozambique, and I’d like to share a little bit of this wonderful country with you in the form of our local “Engrish”, for lack of a better term. Sometimes businesses try to communicate to people whose first language isn’t Portuguese, which is the official language here. The result might be called Menglish, maybe, but I’ll just go with Engrish here.

Jiskefet Lullo's gezinsverpakking: Alle video's

OCT 29, 2011

Van Binsbergen, Kamphuys en Kerstens. Samen in een gezinsverpakking Lullo’s videos!

Operating System Development: First Bootloader Code

OCT 22, 2011

This tutorial shows how to write Intel assembler code for a first-stage boot loader for a toy operating system. We review the structure of the boot sector, and write code for resetting the disk system, rebooting, and writing a string to the screen.

Now that we know the structure of the boot sector’s boot parameter block (BPB) and extended boot parameter block (EBPB), we can start writing our first boot loader code in GNU assembler. (If you need a refresher, please have a look at the first part of this series about the structure of the boot sector).

This article is part of a series on toy operating system development.

View the series index

Operating System Development: Boot Sector Structure

OCT 21, 2011

When you’re writing your own toy operating system, the first thing you’ll need is a boot sector. It’s a piece of code (the boot loader) that lives in the first sector of a (floppy) disk. This code gets called by the BIOS as soon as the computer starts up, and is responsible for setting everything up for your operating system’s kernel to be loaded and executed.

This article is part of a series on toy operating system development.

View the series index

Linking a flat binary from C with MinGW

OCT 20, 2011

If you’re trying to compile a kernel written in C for your own toy operating system, you may run into trouble compiling/linking your code. Assuming you’re using GRUB to load your kernel, or you’ve rolled your own boot sector, you’ll now want to compile your kernel code (written in C) to a flat binary. The toolchain provided by MinGW (gcc and ld) is well suited for this, as long as you know a few tricks.

This article is part of a series on toy operating system development.

View the series index

Ruby: Installing MySQL2 gem for MySQL 64-bits

AUG 12, 2011

I was trying to install Ruby’s mysql2 gem on my Windows 7 computer, running MySQL 64-bits. It turns out that the mysql2 gem is not compatible with MySQL 64-bits libmysql.dll file. The solution is building the gem against the 32-bits version of the MySQL library, which thankfully turns out to be compatible.

Automating website and MySQL backups

AUG 10, 2011

I have a web server with a number of clients’ websites on it. It’s necessary to backup these websites every day, since clients use a content management system to make changes regularly. These changes can be updates to a website’s MySQL database, or they can be changes to the files stored within these websites. What I’d like is to backup the MySQL database and the filesystem for each website, every day, at a specific time. The backups must rotate: when there are, say, five backups, I want the oldest one to be removed as the newest one is written. Also, I’d like the backup solution to send me an email every day after it’s completed the backups with a summary of the procedure.

SASS and CSScaffold

MAR 31, 2011

I think the concept that SASS brings to the table (or CSScaffold, for that matter) is one we’ve all had when we play with CSS and think, “Gee, I would be nice if you could use variables and constants here, and if you could duplicate less code.” And then we would think of splitting our CSS up into many little files, since they’re easier to organize by function, only to find that that wasn’t such a hot idea because a browser will have to make a new HTTP connection for each one to download it.

Dynamic CSS through PHP

MAR 31, 2011

When writing CSS,you will find yourself repeating information a lot, which is always a bad thing in programming. CSS 2 lacks constants, which would allow us to define a value once and refer to it many times. Instead, we are forced to repeat the actual value many times, making updating CSS a process that is prone to errors.

Also, in order to reduce the number of connections a client must make to the server, it’s necessary to place all CSS in a single file. But this may mean that you end up with a lot of possibly unrelated CSS in a single file, making it difficult to navigate while you’re developing. There are times when it’s simply handier to have lots of small files instead of one big file, but it’s just not practical for download by your visitors.

Firefox 4 does not like script.aculo.us builder

MAR 30, 2011

After upgrading to FF4 I noticed that some of my JavaScript, which had been working perfectly fine, stopped working. I was able to isolate the problem to the use of the script.aculo.us Builder class to create a <script> element.

What to do about PHP 5.3's timezone complaints

MAR 28, 2011

If you’ve just upgraded to PHP 5.3, your scripts will probably generate a bunch of timezone errors.

Creating a forward proxy with WEBrick

MAR 26, 2011

Building a simple forward proxy in Ruby with WEBRick requires very little code. Here is a small sample that forwards all requests but for the example.com domain, which it blocks.

Getting local machine's MAC address in C#

MAR 10, 2011

Here’s a way to get the local machine’s MAC address in C#. Note that there may be various MAC addresses (Ethernet cards, local loopback devices, hooked up 3G devices etc.), so we try to find only the Ethernet MAC address.

Inger: A Programming Language

DEC 17, 2010

Back in 2003, a small team of students in the Netherlands worked on a new esoteric programming language called Inger. It was modelled after C, but with some syntactic sugar that made it more readable.

Free Charts Library Development

DEC 16, 2010

It’s happened a number of times now that I’m writing a piece of software that needs charts of some sort. Sometimes I’ll need a line chart, sometimes a bar chart, a pie chart, maybe even a Gauss diagram. There are cases that I’ll need a tiny chart that’s not too accurate but shows a tendency, shown as a bitmap (what seems to be called “sparklines”), and sometimes I’ll need a detailed line chart of visitors to a site by month, or number of pushups by day for a member of a gymnasium, or even a world map with data by country. I’ve done projects needing such charts in C#, in PHP, and in Flash.

Expandable properties in Visual Studio .NET

OCT 28, 2010

I had written a control with a number of properties, most of which showed up automatically in the Visual Studio Properties window. Simple data types were not a problem, nor were arrays: Visual Studio automatically opens up a window that lets the user edit the array elements. However, class or structure instances were not editable out of the box: they were shown greyed-out in the Properties window.

Technical aspects of Search Engine Optimization (SEO)

SEP 30, 2010

“So can you make sure that my new website appears in Google’s search results, on the first page?” It’s what clients tend to ask. They seem to think that one picks up the phone to have a little chat with Google to see if they can be persuaded to bump the site’s classification up a bit. No can do.

Nevertheless, there are ways and means to help Google classify your site properly – and higher. In the old days, it was commonplace to add a bunch of keywords in the META tags of a site in order for search engines to believe that the site was relevant to a lot of searches (the inclusion of porn-related keyword being a much-practised solution). Nowadays, however, Google all but complete ignores keywords. It’s better to leave out the META keywords altogether, since including irrelevant keywords will damage your reputation with Google rather than improve it.

Sysinternals Process Explorer: Replace Task Manager on Windows 7

SEP 24, 2010

When you try to have SysInternals’s Process Explorer (procexp.exe) replace the Task Manager on Windows 7, it won’t work out of the box. The new task manager cannot be found (as you will see when trying to start the task manager from the task bar), because the file procexp64.exe that Process Explorer creates to be instantiated when you start the task manager gets put in a temporary directory under your user account, and is inaccessible.

Installing PHP on Windows the extremely easy way

SEP 24, 2010

So there I was trying to install PHP 5 on a sparkly new laptop running Windows 7, without the foggiest idea how to make PHP get along with IIS 6.1. Although I had setup PHP plenty of times on Windows XP, IIS 6.1 had a new look that was a bit daunting, so it was off to Google for a step-by-step guide. I ended up finding something better than that.

Adobe Flash full install for Firefox

SEP 24, 2010

If you’re trying to set up Adobe Flash on Firefox, be it a new version or an upgrade, perhaps you’re experiencing problems with Adobe’s download manager. It just doesn’t seem to download anything. No problem – you can download the full package in one go for installation on Non-IE browsers here.

Firefox: Addons for Web development

SEP 24, 2010

Web development gets a lot easier when you use Firefox, which comes with an agreeable number of bells and whistles built in. However, it gets much better still when you install some of the addons that the Mozilla community has on offer. In particular, the following addons make the web developer’s life much easier.

ffmpeg commands

JUL 22, 2010

This post contains a number of useful commands for ffmpeg, a tool for converting video file formats. This post shows how to convert AVI to MPEG, MPEG to FLV, how to extract sound from a video, and how to get still frames from a video.

NHibernate and MySQL ISAM

JUL 6, 2010

I learned today that NHibernate should not be used with MySQL’s MyISAM table engine, but only with InnoDB. This is because NHibernate produces, and relies on, numerous foreign keys and MyISAM does not support referential integrity.

If you’re like me, and you produce your database schema from your code, then you’ll see the referential integrity that your code requires automatically expressed in the tables that are generated. By default, NHibernate uses InnoDB (merely because this is MySQL’s default table engine) and there doesn’t seem to be any way to change this, and nor should you want to.

Cross-browser min-height

MAY 20, 2010

The min-height declaration is poorly understood by Internet Explorer. However, here’s a trick to force minimum height on a block element that works in all browsers:

Subscribe via RSS