Saturday, 23 February 2013

Installing Nikola on Windows 7

The new version of Nikola was released and wanted to know if I could use it for www.civet-labs.com.

I started by trying to pip install nikola into a virtualenv, but it didn't work out of the box.
The reason it was not installing out of the box was due to the fact windows doesn't have a build chain installed, and pip doesn't use eggs or exes.
Here are the steps I took to install nikola on my windows 7 laptop into a virtualenv

I will assume that you have python 2.7 installed (like me) and that you have also installed virtualenv

1) Create and activate a new virtual environment

2) Download pillow from pypi: https://pypi.python.org/pypi/Pillow/1.7.8#downloads

3) Run easy_install on the downloaded egg
easy_install %HOME%\Downloads\Pillow-1.7.8-py2.7-win32.egg
4) Download the unofficial build of lxml from http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

5) Run easy_install on the downloaded exe
easy_install %HOME%\Downloads\lxml-3.1.0.win32-py2.7.exe 
6) pip install the nikola package
pip install nikola
Once I had installed it I tried the steps to set up a demo in the nikola handbook and found I had some issues as well.  They seem that they are going to be fixed but I will document them here for future reference.

1) I tried "nikola init mysite --demo" but got a "error not found" this is due to the fact that windows doesn't have executable scripts the same as *nix environments, and so the nikola script is not runnable by itself.  The easy way to fix this is just to copy the bat script from doit (installed as a requirement) to nikola.bat
copy venv\Scripts\doit.bat venv\Scripts\nikola.bat
2) Continuing on with the demo I found the nikola build command was failing because a temp file wasn't being deleted.  This should be being fixed in https://github.com/ralsina/nikola/issues/151.
Till then I just added
self.dodo.close()
to
venv/Lib/site-packages/nikola/plugins/command_build.py+67

Friday, 22 February 2013

Would your device lie to you?

The purpose of this post is the pose the question "Why would your device lie to you?" 

One of the assumptions of the "Internet of things"  is that the device is objective.  That the device will report the truth within the limits of its sensors. 

That is a useful assumption, but what if the devices weren't.  They were telling less than you the truth. 

I see that there are three reasons that your device may not be telling you the whole truth: Bugs, Marketing and Evil.

Bugs either in the software controlling the device or the software reporting the data cause the truth to be bent.  While this isn't lying in the traditional sense, more like a passer by miss reading their watch when you ask them for the time, the effect is the same.

It is important to consider this point as it could be used to cover up for the other two, and as a developer I know it is a very real possibility.

Marketing, or the white lie to push you in the device creators direction.  Imagine that you buy a sensor from a fertilizer company that should tell you when to feed your plant.  It is not hard to see how getting the device not to tell the exact truth would allow the fertilizer company to sell more fertilizer.  If the reason for the increased fertilizer was a lowered tolerance in the sensor, you can also see how one could blame "Bugs" for the marketing decisions.

Another example of this marketing lie may come from a fitness device that reports the calories used based on a gaming algorithm to increase your engagement with the device and system as a whole! 

These lies while falsehoods are like the lies that we tell each other every day to get them to do the things we want them to and pail in comparison to the next type of lie.

Evil.  Unlike the marketing lie which isn't really trying to harm you except to get you to spend more, these devices are actively trying to betray you.  The famous example of this in the wild is the Iranian nuclear centrifuges which were set to destroy themselves. 

You will unlikely meet these devices in the wild (unless you are also trying to do evil) but it is still not beyond the means of criminal networks to use your devices against you, or maybe just someone doing for the LOLZ.

So next time you look at data from your senors ask yourself "Is it lying to me?"