Quick Coding: dealing with quirks in Sinatra + Thin + Windows 8.1 (part 2) — Hacking runner.rb

It seems that the option for -C is set to not be available if you’re under Windows. Ultimately, I ended up creating a quick hack, realizing that if you execute:

Then, thin will write a default configuration file with a bunch of options which are only available under Linux, like daemonize: true. having daemonize set to true in a config.yaml file while under Windows will result in an error raised by Ruby (no daemonizing supported).

It’s simple enough after changing runner.rb around, to allow -C to be used in the context of starting a server.

runner.rb is in: C:\Programming\Ruby200-x64\lib\ruby\gems\2.0.0\gems\thin-1.6.2\lib\thin

On line 99-ish, make a simple edit, moving the entire line:

out of the “unless Thin.win?” statement; the resulting code looks like this:

Now you can perform command line arguments with statements such as:

if you generate a config.yml file first with:

be sure to set:

In your config.yml file–or remove it altogether.

I’m assuming the developer was thinking that nobody would be using thin on Windows, god forbid.


In the documentation of thin’s basic usage (http://code.macournoyer.com/thin/usage/), you can use thin -C config.yml to deal with configuring a thin server.




This has puzzled me for centuries; I guess the lesson learnt is that software development on Windows is not always the greatest thing.

TODO: monkey patch runner.rb

Array of Hashes in Ruby



Was messing around with recursion in Perl for a while in an attempt to be somewhat productive and to get my mind off things at the same time… And somehow, I was successful, at the deep recursion part anyways.

http://www.lyream.com/recursion/recursion_directory.html shows deep recursion being used to list every file in C:/.

An executable and the source code in regular text is at: http://www.lyream.com/recursion/

Oh, it creates a file called “files.txt” in your c:/ root directory, containing every single file in c:/


After searching for a lightweight solution to embed Perl code into HTML documents, I came across this. PLP. It has, perhaps the simplest syntax of all time, getting straight to the point. No doubt, it will be supported by nearly any webhost that supports Perl, because, it supports mod_perl AND cgi. The only problem I ran into was an internal “OK” server error. I checked the log files and it led me to an undefined subroutine: Apache::Constants. Realized it was undefined because I’m running in a mod_perl2 environment and that was a module for mod_perl(1). I changed anything in the source code which contained Apache::Constants to Apache2::Const. Works like a charm now. The only tricky thing about this module is that it hates changing headers, so adding sessions is going to take some thinking… If anyone’s interested, the link is: http://search.cpan.org/~shiar/PLP-3.19/PLP.pm