Sunday, May 22, 2016

Haskell in production

Interested in haskell in production?  Take a look at this http://www.stephendiehl.com/posts/production.html

Saturday, May 14, 2016

LiquidCrystal Displays compatible with the Hitachi HD44780 driver and arduino pin mapping

These lcds are cheap and retro and work with most arduino boards even if you do not have i2c. They are using a bunch of digital pins for the communication.
The full details about the various pins can be found here.

There is an arduino shield that can be used for fast prototyping with a weird (at least for me) pin mapping. The pin mapping the shield is using is: lcd(8, 9, 4, 5, 6, 7).

However if you buy a naked lcd, you can wire it up any way you like. Unfortunately if you are using the shield to develop your app and have a different pin mapping in your naked lcd, that means that you need to modify the code between debugging and normal mode, or wire your lcd in the same way with the shield.

Most code examples out there are using the shield mapping as well.

Anyway. The lcd has 16 pins. Some of them can be wired only one way:

  • VSS (pin 1) -> Ground
  • VDD (pin 2) -> 5Volt
  • V0 (pin 3) -> 10K resistor/pot (this pin controls the contrast)
  • R/W (pin 5) -> Ground
  • A (pin15) -> 10K resistor/pot (this pin controls the backlight)
  • K (pin 16) -> Ground

and there are another 6 data pins that can be wired any way we like. The shield mapping is the following:

  • RS (pin 4) -> Digital pin 8
  • E (pin 6) -> Digital pin 9
  • D4 (pin11) -> Digital pin 4
  • D5 (pin12) -> Digital pin 5
  • D6 (pin13) -> Digital pin 6
  • D7 (pin14) -> Digital pin 7
The pins D0 up to D4 are not being used, since we are using the screen in 4bit mode.

This mapping should allow you to have the same mapping between your development environment and your final setup.

Friday, May 13, 2016

Cleaning hazy photos

Using gimp, multiple passes of the unsharpen mask filter with a radius of 50 and an amount of 0.2 will usually do the trick. After a certain point noise is introduced, so caution is needed.

The documentation for the filter can be found here https://docs.gimp.org/en/plug-in-unsharp-mask.html

Saturday, May 7, 2016

Verifying https key and certificate match

Sometimes it is difficult to verify if your https key matches your https certificate.

In these cases you can use the following commands:

openssl x509 -noout -modulus -in /etc/yourcertificate.crt | openssl md5 
openssl rsa -noout -modulus -in /etc/private.key | openssl md5

Also keep in mind that the CN name of the certificate sign request (CSR) needs to match the CN of the certificate.

If you have more than one domain entries in the certificate, the first one is the CN. Multiple https virtualhost definitions (including the default ssl.conf) may confuse apache.

Tuesday, April 26, 2016

Holy Island: A DCI Ryan Mystery by LJ Ross

This book was a best seller when it was released in 2015. It is  a detective novel, with pagan cult highlights. Not too deep, but a good and easy read nevertheless.

Thursday, April 21, 2016

Using bus pirate to communicate with chips

Check this post http://hackaday.com/2008/11/19/how-to-the-bus-pirate-universal-serial-interface/
The bus pirate can be connected to a Linux box using a terminal emulator or multiplexer (screen and tmux should work fine)
It can also be used as a logic analyser using an opensource java based tool
https://www.lxtreme.nl/ols/

Another article with usage instruction https://learn.sparkfun.com/tutorials/bus-pirate-v36a-hookup-guide