Software

This page lists only the software pages recently written. Bug tracking and repos are in a separate wiki.

2020-08-14 Uses this

Somebody asked me for a “uses this” page… The short answer is: I use Emacs.

But here’s the long version. Because I’m vain. 😆

Portrait
Alex Schroeder

Who are you, and what do you do?

I’m a code monkey for a Swiss and German company. We do business software using Java and databases. It used to be mostly Oracle, these days it’s mostly PostgreSQL. This is still my first job. I’ve been doing it for more than twenty years. That is to say, the programming is boring, the tech isn’t exciting, and I’m old. But the part I love is switching projects, again and again. New team members, new project managers, new clients, new faces, new industries, I love that. I mean, it’s also a bit devoid of meaning, of course. In the grand scheme of things, who cares for car leasing, investment banking, furniture, call centers and credit cards? Nobody I love, that’s for sure.

And yet: I love to program. The world of programming is where I can make things. Like people tinkering with their cars, woodworking, knitting, sewing, playing music, baking, cooking, painting, I want to make things. Making things online comes easy to me and so I do it a lot. I only work a 60% job so that I have long weekends and long summer breaks, allowing me to follow my whim. One year it’s a local IRC server that acts as a gateway to Mastodon, the next year it’s a wiki using the Gemini protocol and markup as much as possible. I fall into projects in summer.

What hardware do you use?

I use a Purism Librem 13v2.

I have a bunch of external keyboards (Atreus, Keyboardio Model 01, Touchstream, Ergo Kinesis) but I don’t use them. I got used to laptop keyboards. And if my hands hurt, I know that I should just stop, not switch keyboards.

I also don’t use a mouse. I use the trackpad. When I’m drawing, I use an Apple Pencil and the iPad Pro. I rarely draw.

When I make music, I use various emulators on the iPad Pro, or the OP-1 or PO-33 K.O! by teenage engineering. I rarely make music.

For my podcasting I started recording voice memos with my phone; later I bought a second hand Snowball by Blue.

When I’m in the office, I use a regular Sennheiser Momentum for headphones. No wireless. No noise cancelling. I tried some noise cancelling headphones earlier and felt like it surpressed the background noise but not the voices and what I hate about the open plan office is the voices of my coworkers. A long time ago I had Shure in-ears. True plugs. Maybe I should get some in-ears again.

And what software?

The laptop runs PureOS, a Debian derivative. I picked a laptop that came with a Debian preinstalled. I hate installing software. I also dislike how out of date Debian can be, and I don’t like how they think the GNU manuals are not free, but overall, I still like package managers. Thank you so much!

In general, though, I’m not a operating system or distro hopping nerd. I used Slackware in the very old days and would not mind going back. I like to use Debian because I also use Debian on my server. My wife has an Apple laptop that I used for a long time, with Homebrew. Over the years I got angry about all the complications with iMovie, iTunes, iPhotos… it was difficult to get the stuff out again. The iTunes interface degraded over the years. Importing pictures into iPhotos led to crashes. It all started to feel like a thin veneer of sugar that was made to entrap me, and still didn’t deliver the stability I wanted. Instead I got mental models that didn’t fit the underlying models, if you know what I mean. The “events” and “playlists” cannot be found in the folders on disk, but the “rolls” are “importing events” and the “albums” are “folders” except when they’re “compilations”… Eventually I decided that I wanted to just use the filesystem again. Have files in folders. This I can understand. And on this level, Emacs can be used for practically everything.

Actual music playback is a command line tool like mpg321. When I look at PDFs, I use Evince because I find that Emacs’ document viewer mode is too slow. Or perhaps I just haven’t gotten used to it? Or is it the missing links? I don’t know. Maybe soon I’ll do without an external PDF viewer. 😁

When importing images from the iPhone, “Files” (is it still Nautilus? I have no idea) and whatever it invokes (gThumbs?) just work. It’s amazing that I don’t even know what this software is. Gnome something. It just works. This makes me happy.

When I’m organizing my images, I need a quick, keyboard driven user interface. Sadly, Emacs isn’t quick in this regard. I use Geeqie instead. The ability to use the ten digits for quick tagging is perfect. Go through the images and use 1 for album, 2 for delete, 3 for review, 4 for family, whatever, and then when you’re done, move the images around based on those temporary tags. ♥

