Programming

Understanding Python's asyncio

How to get started using Python's asyncio.Earlier this year, I attended PyCon, the international Pythonconference. One topic, presented at numerous talks and discussedinformally in the hallway, was the state of threading in Python—whichis, in a nutshell, neither ideal nor as terrible as some critics wouldargue.

Python's Mypy: Callables and Generators

Learn how Mypy's type checking works with functions andgenerators.

Finishing Up the Bash Mail Merge Script

Finally, I'm going to finish the mail merge script, just in time forReplicant Day.

Python's Mypy--Advanced Usage

Mypy can check more than simple Python types.In mylast article, I introduced Mypy, a package that enforces type checking inPython programs. Python itself is, and always will remain, adynamically typed language. However, Python 3 supports "annotations", afeature that allows you to attach an object to variables, functionparameters and function return values. These annotations are ignored byPython itself, but they can be used by external tools.

Build Your Own Internet Radio Receiver

Tune in to communities around the world with the push of a button.When I get home at night, I like to tune into the world with the pushof a button. I've lived in lots of different places—from Dunedin,New Zealand, to Santa Fe, New Mexico—and in each town, I've come to lovea radio station (usually a community radio station) that embodiesthe spirit of the place. With the push of a button, I can get a bit backin sync with each of these places and also visit new communities, thanksto internet radio.

Introducing Mypy, an Experimental Optional Static Type Checker for Python

Tighten up your code and identify errors before they occur withmypy.I've been using dynamic languages—Perl, Ruby and Python—formany years. I love the flexibility and expressiveness that suchlanguages provide. For example, I can define a function that sumsnumbers:

What The @#$%&! (Heck) is this #! (Hash-Bang) Thingy In My Bash Script

 You've seen it a million times—the hash-bang (#!) line at the top of a script—whether it be Bash, Python, Perl or some other scripting language. And, I'm sure you know what its purpose is: it specifies the script interpreter that's used to execute the script. But, do you know how it actually works? Your initial thought might be that your shell (bash) reads that line and then executes the specified interpreter, but that's not at all how it works. How it actually works is the main focus of this post, but I also want to introduce how you can create your own version of "hash-bang" if you're so inclined.

Linux...Do It for the Children

A rundown of some fun and educational Linux software for kids.I'm probably going to regret that title. I've been making fun of thosewords, "do it for the children" for years. It's one of those "reasons"people turn to when all else has failed in terms of getting you to sign onto whatever lifestyle, agenda, law, changes to food—you name it. Hearingthose words draws the Spock eyebrow lift out of me faster than you can say,"fascinating".Okay, pretend that I didn't start this article with that comment. Let's trythis instead.

The Kids Take Over

As with Linux, these kids are all about making things—and then making thembetter. They're also up against incumbent top-down systems they will reformor defeat. Those are the only choices.

Fun with Mail Merge and Cool Bash Arrays

Creating a sed-based file substitution tool.A few weeks ago, I was digging through my spam folder and found an email messagethat started out like this:

Text Processing in Rust

Create handy command-line utilities in Rust.This article is about text processing in Rust, but it also contains aquick introduction to pattern matching, which can be very handy whenworking with text.Strings are a huge subject in Rust, which can be easily realized bythe fact that Rust has two data types for representing strings as wellas support for macros for formatting strings. However, all of this alsoproves how powerful Rust is in string and text processing.

Considering Fresh C Extensions

Matthew Wilcox recently realized there might be a value independing on Cextensions provided by the Plan 9 variant of the C programming language.All it would require is using the -fplan9-extensions command-lineargument when compiling the kernel. As Matthew pointed out, Plan 9extensions have been supported in GCC as of version 4.6, which is theminimum version supported by the kernel. So theoretically, there would be noconflict.

Programming Text Windows with ncurses

How to use ncurses to manipulate your terminalscreen.

Converting Decimals to Roman Numerals with Bash

Decimals to Roman numerals—here we hit all the limitations of Bashshell scripting.

Introductory Go Programming Tutorial

How to get started with this useful new programming language.

Python Testing with pytest: Fixtures and Coverage

Improve your Python testing even more.

More Roman Numerals and Bash

When in Rome: finishing the Roman numeral converter script.In my last article, I started digging in to a classic computer science puzzle: converting Roman numerals toArabic numerals. First off, it more accurately should be called Hindu-Arabic, and it's worthmentioning that it's believed to have been invented somewhere between the first and fourthcentury—a counting system based on 0..9 values.

About ncurses Colors

Why does ncurses support only eight colors?If you've looked into the color palette available in curses, you maywonder why curses supports only eight colors. The curses.h include filedefines these color macros:COLOR_BLACKCOLOR_REDCOLOR_GREENCOLOR_YELLOWCOLOR_BLUECOLOR_MAGENTACOLOR_CYANCOLOR_WHITEBut why only eight colors, and why these particular colors? At least with the Linuxconsole, if you're running on a PC, the color range's origins arewith the PC hardware.

Testing Your Code with Python's pytest, Part II

Testing functions isn't hard, but how do you test user input and output?In my lastarticle, I started looking at "pytest", a framework for testing Python programsthat's really changed the way I look at testing. For the first time, I reallyfeel like testing is something I can and should do on a regular basis; pytest makesthings so easy and straightforward.

Testing Your Code with Python's pytest

Don't test your code? pytest removes any excuses.Software developers don't just write software; they also use software. So,they'rethe first to recognize, and understand, that software is complex andinevitably contains bugs.