Oct 192016

I’m using node.js on Windows. Not ideal, I know. Installing node modules globally means something else than you might expect. Globally means “not in the project folder”. It does not mean “for all users on this computer”, like you’re used to when installing applications.

Node itself is installed in the “Program Files” folder by default. To enable a Windows-like “global” install, try using:

npm config set prefix "%ProgramFiles%\nodejs"

That way the “–global” directive will install the module in the node folder itself, making it available globally in the node way of thinking and in the Windows way of thinking.

Of course, if you didn’t install node.js in the default folder, just replace the “%ProgramFiles%\nodejs” with yours.

If for some reason you want things back to what it was, remove the prefix by issuing the following command:

npm config rm prefix

Oct 102016

My colleague needed to use a function in the database in a query, but found that the function was not defined/reachable in his schema. So the solution is to ask for the function to be granted to you, or to create the function in your schema, or…

…use the new WITH enhancement available from Oracle 12c.

Here is a very simple example, that squares a number and returns it. The function is used in the query. How nice :-p

  function s(x in integer) return integer is
    return x*x;
  q as (select 1 n from dual union all select 2 from dual)
  select q.n,s(q.n) from q
Aug 202016

Gaming is a way to relief stress and not think about daily life. Lately, even gaming can’t keep me interested. But my mind is busy all day long with all kinds of stuff, so yesterday I gave mindmapping a try. A mindmap for what is needed to create a gameserver. A server that keeps track of the users, their progress, serves the game itself to the clients, etc. One thing a gameserver needs is a way to store all that data, so a proper database is needed. So I looked at several candidates and in the process I came across Redis. Maybe not the easiest backend database when you need graphing for social features, but absolutely the perfect toy to keep my mind occupied for some time.
Redis has enough client APIs, like most databases. Let’s see if we can use the C#/.Net API from within Unity. Touch/collect this item and increase a value in the Redis database: the XP of the user playing the game.

I will probably create nothing for real, but it’s nice to be not bored for some time.

Jun 272016

Yesterday I started playing Screeps and bought it even when I hadn’t finished the (free) tutorial yet. I mentioned Screeps earlier, and it’s now in an almost ready state. It’s available on Steam.

The game looks simple, but it’s not. As I mentioned before, it is only as good as the code you put into it. You can spawn creeps with certain properties, so they can harvest, or attack, or heal. But unless you run a “program” that actually uses these properties, the creep is not going to do a thing and will die without being of any use to you.
The tutorial teaches you to give a creep a role, and the behaviour of each role will be specified in a javascript file for that role.

You will make mistakes. And I don’t mean mistakes in your code, since the code will only run (of course) when it’s syntactically correct. No, I mean mistakes about how to play the game. A stupidly placed spawnpoint. Choosing a room full of swamp. Forgetting that other creeps will attack you, and you didn’t think of defending your base. Creeps will die (of old age), and you forgot to respawn them. That kind of mistakes. And with each mistake you solve, your code gets better. And meanwhile……you get better at coding!


Feb 282016

The WordPress plugin Broken Links Detector reported over 900 links on my blog that have some sort of problem. Meaning an URL can’t be reached or even the linked server doesn’t exist anymore. I started blogging about 12 years ago. Websites come and go, domain names change, blogs are moved to different locations. The internet changes constantly.

Feb 262016

My server was dead. Not even a little blink from one of the many LEDs in the system or some other sign of life when putting the power on it. So I figured that replacing parts would be like a puzzle. Is it the power supply? The motherboard? The CPU? Or a combination of any of the parts? Replacing one of them would easily cost me about 100 euro. So I did some math, and figured that hosting was not only a relatively cheap solution, it also has many advantages (that all of you IT people can list better than me).

I went with DirectNIC, since I have been using their services for over 15 years now.

And as you can see, it just works. I had to do some work to restore the WordPress database, since the last backup I had on my NAS disks was from the end of 2015. But with some diskswapping, file copying, MySql-dumping+importing and WP-CONFIG changing it now works.

I’m happy!

Jan 082016

I was looking for icons to use in MenuItems in a WPF menu and found that there are a lot of questions on how to do that. It’s not very difficult, so maybe the documentation is not too clear about it.

Create a folder in your project, for example “res” or “resources” or “images”. Put some graphics files in there by right-clicking on the folder, choosing Add and then choosing Add existing items.

To use these images in your XAML, follow this example:

 <MenuItem Header="E_xit" Click="btnCancel_Click">
    <Image Source="Resources/Exit.png" Width="20" />

In my project, the images are in the Resources folder. And that’s all there is to it.

Dec 262015

Since the server is back online (still going strong) WordPress began to nag me again about a new version being available 😛 So I decided to upgrade. WordPress itself and 3 plugins. Worked like a charm. No hangs or freezes. Yay! Guess buying new memory for the server will be on my to-do list right after Christmas.