wii
mrmr
knx
|
\/
Router ---> filter
^_________|
|
|
\/
proj RA (Theta Phi)
ProjRB (Theta, Phi)
|
|
\/
Router (same as above)
| _____________________> GRR
| |
|______________>You |
\/ | |
WARP <_________| _______|
|
|
\/
Proj Pix
Tuesday, May 1, 2012
Saturday, April 7, 2012
Epic Saturday Session
20 Min Coding Block #1
==================
Now handling precedence ( ie 4+5*2 works -> gave 14)
TREE
+
\
4
\
*
\
5
\
2
14
==================
Now handling precedence ( ie 4+5*2 works -> gave 14)
TREE
+
\
4
\
*
\
5
\
2
14
Newest issue- not handling:
CPAR closing Low Level
Added CLL (need to close low level ) state. Worked it out on paper. Check implementation?
==================
20 Min Coding Block #2
==================
Can handle both a + b * c AND ( a + b ) * c. Added CLL_STATE case in MUL token switch statement. Next, functions?
Pesky issues - case statements need {} if they have variable declarations, but don't forget "BREAK"!!!!
==================
20 Min Coding Block #2
==================
Can handle both a + b * c AND ( a + b ) * c. Added CLL_STATE case in MUL token switch statement. Next, functions?
Pesky issues - case statements need {} if they have variable declarations, but don't forget "BREAK"!!!!
Tuesday, April 3, 2012
April 3
OPR = operation = [+-*/]
CP := )
P:= Expression \n
FuncDescription:= D WT FuncName EQ FuncExpression NL
FN:=name() | name( FuncParameters )
FP := AT name | AT name CO FP
VD:= "S name = E " NL
v:= S name
E:=N | v | OP E CP | FC | E OPR E
FV := AT name (functionVariable)
FC:= FN op cp | name op FuncCallParams cp
FCP := E | E CO FCP
FE = E | FV
WT:= empty space like [\t \r].+ NOT NEW
Number := [0..9].+ (one or more numeric characters) | [0..9].+ '.' [0..9].+
C:= [a...zA..Z]. (one character)
name:= c[a..zA..Z0..9]+
D:= def
================================
isChar(char)
AT := @
S := #
class Token
OPR
CP
OP
V
FV
AT
S
Name
N
CO
EQ
char in[]
int inLen
int pos = 0
Token tokenStream[]
while( !done && pos < inLen)
skipWt( in, inlen, pos ) <------ move past white space in front of token (does not delete white space)
if( isChar ( in[pos] ) )
lexNameorDef(in, inlen, pos) -> tokenStream
elsif( in[pos] == '#' )
tokenStream.add( NewToken (Sharp) );
elsif( in[pos] == '@' )
add(newToken (AT) )
OP
CP
state stacks
top
def
expr
paren
funcCall
FuncCallParams
Add
Sub
Mul
Div
OP:= (
CP := )
P:= Expression \n
FuncDescription:= D WT FuncName EQ FuncExpression NL
FN:=name() | name( FuncParameters )
FP := AT name | AT name CO FP
VD:= "S name = E " NL
v:= S name
E:=N | v | OP E CP | FC | E OPR E
FV := AT name (functionVariable)
FC:= FN op cp | name op FuncCallParams cp
FCP := E | E CO FCP
FE = E | FV
WT:= empty space like [\t \r].+ NOT NEW
Number := [0..9].+ (one or more numeric characters) | [0..9].+ '.' [0..9].+
C:= [a...zA..Z]. (one character)
name:= c[a..zA..Z0..9]+
D:= def
================================
isChar(char)
AT := @
S := #
class Token
OPR
CP
OP
V
FV
AT
S
Name
N
CO
EQ
char in[]
int inLen
int pos = 0
Token tokenStream[]
while( !done && pos < inLen)
skipWt( in, inlen, pos ) <------ move past white space in front of token (does not delete white space)
if( isChar ( in[pos] ) )
lexNameorDef(in, inlen, pos) -> tokenStream
elsif( in[pos] == '#' )
tokenStream.add( NewToken (Sharp) );
elsif( in[pos] == '@' )
add(newToken (AT) )
OP
CP
COM
EQ
EQEQ
eif( in[pos] == '+' || in[pos] == '-' ||
add( newToken (OPR, in[pos] ) )
eif( isNum( in[pos] ) )
lexNumber( in inlen pos ) -> tokenStream
eif( in[pos] == '\n' )
add( new Token (NL) )
=====================
lexNameorDef( in, inlen, pos )
//check for def
if( pos + 2 < inlen )
in[pos] == 'd' && in[ pos + 1] == 'e' && in[ pos+2 ] == 'f' && in[pos+3] == WHITESPACE
pos = pos + 3
return newToken(D)
//name
string name
while( isAlphaNum( in[pos] ) )
name.append( in[pos] )
++ pos;
return newToken(NAME, name)
--pos; ---> because must stop before next token
state stacks
top
def
expr
paren
funcCall
FuncCallParams
Add
Sub
Mul
Div
Tuesday, March 20, 2012
Genetic
R (10) --> R(1)
Genome - set of chromosomes
Fenome - expression of the code
Crossover - A and B mix genomes to yield C
Mutation -
- random bit flip
- deletion
- shuffle
- random
Fitness Functions
Genome - set of chromosomes
Fenome - expression of the code
Crossover - A and B mix genomes to yield C
Mutation -
- random bit flip
- deletion
- shuffle
- random
Fitness Functions
Tuesday, March 6, 2012
Specifications and Requirements
Vending Machine Specifications and Requirements
who are the stake holders?
user?
owner?
product makers
property owner
HIGH LEVEL GOALS
$$
cost of product, machine
demand, creating demand, incentive
availability
Consider:
How to appeal to customers (competitoin)
Automate an interaction
What is the product?
*mechanism, cost, definition of vending machine
Feedback
*selection, price, how to select, warnings, don't-tip-me-over sign
Full range of exceptions/expectations
out of stock/change
invalid input/use
log/record (safety of food)
exception state(s) --> out of order
Security requirements
subversion, intentional misuse
physical and logical
user and operator safety, financial safety
pests and varmints
who are the stake holders?
user?
owner?
product makers
property owner
HIGH LEVEL GOALS
$$
cost of product, machine
demand, creating demand, incentive
availability
Consider:
How to appeal to customers (competitoin)
Automate an interaction
What is the product?
*mechanism, cost, definition of vending machine
Feedback
*selection, price, how to select, warnings, don't-tip-me-over sign
Full range of exceptions/expectations
out of stock/change
invalid input/use
log/record (safety of food)
exception state(s) --> out of order
Security requirements
subversion, intentional misuse
physical and logical
user and operator safety, financial safety
pests and varmints
Thursday, March 1, 2012
Requirements and Development Methods
IEEE 830 Standard
Agile
Formal Methods
Volere
Specifications (Constraints)
-Requirement
-MUST
-OPT
-MUST NOT
API Interface
User Stories
- Semantically speaking, richer and more telling than
Agile
Formal Methods
Volere
Specifications (Constraints)
-Requirement
-MUST
-OPT
-MUST NOT
API Interface
User Stories
- Semantically speaking, richer and more telling than
Tuesday, February 28, 2012
Lab Assignment Feb 28
Assignment:
Using the code we started in lab, alter the method we used to resize the canvas so that a canvas inherits its size from its parent (i.e. the dimensions are not hardcoded and the canvas can easily fill its container (div) )
Test this by creating two canvas elements with different widths.
Using the code we started in lab, alter the method we used to resize the canvas so that a canvas inherits its size from its parent (i.e. the dimensions are not hardcoded and the canvas can easily fill its container (div) )
Test this by creating two canvas elements with different widths.
Tuesday, February 21, 2012
Challenge 2/21/2012
Part 1
- 10 equations that do not pass but should for your calculator
- why does each test case fail? What should be considered?
Interpretation of first question: Submit equations that don't work on my calculator but should.
My calculator has issues with ',' and unary operators at present, but assuming that those were working correctly, equations with the following characteristics would not correctly evaluate:
+equations that use numbers with floating point precision (1.2 + 3.4)
ex. it would split 1.2 into 1, . , and 2
+equations with multiple unary operators (---)
--9+ ---3
+equations with operations that are more than one character
++. --. etc
+equations lacking correctly paired ()s
maybe "shouldn't" work anyway, but it would be nice to deal with that somehow... perhaps infer where one should go?
+ not sure if functions within functions would work on mine
sin(cos(sin(...cos(3.14+.... etc.))))
+ operators that take more than 2 inputs don't work yet
old version (not rewrite) had only left and right nodes. Would require 3 prong node, but maybe a vector of pointers could be used to later add number of children with ease
Part II is inaccessible to me at this time...
Other equations that won't work on MyCalc -
(simply because I'm still not there yet)
use of user-added functions
I expect issues with the following:
user functions that contain the names of actual functions within them (ex: sinuserdef() )
Assignment for Thursday:
- 10 equations that do not pass but should for your calculator
- why does each test case fail? What should be considered?
Interpretation of first question: Submit equations that don't work on my calculator but should.
My calculator has issues with ',' and unary operators at present, but assuming that those were working correctly, equations with the following characteristics would not correctly evaluate:
+equations that use numbers with floating point precision (1.2 + 3.4)
ex. it would split 1.2 into 1, . , and 2
+equations with multiple unary operators (---)
--9+ ---3
+equations with operations that are more than one character
++. --. etc
+equations lacking correctly paired ()s
maybe "shouldn't" work anyway, but it would be nice to deal with that somehow... perhaps infer where one should go?
+ not sure if functions within functions would work on mine
sin(cos(sin(...cos(3.14+.... etc.))))
+ operators that take more than 2 inputs don't work yet
old version (not rewrite) had only left and right nodes. Would require 3 prong node, but maybe a vector of pointers could be used to later add number of children with ease
Part II is inaccessible to me at this time...
Other equations that won't work on MyCalc -
(simply because I'm still not there yet)
use of user-added functions
I expect issues with the following:
user functions that contain the names of actual functions within them (ex: sinuserdef() )
Assignment for Thursday:
//Equations to use for testing :
//GRACEFUL FAIL?
10 (+) 8 (*) 2 (+) 8
10 ()+ 8 * 2 + 8
(10 + 8 * 2 + 8
10) + 8 * 2 + 8
//FAILING FUNCTIONS
sin(45,8)
sin(45,,)
sin45
(sin)45
//PARENS ANYWHERE?
(10 + 8) * 2 + 8
(10) + (8) * (2) + (8)
(((10 + 8) * 2) + 8)
//UNARY OPERATORS
-(10) + 8 * 2 + 8
--10 + 8 * 2 + 8
---10 + 8*2+8
-(-(-(10))) + 8*2+8
Lab ScratchNotes- Feb 21 2012
Fermat
Polytope
Dirichlet's_theorem
Java's Big Decimal... c++ equiv?
http://gmplib.org/ Perhaps?
Sacrificing time for precision
Really a sacrifice? quick (matter of clk cycles), so 300x slower not bad
Composite Design Pattern brought up - NOT good for this assignment.
Lexicon and Parser Setup
Polytope
Dirichlet's_theorem
Java's Big Decimal... c++ equiv?
http://gmplib.org/ Perhaps?
Sacrificing time for precision
Really a sacrifice? quick (matter of clk cycles), so 300x slower not bad
Composite Design Pattern brought up - NOT good for this assignment.
Lexicon and Parser Setup
Thursday, February 16, 2012
Lecture 2/16/2012 and Pre-Challenge 4.2.2
Current functionality of the current re-write ( ...3? ...4? treeAlg_v7) allows for tokenizing the equations.
Infinity and Div by 0
C++ gives inf :
OUTPUT :
Regular Expressions
\d+ <--find one or more digit 0-9 and any following digits
\d* <-- permits 0 or more
( ) <-- catch, save for later not just match
....useful for tokenizing the string.... hrrrmmmm I've been doing this manually -_-
Infinity and Div by 0
C++ gives inf :
#include<iostream>
int main (int argc, char** argv)
{
float answer = 1/0.f;
std::cout << "1/0f gives " << answer << std::endl;
}
OUTPUT :
1/0f gives inf
Regular Expressions
\d+ <--find one or more digit 0-9 and any following digits
\d* <-- permits 0 or more
( ) <-- catch, save for later not just match
....useful for tokenizing the string.... hrrrmmmm I've been doing this manually -_-
Thursday, February 9, 2012
Rounds of Focus
Here is my version of the TODO lists requested on svn. I found it easier (perhaps less embarrassing?) to keep track of these on my own google site, but I will migrate to svn. For the sake of having accessible documentation, here are the relevant "Rounds" (24 minute minimum sessions of focused work).
Most have explanations/self-evaluations at the end.
Testing Calculator
(1-2) * 13/16
(1-2) * (13/16
(pow(1,2))*(13/16)
I expect all errors, because my calculator does not presently handle parenthesis. (First iteration did, but I scrapped that because I thought it was necessary to get operation based tree-construction working first...)
Also, I just realized that I am only handling ints (not floats...)
To get any output, I would have to delete the ()s. For this iteration's sake, here are the results:
Please enter an equation:
1-2*13/16
You entered:
1-2*13/16
NOT base case 1-2*13/16
Reached base case: 1
NOT base case 2*13/16
Reached base case: 2
NOT base case 13/16
Reached base case: 13
Reached base case: 16
0
Another item I failed to include was "pow." (I understood in lab that the equation would be 'flat,' or linear. Misinterp of requirements, apparently.)
It is painstakingly obvious what is not happening....but ...
Examining what IS "happening"
AKA what I (erroneously?) THINK is happening:
1-2*13/16
-
/ \
1 *
/ \
2 "/"
/ \
13 16
1-2*13/16 = 1-1.something --> 0 (because ints truncate)
Traversing the tree (printing out each node as I travel left to right):
LEAF:
1
LEAF:
2
LEAF:
13
LEAF:
16
/
*
-
The fact that LEAF appears before each number is comforting, though I would expect the following:
1
2
13
16
/
*
-
...But that's what I'm getting.... OK- logic error traversing the tree. AArgh.
(1-2) * (13/16
(pow(1,2))*(13/16)
I expect all errors, because my calculator does not presently handle parenthesis. (First iteration did, but I scrapped that because I thought it was necessary to get operation based tree-construction working first...)
Also, I just realized that I am only handling ints (not floats...)
To get any output, I would have to delete the ()s. For this iteration's sake, here are the results:
Please enter an equation:
1-2*13/16
You entered:
1-2*13/16
NOT base case 1-2*13/16
Reached base case: 1
NOT base case 2*13/16
Reached base case: 2
NOT base case 13/16
Reached base case: 13
Reached base case: 16
0
Another item I failed to include was "pow." (I understood in lab that the equation would be 'flat,' or linear. Misinterp of requirements, apparently.)
It is painstakingly obvious what is not happening....but ...
Examining what IS "happening"
AKA what I (erroneously?) THINK is happening:
1-2*13/16
-
/ \
1 *
/ \
2 "/"
/ \
13 16
1-2*13/16 = 1-1.something --> 0 (because ints truncate)
Traversing the tree (printing out each node as I travel left to right):
LEAF:
1
LEAF:
2
LEAF:
13
LEAF:
16
/
*
-
The fact that LEAF appears before each number is comforting, though I would expect the following:
1
2
13
16
/
*
-
...But that's what I'm getting.... OK- logic error traversing the tree. AArgh.
Tuesday, February 7, 2012
Compiled Jibberish
Only one error! ....or so it says...
w00-129-24-253-3:FileIO_Redux smg$ g++ myCode.cpp
myCodePrev.cpp:1: error: expected `}' at end of input
myCodePrev.cpp:1: error: expected unqualified-id at end of input
w00-129-24-253-3:FileIO_Redux smg$ g++ myCode.cpp
myCodePrev.cpp:1: error: expected `}' at end of input
myCodePrev.cpp:1: error: expected unqualified-id at end of input
Technically, it's all one line. Technically, that line is commented out... See?
Extra Credit:
Adding the notion of start... WIP.
Thursday, February 2, 2012
Feb 2, 2012
TOPICS :
Code Challenge
Spikes & Tacks
Where do you start?
Text file describing process in English :
PSEUDO CODE EXAMPLE
{input_words} <- CSV_Read( text )
text <- Jibbers( {input_words} )
Spikes 1 & 2 ---> Hack it (early spikes )
Spikes 3 & 4 = Rewrites
Tacks - demo ONE "little" feature
SVN
Aim for 4 checkouts / hour
Yes, even broken code (only increment spike number for working code)
// Coding Standards
// Nomenclature
// Eclipse
Code Challenge
Spikes & Tacks
Where do you start?
Text file describing process in English :
PSEUDO CODE EXAMPLE
{input_words} <- CSV_Read( text )
text <- Jibbers( {input_words} )
Spikes 1 & 2 ---> Hack it (early spikes )
Spikes 3 & 4 = Rewrites
Tacks - demo ONE "little" feature
SVN
Aim for 4 checkouts / hour
Yes, even broken code (only increment spike number for working code)
// Coding Standards
// Nomenclature
// Eclipse
Wednesday, February 1, 2012
Jibberish....
...should describe the output, not the code. --smg
I have documented my progress in svn text documents, but here's an overview of my versions, decisions, and conclusions thusfar:
history (Assignment 1)...
(will add this later....)
print (Learned_Lessons ) -extra extra extra verbose
I have documented my progress in svn text documents, but here's an overview of my versions, decisions, and conclusions thusfar:
history (Assignment 1)...
(will add this later....)
- Attempt 1 : FileName : Identifiers : Universe of too many ambiguous classes
- Attempt 2 :
- Attempt 3 :
- Attempt 4 : FileName :
print (Learned_Lessons ) -extra extra extra verbose
- Step 1 = Make it work. Iteration 1 - I overthought. I was trying to include elements I did not need. Rather than asking how I could split the actual task into managable pieces, I obsessed over extra features and reusability and efficiency and irrelevant frosting - creature feap. Creature feap before I had even begun. Needless to say, iteration 1 did not work. Did not compile. Did not make sense. Too many ideas. Entangled and messy and before long, I could not even remember the requirements of the original assignment.
- Step 0 = Plan it out. After strangling myself with iteration 2, I was sick of the 'wait,what-am-I-doing?' confusion that plagued me time and again about 50 lines of code into it. I decided that iteration 3 should be easy. Easy to read, easy to follow, easy to code. There should be no question as to whether I had already coded certain functionality or not. I should know. I needed a guiding map, so I created just that. A text file containing the specs, the intended versions/descriptions, and a section to log current progress.
- Step 0.0 = Plan it out again. Write pseudo-code. Just do it. Inevitably you will discover faults in your original logic. Change now or forever hold your frustration (at least until the next iteration.)
- Embrace Your One Track Mind. Between compiles, write with ONE goal in mind. I found myself changing the structure of my code while simultaneously trying to add functionality. (Changing from maps to vectors, for instance, while adding the Pick_Next_Word function. No way to tell where you're breaking.)
- Keep it Simple, Keep it NOW. Go in knowing you are going to iterate. You don't know what Future You will want in the code, so don't out-think yourself. Add functions as they become useful... In fact, ask yourself if they are useful, and specifically if they are useful in the current situation. Example - I went overboard with the idea of printing with functors in Iteration 1 (or 2?). Sure they would be useful... if I were coding a spike or writing a header/library/toolbox. Afterall, did I really need 6 different ways to print a set of words ("just in case")? I don't think so.
- Be Verbose, Descriptive, and Leave Comments. This is the easiest thing to do and the hardest thing to make yourself do. It's cake if you write pseudo-code beforehand. Comments? Check. Be verbose with variable names and take the time to describe the intended role of each new type as you create it.... or risk finding yourself in a world of god-Awful metaphors ("Okay, so each word has two neighbors, and they live in a list neighborhood, which is inside of a map City, which is part of a giant State object that has a population count and ..." --Right, got the picture? I'll spare you the details... -_-' )
Tuesday, January 31, 2012
Jan 30 2012 Lab Questions
What is hash?
How hash map works?
Different from other col, containers, data structures?
Complexity
http://www.cplusplus.com/reference/stl/
http://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable
http://en.wikipedia.org/wiki/Hash_function
Array
Array List
Linked List
Tree Map
Hash Map
Dictionary
(access, insert, delete, space, next)
Speaking of Complexity - Check out this AWESOME PDF OF COMPLEXITY ANALYSIS WIN
How hash map works?
Different from other col, containers, data structures?
Complexity
http://www.cplusplus.com/reference/stl/
http://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable
http://en.wikipedia.org/wiki/Hash_function
Array
Array List
Linked List
Tree Map
Hash Map
Dictionary
(access, insert, delete, space, next)
Speaking of Complexity - Check out this AWESOME PDF OF COMPLEXITY ANALYSIS WIN
Monday, January 23, 2012
SVN Repository 2.0 Spike
Instructions found HERE
Copy and paste is messy, so check out the text file HERE
(Note - forgot a message on my first attempt importing a directory.)
Resources:
how to clear history
Copy and paste is messy, so check out the text file HERE
(Note - forgot a message on my first attempt importing a directory.)
Resources:
how to clear history
Friday, January 20, 2012
Take Three - Java IO and Sorting
EDIT-
Jan 21, 2012
It was brought to my attention that there are libraries to implement different sorting algorithms.
I've decided NOT to reinvent the wheel (though I do intend to learn wheel-crafting in case I am ever in a jam).
C++ version of assignment :
NOTE:
Works on my machine, but compiling on trucks/moons doesn't work (doesn't recognize 'strtok' - scope issue? Perhaps there is an alternative? )
Main Resources :
fstream
STL Containers
STL Algorithms
Readtextfile
strtok
stringstream
convert-int-to-string
Looked At (Not so much used)
functors-and-their-uses
Bloom_filter
EmacsCheatSheet
TAKE THREE DRAFT:
So far, Version 3 on its way... Plus a few thoughts:
How can I add color.... hmmm.....
Resources :
http://en.wikipedia.org/wiki/Function_object
http://www.roseindia.net/java/beginners/java-write-to-file.shtml
http://en.wikipedia.org/wiki/Merge_sort
Looked At (not so much used)
http://en.wikipedia.org/wiki/First-class_function
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
Jan 21, 2012
It was brought to my attention that there are libraries to implement different sorting algorithms.
I've decided NOT to reinvent the wheel (though I do intend to learn wheel-crafting in case I am ever in a jam).
C++ version of assignment :
NOTE:
Works on my machine, but compiling on trucks/moons doesn't work (doesn't recognize 'strtok' - scope issue? Perhaps there is an alternative? )
Main Resources :
fstream
STL Containers
STL Algorithms
Readtextfile
strtok
stringstream
convert-int-to-string
Looked At (Not so much used)
functors-and-their-uses
Bloom_filter
EmacsCheatSheet
So far, Version 3 on its way... Plus a few thoughts:
realized I forgot to print a file with the other versions. (Fixed it)- What's better?
- sorting as you add data
- sorting after you've added all data
- What about functors?
- make different functors for different algorithms?
- switch functors and compare times?
How can I add color.... hmmm.....
Resources :
http://en.wikipedia.org/wiki/Function_object
http://www.roseindia.net/java/beginners/java-write-to-file.shtml
http://en.wikipedia.org/wiki/Merge_sort
Looked At (not so much used)
http://en.wikipedia.org/wiki/First-class_function
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
Take Two - Java File Reading
I got the bare basics working (see SVN ) but wanted to try storing words for later...
Version 2.0 <-CLK IT:
Main Differences:
Primary In-Class Difficulties :
Later Difficulties :
Nouns and Verbs - Data structures and Algorithms
Version Three : The SORT-o-MATIC - coming soon to a blog near you.
References:
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Hashtable.html
http://www.java-samples.com/showtutorial.php?tutorialid=375 --not as helpful as I thought
http://en.wikipedia.org/wiki/Sorting_algorithm --WAAY too much I don't know here. Wow.
http://today.java.net/pub/a/today/2006/11/07/nuances-of-java-5-for-each-loop.html -- not working as expected
http://stackoverflow.com/questions/968347/can-a-java-file-have-more-than-one-class
http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Vector.html
Version 2.0 <-CLK IT:
- gives Total word count
- gives unique word count
- stores words in hashtable --(currently re-evaluating this decision... not sold)
Main Differences:
- It runs.
- Imported only required header files
- Stores words in Hashtable if unique
Primary In-Class Difficulties :
- Lack of Java programming experience
- Main Issue = how to compile and run???
- javac FILENAME.java
- java FILENAME //NO '.java' HERE!!!!!!
- Unfamiliar with Classes/Data structures/Variables/ Java Quirks
- Examples:
- must include Boolean (not a given like in c++)
- .java file needs to be a class, not just have main
Later Difficulties :
Nouns and Verbs - Data structures and Algorithms
- How to store the data?
- I want to find the most commonly used words - I want a hierarchy, not just a single string-value pair (<-boring)
- Considered Hash tables
- How do I index or access in any order when my keys are non-numeric? Enum, but...eh. Shouldn't it be simpler?
- Considering Vector of String-Int pairs
- Could methodically insert
- How to sort the data?
- Algorithms
- Heap sort? Merge sort? Some....Sort?
- n log(n) for heap/merge
Version Three : The SORT-o-MATIC - coming soon to a blog near you.
References:
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Hashtable.html
http://www.java-samples.com/showtutorial.php?tutorialid=375 --not as helpful as I thought
http://en.wikipedia.org/wiki/Sorting_algorithm --WAAY too much I don't know here. Wow.
http://today.java.net/pub/a/today/2006/11/07/nuances-of-java-5-for-each-loop.html -- not working as expected
http://stackoverflow.com/questions/968347/can-a-java-file-have-more-than-one-class
http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Vector.html
Thursday, January 19, 2012
ezSVN - Tired of Typing
- CURRENT WORRY ITEM #1:
- CS svn appeared to be 'broken' for ~5 minutes this afternoon. (FREAKOUT)
- SOLUTION FOR WORRY #1:
- Back up for my back up: Project Locker account
- username smgonzal@unm.edu, (pw = left l-based)
- URL: https://pl5.projectlocker.com/smgonzal/Academic/svn
- CURRENT WORRY ITEM #2:
- Tired of typing "svn checkout yadayadayada...." and can never remember the full path.
- SOLUTION FOR WORRY #2:
- svnget.sh - checks out specified svn repository
- possible arguments include ece, rc, cs, domegl, and pl
- next step GUI??? Perhaps???
- CURRENT WORRY ITEM #3:
- Couldn't remember how to svn something without checking out entire repository first...
- SOLUTION FOR WORRY #3:
- svnadd.sh - imports specified file to specified repository WITHOUT checking out first
- svnadd.sh [FILE_TO_IMPORT] [REPOSITORY_ABBREV]
- possible svn arguments include : ece, rc, cs, pl
Resources:
Bash Guides (for those of us too lazy to commit this stuff to memory)
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements
People
DJMK
SMG : http://cs.unm.edu/~smgonzal/svnHowTo.txt
File IO ....in Java (!)
GNU nano 2.2.6 File: fileIO.java
//all io stuff we need
import java.io.*;
public class fileIO{
public static void main(String[] args){
//What file will we read?
// File myFile = new File("./textFile.txt");
//create a filereader
FileReader fr = new FileReader("/nfs/student/s/smgonzal/textFile.txt");
//create buffered reader
BufferedReader br = new BufferedReader(fr);
int numWords = 0;
//make string tokenizer
StringTokenizer st;
//pseudo code...
// while (not at end of file)
// {
// buffered reader gets next line
// give it to tokenizer
//
// //what if .,! etc are tokens though... this would be inacccurate
// numWords = numWords + st.countTokens();
// }
System.out.println("number of Words: " + numWords);
}
};
Resources Used:
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/BufferedReader.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#File(java.lang.String)
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileReader.html
http://www.abbeyworkshop.com/howto/java/readFile/index.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html
looked at (not so much used):
http://www.roseindia.net/java/beginners/java-word-count.shtml
http://stackoverflow.com/questions/5748656/unreported-exception-java-io-filenotfoundexception-must-be-caught-or-declared-t
//all io stuff we need
import java.io.*;
public class fileIO{
public static void main(String[] args){
//What file will we read?
// File myFile = new File("./textFile.txt");
//create a filereader
FileReader fr = new FileReader("/nfs/student/s/smgonzal/textFile.txt");
//create buffered reader
BufferedReader br = new BufferedReader(fr);
int numWords = 0;
//make string tokenizer
StringTokenizer st;
//pseudo code...
// while (not at end of file)
// {
// buffered reader gets next line
// give it to tokenizer
//
// //what if .,! etc are tokens though... this would be inacccurate
// numWords = numWords + st.countTokens();
// }
System.out.println("number of Words: " + numWords);
}
};
Resources Used:
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/BufferedReader.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#File(java.lang.String)
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileReader.html
http://www.abbeyworkshop.com/howto/java/readFile/index.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html
looked at (not so much used):
http://www.roseindia.net/java/beginners/java-word-count.shtml
http://stackoverflow.com/questions/5748656/unreported-exception-java-io-filenotfoundexception-must-be-caught-or-declared-t
Wednesday, January 18, 2012
Subscribe to:
Comments (Atom)