Working efficiently with multiple versions of Qt sources

If you are working on the Qt source code, you likely want to compare your work with the latest stable branches for benchmarking or testing. However, once you checkout a different branch, make will often rebuild everything that you were working on. This can take a long time, making it hard to quickly compare with the latest stable build.

Continue reading →

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 and by chance I found that it can be done with very little code and a lot of unknown consequences:

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.

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 time. Mostly because I wanted to make my own Qt projects easily available to others, but also because I find the whole concept of running C++ code in a browser fascinating.

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 Blender. At first I considered building this from the ground up using its design tools, but I quickly figured that it would be too time consuming and hard to get the proportions right. After all, I’d like it to be as close to the real structure of DNA as possible.

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 with the new features in C++11 and C++14, I figured it should be possible to make a C++ library that is just as easy to use as h5py. And I must admit that I believe I’m on the way to making it even easier.

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 header-only and appears to reduce the amount of code that must be written in comparison to the other two.

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 for scientific use that might someday replace Python.

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. Not that you’d ever want to do that, but it shows how easy it is to connect objects together. I really wish the web was written in QML and not HTML.[ref]There have actually been some efforts to make QML a language for the web.[/ref]

Continue reading →

Straight From The Source Neurons Incredible Backwards Compatibility

title: Straight from the source: NEURON’s incredible backwards compatibility Date: 2015-10-26 00:37 Author: svenni Tags: Straight from the source, Technical Tags: C++, hoc, neuron, neuroscience, plot, plotting, Programming, vt100, vt125 Slug: straight-from-the-source-neurons-incredible-backwards-compatibility Status: published layout: post

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.

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:

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.

Continue reading →

Sanntid

Screenshot from 2015-01-03
00:05:56 This apps shows your realtime data from all your nearest stops. Add all stops of your choice and the app will immediately fetch information about the next travels from Ruter.

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 Stallman

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 jeg umiddelbart, litt som en lysbryter som skrus av akkurat klokka 22:04.

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 place.

Continue reading →

Recent commit causes Qt3D to fail compilation

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

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.

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.
*

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 and a headphone jack. It also supports +48V phantom power if you need to connect a condenser microphone.

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 binary LAMMPS files. The example should also be fairly easy to port to other data structure type, if needed.

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 of fun, so I decided to sculpt a human face while at it:

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.

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. This is simply because the overhead of each object is very large, both in terms of memory and performance.

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. It was announced that it would be bundled with Qt5.0, but because of the state of the library at the time, its release was postponed. Even so, the library is still very mature and appears to work very well in my opinion. So I would urge you to test it out.

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.

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 idea that you should write tests before you write your code.

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 flag, and how you may set these up in Qt Creator.

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 in full width, making the lines a bit too long to read comfortably:

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 Jenkins.*

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.

Continue reading →

Optimizing your C++ code for molecular dynamics

While working with the molecular dynamics project in FYS4460 I decided to learn more about how to optimize my C++ code for performance. As always, I follow Donald Knuth’s famous quote as a guideline to optimization:

Continue reading →

Setting up Ubuntu SDK on Kubuntu with backports enabled

Gah… So once again my temptation to install the latest and greatest causes a conflicting system setup. This time it was my attempt at installing the Ubuntu SDK on a Kubuntu system with backports enabled that conflicted. Backports are packages that are only available to newer versions of Ubuntu rebuilt for older versions, like when you want to use KDE 4.10 for Ubuntu 12.04. Although rare, when you want to install newer versions of other software you might end up with conflicts.

Continue reading →

Getting the latest version of Ovito for Ubuntu

Ovito is a great tool to visualize atoms from molecular dynamics simulations and to perform some statistical analysis on the data. The tool is an alternative to other similar tools such as VMD and ParaView.

Continue reading →

Set "Open containing folder" to use Dolphin and PDF files to use Okular in Firefox on Kubuntu

If you, like me, are tired of having Firefox open up Nautilus for folders and Evince for PDFs in KDE on Ubuntu, you might want to change your default application settings. To fix this once and for all, open up /usr/share/applications/defaults.list and change the line with

Continue reading →

Setting up Visual Studio to compile Botan

So I’m working with Qt5 on Windows and figured that since the Qt5 SDK is currently only compiled against Visual Studio 2010, I had to figure out how to build the Botan library without using MinGW.

Continue reading →

Setting up the buttons on Logitech G500 mouse in Kubuntu

I’ve become very happy with the Logitech G500 mouse. I like its responsiveness, the USB connection rather than wireless (no batteries, always responsive) and how it sits in my hand.

Continue reading →

Getting started with Ubuntu for phones on 12.04

What exciting news! Ubuntu is coming to phones in the near future, and they are already pushing forward for developers to get started on apps for the upcoming OS. The really great part? It is actually Ubuntu running on the phone, so making apps will be pretty much like making applications for Ubuntu on the desktop. Even better? They have chosen Qt and QML as first-class citizens for app-development together with HTML5.

Continue reading →

Introducing notes.txt

After discovering todo.txt, I realized that I needed something similar for notes. About a year ago I started working on a similar tool that would enable me to write

Continue reading →

Using the same script on installs with different EPD versions

In the newest version of Enthought’s Python Distribution (EPD) on Ubuntu, the plotting package has been moved from enthought.mayavi.mlab to the shorter and more general mayavi.mlab. This does however mean that if you, like me, need to work with different versions of EPD on multiple systems, will experience the following error from time to time:

Continue reading →

Adjusting to the new version of Pylab and Mayavi on Ubuntu 12.04

It seems the IPython and Pylab packages has also been updated in 12.04 and thus removing the old ipython -wthread flag that would ensure Mayavi plots to be run in a separate thread. Running with the flag causes this error to show up:

Continue reading →

Modifying keys on a Norwegian Linux keyboard to resemble those on a Mac

A friend of mine is switching between a Mac and a Linux machine, causing some readjustment whenever he switches keyboards. The most urgent fixes were to move the curly and square braces together with the backslash and dollar sign. Basically to map the keys as follows:

Continue reading →

Installing Norwegian dictionary in TexMaker

I just came over a great LaTeX editor named TexMaker. It seems to fit my needs perfectly, with auto-complete and mapping between tex and PDF files. It does however not have a Norwegian dictionary installed, but this is easily fixed:

Continue reading →

Installing the nVidia driver in Kubuntu 12.04

Running the vanilla install of Kubuntu 12.04 worked incredibly well. It took me quite some time to notice that I was in fact using the open source noveau driver. Dual displays, desktop effects and all other first impressions worked without glitches. In fact, it was not before I tried to run Google Maps’ WebGL version that I started noticing some rendering errors. And according to the noveau project’s own webpages, the OpenGL acceleration is exactly where noveau is still lacking.

Continue reading →

Launching apps from XBMCbuntu Eden

I just replaced an old Ubuntu install with the fresh live CD carrying XBMC. It has now been named XBMCbuntu, noting its inheritance a bit more than earlier. While running XBMCbuntu has its benefits with a pre-made nicely working setup of XBMC, it lacks direct access to applications like a web browser and for instance Spotify. One can boot up the LXDE desktop environment when logging in instead of starting XBMC in full screen, but that is kind of tedious if one wants the default behaviour to be a full screen home theatre PC.

Continue reading →

Nanoparticles game reviewed by Nanoparticles Blog

Continue reading →

Classical mechanics in HTML5 and Javascript

Ok, so we're working on the home exam in classical mechanics and I decided to spend some time simulating the solution of the first exercise. Probably not the wisest way to spend time during an home exam, but what the heck. I'm learning some Javascript and HTML5, plus the fact that it's always fun to verify results by looking at something moving!

Continue reading →

Passwordless access to MySQL by using sudo

Tired of remembering root passwords for MySQL on your servers? Fear no more, help is on the way.

Continue reading →

Developing MPI applications in Qt Creator

I have grown very fond of the ease and usability of Qt Creator lately, making it my main tool for developing anything in C and C++. Recently I started learning the MPI framework for doing large scale parallel programming and figured I wanted to try to make MPI play along with Qt Creator.

Continue reading →

Thunderbird with Lightning on Ubuntu

I’m trying out Thunderbird with Lightning as my calendar application, but for some reason Lightning did not show up under Add-ons in Thunderbird. Instead I installed it by using the xul-ext-lightning package. However, this ended up with all options in Lightning grayed out. To fix this I had to install the libstdc++5 package as well, as reported in this forum thread.

Continue reading →

Getting a headless connection to a server

I just learnt how to get a headless connection to a server before it has even booted. This gives access to LUKS and LVM, giving the oppurtunity to decrypt an encrypted hard drive. The solution was in this blog post. I also found a post about this on Stack Exchange, which I decided to contribute to. For my own later reference, I’ll repost the walkthrough here.

Continue reading →

Nanoparticles available for Android and Mac OS X


