An argparse limitation with nargs="*" and choices=...
Suppose that you are writing a command where the user can specifyone or more additional things for the command to do, as commandline arguments. The basic command might be invoked as ' dothing ',but you can also run it as ' dothing also-a also-b ' (and variants).There are a limited set of valid additional things to do, and tryingto do anything else is an error.
On the surface, it looks like argparse can handle this:
parser.add_argument(
What I want in Vim with the mouse (and why I don't think I can have it)
I've recently been working on improving my vim environment, as partof getting better with it in general, and one of the things I'vebeen doing has been turning on its 'mouse in xterm ' support. Thisled me to a tweet :
I wish vim (in xterm) gave me better control over which mouse actionsit did special things for and which ones acted just like xterm.
Since Twitter is not the best place to explain this, time to elaborate.
What I want is for vim
Why semantic versioning is not going to solve all our problems
One of the things going around the programming community these daysis Semantic Versioning , generally shortenedto 'semver'. Semver proponents generally claim that faithfullyfollowing the semver dogma will solve all our version to versioncompatibility surprises and woes, or at least let us know aboutbreaking changes in things. The sysadmins in the audience areprobably laughing hollowly at this point, and we are completelycorrect to do so.
Recently I read Why Node Sass broke your code and SemVer ( via ),in which the team behind Node Sass
Some thoughts on Python 3 module APIs and Unicode conversion errors
After yesterday's concrete discussion I've kept thinking about some issues involved when designing Python3 module APIs for things that may run into Unicode conversion errors.I won't say I've come up with principles, but I do have a fewthoughts and ideas.
Let's suppose that you're dealing with some form of structuredexternal data, something that at least nominally has a specification;maybe a file archive format, or XML, or a network protocol, or thelike. The big
The various IDs of disks, filesystems, software RAID, LVM, et al in Linux
Once upon a time, you put simple /dev/sdX names in your /etc/fstab .These days that's boring and deprecated, and so there are a largenumber of different identifiers that you can use here. Since I justconfused myself on this today, I want to write down what I know andlooked up about the various levels and sorts of identifiers, andwhere they come from. What I care about here are identifiers thatare tied to a specific piece of hardware or data, instead
Python 3 module APIs and the question of Unicode conversion errors
I have a little Python thing to logMIME attachment type information from Exim ; as has been my practice forsome time, it's currently written for Python 2. For various reasonsbeyond the scope of this entry, today I decided to see if I couldget it running with Python 3. In the process, I ran into what Ihave decided to consider a Python 3 API design question.
My Python program peers inside tar, zip, and rar archives in orderto get the extensions of files inside them
Bourne's getopts sadly makes simple shell scripts more cluttered and verbose
A while back I wrote about how I wanted to use getopts more inmy shell scripts in order to have properreal option handling instead of faking it in bad ways. Recently Iwas modifying a few simple scripts that took arguments, so I decidedto do the right thing and switch them from simple hacks to getopts .This worked, but what it showed me is that simple use of getopts isgoing to make my scripts annoyingly more verbose.
Imagine that I have a script that takes a single option that canchange
Phones and tablets are going to change what sort of passwords I use
For a fairly long time now I've been using strong random passwordsfor websites and other Internet authentication needs ( as coveredhere ). These random passwords aregenerated from an alphabet of upper case, lower case, and numbers;a typical twelve-character one is Hx35n7uVmTaS (I have a scriptthat generates a few of them for me). Although cutting and pastingthem into browsers is the easiest and best approach, they work outokay even if I have to enter them by hand
My logic of blocking certain sorts of attachments outright
Once we started knowing more about what sort of attachments ourusers get (both good and bad), as we now do ,we drifted into the obvious next step of starting to block some ofthem. Our current set of blocks are conservative and have basicallybeen drive by seeing what our commercial anti-spam package already dislikes. Is it identifying basicallyeverything with a single .js file in a ZIP archive as bad? Well,let's just go ahead and block those outright.
Now, there's
Why ZFS L2ARC is probably not a good fit for our setup
Back when I wrote up our second generation of ZFS fileservers , I mentioned in an aside that we expectedto eventually add some L2ARCs to our pools. Since then, I've startedto think that L2ARCs are not a good fit for our particular andsomewhat peculiar setup. The simple problem is that as far as I know,there is no such thing as a L2ARC that's shared between pools.
The easy and popular way to think about L2ARC is right there in