Advent of Code - Day 3: Gear Ratios

2023-12-03-generated.png

You and the Elf eventually reach a gondola lift station; he says the gondola lift will take you up to the water source, but this is as far as he can bring you. You go inside.

It doesn’t take long to find the gondolas, but there seems to be a problem: they’re not moving.

-- Day 3 - Advent of Code 2023

Solution in Java

Full source can be found: in GitHub

[Read More]

Advent of Code - Day 2: Cube Conundrum

2023-12-02-generated.png

You’re launched high into the atmosphere! The apex of your trajectory just barely reaches the surface of a large island floating in the sky. You gently land in a fluffy pile of leaves. It’s quite cold, but you don’t see much snow. An Elf runs over to greet you.

-- Day 2 - Advent of Code 2023

Solution in Java

Full source can be found: in GitHub

Part 1

The first step for today is the parsing of the input string into Game instances. To do this I created a record representing a single game and a parsing method createGame that processes a single line of the input.

[Read More]

Advent of Code - Day 1: Trebuchet?!

2023-12-01-generated.png

Something is wrong with global snow production, and you’ve been selected to take a look. The Elves have even given you a map; on it, they’ve used stars to mark the top fifty locations that are likely to be having problems.

-- Day 1 - Advent of Code 2023

Solution in Java

Full source can be found: in GitHub

Part 1

In the first part of this years Advent of Code we are requested to find the first and last digit in a string. The input will consists out of multiple of these strings.

[Read More]

Catching most PHP errors

When developing in PHP you may have encountered the following problem:

During an upgrade of the code, or just a minor bug fix, you have introduced new (non critical-error) code. This is causing PHP to crash and report ugly warnings to the user.

Well I think most developers of PHP have found this problem. One option, which is always done on live servers, is setting the logging level very low. Only critical errors are displayed. Though effective it’s far from perfect. I know I want to know when a page is creating problems, even if it is just a minor bug.

[Read More]
website  PHP 

MySQL and Random Row Selection

I’ve been working on a quiz section for one of my websites lately, well tried to anyway. One of the dumbest things happened. In a quiz you want to randomly pick questions and serve them to the visitor. That way they can answer them and shout WAHOO once they have one right.

Problem I had was that I couldn’t figure out how to sort all the questions in a completely random order, well semi random any way (since a computer does not know random as we do). I tried to do this by first counting the number of rows in the table and then creating a random array with 0..x (x being the number of rows). But this is very inefficient.

[Read More]

Setting Up A Dedicated SVN Server

All software developers have to deal with it. Version control software. Today I decided to play a bit with installing my own dedicated SVN (subversion) server. This, hopefully brief, step plan will help you do the same.

Downloading all needed software

Before you can continue with the tutorial you will have to get the following things:

  • ‘virtual’ computer to install you dedicated SVN server on,
    I used VMWare to emulate a server, but you could also use an old computer that you have as a spare.
  • Download Debian from http://www.debian.org/devel/debian-installer/,
    The reason for picking Debian is easy. It’s supposed to be a stable and powerful Linux OS. (You can pick the netinst CD image)

That’s all you will need. But be aware that we will be downloading various other packages (software applications) later on. So make sure you have your network prepared.

[Read More]

Language indicator, to use or not to use?

I’ve recently gotten a few questions on the issue of multilingual website implementation and the usage of a language indicator (eg: nl, uk, de). So today it’s time to look into best practice, both from the visitors point of view as well as that of the programmer.

Visitors like confirmation

That was easy. I just summed up the reason why it could be important for your visitor to include a language indicator in the URL. If I am browsing your website I would like to know what language the information is that I can expect. And I mean all of the information, not just this page. Because of that reason I would prefer to see a URL like:

[Read More]

SQL The Basics

Strange title isn’t. Is there such a thing as basic SQL(Structured Query Language). Lets try and find out. I will be covering some basics, thus creating a simple table. Making some basic queries and basics on T-SQL (Transact SQL).

Why use databases

Best to begin with a little story I suppose. Why would you want to use a database? Well it’s pretty easy. Databases give you the capability to store massive amounts of data in a orderly manner. With easy and structured access. I can hear those lovers of files shouting that you can do the same with files. I’ll grant them this, files can store information in the same way. But when it comes to quick access or easy manipulation then nothing beats databases.

[Read More]