Set up Android Studio on debian 7 wheezy 64-bit

Now that Android Studio is the official IDE for Android, you can set it up on your development box running debian 7 wheezy 64-bit as follows:

  1. Get Android studio from here
    cd /tmp
    wget https://dl.google.com/dl/android/studio/ide-zips/1.1.0/android-studio-ide-135.1740770-linux.zip
  2. Unzip it to /opt:
    cd /tmp
    unzip android-studio-ide-135.1740770-linux.zip
    sudo mv android-studio /opt
  3. Install OpenJDK 7 JDK:
    sudo apt-get install openjdk-7-jdk
  4. Set up the required environmental variable
    export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64
  5. Set up 32-bit libraries to avoid the error:
    Downloading android-sdk_r22.6.2-linux.tgz from https://dl.google.com/android/android-sdk_r22.6.2-linux.tgz
    Unpacking android-sdk_r22.6.2-linux.tgz
    tar xzvfC /tmp/AndroidStudio1254025343410050340FirstRun/android-sdk_r22.6.2-linux.tgz /tmp/AndroidStudio1254025343410050340FirstRun/android-sdk_r22.6.2-linux.tgz-unpacked
    Unable to run mksdcard SDK tool.
    

    as follows:

    sudo dpkg –add-architecture i386
    sudo apt-get update
    sudo apt-get install i32-libs
    
  6. Start Android studio:
    /opt/android-studio/bin/studio.sh
pixelstats trackingpixel
Posted in Uncategorized | Tagged , | Leave a comment

Interpreting “The program can’t start errors” on Windows

Sometimes when you start an executable named say xxx.exe on Windows Desktop a modal pop-up may appear:

cantstartwith the message: The program can’t start because xxx.exe is missing from your computer. Try reinstalling the program to fix this problem.

As often happens, this error message is incomplete, misleading and unhelpful. What is missing is not xxx.exe, which likely is a freestanding application with no installer.

If this error occurs during a debug session inside Microsoft Visual Studio, you may examine the Debug tab of the Output windows, just to find the laconic message:

The program '[10080] xxx.exe' has exited with code -1073741515 (0xc0000135) 'A dependent dll was not found'.

which is not correct, but still incomplete and unhelpful.

The way to know which DLL is missing is to use GFlags to set a particular Windows feature – no need to install the DependencyWalker utility (mentioned in many places on the interweb). gflags.exe is the Global Flags Editor, an utility that enables and disables advanced debugging, diagnostic, and troubleshooting features. Get it from here, look for  the “Standalone Debugging Tools for Windows (WinDbg)” section.

Once you got that installed, you may wonder where it did install – well, on my 64-bit Windows it ends up in C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\.

To set the option we need, do this in a Command Prompt:

"C:\Program Files (x86)\Windows Kits\8.1\Debuggers\x64\gflags.exe" /i xxx.exe +sls

Note 0: the option is sls, an acronym that stands for Show Loader Snaps – a flag that captures detailed information about the loading and unloading of executable images and their supporting library modules and displays the data in the kernel debugger console

Note 1: Replace xxx.exe with the name of your executable without the path.

Note 2: the UAC confirmation should come up; if not, launch the command from a Command Prompt window that you started by right-mouse-button clicking on the Command promp icon and selecting the “Run as Administrator” context menu command.

If you then launch again the xxx.exe debug session inside Microsoft Visual Studio, and examine the Debug tab of the Output windows after the pop up comes, you’ll find an extensive diagnostic that should allow you to identify the missing DLL:

Another option is to directly launch the executable by double-clicking on it. In this case you need to access the kernel debugger console, which is most easily done via the excellent sysinternals DebugView utility.

Anyway the diagnostic you get is complete and leads in the right direction, but unhelpful because difficult to interpret. Here are some tips to help yourself:

  1. read the Dynamic-Link Library Search Order for Desktop Applications documentation
  2. look for DLL names immediately before the lines with the messages “LdrpSearchPath – RETURN: Status: 0xc0000135″

Good luck !

