Friday 14 June 2013

Week of June 10, 2013

Presentation

Create Integration Site Use Case Structure

Write Use Cases

Wednesday 5 June 2013

Week of June 3, 2013

Update MySQL scripts, reduce compound primary keys

Plan presentation for Integration Site

Reading through BBB Seneca Integration Use Cases

Attempt to create few Use Cases to Java Classes

Build Power Point slides for presentation

Friday 31 May 2013

Week of May 31, 2013



Week of May 31, 2013

Attend OCE Discovery
Learn CoffeeScript
Modify Database Design and MySQL scripts
Planning actual Integration site

Friday 24 May 2013

Week of May 21, 2013



Week of May 21, 2013

Made an alternative database script that uses a table and function to manually add pk to tables instead of using auto increment, also added a sample data script

Scripts used to generated MYSQL database, connect Netbean to database, everything works fine

Setting up development environment for BBB HTML5 project

Friday 17 May 2013

Week of May 13



  • Under Chad’s guidance, the origin/master of SenecaCDOT-BigBlueButton/bigbluebutton is now fixed, we can build the BBB client from master now
  • Design update on the integration site ERD        
  • Updating the SQL script and converts it to work with MYSQL
  • Setting up development environment for the integration site
  • Setting up netbean IDE, making a HelloWeb site

 The link that offer tutorial on fixing master is at: 





Friday 10 May 2013

Track Week May 6



Week of May 6
Orientation
Installing VMware Player
Installing Ubuntu 10.0.4 64-bit
Installing BigBlueButton 8.1
Installing LibreOffice
Installing Ruby
Installing ffmpeg
Installing API Demos
Installing Development Environment
Setting up Github on Ubuntu
Building bigBlueButton Client (run into issue)
Creating SQL script for BBB Integration project
Updating ERD diagram for the BBB Integration DB
Setting up Eclipse, making hello world

Thursday 11 April 2013

Checked



Can anyone give me a hint as to why there are garbage symbols after checked option?

Tuesday 9 April 2013

double CoinStack::value()


double CoinStack::value(){
  double value = 0.0;
  Coin C;
  open(_fname, ios::out|ios::binary);
  if(!fail()){
    while(!IsEmpty()){
      C = pop();
      value += (int)C;
      write((const char*)&C, sizeof(C));
    }
  }
  close();
  open(_fname, ios::in|ios::binary);
  if(!fail()){
    seekg(0, ios::end);
    int curloc = (int)tellg() - sizeof(Coin);
    while(curloc >= 0){
      seekg((ios::pos_type)curloc);
      read((char*)&C, sizeof(C));
      push(C);
      curloc -= sizeof(C);
    }
  }
  close();
  clear();
  open(_fname, ios::out|ios::trunc);
  close();
  return value;
}

Backward Binary Print with seekg and ios::cur


#include <iostream>
#include <fstream>
using namespace std;

int main(){
  int i;
  int loc;
  fstream file("output.bin", ios::in|ios::binary);
  while(!file.fail()){
    file.read((char*)&i, sizeof(i));
    if(!file.fail()){
      cout<<i<<", ";
    }
  }
  cout<<endl;
  file.clear();
  cout<<(loc = file.tellg())<<endl;
  loc -= sizeof(int);
  while (loc >= 0){
    file.seekg((ios::pos_type)loc);
    file.read((char*)&i, sizeof(i));
    cout<<i<<", ";
    loc -= sizeof(int);
  }
  file.seekg((ios::off_type)0, ios::end);
  while(file.tellg()) {
    file.seekg((ios::off_type)-(signed)sizeof(int), ios::cur);
    file.read((char*)&i, sizeof(i));
    cout<<i<<", ";
    file.seekg((ios::off_type)-(signed)sizeof(int), ios::cur);
  }
  return 0;
}

DLL Template


#ifndef __DLLTemp_H__
#define __DLLTemp_H__

template <class T>
class DLL;

template <class T>
class Node{
  T _data;
  Node<T>* _prev;
  Node<T>* _next;
  Node(T data, Node<T>* prev=(Node<T>*)0, Node<T>* next=(Node<T>*)0);// just incase, review later
  friend class DLL<T>;
};

template <class T>
class DLL{
  Node<T>* _head;
  Node<T>* _curr;
  Node<T>* _tail;
  void copy(DLL<T>& D);
public:
  DLL();
  DLL(DLL<T>& D);
  virtual ~DLL();
  bool isEmpty();
  void append(T data);
  DLL<T>& operator=(DLL<T>& D);
  T remove();   // removes the current node and returns the data
  bool del();     // removes the current node returns false if is empty
  void insert(T data); // insterts before current
  bool goHead();
  bool goTail();
  bool goNext();
  bool goPrev();
  T visit();    // returns the current data
};

template <class T>
Node<T>::Node(T data, Node<T>* prev, Node<T>* next){
  _data = data;
  _prev = prev;
  _next = next;
}

template <class T>
DLL<T>::DLL(){
  _head = _tail = _curr = 0;
}

template <class T>
DLL<T>::~DLL(){
  while(del());
}

template <class T>
void DLL<T>::copy(DLL<T>& D){
  int curpos;
  for(curpos=0;D.goPrev();curpos++); // findout where is current
  if(!D.isEmpty()){
    do{
      this->append(D.visit());
    }while(D.goNext());
  }
  for(D.goHead(), this->goHead();curpos;D.goNext(), this->goNext(),curpos--);
}

template <class T>
DLL<T>::DLL(DLL<T>& D){
  _head = _tail = _curr = 0;
  copy(D);
}

template <class T>
DLL<T>& DLL<T>::operator=(DLL<T>& D){
  while(del());
  copy(D);
  return *this;
}

template <class T>
void DLL<T>::append(T data){
  Node<T>* newnode = new Node<T>(data);
  if(_tail){  // ! empty
    _tail->_next = newnode;
    newnode->_prev = _tail;
    _tail = _curr = newnode;
  }
  else{
    _tail = _curr = _head = newnode;
  }
}

template <class T>
T DLL<T>::remove(){
  T data = visit();
  del();
  return data;
}

template <class T>
bool DLL<T>::del(){
  bool ok = false;
  if(_curr){
    ok = true;
    Node<T>* todel = _curr;
    if(_curr->_next){
      _curr->_next->_prev = _curr->_prev;
    }
    else{
      _tail = _tail->_prev;
    }
    if(_curr->_prev){
      _curr->_prev->_next = _curr->_next;
    }
    else{
      _head = _head->_next;
    }
    _curr = _curr->_next;
    delete todel;
  }
  return ok;
}

template <class T>
void DLL<T>::insert(T data){
  if(_head == _curr){
    _head = new Node<T>(data, (Node<T>*)0, _head);
    _curr->_prev = _head;
  }
  else {
    _curr->_prev = new Node<T>(data, _curr->_prev, _curr);
    _curr->_prev->_prev->_next = _curr->_prev;
  }
}

template <class T>
T DLL<T>::visit(){               // retruns data of current
return _curr->_data;
}

template <class T>
bool DLL<T>::goHead(){
  _curr = _head;
  return (_curr != 0);
}

template <class T>
bool DLL<T>::goTail(){
  _curr = _tail;
  return (_curr != 0);
}

template <class T>
bool DLL<T>::goNext(){
  bool rt = false;
  if(_curr->_next){
    rt = true;
    _curr = _curr->_next;
  }
  return rt;
}

template <class T>
bool DLL<T>::goPrev(){
bool rt = false;
  if(_curr->_prev){
    rt = true;
    _curr = _curr->_prev;
  }
  return rt;
}

template <class T>
bool DLL<T>::isEmpty(){
return !_head;
}



#endif

Saturday 6 April 2013

CCheckList Constructors

Hi,

the web documentation for CCheckList Constructor says:

Passes corresponding values to the Base class (CField)

The constructor for CField is:


CField::CField(int Row, int Col,int Width, int Height,
    void* Data,bool Bordered,const char* Border)

but I'm not sure what I'm suppose to pass to Height and Data

so I put


CCheckList::CCheckList(const char* Format, int Row, int Col, 
        int Width,bool radio, bool Bordered,
        const char* Border) :CField(Row, Col, Width, 0, 0, Bordered, Border){


Should I pass the two zeroes for Height and Data? If not, what am I suppose to pass?




Thursday 4 April 2013

DLL implemented


#include "dll.h"
Node::Node(int data, Node* prev, Node* next){
  _data = data;
  _prev = prev;
  _next = next;
}

DLL::DLL(){
  _head = _tail = _curr = 0;
}
DLL::~DLL(){
  while(del());
}
void DLL::copy(DLL& D){
  int curpos;
  for(curpos=0;D.goPrev();curpos++); // findout where is current
  if(!D.isEmpty()){
    do{
      this->append(D.visit());
    }while(D.goNext());
  }
  for(D.goHead(), this->goHead();curpos;D.goNext(), this->goNext(),curpos--);
}
DLL::DLL(DLL& D){
  _head = _tail = _curr = 0;
  copy(D);
}
DLL& DLL::operator=(DLL& D){
  while(del());
  copy(D);
  return *this;
}

void DLL::append(int data){
  Node* newnode = new Node(data);
  if(_tail){  // ! empty
    _tail->_next = newnode;
    newnode->_prev = _tail;
    _tail = _curr = newnode;
  }
  else{
    _tail = _curr = _head = newnode;
  }

}
int DLL::remove(){
  int data = visit();
  del();
  return data;
}
bool DLL::del(){
  bool ok = false;
  if(_curr){
    ok = true;
    Node* todel = _curr;
    if(_curr->_next){
      _curr->_next->_prev = _curr->_prev;
    }
    else{
      _tail = _tail->_prev;
    }
    if(_curr->_prev){
      _curr->_prev->_next = _curr->_next;
    }
    else{
      _head = _head->_next;
    }
    _curr = _curr->_next;
    delete todel;
  }
  return ok;
}
void DLL::insert(int data){
  if(_head == _curr){
    _head = new Node(data, (Node*)0, _head);
    _curr->_prev = _head;
  }
  else {
    _curr->_prev = new Node(data, _curr->_prev, _curr);
    _curr->_prev->_prev->_next = _curr->_prev;
  }
}

int DLL::visit(){               // retruns data of current
return _curr->_data;
}
bool DLL::goHead(){
  _curr = _head;
  return (_curr != 0);
}
bool DLL::goTail(){
  _curr = _tail;
  return (_curr != 0);
}
bool DLL::goNext(){
  bool rt = false;
  if(_curr->_next){
    rt = true;
    _curr = _curr->_next;
  }
  return rt;
}
bool DLL::goPrev(){
bool rt = false;
  if(_curr->_prev){
    rt = true;
    _curr = _curr->_prev;
  }
  return rt;
}
bool DLL::isEmpty(){
return !_head;
}

Wednesday 27 March 2013

setBit CopyBits


void setBit(unsigned int& V, int bitNo, bool value){
  if(value){
    V = V | (1 << bitNo-1);
  }else{
    V = V & ~(1 << bitNo-1);
  }
}

void copyBits(unsigned int& V, int bitNo, int NoOfBits, unsigned int mask){
  unsigned int i;
  unsigned int m;
  bool value;
  for(i=bitNo; i<bitNo+NoOfBits; i++){
    m = 1 << i-1;
    value = mask & m;
    setBit(V, i, value);
  }
}

Tuesday 12 March 2013

DLL insert



void DLL::insert(int data){
  if(_head == _curr){
    _head = new Node(data, (Node*)0, _head);
    _curr->_prev = _head;
  }
  else {
    _curr->_prev = new Node(data, _curr->_prev, _curr);
    _curr->_prev->_prev->_next = _curr->_prev;
  }
}

Queue Add


void Queue::add(int data){
  Node* last = _head;
  while (last->_next) {
    last = last->_next;
  }
  Node* to_add = new Node(data);
  last->_next = to_add;
}

Probably work, probably not

Saturday 26 January 2013

Week 3: console.display



void Console::display(const char* str, int row, int col, int fieldLen){
        unsigned int i;
        unsigned int size;
        setPos(row, col);
        fieldLen > 0 ? size=fieldLen : size=strlen(str);
        for(i=0;i<size;i<strlen(str) ? putChar(str[i]) : putChar(' '),i++);

  }



Does this count as one line program?

Week 3 challenges: Xmover




#include "console.h"

using namespace cio;

int main(){
  bool done = false;
  int row = console.getRows()/2;
  int col = console.getCols()/2;
  int key;
  int end_flag=0;
  while(!done){
if ((row == console.getRows()-1 && col == console.getCols()-2) || (row == console.getRows()-2 && col == console.getCols()-1)) {
end_flag=1;
} else {
end_flag=0;
}
    console.setPos(row, col);
    console.putChar('A');
    key = console.getKey();
    console.setPos(row, col);
    console.putChar('.');
    switch(key){
    case UP:
      if(row > 0 ){
        row--;
      }
      else{
        console.alarm();
      }
      break;
    case DOWN:
      if(row < console.getRows()-1 && end_flag==0){
        row++;
      }
      else{
        console.alarm();
      }
      break;
    case LEFT:
      if(col > 0){
        col--;
      }
      else{
        console.alarm();
      }
      break;
    case RIGHT:
      if(col < console.getCols()-1 && end_flag==0){
        col++;
      }
      else{
        console.alarm();
      }
      break;
    case ESCAPE:
      done = true;
      break;
    }
  }

  return 0;
}

Wednesday 16 January 2013


Add with checking for valid input


#include <iostream>
#include <stdlib.h>
#include <ctype.h>

using namespace std;


int main(int argc, char* argv[]) {

int sum;
int i;
int j;
int check = 0;
if (argc == 3) { // can only handle 3 parameters
for (j=1; j<=2 && check==0; j++) {
if (!isdigit(argv[j][0]) && argv[j][0]!='-')
// special check for the first char, which may be '-'
check=1;
for (i=1; argv[j][i]!='\0' && check==0; i++) {
if (!isdigit(argv[j][i]))
check=1;
}
}
}
if (argc==3 && check==0) {
sum = atoi(argv[1]) + atoi(argv[2]);
cout << sum << endl;
} else {
cout << "Enter 2 valid parameters after the program name" << endl;
}
return 0;
}

I don't think I'll post the the other three math programs with validation, it's the same code as the blue section.