ByteSplorer- A fun way to explore Binary numbers…

One thing the Android world is not short of is binary calculators but I required one with very specific functionality and behaviour. Hence ByteSplorer, available from Google Play or a direct download here.

ByteSplorer shows how the byte may be interpreted as an unsigned or signed number and its hexadecimal representation.

There are a limited number of functions as well that allow shifting (to demonstrate its effect on the value) and invert all and add 1 keys to allow experimentation with converting numbers to their to complement negative version.

ByteSplorer is at GooglePlay

device-480_320

qrcode_bytesplorer_googleGoogle Play

Posted in android, coding, computing, education, JAVA | Tagged , , | Leave a comment

Quick Way to serve files to devices such as tablets

Fighting with a few mobile devices that I want to easily share content with…. I suspect I am not alone. Manufacturers provide handy transfer software for Windows and Mac users, not so much for Linux.
A quick way to serve up files via a web server is using the built in python one.

Just go to the folder you want to server up and python -m SimpleHTTPServer 8888 & (or whatever port number you want to use)

Posted in android, computing, linux, LinuxMint | Leave a comment

wxGlade wxPython and custom components

A reminder to me of how to use custom components in a wxGlade Project.
I had a Panel which contained controls for a Matplotlib Project. The panel contained the plotting surface and some combo boxes to set parameters. I wanted to use this on multiple packages of a notebook to present different data views. This was a good canditiate for being re-used and subclassed. But how to to do that using wxGlade…..

This assumes a component based upon a Panel called a nineGraafTabPage_M
Where the component is first used
Properties->Common->Class nineGraafTabPage_M
Properties->Common->BaseClasse(s) tick and set to wx.Panel (not NOT wxPanel)

How to reuse the Component

Now if we wish to reuse that panel somewhere else, for example on a notebook page. Then on the page you wish to use it. First of all inset a normal panel. Then
Properties->Common->Class NewNameWhatever
Properties->Common->BaseClasse(s) tick and set to nineGraafTabPage_M
Then also add on
Properties->Common->Code tick Extra code for this widget
and in the extra code section
from nineGraafTabPage_M import nineGraafTabPage_M
(important follow this with a carriage return)
Then click on the add properties button and set a property of id with a value of -1

General

In the application property page also tick
Code Generation Separate file for each class

Posted in coding, computing, python, wxGlade | Tagged , | Leave a comment

Matplotlib, BaseMap, Pyinstaller

(brief random notes, that may help someone else)
A brief tale of getting a matplotlib and basemap to work with pyinstaller. There are two strands to this the Linux and Windows.

This is mostly the linux story.

Step by step, to how I got working.

I was trying to build a single directory solution and a single file solution.
Final conclusion was best to make the application single file and dont include the BaseMap data. then supply the basemap data separately.

This makes it easier to share the basemap data with other applications.

Dependent upon whether you are working on a machine that has matplotlib/basemap installed or not did change how things behaved.

In what follows dev_machine is my dev machine with all packages installed, the target machine is the users machine and has none of the dev tools installed.
Things needed…
On target machine it needed a matplotlibrc,
As a fiddle (thanks to this post http://ubuntuforums.org/archive/index.php/t-1506538.html) I copied my dev machine /etc/matplotlibrc to the directory in which the exectuable was stored on the target machine

the next problem was

IOError: proj data directory not found. Expecting it at: /usr/share/basemap/data

This required a tweak to /usr/share/pyshared/mpl_toolkits/basemap/pyproj
in new install ended up in /usr/local/lib/python2.7/dist-packages/mpl_toolkits/basemap

as per this post http://code.google.com/p/pyproj/issues/detail?id=40&q=PROJ_DIR

Which boils down to around line 239, replace this line


pyproj_datadir = '/usr/share/basemap/data'

with

if 'PROJ_DIR' in os.environ:
   pyproj_datadir = os.environ['PROJ_DIR']
else:
    pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data'])

The setting an enviroment variable to wherever you have the basemap data
in my setup this was in a folder where the executable was
export BASEMAPDATA=./basemap/data

Next rebuild the pyinstaller files and try again….
export PROJ_DIR=./basemap/data

just didnt work!
copied /etc/matplotlibrc from dev machine into the same folder as the executable and
it worked!….As long as I supplied the basemap data in a folder called basemap/data

Posted in computing, matplotlib, python, Uncategorized | 1 Comment

Pyinstaller, Matplotlib and BaseMap

Having big problems persuading a python,matplotlib and Basemap project to freeze using Pyinstaller.

On doze and Linux,

Basemap kept looking in the site distribution for the data files.

Workround I found was the addition of this environment variable PROJ_DIR via a tweak to proj.py
as per this post http://code.google.com/p/pyproj/issues/detail?id=40&q=PROJ_DIR

Which boils down to around line 239, replace this line


pyproj_datadir = '/usr/share/basemap/data'

with

if 'PROJ_DIR' in os.environ:
   pyproj_datadir = os.environ['PROJ_DIR']
else:
    pyproj_datadir = os.sep.join([os.path.dirname(__file__), 'data'])

I still needed to copy the mpl_tools folder across top where the pyinstaller produced single file executable was stored.

Then set these env variables as always ymmv

(looking round in basemaps proj.py and pyproj.py for where folders get set can be fruitful )as well)

I will document this more fully sometime,along with all the useful links I found on the way meantime this may help you get working

set BASEMAPDATA=p:\dist\mpl_toolkits\basemap\data

set PROJ_DIR=P:\dist\mpl_toolkits\basemap\data

Posted in coding, linux, matplotlib, pandas | Tagged , , | Leave a comment

XBMC Raspberry Pi

Following a less than successful experience of using an Android based TV box, the Pi got re-deployed to act as an XBMC device.

Rough notes, proper post later, various flavours of player for the Pi. I chose to use

http://www.raspbmc.com/download/

For BBC iPlayer you need to install a Plugin .. See How to add iPlayer

http://www.stus.net/blog/2012/08/16/add-bbc-iplayer-to-raspbmc-or-any-xbmc-illustrated-instructions/

Sorting DHCP

http://choorucode.wordpress.com/2012/08/14/how-to-assign-a-static-ip-address-to-raspbmc/

Extra notes for using it on old eeePCs

http://forum.xbmc.org/showthread.php?tid=141369

Fixing WiFi

http://forum.xbmc.org/showthread.php?tid=81858

Some stuff on forcing the WiFi to Play nice

http://forum.stmlabs.com/showthread.php?tid=3830

Random handy commands that fixed things

amixer set ‘Front’ on

Posted in linux, Raspberry Pi | Leave a comment