Post Scriptum 1: In practice, the easiest thing to do once you find the missing DLLs, is copying them to the executable location. The second option is to change the working directory (in Visual Studio, do that in Project properties, Configuration Properties, Debugging, Working Directory (be careful to set that for the Configuration / Platform combination you’re actually trying to debug !)

Post Scriptum 2: I’d suggest disabling the sls option when you’re done.

 

pixelstats trackingpixel
Posted in Howtos, Rants | Leave a comment

wordpress POST xmlrpc.php WTF ?

WordPress is widespread because it is such a good blogging platform, CMS, DMS and you-name-it. Unfortunately it means that it becomes the target of many spam and DoS attacks.

The one that is steaming right now it the one that fills your logs with this:
93.174.93.204 wp.libpf.com - [04/Sep/2014:07:33:30 +0000] "POST /xmlrpc.php HTTP/1.0" 403 345 "-" "Mozilla/4.0 (compatible: MSIE 7.0; Windows NT 6.0)"
212.79.108.47 wp.libpf.com - [04/Sep/2014:07:34:02 +0000] "POST /xmlrpc.php HTTP/1.1" 403 345 "-" "-"
...

To block it, add this to your lighttpd.conf:
url.access-deny = ( "~", ".inc", "xmlrpc.php" )

and restart it:
service lighttpd restart

pixelstats trackingpixel
Posted in Uncategorized | Leave a comment

Automated bug finding with git bisect and boost::test

Here we use boost::test to write test programs for our C++ code, and git as a distributed version control system to track revisions.

One day a test that used to pass stopped working so I decided to try git-bisect to identify the commit  that broke the test. This took me along a journey of shell scripting and git magic that I’d like to share.

First I chdir’d to /tmp and cloned the repo:
cd /tmp
git clone ~/my_repo
cd my_repo

Then I created a shell script that builds the test and runs it, and placed it in the root of the git repository. This is the script, aptly called my_script:
#!/bin/sh
rm -rf bin
cd src
bjam release -j3
cd ../test
bjam release TestModel -j3
cd ..
bin/test/gcc-4.9/release/TestModel --build_info=yes --log_level=test_suite --report_level=detailed
OUT=$?
if [ $OUT -eq 0 ];then
exit 0
else
exit 1
fi

The shell script checks the exit code of the boost::test executable, and if that is different from zero (some tests failed) it returns 1, or 0 if all is OK. This is based on the magic shell variable $? that returns the exit code of the last run command – a trick I always forget and that seems so difficult to find with a search engine.

Now I make the script executable:
chmod u+x my_script

Then I test it here where I am (the HEAD):
./my_script
echo $?

This returns 1, so the test is failing. Now we can start the git-bisect journey:
git bisect reset
git bisect start
git bisect bad

Next we look for a previous commit where the test used to pass; let’s rewind by 20 commits and try there:
git checkout HEAD~20
./my_script
echo $?

Now this passes, so let’s get back to HEAD and find the corresponding commit:
git checkout master
git log --pretty=oneline | head -n 21

The HEAD~20 has a hash of f6aabbe80766a9745447214a89c513de29cbbe70 so let’s mark that as a good one:
git bisect good f6aabbe80766a9745447214a89c513de29cbbe70

and now we’re ready to start:
git bisect run ./my_script

after some time git-bisect returns with:
3c9b0231c2dbef5a7c6a490c877116e2c5bd89c2 is the first bad commit

Done !

pixelstats trackingpixel
Posted in Howtos | Leave a comment

Third LIBPF app preview

This time we have dynamic pages and you can switch between 4 pseudo-servers (switching server changes the app skin). But of course no server is running yet so it’s all fakes (there is a fruit salat configurator you can play around with).

Here is a group photo of the app on our test gizmos:

app on gizmosFor a hands-on session straight into your own device, try this link.

pixelstats trackingpixel
Posted in UI | Leave a comment

Using jshint on debian testing

tl;dr: If you wish to use jshint on debian testing (jessie), do this:

sudo apt-get update
sudo apt-get install nodejs nodejs-legacy
sudo npm install jshint -g
jshint

Long story: this is difficult to get right if you read random posts around. There are flamewars from 2012 about node-js package being obsolete in Debian (not true as of today) and WNPP for jshint is stuck because the package contains some code licensed with a variant of the MIT license considered un-kosher by debian (still true).

pixelstats trackingpixel
Posted in Howtos | Leave a comment

Second LIBPF app preview

Hey we’re still in the early prototyping phase – it’s all static pages – but you asked for it, so here it is on the XCode simulator (iPhone 3.5 retina):

Random screenshots:

03
00
02
01For a hands-on session straight into your own device, try this link.

pixelstats trackingpixel
Posted in UI | Leave a comment

First try at webapp integration testing with capybara on debian

Capybara looks like a promising tecnology for integration testing of web applications, so we decided to give it a try on debian jessie workstation.

There are some howtos around based on rails or other ruby-specific stuff, but what is required for a first try (see KISS phylosophy = Keep it Simple Stupid) is to run one test interactively with irb (the Interactive Ruby Shell).
There is a ruby-capybara debian package, but it only comes with rack_test driver. It looks tricky to configure with other drivers, as per Debian Bug report #705739; also its popcon data with 9 submitters suggest it may not trendy.

The RubyGems package manager seems to do the job better, so let’s remove the ruby-capybara package, install ruby-dev (for the header files to compile ruby extensions)  and launch gem for capybara and the selenium webdriver:

sudo apt-get remove ruby-capybara
sudo apt-get install ruby-dev
sudo gem install capybara
sudo gem install selenium-webdriver

Now start irb and try this:

require 'capybara/dsl'
Capybara.default_driver = :selenium
Capybara.app_host = 'http://bing.com'
Capybara.default_wait_time = 15
Capybara.visit '/'
Capybara.fill_in 'sb_form_q', :with => 'simevo'
Capybara.find('#sb_form_go').click

Mandatory screenshot:

capybara

pixelstats trackingpixel
Posted in Howtos, UI, Uncategorized | Leave a comment

LIBPF app preview

Work is underway to create a LIBPF mobile app. At the moment we have the storyboard:

P1100260and a very early prototype of the main page:

pixelstats trackingpixel
Posted in Uncategorized | Leave a comment

New LIBPF.com headquarters

Starting today LIBPF is temporarily based c/o Faktory Basement, a multi-purpose facility (club, music reharsal / recording and coworking) located in the now abandoned chemical site of Châtillon / Montefibre.

Nothing more adequate to the topic of process simulation than a post-industrial site !

Here are some snapshots:

Whole building viewEntranceThe roomThe coworkers

 

 

 

pixelstats trackingpixel
Posted in Uncategorized | Leave a comment