When I’m editing my podcast, I use Audacity. I tried other programs, but most of the time their user interfaces are all tiny. I use a small laptop and I like big fonts and big icons. Audacity is the limit.

For graphics, I use Inkscape and Gimp (I hope to see Gimp replaced by Glimpse, soon!) – what a name. Yuck! It reminds me of that Quentin Tarantino movie and I hate Quentin Tarantino movies. On the iPad, the only app that I actually like using is Zen Brush 2. I somehow can’t get used to Procreate or Art Set or any of the other apps.

For making music, I use the iPad. The apps I like to use are PixiTracker (which is also available for other platforms), the iVCS3 emulator, the Model D emulator, the Animoog emulator, Synth One, and GarageBand (mostly for instruments like the Pipa, Erhu, Koto and Guzheng). I’d love to know more about music and must resist the temptation to buy more music making hardware without having taken full advantage of the things I already have. The temptations of capitalism…

The projects I work on in my spare time often use Perl 5. I sometimes try other languages: Python, Raku, Go, Scheme… but I always come back to Perl. Perhaps people just like to stick to their first language because that’s where their experience lies. You have made all the mistakes in the distant past and now everything comes naturally.

All the Perl projects I work on use the web as the universal user interface. I know, I know. I hate the web. It’s big and bloatet. And yet, the browser is the universal client. Huge, and bloated, and requiring a thousand engineers, I know. But none of the alternatives are great, either. I still haven’t written a GTK or Qt application, let alone something using X11, wxWidgets, or Tk. HTML and SVG it is, for me.

What would be your dream setup?

I have no idea. I want everything to just work, with no installation, and I love Emacs.

I’m fascinated by the Plan 9 concept of everything being a file, but at the same time, why can’t we have a system where everything is a file, and Emacs? Plan 9 has no Emacs. Emacs is like a universal Lisp machine: it provides a universal user interface to the underlying operating system and thus to the machine. It’s not perfect, yet. It often relies on tools that aren’t immediately available on Windows, for example – grep, find, sed – and you need external tools to play MP3 files and to edit their metadata.

Now that I use the Apple Pencil on the iPad Pro, I imagine how hard it is to draw on a traditional computer, even with a good tablet. And how would all of that work within Emacs? I would love to see all the Gimp stuff gobbled up by Emacs.

Comments on 2020-08-14 Uses this

I am really digging the love for EMACS that everyone is pouring out at the moment!! It’s probably because of its new release. I really enjoyed this gemini post 🙂 ~VIDAK

– elpherwVSLR9 2020-08-14 14:10 UTC


Haha, yeah! Emacs is great. I love it, too. And Elpher and Emacs together... my favourite way to comment on my wiki!

Karl Voit sent me a message on Mastodon about the naming and tagging he does using Geeqie with the addition of a small number of nifty scripts. An interesting workflow! And I totally agree with him: file names and folder structure is the kind of metadata that lasts a lifetime. Everything else is tricky.

– Alex

Add Comment

2018-03-12 Writing an Editor

I’d like to collect some links to tutorials teaching readers how to write their own editor. These editors will necessarily be small, but perhaps they’ll be easy to adapt to your own taste.

Vip is a vi-style editor in PicoLisp.

Build Your Own Text Editor: “It’s about 1000 lines of C in a single file with no dependencies, and it implements all the basic features you expect in a minimal editor, as well as syntax highlighting and a search feature. This booklet walks you through building the editor in 184 steps.” I was super impressed when I started reading it (but I never finished it).

Tags:

Add Comment

2018-02-08 Use Old Tech to Fight Information Overload

Here I am, using newsboat as my newsreader instead of visiting Feedly or using Reeder on my iOS devices. It’s an application that runs in the terminal. It doesn’t hide empty feeds. It doesn’t sort feeds. It doesn’t group feeds. I imported a gazillion feeds via OPML file and slowly I’m finding that this or that feed is dead, or that I don’t really enjoy reading a feed, and I simply edit my subscriptions and remove the feeds. It’s as if the slight discomfort of using the tool makes me realize that this or that isn’t actually worth the effort.

At the same time, I find that when I use VF-1 to visit Gopher sites, or when I use newsboat to read blog posts, and I do this from my laptop, then I with purpose, when I have some time. I don’t skim articles. I take the time to think about what I have just read. And I can’t just quickly comment or +1 or start what I have read and move on. Should I write a comment, an actual email, or a post on my blog? Again, an action that requires enough effort to give me pause, to evaluate whether what I was about to do is actually worth doing. And I am starting to find that in the past few years I might done things very efficiently that aren’t actually worth doing in the first place.

