Month: June 2013

The necessity of nerding in smartphone brainscanning

Posted on

Screenshot from Necessitas QT Creator with the smartphone brainscanner running.
Screenshot from Necessitas QT Creator with the smartphone brainscanner running.

So I am trying to get the smartphone brainscanner al la Arek working with the help of Carsten Stahlhut and Arek. The Android QT development may take place in IDE. When you install that in /opt as root you may experience that the file permissions are all messed up. You may require something like “$ sudo find -perm /u=x -exec chmod a+x {} \;” and similar to execute the programs and directories and be able to read the files. Also if “/opt/NecessitasQtSDK/android-sdk/.android” is not readable for the developer then problems around the “debug.keystore” and developer signing of the application may arise.

Arek has nicely setup a github site with some applications. However, the git distributions do not contain all that you need. The sbs2-Brain3D program with the fancy 3D model is not there and an Emotiv decryptor module is also needed, which is (also) not publicly available.

Before you can get the programs running, the smartphone may need to be modified. There is hidraw device reading. The Nexus 7 I have now runs Arek’s 3.1.10-hopbeat-g009b6d1 kernel and has the SuperSU program installed. For unlocking and other steps I followed the description on Nexus 7 (android) on the GitHub smartphone website.

I have not been able to make the program running in the Android development emulator environment. QT is a showstopper as I have not been able to get Ministro working with something like “/opt/NecessitasQtSDK/android-sdk/platform-tools/adb install ~/Downloads/Ministro\ II.apk”. Other older version of Ministro neither worked.

Also I have problems with the program on an Android device, – a Nexus 7.

After building the sbs3-Brain3D program and deployment on the Android device I get a immediate crash with the sbs3-Brain3D program. Among the last thing I hear from the program is: “I/WindowState( 475): WIN DEATH: Window{424d4810 u0 org.kde.necessitas.example.sbs2_Brain3D/org.kde.necessitas.origo.QtActivity}”, “Failed looking up window” and “java.lang.IllegalArgumentException: Requested window android.os.BinderProxy@42aeb818 does not exist”. My googling did not bring me an understanding of what is the problem.

So I tried to enable building for desktop. If compiler is missing: Menu, Options, Kits, Device type: Desktop-QT 4.8.1 in PATH (SYSTEM) and selecting Compiler GCC (x86 64bit). Left panel, Projects, Add kit. Building yields “libudev.h: no such file or directory.” is available in libudev-dev: $ sudo aptitude install libudev-dev.

One step further I get “skipping incompatible sbs2emotivdecryptor-build-…” and subsequent “cannot find -lsbs2emotivdecryptor”. So the decryptor library is not built for desktop? With the sbs2emotivdescriptor in the Necessitas QT Creator I can with projects “Add kit”, but then during compilation run into “Cannot find Makefile. Check your build settings.” However, the Makefile is available in the build directory and an ordinary ‘make’ in the directory compiles and links the library. A right click in the projects and “Run qmake” will also “exited normally”. Erasing automatically insert library inclusion in the .pro file and right click project, “Add library” and adding sbs2emotivdecryptor. With building I get “glmReadOBJ() failed: can’t open data file
“/home/fnielsen/smartphonebrainscanner2_data/mesh_ctx_5124_normals.obj”. So where do this comes from? Are we missing a mesh of the text with 5124 vertices? “$ ln -s projects/smartphonebrainscanner2-core/sbs2_data/
smartphonebrainscanne2_data”? No! “$ locate mesh_ctx”? No! Then what about “$ find . -name “mesh_ctx_5124_normals.obj”. No!

In matlab I try filename = ’emotiv_SPMleadfields’; Semotiv = spm_eeg_load(filename); headmodel = 1; Xvert = Semotiv.inv{headmodel}.mesh.tess_mni.vert / 1000; faces = Semotiv.inv{headmodel}.mesh.tess_mni.face; and there a size(Xvert) reports 5124 x 3.

And a “$ egrep -r “mesh_ctx_5124_normals.obj” ~/projects/sbs2-Brain3D/*” shows the perpetrator to be “~/projects/sbs2-Brain3D/glwidget.cpp”. The loading happens in model.cpp in the “Model::load” method where “glmReadOBJ” is called, so this is the Wavefront .obj file which is in Wikipedia country.

With a new file in the Brede Toolbox called brede_write_obj.m and back in Matlab with S.vertices = Xvert; S.faces = faces; S.type = ‘sur’; S.filename = filename; it is possible to write “brede_write_obj(S, ‘filename’, ‘mesh_ctx_5124_normals.obj’)”

With “$ sudo aptitude install blender” and import obj file I get “IndexError: list index out of range”. I got “grep “v”
mesh_ctx_5124_normals.obj | wc” = 5124 vertices. A Python oneliner tells that my Matlab script is erroneously zero-indexed:
“max(map(lambda s: max(map(int, s.split()[1:])), filter(lambda s: s[0]==’f’, open(‘mesh_ctx_5124_normals.obj’).readlines())))” gives 5123. So with a corrected brede_write_obj.m I can see the surface in blender (it is hiding in the default center box).

But “$ ln -s vertface_brain_reduced.obj mesh_ctx_5124_normals.obj” will apparently also do a trick to make a bluish flickering rotating brain appear.

Back to the android device: “$ /opt/NecessitasQtSDK/android-sdk/platform-tools/adb push
mesh_ctx_5124_normals.obj /mnt/sdcard/smartphonebrainscanner2_data/” and we are running! Well, well, – without the emotiv device attached yet.

Nvidia kaput

Posted on Updated on

Bug #1002641 (“after upgrade to 12.04 amd64 Gnome Classic not properly draw second screen”) seems to be impossible for me to solve: A laptop with Nvidia cannot display on an external display or the laptop display on the same time in Gnome/Unity Ubuntu. You need to switch to KDE; or disable the Nvidia driver and run on the external screen only; or enable the Nvidia driver with TwinView by settings in nvidia-settings (I guess you need to find a screen that has the capability for the same resolution as the laptop screen).

The problem has persisted for over a year in the Ubuntu distribution and questions the applicability of Nvidia for Ubuntu.

See also nvidia-settings makes one of my dual monitors grey and useless, disables network.

Update 2012-06-18

I have now several times experienced that the X-interface becomes unresponsive (except for mouse movement), where a hard restart seems to be the only possible way out. There are multiple issues with this proprietary drivers.

You can’t fool Python

Posted on

There is this funny thing with Python that allows you to have static variables in functions by putting a mutable object as the default argument.

In Ruby default arguments are evaluated each time the function is called (I am told), so you can make recursive calls with two ruby functions calling each other with the default input arguments:

Ruby complains that the stack level becomes too deep.

In Python the default argument is evaluated once when the function is defined, so the result of calling one of the Python functions will be different than calling one of the Ruby functions.

Google scholar citations for Responsible Business in the Blogosphere project

Posted on Updated on

GS Year First author Title
35 2011 Finn Årup Nielsen A new ANEW: evaluation of a word list for sentiment analysis in microblogs
24 2011 Gerardo Patriotta Maintaining legitimacy: controversies, orders of worth and public justifications
19 2011 Annemette Leonhardt Kjærgaard Mediating identity: a study of media influence on organizational identity construction in a celebrity firm
16 2011 Lars Kai Hansen Good friends, bad news – affect and virality in Twitter
10 2012 Adam Arvidsson Value in informational capitalism and on the Internet
8 2010 Adam Arvidsson The ethical economy: new forms of value in the information society
7 2011 Adam Arvidsson Ethics and value in customer co-production
5 2012 Chitu Okoli The people’s encyclopedia under the gaze of the sages: a systematic review of scholarly research on Wikipedia
5 2013 Finn Årup Nielsen Wikipedia research and tools: review and comments
4 2011 Toke Jansen Hansen Non-parametric co-clustering of large scale sparse bipartite networks on the GPU
4 2011 Friederike Schultz Strategic framing in the BP crisis: a semantic network analysis of associative frames
1 2012 Michael Kai Petersen Cognitive semantic networks: emotional verbs throw a tantrum but don’t bite
1 2010 Michael Etter On relational capital in social media
1 2011 Mette Morsing State-owned enterprises: a corporatization of governments
0 2013 Elanor Colleoni CSR communication for organizational legitimacy in social media
0 2013 Anne Vestergaard Humanitarian appeal and the paradox of power
0 2011 Bjarne Ørum Wahlgreen Large scale topic modeling made practical
0 2012 Michael Kai Petersen On an emotional node: modeling sentiment in graphs of action verbs
0 ? Friederike Schultz The construction of corporate social responsibility in network society: a communication
0 2013 Adam Arvidsson The potential of consumer publics

I typed in many of the publications from our Responsible Business in the Blogosphere project into the Brede Wiki together with an identifier for Google Scholar for each publication. With a script (do not run code you obtained from a wiki!) I am able to collect the citation information from Google Scholar using the MediaWiki API, the categories and the templates. Here it is sorted according to number of citations.