I've decided to leave blogger and move to blogs.scienceforums.net. The change is almost entirely simply due to the fact that the blogging community (and larger forum community) at ScienceForums is more fitting my subject matter, and it's an easier way to have people find my site.
The new link is http://blogs.scienceforums.net/GlitchHound/ and my new posts will all go there. For the moment it's under construction, but it's still fully functional.
For my one regular reader out there, be sure to update your link!
Saturday 20 March 2010
Weekend Plans
So, this coming week is the last week of classes before Easter break, and also the only week standing between me and US soil for a little time at home.
That means that this week is the final week for a lot of projects. Pro/E was one of them, but that's done. I have one assignment due Wednesday, and technically two due Friday (one of those being MATLAB, which will probably be pushed back). Incidentally, I have a friend coming to visit on Wednesday.
So that puts me in a predicament. I'd like to not be doing any sort of (boring) work while my friend's here, so I need to get at least the second project which is due on Friday done by Wednesday. Obviously the other assignment needs to be done by Wednesday. MATLAB, therefore, is technically my last priority. Expect to see that reflected in this weekend's turnout. I want to get at least a bare minimum done each day, with an arbitrary goal being something like one class/object per day. But the main priority is other work. And that means, little news on this front.
See you tomorrow.
That means that this week is the final week for a lot of projects. Pro/E was one of them, but that's done. I have one assignment due Wednesday, and technically two due Friday (one of those being MATLAB, which will probably be pushed back). Incidentally, I have a friend coming to visit on Wednesday.
So that puts me in a predicament. I'd like to not be doing any sort of (boring) work while my friend's here, so I need to get at least the second project which is due on Friday done by Wednesday. Obviously the other assignment needs to be done by Wednesday. MATLAB, therefore, is technically my last priority. Expect to see that reflected in this weekend's turnout. I want to get at least a bare minimum done each day, with an arbitrary goal being something like one class/object per day. But the main priority is other work. And that means, little news on this front.
See you tomorrow.
Friday 19 March 2010
Unplanned, Yet Foreseen Hiatus
What's that? No MATLAB code today? Who's surprised by that? *Looks out over the crowd* I'm not seeing any hands. Oh, I'm not seeing any crowd, either.
Regardless, I'm still posting. Aren't I a trooper? Today I did absolutely nothing. Not even gonna talk about some decision I made. I have not discussed any code aside from talking about the idiocy of MATLAB's ridiculously expensive compiler.
I /did/ play a good game of L4D2 versus. I /did/ get a hell of a lot done with CAD in school today. But nothing code-related. And that means that this post, while short, is done.
Regardless, I'm still posting. Aren't I a trooper? Today I did absolutely nothing. Not even gonna talk about some decision I made. I have not discussed any code aside from talking about the idiocy of MATLAB's ridiculously expensive compiler.
I /did/ play a good game of L4D2 versus. I /did/ get a hell of a lot done with CAD in school today. But nothing code-related. And that means that this post, while short, is done.
Wednesday 17 March 2010
30 Posts! Consecutive, no less!
Considering the average number of days in a month (in a non-leap year), rounded to the nearest integer (just truncated in a leap year. Yes, I did the math on this) is 30, I'm considering myself one full month of daily blog posts into this. For me, that's pretty impressive, as I'm usually the kind of guy who commits himself to something and then gets bored of it.
That said, I have literally accomplished NOTHING else today. Programming-wise, at least. I did get a new best answer for actual Java-related help on Y! A, but otherwise, nada. Zippo. Zilch. Get the picture? And here I thought I'd have time to do something today.
I did make one decision. In order to practice my object-oriented programming in this upcoming MATLAB assignment, I'm going to strive to achieve well-isolated code. I intend to program the essential workings first, getting the calculations encapsulated and finished, and then work on integrating them into the GUI and everything else. With Java, this is how I program already. With MATLAB, I programmed everything last time top-down. I built the GUI, then made the callbacks, then made the functions. It was actually ridiculous, in hindsight.
Doing things this way will give me the two-fold advantage of having the opportunity to play around with different arrangements and also allowing me to throw together a basic version if I find the optional stuff is taking too long.
And... that's all I've done today. Well, better than nothing. And still, a milestone! I'm happy.
That said, I have literally accomplished NOTHING else today. Programming-wise, at least. I did get a new best answer for actual Java-related help on Y! A, but otherwise, nada. Zippo. Zilch. Get the picture? And here I thought I'd have time to do something today.
I did make one decision. In order to practice my object-oriented programming in this upcoming MATLAB assignment, I'm going to strive to achieve well-isolated code. I intend to program the essential workings first, getting the calculations encapsulated and finished, and then work on integrating them into the GUI and everything else. With Java, this is how I program already. With MATLAB, I programmed everything last time top-down. I built the GUI, then made the callbacks, then made the functions. It was actually ridiculous, in hindsight.
Doing things this way will give me the two-fold advantage of having the opportunity to play around with different arrangements and also allowing me to throw together a basic version if I find the optional stuff is taking too long.
And... that's all I've done today. Well, better than nothing. And still, a milestone! I'm happy.
Overcomplication, and How it Simplifies My Life
Did some thinking on MATLAB today. Not content with just doing a GUI, I figure I'm going to implement a simple sort of file I/O system whereby when a user enters constant values it can save them, and then reload them on a later start of the program. The inputs required include some that will be different on each logon, but things like the wingspan, chord length, and (empty) mass (and weight) will always be the same. As a result, it would save time in the long run, assuming, of course, that this program is usable beyond the marks it earns me, to be able to save an aircraft configuration to reference by name at a later point. It should also save time.
I looked over the functions today and, while not simple, they certainly look possible. Since my Java program has yet to actually produce output, and that output is going to be database-oriented, I figured it'd be a good idea to learn the basic .txt input/output procedures. MATLAB is object-oriented, so I should be able to manage stretching the assignment into a learning experience for Java, even if it isn't exact.
Depending on how much time we have (the lecturer suggested he may be pushing the deadline back on account of the actually massive workload we have between his assigning the project and the due date, including this being a solid week of CAD training), I was considering doing a bit more optimization work on the first assignment and packaging both assignments together into an "Aerospace Tools" package, with a central launcher accessing both. But that's entirely optional and will only happen if I do have an extra three weeks (given the holidays starting the day after the current due date, this is possible).
I'm still reading through Yahoo! Answers, having a good time of it. I actually got chosen as a best answer, and the best part of it is that it was the only question I answered half-heartedly. It was someone asking for a good free place to make a blog, and I simply recommended blogspot // blogger here. I like to think I've helped some people out with their code, but I know I won't get some best answers simply because I refuse to actually do people's homework for them, instead choosing to try to explain how they can do it.
That's all for today, though. Tomorrow's the only short day we have this week, so maybe I'll get some coding done.
I looked over the functions today and, while not simple, they certainly look possible. Since my Java program has yet to actually produce output, and that output is going to be database-oriented, I figured it'd be a good idea to learn the basic .txt input/output procedures. MATLAB is object-oriented, so I should be able to manage stretching the assignment into a learning experience for Java, even if it isn't exact.
Depending on how much time we have (the lecturer suggested he may be pushing the deadline back on account of the actually massive workload we have between his assigning the project and the due date, including this being a solid week of CAD training), I was considering doing a bit more optimization work on the first assignment and packaging both assignments together into an "Aerospace Tools" package, with a central launcher accessing both. But that's entirely optional and will only happen if I do have an extra three weeks (given the holidays starting the day after the current due date, this is possible).
I'm still reading through Yahoo! Answers, having a good time of it. I actually got chosen as a best answer, and the best part of it is that it was the only question I answered half-heartedly. It was someone asking for a good free place to make a blog, and I simply recommended blogspot // blogger here. I like to think I've helped some people out with their code, but I know I won't get some best answers simply because I refuse to actually do people's homework for them, instead choosing to try to explain how they can do it.
That's all for today, though. Tomorrow's the only short day we have this week, so maybe I'll get some coding done.
Tuesday 16 March 2010
General Thoughts on MATLAB
MATLAB is a nice program. It's great for doing what it does, expandable, pretty easy to program, overall a very handy tool. Seriously, though, they haven't thought much about usability so far as I can tell. This isn't a rant about the program being hard to use for built-in functions. In fact, that's all pretty easy and, more importantly, well-documented.
This is a rant about development problems. Like any progamming language, you can code MATLAB programs in whatever text editor you feel like using. Unlike most, however, there are no third-party IDEs. Compiling code requires that MATLAB be installed (and in most, if not all, cases running), and if not MATLAB then a very expensive compiler. There's no such thing as a third-party compiler.
Compiling code is important as it's how you test it. Hopefully you don't get compilation errors, but if you do they'll tell you what's wrong. But you can't test for run-time errors without first compiling the code. In other words, I can't possibly develop efficiently on any machine that doesn't have their very expensive software on it. Nor can anyone else, of course.
I find this to be a major flaw with MATLAB. As great of a platform as it may be, it's such a hassle to program that most people prefer to program in a more accessible language. And it's not like those languages can't be manipulated to allow for the programs that MATLAB can support. In my opinion it was a seriously poor decision on their part.
I don't think Mathworks minds, however. They have a very strong hold on the academic and scientific markets. Their customers, mostly, make due with what they have. In other words, I don't expect anything to be changing on these fronts.
All I can do is post a mini-rant on my blog and suffer though the little inconveniences that these problems cause me. Or theoretically fork over $5,000 (no joke, I made an account on Mathworks to confirm this) to get the compiler for personal use. Can you guess which solution I chose?
This is a rant about development problems. Like any progamming language, you can code MATLAB programs in whatever text editor you feel like using. Unlike most, however, there are no third-party IDEs. Compiling code requires that MATLAB be installed (and in most, if not all, cases running), and if not MATLAB then a very expensive compiler. There's no such thing as a third-party compiler.
Compiling code is important as it's how you test it. Hopefully you don't get compilation errors, but if you do they'll tell you what's wrong. But you can't test for run-time errors without first compiling the code. In other words, I can't possibly develop efficiently on any machine that doesn't have their very expensive software on it. Nor can anyone else, of course.
I find this to be a major flaw with MATLAB. As great of a platform as it may be, it's such a hassle to program that most people prefer to program in a more accessible language. And it's not like those languages can't be manipulated to allow for the programs that MATLAB can support. In my opinion it was a seriously poor decision on their part.
I don't think Mathworks minds, however. They have a very strong hold on the academic and scientific markets. Their customers, mostly, make due with what they have. In other words, I don't expect anything to be changing on these fronts.
All I can do is post a mini-rant on my blog and suffer though the little inconveniences that these problems cause me. Or theoretically fork over $5,000 (no joke, I made an account on Mathworks to confirm this) to get the compiler for personal use. Can you guess which solution I chose?
Monday 15 March 2010
Old MATLAB Improvements, Java Data Objects Primer
Matlab m-file (Download and run)
Matlab Source Code (to view online)
For the most part I haven't changed the workings of this code. I did change one error dialog that told you the height needed to be between 0 and 20,000 meters when inputting an incorrect value for the height increments. Just a copy-paste situation where I forgot to edit the message. The big changes here are comments. It's quite thoroughly commented now and should be a bit easier to follow. I also commented-out the "Standards Selection" box, which was unusable, and centered the title information to make it look more natural. Finally I cleaned up a function call that was passing the constants array despite the fact that the other function had full view of the same array. Basically, unnecessary transferring of variables. Theoretically should have sped up the code. Considering the ambiguity of some of this code and the amount of time that passed between writing it last and doing this editing, I'm quite pleased with my ability to understand what was performing which actions throughout.
After finishing that I decided not to start the new assignment yet. Instead I started reading my book on JDO. The more I read, the more excited I get about the system. It really seems quite easy to work with and I'm excited for the implementation of it all.
I'm not sure I've talked much about JDO and why it's important to my application and Java in general, so here goes. Java code is run in a Java Virtual Machine. This is what enables it to be so universal... once the JVM is started up, one computer "appears" to be exactly like any other. At least in terms of executing the code. Unfortunately, every action the code performs is done in this Virtual Machine, and this means that everything that's been done is deleted when the code finishes, as the code finishing results in the JVM being closed. Saving in Java is done by file output during the execution of the code, by Serialization, or by storing the values of a class's variables in a database.
The first, file output, is mostly for saving a text file or similar. It's simple and useful sometimes, but it's simple and therefore not useful other times. In the case of my simulation, it's impractical due to the methods of parsing a text file back in (it would take AGES) and due to the ease of editing that text file between sessions to hack the game. Besides that, saving the file on your computer makes it tough to have an exciting multiplayer experience.
The second, Serialization, is complex. Essentially it converts the state of an object into a stream of bits and bytes, then on loading deserializes it back into its object form. These bytestreams can be large, but more importantly it's a bit unwieldy to program a class to be Serializable and program the Serialization and Deserialization across a full application like the simulation. There's also, again, the problem of things being stored on a client computer and making multiplayer a bit lackluster.
The third is storing values in a database. To start with, we'll ignore JDO. Storing values in the database means building a database (using SQL, most likely), linking the Java code up with it through the JDBC API, and programming in all the possible commands for editing the database that the client will ever use. While it sounds daunting, it's certainly doable and it had my vote for a while. Every time the client-side application is run, the user would log into the database and it would load all of his/her details, initializing all the objects necessary and setting the values back to what they are in the database.
Then comes JDO. JDO is a standard that allows me, as a Java developer, to program everything in Java code. I don't need to build my database with SQL to start with, I don't need to include ridiculous amounts of SQL hidden among the Java I'm writing, I don't need to specially format my classes. All I do is write the class as normal, enhance it with an automated tool (which builds into the class all of the methods necessary to view and edit it, automatically), initiate my database with a similar automated tool, and tell my program to make an object persistent whenever I need it to. Loading that object isn't always done per se, more often you just access the values in the database. It's just that those values are set within the Java application and without any complicated translation are plopped into the database in a Java-accessible structure.
It's really the easiest of the bunch I've seen so far. I can't wait to actually use it.
But first... I have more MATLAB to code.
Matlab Source Code (to view online)
For the most part I haven't changed the workings of this code. I did change one error dialog that told you the height needed to be between 0 and 20,000 meters when inputting an incorrect value for the height increments. Just a copy-paste situation where I forgot to edit the message. The big changes here are comments. It's quite thoroughly commented now and should be a bit easier to follow. I also commented-out the "Standards Selection" box, which was unusable, and centered the title information to make it look more natural. Finally I cleaned up a function call that was passing the constants array despite the fact that the other function had full view of the same array. Basically, unnecessary transferring of variables. Theoretically should have sped up the code. Considering the ambiguity of some of this code and the amount of time that passed between writing it last and doing this editing, I'm quite pleased with my ability to understand what was performing which actions throughout.
After finishing that I decided not to start the new assignment yet. Instead I started reading my book on JDO. The more I read, the more excited I get about the system. It really seems quite easy to work with and I'm excited for the implementation of it all.
I'm not sure I've talked much about JDO and why it's important to my application and Java in general, so here goes. Java code is run in a Java Virtual Machine. This is what enables it to be so universal... once the JVM is started up, one computer "appears" to be exactly like any other. At least in terms of executing the code. Unfortunately, every action the code performs is done in this Virtual Machine, and this means that everything that's been done is deleted when the code finishes, as the code finishing results in the JVM being closed. Saving in Java is done by file output during the execution of the code, by Serialization, or by storing the values of a class's variables in a database.
The first, file output, is mostly for saving a text file or similar. It's simple and useful sometimes, but it's simple and therefore not useful other times. In the case of my simulation, it's impractical due to the methods of parsing a text file back in (it would take AGES) and due to the ease of editing that text file between sessions to hack the game. Besides that, saving the file on your computer makes it tough to have an exciting multiplayer experience.
The second, Serialization, is complex. Essentially it converts the state of an object into a stream of bits and bytes, then on loading deserializes it back into its object form. These bytestreams can be large, but more importantly it's a bit unwieldy to program a class to be Serializable and program the Serialization and Deserialization across a full application like the simulation. There's also, again, the problem of things being stored on a client computer and making multiplayer a bit lackluster.
The third is storing values in a database. To start with, we'll ignore JDO. Storing values in the database means building a database (using SQL, most likely), linking the Java code up with it through the JDBC API, and programming in all the possible commands for editing the database that the client will ever use. While it sounds daunting, it's certainly doable and it had my vote for a while. Every time the client-side application is run, the user would log into the database and it would load all of his/her details, initializing all the objects necessary and setting the values back to what they are in the database.
Then comes JDO. JDO is a standard that allows me, as a Java developer, to program everything in Java code. I don't need to build my database with SQL to start with, I don't need to include ridiculous amounts of SQL hidden among the Java I'm writing, I don't need to specially format my classes. All I do is write the class as normal, enhance it with an automated tool (which builds into the class all of the methods necessary to view and edit it, automatically), initiate my database with a similar automated tool, and tell my program to make an object persistent whenever I need it to. Loading that object isn't always done per se, more often you just access the values in the database. It's just that those values are set within the Java application and without any complicated translation are plopped into the database in a Java-accessible structure.
It's really the easiest of the bunch I've seen so far. I can't wait to actually use it.
But first... I have more MATLAB to code.
Labels:
java,
Java Data Objects,
JDO,
Object Oriented,
programming,
simulation,
tutorial
Subscribe to:
Posts (Atom)