cocoa dev'ing

1.13: web.addn/dev.mac/singh`os x internals:
explore more:

1.23: pos.addn/dev.mac/cocoa:
. with example code being available,
the best bet is to find examples of
{web browser, text and graphics editor}
then find doc's of all classes used by them .

A number of Applications have been
removed from the App Store
on the basis that they allegedly
infringed a pre-existing trademark.
1.31: mis:
. I'm just glad I haven't come to that bridge yet;
the worry associated with hooded judges at App store
seems daunting .

An iPhone application for sending accelerometer data
from your iPhone/iPod touch to your development computer
for using accelerometer inside the iPhone simulator.
Let's you develop and debug applications that require accelerometer
without running the application on the device.
Can also be used to create desktop applications
utilizing the iPhone accelerometer as control.
Uses UDP broadcast/unicast for sending data,
so you can even have multiple senders/receivers at the same time.
todo.addn/dev.mac#iphone/automation onboard:
. did I really hear right that iphone disallows
scripting engines?
does it already have something like automator?
maybe if it had an applescript engine
they could use an adda->applescript compiler
. iphone does have automator .

1.31: web.addn/dev.mac#iphone.scratch:
Scratch Forums / Scratch on iPhone? yes:

booking obj'c

1.10: web.addn/dev.c/ms'visual c++:
(even though my primary goal right now is dev.mac,
I often use a pc tablet/laptop (xpw)
and am interested in a c sdk for that platform)
. vcsetup (in downloads) is for ms`visual c++
see tutorial .
. it has an optional game api;
but I doubted this would help sci c on xpw .
. here is a vid showing the ide;
it needs silverlight in firefox (not chrome) .
(opens into win'media player and then is dead )


1.15: lib.addn/dev.mac/obj'c:

1.17: the secret life of globals:
. I was wondering if there was some
sure way of knowing how c globals worked:
. did the value remain persistent across
all platform time,
or just the main program's execution time ?
. the [code complete].book reminds me,
to not even use globals .
. atleast you don't have to depend on
their being persistent: use files .

1.19: co.dev.c:

mem mgt tips:
> According to the memory management rules,
you're only responsible for objects you create via
an "alloc", "new", or "copy" method,
All other objects are autoreleased.
Unless your PerformXMLXPathQuery returns an object that you own.
But if it does that,
it should have been given a better name
-- one that has the word alloc, new or copy in it.
. the method in question "PerformXMLXPathQuery"
is a wrapper that was obtained from cocoawithlove.com .
sci.addn/dev.c/organizing large programs:
. what's the diff'tween separate files,
and when exactly are we including header files?
(I'm getting confused between what's communicated to
the compiler vs the linker)
. the headers are typically just holding the decl's
which are like the import stmt:
the decl' says
a given function type (the signature of it) will be
found among one of your other files .
. just as there are separate {decl's, def's} for functions,
there can also be separate {decl's, def's} for variables .
. shared var's are just like a pascal global,
except that you get the chance to separately compile .
. if you didn't use separate compilation
then youBold could simply use the includes for
merging all the separately filed def's
and then you wouldn't need the header files .

news"decl's, def's, and perfectly legal C code, oh my!

stumped by c decl's?
cdecl.org converts them to english .

much about loader activity at tenouk.com
--. interesting details like that found in the
[van der linden]`[expert c].book .

computer programming for all (children) is here!

10.1.31: news.addx/scratch.mit.edu

. filling out the form to get updates about Scratch:
School or Organization: Americium Dream Documents
Role: Researcher

Where did you hear about Scratch?
Can you build a visual (touch based)
programming environment like Scratch?
What interests you about Scratch?
cp4e (computer programming for everyone)

Anything else you want to share about your background or related experience?
addx -- a secure and friendly system
that promotes computing as a universal 2nd language

free {pc, mac} downloads with tons of support
Scratch Installer For Mac OS X (MacScratch1.4.dmg)
Scratch Installer for Windows (ScratchInstaller1.4.exe)

. user doc's include the support page's links:

getting started page
release notes
Getting Started Guide (pdf)
new user forum
other forum pages (28,400 pages)
learnscratch.org (115 pages)
Scratch Reference Guide
Scratch Cards
Videos about Scratch

Scratch 1.4: Beginner's Guide ($32 book)
Scratch Programming for Teens ($20 book)

[. if you are redistributing an official copy,
or pointing at where to get it, then ]
you can include a description of Scratch
and the Scratch logo:
"Scratch, a project of MIT Media Lab's
Lifelong Kindergarten group,
makes it easy to program your own
interactive stories, games, and animations
-- and share your creations on the web.
As you create and share projects with Scratch,
you learn to think creatively,
reason systematically,
and work collaboratively .
It is available for free download
from scratch.mit.edu .

scratch reviews in the news

Research Papers and Presentations

Scratch: Programming for All. Communications of the ACM, November 2009 (pdf)

What video game making can teach us about learning and literacy:
Alternative pathways into participatory cultures. (pdf)

All I Really Need to Know (About Creative Thinking)
I Learned (By Studying How Children Learn) in Kindergarten. (pdf)

Creative coding: The role of art and programming
in the K-12 educational context. (pdf)

2005 Some Reflections on Designing Construction Kits for Kids. (pdf)

2003 NSF grant Proposal:
A Networked, Media-Rich Programming Environment
to Enhance Technological Fluency
at After-School Centers in Economically-Disadvantaged Communities. (pdf)

educator doc's

getting started for educators

1-page overviews:
Creating with Scratch (pdf)
Learning with Scratch (pdf)
and Programming with Scratch (pdf) .

educator resources

educator forum
map of interested educators
Programming Concepts in Scratch (pdf)
. the computational concepts and skills
young people can develop .

Scratch and 21st Century Learning Skills (pdf)
. the learning skills young people can develop .

Learning by Designing (pdf)
. design-based approaches to learning .

find doc's in your language
--. some have their own websites:
( portuguese (6800 pages)
arabic.edu (400 pages)
hungarian (310 pages)
estonian (100 pages)
israeli.org (40 pages)
spanish.{org, educa}(25 pages)
dutch.{edu, org} (6 pages),
italian.com (1 page)

scratch openware
This source code release (4.8mb)
is based on the source code of Scratch 1.4
with a few changes [to conform to the license]

To view the source code,
just drop the .image file onto a Squeak virtual machine
(e.g. Scratch.exe or Scratch.app,
which come bundled with Scratch).

. source code for the Squeak virtual machine .

Scratch UI "Skin" resource:
The Scratch User Interface is a
ScratchFrameMorph.class`ScratchSkin.Dictionary .
. readSkinFrom(folder) can load the skin
from this skin folder download. (zip)

ScratchPlugin and UnicodePlugin source code (zip)
(for Windows, Mac OS X, and Linux) .
ScratchPlugin for Squeak
is a shared C library that extends the Squeak VM
to support image filters, presentation mode, the help button, ... .
. UnicodePlugin lets Squeak support text rendering .

some confusion about linux sources

. no need to recompile if are using
a recent version of Ubuntu (7.x or 8.x).
However, if you do need to rebuild the binaries,
they have source code for the Squeak virtual machine
source code for the special Scratch plugins is available
at "(mks://localhost/Source_Code) ?
mks ? perhaps refers to this:
MKS Toolkit Vs. Cygwin: You Get What You Pay For - New
$479 MKS Toolkit for Developers is a Windows development product
for software, script, and Web developers,
who can choose from command-line
or graphical Visual Studio® build environments.
It is ideal for developing common, cross-platform scripts
for UNIX, Linux, and Windows,
from a single Windows desktop.
Using the power of more than 300
command-line utilities, and CGI scripts.
. source code is best explored using the
browser and other tools
inside the Squeak programming environment.
To get started,
first copy the Scratch application
( pc: "Scratch.exe"
, mac: "Scratch.app"
) from your normal Scratch folder
into the Scratch source code folder.
(The Scratch application is actually just a
Squeak virtual machine,
so any recent Squeak virtual machine should also work.)
Also, put a copy of the Squeak source code file
in that folder if needed
(this file is included in the zip file
starting with the 1.4 source release).
drop the file "ScratchSourceCode1.4.image"
onto the Scratch application.
The Squeak programming environment will start up,
allowing you to view and modify the Scratch source code.

Scratch is built on a modified Squeak 2.8 image .
That version of Squeak is documented at
the squeak.org site, and two books:

Mark Guzdial` "Squeak: Object-Oriented Design with Multimedia Applications"
and {Mark Guzdial, Kimberly Rose}`
"Squeak: Open Personal Computing and Multimedia"

Both the source code and pre-compiled binaries
for the Squeak virtual machine are available at www.squeakvm.org .

. classes that appear in the original Squeak 2.8 image
are covered by the Squeak license
while all code in the remaining classes is covered by the Scratch license.
The Scratch classes are easy to find in practice:
nearly all of them appear in the class categories starting with "Scratch-".

doc's for developers
. comments are embedded in the code
and see the Scratch project file format .

. both developers and users are finding personalized help
at the advanced forum;
eg, the great list of tips
-- many of these will someday make their way
into the official user doc's .
. researchers might also get help by contact form .


. the source code license includes certain restrictions
intended to avoid confusion between the Scratch product
and research projects built on the Scratch source code.
If members of the Scratch user community
stumble on a research project based on the Scratch code,
they should be able to tell at a glance
that it is not the Scratch product.

The Scratch Source Code License
[. it's like the GPL plus...]
. for non-commercial uses
. you cannot use the word "Scratch"
to refer to derivative works
(except in the phrase
"Based on Scratch from the MIT Media Laboratory"),
. you cannot use the Scratch logo
nor the official (copyrighted) Scratch cat;
you cannot implement the ability to upload projects
to any MIT Scratch website
. and see the full license in "license.txt"
included in the source code download package.

compare databases, filesystems

1.24: adda/oop/db:

5.4(2009): adda/oop/db:
. how is a fs different than a db,
eg, how to impl' db with fs?
. the db controls how it stores its data as files;
but one way is
a record gets a folder named with a serial #,
then each file is named after a field in the record;
if that field is structured
then it would be a folder named like a file with a d'type name
. another subfolder system holds oop'ish meta data .
. so, instead of using db mgt to access records,
it sends msg's to a record`s type mgt
so data formats can change without reprogramming db mgt
or normalizing db .
. the oop'ish question to ask is
what operations exist for db vs fs ?
. the unit of a fs is the file
which is a db restricted to a few components:
(name, owner, type, creation.date, mod.date, etc)
. the unit of a db is a record
whose components are specific to attributes of
what the record is a symbol of .


Collaboration-Based Design

1.12: web.adda/Collaboration-Based Designs:
collaboration-based design (a.k.a. role modeling)
is a modeling technique that reduces complexity of
oop design and imple men ta tion.
In this paper we first show how to use aop
to imple ment collaboration-based designs.
We then compare the effectiveness of std lang
vs using one enhanced with aop .
Collaboration-based design (role modeling)
Advances in systems, computing sciences and software engineering


1.27: adde/versioning:
. another way to handle conflicts in versioning
is to treat them like c`pre-processor conditionals:
you would give the conditions under which
one version or the other would be selected for viewing .


1.22: adda/generics:
. generics are actually functions;
ie, the syntax is
f(what makes it generic).[what's instantiated]
eg, given the declaration f(type).pkg
the function return for f(x)
is a usable pkg .
f().().y is a generic function . ]

parameter blocks

1.20: adda/dstr/param'blocks:

. back when I was studying inside mac
-- before mac os X --
they had param'blocks:
huge records that would hold lots of options
so that when using services like window mgt
you didn't have long param' lists with every call .

. it would be even more convenient if
merely importing a subprogram would also
declare and implicitly apply a param'block for you .
. the translated code would have to include
a parameter -- the pointer to the param'block --
but user's code would not have to include that .

. param'blocks can be viewed as
caller-defined defaults
-- that's in contrast to the usual
subprogram-defined defaults
where if you don't specify an arg'
then the sub' provides one for you .

. param'blocks could also work like packages
in that name clashes could be avoided by
using the sub's name as owner of the global:
sub`global .

. another way to do this is ada`packaging:
have the sub' be a component of it's struct
where you can have
sub`[caller-defined default]`= [your pref's],
and then also do a call that uses that preference:
sub`fun(args) .

comparing array, record, function, and assoc'array

1.3: adda/dstr/comparing array, record, function, and assoc'array:

array vs function is storage:
. array is always stored as array
while a function can be
either associative array or formula .
. assoc'array is really a variable function .
. when taking a slice of each,
fun' keeps keys, while array re-keys;
doing an array slice from middle of an array
to replace an entire other array,
starts keys at destination's first key .
[. the diff is array's keys are address-oriented,
while fun is value oriented .]
. arrays have no formulae, and no param' modes
. {array, rec} literals look the same
but rec is associative:
a subslice retains associations .
. like arrays,
rec's can have slices:
r`{keys,,,} -> {r`compon's,,,}
r`(var) -> r's component whose key is a symbol returned by var
r`(,,,vars) -> r's component named by path returned keys
ie, the vars return a list of symbols that are
a pathname to a component in nested subrec's) .
. obj's in rec are ordered,
and a rec assignment is compatable if
their component types are compatable
(the rec'components may not be
stored as listed in rec,
but component assignments still work as if
that's the case ) .
. recs have fixed domain,
while arrays can vary in size (#first ...#last)
and functions are fully definable;
eg, a varying function (vs a const function)
allows slices which are lists of pairs;
. part of a varing function's attributes
includes the [currently defined domain];
you can traverse the [entire potential domain];
and, an undefined domain.point returns nil;
or, you can traverse the [currently defined domain],
which assures there will be no nil returns
f(x) for x in f`dom ) .
. f`dom is a set that can be ordered with a pipe:
f`dom @ sort (-1) .

1.21: adda/dstr/function vs array:
. a function should be able to assign to subsets of domain
f(sA)`= '(formula);
array vs fun has no formula, and is not sparse;
Python`dictionaries are sparse, so they are functions
... -- this confuses impl vs concept:
array represents an obj' with multiple components
like a rec' or tuple except that
all but all components have the same type .
. functions are a set of tuples .

label-based syntax

1.22: adda/cstr/label-based syntax:
. use label syntax whenever possible:
if b: s else: s;
loop: s until b;
while b: s;
for x and b .

adda translation

1.4: adda/translate/c param' limitations:
. c param's don't support all of c's datatypes,
but they do function records
and then there's malloc .

1.8: adda/translate/exceptions:

what is the ada exception
doing in terms of c code?

. according to expert c,
c++ orig'ly avoided exceptions
apparently because they couldn't be impl'd without
slowing down even code that
wouldn't be using the feature .

. non-tricky code for a failure exception
seems to require that every call be
wrapped in an if-stmt:
was the return normal ? ok;
else which exception?
is there a handler? ok;
else raise again and exit .

. if there's no handler
that means needing to check for exceptions
even when the called has not declared any;
since to be modular,
the called should be able to change its body
including variations of
the exceptions it gets exposed to
and doesn't handle .
. the subunit doesn't have to declare these exceptions
and could be imported from another system,
so that the library being shared between
this subunit and its users,
need not support the subunit's exception
meaning that it's recognized only generically
as a [component fail].exception .
. another view is that when a binary is exported,
it implicitly brings along
binary versions of all its dependencies
into the importing lib .
. name clashes would be avoided by
keeping the import's dependencies local to
the subunit's package .
. in essence then,
the subunit's package is a sort of interface
and that interface would include
all exceptions possible during exec of the subunit .

. even when subunits are allowed to change their body
and in a way that changes their exceptions
all that means is that a user who
thought ...
[ a user is not going to think that without a
contract that asserts that;
. one interface that would not interfere with modularity
is having a subunit describe what exceptions it will handle
[ with each compile of its body,
the compiler can see what exceptions it decided to catch]
. the exception interface needs something more,
since one way that a sub' can fail
is by not handling the unexpected .
. so then when the contract includes
exception identification,
there should implicitly be the Unknown;
ie, if the sub' is caught by surprise,
and doesn't get to raise an exception from it's list,
then the default is the Unknown .
. if that is the case,
the caller can then test for system exceptions .

. but what if only a sub.block catches an exception?

getting back to c-code that does this efficiently:
. if all code could raise exceptions by
affecting a global
then catchers could check as often as they like
while the default would be to
only check the failure.global when the
system was giving more resources;
eg, during a call there is an act'rec malloc
... but that could cause an infinite loop
if the call was exit loop on success?
lost sight of what can actually happen .

. perhaps no efficient, simple way
to translate exceptions
unless not translating to c simply
but letting addm control the stack .

. just get used to the inefficiency of
having a number of well-placed checkpoints
eg, at the top of every loop and block
assertions are asking:
"(is the failure.exception raised? );
if yes then exit or return .
. it gets less inefficient when adda knows
the smart balance between checking too often
and doing too much work on a flat tire .

. another place where adda needs to be smart
is knowing how to divide routines into
pieces that allow wise time-slicing .
. these could be the same checkpoint blocks that
exceptions are built with .

. each thread needs its own fail.exception
then the root of each thread
either handles its failure
or propagates it to the fail.exception of parent thread .

1.15: adda/translate/private headers:
re 5.19(2009):
. to make c more modular
use separate headers for public and private use .
. private can be done by
preceeding the header filename with an underscore .
. you're creating headers per file
even if not sharing
to declare what's in the file
and as forward referencing for mutual recursion .
. what would the point of this be?
there is no reuse in the privates
. there are 2 cases of privates:
#: declarations of functions
should be placed at the top of the file
of the top of the function that needs them .
#: definitions of nested functions
and aggregate init's can be bulky
so these can be separately filed and #include'd
. these private include's don't need
matching header files;
also, their names are limited only by the filesystem
not by what the linker will tolerate,
so name them fully; eg:
the first part should be the parent file
(the file that will be including it)
and the name's 2nd part should indicate what's inside .
. the grave.char "(`) can separate the 2 names
. can a system's pre-processor choke on that?
I'm sure it should tolerate anything the os`fs will .

1.15: mis.adda/translate/use std c:
. never use defines to change the C language;
the point of adda is to avoid using std c;
the adda translater should assume
either the readers have no trouble with std c
or they will use the adda translation instead .
. that position obviated these 2009 ideas:
. to make c more understandable use #defines
to replace static with private .
. instead of using & and * directly,
use macro's that give intent:
* = {IN, OUT, INOUT}
& = {RO, RW, WO}
. to emulate an ada loop with exit in the middle
use a macro:
#define LOOP while(1)
then use break and continue as usual .
) .
1.21: adda/translate/c modularity mechanisms:
bk"c by dissection/modularity,
bk.dev.c" steele/sto class specifiers,
bk.dev.c`lib/hints on good lib design,
bk.dev.c{c`lib, steele},
bk.dev.c"k&r/modular design .

hierarchical {project, scope} headers:
. each file is a scope:
private sub's are typed static,
a program using sub's from other files
will use an enviro header
to be included by itself and its child files
to share vars, types, functions, and decl's .
. libunit headers are for sharing one unit with another .

bk" steele` sto class specifiers:
. at top level, "(static) is used on both
var's and fun's to localize .
[... although fun's are usually localized by file,
static will be good for adda's plan to impl'
{exceptions, multi-tasking} by
breaking functions up into sequenced blocks .]


1.8: adda/exceptions

[1.9: review of exceptions:
. there are 2 types:
# dialog-acceptions
are accepting a callback to resume,
(similar to the mac dialog) .
# failure-exceptions
are like the ada'exception,
which is simply canceling the job,
and asking the caller what it wanted to do
in the event a call had failed .
. failure-exceptions are part of the contract
between client(caller) and service(subroutine) :
the subroutine's list of exceptions
are telling the caller that if the call fails
then the reason for the failure will be given;
( [file not found]: handler#1
, [user unresponsive]: handler#2
) .
. if subprogram f didn't declare any exceptions?
or if you were not concerned with
the reason for the failure?
then you could simply use f's name
as an exception case:
( f: handler#1 .
, others: ... )
there are 2 ways for declaring exceptions:
. the ada way has symbols declared to be
an exception.type,
eg, (e.exception; raise e);
and then the caller can ask:
(was e raised?) .
. the other common way
is using the name of a datatype or class;
ie, you can ask:
"(was the failure from any operation owned by
number.type ?)
. along the same lines, you can be more specific
by asking which subprogram or operation
was in effect when the exception was raised .
asking "(did f cause the exception?)
would be the same as asking
"(was it any exception raised by f
or by employees of f ?

. exceptions should be part of the subprogram interface;
this is in contrast to ada's idea
which requires exceptions to be
packaged with a subprogram:
ie, instead of submitting just a sub' to the library,
the sub' and it's exceptions must be
components of a package;
then importing the package from the library
brings you both the sub' and its exceptions .

. when using subprogram names as exception cases,
there can be some confusion due to
overloading of sub' names,
so the syntax must allow for use of the full name
including the parameter types,
which may preclude the use of declarations
within an exception-casing.stmt
(atleast not at the top level);
[1.19: or,
overloaded operators can be viewed as
belonging to a particular datatype or package,
so then for function f belonging to t.type,
there would be the exception case: t`f .
. then using an overloaded name without qualification
would mean every member of the overload class . ]

. raising an exception means
asking whether any in command chain
is catching this exception,
if no,
then the system knows to hang up the whole process,
having an exception handler in the employer chain
gives the system a place to roll back to .
. this is all the info needed by the system
by runtime
the sub decides on exceptions to propagate;
if the sup happens to catch, ok .
. the details of this rollback require a review
of how nested and recursive subunits
complicate where on the stack an instance is .
. what does either say about
contracts and exceptions?

. even if a sub' doesn't declare an exception
then there are still certain system exceptions
that are implicitely declared for every sub' .
. it is very common for sub's to fail because of
misusing sytem resources, eg:
( [out of mem]: handler#1
, [access violation]: handler#2
, others: handler#3 ...
) .

1.20: exception/translation:

. anything you do with {setjump, signal}
can bring out bugs in compiler
and make your app less robust;
so, it's best to first check your sdk
for platform-specific ways to
make your app responsive to user interupts .
. while setjump is good at
quickly unwinding the stack,
can it really be the case
that a rarely occuring situation
is the right place to worry about being quick
at the expense of program stability ?
. signals may still be useful,
but platform-specific frameworks
usually provide you with full-featured
event-loop programming that includes
all the signals you'll need .

declaring dialog-exceptions:
. dialog-exceptions are just call-backs,
so a subprogram can declare them as globals
(see adda/dstr/param'blocks)


1.20: addm/exceptions:

. I first had the idea of stacking
more than the usual return address,
for the 2 cases of whether or not
the system was in an exception-raised mode .
. however, in recursive situations
that would use a lot more memory;
ie, an extra pointer per call,
when the alternative is to have a
conditional at the call's return point
which could be shared by all those recursive calls .
. then I found a way in which
it wouldn't even need the conditional.stmt:
. for a call.stmt that may involve an exception,
place a goto.stmt after it;
then make the call's return address
to land beyond the goto.stmt .
. in an exception.mode, the system would
treat the return address differently,
decrementing it before using it,
which would then cause the return to
land on the goto that would jump to the
exception-casing stmt,
or if letting a super.routine handle it,
the goto could just land at the
[cleanup and exit].section .