PDA

View Full Version : Cue Card Program



Nava2
12-05-2009, 08:02 PM
Since I know how to use pascal enough, I thought I would work with Java to try and create a CueCard like program for studying.

So far, it can not really do much :(:

Add/Delete questions
Load multiple text/quiz files.
Displays help menus for every interface.


Todo:

Ability to run through, flipping cards etc
Perhaps a GUI if I feel like learning
Create a static system for the stream, rather than passing around the param.
allow for multiple commands in one line, adding questions w/ options etc.
answering questions, rather than just looking at answer.
Create a debugging system to change what is shown and what isn't.
Create a library like structure allowing for porting to a GUI.
Allow for quicker addition of questions
Add passing of parameters to commands. Should be fairly simple.
Word wrap for longer answers/questions. (Its annoying to read otherwise..)
Re-add Listing of cards, will have more options now, including custom formatting
List all questions, with different formatting.
Quiz based on questions inputted. (Random ordered)


Completed: (Just makes me feel better.. :))

Move project to an SvN
Re-create addCard stuff, will be a separate menu allowing to continuously add cards and can be terminated. Also, will allow editing of cards.
Add deleteing of cards
Re-add loading of cards
Restructure program, OOP ideas to do this, creating a better structure etc. Create a string array of acceptable options with indexes associated with them, these indexs will be used in a switch..case piece in another function. pass these integers when the string is called and call the associated section.



To run it:

Check out from:
http://java-cuecards.googlecode.com/svn/trunk/ This will give you the latest version.
cd to the directory from a terminal/command line.
** Ignore this step if you trust that I'm not messing with your computer** Run: "javac CueCardProgram"
Run: "java CueCardProgram"
Tell me what you think ;)
Type ``h'' or ``help'' to get a list of commands in any interface!


Remember, this is still very much a work in progress. Please post bugs errors and the like. I cannot guarantee the stability of it either. The older revisions (< 9) are stable for use and allow adding questions etc. Its what I'm using to study (You have to javac CueCardApp.java and java CueCardApp instead of CueCardProgram.java, etc).

Comments, and issues pleaseeee.

All that is man
12-06-2009, 12:13 AM
Did as you said, but http://i46.tinypic.com/jfgugi.jpg so idk

EDIT: I tried to look at the code but when I opened the .txt it came up like in 5 lines and no entering so Idk if that made the error or if thats just a coding style

Nava2
12-06-2009, 01:22 AM
Did as you said, but http://i46.tinypic.com/jfgugi.jpg so idk

EDIT: I tried to look at the code but when I opened the .txt it came up like in 5 lines and no entering so Idk if that made the error or if thats just a coding style

That error was my bad, I added it in and I'm still getting used to useing different syntax.. = is assigned rather than equal to. :(

The newline issue could be because I wrote it on linux and Windows uses a different char for new line. :(

Upped a new version. Has quizzing and loading from multiple files etc.

Floor66
12-06-2009, 11:11 AM
I believe that you have to use \n\r for cross-platform compatibility.

senrath
12-06-2009, 11:17 AM
I believe that you have to use \n\r for cross-platform compatibility.

That is correct. At least, that's what Windows uses for new lines, and I think the other operating systems are smart enough to parse it correctly as well.

Nava2
12-06-2009, 02:46 PM
That is correct. At least, that's what Windows uses for new lines, and I think the other operating systems are smart enough to parse it correctly as well.

I'm not writing that in every line when I'm coding though.. I can do it for when I put \n but he is talking about when he opened the .java file.

senrath
12-06-2009, 03:46 PM
I'm not writing that in every line when I'm coding though.. I can do it for when I put \n but he is talking about when he opened the .java file.

Oh, he was? Eh, I use Notepad++ so I didn't notice any problems with newlines.

All that is man
12-06-2009, 09:44 PM
Not trying to be a hassle just trying to help ;) But...
http://i45.tinypic.com/5v2kvp.jpg

senrath
12-06-2009, 09:56 PM
It works if you load from a file. But it doesn't properly grade you. It always says 0% when you finish.

Nava2
12-06-2009, 11:46 PM
Not trying to be a hassle just trying to help ;) But...
http://i45.tinypic.com/5v2kvp.jpg

Thanks! I will never complain about someone helping me! I was trying to access the length of a ``null'' array. One sec I can fix that..


kevin@n2-laptop:~/drjava/k/cuecardsstuff/Cue Card Quizzer - r2$ java CueCardApp
Choose a working file:

Couldn't find .
File could not be read.
Enter a command:
a
Adding Question
Question?
What is sex?
Answer?
Peniz + vag
Added question number 1
Enter a command:
OH HAI SRL

*Side note: I am well aware of my immaturity sometimes.*

All that is man
12-07-2009, 01:31 AM
Thanks! I will never complain about someone helping me! I was trying to access the length of a ``null'' array. One sec I can fix that..


kevin@n2-laptop:~/drjava/k/cuecardsstuff/Cue Card Quizzer - r2$ java CueCardApp
Choose a working file:

Couldn't find .
File could not be read.
Enter a command:
a
Adding Question
Question?
What is sex?
Answer?
Peniz + vag
Added question number 1
Enter a command:
OH HAI SRL

*Side note: I am well aware of my immaturity sometimes.*

lmfao

i r teh 1337 bugz findr? :(
http://i48.tinypic.com/21l1vrd.jpg
lots more
http://i47.tinypic.com/f3ie84.jpg

It could just be because I only have 2 questions maybe?

Nava2
12-07-2009, 06:27 AM
lmfao

i r teh 1337 bugz findr? :(
http://i48.tinypic.com/21l1vrd.jpg
lots more
http://i47.tinypic.com/f3ie84.jpg

It could just be because I only have 2 questions maybe?

Yes and no, I just keep forgetting to remove the line where it writes out which indexs are being switched :)

Okay, removed that, fixed an annoying error I had..

I really need to restructure this entire thing to make it work better..

Perhaps I should host it on an SVN too :) Might make my life easier.

E: Now its hosted on google code! Much easier for me to update :)

Nadeem
12-08-2009, 01:06 AM
If your planning to recode, then you should look into applying a composite array or/with stacks =) Would be quite a bit more efficient + great learning experience with creating your very own customized lists.

Quickly browsing through your code, here are some suggestions I put together:

1) Since public class CueCard is really being read as public class CueCard extends java.lang.Object, the toString() method should be an override. (@Override public string toString()) ~ It works without it, but there are some good benefits that come along with declaring as an override in the beginning. (You can find some good reasons at: http://preview.tinyurl.com/yd2jznm)

2) Your readFile method kinda made me smile =) You could simply used a java.awt.List and push the new lines onto the list and then obtain them at the end. Would literally cut your method down by half. Something like:

java.awt.List list = new java.awt.List();
String line = null;
while((line = reader.readLine()) != null)
list.add(line); /* adding line to a list */

return list.getItems(); /* will return all the items in the list as a String array */


But overall its a pretty good job:smile:



~NS

senrath
12-08-2009, 01:33 AM
If your planning to recode, then you should look into applying a composite array or/with stacks =) Would be quite a bit more efficient + great learning experience with creating your very own customized lists.

Quickly browsing through your code, here are some suggestions I put together:

1) Since public class CueCard is really being read as public class CueCard extends java.lang.Object, the toString() method should be an override. (@Override public string toString()) ~ It works without it, but there are some good benefits that come along with declaring as an override in the beginning. (You can find some good reasons at: http://preview.tinyurl.com/yd2jznm)

2) Your readFile method kinda made me smile =) You could simply used a java.awt.List and push the new lines onto the list and then obtain them at the end. Would literally cut your method down by half. Something like:

java.awt.List list = new java.awt.List();
String line = null;
while((line = reader.readLine()) != null)
list.add(line); /* adding line to a list */

return list.getItems(); /* will return all the items in the list as a String array */


But overall its a pretty good job:smile:



~NS

Since he's not already using java.awt, and there is no GUI, he should probably use an ArrayList instead of java.awt.List.

Nava2
12-08-2009, 02:36 AM
If your planning to recode, then you should look into applying a composite array or/with stacks =) Would be quite a bit more efficient + great learning experience with creating your very own customized lists.

Quickly browsing through your code, here are some suggestions I put together:

1) Since public class CueCard is really being read as public class CueCard extends java.lang.Object, the toString() method should be an override. (@Override public string toString()) ~ It works without it, but there are some good benefits that come along with declaring as an override in the beginning. (You can find some good reasons at: http://preview.tinyurl.com/yd2jznm)
To me, it appears as though the override stuff is a bit over my head. I don't know how interfaces etc work yet. I'm still learning :D

2) Your readFile method kinda made me smile =) You could simply used a java.awt.List and push the new lines onto the list and then obtain them at the end. Would literally cut your method down by half. Something like:

java.awt.List list = new java.awt.List();
String line = null;
while((line = reader.readLine()) != null)
list.add(line); /* adding line to a list */

return list.getItems(); /* will return all the items in the list as a String array */

What is the benefit of doing it your way vs mine? Is it just to make it smaller?

But overall its a pretty good job:smile:
thanks :)



~NS


Since he's not already using java.awt, and there is no GUI, he should probably use an ArrayList instead of java.awt.List.

Currently, I'm trying to create just a library which only requires an InputStream and an OutputStream. This way, it will function using either a GUI or commandline depending how it is loaded.

I'm still a large beginner with java, and my issue is not for lack of ideas and know how, but how to actually go about and do it.


I added new files into the SvN, they don't work. But they show some of my ideas and I'm trying to implement them. I don't really understand stacks, but I'm pretty sure I'm making a sudo one and there is probably a better option than what I am doing. :p

arash
12-08-2009, 03:53 AM
You are taking a hybrid OOP, and procedural programming approach. Although it may be easier to code that way, your code looks messy and unclean. It also lacks flexibility.

