Apple is a shit hole company

• August 22, 2017 • Comments Off on Apple is a shit hole company

I went to upgrade to El Capitan on my MacBook Pro (17-inch, Mid 2009). I added max ram and a solid state drive. I have no problems virtualizing Windows and Linux on this fucker, but Apple decided my 17″ MBP is no longer viable and will not let me upgrade. Yes, I know I can without them, but fuck that! This is outright bullshit! So I went to run XCode, which I hadn’t ran since the last update – I develop more in Windows or Linux in Python or Rust than OS X in XCode – and they broke it. So I go to the AppBore to upgrade and it just spins, so I am not allowed to update XCode either? I am now forced to hack Sierra onto the machine, install Linux and virtualize OS X, or buy a new laptop with a smaller fucking screen. FUCK YOU! I am buying a System76 powerhouse, and maybe a with the money I save, and virtualizing their crap. Either way, I wrote my two cents on the AppStore and of course they will not allow it to go through so here it is:

“I cannot update XCode, because Apple decided that the over priced hardware I purchased, that was 6 months behind other companies when it was new, is not viable for an OS upgrade from El Capitan to Sierra. I run Windows and Linux virtualized on this laptop as well as play games with no issue. Not only that but they broke the XCode I currently have installed, which worked fine until the last update. The reality, the company changes your system preferences without permission, the majority of AppStore apps are horrid, they kill apps in the store often or steal the ideas effectively killing the original app, and ask for way more for older hardware than required to blackmail you into buying new hardware just to run a single OS version above what you’re running already. They are not a small company that needs to command a higher cost to maintain their business or need to fill landfills with viable hardware to keep money rolling in. The iPhone is great but as a company they are worse than Microsoft in the nineties. I’m going to System76 and LinuxMint and I will virtualize OS X from now on. Not worth my time or money anymore…”

Now don’t give me that, “they are protecting you”, “they want to be secure”, “they need to advance” bullshit. If the motherfuckers are using open Unix shit to build off of, don’t fuck it up, don’t mess with my settings, allow good programs into the AppStore, allow Linux and/or open devs a good environment to build in, and stop trying to be an everything greedy business. If Windows was better I’d go back to that as Microsoft has at least wised up a little bit.

Really nice set of free javascript canvas gauges.

• February 5, 2017 • Comments Off on Really nice set of free javascript canvas gauges.

Krita is becoming a Painter and Photoshop killer.

• January 9, 2017 • Comments Off on Krita is becoming a Painter and Photoshop killer.

It has been a long time since I checked out Krita. I Painted this in Krita 3.1.1 on Mac Yosemite. Versions for Windows as well, both are free. It took about six hours and the program was not shut down for two days. I had one lock up during export of the final PNG save, no problems with the tools or app other than that. Be sure to save often, just in case. I used the following brushes, available here:

David Revoy
Concept Art & Illustration Pack
Cazu Brush Collection

Just plying around I created this in no time:


Further playing ended with this:


Of course this gave me an excuse to continue painting:


and finally, the end result:


Linux like Package Management for Windows and Mac

• January 8, 2017 • Comments Off on Linux like Package Management for Windows and Mac

Package managers for installing open software. These gives you Linux like package management similar to Linux apt, zypper, yum, etc…



Brew GUI

Convert PostScript to PDF from D lang calling GhostScript ps2pdf.

• September 9, 2016 • Comments Off on Convert PostScript to PDF from D lang calling GhostScript ps2pdf.

I’m learning D. This provides working examples of getopts, concurrency, and a process call.

import std.getopt;
import std.stdio; 
import std.file;
import std.path;
import std.datetime;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.process;
import std.concurrency;

