Mar 212017
 

Apple to Ubuntu

For almost the last 20 years, an Apple laptop of one variety or another has been my main computing device. Imagine my surprise when I finally learned today that Apple keyboards don’t have an Insert key. In almost two decades I have never needed it, but that changed this morning.

While working in my favorite Python editor, Wing IDE by Wingware, some sloppy touch typing resulted in the cursor changing from the blinking vertical line I am used to a blinking underline. That change was subtle enough that I missed it, but as soon as I began typing and the text I was entering started overwriting the existing code, I knew something was up. WTF!

Continue reading »

Mar 042017
 

Django logo

If you’ve created any forms at all using the Django web framework then you should already be familiar with Django’s CSRF middleware and the protection it provides web site’s against cross site forgery request attacks. When the middleware is active, and unless the view has this protection overridden, any form POSTed will be expected to contain a hidden field named csrfmiddlewaretoken the value of which is expected to match a similarly named field in a CSRF cookie attached to the user. Because this value is specific to a user and constantly changing as well, testing the output of webpages with forms against what is expected is difficult. What follows is the solution I am using in Django 1.10.

Continue reading »

Feb 152017
 

SWI-Prolog Logo

I know that this post will probably be of interest to about a dozen people worldwide, and even those few may be disappointed by it. Since the official SWI-Prolog packages aren’t often kept up to date and because compiling and installing SWI-Prolog from source should be both quick and straightforward, that is the recommended way to do it on Linux and other *nix systems.

If you are looking for tips, tricks or assistance with an installation problem, you likely won’t find it here. The instructions provided on the SWI-Prolog site for building and installing SWI-Prolog from source code “just worked” for me. Nevertheless, I want to document what I did, and if you are looking for the Cliff Notes version, then by all means, read on.

Continue reading »

Feb 092017
 

Inkscape Logo

GIMP has done such a good job filling the Photoshop-shaped hole in my software arsenal left during my transition from OS X to Ubuntu, that until today I forgot that I sometimes work with vector-based images, and for that I had been using Adobe Illustrator.  The best free, as in both beer and speech, Illustrator alternative is Inkscape, a professional vector graphics editor available for Windows, OS X, and Linux.

The problem: 
I want to import an Adobe color palette (.aco file) into Inkscape.

The solution: 
This is not as straightforward as I expected. Without using a third party plugin, the solution is a multi-step process. Read on to learn how I did it.

Continue reading »

Jan 292017
 

Binary NumbersAbraham Lincoln once famously said, “Everybody loves a compliment.”  I suspect that if he had been a mathematician he would have loved complements, too. We’ve already seen what complements are and talked about the two most prolific: the radix complement and the diminished radix complement. Now it’s time to explore how we can leverage complements to do some really interesting integer arithmetic. Using complements we can subtract one positive integer from another or add a negative integer to a positive one by simply performing addition with two positive integers. The algorithm behind this black magic is called the Method of Complements.

Continue reading »

Jan 252017
 

Monsterz Marble

By the time December of last year rolled around, my family had been participating in the World’s Biggest Marble Hunt for several months.  During that time we had found many breathtaking marbles created by some of the most talented artists in the world including Geoffrey Beetem, Topher Reynolds, and Tucker Heebner. One artist whose iconic marbles we were never able to find due to proximity and timing was Chad Parker.

Continue reading »

Jan 212017
 

Python Logo

I am excited this evening. Why? Because I am finally getting back to some real Python development. While I have recently coded up some GIMP plug-ins, I haven’t really taken the time to properly set up my Python environment since making the switch from OS X to Ubuntu in December.  Now I’ve got some Django programming to do, but before I can start installing any third party packages, I’ll need to install pip, the de facto package management system for installing and managing Python packages. Think of pip being to Python as apt is to Ubuntu. The main repository for Python software is PyPi, the Python Package Index.

Continue reading »

Jan 102017
 

Binary NumbersIn my last post about binary signed integers, I introduced the ones complement representation. At the time, I said that the ones complement was found by taking the bitwise complement of the number. My explanation about how to do this was simple: invert each bit, flipping 1 to 0 and vice versa. While it’s true that this is all you need to know in order to determine the ones complement of a binary number, if you want to understand how computers do arithmetic with signed integers and why they represent them the way they do, then you need to understand what complements are and how the method of complements allows computers to subtract one integer from another, or add a positive and negative integer, by doing addition with only positive integers.

Continue reading »