1. [GEN] Template Handler

I've sent Robert a program called "Template Handler", which intends to make
it easy to store & retrieve snippets or "templates" of code, for both
Euphoria and Win32Lib (could be extended to EDS etc, too).  Anyone who's
interested, please check it out & let me know what you think of it.

It seems to work well, except I don't have many TEMPLATES to include
with it!

So I'm hoping maybe some of you will contribute code snippets for
it.  You could either *use* the Template Handler to create template
contributions (good exercise for it), or just send code snippets here so
others could comment upon or improve them (could make for better snippets).

With "comment or improve" in mind, here's a sample template I might include
with it later (if you want to use it with the Handler, just save it to a
file and use an extent ".etp", for "Euphoria TemPlate"); it has two
templates in it, and the Handler does NOT show all the "!!" comments, just
the name, description, and code.

Dan Moyer

following could be put into a file, eg "Seq1.etp", to use with the handler:

!!  THIS IS A EUPHORIA CODE TEMPLATE FILE
!!
!!    EUPHORIA Sequence Manipulation TEMPLATES
!!
!! COMMENTS START WITH !! AT THE *FIRST* SPACE IN LINE
!! <<CATEGORY defines the CATEGORY of TEMPLATES in this file
!! <<NAME defines the NAME of a TEMPLATE
!! <<DESC defines the DESCRIPTION of a TEMPLATE
!! everything else is TEMPLATE CODE
!!
!! in order to allow ACTUAL blank lines INSIDE templates code,
!! blank lines in TEMPLATE FILE "comments" MUST be preceded by !!
!!
<<CATEGORY Sequence Manipulation
!!
<<NAME & Operator
<<DESC How to use "&" to append
--  ADDING THINGS INTO SEQUENCES:  JUST USE "&"

-- for simplicity and to avoid confusion, forget about whether to use
-- "append" or the concatenation operator "&" to add things to a sequence;
--  just use "&" to do both:

-- if you want to add the ELEMENTS of a sequence
-- to the end of the ELEMENTS of another sequence,
--  just use "&" normally:

sequence something
something={"a string"}
something[1] &= " of letters"       -- appends  " of letters" to end of
something

--so, something =  {"a string of letters"}

-- but if you want to add another SEQUENCE to the end of a sequence,
-- use "&" and put the sequence to add INSIDE curly braces:

something &= {"another string"}  -- appends a new dimmed subscript (2)

.. something will now look like this..
   {"a string of letters","another string"}

--Chris Bensler

<<NAME ArrayMakeFill
<<DESC Make an array to N dimensions & fill it
-- Make & Fill an Array
-- an easy way to create and fill an array of various dimensions:

-- the syntax of the function is:
-- <sequence> = array( <filler>, {<dim1>, <dim2>,...<dimN>} )
-- eg., s = array( 0, {8,10}) gives an array of 8 by 10, filled with 0's
--    Note:  will work for more than 2 dimensions

-- created by Lucius L. Hilley III

sequence s  -- to make as an array

function array(object filler, sequence dimensions)
  object x

  x = filler
  for A = 1 to length(dimensions) do
    x = repeat(x, dimensions[A])
  end for
  return x
end function

s = array(0,{8,10})  -- make an 8 by 10 array, filled with 0's

print(1,s)  -- show the array

new topic     » topic index » view message » categorize

2. Re: [GEN] Template Handler

Since my "Template Handler" needs Templates to be useful, and they would
presumably be added semi-regularly, I have to make some nice simple way to
accomplish this "update".

Here's what I have thought of, maybe you all can see flaws or improvements
for it?

TEMPLATE UPDATE FEATURE DETAILS:

1.  An "update" file would have TWO parts:
   a)  new FILES (ie, new CATEGORIES of templates);
   b)  new TEMPLATES to be added to EXISTING categories;

2.  The "update facility" would read in the update file, put all of the NEW
FILES info into ONE VARIABLE (or section of a sequence), all of NEW
TEMPLATES into ANOTHER variable (or second part of main);

3.  Update facility *compares* FILENAMES from update file against a dir of
folder;  puts all filenames *not* in dir into a combo box, asks user to
either select which ones to add, or "add all";  selected new files are
written to new template files;

4.  Update facility then compares NEW template NAMES against names in
existing appropriate categories (each category is a separate file); puts any
"new" templates NOT already in an existing file into a tabbed folder of
combo boxes, with ability to select which to add, and an "add all in this
category" button; also an overall "add *all* new templates" button outside
tabbed folder; selected templates are written to end of existing template
files.

5.  The "Templates Update File" NAME might be something like:  UpdTempl.AA1
(incrementing the extent for each new update, so people could know if they
have updated with it before or not); and after an update, user given choice
to either DELETE the file which just updated the Templates, or to SAVE it as
"BakTempl.AA1"

Does this make sense, or have I missed something that should be done to make
updating templates easy?

Dan Moyer

