Uniform call syntax in C++ today

While looking into uniform call syntax in C++, I stumbled onto how some libraries use the | operator to create pipable functions. Paul Fultz II has a good tutorial on how to create your own pipable functions. However, I wanted to also make existing free functions pipable without too much boilerplate …

Continue reading »

Using PyQt in Qt Creator

PyQt and PySide are Python bindings for Qt. I will focus mainly on PyQt in this post, but most of what I write is also the case for PySide. Both are a common choices for adding a GUI to a Python application.

Using PyQt instead of the original C++ library …

Continue reading »

Experimental Qt and QML in the browser

Update: You might also be interested in the discussion on Hacker News.

I was amazed when I read Morten Johan Sørvig's blog post about bringing Qt to Native Client (NaCl) and Emscripten in September last year. I have been following multiple efforts to bring Qt to the web for some …

Continue reading »

Using Blender and make-na to create DNA art

In CINPLA we are developing teaching material for a new course in biology and programming. One topic we're working on is that of bioinformatics and DNA. I figured that an artistic rendering of the DNA double helix would be nice to have and decided to try and make one in …

Continue reading »

An upcoming C++ library for HDF5 files

I recently started working on a new C++ library for reading and writing HDF5 files. I got the idea when I was working on a few files in Python and C++ at the same time. The Python library h5py is just way more comfortable than the HDF5 C++ API. But …

Continue reading »

Getting started with unit tests in Qt Creator and Catch

I have written about unit testing in Qt Creator on multiple occasions earlier. Since then, a new testing framework seems to have become a new leader in the field, and that is Catch. It is similar to UnitTest++ and Google's gtest and brings the best of both worlds. It is …

Continue reading »

Why I won't be starting my next project in Rust

I have been inspired to learn Rust and Julia lately. The idea was to use these promising languages in all of my new projects. I wanted to learn Rust because it is a safe and fast replacement for C++. I wanted to learn Julia because it is a language tailored …

Continue reading »

Today I called Python from QML

I always use QML with Qt Quick for GUI programming. It's incredible both for prototyping and larger applications. I find it easy to express myself in QML, because it is so flexible. It's declarative. You can bind a button's position to the value of a slider in just one line …

Continue reading »

Straight from the source: NEURON's incredible backwards compatibility

NEURON is a neural simulator, but it's not just another neural network application. NEURON has been around much longer than your fancy deep learning software. It was first released in 1994, although some of it's early code and concepts seem to stem from the 70's and 80's. In fact, NEURON …

Continue reading »

Hva er nevrale nettverk? (Del 1)

Kunstige nevrale nettverk er en etterligning av nervecellene våre i hjernen. De skal brukes til å gjøre datamaskiner like flinke til å lære som mennesker og dyr. Dette gjøres ved å herme etter hvordan hjernen er bygd opp.

Nevrale nettverk er noe som har blitt forsket på helt siden 1940-tallet …

Continue reading »

Nerveceller med toon-shader

Da var det på tide med et nytt Blender-prosjekt igjen. Etter å ha lest om mulighetene til å lage tegneserieaktige materialer bestemte jeg meg for å teste dette ut på en 3D-figur av en nervecelle:

neuronity4{.alignright .wp-image-1323 .size-large width="604" height="340"}

Jeg har for øyeblikket ingen anelse om …

Continue reading »

Ny CINPLA-logo som helgeprosjekt

Da jeg fikk jobben som stipendiat ble jeg med i en gruppe ved navn CINPLA. Gruppen er dannet for å kombinere eksperimenter og simuleringer innen hjerneforskning.

I helgen bestemte jeg meg for å teste ut en idé til en CINPLA-logo som vi har diskutert på kontoret den siste tiden:

cinpla-logo-brain{.alignnone …

Continue reading »

Choosing the right license for your code

I was pointed to John Hunter's Why we should be using BSD and came to think about how I rather tend to advocate using the GPL license. Richard Stallmanmakes some very convincing arguments for why GPL is the better choice, but even though I like this reasoning, I do …

Continue reading »

Simuleringer av hjernen

For et par dager siden lå jeg våken i sengen og innså at dette var en av de nettene hvor jeg ikke kom til å få sove. Heldigvis sovner jeg alltids til slutt, men det går fort noen timer fra jeg legger meg til jeg faktisk sovner. Andre ganger sovner …

Continue reading »

Installing Sumatra 0.6-dev in Ubuntu 13.10

Sumatra is a great tool for reproducibility and provenance when you are running numerical simulations. Keeping your work reproducible ensures that you and others will be able to check your results at a later time, while provenance is to keep track of where your results came from in the first …

Continue reading »

Recent commit causes Qt3D to fail compilation

A recent commit pushed to the Qt3D repositorybreaks building Qt3D against Qt version 5.2 and older with the following error message:

painting\qglpainter.cpp:2348:29: error: 'class QOpenGLFunctions' has no member named 'glReadPixels'

Thankfully, rolling back to an older commit still works. Just supply the following command …

Continue reading »

New project structure for projects in Qt Creator with unit tests

Note: This is a new version of an earlier post, with a revised project structure.

Note 2: See this post for the same project structure using the even better Catch testing framework.

This post assumes that you are using a C++ testing framework such as UnitTest++. See this earlier post …

Continue reading »

Faster loading of Qt apps on Android

Edit: In QtCreator 3.1, the method used here (using resource files) will become the default way to perform deployment on all platforms. I.e., this guide is only useful if you have created your project using QtCreator < 3.1.

If your Qt application is taking too long to load …

Continue reading »

Focusrite Scarlett 2i2 working flawlessly on Ubuntu with JACK

I needed a new sound card for Ubuntu that would allow me to do some recording and playback easily. After a bit of searching and testing, I figured I would go with the Focusrite Scarlett 2i2, which is a USB sound card with 2 XLR + jack inputs, stereo monitor output …

Continue reading »

Writing molecular dynamics data to binary LAMMPS format

In this post I will explain  how to write to the binary LAMMPS file format from C++, using data stored in Armadillo vectors and matrices. After running the example in this post you should be able to open the resulting file in Ovito or any other program capable of reading …

Continue reading »

Playing around with Sculpt Mode in Blender

While preparing for a presentation I'm giving on Python scripting in Blender, I figured I'd  also try out some new features . One such feature is in Sculpt Mode, where dynamic topology is now allowing fine-grained control over the level of detail while sculpting. This turned out to be a lot …

Continue reading »

Copying data files to the build directory with qmake

Sometimes you want to copy some data files to the same folder as your final executable when you are building with qmake in a different directory than your source code. This is what Qt Creator does by default, so this is quite often needed.

Just add the following to your …

Continue reading »

Multiple billboards in Qt3D

While Qt3D has a transform for drawing billboards, it is not very useful if you are drawing thousands of particles. This is because the transform can only be applied to one object at the time, and using thousands of objects is never a good idea in neither OpenGL or Qt …

Continue reading »

Using Qt3D today

Qt3D is an amazing library for Qt that gives you the ability to render your own 3D stuff together with your existing widget or QML based GUI. The library was started by the Qt developers a few years back, but has not yet been released with the official Qt SDK …

Continue reading »

When variational Monte Carlo becomes visual

Today I was playing around with the output of the code from Jørgen's thesis, and figured it would be fun to visualize the random walk in the variational Monte Carlo calculation.

[youtube=www.youtube.com/watch?v=H4AYC-nSgZY]

For the interested, this is a visualization of a variational Monte Carlo …

Continue reading »

Monitoring your unit tests without lifting a finger

I love unit testing. First of all, I think it is a good idea to test separate units of the code, but after doing so for some time, I've come to realize that unit tests are great for managing the software development cycle too. It all boils down to the …

Continue reading »

Speeding up compilation on Ubuntu with Qt Creator

Are you reading random stuff on the web while waiting for your C++ compilation to finish? Then you have come to the right place. In this post I will tell you about two really nice tweaks you may do to speed up your compilations, namely ccache and the make -j …

Continue reading »

Limiting the width of Wikipedia-articles when reading on widescreens

I'm using a widescreen display most of the day, which makes it quite useful to have two browser windows open or one browser window and a text-editor side-by-side. But sometimes I keep the browser window maximized, which is a bad thing for sites like Wikipedia. The articles get dragged out …

Continue reading »

Setting up UnitTest++ with Qt Creator in a nice project structure

Note: I've found a better way to visually verify that all tests are running. Check out this post on Jenkins to see how I'm now working with my tests. The below post is still useful as a reference on how to set up UnitTest++ in Qt Creator, also when using …

Continue reading »

Working with percolation clusters in Python

We're working on a new project in FYS4460 about percolation. In the introduction of this project, we are given a few commands to help us demonstrate a few properties of percolation clusters using MATLAB.

As the Python-fan I am, I of course had to see if I could find equivalent …

Continue reading »