As mentioned in the post about Nanoparticles for Android being just around the corner, I have been able to port Nanoparticles by using the Qt port for Android enabled by the Necessitas project.

Continue reading →

Deploy Qt applications for Mac OS X

This turned out to be really simple. I was trying to create a Mac OS X version of my game, Nanoparticles, and was having trouble with some flicker when running a QGraphicsView with OpenGL. The solution turned out to simply be to disable some style sheet settings that I didn’t need.

Continue reading →

Nanoparticles for Android is just around the corner

Thanks to the great work of Bogdan Vatra and the Qt Developers working on Lighthouse, I have finally been able to create a running version of Nanoparticles on Android. Their efforts have led to the Necessitas project, a very user friendly and working port of Qt to Android.

Continue reading →

RewriteRule in .htaccess not working for cURL

For some strange reason I have experienced on one server that the RewriteRule in .htaccess is not working for cURL via the command line. The fix has been to add a User-Agent line to the header of the cURL command, like this:

Continue reading →

Bookmarks in terminal

Today I found a great tool to ease the navigation in terminal, called apparix. It lets you bookmark a folder so that you easily can navigate to it just by typing

Continue reading →

Fixing the volume treshold and intervals in Ubuntu on Dell XPS M1330

So the new Ubuntu version is finally out and as with every other time I’ve been upgrading from one version of Ubuntu to a new one, I keep forgetting how to fix the sound issue on the Dell XPS M1330. It is no big issue, really. It is simply that the lowest volume threshold is a bit high with headphones plugged in and that the volume intervals are a bit too large.

Continue reading →

Nanoparticles available for Nokia N9

Finally the N9 is here. And so is Nanoparticles for the Nokia N9. You can over to Nokia Store to get a copy right now:

Continue reading →

How to get things done with todo.txt

The simple answer to how you get things done is to actually do them. However, to do things in an organized manner is more easily said than done. Why? Because it is way too easy to drift away with less important stuff when you’re supposed to do anything you have to.

Continue reading →

Forgot that LaTeX symbol? Use Detexify to find it for you

I just came over this website called Detexify that helps you figure out the name of a symbol based on your drawing of it. With most the symbols I tested, it managed to suggest correctly the symbol I was trying to draw. Quite impressive, and very useful!

Continue reading →

Norwegian keyboard on the N950

The N950 is delivered with a keyboard without Norwegian keys, so I decided to map holding the function/arrow key and pressing comma (,), period (.) or asterix (*) to ø, æ and å, respectively.

Continue reading →

Handling locked screen event in Qt for Maemo

If you want to pause an application to save battery power when the screen is turned off, you can do this by listening for the locked screen event in Qt for Maemo. However, this is not made easily available through a wrapper function (that I know of), so in this case we’ll need to resort to listening for the right DBus call. (Thanks to Diph from Maemo.org for providing the recipe to make this possible.)

Continue reading →

Handling application minimization in Maemo with Qt

When you are developing with Qt on Maemo you might want to minimize or detect minimization of your application to the dashboard. Qt lacks clean functions for these use cases, but thankfully it’s still very easy to accomplish them.

Continue reading →

Nanoparticles

The survival of the green charge is in your hands. The purple charges will destroy the green one upon touch, so you’ll have to keep them away from each other.

Continue reading →

Loading local gems in cPanel shared host

I had some trouble today figuring out why my Redmine installation wouldn’t start running on my shared server. I received the following error in my log/mongrel.log file:

Continue reading →

Making new image in Gimp same size as clipboard

Have you ever tried to copy an image in Gimp and open a new image to paste it into? Then you’ve probably noticed that the size of that new image isn’t automatically adjusted to the size of the image in your clipboard - like it is in Photoshop or in earlier versions of Gimp.

Continue reading →

Using Wacom tablet with dual monitors (TwinView) in Ubuntu

I have a setup with two monitors on my computer and wanted to restrict my Wacom tablet to only one of the screens. Otherwise, the tablet is expanded to the entire two screens, making any drawing stretched.

Continue reading →

Spotify for Linux

Awesome news! Spotify is now finally available as a native client for Linux. I have no idea why I haven’t spotted this earlier, as it was already announced in July, but in any case it is finally here.

Continue reading →

Updated method for drawing springs in Inkscape

I’ve written an earlier post on how to draw simple schematically springs in Inkscape. After reading a great tip from \~suv in the Launchpad bug tracker, I figured I should bring you guys another update on how to do this using \~suv’s method.