----- Original Message -----
From: "Dan Moyer"
>
> I've sent Robert a program called "Template Handler", which intends to
make
> it easy to store & retrieve snippets or "templates" of code, for both
> Euphoria and Win32Lib (could be extended to EDS etc, too).  Anyone who's
> interested, please check it out & let me know what you think of it.
>
> It seems to work well, except I don't have many TEMPLATES to include
> with it!
>
> So I'm hoping maybe some of you will contribute code snippets for
> it.  You could either *use* the Template Handler to create template
> contributions (good exercise for it), or just send code snippets here so
> others could comment upon or improve them (could make for better
snippets).
>
> With "comment or improve" in mind, here's a sample template I might
include
> with it later (if you want to use it with the Handler, just save it to a
> file and use an extent ".etp", for "Euphoria TemPlate"); it has two
> templates in it, and the Handler does NOT show all the "!!" comments, just
> the name, description, and code.
>
> Dan Moyer
>
> following could be put into a file, eg "Seq1.etp", to use with the
handler:
>
<snip proto-template>

new topic     » goto parent     » topic index » view message » categorize

3. Re: [GEN] Template Handler

Hi Dan:
What about the possibility of someone finding a (THE FORCE FORBID!) bug
in a template.  I don't see how you would replace that template with
your stated feature list.

Regards
Brian Keene

--- Dan Moyer <DANIELMOYER at prodigy.net> wrote:
> 
> Since my "Template Handler" needs Templates to be useful, and they
> would
> presumably be added semi-regularly, I have to make some nice simple
> way to
> accomplish this "update".
> 
> Here's what I have thought of, maybe you all can see flaws or
> improvements
> for it?
> 
> TEMPLATE UPDATE FEATURE DETAILS:
> 
> 1.  An "update" file would have TWO parts:
>    a)  new FILES (ie, new CATEGORIES of templates);
>    b)  new TEMPLATES to be added to EXISTING categories;
> 
> 2.  The "update facility" would read in the update file, put all of
> the NEW
> FILES info into ONE VARIABLE (or section of a sequence), all of NEW
> TEMPLATES into ANOTHER variable (or second part of main);
> 
> 3.  Update facility *compares* FILENAMES from update file against a
> dir of
> folder;  puts all filenames *not* in dir into a combo box, asks user
> to
> either select which ones to add, or "add all";  selected new files
> are
> written to new template files;
> 
> 4.  Update facility then compares NEW template NAMES against names in
> existing appropriate categories (each category is a separate file);
> puts any
> "new" templates NOT already in an existing file into a tabbed folder
> of
> combo boxes, with ability to select which to add, and an "add all in
> this
> category" button; also an overall "add *all* new templates" button
> outside
> tabbed folder; selected templates are written to end of existing
> template
> files.
> 
> 5.  The "Templates Update File" NAME might be something like: 
> UpdTempl.AA1
> (incrementing the extent for each new update, so people could know if
> they
> have updated with it before or not); and after an update, user given
> choice
> to either DELETE the file which just updated the Templates, or to
> SAVE it as
> "BakTempl.AA1"
> 
> Does this make sense, or have I missed something that should be done
> to make
> updating templates easy?
> 
> Dan Moyer
> 
> ----- Original Message -----
> From: "Dan Moyer"
> >
> > I've sent Robert a program called "Template Handler", which intends
> to
> make
> > it easy to store & retrieve snippets or "templates" of code, for
> both
> > Euphoria and Win32Lib (could be extended to EDS etc, too).  Anyone
> who's
> > interested, please check it out & let me know what you think of it.
> >
> > It seems to work well, except I don't have many TEMPLATES to
> include
> > with it!
> >
> > So I'm hoping maybe some of you will contribute code snippets for
> > it.  You could either *use* the Template Handler to create template
> > contributions (good exercise for it), or just send code snippets
> here so
> > others could comment upon or improve them (could make for better
> snippets).
> >
> > With "comment or improve" in mind, here's a sample template I might
> include
> > with it later (if you want to use it with the Handler, just save it
> to a
> > file and use an extent ".etp", for "Euphoria TemPlate"); it has two
> > templates in it, and the Handler does NOT show all the "!!"
> comments, just
> > the name, description, and code.
> >
> > Dan Moyer
> >
> > following could be put into a file, eg "Seq1.etp", to use with the
> handler:
> >
> <snip proto-template>
> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: [GEN] Template Handler

Brian,

Hmm, you're right, I was just thinking about *adding* new templates in
updates, not about *fixing* bent ones!  I am planning on giving the facility
to do that semi-manually in the Handler itself, with "edit" choice "replace
an existing template with code in edit box", (as well as "delete" a
template), maybe if I implement that *first*, then I might be able to use
that in relation to update files, maybe a token or whatever you call it in
the update file for "replace that template with this one".

Thanks!

Got any templates you could contribute?  :)

Dan


----- Original Message -----
From: <brian_keene at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, September 26, 2001 4:54 AM
Subject: Re: [GEN] Template Handler