I think I’ll start reducing my toolset even further. Perhaps I’ll start browsing the web using w3m again.

I’d lover to view images in my terminal instead of opening new windows. I need to look at the solutions proposed in this thread about displaying pictures in a terminal. So many exciting ideas.

And really, most of the time I just use Emacs, a terminal emulator, and a browser. I think I’ll remain an Emacs user until the very end. But everything else is up for grabs.

Right now I am exploring what Gnome has to offer. That’s why I use Tilix as my terminal emulator. It does tiling and I love that.

alias right="tilix --action=session-add-right"
alias down="tilix --action=session-add-down"

Use Ctrl~Tab to switch between sessions. I think this is good enough for me right now.

And I’m using Tilingnome, an extension to the Gnome shell which does window tiling automatically, without me needing to switch to a tiling window manager. For now, this is very slick. I can open new windows without ever thinking about placement and really, I rarely have more than two or three windows open (specially since my terminal emulator and my editor do tiling). I guess the only key combos I might need eventually is sending a window to the other workspace. I’ll look for it when I have a need for it.

Screenshot showing Emacs and Tilix

Tags:

Comments on 2018-02-08 Use Old Tech to Fight Information Overload

Perhaps this is also the reason I’m starting to prefer blogs, Mastodon and Gopherholes over visiting Google+. It’s just a bit less slick, takes a bit more effort, sometimes it requires my laptop at home, and in the end these little barriers move me away from some social media. I guess that’s very similar to how I moved away from Facebook. I simply uninstalled the app and changed the password. Sure, at home, on my laptop, the password is still around. But it isn’t available in the office. It isn’t available on my phone.

– Alex Schroeder 2018-02-08 18:10 UTC


Now that I’m using newsboat to read my news, I’m discovering a lot of dead blogs. As I’m discovering these, and dropping them (using a slightly convoluted keybome: E to edit, / to search, dd to delete, :wq to save), I’m feeling increasingly frustrated and rushed and I’m starting to think that maybe I should just delete most of them. Right now I still treat them like a treasure trove. But maybe I should treat them like the detritus of times gone by and just clean the house (or boat).

– Alex 2018-02-10 11:37 UTC


I defined a custom link for Tilix:

Regex Command
\bgopher://\S+ tilix -a session-add-down -e /home/alex/.local/bin/vf1 "$0"

– Alex 2018-02-11


Now that I can only read news from my laptop, I find that I no longer feel like I should be reading news on my phone. A relief?

– Alex Schroeder 2018-02-13 14:21 UTC


Reading news using newsboat I find that it doesn’t refresh the feeds unless I tell it to. How refreshing! Those feeds don’t just keep on racking up numbers. Once you’ve read a feed it stays read until you decide to hit r and reload it. Just don’t ever hit R and reload all of the feeds if you’re like me. :)

– Alex Schroeder 2018-02-15 09:17


I’m still going by my new motto: make computer use hard again. Specifically, I shall try to do everything I want to do without one of the big browsers. So, it’s either in Emacs, or newsboat, or w3m, or lynx, or VF-1, or IRC (and that means Emacs), or Mastodon (since that happens via IRC and thus within Emacs). Whenever I find myself starting Firefox or one if its friends, I stop myself. 1/2

Can I do the thing without a browser? If I can, do I still want to do it? If that’s too much trouble, I saved myself from wasting time. Good! If I definitely need a browser because of Javascript or whatever, and I realize that this is the reason, I’m feeling the anger rise and that is often enough for me to close the window again. Good! No time wasted. 😤 (← remember: this is the face of triumph according to Unicode)

– Alex Schroeder 2018-02-18 18:00


I second the recommendation by @wrenpile to read The Tyranny of Convenience by Tim Wu about convenience and struggle and how we must realise that making everything convenient robs us of life experience. We run, not because it is easy but because it is hard. We went to the moon, not because it was easy but because it was hard. Let’s recognise that «hobbies» and «passions» are just inconvenient things we like doing anyway.

– Alex Schroeder 2018-02-18 23:04


I was looking at toot and madonctl trying to find a good command line client for Mastodon but now I think I found what I was looking for: tootstream.

– Alex Schroeder 2018-02-19 07:14 UTC


