Archivi categoria: English

Android AsyncTask, DeepBeliefSDK e SISSEGV

Lately I have been playing with the DeepBeliefSDK released by JetPac, a startup acquired by Google in 2014.

I have encountered a lot of problems when I have tried to bring the usage of the library from the main application thread (as it is used in the provided examples) to a background thread (called Worker in many different lnaguages and named AsyncTask in Android).

The library has a huge CPU usage, so I guess it HAS TO be used on a background thread, or the application will experience lag (on a Galaxy S5 it keeps 650ms to classify an image, on my device much more). During my tests with the AsyncTask, the application was costantly crashing, with a nice Segmentation Fault (SISSEGV error on the LogCat window) and no useful stacktrace (as expected from native C++ code).

When all seemed lost, I found this article. DeepBeliefSDK is using Open MP (from wikipedia:
OpenMP (Open Multi-Processing) is an API that supports multi-platform shared memory multiprocessing programming in C, C++, and Fortran, on most processor architectures and operating systems […] It consists of a set of compiler directives, library routines, and environment variables that influence run-time behavior.), but there’s currently a bug in the way GOMP (GCC’s implementation of the OpenMP specification) handles data when thread-local storage isn’t available.

So when a non-main thread (the AsyncTask) attempts to use the Thread Local Storage, it crashes. There is a workaround, you should recompile the DeepBeliefSDK with a patched GCC toolchain.

Here you can find the recompiled SDK ready for the use on AsyncTasks. Enjoy! 🙂

Tag people on Facebook App for Windows Phone

This is not a summary as the other posts of this forum. But I hope to help someone who encountered the same issue of mine.

This is the issue: I was accustomed to using Facebook App for Android. In Facebook App for Android, you write the first letters of a friend of yours and the autocomplete menu appears, allowing you to tag your friends in comments and posts.

In Windows Phone it does not. In order to have the same outcome, you need to write @ before the first letters of the friend you want to tag. In this way, the autocomplete menu will appear. Enjoy.

Windows Phone 8. User Guide

Real-Time Systems

Today I am not going to advertise any book from Amazon like I usually do, with a summary of some book and the affiliate link.

Today I am going to post the summary of my notes about the Real-Time Operating Systems Course I attended at the my university: despite the main reason I am writing summaries is to get some bucks with the Amazon affiliate program, I enjoy posting summary because while re-writing (they are usually originally written into paper) and re-reading them, I refresh my memory about the topic.
Continua a leggere

Composite and Strategy from Design Patterns: Elements of Reusable Object-Oriented Software – 2/15

Design Patterns: Elements of Reusable Object-Oriented Software

Design Patterns – Gang of Four

Design Patterns: Elements of Reusable Object-Oriented Software is the first and probably the most famous book about the Design pattern. It was first published in 1995, but thankfully those design patterns are still valid nowadays, the only outdated thing in this book may be the Smalltalk programming language, used in some examples. Anyway this book is still very good and popular: in fact I have decided to read this book when, in a job listing, it was expressly requested the knowledge of design patterns and of this book!

I will write a series of 15 articles about this book, making the summary of a couple chapters of this book in each one (the book is pretty big, it has over 500 pages). To deepen your knowledge of the argument, you can always buy the book @ Amazon.
Continua a leggere