Jon Thysell

Father. Engineer. Retro games. Ukuleles. Nerd.

Tag: mono

Chordious 1.0.0 now available at chordious.com!

Chordious Image

It’s here! Over a year since my first code check-in, and I’m finally ready to release Chordious 1.0.0 into the world. Need chord charts for your favorite stringed instruments? Want to make your own? Chordious helps you find chords and make customized chord diagrams for free.

It’s my first major cross-platform application, and is available now for Windows, Mac OS X, and Linux, with fancy-pants installers to boot.

Find out more at the new official Chordious website.

/jon

 

Using a batch file to launch Gtk# apps on Windows with Mono instead of .NET

Mono is great for cross-platform development – maybe not so great for cross-platform deployment. In working on Chordious, a Gtk# app written entirely in MonoDevelop on an Ubuntu machine, there’s been no greater struggle than trying to find a simple “double-click” launch of Chordious on Windows.

Yes, if you stick with just the “standard” libraries and write your GUI with Windows.Forms, all an end-user has to do is double-click on your executable, and let .NET run it. But what if you don’t want that? What if your app needs to be launched by the Mono Runtime?

Realistically, the bigger hurdle is getting your end-users to install Mono in the first place – but even if you can get them past that – you’ll still need a double-click way to start your app. You’ll never convince them to start up a Mono command prompt and manually launch your app with mono.exe. And unfortunately for us, the Mono installer for Windows isn’t so nice as to add itself to the PATH, so you can’t just get away with a one-line batch file.

Enter StartMonoApp.cmd:

@echo off
setlocal

rem Script: StartMonoApp.cmd
rem Author: Jon Thysell <thysell@gmail.com>
rem Date: 7/15/2014

set _MonoApp=YourMonoApp.exe

rem Checking for 32/64bit machine

if exist "%SYSTEMROOT%\SysWOW64" (
    set WOW6432=\Wow6432Node
) else (
    set WOW6432=
)

rem Find default Mono version

set _MonoBase=HKEY_LOCAL_MACHINE\SOFTWARE%WOW6432%\Novell\Mono

echo Looking for Mono registry key %_MonoBase%

for /f "Tokens=2*" %%I in ('reg query "%_MonoBase%" /V "DefaultCLR" 2^>nul') do set _MonoVersion=%%J

if "%_MonoVersion%" equ "" (
    echo ERROR: DefaultCLR not found!
    goto nomono
)

echo Default Mono is %_MonoVersion%

rem Find the path to where that version of Mono is installed

for /f "Tokens=2*" %%I in ('reg query "%_MonoBase%\%_MonoVersion%" /V "SdkInstallRoot" 2^>nul') do set _MonoPath=%%J

if "%_MonoPath" neq "" (
    if not exist "%_MonoPath%" (
        echo ERROR: SdkInstallRoot not found!
        goto nomono
    )
)

echo Mono %_MonoVersion% installed at %_MonoPath%

rem Check for the mono.exe binary

if not exist "%_MonoPath%\bin\mono.exe" (
    echo ERROR: mono.exe not found!
    goto nomono
)

set PATH=%_MonoPath%\bin;%PATH%

rem Launch the app

pushd %~dp0

echo Launching %_MonoApp%

start mono.exe %_MonoApp% %*

popd

goto :quit

:nomono
echo ERROR: Unable to find Mono. Please install Mono and try again.
pause

:quit
endlocal

So let’s say you’ve got yourself a nice little Gtk# app named GreatMonoApp.exe. To make a double-click launcher that uses Mono, simply:

  1. Copy the contents (minus the line numbers) of the script above into Notepad.
  2. Update line 8 with the name of your executable (in this example, the line should read set _MonoApp=GreatMonoApp.exe).
  3. Save the file into the same directory as your executable. (You can name the file whatever you want, just make sure you save it as a .cmd, not .txt, file).

There you go! Double-click on that new batch file and your app should launch via Mono. You might see a flicker or two of command prompts, but otherwise works quite well. If something does go wrong, the command prompt will stay open with an (hopefully useful) error message for you to debug.

How does the script work? Essentially it looks for the registry keys that the Mono for Windows installer created, and uses them to find where the mono.exe binary is. Then it adds that folder to your PATH (temporarily) so it can use mono.exe to launch your app. And as mentioned before, if there’s anything wrong (can’t find the registry keys, can’t find the folder or binaries) the script will show an error.

I hope someone out there finds this as useful as I do – I’ve spent forever trying to solve this problem, with progressively more and more complicated scripts. I’ve verified that the script works on Windows XP, 7, 8, and 8.1, 32 and 64-bit.

Happy coding!

/jon

P.S. I have no reason to believe the script won’t work on Vista, I just don’t have access to a Vista machine to test it. Sorry true believers.