I bought a book about ed for $4.99 called Ed Mastery.

From the introduction:

After receiving rare but tediously ongoing complaints about my use of mixed male and female third-person pronouns in my technology books, I’ve prepared two editions of this book. Any third-person singular pronouns that appear in the standard edition, for normal people, are female.

Those who believe that women don’t belong in tech books are welcome to purchase the special “Manly McManface” edition, where all third-party singular pronouns are masculine. To compensate for this edition’s much smaller market, though, the Manly edition is pricier than the standard edition. That’s basic economics.

From the shop:

Ed Mastery
Suggested Price $4.99

Ed Mastery: Manly McManface Edition
Suggested Price $15.99

– Alex 2018-04-05 23:34 UTC

Add Comment

2017-05-30 Planning for my Summer of Code

Soon, summer break. Sadly, this year begins later than usual. I have to wait until mid July! 😢

This is what I’m contemplating:

  1. work on the Gridmapper Megadungeon Generator.
  2. work on making Gridmapper useful for grid-based wilderness maps, like this map by Edward Kann (it reminds me of Ultima IV and Ultima V)
  3. allow Oddmuse to upload pictures by “pasting” them into the text area like GitHub does it (notes)
  4. maybe resume working on Oddmuse and WebDAV?
  5. also, practice playing the recorder
  6. add more face elements to my digital set for the Face Generator
  7. is Oddmuse ready for Perl 6? Apparently there is no Mojolicious for Perl 6! Installing rakudobrew and zef. I’d probably be using Bailador and HTTP::Easy.
  8. a city map creator like this but colorful, like this
  9. read Piracy by Adrian Johns (see 2015-07-14 No Copyright)
  10. read Against Intellectual Monopoly by Michele Boldrin and David K. Levine (see 2017-06-25 Against Intellectual Monopoly)
  11. allow fgallery to update an existing destination directory
  12. Take a look at the Classic Traveller Character Generator

Tags:

Comments on 2017-05-30 Planning for my Summer of Code

As a note, I’ve done some experiments with perl 6 grammars for parsing wikitext. If done right, it will be possible to merge two grammars into one simply by creating a class with two parents, e.g. markdown+creole (or even markdown + tables :P). Pretty cool stuff.

By the way, I’ll be free from June 13th and onwards, so feel free to ping me about anything.

– AlexDaniel 2017-06-05 15:34 UTC


Yay!!

Also, im thinking we should just rewrite all of Oddmuse and not just port the existing code.

– Alex Schroeder 2017-06-05 19:01 UTC

Add Comment

2016-01-23 Testing Encrypted Mail Setup

I’ve updated my guide, the Gmail Gnus GPG Guide (GGGG) to incorporate the latest addition to the FSF’s Email Self-Defense guide to free software-powered encryption. They even have a guide on how to help your friends and family, including talking points if want to make your case.

Anyway, the thing I added to the guide is how to initiate communication with the bot:

  1. send him your Public key
  2. get his public key from a keyserver
  3. how to set up a keyserver in order to achieve step #2
  4. send him an encrypted mail

Tags:

Comments on 2016-01-23 Testing Encrypted Mail Setup

The public (not private) key should be sent in point 1. Best regards, A.

– A. 2016-01-23 16:01 UTC


Aaaaargh!

– Alex Schroeder 2016-01-23 16:36 UTC


Thanks!

By the way, what’s the reason to use gpg instead of gpg2?

– AlexDaniel 2016-01-23 22:44 UTC


Also, it looks like it has to be ~/.gnus.el instead of ~/.gnus.

– AlexDaniel 2016-01-24 00:07 UTC


Hm, I think ~/.gnus is fine, according to the manual: “… and gnus-init-file (‘~/.gnus’ by default)”

As for the GPG version, I am using gpg. Perhaps on Debian version 2 is only available as gpg2?

alex@Megabombus:~$ gpg --version
gpg (GnuPG) 2.0.29
libgcrypt 1.6.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA, RSA, ELG, DSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

– Alex Schroeder 2016-01-24 00:15 UTC


Interesting. Also it would be great to know how to make gnus sort things in the right order by default…

– AlexDaniel 2016-01-24 00:35 UTC


Oh well. It seems like the idea is to have only unread messages visible by default. If you keep it this way then there’s no reason to change the order. Hmmmm.

– AlexDaniel 2016-01-24 01:37 UTC


