Federico Fuga

Engineering, Tech, Informatics & science

A C++ Smart Pointer wrapper for use with JNI

10 Mar 2017 14:49 +0000
Introduction In this article, I'll propose a solution for managing native C++ resources from JNI using smart pointers. While Smart Pointers can't be useful from Java, because of the limits of the Java memory management, it may be required by the native library to maintain allocated resources through shared_ptr or unique_ptr, for example because classes derive from std::enable_from_this. Since there is a fixed pattern to maintain native objects in Java classes, a utility C++ class is proposed. Continue reading

Vmware Player is slow under Ubuntu 16 host, Part 2.

21 Oct 2016 17:55 +0000 Linux vmware Windows
So it seems the issue I talked about some week ago, wasn't fixed. Windows is still slow, the hard disk always working at 100% load. Not so slow, because the fix explained in my previous post seems to mitigate the problem, but still slow. Since I was using many Virtual Machines on that box without any problem since longtime, well before my upgrade to Ubuntu 16.04, I guessed the problem was the kernel. Continue reading

Vmware Player is slow under Ubuntu 16 host

10 Oct 2016 17:57 +0000 Linux vmware Windows
So you just upgraded your Ubuntu box and found that all your VmWare Windows Boxes are extremely slow? The symptom is your Windows task manager showning 100% usage of your disk, and the WIndows Instrumentation showing very long lags, says, up to 2.5seconds (yes, seconds) to respond to a disk request. This makes the box practically unusable. Perhaps your vmware logs are shoing a lot of lines like scsi0:0: Command READ(10) took 2. Continue reading

A compact CSV parser using C++ TMP

07 Mar 2016 17:24 +0000 c++ Metaprogramming
How many times have you implemented a CSV parser to fill a list of stucts from a text file? Personally, it happens to me about every time I have new project. Though it is a simple task that requires no more than half an hour to build and debug, it is boring, error prone and repetitive. The algorithm is quite trivial, read each line, split it in a vector of string using some separator (about always a comma, hence the "Comma Separated" name), use something to convert each field in a PoD (int, double, whatever) and fill a struct. Continue reading

The dbus-cpp Library, introduction

28 Nov 2015 22:33 +0000 c++ Code Linux
While working on a bluetooth based embedded device, I needed to deal with the somehow infamous dbus. [DBus](https://wiki.freedesktop.org/www/Software/dbus/) and [Bluez5](http://www.bluez.org/) have a very steep learning curve, and if you are don't have access to either [Qt framework](https://www.qt.io/) or [glib framework](https://developer.gnome.org/glib/), you have indeed a problem. Glib are very complex C libraries that mimick some of the built-in feature of the C++ language, while on the other hand, Qt are very vast and sometime a big overkill. Continue reading

Pairing Bluetooth with no pin on Intel Edison

10 Aug 2015 15:30 +0000 Code Embedded
It may seems strange for an IoT enabled device, but there's no obvious way to pair an Intel Edison through Bluetooth without accessing the shell. I spent different hours to do something that with Bluez4 took at most 4 minutes, including the research on Google. Here's what I did. Edison provides Bluez5 that reworks most of the tools using DBUS, so to make two quite frequent actions, like pairing a device without providing user intervention on the device, and registering a new bluetooth RFCOMM service, you need to interface with it, that isn't so obvious from C or C++. Continue reading

Fixing problems with Ubuntu 13.04 and VmWare Tools

21 Aug 2013 09:51 +0000 Linux vmware
Installing Ubuntu on my VmWare fusion box has never been so difficult as it was last weeks, when I needed to have it ready as soon as possible. Though 12.04 LTS has been proved to be a great choice when you need a solid rock linux box, latest Ubuntu boxes are preferable, on my opinion, for development purpose. This way, switching to the latest, bleeding edge kernel hasn’t gone well for the people at VmWare. Continue reading
Older posts Newer posts