I have improved the ExerciseClass a bit. An Exercise must have a button that the program can listen to. When clicking on that button, a function is triggered to calculate and submit the current result of the exercise.
If the class is correctly written that will allow for faster develoment when adding new classes to the program.
Monday, 7 December 2009
Sunday, 6 December 2009
Friday, 4 December 2009
Class Test Class
A Teacher should be able to create a test with a group of problems or exercises. I have thought some about that, and it looks like we can solve it in a nice way with our current inheritance-approach. If we let our test implement the ExerciseClass, we can use and acces it just like any other exercise from the sidebara-menu.
A standard exercise takes a string as a setting argument, so if we let our test take a comma-separated string as input with class-names and setting-strings, we can create exercise instances within our test. A nice way to do this would be with dynamic class loading, Reflection, but that is not fully compatible with GWT.. and there is some drawbacks too. Dynamic classloading would probably decrease the code modifications to zero when new exercise-classes is to be added. We will have to solve the problem in a more static way, but with a nice code-layout it should be very clear where to manually add code for new exercises.
A test displays its exercises one at a time, stores the results from the individual exercises and uploads a testresult once the test is completed. A simple 'exercise' can be used to generate parameters for tests.
An idea that I want to think more of, is that all settings and statistic functionalities should be accessed like exercises, and the type of the user should determine which options that show up in the sidebar. Admins should see statistics and settings, teachers should see test generators and users should only see the exercises.
This way of constructing the site is similar to how facebook is built up, just a shell with applications for everything but the basic functionallities. The users decides what applications to see and use.
A standard exercise takes a string as a setting argument, so if we let our test take a comma-separated string as input with class-names and setting-strings, we can create exercise instances within our test. A nice way to do this would be with dynamic class loading, Reflection, but that is not fully compatible with GWT.. and there is some drawbacks too. Dynamic classloading would probably decrease the code modifications to zero when new exercise-classes is to be added. We will have to solve the problem in a more static way, but with a nice code-layout it should be very clear where to manually add code for new exercises.
A test displays its exercises one at a time, stores the results from the individual exercises and uploads a testresult once the test is completed. A simple 'exercise' can be used to generate parameters for tests.
An idea that I want to think more of, is that all settings and statistic functionalities should be accessed like exercises, and the type of the user should determine which options that show up in the sidebar. Admins should see statistics and settings, teachers should see test generators and users should only see the exercises.
This way of constructing the site is similar to how facebook is built up, just a shell with applications for everything but the basic functionallities. The users decides what applications to see and use.
Tuesday, 1 December 2009
Text problems now online
Text problems are now online. I have created a TextExercise-class, so textproblems now behave just like all other types of exercises.
Support for the previously mentioned TextProblemSets is not yet implemented.
Notes on Sudoku:
I create lists containing all the elements in a row, column or square, and then check if all numbers from one to nine occurs in all those lists. Selecting lines or columns in two for-loops are pretty straightforward, however squrares are more difficult. This is how to select a square given a sudoku-matrix, if i is square number from 0 to 8 and j goes from 0 to 8 you get:
int row = (i / 3) * 3 + j/3;
int col = j%3 + (i%3)*3;
Support for the previously mentioned TextProblemSets is not yet implemented.
Notes on Sudoku:
I create lists containing all the elements in a row, column or square, and then check if all numbers from one to nine occurs in all those lists. Selecting lines or columns in two for-loops are pretty straightforward, however squrares are more difficult. This is how to select a square given a sudoku-matrix, if i is square number from 0 to 8 and j goes from 0 to 8 you get:
int row = (i / 3) * 3 + j/3;
int col = j%3 + (i%3)*3;
Text Problems now in (not online yet)
Text problems are now working. There are two kinds of such problems: one involving random variables and a numeric answer, and one simply a question/answer type problem. Both of these are supported by the same class, and both problems support solution comments, and a TextProblemSet object can be stored in the database, thus making it easy to add new problems from the web, for instance.
What really happens is that a TextProblemSet contains all of the problem strings, and when one wants a new problem, one can request one from the problem set. A random problem is chosen, and then a TextProblem itself is created with those strings. The TextProblem will take care of randomising numbers and computing the result by parsing and computing the supplied formula (if it is a numerical problem).
My original intention was that we should create TextProblems, and store these, but the way it tuned out might actually be better. We add problems to the TextProblemSet, which is kind of a database, that can spawn TextProblems.
What really happens is that a TextProblemSet contains all of the problem strings, and when one wants a new problem, one can request one from the problem set. A random problem is chosen, and then a TextProblem itself is created with those strings. The TextProblem will take care of randomising numbers and computing the result by parsing and computing the supplied formula (if it is a numerical problem).
My original intention was that we should create TextProblems, and store these, but the way it tuned out might actually be better. We add problems to the TextProblemSet, which is kind of a database, that can spawn TextProblems.
Tuesday, 24 November 2009
The Unified Representation of Simple Mathematics
Someone has told me the following words of wisdom: "Use inheritance only where it makes sense to do so". When it comes to mathematical problems, we think it does make sense to use inheritance, and so we have a base class called somewhat surprisingly "the exercise class" that contains some properties common to all exercises/problems. One such subcategory of problems are textual problems, which I am currently working to implement. These will consist of: the problem text containing variable names, a formula that is used to compute the answer, a list of variables that will take bounded random values, and an answer comment string, so that the pupils can learn something too, which is quite important!
While working on this I realised that quite a bit more can be moved out into our basic math representation; A variable taking on a bounded random value for instance, is something that we will have a use for in many problems. Also, I needed a simple mathematical expressions parser so the computer can calculate the problem result. This would not strictly be necessary, but is done in this way because then it will be very easy for a teacher to create new text problems that the system can use, simply by entering a problem string with variable names isntead of values, entering a formual such as (x1+2*x2)/2, specifying variable bounds and also supply a nice solution comment string.
This was an excellent reason to visit one of my favourite branches of computer science, namely the theory of formal languages. Simple mathematical expressions are ... simple, and can be parsed by a push-down automaton, like many programming languages. In my current implementation I lex and parse expressions involving addition, subtraction, multiplication, division, and parenthesis, by the following grammar (Backus Naur Form):
Special consideration must be taken for the case of division, something which I am working on right now.
While working on this I realised that quite a bit more can be moved out into our basic math representation; A variable taking on a bounded random value for instance, is something that we will have a use for in many problems. Also, I needed a simple mathematical expressions parser so the computer can calculate the problem result. This would not strictly be necessary, but is done in this way because then it will be very easy for a teacher to create new text problems that the system can use, simply by entering a problem string with variable names isntead of values, entering a formual such as (x1+2*x2)/2, specifying variable bounds and also supply a nice solution comment string.
This was an excellent reason to visit one of my favourite branches of computer science, namely the theory of formal languages. Simple mathematical expressions are ... simple, and can be parsed by a push-down automaton, like many programming languages. In my current implementation I lex and parse expressions involving addition, subtraction, multiplication, division, and parenthesis, by the following grammar (Backus Naur Form):
Expr ::= Term | Expr "+" Term | Expr "-" Term
Term ::= Atom | Term "*" Atom | Term "/" Atom
Atom ::= int | "(" Expr ")"
Special consideration must be taken for the case of division, something which I am working on right now.
Tuesday, 17 November 2009
The Ants are Working
Getting things up and running with neither the magical Google Plug-in for Eclipse nor Eclipse itself is certainly tedious. The positive side of all this, is that one gets to know the details of what the system does. After finalising my Ant build script for GWT I struggled a lot with the App Engine part, until I noticed Google generously provided an ant_macros.xml file with the App Engine SDK! Having inported the definitions from that file, and copied some commands from some example project, I can now do quite a lot with the build file, including copying files, compiling them, packaging, running in hosted mode or through a local App Engine server, cleaning up directories, and my favourite: datanucleus enhance, just because it sounds so high-tech-sci-fi-y.
Tere are probably some libraries and procedures we don't really use in our project, but at this point I dare not modify things that work!
datanucleusenhance:
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings :
input=250 ms, enhance=40 ms, total=290 ms. Consult the log for full details
BUILD SUCCESSFUL
Total time: 2 seconds
Tere are probably some libraries and procedures we don't really use in our project, but at this point I dare not modify things that work!
datanucleusenhance:
[enhance] DataNucleus Enhancer (version 1.1.4) : Enhancement of classes
[enhance] DataNucleus Enhancer completed with success for 1 classes. Timings :
input=250 ms, enhance=40 ms, total=290 ms. Consult the log for full details
BUILD SUCCESSFUL
Total time: 2 seconds
Facebook Application
We are now up and running on Facebook!
After having read through tons of policies and even more documentaion, Math Empire is now up on Facebook. However it was not hard to actually get it up, but it seems stupid to just upload it and hope that it follows Facebooks rules.
The program still has no user authorization abilities, but that will hopefully be added later. So far the application is in sandbox-mode, so it can't be accessed from within facebook, but that will hopefully change soon.
Picture of our application inside Facebook:
After having read through tons of policies and even more documentaion, Math Empire is now up on Facebook. However it was not hard to actually get it up, but it seems stupid to just upload it and hope that it follows Facebooks rules.
The program still has no user authorization abilities, but that will hopefully be added later. So far the application is in sandbox-mode, so it can't be accessed from within facebook, but that will hopefully change soon.
Picture of our application inside Facebook:
Sunday, 15 November 2009
Sudoku
A simple sudoku-game has been added to the exercises available in the application.
I had some trouble with CSS, so i havn't been able to change the font-size inside the sudoku-grid, or practically not anywhere else either...
So far the sudoku-exercise can only display one sudoku-game, new games must be inserted somewhat manually, i.e. prociding a 81-digit long string representing the grid. There is no way to correct the ongoing game either, so no results can be stored.
I had some trouble with CSS, so i havn't been able to change the font-size inside the sudoku-grid, or practically not anywhere else either...
So far the sudoku-exercise can only display one sudoku-game, new games must be inserted somewhat manually, i.e. prociding a 81-digit long string representing the grid. There is no way to correct the ongoing game either, so no results can be stored.
Saturday, 14 November 2009
Clean(er) Code and Facebook
I have cleaned up the code a bit, the previous berserking-rage-coding-marathon was devastating on code readability, hopefully the code is a bit more readable right now.
I have added an abstract Exercise-class. Exercises can inherit that class and call its methods, hopefully that will make it easier to implement new types of exercises. A class that implements the exercise-class in implemented, therefore the application now features four different types of exercises(+,-,*,/).
Facebook
I have tried to find ways to connect with Facebook, but all tutorials I've found is using php, a language that I'm not familiar with. After some desperate struggling on the net, I found a Facebook Java API. I will look more on that now. Generally Facebook-related things seems to have enormous amounts of guides and tutorials available online.
I have added an abstract Exercise-class. Exercises can inherit that class and call its methods, hopefully that will make it easier to implement new types of exercises. A class that implements the exercise-class in implemented, therefore the application now features four different types of exercises(+,-,*,/).
I have tried to find ways to connect with Facebook, but all tutorials I've found is using php, a language that I'm not familiar with. After some desperate struggling on the net, I found a Facebook Java API. I will look more on that now. Generally Facebook-related things seems to have enormous amounts of guides and tutorials available online.
Tuesday, 10 November 2009
Save your progress
I have managed to get Google Datastore to work with our application!
The server now stores the results of users. The user-name entered when 'logging in' is stored and sent to the server together with the achieved results. If that name exists in the server's database, the result data will be updated, otherwise it will create a new data element.
The code works, but it will need some cleanups(sigh, zzz) ...
The server now stores the results of users. The user-name entered when 'logging in' is stored and sent to the server together with the achieved results. If that name exists in the server's database, the result data will be updated, otherwise it will create a new data element.
The code works, but it will need some cleanups(sigh, zzz) ...
User Authentication
I've been looking into user authentication. It is quite a challenge, considering all issues involved. We want users to be able to log in to Math Empire using accounts they already have registered with other services. If we let users sign in with their Google account for example, we can let Google worry about most issues associated with user authentication. Nice! But still, if we are to support multiple services we will have to differentiate these at some level. I've been looking at OpenID lately, which looks promising.
Ideally, there would be a single common interface towards different services, and an implementation of that protocol could be used to authenticate users from whatever service supporting it. Sure, such a wide perspective has its own set of drawbacks, but it sounds great anyway!
Ideally, there would be a single common interface towards different services, and an implementation of that protocol could be used to authenticate users from whatever service supporting it. Sure, such a wide perspective has its own set of drawbacks, but it sounds great anyway!
Monday, 9 November 2009
The Little Things IDE's do...
Since I (Daniel) uses neither Eclipse nor any other Java IDE, I have realised the painful way how great the little things IDE's do are. I am not talking about syntax highlighting, or dynamic intelligent "write half the code for me" features. No, I'm thinking about building and deployment, managing file paths, environment variables and tool chains, etc.
I hope Ant will do the trick for me, once I get all the paths set up in a nice, clean way. When that is working it shouldn't be difficult to write some small scripts to consolidate everything into a single "build the code and show me the result" script, like the Eclipse command "Run" I guess.
I hope Ant will do the trick for me, once I get all the paths set up in a nice, clean way. When that is working it shouldn't be difficult to write some small scripts to consolidate everything into a single "build the code and show me the result" script, like the Eclipse command "Run" I guess.
We are online!
A first pre-pre-pre-Alfa version is now up on Google's App-Engine servers.
Have a look at it on:
http://themathempire.appspot.com/
All EULA's that I had to read through just to get it up there made me sleepy.
About the app's current state:
Don't mind the login-menu, nothing actually happens when you type something in. That functionality will be added later on (of course).
Right now the application can be used to train basic arithmetic skills, two summands are randomized, twenty at a time, and the user has to add them together. The server stores the success-ratio of submitted answers.
Have a look at it on:
http://themathempire.appspot.com/
All EULA's that I had to read through just to get it up there made me sleepy.
About the app's current state:
Don't mind the login-menu, nothing actually happens when you type something in. That functionality will be added later on (of course).
Right now the application can be used to train basic arithmetic skills, two summands are randomized, twenty at a time, and the user has to add them together. The server stores the success-ratio of submitted answers.
Saturday, 7 November 2009
Getting Started!
Ideas and visions are running through our minds, and I have just finished some sketches. Tonight I will dream nightmares about uncontrollable CSS-monsters.
Have a look at the first storyboard sketch (There would have been more of them unless I ran out of black lead):
That one turned up to look like this:

It cant do anything useful yet, it just exists. Hopefully it will up on the net soon..
Have a look at the first storyboard sketch (There would have been more of them unless I ran out of black lead):

It cant do anything useful yet, it just exists. Hopefully it will up on the net soon..
Friday, 6 November 2009
Math Empire dev blog up and running!
This is the first among many posts on the development of Math Empire, the fun way to learn mathematics!
We chose to go the Google way when it comes to services and platforms, so now it is time to sign up for them all.
We chose to go the Google way when it comes to services and platforms, so now it is time to sign up for them all.
Subscribe to:
Posts (Atom)