Pure OOP FTW

Nava2
12-08-2009, 04:05 AM
You are taking a hybrid OOP, and procedural programming approach. Although it may be easier to code that way, your code looks messy and unclean. It also lacks flexibility.

Pure OOP FTW

Perhaps you could explain what you mean?

senrath
12-08-2009, 04:41 AM
Perhaps you could explain what you mean?

Maybe he's referring to your use of static methods? Generally, unless there is a really good reason for a method to be static, it shouldn't be.

Nava2
12-08-2009, 02:02 PM
Maybe he's referring to your use of static methods? Generally, unless there is a really good reason for a method to be static, it shouldn't be.

Oh, I'm getting rid of those :)

Nava2
12-10-2009, 08:14 PM
I just keep learning:

MASSIVE CHANGES:
Fully OOP oriented.
Currently supports:
+ Will have multiple menus which store where they are in a stack
+ Help menu is much easier to read, and easily updated.
+ Quiz's will behave much nicer.

Todo:
+ Create addCard stuff, will be a separate menu allowing to continuously add
cards and can be terminated. Also, will allow editing of cards.
+ Add passing of parameters to commands. Should be fairly simple.
+ Add deleteing of cards
+ Add loading of cards
+ Add Listing of cards, will have more options now, including custom formatting.

So, it doesn't really work right now, the old version *should* still work, but
this new one works for everything I listed, but nothing I put in todo.

I'm excited, and if you want to help contribute, please post ideas etc. For now,
I don't want anyone else working on the project so I can continue to learn. When
I feel as though I've learned enough and I'm just improving, I will add more
people!

Woot woot.

~Kevin

Any advice is really appreciated.

Anyone know a better way to keep track of the current cards other than a static array? I would really rather not pass it around. Creates a pain in if I do so.

Also, any advice for bettering my structure? I do plan on removing it all out of newDevelopment :P

P.S. senrath, Nadeem, you have msn?

Edit:
Moar updates, no more old, just new! (: Ditched the old style completely. Quickly moving everything over into the new version. :)

Rev 9 still works, just you have to run javac CueCardApp.java then java CueCardApp.

Please use this people :(

super_
12-12-2009, 12:49 AM
1. nice work mate; best wishes
2. so you're the guy from #rsbotjava eh?
3. (@the guy suggesting java.awt.List) NO... AWT's List is for UI WIDGETS, not general utility. i think you mean java.util.List.

Nava2
12-12-2009, 01:16 AM
1. nice work mate; best wishes
2. so you're the guy from #rsbotjava eh?
3. (@the guy suggesting java.awt.List) NO... AWT's List is for UI WIDGETS, not general utility. i think you mean java.util.List.

1. Any more comments? :(

2. Nope.. who you talk `bout.

3. What would be the difference? awt is for GUI and util is for utilities aka commandline?

Not really sure the difference.

super_
12-12-2009, 01:27 AM
1. Any more comments? :(

2. Nope.. who you talk `bout.

3. What would be the difference? awt is for GUI and util is for utilities aka commandline?

Not really sure the difference.

1. nope
2. there was someone in #rsbotjava a little while ago asking for help with:

if (line = null)
which is identical to the output of javac in a screenshot of the command prompt console earlier in this thread.
3. the difference is that java.awt.List is not a general, miscellaneous utility class; it is a graphical UI widget/component... this is a picture of it:
http://www.ilariolarosa.net/wp/wp-content/gallery/articoli-2009/list_applet.jpg
on the other hand, java.util.List IS a general utility collection; hence why it is generic. it is not for 'commandline', i have no clue as to where you would ever be able to deduce that from existing documentation.

Nava2
12-12-2009, 01:44 AM
1. nope
2. there was someone in #rsbotjava a little while ago asking for help with:

if (line = null)
which is identical to the output of javac in a screenshot of the command prompt console earlier in this thread.
3. the difference is that java.awt.List is not a general, miscellaneous utility class; it is a graphical UI widget/component... this is a picture of it:
on the other hand, java.util.List IS a general utility collection; hence why it is generic. it is not for 'commandline', i have no clue as to where you would ever be able to deduce that from existing documentation.

More of a guess.

Nava2
03-31-2010, 02:09 PM
I need something to be productive with small bursts of time, so if I worked on this more (probably a complete rewrite) would anyone want it?

Craig`
03-31-2010, 03:34 PM
Yeah I'd want it :).

and I guess once it was done I could try and remake it myself in Ruby, just for the learning experience, heh

~ Craig` :)

Nava2
03-31-2010, 07:39 PM
I was thinking of making it GUI, meaning it forces me to learn jva GUI's and I was going to try and find a set of /LaTeX packages to allow for either \LaTeX full input or at least formula rendering as I love it. (www.mathbin.net)

anywho, I'll start working on a rewrite tomorrow or the next day. My Java/OOP knowledge is much better than it was. So hopefully I can get something better out of this.