I’m not sure if this approach is really useful. Gmail sorts messages into three tabs – Primary, Social and Promotions. Obviously I never read Social and Promotions, and I even ignore some messages in Primary. That’s the result:

https://files.progarm.org/2016-01-24-033741_154x97_scrot.png

In such case default settings in gnus are so alien. But I thought that it is how all people read their emails? Is there any way to get this PrimarySocialPromotions distinction in gnus?

– AlexDaniel 2016-01-24 01:40 UTC


Not unless Gmail makes the tabs available via IMAP, i.e. via folders (like it does for labels). I don’t think this is happening. Apparently you can search for them but I don’t understand how you would use this from Gnus. [1]

– Alex Schroeder 2016-01-27 20:26 UTC

Add Comment

2015-10-09 Oddmuse and Mojolicious

I’m trying to run Oddmuse within a Perl web framework: Mojolicious using Mojolicious::Plugin::CGI. It won’t be as perfect as a true Mojolicious app, but it will still be much faster than a simple CGI script. When running as a CGI script, every request loads Perl and compiles all the modules – including the CGI module itself – and Oddmuse and the config files. When running under Mojolicious, we no longer load Perl and we compile Oddmuse just once. Oddmuse itself will keep loading the config file and all that, but it’s still much better than before. The Mojolicious app itself is then started by Toadfarm. And in order to force myself to test it, I’ve switched this wiki over to the new setup!

First, tell Apache to act as a reverse proxy and pass all /wiki requests to the new server. The two ProxyPass instructions at the bottom are the important bits:

<VirtualHost *:80>
    ServerName alexschroeder.ch
    ServerAlias www.alexschroeder.ch
    Redirect permanent / https://alexschroeder.ch/
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin alex@alexschroeder.ch
    <Directory />
        Options None
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    ServerName alexschroeder.ch
    ServerAlias www.alexschroeder.ch
    ServerAlias rpg.alexschroeder.ch
    DocumentRoot /home/alex/alexschroeder.ch
    <Directory /home/alex/alexschroeder.ch>
        Options ExecCGI Includes Indexes MultiViews SymLinksIfOwnerMatch
        AddHandler cgi-script .pl
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>

    SSLEngine on
    SSLCertificateFile      /home/alex/ssl/alexschroeder.crt
    SSLCertificateKeyFile   /home/alex/ssl/alexschroeder.key
    SSLCertificateChainFile /home/alex/ssl/GandiStandardSSLCA2.pem
    SSLVerifyClient None

    ProxyPass /wiki             https://alexschroeder.ch:8080/wiki
    ProxyPass /mojo             https://alexschroeder.ch:8080/mojo

</VirtualHost>

Toadfarm setup in ~/farm/farm:

#!/usr/bin/env perl
use Toadfarm -init;

logging {
  combined => 1,
  file     => "farm.log",
  level    => "info",
};

1. other apps go here...

mount "$farm/alexschroeder.pl" => {
  "Host" => qr{^(www.)?alexschroeder\.ch$},
  mount_point => '/wiki',
};

plugin "Toadfarm::Plugin::AccessLog";

start; # needs to be at the last line

The above means that all requests to htpp://alexschroeder.ch:8080/wiki and htpp://www.alexschroeder.ch:8080/wiki will be handled by Oddmuse.

Mojolicious wrapper in ~/farm/alexschroeder.pl:

#! /usr/bin/env perl

use Mojolicious::Lite;

plugin CGI => {
  support_semicolon_in_query_string => 1,
};

plugin CGI => {
  route => '/',
  script => 'wiki.pl', # ~/farm/wiki.pl
  env => {WikiDataDir => '/home/alex/alexschroeder'},
  errlog => 'alexschroeder.log', # path to where STDERR from cgi script goes
};

app->start;

In this case, wiki.pl is simply the original Oddmuse script, unchanged. :)

Tags:

Comments on 2015-10-09 Oddmuse and Mojolicious

Cool! That’s interesting.

What about side effects? Like, if you forget to initialize some variable somewhere, what is going to happen? (Thinking about mod_perl and all stuff related to it)

Also, I miss one important thing from your report... What about page load time? How much faster is it right now, comparing to regular cgi script?

– AlexDaniel 2015-10-09 11:21 UTC


I did not measure page load time. I also think that it keeps forking to run the script, so globals start empty every time? Not sure about the details. I haven’t seen any side effects, yet. Let me know if you see anything!

– Alex Schroeder 2015-10-09 11:39 UTC


Could you be so kind to measure the load time?

– AlexDaniel 2015-10-09 11:50 UTC


I think I was under the illusion that it was working. Now it is working. Hah! I had to rename my old wrapper script to realize that my ProxyPass instructions had been wrong.

Things to remember:

Check the config file for weird stuff.

1. if ($ENV{SERVER_PORT} == 8080) {
1.   $ScriptName  = 'https://alexschroeder.ch:8080/wiki';
1.   $FullUrl     = 'https://alexschroeder.ch:8080/wiki';
1. }

Make sure the user running toadfarm can write alle the files in your data directory. In my case, the data directory belongs to www-data.alex but there were temp files that alex could not write.

– Alex Schroeder 2015-10-09 13:27 UTC


Hm. Current setup, I get more or less the same time when I look at network analysis with my browser when I’m loading /wiki/About and when I’m loading /wiki2/About with wiki2.pl being my old wiki.pl wrapper script. I get numbers between 200ms and 700ms. I do note that /wiki/About keeps getting me a 200 OK response instead of a 304 NOT MODIFIED. I’m not quite sure what the problem is.

– Alex Schroeder 2015-10-09 13:40 UTC


Oh, and the code shows that our script is being exec’d. I’m not sure about the headers. I think if our script prints HTTP headers, we should be fine.

– Alex Schroeder 2015-10-09 13:47 UTC


Well, at least it seems to work right now. I think I got confused about the various restarts required.

The missing 304 NOT MODIFIED remains a mistery, however. I’ve tried $q = new CGI; $q->nph(1) in the config file, $CGI::NPH = 1 in the config file, CGI::nph(1) in the config file, use CGI qw/-utf8 -nph/ in the core script, and print $q->header(-nph=>1, -status=>'304 NOT MODIFIED') and return if PageFresh(); in the core script, reloading my toadfarm between edits and found no change.

When I tried to export MOJO_PLUGIN_CGI_DEBUG=1 before starting the toadfarm, I got a 503 error when visiting the site.

This is very annoying.

– AlexSchroeder 2015-10-09 14:32 UTC


OK, so the question is: How often is 304 NOT MODIFIED actually used?

alex@kallobombus:~/farm$ sudo wc -l /var/log/apache2/access.log.1
259852 /var/log/apache2/access.log.1
alex@kallobombus:~/farm$ sudo grep ^oddmuse /var/log/apache2/access.log.1 | wc -l
32867
alex@kallobombus:~/farm$ sudo grep "^oddmuse.*GET /wiki.* 304 " /var/log/apache2/access.log.1 | grep -v feed | wc -l
270

Filtering out feed request we’re down to 8‰.

For my own site:

alex@kallobombus:~/farm$ sudo grep ^alexschroeder /var/log/apache2/access.log.1 | wc -l
79286
alex@kallobombus:~/farm$ sudo grep "^alexschroeder.*GET /wiki.* 304 " /var/log/apache2/access.log.1 | grep -v feed | wc -l
702

This reduces the percentage to 9‰.

So, if we redirect feed requests to files and use a cron job to produce some of them, the 304 NOT MODIFIED response seems to be something we can do without, even if I think it ought to work.

– AlexSchroeder 2015-10-09 14:54 UTC


In other words, no noticeable performance boost? Do I read it right? But then why bother?

– AlexDaniel 2015-10-09 21:26 UTC


Hehe, indeed. The point is, however, that I want some sort of plan that will allow me to incrementally develop a solution. Mojolicious::Plugin::CGI does a lot of what I want. It integrates into Mojolicious and thus it can do logging, forking, and so on. It handles input and output. The only thing that’s missing is that it exec’s the script – loading Perl and compiling all the modules on every request.

I think I’ll try and modify the Plugin for my purposes. Then it’ll require Oddmuse once and just run DoWikiRequest on every request, mod_perl style.

– AlexSchroeder 2015-10-10 07:40 UTC


These are the changes I had to make to Mojolicious::Plugin::CGI: Add run option for a code reference and Make sure the status code is actually used and Add HTTP_IF_NONE_MATCH to environment.

This is the new server script I used:

#! /usr/bin/env perl

use lib '/Users/alex/src/mojolicious-plugin-cgi/lib';

use Mojolicious::Lite;

plugin CGI => {
  support_semicolon_in_query_string => 1,
};
 
plugin CGI => {
  route => '/wiki',
  script => 'wiki.pl',
  run => \&OddMuse::DoWikiRequest,
  before => sub {
    $OddMuse::RunCGI = 0;
    $OddMuse::DataDir = '/tmp/oddmuse';
    require 'wiki.pl' unless defined &OddMuse::DoWikiRequest;
  },
  env => {},
  errlog => 'wiki.log', # path to where STDERR from cgi script goes
};

get '/' => sub {
  my $self = shift;
  $self->redirect_to('/wiki');
};
 
app->start;

– AlexSchroeder 2015-10-11 06:51 UTC


With the above setup now installed on alexschroeder.ch, I’m getting response times of 150–230ms when looking at /wiki/About (and a 304 Not Modified response). The old CGI setup under /wiki2/About is giving response times of 250–720ms.

So, much better?

I’ve also started noticing the first signs of trouble: Edit page, save, look at it (looks good), edit page again and notice that it’s showing the old text, not the new text.

– AlexSchroeder 2015-10-11 10:28 UTC


When I tried it with this page, I saw my browser requesting the page using the following:

GET /wiki?action=edit;id=Comments_on_2015-10-09_Oddmuse_and_Mojolicious HTTP/1.1
...
If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com

Oddmuse replied with a 304 Not Modified and the content was wrong. As I checked, however, the timestamp of the index file does in fact match:

alex@kallobombus:~/alexschroeder$ date -r pageidx +%s
1444395217

Looking at the log of recent changes, however:

alex@kallobombus:~/alexschroeder$ tail -n 1 rc.log
1444559479Comments_on_2015-10-09_Oddmuse_and_Mojolicious1With the above setup now installed on alexschroeder.ch, I'm getting response times of 150–230ms when looking at wikiAbout (and a 304 Not Modified response). So, much better? 127.0.0.1AlexSchroeder23en

I guess something about TouchIndexFile isn’t working.

sub TouchIndexFile {
  my $ts = time;
  utime $ts, $ts, $IndexFile;
  $LastUpdate = $Now = $ts;
}

I’ve made sure that all the files belong to alex.alex instead of www-data.alex. And that seems to help. After saving:

alex@kallobombus:~/alexschroeder$ date -r pageidx +%s
1444560771
alex@kallobombus:~/alexschroeder$ tail -n 1 rc.log
1444560771Comments_on_2015-10-09_Oddmuse_and_MojoliciousWhen I tried it with this page, I saw my browser requesting the page using the following: {{{ GET wiki?action=edit;id=Commentson2015-10-09OddmuseandMojolicious HTTP1.1 … If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com }}} Oddmuse replied with a 304 Not Modified and the content…127.0.0.1AlexSchroeder24en

And the next request:

GET /wiki?action=edit;id=Comments_on_2015-10-09_Oddmuse_and_Mojolicious HTTP/1.1
...
If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com

HTTP/1.1 200 OK
...
Etag: 1444560771%1e1%1eAlexSchroeder%1ekensanata%40gmail.com
...

Yay?

– AlexSchroeder 2015-10-11 10:52 UTC


OK, added one final patch to make it work without having to use the -nph option for the CGI library and submitted a pull request. And I installed it for this site as well. “Eat your own dog food,” and all that.

– AlexSchroeder 2015-10-11 12:41 UTC


Wow, many more commits after talking to the maintainer.

– AlexSchroeder 2015-10-11 16:14 UTC

Add Comment

2015-10-02 RPG Web Apps I Have Written

I’m trying to make a list of web apps I have written for role-playing games...

If you like what I’m doing, you can sponsor future web apps via Patreon or just send some money to kensanata@gmail.com using PayPal.

Tags:

Comments on 2015-10-02 RPG Web Apps I Have Written

I think that you forgot to mention Gridmapper.

– AlexDaniel 2015-10-03 16:26 UTC


Oops! Thanks, added.

– Alex Schroeder 2015-10-03 22:16 UTC


And I have finished rewriting the Character Generator as a Mojolicious::Lite application and both the Face Generator are now running as two apps within a Toadfarm, and Toadfarm is beeing monitored by Monit. I think I’m happy now!

– Alex Schroeder 2015-10-05 07:35 UTC

Add Comment

More...

Comments


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Just say HELLO