string[] listdir(string path)
    return dirEntries(path, "*.ps", SpanMode.shallow)
        .filter!(f => f.isFile)
        .map!(f => buildPath(path,

void rip(string path, bool v=false) 
	//ps2pdf filename.pdf
	string outpath = path.replace(".ps", ".pdf");
	if (v == true) {
		writefln("OUT: %s", outpath);
	auto logFile = File("errors.log", "w");
	auto pid = spawnProcess(["/usr/bin/ps2pdf", path, outpath],

void main(string[] arguments)

	// Get opts
	auto base_path = "/home/username/Documents/postscript";
    bool render = false;
    bool count = false;
    bool verbose = false;
		"p|path", &base_path,
		"r|render", &render,
		"c|count", &count,
		"v|verbose", &verbose
	// $./psmerge -p /home/username/Documents/postscript -r -c -v
	StopWatch sw;
	int totalDocs = 0;
	int totalPages = 0;
	if (base_path.exists) {
		string[] psfiles = listdir(base_path);
		foreach(ps; psfiles){
			if (render == true) {

				auto tid = spawn(&rip, ps, verbose);
				if (verbose == true){
					writeln(tid, " \nIN: ", ps);
			// Count pages.
			if (count == true) {
				// Read file.
				File fileHandle = File(ps, "r");
				while (!fileHandle.eof()) 
					string line = fileHandle.readln();
					if ( canFind(line, "(atend)") ) {
					if ( canFind(line, "%%Pages: ") ) {
						string[] s = line.split(":");
						auto pgNum = strip(s[1].replace("\r\n",""));
						if (verbose == true){
							writeln("Pages: ", pgNum);
						auto pgCount = to!long(pgNum);
						totalPages += pgCount;
		writefln("Total Docs: %s", totalDocs);
		writefln("Total Pages: %s", totalPages);
		writefln("Elapsed: %f seconds", sw.peek().usecs / 1_000_000.0);

Gambas 3 TreeView and TabStrip Example Code

• September 3, 2016 • Comments Off on Gambas 3 TreeView and TabStrip Example Code

I sometimes play around with Xojo and PureBasic for quick and simple GUI apps since the interface designers are convenient and the language makes for easy coding. I was checking out Gambas 3 and found it to be fairly good but lacking in a lot of examples. I was messing around with TreeView and TabStrip working together. It took a bit and I am sure there are better ways to approach this, but if you need examples of either of these controls this is working code.

I have a form with an HSplit. If the left side I have a TreeView and the right I have a TabStrip. I left names default and made the object expand to the window. I still haven’t figured out how to resize either side of the HStrip. This just loads some books off the file system to populate the treeview and creates a tab when clicked. I also added tab delete buttons. I have a module for the base path, but you can set it in form open. Screen shot here.

At this point I am thinking I will need to subclass and make my own form objects as this was a pain in the ass. Maybe this will help someone.

Public Sub TabStrip1_Close(idx As Integer)
  Try TabStrip1[idx].Text = Null
    TabStrip1[idx].Text = Null
    TabStrip1.Closable = False

Public Sub TabStrip1_Click()
  Dim k As String
  If Len(TabStrip1[TabStrip1.Index].Text) > 0 Then

Public Sub TreeView1_Click()

  Dim counter As Integer

  If TreeView1.Item.Key Begins "root_" Or TreeView1.Item.Key Begins "parent_" Then
    'Do nothing For parent items or capture parent events.
  If TreeView1.Item.Children = 0 Then
    If TabStrip1.Index = 0 And Len(TabStrip1[TabStrip1.Index].Text) = 0 Then
      If Len(TreeView1.Item.Text) > 0 Then
        If Len(TreeView1.Item.Text) > 0 Then
          TabStrip1[TabStrip1.Index].Text = TreeView1.Item.Text
          TabStrip1.Closable = True
          TabStrip1.Count = 1
    For counter = 0 To TabStrip1.Count - 1
      If TreeView1.Item.Text = TabStrip1[counter].Text Then
        'Focus tree item on corresponding tab select.
        TabStrip1.Index = counter

    If TreeView1.Item.Text = TabStrip1[TabStrip1.Index].Text Then
      'Add new tab if not in tabs.
      TabStrip1.Count += 1
      TabStrip1[TabStrip1.Index].Text = TreeView1.Item.Text

Public Sub Form_Open()

  Dim File As String
  Dim path_parts As String[]
  Dim file_parts As String[]
  Dim cat As String
  Dim cat_key As String
  Dim title As String
  Dim treeIndex As Integer
  'Dim img_book As New Picture(16, 16, False)
  'Dim img_cat As New Picture(16, 16, False)
  'Dim img_root As New Picture(16, 16, False)
  'Globals.basePath = "~/ebooks"
  If Not Exist(globals.basePath) Then
    Mkdir globals.basePath
    'TreeView1.Add("root_EBooks", "EBooks", img_root) 'With icon.
    TreeView1.Add("root_EBooks", "EBooks")
    For Each File In RDir(globals.basePath, "*.epub").Sort()
      path_parts = Split(File, "/")
      cat = path_parts[0]
      cat_key = "parent_" & cat
      file_parts = Split(path_parts[1], ".")
      title = file_parts[0]
      If Not TreeView1.Exist(cat_key) Then
        TreeView1.Add(cat_key, cat,, "root_EBooks")
      treeIndex += 1
      TreeView1.Add(title, title,, cat_key)


Install Virtuoso 6.1.6 for use with Python 3 on LinuxMint 18

• August 27, 2016 • Comments Off on Install Virtuoso 6.1.6 for use with Python 3 on LinuxMint 18

Install the following from the Software Manager (use apt if you prefer):


Download zip and Install PyODBC from

Unzip, cd into the expended folder, then type:

$ sudo python build install

Add the following in the odbc.ini:

$ sudo nano /etc/odbc.ini

Add the following and save it.

[Local Virtuoso]
Driver = /usr/lib/odbc/
Address = localhost:1111

Start the database:

$ cd /etc/virtuoso-opensource-6.1
$ sudo virtuoso-t -fd

If you have problems delete virtuoso.lck:

$ sudo rm -r /var/lib/virtuoso-opensource-6.1/db/virtuoso.lck

Open the browser and point to: http://localhost:8890/conductor/

If this works, you’re good.

Assuming you haven’t changed them:
User = dba
Pass = dba

If you have trouble with the password, kill the db process, delete the db, and restart:

$ sudo rm -r /var/lib/virtuoso-opensource-6.1

The db ini is in: /etc/lib/virtuoso-opensource-6.1/virtuoso.ini

Console management:

$ isql-vt

Example Python3 code:

import decimal
import pyodbc

c = pyodbc.connect('DSN=Local Virtuoso;UID=dba;PWD=dba')

cursor = c.cursor()
print ([i for i in cursor.tables()])

Windows Authentication from CherryPy served from Apache 2.4/WSGI using Python 3.4 64bit.

• December 12, 2015 • Comments Off on Windows Authentication from CherryPy served from Apache 2.4/WSGI using Python 3.4 64bit.

Here’s an example with working code and all the modules to get CherryPy running in Apache via WSGI with Windows authentication. Just download and copy Apache24 and coolwhip to the C: drive, add your IP\domain to httpd.conf, and fire up the server. See the read me for more details, installing Apache yourself, and Python libraries needing to be installed.

This example will also show how to mount a static folder in CherryPy for your images, javascript, etc. and the basic use of a Jinja2 template. This is the beginning of a bigger project so it’s very basic with the intentions of growing into a MVC Ajax powered site. It’s going to be fun! Tested on latest Windows server (AD environment) and my local home machine (localdomain) running Windows 10.

If you have trouble with localhost access on Windows 10 try changing the port from 80 to 8000, 8080. Make sure you start Apache as an admin.

Download (15.8mb) SHA: a193f0ecd6f2f88c908dab622304ce4163e17a21

Creating a DataMatrix GS1 barcode and saving to postscript, PDF, or image for free in C#.

• December 5, 2015 • Comments Off on Creating a DataMatrix GS1 barcode and saving to postscript, PDF, or image for free in C#.

I’ve been working on an interesting project where I had to learn Pitney Bowes Streamweaver in order to sort/merge and barcode postscript with very little knowledge of postscript and no training or knowledge of Streamweaver. I rolled my own in C# in order to understand how the product worked for parsing but didn’t know much about creating the data matrix barcode and placing it into the postscript, which left me relying on Streamweaver no matter what. My employer is continuing to use Streamweaver until we rewrite this functionality into Adobe ES (hopefully), but if you have small amounts of postscripts to barcode for printing or whatever maybe this will be helpful. Adobe has a free book to get you up to speed on the Postscript language and this post was helpful as well.

I wrote a small console app that will produce a barcode written out in Postscript, JPG, PDF, Hex and ASCII85 encoded. This program has few features and less options as I was just playing with different approaches, these turned out to be the best, but if you need more just ask and I can help as much as possible.


Download DataMatrix Barcode Generator

Before I go further I’d like to acknowledge and link the folks who did the real work!

Ascii85 encoding code

Here’s a sample of the code.

using System.Drawing;
using System.Drawing.Imaging;

using Ghostscript.NET.Processor;

// Examples
namespace datamatrix
    class Program

        public static void convertPDFToPs(string inputFile, string outputFile)
            List<string> cmds = new List<string>();
            string postscriptOut = string.Format("-sOutputFile={0}", outputFile);

            using (GhostscriptProcessor processor = new GhostscriptProcessor())

                processor.StartProcessing(cmds.ToArray(), null);
	 public static string generateBarcode(string outputImageFile)
	    string imageHexString = "";  // OUTPUT: Hexdecimal string.

            DmtxImageEncoder encoder = new DmtxImageEncoder();
            DmtxImageEncoderOptions options = new DmtxImageEncoderOptions();
            Bitmap encodedBitmap = new Bitmap(38, 38, PixelFormat.Format8bppIndexed);

            options.ModuleSize = 2; 
            options.MarginSize = 1;
            options.BackColor = Color.Transparent;
            options.ForeColor = Color.Black;
            options.Scheme = DmtxScheme.DmtxSchemeAsciiGS1;
            encodedBitmap = encoder.EncodeImage(gs1Code, options);
            encodedBitmap.SetResolution(96.0F, 96.0F);

            using (var stream = new MemoryStream())
                encodedBitmap.Save(stream, ImageFormat.Jpeg);
                stream.Seek(0, SeekOrigin.Begin);
                buffer = stream.ToArray();

                // Get hexdecimal
                imageHexString = BitConverter.ToString(buffer).Replace("-", "");

                // Save the image to disk, save the barcode as Jpg,Png, whatever image.
                encodedBitmap.Save(outputImageFile, ImageFormat.Jpeg); // Save the barcode as Jpg,Png, whatever image.

	 return imageHexString

Some conversions in Python.

from PIL import Image # Pillow :
import binascii
# Convert hex to jpg 
out_path  = r'c:\barcode\from_hex.jpg'
jpg_hex = u"the hex string" # Hex output from datamatrix in text file.

image_data = binascii.a2b_hex(jpg_hex)
with open(out_path, 'wb') as output:

# Convert jpg to eps 
jpg_file = r'c:\barcode\'
eps_out = jpg_file.replace('jpg','eps')

Adding jpeg hex to an Adobe postscript. You should be able to paste this into an existing postscript, just be careful where you place it; directly after %%Page might be a good start.

%%PageBoundingBox: 0 0 38 38
0 0 translate
20 20 scale
38 38   %% Width Height
8       %% Bit

If you need to convert XML to PostScript check out this excellent tool from Apache:

Leucine calculator Windows, Mac, and Linux

• November 28, 2015 • Comments Off on Leucine calculator Windows, Mac, and Linux

I created a calculator to approximately calculate mg leucine and exchange based on serving size by grams of protein. You can save the calculation as a food and further calculate meal totals. it could be helpful for body builders or those with MSUD.

I provide this software free of charge and without any warranty expressed or implied. This software was tested but could contain errors or incorrect information. This software does not contain any security features and should not be used on public or insecure computers. Please e-mail me with “leucine calc” in the subject line to report any bugs or erroneous values, or to request features. 

Consult a physician before using this software and have your doctor or nutritionist evaluate whether this software will meet your individual needs.

Download for

Windows [12.7 mb] SHA1 : 44724d50afebeeb67d384c453ee3a028cd02b8c2

Mac [2.4 mb] SHA1: 93a9371b368cc3f3b887a1937deaefb4c3a591e3

Linux 32bit [9.1] SHA1: 3a45980bc0e9aba222aba82af74195147155dcea

If you have trouble running on 64bit Linux you will need to install 32bit libs. These three terminal commands should be what you need in modern Ubuntu. Worked for me on Ubuntu Gnome 15.10.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386