Posts by Category

Editors

Considering a Switch from Vim to Emacs?!

11 minute read

People joke about that I change my blogging platform and editor of choice only to have something to write about. And I guess I change both more than most peo...

Generate Source Files With CMake

1 minute read

Sometimes when writing c++ programs I have some textual data that I want to use in the program that I want to be part of the executable instead of in flat fi...

Learning

Where I Go To Learn

2 minute read

I try to learn a new thing every day. Sometimes it is a big thing sometimes something small.

Quick Tip

Generate Source Files With CMake

1 minute read

Sometimes when writing c++ programs I have some textual data that I want to use in the program that I want to be part of the executable instead of in flat fi...

Git Quick Tip - forgot to create a branch

less than 1 minute read

It happens to me at least once a week. I meant to make a topic branch. But I dove into the code too quickly - and suddenly I am a couple of commits into what...

Merge Clover XML Files

1 minute read

We have a single git repository with a large project that is split into two separate PHP application (api and client). We use travis for running tests and de...

Thoughts

Why I gave away a domain name

2 minute read

Like so many of my colleagues I have a disease. I think it could be called “Idea Induced Domain Hogging”. You know that thing that happens in three easy step...

c

How to Write to a file in C

less than 1 minute read

Writing to a file in c is surprisingly simple. Most of the steps in c can be found in most other languages as well. In c you open a file, write to it and clo...

How to Write a TCP Echo Server in C

1 minute read

In c you are as close to the metal - or at least as close to the os - as possible in a high-level language. This shows in the verbose code you need to make a...

How to Read from stdin in C

less than 1 minute read

Reading from stdin in c - is exactly like reading from a file. (In unix philosophy - everything is a file after all). This means that the how to read a file ...

How to Read a file in C

less than 1 minute read

