Saturday, April 23, 2016

A few quick notes on trying out Windows 10 WSL (Windows Subsystem for Linux)

I had a chance to play with the Ubuntu userspace support in Windows 10 recently. I started with Windows Insider Preview build 14295 from MSDN, enabled the "Fast Ring" for Windows Insider updates, and then updated to build 14316 and activated the subsystem. After rebooting, running bash from PowerShell installed the Ubuntu base image.

The first use case was building the APR 1.6.x tree from svn and running the test suite. The build was uneventful and most testcases pass. From looking only at the test suite output, it seems that Sys V semaphores and the FREEBIND socket option aren't implemented, epoll isn't close enough to Linux, sendfile isn't close enough to Linux, and perhaps something about file locking isn't close enough. That's not so bad all in all. I think the next steps here are to identify some particular discrepancy from Linux, report it, and see if they bite. Separately, setting some ac_cv_FOO variables might be close to enough to get the testcases to run completely (e.g., use poll() instead of epoll(), use a different default proc mutex, etc.).

The second use case was trying out a Python+Django+PostgreSQL project, checking if it is usable and test suites for some projects I work on pass. (Such code "should" work fine on native Windows given enough time to mess around with installing different server software, getting native Python extensions to compile, etc. Yuck.) Unfortunately, the lack of SysV IPC breaks PostgreSQL setup. (See this GitHub issue for the PostgreSQL failure and this suggestion for supporting SysV IPC.)

So what is the point of WSL, for me at least?

  • Garbage collect the last 3 or so ways to get Unix-y stuff running on Windows and make the installation and update effort for such tools largely disappear (apt-get). (I.e., greatly improve the theoretical best-of-both-worlds development setup.
  • Improve some use cases for the occasional savvy Windows-bound consumer of <dayjob>, which would require being able to install a Django application using the same Ubuntu and Python packages and the same setup instructions as on Ubuntu, in order to run management commands and maybe occasionally use the dev server for testing very simple changes.
  • Have something new for me to yell at OS X users with broken tools who have been ignoring my pleas to install an Ubuntu VM.


Saturday, April 16, 2016

Brief notes on replacing the HD in an Asus M32CD with SSD

The goal: Clone the Windows 10 OS partition from the original 1GB hard disk to a new 480GB Crucial SSD

The 'net said to use the Clone feature of Todo Backup Free 9.1. I tried. The clone didn't work. Both the sector for sector copy and the SSD optimize options were selected. The problem symptom after switching cables was that the machine didn't boot but instead loaded the Asus BIOS screen. (What may have been different for me: GPT instead of MBR, the particular arrangement of partitions on the 1TB source drive, user error, etc.)

The 'net said to use AOMEI Partition Assistant Standard Edition. I tried. This free version does not support GPT partitions, so it wouldn't do anything. I didn't pay up to get the version that does.

The 'net said to use Paragon Migrate OS to SSD 4.0. PC Magazine had a review that suggested that it would be easy to use for my situation. (That is not different than what I read before about other solutions.) I paid the $19.95. It just worked, no drama. Done.

Thursday, February 4, 2016

Your Errata Submission for ...

My phone screen flashed earlier this a.m. with the reception of e-mails indicating that a couple of fixes for typographical errors which I submitted some time ago for Fluent Python have been accepted by the author. I was motivated to submit them because of the near-perfection of the book, beautiful in concept and in implementation; it was my opportunity to help maintain a wonderful work. Just as importantly, the publisher made it easy.

The contribution of a quotation mark and a two-letter English word to a 740-page book is hardly remarkable. It is instead what is now an ordinary task made easy by the Internet — the same Internet that contributed immensely to the creation of the book in the first place, from the development and popularity of the subject matter of the book to the tools which were used to create it to the ability of a publisher to interact with more authors to the electronic marketing and commerce which resulted in my purchase.

This is not unlike the creation of the software we all use daily. A large amount of it has the mark of a company but it relies to a tremendous extent on open source software, easily obtained, usually easy to contribute to, and truly ubiquitous even in so-called proprietary software with which we interact. It works because of countless contributions big and small from developers all over the world, using collaboration methods made easy by the Internet. Ease of collaboration enables contributions which have further eased collaboration (not to mention the rest of electronic life), and the software industry is built on the result.

It is time to close the door on what has been called open source strategy, as the use of open source software and the need for strategies for appropriate consumption of the software and interaction with the communities has invaded even the darkest corridors of proprietary software development and become business as usual. All software projects are a fusion of open source and custom-built components, whether or not everyone involved acknowledges it.

I look forward to a refresh of my electronic copy of Fluent Python with the latest corrections. But since submitting those fixes to the book text, I've collaborated with a handful of open source projects in the Django ecosystem for the first time and seen most of my small contributions there accepted; I am still watching some of those for feedback from the project maintainer or for inclusion in a new release. Those contributions were an important day-job activity, enabling features that our customer requested which didn't quite fit into the existing application.

Possible upcoming book contribution — convince the Two Scoops of Django authors to rework their claim that you can't pass environment variables to Django apps running with Apache httpd :) I'm sure they think that Apache+Django implies mod_wsgi, and I guess it is not fun to pass through OS-level environment variables in that configuration. My 2 cents on that matter: Deploying Python Applications with httpd (PDF)

Monday, October 5, 2015

cmake Windows nghttp2

This is just a web-search-findable note that I have an initial implementation of nghttp2 cmake-based build support for Windows (just the core library), at See the note on future plans for issues I hope to resolve soon before I submit it to the nghttp2 project.

Tuesday, August 11, 2015

Tuesday, January 27, 2015

Today's Python homework

The card I gave myself today says "Read Python language docs until I have written down 10 new things." Why? Somebody pointed out that var = val or '-' was cleaner than the mess I used instead, and I realized that much more effort is required. (Were it Perl, I'd probably have used or '-', but I can't always keep the features of the different languages straight.)

Here's today's list, which includes some things I'm familiar with in Python or other languages but can't pull out of a hat on demand.

  1. The file is UTF-8: # -*- coding: utf-8 -*- (or UTF-8 byte-order mark or VIM-style coding string)
  2. Identifiers named _* are not imported by from module import *. (I knew that a leading _ is for privacy but I didn't realize it was enforced anywhere besides analysis tools. But I don't think I use from module import * except with cascaded Django settings.)
  3. Identifiers named __* are class-private, and this is essentially enforced.
  4. Wow, combining string prefixes, as in ur or br, is new to me, as is using upper case string prefixes, such as R, bR, etc.
  5. I forgot about escape sequences for Bell, Backspace, Formfeed, and Vertical Tab, and never knew about \N{name-of-Unicode-character}. (I probably didn't know about octal escape sequences in Python either.)
  6. I don't always use whitespace to concatenate string literals, though I should where applicable.
  7. complex literals — 3.14j, 3.14e-10j
  8. ^ operator, for XOR
  9. the NotImplemented single-valued type, for returning from certain methods
  10. the Ellipses single-valued type, for indicating the presence of the ... syntax in a slice

Saturday, August 2, 2014

Google App Engine: skipping complete directory via skip_files

I forgot all about the skip_files in app.yaml and asked my favorite search engine what to do. A number of the top pages returned made it unnecessarily complicated. Just do this to skip directories (.idea and tools in this example):

- ^(.*/)?#.*#$
- ^(.*/)?.*~$
- ^(.*/)?.*\.py[co]$
- ^(.*/)?.*/RCS/.*$
- ^(.*/)?\..*$
- ^\.idea$
- ^tools$

(These are top-level directories within my app engine project.)

Add -v to your ... update ... invocation to confirm, from messages like

2014-08-02 09:19:20,424 INFO Ignoring directory '.idea': Directory matches ignore regex. 
2014-08-02 09:19:20,425 INFO Processing file 'app.yaml' 
2014-08-02 09:19:20,426 INFO Processing file 'index.yaml' 
2014-08-02 09:19:20,426 INFO Processing file '' 
2014-08-02 09:19:20,426 INFO Ignoring file 'main.pyc': File matches ignore regex. 
2014-08-02 09:19:20,426 INFO Processing file '' 
2014-08-02 09:19:20,427 INFO Ignoring directory 'tools': Directory matches ignore regex. 
2014-08-02 09:19:20,429 INFO Processing file 'static/Chart.min.js'