python coroutines and generators

3.26: adda/type/streams/python coroutines and generators:
. after seeing python's coroutines and generators,
I was noticing that its function's signatures weren't explicit;
the syntax for generating coroutine should be:
f(x.stream.t1).stream.t2 .
. this tells you that when you pass f a file, x, of type t1,
it keeps reading units until you close x,
and it expects to be assigned to a stream,
which it continues to write to until f's input is closed .
y,x: stream; y`= f(x);
-- this causes f to function its stream .
. readers wait if x`item = eof
until there's a value to read .

packages compared to types

3.23: adda/type/packages compared to types:

. when were child packages needed by ada?
when you want to extend an existing package .
. the point is to reuse the parent package's object
without having to recompile .
. the child's object has links to the parent's object .
. parent package can be compared to supertypes;
they can use the same is.section syntax
to express the {super, parent} relation .

. adda records are not quite like ada packages,
so let us use the terms {record vars, record types};
record types allow you to include vars and subrograms
into an activation record;
each inclusion creates new instances of the vars .
. a record var at top level may be shared by
2 or more concurrently running subprograms .
. safely sharing a var requires the use of
a task's command queuing system .

. it seems possible to merge records and tasks;
ie, they don't need to differ in syntax;
every subprogram can be viewed as an entry;
and the default method for handling entry queues
is to select the queue with the longest line .
. if the compiler sees that vars aren't shared,
(ie, there is no sharing a top-level record instance,
then the optimizer can replace the queue with a direct call ).

sections in typedef for {use, is, has}

3.23: adda/oop/syntax/sections for use, is, has:
<use ,,,imports;
is ,,,supertypes; -- establishing type compatibility .
has ,,, subtypes;
... .
the use.section:
. why would an interface need to import a module?
they may refer to types other than self
that are not in the top-level library .
the has.section:
. a supertype has or controls its subtypes;
eg, number has all of these types:
int, real, quotient, complex, modular .

library mgr preparing code for export to public

3.23: adda/library mgt/preparing code for export to public:
. should adda use the python module system?
. the problem python has is a rapidly changing system library;
often times the system will choose the same name as
some private user modules,
so unless you have separate namespaces for {system, user}
the system space will likely engulf part of existing user space,
thereby changing the meaning of some older programs,
at least if user's upgrade their system library .
. the library mgt should take care of this:
when you upgrade the system,
it tells you whether the new system is clashing with your library .
. if you export your code for public use,
it makes sure that your references to local modules
include the url where that module's source code is kept .
. if there is no url, or you modified the code,
then the library makes sure your export
includes the local source code .
. the export also needs to indicate
the current version of the system module
so then when a library mgr is importing a module
it has to find a compatable system to place the new module;
and it has to check for library conflicts,
where the current compatible system
has the same names as some of the modules being imported,
in which case it has to rename the user modules,
and patch all references .

(be) is return statement for declare blocks

3.20: adda/cstr/declare expression/be stmt:
. adda's declare blocks can be expressions,
so they should have their own return stmt
that means what the declare block is returning
rather than what the enclosing function is returning .

unifying generators with function literals?

3.11: adda/syntax/unifying generators with function literals?:

f^(3)(x) = f f f x -- power of a unary operator;
* (^ i:1..3  ) = 1 * 2 * 3 -- power of a binary operator
= *(1,2,3) -- that is the same as operator applied to a list,
-- and the list was generated with a power of a parenthetical .
{^ x,y:R . y=f(x) and ... ? (x,y) }
= { (x1,y1), ... }
= {x1:y1, ....} -- a function
. the list generating needs to be
integrated with the function literal,
so how are they alike?
the function literal is implicitly describing a set of points:
f(x.1..3).t: '(x+1)
= { (1, 2), (2,3), (3,4) }
= {^x.1..3 . (x, x+1) }
. but do we want our function literal to be
this: {^x.1..3 . (x, x+1) } ?

. the power operator is simplest to understand
just the way it is;
here is a new idea for the function literal:
( f(x.1..3).t: '(x+1); f ) -- returns a function .
( (x.1..3).t . x+1 ) -- returns the same function .
. when we define function this way:
f(x.1..3).t: '(x+1),
its literal is implicitly declaring the type of function it is,
the explicit way to do that is with a 2 part parenthetical;
the first part specifies a function type .
. another idea that might be simpler to remember is
( (x.1..3).t: x+1 ).
. when the function was named (f)
then the (:) was saying
the way to eval f, is this; so, likewise,
when a list starts with a function type,
the (:) is telling you how to eval this function .

. instead of having to quote the function literal,
just the fact that it's typed as a function,
should mean that the quote is implicit .
. if that's not what you mean,
you can use the eval operator (!) .

. now that we have ( typeid: value ),
we can generalize that
as the syntax for type conversions?
no, that would be confused with typdef;
so, use the dot or some new operator, like (::) ?

. instead of this: {^x.1..3 . (x, x+1) },
we have power raised to the type,
so this: {^ (x.dom).rng |  y= x+1) };
but doesn't this have to fit in with the idea of
the power's arg' being the index variable?
* (^ x.range : f(x) )
-- this tells you nothing about the list's type,
just that the function for generating the list
has an arg in the power var's range .
. nevertheless, this {^ (x.dom).rng |  y= x+1) };
serves the same purpose because,
it's providing the function's arg as an power variable,
and that power is what generates the list of function points .

. here is the syntax that should be used:
after the power (^) there is the variable or function,
and then there is the (:);
it seemed before that this would collide with
the ability to have more than one power var,
but in that case we use a parenthetical:
{^(x,y:N): x+y+global | predicates }.
. after the (:) comes an expression that generates a list value,
then comes the div (|) whose purpose is to weed the list,
ie, for {^x | is-even(x) }, if x is-even,
then it's allowed in the list .