>
> Hi Dan:
> What about the possibility of someone finding a (THE FORCE FORBID!) bug
> in a template.  I don't see how you would replace that template with
> your stated feature list.
>
> Regards
> Brian Keene
>
> --- Dan Moyer <DANIELMOYER at prodigy.net> wrote:
> >
> > Since my "Template Handler" needs Templates to be useful, and they
> > would
> > presumably be added semi-regularly, I have to make some nice simple
> > way to
> > accomplish this "update".
> >
> > Here's what I have thought of, maybe you all can see flaws or
> > improvements
> > for it?
> >
> > TEMPLATE UPDATE FEATURE DETAILS:
> >
> > 1.  An "update" file would have TWO parts:
> >    a)  new FILES (ie, new CATEGORIES of templates);
> >    b)  new TEMPLATES to be added to EXISTING categories;
> >
> > 2.  The "update facility" would read in the update file, put all of
> > the NEW
> > FILES info into ONE VARIABLE (or section of a sequence), all of NEW
> > TEMPLATES into ANOTHER variable (or second part of main);
> >
> > 3.  Update facility *compares* FILENAMES from update file against a
> > dir of
> > folder;  puts all filenames *not* in dir into a combo box, asks user
> > to
> > either select which ones to add, or "add all";  selected new files
> > are
> > written to new template files;
> >
> > 4.  Update facility then compares NEW template NAMES against names in
> > existing appropriate categories (each category is a separate file);
> > puts any
> > "new" templates NOT already in an existing file into a tabbed folder
> > of
> > combo boxes, with ability to select which to add, and an "add all in
> > this
> > category" button; also an overall "add *all* new templates" button
> > outside
> > tabbed folder; selected templates are written to end of existing
> > template
> > files.
> >
> > 5.  The "Templates Update File" NAME might be something like:
> > UpdTempl.AA1
> > (incrementing the extent for each new update, so people could know if
> > they
> > have updated with it before or not); and after an update, user given
> > choice
> > to either DELETE the file which just updated the Templates, or to
> > SAVE it as
> > "BakTempl.AA1"
> >
> > Does this make sense, or have I missed something that should be done
> > to make
> > updating templates easy?
> >
> > Dan Moyer
> >
> > ----- Original Message -----
> > From: "Dan Moyer"
> > >
> > > I've sent Robert a program called "Template Handler", which intends
> > to
> > make
> > > it easy to store & retrieve snippets or "templates" of code, for
> > both
> > > Euphoria and Win32Lib (could be extended to EDS etc, too).  Anyone
> > who's
> > > interested, please check it out & let me know what you think of it.
> > >
> > > It seems to work well, except I don't have many TEMPLATES to
> > include
> > > with it!
> > >
> > > So I'm hoping maybe some of you will contribute code snippets for
> > > it.  You could either *use* the Template Handler to create template
> > > contributions (good exercise for it), or just send code snippets
> > here so
> > > others could comment upon or improve them (could make for better
> > snippets).
> > >
> > > With "comment or improve" in mind, here's a sample template I might
> > include
> > > with it later (if you want to use it with the Handler, just save it
> > to a
> > > file and use an extent ".etp", for "Euphoria TemPlate"); it has two
> > > templates in it, and the Handler does NOT show all the "!!"
> > comments, just
> > > the name, description, and code.
> > >
<snip>

>
>

new topic     » goto parent     » topic index » view message » categorize

5. Re: [GEN] Template Handler

Bernie,

I'd never thought of that, and haven't ever used EDS, so I'd have to scrap a
lot of what I've done, & learn EDS, but it does sound like a better way to
approach the basic template storage, retrieval, and usage.

But I'm not sure it would do anything to answer my concerns about making
updating templates easy.  My idea is that I would like to be able to put a
bunch of new templates into one file, with incrementing extents (update.aa1,
update.aa2, etc); updates sent to Robert, user downloads any or all, clicks
on "update", and handler discerns which are new and need to be added and
which are not and don't.  It might ever be better if I abandoned the idea of
multiple template files altogether, and combined all Euphoria templates into
one file, added to by updates, same with Win32Lib templates, maybe.

And I forgot about linux, sorry, I'll see what I can do to add capability to
store/use them.  Should I add capability to store/retrieve code templates
for use with EDS, too?

Dan

----- Original Message -----
From: "Bernie Ryan" <xotron at localnet.com>
To: "EUforum" <EUforum at topica.com>
Sent: Wednesday, September 26, 2001 8:14 AM
Subject: RE: [GEN] Template Handler


>
>
> Dan Moyer wrote:
> > ETC
>
>  Dan:
>     Why don't you keep the Templates in a EDS database
>     Then you could have a index file for each ex, eu, exw.
>     The user could then easily update the templates.
>     The snips that a user would like to use could then
>     selected and placed into the clipboard, or into a editor.
> Bernie
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu