September 2010
M T W T F S S
« Jun «-»  
 12345
6789101112
13141516171819
20212223242526
27282930  

Leaving Chris World?

Why not bring back a souvenir?

Archives

An Unlikely Conclusion.. WAIT!!!

An Unlikely Conclusion.. WAIT!!!


Last nights little venture was to make the very
large classes easier to keep on the screen.
The task turned out a bit more difficult than
I had thought.

You can download the software thus far
for Mac OS X.
Software Thus Far

Is it over?

That's something I begin to ask myself as the data
set no longer seems so pleasing to me. I have yet
to have detected a change in any enrollment. And
I wonder if this is a software issue or it's just
the data itself.

Regardless, it seems the Class schedule project
(the long running thing that it is) ought to be
brought to a close. There are other obligations
I agreed to fulfill.

Still, I don't feel like I could close the project
with out one of two things.

I.
Either I absolutely confirm there is no difference
in files over this short time period. Thus,
forcing me to conclude that the average HSU student
apparently sticks to their class choices the first week
of college. And by absolutely confirm I mean I write
one last piece of software that walks my data and
tells me no changes.

And II.
I write something that still collects the data daily
but with out my intervention so I can take a better
look later or during next semester.

Though the programing was a challenge and I learned
a deal about the data set I don't really feel like
it's a strong ending to the thing.

....
I can't in good conscience call it a good ending but
it's been fairly successful through it's duration
and if anything I'd rather say it's on hold.
Which if it wasn't for the fact that 'on hold' is the
kiss of death from projects (RIP Thermistor?)
then I would feel okay. But this one was suppose
to be different.

12:33 AM (tomorrow)

WAIT!
I just added the new data files... and I saw a
change!!!!!!

Ah HA!


Oh my gosh, suddenly I feel vindicated!
And student apparently wait till the second week
before they move around.

So, though as I said I have to move on...

Strange Notes
-GERM 106 German Level II just knocked off 5 seats?
A course called RS Zen Experiential Weekend came into existent with
no seats and no students.
 
/**
 *
 *
 * Parse and display courses in majors
 * TODO: 1 use proControl to route into a controller for zooms and pans and controls
 * TODO: 2 jump to next major (that exists)
 * TODO: 3 Full timeline plot
 * TODO: 4 Aggregate statistics
 * TODO: 5 Auto Download of data
 * TODO: 6 Better viewing controls and represenation
 *
 * January 29, 2009
 * Chris B Stones
 */
 
import proxml.*; // Using proXML due to bugs in core
XMLInOut xmlIO;
 
String files[] = {
    "majors1.xml","majors2.xml","majors3.xml",
    "majors4.xml","majors5.xml","majors6.xml",
    "majors7.xml","majors8.xml","majors9.xml",
    "majors10.xml"   };
 
boolean   PARSEING;
boolean   thread_not_done_wait;
 
String    masterdate;
ArrayList timeLine;
ArrayList majors;
ArrayList courses;
 
int       timeLineIndex;
int       selectMajor;
String    loadingtitle;
 
//Integrator interpol;
//Integrator interpol2;
String[] data;
String[] l;
int enrolled,capacity;
String title,shortname;
int c,x,y;
 
void setup(){
 
  size(1300,800); // Line goes first to prevent weird behavior
 
  selectMajor = 0; // alphebetical order
  PARSEING = true;
  courses = new ArrayList();
  timeLine = new ArrayList(); // holds majors ArrayList's
 
  // Load Each file into memory
  for( int m = 0; m < files.length; m++) {
    majors = new ArrayList();
    xmlIO  = new XMLInOut(this);
    xmlIO.loadElement(files[m]);  // threads off
 
    thread_not_done_wait = true;  // simplest way to force ourselves to wait for the
    while(thread_not_done_wait);  // thread to finish
 
    timeLine.add(majors); // now we know data is loaded
  }
  PARSEING = false;
 
  println("TimeLine size: " + timeLine.size());
  timeLineIndex = 0;
 
  //frameRate(25);
  smooth();
  //interpol = new Integrator(0,0.8f,0.4f);
  //interpol2 = new Integrator(0,0.8f,0.4f);
 
  PFont dfont = loadFont("courier.vlw");
  textFont(dfont,13);
 
  x = 100;
  y = 30;
}
 
void draw() {
  //c++;
  //println("draw called: "+c);
  //println("courses size: "+ courses.size());
 
  if(PARSEING) {
    //the load bar displays
    background(100);
    rect(10,height/2,norm(timeLine.size(),0,65)*20,20);
    text(loadingtitle,10,(height/2)-20);
 
  } else {
 
    background(100);
    smooth();
    line(90,0,93,height);
 
    majors = (ArrayList) timeLine.get(timeLineIndex);
 
    //  Major currentMajor = new Major();
    //println("major size: "+majors.size());
 
    if ( majors.size() > 0 ) {
      Major currentMajor  = (Major) majors.get(selectMajor);
 
      fill(255);
      text(currentMajor.date,width-200,height-20);// Draw the date
      text("<-- A Time  S -->",width-200,height-40);
      text("<-- Z Major X -->",width-200,height-60);
 
      ArrayList crsFromMajor = currentMajor.courses;
      for(int j = 0; j < crsFromMajor.size()-1; j++)
      {
        Course crs = (Course) crsFromMajor.get(j); // need to cast to a type
        draw_class(x, y+(j*37),  crs.c, crs.e, crs.shortname, crs.title);
      }
 
    }
 
  }
}
 
void draw_class(int x, int y, int cap,int enrolled,String shortname, String title) {
  // Label Short name
  fill(255,255,255);
  text(shortname,x-(6*12),y+3);
 
  // Label Title
  text(title,x-12,y-11);
 
//  if ( enrolled > cap ) { // course is overenrolled
//
//  }
 
  if ( cap > 50 ) { // if there's a lot of seats draw compressed version
    boolean slots_remain = true;
    int i = 0;
 
    while(slots_remain) {
      if ( cap == 0 && enrolled == 0 ) {
        slots_remain = false;
      }
 
      if ( cap > 0 ) {
        cap--;
      }
      if ( cap != 0) { // spots to fill
//        int w = 0;
//        if( enrolled == 0 ) {
//          w = 18-7;
//        }
        fill(#FFFFFF);
        ellipse(i*(7)+x,y, 15, 15);
      }
 
      if( enrolled > 0 ) {
        enrolled--;
      }
     if ( enrolled != 0) { // student for the spot
//        int w = 0;
//        if ( cap == 0 ) {
//          w = 18-7;
//        }
        fill(200,0,0);
        ellipse(i*(7)+x,y, 8, 8);
      }
 
      i++;
    }
 
  } else {
    // Draw spots to fill
    for(int i = 0; i < cap; i++ ) {
      ellipse(i*(10+8)+x,y, 15, 15);
    }
 
    // Draw in enrolled in the course
    fill(200,0,0);
    for(int i = 0; i < enrolled; i++ ) {
      ellipse(i*(10+8)+x,y, 8, 8);
    }
  }
 
  // draw filled seat (filled seat)
 
  // draw empty seat (hite circle)
 
  // draw student no seat (red dot)
 
}
 
public class Course {
  int crn;
  int e;
  int c;
  String shortname;
  String title;
 
  Course(int crn,int e,int c,String shortname,String title){
    this.crn = crn;
    this.e = e;
    this.c = c;
    this.shortname = shortname;
    this.title = title;
  }
}
 
// We need a collection of Majors each with a list of their courses
public class Major {
  String name;
  String date;
  ArrayList courses;
 
  Major() {
  }
  Major(String name, String date, ArrayList courses) {
    this.name = name;
    this.date = date;
    this.courses = courses;
  }
}
 
/**
 * Parse xmlEvent could be any major but it's always from
 * slice of time majors ArrayList is added to the timeLine
 *
 */
void xmlEvent(proxml.XMLElement e){
 
  String localdate;
 
  masterdate = e.getAttribute("date");
  localdate = masterdate;
 
  proxml.XMLElement[] majorsElement = e.getChildren();
 
  for(int i = 0; i < majorsElement.length; i++) {
    proxml.XMLElement[] classes = majorsElement[i].getChildren();
 
    // Number of Courses in a Major
    //    int count = majors[i].countChildren();
    //    println(majors[i].getAttribute("name")+" has "+count);
    //    for(int s = 0; s < count; s++) print("*");
    //    print("\n");
 
    //    if ( majors[i].hasAttributes()  && majors[i].getAttribute("name").equals("CIS") ) {
    //
    //    }
    // for Effieciny load select majors
    //  if ( majors[i].hasAttributes()  && majors[i].getAttribute("name").equals("BIOL") ) {
    ArrayList crss = new ArrayList();
 
    for(int j = 0; j < classes.length;j++){
      proxml.XMLElement clas = classes[j];
 
      int    crn   = clas.getIntAttribute("crn");
      int    cap   = clas.getIntAttribute("capacity");
      int    enr   = clas.getIntAttribute("enrolled");
      String sname = clas.getAttribute("shortname");
      String titl  = clas.getAttribute("title");
 
      loadingtitle = titl;
 
      //println("major: "+i+" course:"+j+" title:"+titl);
      crss.add(new Course(crn,enr,cap,sname,titl));
      //println("Class "+enr+"/"+cap+" "+sname+" title: "+titl);
    }
 
    // } // end on select 1 major
    // if( majorsElement[i].hasAttributes() ) {
    Major m = new Major(majorsElement[i].getAttribute("name"), masterdate, crss);
    majors.add(m);
    // }
 
  }
  // timeLine.add(majors); // <-- thi shas to be in athe function that threads off
  println("File Loaded: "+ localdate);
  thread_not_done_wait = false;
  // Since this is threaded I presume I'll need to add some software semphores or something
 
  //timeLine.add(majors); // <-- thi shas to be in athe function that threads off
  //PARSEING = false; // must wait or the program crashes
}
 
// Key Functionality =================================================
void keyPressed() {
 
  // Toggle Through Time
  if ( key == 'a') { // back in time
    if( timeLineIndex != 0 ) {
      timeLineIndex--;
      println("Back in Time: "+timeLineIndex);
    }
  }
 
  if ( key == 's') { // forward in time
    if( timeLineIndex != files.length-1 ) {
      timeLineIndex++;
      println("Forward in Time: "+timeLineIndex);
    }
  }
 
  // Toggle through majors
  if ( key == 'x') {
    if( selectMajor < 65 ) {
      selectMajor++;
      y = 30;
      x = 100;
      println("Next Major: "+selectMajor);
    }
  }
 
  if ( key == 'z') {
    if( selectMajor > 0 ) {
      selectMajor--;
      y = 30;
      x = 100;
      println("Previous Major: "+selectMajor);
    }
  }
 
  if (key == CODED) {
    if (keyCode == RIGHT) {
      x = x - 30;
    }
    else if (keyCode == LEFT) {
      x = x + 30;
    }
    else if (keyCode == UP) {
      y = y + 30;
    }
    else if (keyCode == DOWN) {
      y = y - 30;
    }
  }
 
  if ( key == 'q') {
    exit();
  }
}
 

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Security Code: