Category Archives: Programming

Building software.

Updating a wxWidgets project for Visual Studio 2019

I recently resurrected a dormant code project and went through the process of converting a wxWidgets 3.0 project to wxWidgets 3.1 and updaing from Visual Studio 2010 to Visual Studio 2019.

Include Directories

Here are the things I had to change to make things build and run:

Change “Platform Toolset” to Visual Studio 2019 in General configuration properties.

Change include and library directories from wxWidgets 3.0.2 to 3.1.4 in VC++ Directories and update the include path for modern Visual Studio. The change to $(IncludePath) does a lot of magic things that will save a lot of trouble. Failure to update that will cause common includes like stdafx.h to be missing.

Change include from:
E:\lib\wxWidgets-3.0.2\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include
to:
E:\lib\wxWidgets-3.1.4\include;$(IncludePath)

Code

The only code changes I had to make were to remove wxADJUST_MINSIZE anywhere it showed up.

Libraries

This is for the debug version of the project. Remove the “d” for libraries in the release version (i.e. wxbase31ud_core.lib => wxbase31u_core.lib).

These libraries showed up as missing:

comctl32.lib
rpcrt4.lib
uuid.lib
kernel32.lib

Adding C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\um\x86 to the linker directories fixed this.

msvcprtd.lib

Adding C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.20.27508\lib\x86 to the linker directories fixed this.

ucrtd.lib

Adding C:\Program Files (x86)\Windows Kits\10\Lib\10.0.19041.0\ucrt\x86 to the linker directories fixed this.

wxregexu.lib

Adding that to the library list fixed it.

I suspected there was something similar to $(IncludePath) I could add to the library paths to make those resolve, but I wasn’t sure. So I tried $(LibraryPath). And it worked. Magic!

So do that instead of adding those individual directories.

Change library path from:
E:\lib\wxWidgets-3.0.2\include;$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include
to:
E:\lib\wxWidgets-3.1.4\include;$(IncludePath)

Update all the libraries from wx 3.0 versions to wx 3.1 versions:

wxmsw30ud_core.lib => wxmsw31ud_core.lib
wxbase30ud.lib => wxbase31ud.lib
wxmsw30ud_adv.lib => wxmsw31ud_adv.lib
wxmsw30ud_html.lib => wxmsw31ud_html.lib
wxmsw30ud_xrc.lib => wxmsw31ud_xrc.lib
wxbase30ud_net.lib => wxbase31ud_net.lib
wxbase30ud_xml.lib => wxbase31ud_xml.lib

After these changes I was able to build and run my old project, which was originally written for wxWidgets 2.8 and then ported to wxWidgets 3.0.

Updating Django 1.8 on Python 2.7 to Django 1.11 on Python 3.6

I recently updated a few Django apps from Python 2.7 to Python 3.6 and while going from Django 1.8 to Django 1.11. This is mainly for my own reference, but others may find it useful.

Move the existing virtualenv (this will break the app):

mv ~/.virtualenvs/wbstats ~/.virtualenvs/wbstats2

Create a new virtualenv:

mkvirtualenv -p /usr/bin/python3 wbstats

At this point it might be a good idea to update the version of Django in requirements.txt. For WbStats it moved from 1.8 to 1.11.

Pip install the requirements.txt:

pip install -f requirements.txt

Edit settings.py and make sure there is a TEMPLATES section, which replaces TEMPLATE_DIRS. In addition, TEMPLATE_CONTEXT_PROCESSORS no longer exists. Basically anything with TEMPLATE_ has been rolled into the TEMPLATES section.

You may need to change some imports, i.e.

from models import *

may become:

from stats.models import *

The URLs will probably choke because strings are no longer allowed. Do not import “patterns”. Urlpatterns now is an array: urlpatterns = [url(…), url(…)]

'stats.views.index'

may need to be changed to:

from stats import views
views.index

After imports are fixed, the next thing will probably be fixing print statements.

Urlparse has been moved.

import urlparse

becomes:

import urllib.parse as urlparse

If you updated Django you’ll probably need to run migrations.

python manage.py migrate

Admin commands will need to be ported:

     option_list = BaseCommand.option_list + (make_option('-d', '--domain', default=None, action='store', type='string', dest='domain', help='The name of a domain to create or update.'),)

Becomes:

     def add_arguments(self, parser):
          parser.add_argument('-d', '--domain', default=None, action='store', dest='domain', help='The name of a domain to create or update.')

The parser arguments are mostly the same, but  references to “type=’int'” should be changed “type=int” without quotes, otherwise you’ll get ValueError: ‘int’ is not callable.

There’s some code in some of the admin commands I’ve written that changes the codec for stdout:

UTF8Writer = codecs.getwriter(‘utf8’)
sys.stdout = UTF8Writer(sys.stdout)

This will NEED to be removed because it causes cryptic TypeError problems saying things must be str and not bytes.

render_to_response needs to change to render because context_instance doesn’t exist.

Signing Up for Uber Eats in Another Country

Just want to mention my UX ordeal here – I basically had to hack my way through an app to order food.

I’m soggy and rained on (torrential pour today) and don’t want to leave the Airbnb, so I decided to sign up for Uber Eats, which I’ve never used before, and have food delivered. I’m in Mexico City but I live in Portland, Oregon.

I signed up using the web app because I wanna look at food pics on a big screen. I used my Google Voice number because I could validate it via text-to-email (I don’t get reliable phone service here on my network – Ting). Filled the cart with a huge order, entered my credit card, and when I clicked “place order” I got an alert that my phone number is not valid for ordering and I have to edit my account and add a valid phone number. The web app doesn’t let you edit your phone number. So I installed the mobile app and signed in. THAT let me edit my phone number and luck of all luck the validation text went through. I went back to the web app on my PC. Logged out and back in and my phone number showed up. Order was still in my cart. THEN I was able to order some food.

And now I’m getting Uber’s marketing emails in Spanish.

So yeah, sign up for your apps BEFORE you leave the country.

Proxima Controller Released for macOS via the App Store

I just released my virtual MIDI controller app Proxima Controller for macOS via the App Store. It’s something that I ported to OSX a while ago but never posted to the app store.

It lets you use your mouse, touchscreen, or keyboard keys to play a virtual MIDI controller that can be used to control external devices such as drum machines, synthesizers, or samplers.

You can get it here.

And if you want the Windows version you can get it here.

SpaceTheremin and MIDIPlayer Available for macOS Again

Over the years I’ve struggled mightily with OSX development. It’s just hard if you want to do things your way. It’s far easier if you use Apple’s choice of tools and languages.

Since most of what I’ve worked on for Apple computers has been apps ported from Windows or Linux, there really hasn’t been the option of starting with their way of doing things in mind at the beginning.

Last time I was working on building things for the App Store, I had eight apps I was trying to publish. I only ended up getting two released before I gave up in frustration. Those two were SpaceTheremin and MIDIPlayer.

Well, given my lack of enthusiasm, it’s no surprise that I let my developer subscription lapse. A lot of people wonder what happens when you let your subscription expire but then renew it later (around two years later in my case). Well, your apps disappear from the app store but stay installed wherever people already have them. And when you renew, they magically reappear like they never disappeared without needing to be reviewed again, and any apps in progress will be exactly as you left them.

That’s the case with SpaceTheremin and MIDIPlayer, which are now both available for macOS again.

Here’s SpaceTheremin.

Here’s MIDIPlayer.

I also have some things that have made it farther than before that you should expect to be released in the near future.

Menu Bar with Quit for a wxDialog or wxFrame-based app on OSX

I have some apps that I’ve tried porting to OSX off an on over the years, but some of them have never been quite right.

They’re written with wxWidgets, which is a multiplatform application development toolkit. However, documentation and fine details for macOS specifics is generally lacking.

For instance, I had an ongoing problem with making the “Quit” function in a menu work in a single-dialog application based on the wxDialog class. I originally asked the question on the forums back in 2011:

I have a wxDialog-based application on OSX that shows a single modal dialog window.

My understanding is that a dialog-based app cannot have a menu bar. However, I do get the default system menu bar on the app.

The Cmd-Q option (Quit) shows up on the default system menu bar, but it is grayed out. How can I modify my app to bind to that Cmd-Q option so I can treat it the same as clicking the red button at the top right of my dialog (which exits the app)?

The original post is here.

The answer from Tierra about switching to a wxFrame instead of a wxDialog was a part of the puzzle (thank you!), but the quit item still didn’t work. Once I had a wxFrame I could then attach the default menu items (in the constructor where all the dialog controls are being created):

wxMenu* helpMenu = new wxMenu();
helpMenu->Append(wxID_HELP);
helpMenu->Append(wxID_ABOUT);
wxMenuBar* menuBar = new wxMenuBar();
menuBar->Append( helpMenu, "&Help" );
SetMenuBar(menuBar);

I also had to connect those buttons to my functions in the event table (my dialog class is called wxKeyboard):

EVT_MENU( wxID_EXIT, wxKeyboard::OnExit )
EVT_MENU( wxID_ABOUT, wxKeyboard::OnInfo )
EVT_MENU( wxID_HELP, wxKeyboard::OnHelp )

Once that was done, I had an about menu item, a help menu item, and the quit item magically appeared and worked as intended. In addition, the “About” menu entry appeared under the application menu and not the help menu, but I had to add it to a menu in order for it to show up.

WbSrch Online Again

A while back I open-sourced the code for the WbSrch search engine.

It’s online now in a much-reduced form at wbsrch.com.

It’s not the full search engine. Far from it. It’s just a tiny database of about 10,000 or so URLs to demo the source code, but it’s possible you’ll actually find what you’re looking for in even that tiny amount of data if your search is sufficiently simple.

It probably won’t get any bigger — that’s about the size I can support “for free”, in that it doesn’t take enough resources on my inexpensive VPS to impact more important things. If you’re curious what the original WbSrch search engine was like, it’s a pretty good demo, at least visually.

DrumPads Now Open Source

Of all the audio apps I wrote for Zeta Centauri, DrumPads was by far the most popular, with more than 300,000 lifetime downloads.

It’s a pretty simple app. It’s a set of 12 virtual drum pads, each of which plays a sample when you tap or click it, or hit the corresponding keyboard key. It also had MIDI support and included a bunch of samples from freewavesamples.com. It let you use arrow icons scroll through to samples to change the kit, which could be a fairly long process. It was notable for me in that it was the first app I had ever written as a with a touch-only interface.

It started as an app for webOS tablets back in 2011. Soon after, webOS was discontinued, abandoned, and set aflame by Leo Apotheker, one of the most incompetent CEOs in modern history. I ported it to Linux and it was in the Ubuntu app store. Then I ported it to Windows and posted it online. And I almost got it ported to OSX. It built, but it never came together well enough to make it past the App Store goons. There was a pretty capable free version and a paid version. The free version was very popular, but the paid version only sold a few dozen copies.

Now that Zeta Centauri is no longer a business, there’s no reason not to release the full version for free.

The source code to DrumPads is now available on GitHub, along with a full version Windows download. Enjoy. 🙂

 

MusicSrch Reboot

Early in 2016 I bought the source code for a music search site from a fella in Slovenia and put it under the umbrella of the WbSrch search engine.

When WbSrch shut down later in 2016, it was left in limbo. It was still running through 2017, but ignored. And sometimes the service crashed and wouldn’t be started back up for a while. Like, sometimes even months.

When I started curating for RCRDList, it became something that I wanted to use again. But it was pretty broken, and I never really got around to learning Ruby. So I spent a long weekend and a few evenings rewriting it in Python and JavaScript.

It doesn’t search all of the same services that it used to, but it searches more of them now, especially more of the mainstream services. There are a few more things I’d like to add, but it already does more than the original version did. I also don’t have to worry about the service crashing because it’s a Python app, and I know how to keep those running consistently.

Try it out at:

https://musicsrch.com

 

SampliTron Now Open Source

SampliTron is one of the most popular Windows apps I’ve written. Although it’s fairly simple, it’s pretty powerful. It’s a virtual sampler that lets you load a .wav file and scale it across the entire keyboard, with that keyboard playable via either the computer keyboard or an external MIDI controller.

Before today it was a commercial app with a demo version, and the full version was $15. Over its lifetime it’s been downloaded more than 40,000 times and has sold a few dozen copies.

As of now, the full version is free, on the zetacentauri website, and the source code is available under the MIT license on GitHub.

Open Source: Sigmatizm, A Virtual Additive Synthesizer

Back in 2012 I wrote the most complex audio application I had ever written. It’s called Sigmatizm, and is a standalone additive synthesizer.

Additive synthesis works by adding together sine waves of different frequencies (harmonics) to create a more complex sound.

This particular application adds up to 128 sine waves together in real-time, while transitioning from one set of harmonics to another and while modifying the sound with an attack-decay-sustain-release (ADSR) envelope.

It also has full MIDI support and can be played with a MIDI controller, or can be used to play an external MIDI synthesizer. It also supports using any sound card or MIDI device attached to the system.

It started life as a Windows app and was also ported to Linux. Originally it was a commercial app available for $9.99 on both Windows and Linux (via the Ubuntu store). It also works on OSX, but building is a bit more involved and not for the faint of heart.

