[in brief] compiling libgcrypt 1.6.3

While building this library, i ran into errors finding libgpg-error 1.11.

There is a small bug in libgcrypt’s configure script for finding this library. It tells you to set –with-libgpg-error-prefix, but it actually ultimately looks for the location of this library from the variable –with-gpg-error-prefix. You should set –with-gpg-error-prefix instead of –with-libgpg-error-prefix, if your libgpg-error is installed to a non-standard location.


Installing pycrypto on Windows 8

While trying to install pycrypto on Windows 8, because it was a requirement for “paramiko” which I needed for some SSH stuff, I kept running into failure after another. To summarise, you need to have Visual Studio 2008 installed (there is an express version available free, and there is also likely a microsoft SDK package that includes the Visual C++ 9.0 compiler). After sorting all of these out however, I still had one persistent type of problem:

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
 Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "c:\users\fanen\appdata\local\temp\pip_build_Fanen\pycrypto\setup.py", line 456, in <module>
 File "c:\Python27\lib\distutils\core.py", line 152, in setup
 File "c:\Python27\lib\distutils\dist.py", line 953, in run_commands
 File "c:\Python27\lib\distutils\dist.py", line 972, in run_command
 File "c:\Python27\lib\site-packages\setuptools\command\install.py", line 53, in run
 return _install.run(self)
 File "c:\Python27\lib\distutils\command\install.py", line 563, in run
 File "c:\Python27\lib\distutils\cmd.py", line 326, in run_command
 File "c:\Python27\lib\distutils\dist.py", line 972, in run_command
 File "c:\Python27\lib\distutils\command\build.py", line 127, in run
 File "c:\Python27\lib\distutils\cmd.py", line 326, in run_command
 File "c:\Python27\lib\distutils\dist.py", line 972, in run_command
 File "c:\users\fanen\appdata\local\temp\pip_build_Fanen\pycrypto\setup.py", line 253, in run
 File "c:\Python27\lib\distutils\command\build_ext.py", line 337, in run
 File "c:\users\fanen\appdata\local\temp\pip_build_Fanen\pycrypto\setup.py", line 150, in build_extensions
 File "c:\Python27\lib\distutils\command\build_ext.py", line 446, in build_extensions
 File "c:\Python27\lib\distutils\command\build_ext.py", line 496, in build_extension
 File "c:\Python27\lib\distutils\msvc9compiler.py", line 475, in compile
 File "c:\Python27\lib\distutils\msvc9compiler.py", line 385, in initialize
 vc_env = query_vcvarsall(VERSION, plat_spec)
 File "c:\Python27\lib\distutils\msvc9compiler.py", line 301, in query_vcvarsall
 raise ValueError(str(list(result.keys())))
 ValueError: [u'path']

It appears that the function “query_vcvarsall” fails if it doesn’t find a set of 4 environment variables (this is some dodgy coding to me :p):

  • path
  • include
  • lib
  • libpath

You may need to create these environment variables, and place in them the appropriate paths for your PC.

On my 64-bit windows 8 machine with 64-bit Python 2.7.6, I have the following:

LIB = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\LIB;%WindowsSdkDir%lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;C:\Python27\Lib;%LIB%
INCLUDE = C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE;%WindowsSdkDir%include;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Include;C:\Python27\include;%INCLUDE%
PATH = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools;C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\VCPackages;%WindowsSdkDir%bin;C:\Python27\Scripts;C:\Python27;%PATH%
LIBPATH = C:\WINDOWS\Microsoft.NET\Framework\v3.5;C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\LIB;C:\Python27\Lib;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib;%LIBPATH%

After that, I am able to use pip to install pycrypto.

Note that my variables may contain paths which are redundant, but I arrived there after a windy path of experimentation. After It worked, I said to myself: “if it ain’t broke, don’t fix it.”

The following site was very helpful in showing me alternative ways. I like what the guy did to the python utility scripts. Just hack them to do what I want. None of the cruft of general-purpose code. Just tell the bloody system I have Visual Studio 9.0 😉 http://blog.victorjabur.com/2011/06/05/compiling-python-2-7-modules-on-windows-32-and-64-using-msvc-2008-express/



Windows 8 SSD 100% disk usage

Upgraded my Windows 8.1 PC by installing a 240GB Crucial SSD, and the performance became worse than with a spinning disk.

In my instance, I was able to improve the experience simply by installing Intel Rapid Storage tools drivers (downloaded from MSI’s site for my specific motherboard). I accepted all defaults. I was using an MSI motherboard. This just might be your solution.

Openssl Hint for today

You find yourself trying to look at a certificate with Openssl (I’m using the cygwin version of openssl on windows 7):

$ openssl.exe x509 -in certificate.crt -text
unable to load certificate
2675716:error:0906D06C:PEM routines:PEM_read_bio:no start line:pem_lib.c:703:Expecting: TRUSTED CERTIFICATE

Openssl error messages are so cryptic, I tried looking at the code to deduce what it meant, and even that didn’t go so well.

The error message shown above doesn’t really have much to do with “trust”. It most likely means that your certificate is not in PEM format. The most common other format that certificates can be in is DER. If you wanted to view the certificate in DER format anyway, you would do this:

$ openssl.exe x509 -inform DER -in certificate.crt -text

the -inform argument allows you to specify what format the certificate you are trying to examine is in. The -text argument says “display it on screen”, and the -in argument specifies the certificate file name.

If you wanted to convert that certificate from DER to PEM, you would say:

$ openssl.exe x509 -inform DER -outform PEM -out ./PEMcert.crt -in DERcert.crt

-outform PEM says the output format should be PEM, and the -out argument specifies the filename to give the converted certificate.



Jquery .load() makes the target blank

If you run into the problem where calling .load(url) on an element makes it turn blank, you very likely have an unexpected space (” “) in your url.

You should re-examine it, it may be a trailing or leading space, which will make it difficult to see with the naked eye. Try calling the javscript .trim() on the url string.

At the time of this writing, I was using version 1.10.2.

HTTPD Alarm Clock

When your apache web server dies when starting with a message that goes something like “alarm clock” or SIGALARM, your solution is to get rid of the file:


Strace helped to track this one down:

[admin@theSuperStar] httpd # strace /usr/sbin/httpd
open("/var/run/httpd.pipe", O_WRONLY|O_CREAT|O_APPEND|O_LARGEFILE, 0666) = ? ERESTARTSYS (To be restarted)
--- SIGALRM (Alarm clock) @ 0 (0) ---
+++ killed by SIGALRM +++

[admin@theSuperStar] httpd # mv /var/run/httpd.pipe /var/run/httpd.pipe.off
[admin@theSuperStar] httpd #/etc/init.d/httpd start 
Starting httpd: [  OK  ]

Serviio and high quality LPCM audio output

So a quick post here. If you want your Serviio instance to push 16-bit, 2 channel LPCM audio to your DLNA client or renderer, you need to configure your audio profile like this:

<Audio targetContainer="lpcm" aSamplerate="48000" aBitrate="1620">

Basically, aBitrate=”1620″ for LPCM means 16 bit 2 channel. The default (as of this writing) appears to be 192, which makes no sense, and gives you horrible 1-bit 2 channel LPCM.

If you need help with editing the audio profile, read this slightly technical article: http://www.serviio.org/index.php?option=com_content&view=article&id=16 

Now go have fun 🙂

I Can Rule!

This irule should allow you to redirect from http to https, as well as append a www. to the hostname if this is not already there….

If you know what an irule is, and you found this page, chances are good that this is what you’re looking for. Have fun, and pay it forward.

Remember, this is the personal blog of some dude on the internet. Use your common sense.

set hname [substr [HTTP::host] 0 4]
#log local0. $hname
if { [string tolower $hname] equals “www.”} {
HTTP::respond 301 Location “https://[getfield [HTTP::host] “:” 1][HTTP::uri]”
} else {
HTTP::respond 301 Location “https://www.[getfield [HTTP::host] “:” 1][HTTP::uri]”

Some Facts about the Kobo Vox e-reader/Android Tablet [Updated]

There are a few things you should know before you buy this device.

  1. It does not support the Google Android Market place. The marketing materials are deceptive in this regard, as I bought this device under the impression that I would have access to the Android Marketplace. It ships with a bookmark to http://kobo.getjar.com, which is, to put it mildly, a little bit less than helpful. A consequence of this fact is that you cannot easily install your favourite apps..
  2. You don’t even get the official Gmail app, and you cannot add your Google Account to the device for syncing. You again get a silly bookmark to the mobile web version of Gmail. The device does ship with an Email application, which seems to be the stock generic email app for android, and that should theoretically support Gmail, but I have not tested it.
  3. The device is chargeable via Micro-USB, but it refuses to work with the USB charger for my Samsung Galaxy S. Forcing me to keep two USB chargers on my desk. I don’t know who is violating the USB Standard here, Samsung or Kobo.
  4. The device is slightly heavier than one would expect in the hand.
  5. The loudspeaker is not nearly competitive with a decent smartphone. Get yourself a pair of headphones if you plan on using it for multimedia. A small amplifier may even be necessary, as the loudness leaves a lot to be desired, especially if you have to use it while commuting.
  6. Coming from a nice smartphone, the screen of the Kobo Vox is noticeably less crisp, but does not really constitute an inconvenience.
  7. Yes, you can play Angry Birds (it is available from the Getjar Store).
  8. The web browsing experience is considerably improved after you install the Dolphin web browser and make it the default.
  9. I like the rewards scheme, where you get “virtual” rewards for achievements and other reading related activities.
  10. Reading PDFs with the psychologically addictive (due to the rewards scheme, and the ease with which you can intimidate your friends on facebook) Kobo reader app is rather hit and miss. I side-loaded (grabbed off the Web) Aldiko, which handles PDFs just fine, and is even capable of downloading from Oreilly and other DRM-free ebook stores directly.
  11. You can play videos, but you will get a better experience if you install a file manager and browse your videos using it, rather than the default Gallery app. You can get a file manager from the GetJar Store.

You can find more information about the Kobo Vox here: http://www.kobobooks.com/kobovox .