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' 

Friday, August 1, 2014

Another year (or two), another release of mod_whatkilledus and mod_backtrace

mod_whatkilledus and mod_backtrace V2.01

I have a sinking feeling that this isn't pertinent to a fairly large percentage of the world's inhabitants, but it was a fair amount of hours spread over time and it's finally done, so I'll pretend otherwise.

mod_whatkilledus improvements

  • The name of the log file can now be configured with the WKULogfile directive.
  • On Windows: Add directive WKUDisableWindowsErrorBox to allow disabling the pop-up error handling dialog after a child process crash.
  • On Windows: Handle exceptions in 64-bit builds.
  • With Event MPM on Unix: When building with httpd 2.4.10 or later, properly track request processing across threads with the Event MPM. Previously, the wrong client and/or request might be logged as the trigger for a crash (with the Event MPM only). The change is not effective when building with httpd 2.4.9 or earlier.

mod_backtrace improvements

  • Support libunwind on Linux, FreeBSD, and OS X. This provides better resolution of function names, so a raw address will be provided in lieu of the function name in fewer situations. (Add LIBUNWIND=yes to the make invocation.) OS X note: A libunwind build silently fails to capture a backtrace with 32-bit builds, so use the default mechanism with 32-bit builds on OS X.
  • Filter out internal functions from backtraces so that only the caller's stack frames are reported.
  • Improve formatting of a backtrace for the error log field.

Windows binaries

64-bit binaries are now included for use with httpd 2.2 and 2.4 on Windows. (32-bit binaries are still included.)

Build improvements

  • Support make APXS=/path/to/apxs for building with non-default install layouts.
  • Support Clang on FreeBSD 10.
  • Add -funwind-tables on ARM platform for better backtraces.
  • mod_whatkilledus fails to build in a less mysterious way when using an httpd build that doesn't have exception hooks enabled.

Friday, May 30, 2014

Is a script to run a command within a virtualenv missing from virtualenv?

Sometimes the python command in the virtualenv isn't quite enough.

Contents of script




. $envdir/bin/activate && cd $curdir && exec "$@"

This runs a specified command (plus arguments) in a particular directory within a particular virtualenv.

Example use:

$ crontab -l
30 0 * * * /home/trawick/myhg/apache/bin/ git/edurepo/envs/edurepo git/edurepo/src/edurepo python teachers/

July 4 update:

See also vex.