For the official download page, visit Zeta Centauri.

Or, to get the source code, visit GitHub.

There’s still a lot more that I’d like to do with this application. For example:

  • It’s nice as a standalone, but would be more useful as a VST so it could be used with multitracker software and be piped to effects, like delay, reverb, etc.
  • I’d like to be able to have an infinite number of envelope stages, so things could go quiet-loud-quiet-loud, or other evolving sound scenarios.
  • I’d like to add the ability to add noise or other inharmonic sources, since the app is completely harmonic and aliasing is the only source of inharmonic sound.

One thing that I’ve deliberately done in order to make it easier to create crazy sounds is NOT prevent aliasing, which is what happens when a sound goes past the sample rate (which in this case is 44.1KHz). When that happens, waveforms “wrap around” and start going in the other direction. I’d like to make that sort of thing optional (block or don’t block) because it’s undesirable in some situations and desirable in others.

It only has a handful of included patches, but I’d like to include more. If you download it and create some sounds, please consider contributing them back to the project.

Proxima Controller, a Virtual MIDI Controller

Back in 2008 I created an app called Proxima Controller. It’s a virtual MIDI controller that runs on Windows, OSX, and Linux.

I wanted an easy way to control external MIDI hardware (synthesizers, etc.) from my PC and there wasn’t an app that I liked available.

It started out as a Windows-only app. A few years later I ported it to Linux. And last year I ported it to OSX (but didn’t release it via the app store).

It’s been one of my more popular apps, with more than 70,000 downloads. I’m glad people have found it useful. It certainly made it easier for me to test sounds on my rackmount audio equipment without needing to shuffle full-sized MIDI keyboards around.

When I have time I’d also like to add an X-Y controller pad, something that can be used to transmit the same controller messages as the joystick on the Korg Wavestation and the Yamaha SY22/SY35/TG33.

You can get it here.

Trigram Generator for Windows and Linux

A long time ago I wrote a free Windows app called the “ZC Trigram Generator”. It was a simple app to generate plausible-sounding words based on a set of input words.

It had a steady trickle of downloads for around 8 years or so, about 1500 downloads per year.

Two years ago I open-sourced it and posted it on GitHub.

Today I updated it to be a little easier to use by adding a “load text” button to load a text file.

Trigram Generator Screenshot

It works on Linux and Windows 7 or newer (including Windows 10).

It’s available here on GitHub if you’d like to get it.

Guitar Tuner and Bass Tuner for Windows

Guitar Tuner and Bass Tuner are the first desktop Windows apps that I wrote. I don’t recall how long ago, but it was certainly more than a decade.

They’re super-simple apps that let you sound notes to tune your guitar or bass to. They only support standard tuning and use the default MIDI device for sound output, which usually means the “Windows MIDI Mapper”, a built-in sound synthesizer that’s been part of the OS for ages.

For nearly ten years I had them available for download on zecentauri.com, and they had more than 100k downloads in total. Two years ago I open-sourced them, but didn’t really mention it anywhere.

I updated them both today, adding two notes to Guitar Tuner to support 8-string guitars and making improvements to the installers.

Both the source code and the installers are available on GitHub under the MIT license.

Visit Guitar Tuner on GitHub.

Visit Bass Tuner on GitHub.

Java: Overcoming A Technology Prejudice

For a very long time I’ve been anti-Java. It started when I was a PC technician in the late 1990’s. The Java Runtime was always a nuisance to maintain and the apps were terrible memory hogs with bad user interfaces.

My view of Java didn’t improve as I learned and worked in C++ and then later C#. Java seemed a poor, clunky way of doing things and there was no need for it, given the fitness of the C# ecosystem for many of the same “enterprisey” purposes.

When the Android operating system was released things got weird. Why were they using this slow memory-hog language for a mobile phone’s applications when the hardware has such limited memory and processor power? It made no sense.

Soon after that, Oracle bought Sun and became the owner of Java. Oracle is a terrible company that I want nothing to do with. In addition to their hyper-litigous business practices, they also deploy auto-accept crapware with their Windows runtime installer*, which is unconscionable. Needless to say, this did not improve my opinion of Java.

Years later I built a search engine. There are a lot of useful web crawling tools in the Java ecosystem that I didn’t take advantage of. The Python ecosystem has a lot of wonderful web crawling tools and libraries, but not having access to the whole set of what’s available ended up being a hindrance.

The same goes for data science. I know the Python data analysis tools, but there are a lot of things in Java that I haven’t really had access to (particularly the Hadoop ecosystem), so I’ve missed out on some possibilities.

I get that it’s no longer true that Java is clunky and incapable, but it’s hard to let go of a long-held belief. But it’s not a useful belief, so it’s time to let it go the same way I let go of my prejudice against Apple’s OSX a few years ago (although I do sometimes still refer to it as “broken Linux”).

Now that I’ve been focusing more on DevOps, it has become more important to be able to support a wide variety of programs. Writing software is one thing – you can usually focus on only the language(s) used by your project and not suffer for it. When you’re deploying applications from dozens of teams, you need to be able to support (and troubleshoot) anything and everything.

Everything I’ve heard leads me to believe it will be fairly easy to become competent in Java given my experience in C# and C++. I have a copy of Teach Yourself Java in 24 Hours and some spare time, so I’ll find out soon.

* I hope that one day that the FTC will ban installer bundling. That certainly won’t happen with the current shitministration.

SpaceTheremin, a Virtual Theremin

Back in 2007 I wrote an application called SpaceTheremin. It is a simple app that lets you use your mouse to control a virtual theremin by moving it over a beautiful public domain image from the Hubble Telescope to control pitch and volume.

Over the years I also released versions for Linux, webOS, and OSX (via the Apple Store). It’s been downloaded tens of thousands of times and is a fun noise toy.

It’s available on the Zeta Centauri website if you’d like to check it out.

Open Sourced: RoboBlather, a Text to Speech Application for Windows

Back in 2008 I released the first version of a simple text-to-speech program for Windows called RoboBlather. Over the years it has enjoyed some popularity among a small niche of users due primarily to its uncomplicated interface.

Today I finished open-sourcing it under the MIT license. If you’re interested, it’s available here on GitHub.

You don’t have to be a programmer to enjoy it — there’s an installer that lets you use it right away without needing to worry about the programmer-y aspects.

Old Basternae Blog Posts Imported

I ran a blog for about seven years at basternae.org. It was almost entirely about Basternae MUD and the evolution of the ModernMUD codebase, but also included a lot of general programming-related entries. I’ve imported all of the previous posts from that blog for the sake of preserving history, though many of them will no longer be relevant. Even so, there may be information that is helpful for people who want to make use of the ModernMUD code to build their own multi-user dungeon.

Setting Up a Redash Dashboard

This was originally posted on wbsrch.com. It is reproduced here to preserve history.

The more WbSrch evolves, the more it becomes necessary to keep track of a bunch of metrics.

Until now we’ve been using a mix of simple report pages and raw SQL queries. It has worked well enough, but not having a clean way to track things in a single place is a nuisance.

That’s why I was happy to discover the redash.io open source project. It’s a query tool meant to be used for setting up business intelligence dashboards and it works with a wide range of databases.

No stranger to code, I tried to check out the GitHub source and get it running on my local machine. It didn’t quite work out. They have a bootstrap script, and it had some trouble with my particular system setup (it fell over when it came to configuring local database users).

But they also have EC2 AMI images you can launch to get running in AWS. I fired up an Amazon micro instance on the free tier and had the app running in seconds. It only took some minor configuration to get set up with my SSL certificate, and I was ready to go.

Adding a Database Connection to Redash

Connecting my three PostgreSQL databases was easy and the clean interface made it easy to find the query editor. After running a few queries I had the feel for how things worked well enough to save them. It also lets you set a refresh interval on your queries so you can have data refresh daily, hourly, or whatever. Results are cached so you’re not taxing your database gathering totals every page load.

Redash Query Editor

After you have a few queries, you can start adding them to a dashboard as panels. You just select the query name, the visualization type (you get table by default, but can add graphs and charts in the query builder), and the widget size.

This is a dashboard that I built to keep track of the search traffic and index state for the Somali-language version of WbSrch:

Redash Dashboard Example

I created dashboards for each supported language plus an overall meta-dashboard. It was fairly quick, taking about a day to set up 35 dashboards and about 200 queries.

Luckily the interface is pretty good, because once you have the software set up, that’s where the documentation ends. You can figure out most things with experimentation (trial-and-error), but it would be very helpful to have a few getting started tutorials, or at the least an explanation of how the various visualizations work.

A micro EC2 instance may stumble if you have some large queries (selecting an entire table is a bad idea, don’t do it), or a lot of things refreshing, but it kept up pretty well.