Continue reading →

Trafikanten on Maemo

Update: The package was pushed to Extras testing on 2nd of October. It was delayed because Maemo’s package repository would not import the new package due to some trouble with the version numbering.

Continue reading →

LaTeX It! (and a new blog)

Together with my good friend, Mikael, I’ve started a blog about physics, chemistry, maths and technology over at Mindseye.no. Some of my postings over there will be dual posted here. Especially those about technical notes and tutorials. This is the first one, about LaTeX equations in Thunderbird.

Continue reading →

Internal licensing error

What do you say? Is there something wrong with the internal license? Well, just change the name of that client, and we’ll be alright!

Continue reading →

Copyleft

All content on this site, except where specifically noted, is created by Svenn-Arne Dragly and is licensed under a Creative Commons Attribution-ShareAlike 3.0 Norway License.

Continue reading →

Skip the packaging step in Qt Creator 2.0

I just figured that Qt Creator is now packaging every Maemo application whenever you tell it to run one. This might be annoying if packaging fails and will in any case slow down the whole process of debugging. However, if you want to skip the packaging step, this is not an option in Qt Creator 2.0(!).

Continue reading →

Connect to your N900 while developing via usb

If you are developing for Nokia N900 using the Nokia Qt SDK, you are most likely following this guide to set up your environment. This is all nice and easy, but if you are connecting using usb you have to open a terminal each time you plug in your N900 and write

Continue reading →

Loading wavefront .obj files in Qt's OpenGL ES

Note : This method is now easily replaced by the awesome Qt3D module that has support for loading a range of different file formats into an OpenGL context.

Continue reading →

Moving around and going to github

I don’t think you’ll notice, but I’ve just moved this page permanently to dragly.org. There seems to have been some problems getting this site indexed properly when it was hosted on a subdomain of dragly.com. To get the site ut to speed I decided to move it. After all, what is a webpage without visitors? And how would you get here without the site being visible?

Continue reading →

How to draw a spring in Inkscape

Update: Check out the new spring drawing method here. The old one on this page is still useful, but the new one is a bit faster.

Continue reading →

Why I'm not using Ubuntu One

Recently I’ve had some issues with my previous solution for synchronizing files between my computers. I used to have an SSH server which I placed all my files on, and usually I edited them directly on this server. Whenever needed offline I used to synchronize them to my computers using Unison. Recently, however, the SSH connection to the server has been pretty sluggish on my laptop, causing the work flow to slow down.

Continue reading →

Python deleted my vector values

Sometimes scripting languages can be a real annoyance. Why? Because when you get as much help as you do with for instance Python, you also lose a lot of control.

Continue reading →

Getting started with encrypted e-mail using Thunderbird and Enigmail

E-mail encryption is getting more and more important as more information is accessible to your ISP, e-mail provider or even your government. In this tutorial I won’t be going into any of the principles for why you should encrypt your e-mail or how it works - I rather assume that you have already realized the dangers of letting your personal e-mails swarm around on mail servers open for everyone to read.

Continue reading →

Fixing a bug with python-visual in Ubuntu Karmic

I was preparing to do some tasks in my physics course today, and experienced a rather annoying problem when attempting to use the python-visual package in Ubuntu.

Continue reading →

Fixing "undefined reference to `vtable for ..."

These annoying errors have been haunting me the last couple of days, so I figured I should share the most common reason for their occurrence. That is in my projects at least.

Continue reading →

Automount an SSH server in Ubuntu

If you ever need to mount an SSH server in Ubuntu, this is probably the easiest way to do it. This method uses a public/private key pair to authenticate with the server, making the whole process work without passwords.

Continue reading →

Revision and build numbers for your NetBeans apps

After going through a couple of guides on the net, I figured out how to add build numbers and revision numbers to my NetBeans projects. The build number will be incremented for each build, and the revision number is gathered from your subversion repository. If you don’t use Subversion just skip that part and add the revision number manually.

Continue reading →

On vacation in Naxos

Greece. The beautiful country in the south of Europe with all its islands spread in the Mediterranean Sea. After a couple of days here on the beautiful island of Naxos, I must say that I once again have fallen in love with Greece and its pretty nature.

Continue reading →

Mounting a Windows share folder in Ubuntu

I have been connecting to my home folder at the Universitiy of Oslo for quite some time now, and since they use the Windows file-sharing protocol for this purpose, there has been room for quite som headaches.

Continue reading →

About

svenn-arne_dragly

Continue reading →