Reading files in C is very easy. First you need the stdio.h header file included, then you need a pointer of type FILE, and you call fopen on a filename (set...

cpp

How to parse JSON in C++

less than 1 minute read

In C++ there are no built-in ways to handle json. However there are many open source libraries to help you.

How to Read from stdin in Cpp

less than 1 minute read

Reading from stdin in C++ is surprisingly concise. Only 12 lines of code (including includes and empty lines).

csharp

How to Read a File in C#

less than 1 minute read

Csharp was probably the first compiled language I really loved. When the first version of .net came out I wrote a small CMS using C# and the new runtime. (A ...

How to Read Program Arguments in C#

less than 1 minute read

In C# program arguments (like in most c-based languages) are a part of the main method signature. Like in java this variable is an array of strings.

elixir

How to parse JSON in Elixir

less than 1 minute read

Parsing JSON in elixir requires an external tool - and you’ll need to define the types the data needs to be parsed into.

How to Read a file in Elixir

less than 1 minute read

Reading files in elixir is pretty straight forward - especially if you just want the content of a file you know exists. And that case it is a oneliner just l...

How to Read from stdin in Elixir

less than 1 minute read

Elixir is rather easy - as long as you get past the pattern matching barrier I stumpled into when writing about how to read program arguments.

euler-1

How to Solve Euler 1 in JavaScript

less than 1 minute read

The Euler 1 problem is fairly simple to solve. Most people intuitively know how to do it. Here is how I would do it in JavaScript.

evernote

I love me some native code

1 minute read

I love me some native code Don’t get me wrong - I love Ruby. I have been the host of many a JavaScript meetup. I have written many thousand lines of php.  I...

This is a quick blog post written in evernote

less than 1 minute read

This post will be auto posted to my blog directly from evernote.  Using evernote for handling drafts seems so intuitive for me - I have done this for years....

go

How to parse JSON in GO

1 minute read

The go standard library has all you json needs covered. The JSON package has methods for both encoding and decoding to/from JSON.

How to Read a file in Go

less than 1 minute read

In go you will sometimes write more code than you are used to in e.g. most higher level languages (think php, ruby, python) - but will have a lot more contro...

How to Read from stdin in Go

less than 1 minute read

Reading from stdin in go is as easy as reading from os.Stdin - the ioutil.ReadAll method reads all bytes into a buffer and allows you to handle the input onc...

How to Read Program Arguments in Go

less than 1 minute read

There seems to be two schools of program options reading in programming languages. Those who have a main method where arguments are explicitly mentioned in t...

haskell

How to Read from stdin in Haskell

less than 1 minute read

In haskell there are two ways to read the stdin stream. Which one to use depends on what you’re trying to accomplish I guess.

How to Read Program Arguments in Haskell

less than 1 minute read

This is the one programming language to date where I have had the hardest time doing the little hello world program that prints a hello line per input argume...

ideas-and-demos

Quick Metal Demo

less than 1 minute read

My wife and I bought our first house at the beginning of 2017. In this house I have finally created my own little demo studio.

java

How to read a file in Java

less than 1 minute read

Java is - off course you might joke - rather verbose when it comes to reading files. However most of the verbosity has to do with importing the functionality...

How to Read from stdin in Java

less than 1 minute read

Reading from stdin in java looks like in most languages. Standard in is bound to System.in - and must be opened as if it where a file just like in c.

javascript

How to Write to a file in JavaScript

less than 1 minute read

Writing a file in Javascript is as easy as using the built-in method fs.writeFile, and as such matches the read file method quite well

How to Solve Euler 1 in JavaScript

less than 1 minute read

The Euler 1 problem is fairly simple to solve. Most people intuitively know how to do it. Here is how I would do it in JavaScript.

How to Read a file in JavaScript

less than 1 minute read

Reading a file in Javascript (again, nodejs) is as easy as using the built-in method fs.readFile (however it needs to be required first).

How to Parse Json in JavaScript

less than 1 minute read

As already stated in the post about how to write json in javascript, JSON is an integral part of the JavaScript language.

How to Read from stdin in JavaScript

less than 1 minute read

In javascript (nodejs anyway) stdin can be read as a stream of bytes. Therefore you need to tell node which encoding it is (utf-8 in our instance). We do the...

How to Write Json in JavaScript

less than 1 minute read

Since json is short for JavaScript Object Notation - it does not come as a surprise that is a natural part of the javascript language. The JSON module has tw...

How to Read Program Arguments in JavaScript

less than 1 minute read

In JavaScript (nodejs) you can access the program arguments in the array process.argv. Like in C it includes the program name but unlike e.g. PHP and Ruby it...

lisp

How to Read from stdin in Lisp

less than 1 minute read

Just as with reading program arguments - lisp looks a bit weird when reading from the stdin stream. That is until you get the hang of it.

How to Read program arguments in Lisp

less than 1 minute read

Lisp is a completely different way of looking at programming than e.g. ruby is. Where in Ruby everything is an object - in lisp everything is a list. Which m...

lua

parse-json

How to parse JSON in Rust

less than 1 minute read

To parse json in Rust you need a library. The one used here is called rustc-serialize.

How to parse JSON in C++

less than 1 minute read

In C++ there are no built-in ways to handle json. However there are many open source libraries to help you.

How to parse JSON in GO

1 minute read

The go standard library has all you json needs covered. The JSON package has methods for both encoding and decoding to/from JSON.

How to parse JSON in Elixir

less than 1 minute read

Parsing JSON in elixir requires an external tool - and you’ll need to define the types the data needs to be parsed into.

How to Parse Json in Ruby

less than 1 minute read

In Ruby you parse json by first including the json library (either the one provided with the language - or any one of the gems that provide the same function...

How to Parse Json in JavaScript

less than 1 minute read

As already stated in the post about how to write json in javascript, JSON is an integral part of the JavaScript language.

How to Parse Json in PHP

less than 1 minute read

Once again php shows how it is an easy language for beginners. In PHP you don’t have to think about much when you want to parse json. Json parsing and encodi...

perl

How to Read Program Arguments in Perl

less than 1 minute read

IISResetMe has made another Program Arguments script. This time in perl. Reading perl has always been weird for me. I have never used perl for much myself - ...

personal

Printing C++ Objects to stderr/stdout

1 minute read

When your C++ projects grow a little, you may find yourself needing to log the state of objects. There are two ways of doing this (assuming that you’ll want ...

php

How to Write to a file in PHP

less than 1 minute read

The simplest way of writing to a file in php is using the file_put_contents function. This implicitly calls fopen, fwrite and fclose, as we know from e.g. c.

How to Write Json in PHP

less than 1 minute read

In PHP JSON stringify and parse are part of the core libraries - however in PHP they are called json_encode and json_decode respectively. The latter was show...

How to Read from stdin in PHP

less than 1 minute read

Reading from stdin in PHP is just like reading a file. The only difference is that the file to read is called php://stdin

How to Parse Json in PHP

less than 1 minute read

Once again php shows how it is an easy language for beginners. In PHP you don’t have to think about much when you want to parse json. Json parsing and encodi...

How to Read a file in PHP

less than 1 minute read

Reading a whole file is as easy as one function call in PHP. (Especially good if you want to read a small file, and want all the data in memory anyway).

powershell

How to Read Program Arguments in PowerShell

less than 1 minute read

I don’t know much about PowerShell to be honest. It sounds to me like it is some kind of a windows version of bash/zsh. Nevertheless, IISResetMe wrote up a q...

quick-post

Feeling lucky or feeling grateful

less than 1 minute read

I am grateful for my life. I love my wife and my kids. I have a great job. I have a nice house. I am relatively healthy - albeit overweight.

read-a-file

How to Read a File in C#

less than 1 minute read

Csharp was probably the first compiled language I really loved. When the first version of .net came out I wrote a small CMS using C# and the new runtime. (A ...

How to read a file in Java

less than 1 minute read

Java is - off course you might joke - rather verbose when it comes to reading files. However most of the verbosity has to do with importing the functionality...

How to Read a file in JavaScript

less than 1 minute read

Reading a file in Javascript (again, nodejs) is as easy as using the built-in method fs.readFile (however it needs to be required first).

How to Read a file in Go

less than 1 minute read

In go you will sometimes write more code than you are used to in e.g. most higher level languages (think php, ruby, python) - but will have a lot more contro...

How to Read a file in Elixir

less than 1 minute read

Reading files in elixir is pretty straight forward - especially if you just want the content of a file you know exists. And that case it is a oneliner just l...

How to Read a file in PHP

less than 1 minute read

Reading a whole file is as easy as one function call in PHP. (Especially good if you want to read a small file, and want all the data in memory anyway).

How to Read a file in Ruby

less than 1 minute read

In ruby you read a file in two steps. First open the file, and then iterate over the contents. (In this instance we loop over the contents of a text file so ...

How to Read a file in C

less than 1 minute read

Reading files in C is very easy. First you need the stdio.h header file included, then you need a pointer of type FILE, and you call fopen on a filename (set...

read-from-stdin

How to Read from stdin in Haskell

less than 1 minute read

In haskell there are two ways to read the stdin stream. Which one to use depends on what you’re trying to accomplish I guess.

How to Read from stdin in Cpp

less than 1 minute read

Reading from stdin in C++ is surprisingly concise. Only 12 lines of code (including includes and empty lines).

How to Read from stdin in Lisp

less than 1 minute read

Just as with reading program arguments - lisp looks a bit weird when reading from the stdin stream. That is until you get the hang of it.

How to Read from stdin in Java

less than 1 minute read

Reading from stdin in java looks like in most languages. Standard in is bound to System.in - and must be opened as if it where a file just like in c.

How to Read from stdin in JavaScript

less than 1 minute read

In javascript (nodejs anyway) stdin can be read as a stream of bytes. Therefore you need to tell node which encoding it is (utf-8 in our instance). We do the...

How to Read from stdin in PHP

less than 1 minute read

Reading from stdin in PHP is just like reading a file. The only difference is that the file to read is called php://stdin

How to Read from stdin in Elixir

less than 1 minute read

Elixir is rather easy - as long as you get past the pattern matching barrier I stumpled into when writing about how to read program arguments.

How to Read from stdin in C

less than 1 minute read

Reading from stdin in c - is exactly like reading from a file. (In unix philosophy - everything is a file after all). This means that the how to read a file ...

How to Read from stdin in Go

less than 1 minute read

Reading from stdin in go is as easy as reading from os.Stdin - the ioutil.ReadAll method reads all bytes into a buffer and allows you to handle the input onc...

read-program-arguments

How to Read program arguments in Lisp

less than 1 minute read

Lisp is a completely different way of looking at programming than e.g. ruby is. Where in Ruby everything is an object - in lisp everything is a list. Which m...

How to Read Program Arguments in Perl

less than 1 minute read

IISResetMe has made another Program Arguments script. This time in perl. Reading perl has always been weird for me. I have never used perl for much myself - ...

How to Read Program Arguments in PowerShell

less than 1 minute read

I don’t know much about PowerShell to be honest. It sounds to me like it is some kind of a windows version of bash/zsh. Nevertheless, IISResetMe wrote up a q...

How to Read Program Arguments in C#

less than 1 minute read

In C# program arguments (like in most c-based languages) are a part of the main method signature. Like in java this variable is an array of strings.

How to Read Program Arguments in Haskell

less than 1 minute read

This is the one programming language to date where I have had the hardest time doing the little hello world program that prints a hello line per input argume...

How to Read Program Arguments in Rust

less than 1 minute read

Rust reminds me of C in many ways. The program arguments include the program name at the first index, but unlike C you have to make a function call to get th...

How to Read Program Arguments in Go

less than 1 minute read

There seems to be two schools of program options reading in programming languages. Those who have a main method where arguments are explicitly mentioned in t...

How to Read Program Arguments in JavaScript

less than 1 minute read

In JavaScript (nodejs) you can access the program arguments in the array process.argv. Like in C it includes the program name but unlike e.g. PHP and Ruby it...

How to Read Program Arguments in Ruby

less than 1 minute read

Ruby has a global ARGV array which contains all arguments. Contrary to e.g. C and PHP it does not, however, contain the script name. This means the hello wor...

ruby

How to Write Json in Ruby

less than 1 minute read

Just like when parsing json in ruby you need to require the json library to write hashes and arrays to json strings. Unlike Javascript and PHP you don’t call...

How to Parse Json in Ruby

less than 1 minute read

In Ruby you parse json by first including the json library (either the one provided with the language - or any one of the gems that provide the same function...

How to Write a TCP Echo Server in Ruby

less than 1 minute read

In ruby you have lowlevel access to all the same methods that you do in C. But you also have some higher level sugar on top of that - and a program that does...

How to Write Xml in Ruby

less than 1 minute read

In Ruby there is no built-in support for parsing and writing xml. There are however a couple of gems (packages) that allow you to do exactly this. If you are...

How to Read a file in Ruby

less than 1 minute read

In ruby you read a file in two steps. First open the file, and then iterate over the contents. (In this instance we loop over the contents of a text file so ...

How to Read Program Arguments in Ruby

less than 1 minute read

Ruby has a global ARGV array which contains all arguments. Contrary to e.g. C and PHP it does not, however, contain the script name. This means the hello wor...

rust

How to parse JSON in Rust

less than 1 minute read

To parse json in Rust you need a library. The one used here is called rustc-serialize.

How to Read Program Arguments in Rust

less than 1 minute read

Rust reminds me of C in many ways. The program arguments include the program name at the first index, but unlike C you have to make a function call to get th...

tweet

clauswitt - Tweet

less than 1 minute read

The best part of working from home, is that you have a couple of guitars within reach at all times #fb #post— Claus Witt (@clauswitt) December 15, 2017

clauswitt - Tweet

less than 1 minute read

Weekend status: have written code, read (a couple of chapters) in a book, have made music, have had time to write, did make "real food", have spent...

clauswitt - Tweet

less than 1 minute read

When I write any text in English I overuse the word “however”. #post— Claus Witt (@clauswitt) November 26, 2017

tweets

clauswitt - Tweet

less than 1 minute read

Auto posting quick blog entries directly from twitter - seems like a very dumb idea #postBut I have to celebrate the fact that I can now write much more that...

write-a-tcp-server

How to Write a TCP Echo Server in Ruby

less than 1 minute read

In ruby you have lowlevel access to all the same methods that you do in C. But you also have some higher level sugar on top of that - and a program that does...

How to Write a TCP Echo Server in C

1 minute read

In c you are as close to the metal - or at least as close to the os - as possible in a high-level language. This shows in the verbose code you need to make a...

write-json

How to Write Json in Ruby

less than 1 minute read

Just like when parsing json in ruby you need to require the json library to write hashes and arrays to json strings. Unlike Javascript and PHP you don’t call...

How to Write Json in PHP

less than 1 minute read

In PHP JSON stringify and parse are part of the core libraries - however in PHP they are called json_encode and json_decode respectively. The latter was show...

How to Write Json in JavaScript

less than 1 minute read

Since json is short for JavaScript Object Notation - it does not come as a surprise that is a natural part of the javascript language. The JSON module has tw...

write-to-a-file

How to Write to a file in JavaScript

less than 1 minute read

Writing a file in Javascript is as easy as using the built-in method fs.writeFile, and as such matches the read file method quite well

How to Write to a file in PHP

less than 1 minute read

The simplest way of writing to a file in php is using the file_put_contents function. This implicitly calls fopen, fwrite and fclose, as we know from e.g. c.

How to Write to a file in C

less than 1 minute read

Writing to a file in c is surprisingly simple. Most of the steps in c can be found in most other languages as well. In c you open a file, write to it and clo...

write-xml

How to Write Xml in Ruby

less than 1 minute read

In Ruby there is no built-in support for parsing and writing xml. There are however a couple of gems (packages) that allow you to do exactly this. If you are...