Snake with Python 3 + Qt 5

June 10, 2016 [Games, Programming, Programming Languages, Python, Videos] Series: Groovy, Ruby, BASIC, Dart, Elm, Python3+Qt5 I’m writing a Snake game in multiple programming languages, for fun, and to try out new languages. Python 3 breaks compatibility to fix some bugs – is it worth it? Qt 5 continues to offer more features – can…

Shutdown Firefox properly, to avoid crash/session dialogs

June 16, 2016 [Tech] I usually have multiple Firefox profiles open, and when I log out without closing the Firefox window, I get a “session restore” dialog on the next login. This is due to Bug 336193 which says that Firefox should shutdown gracefully when it receives a SIGTERM signal, which happened when I logged…

Ambiguous name in Java due to non-normalized unicode – but everything is fine in Python

August 11, 2016 [Java, Programming, Programming Languages, Python] In Java and some other languages, identifiers (e.g. method names) are allowed to contain unicode characters. Unfortunately, some unicode character combinations are logically identical. For example, á (one character: Latin Lowercase a with Acute U+00E1) is the same as aÌ (two characters: Latin Lowercase A U+0061, and…

Elm’s resizable SVG canvas fills the screen

August 26, 2016 [Elm, Games, JavaScript, Programming, Programming Languages] I’m toying with writing an SVG-based game in Elm (a nice looking JavaScript replacement), and I want an SVG that takes up the entire screen and resizes when the screen is resized. I found this to be more difficult than I expected, so here’s what I’m…

A simple example of using Netty 4

September 15, 2016 [Java, JavaScript, Programming, Programming Languages] I feel like the title of this post is too promising, because I can’t come up with an example that I think is simple. Anyway, here’s a minimal example of how to use Netty to create a server that replies to whatever you say: NettyExample.java: import io.netty.bootstrap.ServerBootstrap;…

How to write a programming language – Part 1, The Lexer

September 24, 2016 [Programming, Programming Languages, Python, Tech, Videos] Series: Lexer, Parser, Evaluator I wrote a little programming language, Cell which should be simple enough to help explain how a programming language works. The following is an explanation of the lexer which is the first part of the compiler or interpreter. Slide: How to write…

Mousedown events are delayed or laggy on mobile devices

September 30, 2016 [Elm, JavaScript, Programming, Tech] I learned about Elm and web applications by writing a little game called sootl. They’re all SVGs animated with requestAnimationFrame(), and you control the player by clicking or touching the screen. Everything seems fine in desktop browsers, but in mobile browsers it takes a long time to trigger…

How to write a programming language – Part 2, Parsers

09 October 2016 [Programming, Programming Languages, Python, Tech, Videos] Series: Lexer, Parser, Evaluator My little programming language, Cell (Cell Elementary Learning Language) is designed to be simple. I want to use it to explain how to write a programming language. The parser is only 81 lines long, so hopefully it’s not too hard to understand.…

Basic Haskell project setup (unit testing, code, formatting)

October 14, 2016 [Haskell, Programming, Programming Languages] To start a programming project, we need to be able to create, format code, and run unit tests. Here’s what I’ve found to be a reasonable starting point for a Haskell project. Complete code: hunting example. To create and run a test, just do: make setup make test…

How to write a programming language – Part 3, Evaluator

October 16, 2016 [Programming, Programming Languages, Python, Tech, Videos] Series: Lexer, Parser, Evaluator. Finally, we get to the real magic of the little language I wrote (Cell) – the evaluator, which takes a syntax tree and finds the actual value, in the context of the “environment”: the symbols defined around it. Slide: How to write…