. how would adda's list do something equivalent to
this python expression
where there are nested for-loops?:
for s in symbols
  for terminal in f(s)
    if s in grammar else [s]]
. the first for-loop is acting as the
generator's power var,
and then the next inner loop is a typical for-loop .
. but couldn't the for-loop be using the
same syntax as the power variable?
do they serve the same purpose ?
. well, (^x: f(x) ) means
(list = nil;
for x: list`append f(x);
be list),
. in the case of a function having a for-loop,
what's being appended is another list ?
but that would be describing a list of lists,
and that's not what we want .
. how about this:
(^ s in symbols, terminal in f(s):
s in grammar ? be terminal else be '(s) ).
. but if you have complex functions,
the most general way is, define f as a stream,
and then say (^y = f ).
or if f(x) is a stream,
then say (^x: f(x) );
eg, (^symbols:
for s in symbols:
  for terminal in f(s):
    s in grammar ? be terminal else be '(s)

pointerType ~ null

3.9: adda/syntax/type/pointerType ~ null:
. the syntax:
means a pointer type that excludes null values .
. that could be slightly confusing
since this(~) is a truth or set operation,
it could apply to the object instead of its type;
but since (var~null) trivially reduced to var,
it will never be used,
so we can assume it applies to the type .

wordcode that includes grammar trees

3.6: adda/wordcode/including grammar trees:

. not only can we be encoding all words,
but also have etrees (grammar trees) to the words
. we should reserve some ascii control codes for this,
since that will be common .

. relative addressing can reduce pointer size,
ie, the pointers can be byte sized
if we know that their base address
(the address they are relative to)
is no farther than 256 units from the
farthest place the pointer can indicate .
. thus to be byte sized,
we need to have a separate etree for every phrase
(delimited by semicolon  or period)
and we need to know that the size of phrases
will be less than 128 words
(there will be as many pointers as words,
and the first node may have to point into
the middle of the phrases text,
so it has to jump past all the pointers,
plus half the text).
. we can give the pointers more range by
making them relative to where the text begins .
. we could have a code that says
"( this is the beginning of an etree;
what follows is a link to the beginning of the text;
if the first byte of this link is a negative number,
then there's only one byte,
and its absolute value is showing
how many bytes ahead the text is;
it also says the etree's pointers are byte-sized .
. if the first byte is positive,
then the link is composed of 2 bytes,
showing you how far ahead the text is;
this also says the etree's pointers are 2-byte sized .]

. you can tell what a node's pointer is pointing at
by looking at the 1st byte of what it's pointing at:
if it's not the code for a node, then it's text;
therefore a node needs to have 3 parts:
a 1-byte node code, and 2 pointers .

. english syntax trees can have long tree nodes;
eg, (if * then * else * ) = 6 pointers in one node;
but, generally, all syntax trees can be reduced to
a sequence of minimal nodes (2pointers);
so one node code could mean
it's the non-end of a sequence,
and the other node could mean
it's the end a node sequence .
. but there is a more compact way:
we could have just one node code
followed by a 1-byte length field,
and that tells us how many pointers follow .
. or
if we have more codes to spare,
then we could have 5 node codes:
#1: 2pointers, (eg, the * )
#2: 3pointers, (eg, * unless *)
#3: 4pointers, (eg, if * then * )
#4: 6pointers (eg, if * then * else * )
#5: n-pointers -- the generic case:
it means the number of pointers is in the following byte .

varying numbers of parameters

3.5: adda/syntax/parameters/varying numbers of:

. if only some functions can accept lists
(varying numbers of parameters)
how do you define these functions?

. should we assume they are like numeric's args
where the {addition, multiplication}
is taking {2, or more} args,
while the {subtraction, division}
is taking only {1,2} args ?

. for the {1,2}-arg case,
we would define 2 args,
and then give one a default;
eg, here's numeric's division operation:
/(numerator.R`= 1, denominator.R).R
-(minuend.R`= 0, subtrahend.R).R

. for the {2, or more}-arg case,
the (...)-symbol would be used;
eg, here's numeric's multiplication operation:
*(x1.R, x2.R, ...).R .

. when dealing with a list (...) of args,
we need some way to refer to items of the list,
or we can let the user name the list ?
*( x1.R, x2.R, ... xn.List(R) ).R
. that says any other params beyond 2
will be placed in a list named xn .

. we can do Python's idea of args like this:
( x1., x2., ..., xn.List, fn.Map)
-- now any extra values are put in xn,
and any other named-param-associations are in fn .

signals are another dimension of interfaces

3.5: adda/cstr/signals/another dimension of interfaces:
. pyqt's connector lets an object's method
emit a message to a notification center,
which then relays the signal by launching an instance of
"(on signal do call this list of functions
which can include emitting an object's signal;
use qobject`connect to add to the todo list
of a signal of some object ).
. signals are like gui's mousedown(coords) event,
which means it emits a signal to the eventqueue,
and you can respond to events by connecting the signal
to your subprogram named:
[what I do when a mousedown happens].
this works like a framework class
where it has methods for you to define
so it knows what to do for you .
. they are a new control system
more similar to exceptions than to object functions .
in fact an exception is a special kind of signal
just as a task type is a special kind of datatype .
. I like to think of object communications in human terms
like telephones and mailboxes;
emitting a signal is like publishing a newsletter;
people can subscribe to your newsletter
by naming a mailbox .
. then that address will be just for that newsletter,
and you have one of your staff there (a subprogram)
waiting to respond to what that newsletter says .
. this responder subprogram is called a slot .
. a list of publishings can be seen as a
dimension of a type's interface
except that rather than being a type member's requirement,
it explains what is expected of clients of the type's members;
ie, part of the type's service is
keeping you uptodate with these newsletters .

3.23: adda/cstr/unify exceptions, dialogs, and signals:
. a dialog is like a gui dialog:
the caller provides a callback
and if the callback comes back before a timeout error
then the server continues
else it does a dialog-failed exception .
. the exception works like ada's:
it signals a failure (type, details), and then terminates .
so the block's exception catching part
should look like the signal catcher parts :
they are both interrupt handlers .

getters and setters

3.3: adda/oop/getters and setters:
. they are always using implicit getters and setters,
so what is the syntax for redefining them?
. needs some way in the body
to differentiate var from function:
x:  'o.x; -- the default getter,
x`=(i): '(o.x`= i ) -- and setter .
. this assumes '(o) is the name of the instance;
in python this is called self .

parser uses string descriptors

3.3: adda/translate/parser/use string descriptors:
. one way to parse a string
is use the lexical analyzer to find the relevant substrings,
and then make lexical nodes that point at copies of string;
the way I'm thinking of now
uses string descriptors instead of copies:
put the string in an array of characters,
and then a descriptor is an index into that array,
along with intended length .
. the advantage to this way is that
if the parser gets confused,
a repair algorithm can work with the result
searching not only the tree,
but also the string,
and seeing how they relate .

comparing tasks to types

adda/co/comparing tasks to types:
. how is a task like a class?
do they both use < ... >? [3.4: .... yes]
. records and tasks can both be anonymous types:
C.type: (im,re:R);
x.C; y.(im,re:R);
x`= y; -- y is an anonymous type .
mytasktype.type: co<...>;
x.mytasktype; y.co<...> .
. the name: "(task type) says it all:
it's just a type but with
the added dimension of concurrency .
. a type defines an interface,
an instance defines an object that is
following its type's interface,
and the instance implicitely belongs
to some particular process .
. in the case of a task object,
it is its own process .
. conversely, non-task types can have
all the same appearance internally
as a task does:
because, they can handle messages async'ly,
so, instead of being called,
they can be accepting order records,
then they can prioritize the order records,
according to who called and what they asked for .

unifying tasks and protected types

adda/co/unifying tasks and protected types:
. task type and protected var can be unified?
. just as a type can define components,
a task type can have the same components
but featuring atomic getters and setters .
. in the spirit of Ada protected var's,
the component acesses have the highest priority
so that clients aren't having to be suspended
just to share a variable .
. the task type can have other subprograms
but they stop what their doing in order to
get these protected var accesses serviced .

component selector syntax

adda/syntax/component selector:

3.2: colon:
. the colon is part of the internet syntax;
if it were used for components,
then dots would mean only typedef syntax,
there's already a precedent for being picky about spaces .
x: y is the label,
x:y is the component selector .
. the way internet uses dot notation is the selection of names not components .
. people who know mac paths will be familiar with x:y .

3.3: colon and comma are out:
. the most popular english meaning of (:)
is for labelling {is a, is naming};
so, if using it like mac did, for component selection,
then it has 2 fundamentally different meanings,
which would be confusing .
. also, so what it's like the internet use?
no popular urls use the colon specifier .
. what about the comma?
there's already a precident of the comma in numbers separation;
yes, but it's insignificant being optional,
it's like the apostrophe,
to be left as an english style of variant spelling .

3.3: backslash:
. another symbol with a meaning similar to (/) is (\);
because, that is microsoft's folder divider,
so it is being seen popularly as either nothing
or as a component selector .
. here's a memory aid:
(a\c) : look down for built-in components,
(a/c) : look up and outward by pointer for modular component .
. but consider how often components are used,
and how much easier (.) is to find on the keyboard than (\).

3.3: apostrophe is out:
. the apostrophe might be easily remembered as
doubling as english's possessive mark;
ie, components belong to the aggregate,
hence, (aggregate'component) would read as
aggregate's component .
. but the overriding reason for that understanding
is that apostrophe means a placeholder,
indicating that part of the name's spelling is missing
(ie, aggregate's = aggregate has).
. that's why (`), rather than the apostrophe,
is used for oop's possessive mark:
the apostrophe is part of many english spelling,
so we should use something other than the apostrophe
to represent our possessive operator;
the backquote (`) was chosen because
it looks like apostrophe ('),
which is  often representing possession .

3.3: backquote is out:
. the reason for not using (`) for components
is that oop's possessive has different semantics:
. say (.) is the component selector,
then x.f() means x is a record containing a function;
whereas, x`f() means that if x is a variable of type T,
then T has a function f that has an implicit inout parameter;
so, x`f() is similar to f(inout x) .

3.3: applies to activation records:
. how is the nested subroutine like a component?
save the (\)-syntax for that if they differ .
. the function body is like a record
because its local var's are its components .
records are like Ada packages,
in that their components can be functions,
and within the record's body
we put the bodies of its function,
along with any local var's that will be global to them,
but inaccessable by the user of the record .
. a function's signature and body defines an
activation record (after elaborating params and locals).
. an assignment can replace
the initial value of a function's component,
so there are reasons to have this syntax .
. so we have: f.component,
vs a call to f (f arg)
vs (f), the unbound or unactivated function .
. the syntax ( x. ) should be reserved for
defining the any-type local, often used in generators,
and duck typing .

subfiler after learning some Python


2.23, 3.15: intro:

. this subprogram inputs a file with subfile syntax:
ie, a file can represent a folder containing files
(files within files, hence the term subfiles).
. each file having the expected subfile syntax
starts with a datestamp-label,
and then a title representing the folder's pathname,
. each subfile should have a datestamp;
if its title is not already preceded by a datestamp,
the date to use is that of the previous subfile,
else that of the top-level title;
it's an error if the top-level title has no date .
. within a subfile, the timestamps don't matter:
they are internal to the subfile,
and are not to be applied to subsequent subfiles .

3.29: version#batch mode:
. it has an input folder named subfiler/,
and if there is no report.txt file in that folder, it makes one,
if the report.txt is there, then it does the job:
for each file in subfiler besides report.txt
it makes a folder of the same name, and fills it with subfiles .

version#interactive mode:
. it displays what it understands to be the folder structure,
and gets the user's ok to do one of the following:
# do nothing,
# create a folder of the given structure,
# create the subfiles and do a filesystem merge .

2.23:  the displayed TOC (table of contents):
. the display shows a hierarchical relationship
by way of indentation; eg,
 . . . subfile#1
 . . . . . paragraph#1 1st line
 . . . . . paragraph#2 1st line
 . . . subfile#2
. it shows titles of each of the subfiles
along with first lines of any paragraphs
not assigned to separate files,
showing the relationship as a hierarchy with indentation .
. this assures the user that the parsing is correct;
no subfiles were mistaken for paragraphs,
and no paragraphs were mistaken as subfiles .

subfile naming strategy:
. for each file from the input folder,
it's creating a collection of files,
so, we have a choice of naming strategies .
. if we use names that start with the date,
then files within a topic can be sorted by date
-- the order in which ideas on the topic evolved .
. the file's modification date is meaningless,
showing only when the subfile was generated,
so the content creation date is noteworthy .
. more than one date? use the first date .
. if its name includes the entire pathname,
then later it can use the file's name to know
where in the obj folder system to put the file
(without having to open the file).
. perhaps the pathname should be reversed,
so that root is at the end .
if the filename exists,
add a number, looping until unique .
3.15: 3.25:
. each subfile has a title which is used for generating
a name for the file that the subfile will be stored in .
. it follows portability rules for filenames,
so it needs to strip out or replace all but ascii
alphanumerics, and ( , ; . );
some punctuations get transformed like so:
? -> " KA"
! -> " BANG "
: / \ | -> " l " -- lowercase L .

3.15: superfiles:

. the top of a file should have a date and title;
these are called the file`date and file`title .

. the file`date format is year.month.day;
the year has just 2 digits (eg, 12 means 2012 );
if the file`date's day =1 then the file`date is a generic:
it's telling you only the year and the month;
subsequent timestamps are of the format:
and, these are meant to give the actual day .
. if subsequent timestamps include the year,
it's because the file's dates are spanning multiple years .
. when sending the subfiles to their separate files,
this app should be prefixing the titles with full datestamps,
(ie, including the year) ].

. the file`title shows where in the filesystem
the subfiles need to be placed,
eg, for the name: adde/subfile,
there is a folder named adde,
containing a subfolder named subfile .
. however,
there are some generic subfolders; eg,
the file`title can be named cyb/pim
(pim= personal info mgt);
but the files within are using a shortcut
that leaves out the /pim subfolder name:
cyb/fs means cyb/pim/fs .

3.15: project files:

. if the file`title has subfolders
and then the file includes any chunks (defined as
any sequence of paragraphs having no subfile title;
where title is defined as a pathname whose
root name is one of the user's root subjects)
then this should be considered a project file
meaning this whole file represents a folder
rather than representing a batch merge .

. for example, say that we have a file`title of
pol/purges/reaganomics/housing market crash/-
housing stocks vs housing bonds;
and, we find chunks in this file,
then we see that part of that path
is already in the filesystem:
pol/purges/reaganomics/housing market crash,so we have one level of new folder to make:
(housing stocks vs housing bonds);
and, since this is a project folder,
we give it a datestamped name:
(2008.06.16 housing stocks vs housing bonds).
. then, within that new folder,
we divide the project into number-titled subfiles:

. if a section does have a title, then its new title is
its old title prefixed with the assigned serial number; eg,
01 -- a chunk's title is nothing but the assigned serial number;
02 how bonds differ from stocks
03 how bonds crashed the market
04 -- another chunk
05 web --[a generic title for copied stuff .]

2.23, 3.12, 3.15: subfile formats:

. there are 2 main subfile formats,
that indicate whether a subfile's body
can include blank lines;
a body that does include blanklines
is said to be segmented, a seg'd subfile .

format# non-seg'd subfile:
. after the title is identified,
the next line is not a blankline,
and so the end-of-subfile (end of the title's body)
is determined by the next blankline .

format# seg'd subfile:
. if the title is preceded by a multi-blankline,
and followed by a single blankline,
then the body is segmented (it includes blanklines),
so the end-of-subfile is determined by
the next multi-blankline
(more than 1 blankline consecutively).
. within a seg'd subfile,
it prints the first line of every segment
(the line after a single blankline).
. indentation of that printing
shows the seg belongs to the seg'd subfile's title .

being tolerant of format errors:
. if the title is preceded by a mult-blankline,
but not followed by a blank,
then it's most likely a non-seg'd subfile,
but, keep an eye out for a blankline followed by a non-title,
in that case there has been a formatting error;
so, revise the context assumption
to that of being in a seg'd subfile .
. the app must adapt to such formatting errors
by providing the missing blankline after the title .]
. if in a seg'd subfile,
and a seg appears to start with a subfile title,
then alert the user to a possible formatting error .
. but continue to treat it as a seg; because,
one purpose of the seg'd-subfile format
is to indicate that a collection of small articles
should be packed into one subfile .

3.29: was-blogged format:

. a complication of finding subfiles
is the inclusion of relatively new formats that are
documenting how subfiles have been blogged .
. if the blog entry involved more than one subfile
then the usual multi-blankline system is used to indicate
how many of the following subfiles and chunks
are associated with a was-blogged header .
. a was-blogged header has this format:

title of blog -- not a subfile title
(optional list of keywords)
blog's url .

. even if there is only one subfile included,
this use of a was-blogged header may still occur
if the blog's title differed from subfile's header .
. in these cases the was-blogged header should be
copied to each of the enclosed subfiles .
. a complication of this would be a project format
where the blog included not only subfiles
but also untitled paragraphs (chunks)
meant to explain how the subfiles were related .
. in that case the project folder format should be used
( each chunk and subfile become
files within a folder having the blog entry's name).
. the date can listed as yymm00 or yymm99 .

3.29: targets .txt only:
. input folders may include .html as well as .txt
as a record of what has been blogged;
subfiler should be processing only .txt files .

3.25: 3.28: the parameter file:
. the parameter file should contain a list of the user's
root or top-level subjects .
. in order for a pathname to be considered a subfile title
it's root name needs to be included in this parameter file .
. eg, here's part of my parameter file:
addx, adda, adde, addm,
adds, math, engl,
cyb, me
care, gear, bank, cook, med, wealth
psy, pol, relig
--. the list is comma-delimited for in case
the user's root names include spaces .
. we parse by splitting on commas,
then strip any leading or trailing spaces .
. we read a line at a time,
so a newline can optionally serve as a comma;
we discard any empty strings
produced by having a comma at the end of string .
. we assume the parameter file is in the current directory .

incremental progress:

. the next version can integrate an editor
for adjusting the mistakes that the user or it made;
the first version just displays an outline
that includes the line numbers
to help you do the file syntax reviewing,
using your usual editor to visit those line#'s .
. it can print every line preceded by a blank line,
print a blank line if the file has
2 or more blank lines in a row .
. or, it generates a file of numbered lines
rather than printing them;
then after you adjust any lines in your editor
and run subfiler on this file,
it copies your changes back to the original file .
it then proceeds to do the subfiler routine .]

. a next version might move things to proper folders
according to what the subfile paths are .
. the expectation is that a reviewer has
checked the syntax and made the changes to the file path
so that in case it was written a long time ago,
the path is changed to become currently relevant .
. the first version just generates a folder of files
and leaves that in the current working directory .

structuring a list of lines into an outline tree:

2.23?:  3.27:
. a good function to start with is:
[number of blank lines]( [next line]/.string ).integer
. it returns with the number of blanklines it passed over,
and also modifies the string pointer it was passed
so [next line] contains the next non-blank line .
. if [next line]`length =0,
then eof has been reached .
. after reading how to use python,
I'm thinking I'd rather
read the file into a list of strings,
so that line[i] is representing
the string at the ith linenumber .
. then I could make a tree whose leaf nodes contained
integers which were indices into the line[i] list .
3.27: 3.28:
. the file is represented by a list of lists,
where the inner lists represent the subfiles,
and the outer list represents the project folder
or merge command arguments .
. the structure of the inner lists should make it easy to
generate the outline being displayed:
the first column of an outline is the line#,
the 2nd col is the datestamp,
and 3rd col is the title;
hence, these will be 1st, 2nd, and 3rd items
of the inner lists .
. subsequent integers of an inner list
are showing line#'s of segments (paragraphs)
whose first lines should be indented under a title .
[ file`title
, chunk
, [title`line#, '1.2', subfile#1`title, seg#1, seg#2]
, [title`line#, '1.2', subfile#2`title, seg#1, subtitle, seg#2]
] .

title format:
. the title may be missing a colon,
but a subfile title has one div in it,
and is preceded by at least one blank line .
. but if the root of the title's pathname
is not among the expected roots
then the meaning depends on context:
# in a seg'd subfile:
. this is a subtitle of the current subfiles .
# in a non-seg'd subfile:
. this is a new subfile,
so assume the pathname is
file`title & current-title .

3.11: 3.27: identify titles:

. a typical title has this pattern:
1 or more blanklines followed by this pattern:

. if the suspected title is missing a (:) at the end,
or the (:) was replaced by a (;)
but has otherwise got a title syntax,
then it is still surely a title .
. on the other hand,
if the title candidate starts with a ". "
then this situation is a sentence refering to a title,
not the title itself .
. if the title candidate starts with a datestamp:
1.2: -- that is month.day, or
1.2.345: -- month.day.hour+minutes,
1.2 .. 8: -- cross-day range
1.2 .. 2.1: -- cross-month range
1.2, 2.3: --comma-separated multistamp
1.2: 2.3: -- simple multistamp
then remove the datestamp and test again,
since there may be multiple datestamps .
. one date stamp may apply to successive subfiles,
so it may not be there,
and if it's not, then this app needs to add it .
. if there are multiple timestamps in subfile#i,
and then no timestamps in subfile#(i+1),
then that is an error the user must be alerted to:
"(which of multiple timestamps applies to subsequent subfiles?).
. this app's output needs to indicate
what it thought was the right timestamp,
eg, if it had to propagate a timestamp from earlier subfiles,
it can use this syntax:
/1.2/: title: .

. the way to get the title is split on (/),
called the divparts list;
if no (/) exists in string,
return [this is not a title] .
. the dotparts list is split divparts#0 on (.);
domain`= dotparts#end;
if domain has a (`) in it,
then domain`= domain#(start:1st, stop:find(`));
if domain in (list of known domain names)
then this is a title,
else alert user to ambiguity:
is this a domain not yet in domain list? ]

3.22: sci: may not need to worry about unicode:
. the parts of the string I'm dealing with are just ascii,
and the rest are just being written in the same way they are read:
the extended bytes just look like ascii extended chars .

some details with some python code:

def dateSplit(line):
""". the quickest way to get past all datestamps is to
check that the line starts with a number,
and then remains in "1234567890., :;?" .
. it splits the given string into
(datestamps, remainder of string ).
 stripped= line.strip()
 if stripped[0] not in "1234567890":
   return ('', line)
 result = 0
 for i in range(len(line)):
   if line[i] not in "1234567890., :;?":
     result = i; break
 return ( line[:result], line[result:])

. how to tell if datestamp is a single, not a range of dates?
pick off trailing {:;}, and find "..", ":", ";"

3.28: the parameter file:

def DomainsInFile():
""". this returns a list of user domain names
that it found in the parameter file, parameter.txt .
 domains = set([])
 for line in open( 'parameter.txt' ):
   nextset = set(map( str.strip, line.split(',') ))
 if '' in domains: domains.remove('')
 return domains
 #. now the domains set contains the strings
 # that define the root of a subfile title .

3.11: 3.27..28:

def hasTitleFormat(candidate):
 """. needs global list of strings, DomainList,
 and returns truth of candidate has a format of:
 a.b.Domain`part/title/subtitle .
 . the dots  and (`) are optional, the div's are not,
 and Domain must be in DomainList .
 nodiv = (candidate.find('/')== -1)
 if nodiv:
   isTitle = False
   divparts = candidate.split('/')
   dotparts = divparts[0].split('.')
   candidateDomain = dotparts[-1]
   index = candidateDomain.find('`')
   if index > -1: candidateDomain= candidateDomain[:index]
   isTitle = (candidateDomain in DomainList)
 return isTitle

# init
DomainList = DomainsInFile() # global
# say line is the current line
date, candidate = dateSplit(line)
isTitle = hasTitleFormat(candidate)
# if an internet domain, then candidate is an author identifier .

finding openware to reuse #dev.pyqt

3.6: web.cyb/dev.pyqt/finding openware to reuse:
activestate's pyqt:
Google site:code.activestate.com/recipes
python qt
Google site:sourceforge.net
python qt
auto resize and relative to position move the widgets to the place they
should be:
3.7: g'code's pyqt projects:
dictionary to learn 2nd lang
Batch zoom picture and photograph files.
(file manager, text editor, ... adde) http://code.google.com/p/pydingo/
-- uses freedesktop.org
std accessor:
automatically upload and organize pictures on Flickr
merge extract PDF convert to TXT, HTML or XML
Serial communication GUI tool http://code.google.com/p/sppyqt/
information gathering tool
WYSIWYG editor yet can be used for editing beautiful HTML
Finds duplicate files in configurable directories
file browser
identification of vulnerabilities in web applications.
FreeCAD uses qt
qt Wrapper for FFMPEG http://sourceforge.net/projects/qt-giraff/
python, QT and QT's phonon framework to play media.
book about pyqt
tut's about pyqt
how to install eclipse pydev and pyqt ide .
tut's & doc's [downloaded] for pyside
3.7: pos: Spyder is a major contribution:
. it may also be used as a PyQt4 extension library (module
For example, the Python interactive shell widget used in Spyder
may be embedded in your own PyQt4 application.
. it has good docs too;
my only concern is the underlying technology, python with Qt,
I'm wondering if I'll be sorry committing to that,
since it mixes c and c++ code,
and this has been a source of bugs and vulnerabilities .
. but it's a great way to learn coding anyway,
and should be ok for personal use,
where the user is known to have good backup habits,
and runs it in virtual machine .
3.7: see Python Scripting for Computational Science:
3.7: guiqwt (2D graphs using pyqt widget toolset):
Efficient 2D plotting Python library based on PyQwt Based on PyQwt
(plotting widgets for PyQt4 graphical user interfaces)
and on the scientific modules NumPy and SciPy,
guiqwt is a Python library providing efficient 2D data-plotting
(curve/image visualization and related tools)
for interactive computing
and signal/image processing application development.
3.7: PyQwt is Numerical Python with PyQt
PyQwt is a set of Python bindings for the Qwt C++ class library
which extends the Qt framework with widgets for scientific and
engineering applications.
It provides a widget to plot 2-dimensional data and various widgets
to display and control
bounded or unbounded floating point values.
PyQwt addresses the problem of integrating
PyQt, Qt, Qwt, NumPy and optionally SciPy.
Look at the Command Line Interface (CLI) examples
and the Graphical User Interface (GUI) examples
to get an idea of what you can do with PyQwt.
It is highly recommended to use PyQwt with NumPy.
3.7: lib cad didn't get far
3.6: just python
code in python but not always qt
python numerical
list of free just py books
list of py articles
py 3.0
3.7: Parallel Python
list of py or algorithm books:
Algorithms for Programmers: Ideas and Source Code http://www.jjj.de/fxt/fxtpage.html#fxtbook
Beej's Guide to Network Programming - Using Internet Sockets
text algors
py lib
imaging lib
cheat sheet
learn python
from other langs to py
from lisp to py
3.9: GUI Programming with Python Using the Qt Toolkit
(2002 -- defunct)
news.cyb/dev.pyqt/finding openware to reuse/
applications and resources for use with PyQt.
. to use PyQt interactively, ipython has been extended .
PEEQ is a version of khpython that only relies on PyQt,
news.cyb/dev.pyqt/finding openware to reuse/

news.cyb/dev.pyqt/finding openware to reuse/

news.cyb/dev.pyqt/finding openware to reuse/
3.23: web.cyb/dev.pyqt/finding openware to reuse/
. started by trying to find a way to get file from user;
also found much interesting from:
Donn Lee Python Cookbook
-- Directory Pruner tkinter
getch()-like unbuffered character reading from stdin on both Windows
and Unix
argdeclare: declarative interface to argparse
lines = open(filename, 'r').readlines()
for line in lines:
sort a cli-given file:
map(sys.stdout.write, sorted(file(sys.argv[1]).readlines()))
mostly code specific to using django http://djangosnippets.org/languages/python/
eg, dropbox integration
. here some downloaded:
Async PIL resize of images
Files and Directories http://docs.python.org/release/2.4.1/lib/os-file-dir.html#l2h-1636
3.29: e-booksdirectory.com
pyqt intro online:
more free python books
including cookbooks:
# Multimedia Cookbook in Python http://www.e-booksdirectory.com/details.php?ebook=3042
# the library .

PySide vs pyqt

3.7: pos.cyb/dev.pyqt/PySide vs pyqt:

. one problem with deciding between PySide and pyqt
is that it does mean
changing the source I'm learning from,
and the only reason not to use
pyqt, the choice of my tutor,
is if you're project is closed-source .
. at first I thought that pyqt would
not be as well supported as PySide
but pyqt is backed by payware funds
just as PySide is .

3.8: web: not easy to keep them separated:
It is also generally not a good idea to
import both PyQt and PySide at the same time.
Note that some packages will import PyQt
when imported themselves (eg. matplotlib/pylab
with Qt set as the default backend etc).
. this means that you may need use both {pyside, pyqt}
because whenever you import one of them indirectly,
that importing module should do all its work
in which ever one is already being used .
. imports are module specific so this works out .
. as for gui widgets that are trans-module,
it all gets translated into c++ by then .
. if it's not this simple, then the version used
will depend on what libraries you need the most .

installing an ide #dev.pyqt

3.6: web.cyb/dev.pyqt/finding and installing an ide:

. see comparing ide's.
Spyder is running advanced examples .

pos: not eric? check qt for suggestions:
. eric doesn't even have any doc's?
[3.31: I had pretty unlikely problem;
I just needed time think or see a newsgroup ...]
why aren't I using qt's tools?
well, for that you should check their pyside site,
and see if they have any tools ...
[all they have is a reference to a tutor book
that is going to tell you to use Idle .]

proj: PySide is installed:
. why doesn't installation work? pyside is not installed?
I just misspelled it: forgot to camelcase PySide .
I tried from both the ubuntu software center
and from instructions from the PySide page
for getting it from the terminal . one of them does work .

qt's advice:
. Qt API is implemented in C++,
and provides additional features for easier cross-platform development.
QML – introduced with Qt Quick
is a CSS and JavaScript-like declarative, language
designed to describe the user interface of a program:
both what it looks like, and how it behaves .
Qt has signals and slots [doc.qt.nokia.com]
and Guarded pointers to avoid dangling pointers .

Bindings to Qt exist for several other languages,
including Ada,
and Python (pyside and pyqt).

PyQt [riverbankcomputing.com] (GPL/commercial)
    Tutorials [diotavelli.net]
API Documentation [riverbankcomputing.com]
    Reference Guide [riverbankcomputing.com]
    Book [qtrac.eu]
    Whitepaper [riverbankcomputing.com]
. use PyQt to create widgets that can be used in Qt Designer .
    KDE Platform and py bindings (source)
. mix PyKDE widgets and other classes
with PyQt widgets and classes, just as you would in C++.

PySide: Python for Qt [pyside.org] (LGPL)
    Documentation (tutorials, examples, API reference)
    Downloads, pyside-docs-latest.zip
    Mailing list [lists.pyside.org]
    Bugzilla [bugs.pyside.org]

the PySide project now utilizes Qt’s Jira bug tracker.
Being a Qt Add-on provides PySide a permanent home
and perfect alignment with Qt Frameworks.
Furthermore, the project gets improved visibility, as well as a simple,
carefully thought out meritocratic project structure.
source code;
dev access .

. diff's between PyQt and PySide .

eric seems flakey and not well doc'd:
[3.31: but only because it expected me to have svn installed,
and I missed the main technical report (out since 2011.8.16)
that serves as the primary documentation .]
. the 2nd tutorial (intro page)(.zip)
. eric's Web Browser's Technical Report
. eric forum .

check for how to install and config eric:
trust your package manager:
* Get rid of anything you've installed
outside of the package manager
* Open Synaptic (System --> Administration
--> Synaptic Package Manager)
* Type 'Eric' into the Quick Search text box

for eric4 you should have the following installed:
    Python 2.6.0 or better
    Qt 4.6.0 or better (from Nokia)
    PyQt 4.6.0 or better (from Riverbank)
    QScintilla 2.2.0 or better (from Riverbank)

3.7: web.cyb/dev.pyqt/finding and
installing an ide/spyder:

I'm looking at spyder's doc's from its menu
and I'm thinking it's an IDE like ipython is,
but one of its recommended modules
is ipython:
. I don't think it pre-installed
what it recommends
because I just now was able
to install ipython and matplotlib;
ie, they were not already on-board,
according to unbuntu software center .

3.9: proj.cyb/dev.pyqt/
testing an ide with tutorial's code:

. this is my own xu path:
uservv@ubuntu:~$ $PATH
bash: /usr/local/sbin:/usr/local/bin:/usr/sbin:-

. spyder is an ide started from the command line:
uservv@ubuntu:~$ spyder

. the integrated console looks like this:
Python 2.7.1+ (r271:86832, Apr 11 2011, 18:05:24)
[GCC 4.5.2] on linux2

. it has the normal control-o to open a file browser,
and then with hello world loaded that way,
hitting menu/run creates this in its console:
>>> runfile(r'/home/uservv/pyqt/chap01/hello.py',-
Hello World
. the file it ran was this:
#!/usr/bin/env python
from __future__ import print_function
print("Hello World")

then I had it run a .pyw file, bringing up a window
that contained an array of numbers
pyQt gui in action!

3.23: todo:[done]
page192, 0382, has gui-driven file io example;
chapt 13 code is interesting for text editor code example .

qrc_resources module not generated:

I tried to run pythoneditor2.pyw,
but it returned ImportError:
No module named qrc_resources
-- Traceback (most recent call last):
  File "/home/uservv/0pyqt/chap13/
pythoneditor.pyw", line 24, in
    import qrc_resources
I think the book said there was
a program I need to run
in order to generate that missing resource,
but I thought for the examples
that would have already been done .

3.24: proj.cyb/dev.pyqt/
get the advanced examples running:
. find someone making the same mistake
(translated from german by google)
I bought myself the book
Rapid GUI Programming with Python on QT.
Now it is show some demos
so that it equals the error.
eg Chapter 15 assetmanager.pyw line 17
import qrc_resources
results in an error:
The program examined produced
the unhandled exception ImportError
"No module named qrc_resources"
In the archives of the sample files
are located next to the folders on the individual chapters
2 scripts called makepyqt.pyw and mkpyqt.py.
The former allows you to create GUI
even with the resource files in the folders.
This procedure is not necessary, 
you can integrate the resources via files.
But it is not a bad approach,
and it does not hurt to try it
as part of the book .
So just "python makepyqt.pyw" recursive call
and let all qrc_resources generate.
[it pops up the window "[make pyqt]
with the options to
recurse? translate? dry-run?
so I set it to recurse for do-all .
. then it has 3 buttons: build, clean, quit,
and I just hit build .]
The log then showed this message:
... converted to chap[...]/resources.qrc

the conversion programs were in the root
of the sample's folder system;
there was also a readme that says this:
Two helper programs are provided:
mkpyqt.py (a console application),
and makepyqt.pyw (a GUI application).
These programs both do the same thing:
They run pyuic4, pyrcc4, pylupdate4, and lrelease
with the correct command line arguments.
In some cases you may need to
set the path to pyuic4 (pyuic4.bat on Windows),
and possibly to the other programs as well.
For mkpyqt.py this means editing the file itself
(the paths are in variables near the top);
for makepyqt.pyw, click "More->Options"
and set the paths there.
The use of these programs
is described in Chapter 7.
. the way I ran it with no troubles was by
cd'ing to the folder where makepyqt.pyw was,
and then using the current-folder qualifier
on makepyqt.pyw:
here's the result of the whole session:
uservv@ubuntu:~$ cd 0pyqt
uservv@ubuntu:~/0pyqt$ ls
chap01  ...       makepyqt.pyw
... gpl-2.0.txt  mkpyqt.py
... gpl-3.0.txt  README.txt
uservv@ubuntu:~/0pyqt$ python ./makepyqt.pyw

. the editor sample project is working,
and the editor's open command
lets the user browse for a file !

comparing ide's #dev.pyqt

3.31: summary:
. I got spyder working on ubuntu 11.04,
running the summerfield examples .
. everything was installed by the
ubuntu software center .

3.6: pos: ide should be idle:
. my tutor suggests using Idle
(mark summerfield`rapid gui programming with python and qt)
. he said eric would be too complicated
for a beginner -- that was back in 2008;
I wonder what he would have thought of spyder ?


menu-driven coding

3.5: adde/menu-driven coding/current vars list:
. when an interactive coding session is adding vars,
the menu is updated to show what's currently defined
-- this is part of the menu-driven coding capability
for the memory impaired .

auto-save with merge versions

3.9: news.adde/camelot's implicit save command:
. camelot uses pyqt, activeMQ, Elixir (interfacing SQLalchemy),
to build apps faster by adding gui info to the model
like django admin interface does .
. they removed the save button 2 years before apple did
and explain this in their faq:
. if you don't like it, take a week off to get used to it .
. when the user asks for the save command
it should explain that it is already auto-saving versions,
and that when you hit save(merge versions),
that is deleting the old versions
(undoable until closing session).

games for health awareness

3.2: adde/games for health awareness:
. I got my will to quit smoking
not from the fear of dying of lung cancer,
but of slowly being strangled by emphysema .
. the game's adversaries should be causing disabilities,
and there should be a tension where
if you do smoke then you get more energy points,
but then there's the emphysema unrecoverable;
you get 9 lives, and emphysema happens
to at least one of the lives;
your other lives are slowed down by this breathless smoker .
. the same thing applies to eating and diabetes,
or eating and heart conditions that reduce abilities .

internet library news

3.6: news.adds/free math books:

3.15: news.adds/lib/TEDTalks on iTunes U:
. organized by subject area in courses curated for
students, educators, and livelong learners.
Courses include
Creative Problem Solving, Mastering Tech-Artistry,
Ingenuity in the Development World, and more.
3.29: where did I see this?
apple's itunes edu news had a copy of same .
. ted stands for Technology, Entertainment, Design
and "( Ideas Worth Spreading ).

news.adds/lib/aima.cs.berkeley.edu's code with book
 [Artificial Intelligence: A Modern Approach]:
. the book's code is python openware .
svn checkout http://aima-python.googlecode.com/svn/trunk/ aima-python-read-only
todo: explore AI on the Web links .

3.26: tech.adds/lib/g'books makes your paper book searchable:
. books.google.com has so many books,
there's a good chance they have yours too .
. often they remove some pages of their online books,
but you can still search every page;
it will give you a page number even if the page isn't viewable,
and then you can check the page with your copy .

celebrating women in tech

3.2: news.adds/anitaborg.org/advancing women in tech:
. through our work every day, the Anita Borg Institute seeks to:
# increase the impact of women on all aspects of technology, and
# increase the positive impact of technology
on the world’s women.
2006 Anita Borg Change Agents Since 1997,
ABI has developed tools and programs designed to
help industry, academia and government
recruit, retain and develop women technology leaders.
By providing inclusive platforms designed to ensure
women’s voices, ideas and spirits will result in
higher levels of technical innovation,
ABI delivers programs that are changing the world
for women and for technology .
. newsletter .

3.20: news.adds/women in tech:
... and some variety in outcomes:
After graduating MIT, an electrical engineer,
Wong served a brief stint as an investment banker
before heading to graduate school at Stanford
for her MBA .