Good practice / revisioning / template / backup


#1

my english is not good enough for a tutorial,
but i have a idea about a
good practice beginner info sticky

  • revisioning
    it could be a good idea even for small tests to start with a revisioning system
    easy just as some comment lines
    // rev 0.77b
    and some info what you changed, what you published ( like here to a forum post )
    or even show it in the header ( window title )
example
/*
 use a longer description for your project:
 _____________________________________________________________
 here want test a basic layout of a processing sketch
 using a revision number system
 _____________________________________________________________
 also the usual info about file(s):
 /revisioning/revisioning.pde
 /revisioning/data/optional data files like images, fonts, data csv...
 means you can only "distribute" as zip of the 
 /revisioning/ directory
 _____________________________________________________________
 and optional info about copy left:
 https://www.gnu.org/licenses/copyleft.en.html
 kll-engineering
 01/2019
 [ CC BY SA ] https://creativecommons.org/licenses/by-sa/4.0/legalcode
 or Public Domain [PD]
 [ CC0 ]      https://creativecommons.org/publicdomain/zero/1.0/
 _____________________________________________________________
 and a revision list:
 */
// v0.0  start this
// v0.1b internal revision / tests
// v0.1  public rev : posted at forum
String rev=" v0.1";
// canvas window layout:
String mytitle="my project";
int mywidth=500, myheight=500;
// animation:
int cr=0;                             // ellipse radius see mouse wheel

void settings() {
  size(mywidth, myheight);
}

void setup() {
  surface.setTitle(mytitle+rev);
  println("canvas: "+width+" * "+height);
  println("operational concept: \n key :\n mouse : wheel -> radius");
  // static look 
  fill(0, 200, 0);
  stroke(200, 0, 0);
  strokeWeight(width/20);
  cr = width/2;                        // ellipse radius setup
}

void draw() {
  background(200, 200, 0);
  ellipse(width/2, height/2, cr, cr);
}

void keyPressed() {
  println("key "+key+" keyCode "+keyCode);
}

void mousePressed() {
  if ( mouseButton == LEFT ) {
    println("LEFT");
  }
  if ( mouseButton == RIGHT ) {
    println("RIGHT");
  }
  if ( mouseButton == CENTER ) {  // hardware and OS dependency
    println("WHEEL");
  }
}

void mouseWheel(MouseEvent event) {
  float e = event.getCount();
  cr += e;                        // hardware and OS dependency
  println("e "+e+" radius "+cr);
}

/*
 if you want this to be the template to come up 
 when you start (a new) processing sketch pls. save it as
 /sketchbook/templates/Java/sketch.pde
*/

  • template
    it might be not too much used,
    so possibly you felt bad already
    that a new sketch comes up empty and you have to type the defaults again and again
    https://github.com/processing/processing/wiki/Templates
    the idea is to save a good prototype / like above code example / as a template to
    /sketchbook/templates/Java/sketch.pde

  • backup
    YES make backups!
    we all learn the hard way when loose some code, projects, OS installations or hard drives…
    and also about processing ( or arduino projects ) i have tried many ways:

    • “save as” MyProject_v02
      can help to save each revision under a different name,
      but if all works well you end up with a lot of project entries you never use again
      • so possibly better first make a sub directory for each project in development??
    • zip it away
      now you can zip a project or the whole sketch dir
      and you can save that even to a other drive or computer ( daily ? )

but that is only part of the story,

    • what if you want to work on 2 computers ( but same project )
      • i have tried to have the sketch dir on a USB stick ( worked well for 2 years )
        ( so actually had no backup but available on ?every? computer )
      • run google drive on windows and have the sketch dir on it
        • so automatic backup and availability even in a “remote” team
          but after 3 years i had 9000 files and 3GB usage on google drive and the
          boot of the old PC was delayed 5min?
        • a cleanup by “move to zip” did actually not help too much
          ( by zip to PC and reset will loose all the original google files ( spreadsheets… ))

so i think for above 3 points there is a lot of knowhow with the experts
i hope they want to share.


#2

Thanks for sharing this.

Do you mean, revise this into a sticky post on the forum – or as entries in an FAQ?


#3

who ever works on tutorials or any "using processing “intro” "
what reaches beginners might pls. think of that points.
( and translate it, LOL )