Skip to content

Instantly share code, notes, and snippets.

View kevinw's full-sized avatar

Kevin Watters kevinw

View GitHub Profile
extern "C" {static void release_wxTimer(void *, int);}
static void release_wxTimer(void *sipCppV,int state)
{
if (!wxIsMainThread()) {
wxpy_add_pending_delete(&sipType__wxcore_wxTimer, sipCppV, state);
} else {
wxpy_remove_pending_delete(&sipType__wxcore_wxTimer, sipCppV, state);
if (state & SIP_DERIVED_CLASS)
delete reinterpret_cast<sipwxTimer *>(sipCppV);
else
/*
* Interface wrapper code.
*
* Generated by SIP 4.8-snapshot-20090409 *
*
* copyright 2008 Kevin Watters
* released under the wxWidgets License
*/
#line 19 "src/wx.sip"
#include "stdwxpy.h"
/*
* SIP library code.
*
* Copyright (c) 2009 Riverbank Computing Limited <[email protected]>
*
* This file is part of SIP.
*
* This copy of SIP is licensed for use under the terms of the SIP License
* Agreement. See the file LICENSE for more details.
*
def test_subthread_delete():
app = wx.GetApp()
t, t2 = wx.Timer(), wx.Timer()
t.t = t2
t2.t = t
timers = [t, t2]
del t, t2
from threading import Thread
def subthread():
# -----------------------------------------------------------------------------
# f i l e B a s e O f ( ) -- Return base name of filename --
# ^^^^^^^^^^^^^^^^^^^^^^^
#
def fileBaseOf(filename,withPath=0) :
pos = filename.rfind('.')
if pos > 0:
>>> '%d' % 2.0
'2'
>>> '{0:d}'.format(2.0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: Unknown format code 'd' for object of type 'float'

I’d read Poul Henning Kamp’s amusing ‘what’s wrong with 1975 programming‘ rant (also, take a gander at this unrelated but good article by the same chap) and suddenly had a brainwave: linux implements ‘copy on write’ semantics for memory blocks when a process forks. That means that my database could just ‘fork’ when it wanted to save a checkpoint. The child process gets an unchanging copy of all of the memory, just for the cost of a page-table copy in the OS; any writes in the parent process just cause the OS to do all the work for us, and duplicate the pages that are changing. The child can checkpoint at its leisure.

Twenty years after my own graduation, I have come gradually to understand that the liberal arts cliché about teaching you how to think is actually shorthand for a much deeper, more serious idea: learning how to think really means learning how to exercise some control over how and what you think. It means being conscious and aware enough to choose what you pay attention to and to choose how you construct meaning from experience. Because if you cannot exercise this kind of choice in adult life, you will be totally hosed.

Script started on Wed Apr 13 13:25:23 2011
bash-3.2$ tmux
7[?47h[?1l>[?1000l]0;4:0:reattach-to-user-namespace - "kevin-watterss-macbook-pro.local"







bike to sausalito