Chordious 0.8.0 available, less requirements on Windows installs

I’ve had the code for Chordious 0.8.0 sitting on my laptop for a couple months now – haven’t found the time to add anything more to the pre-1.0 line since I plan on re-factoring a lot of the app after 1.0. Nothing too fancy in this release then:

  • Chord finder: Added the option to produce mirrored diagrams (for “left-handed” chords)
  • Windows: Removed the dependency on GTK# for .NET (now you just need Mono)
  • Windows: Fixed the StartChordious.cmd script to work on Win XP
  • Bug fix: Selected chords in the Chord Finder now unselect between searches

Check out these lovely screenshots (of 0.6.0):

For download links, check out my Chordious page, or the Chordious project page at Launchpad. You’ll find links for both the binaries and the source. Be sure to download the right binaries for your system (Windows or Linux / Mac OS X), and follow the installation instructions carefully.

Happy strumming!

/jon

Note: Chordious is still beta software, so please be sure to backup any ChordDocuments and diagrams you create. If you run into issues, or have feature requests, let me know!

Chordious 0.6.0 available, now with an integrated chord finder!

It’s been five months since I last released Chordious, my free app to generate beautiful chord diagrams for stringed instruments. Version 0.4.0 brought the first public iteration of the graphical chord designer, greatly simplifying your ability to create diagrams to meet your own style needs.

The problem was, you still needed to know what chords you wanted to make diagrams for. The biggest ask then was for an integrated chord finder.

It took me some time to bone-up on music theory, and then figure out exactly how to implement a chord finder in an efficient way. Other apps have done it before, but it’s a non-trivial problem to solve, and so I wanted as efficient, complete, and flexible solution as possible.

It took a few months to plumb the whole thing through, but Chordious 0.6.0 now features an integrated chord finder! Check out these lovely screenshots:

Now you can simply pick your instrument, tuning and search parameters and then search for chords! Right now you’re limited to the instruments, tunings, and chord types that I’ve entered- to start I just added some of the more popular banjo, guitar, and ukulele tunings. In the future I plan on making the list user editable. Same thing with the chord qualities- right now you’re limited to major, minor, augmented, diminished, 7th, 6th, and some of their variants.

Though the chord finder is the meat of the release, there are also plenty of other new features as well, including:

  • Export: Export images as PNG or JPG for easier use
  • Diagrams: Strings can be “muted” by setting them to -1 (and they show as x’s above the string)
  • Diagrams: Strings left open can optionally have an O at the top of the diagram
  • Diagrams: If Barre is set to -1, the diagram will make an “educated guess” where the barre should go
  • Diagrams: Barres can now be partial (only crossing the minimum number of marks) or cross the whole fret
  • Diagrams: If Baseline is set to 1, don’t show the 1 fret number (just remove the nut line, great for creating blank diagrams)
  • Bug fix: Fixed an issue where the app kept running in the background when you closed with an unsaved document open
  • Lots of other clean-up and code reduction

For download links, check out my Chordious page, or the Chordious project page at Launchpad. You’ll find links for both the binaries and the source. Be sure to download the right binaries for your system (Windows or Linux / Mac OS X), and follow the installation instructions carefully.

Happy strumming!

/jon

Note: Chordious is still beta software, so please be sure to backup any ChordDocuments and diagrams you create. If you run into issues, let me know! I’ve still got plenty of room on the road-map to version 1.0.

Update (02/16/2014): I finally fixed the StartChordious.cmd script to work on Windows XP, so I’ve updated the 0.6.0 windows binaries zip to include the fix.

Chordious 0.4.0 available, now with a graphical chord designer!

It’s been a couple months since I first released Chordious, my free app to generate beautiful chord diagrams. The first version was mostly just functional- a pain to use command-line utility that required users to create a custom text file with all of the chords they wanted to make.

But a pain no longer!

Chordious 0.4.0 now features a fully-graphical chord designer. Check out these lovely screenshots:

chordious0.4.0_01 chordious0.4.0_02 chordious0.4.0_03 chordious0.4.0_04 chordious0.4.0_05

Now it’s easy as pie to make chord diagrams for all of your favorite stringed instruments, from the ukulele to the guitar. Give the new designer a whirl and tell me what you think!

For download links, check out my Chordious page, or the Chordious project page at Launchpad. You’ll find links for both the binaries and the source. Be sure to download the right binaries for your system (Windows or Linux / Mac OS X), and follow the installation instructions carefully.

Happy strumming!

/jon

Note: Chordious is still beta software, so please be sure to backup any ChordDocuments and diagrams you create. If you run into issues, let me know! I’ve still got plenty of room on the road-map to version 1.0.