Thursday, November 19, 2009

So what?

Sorry, I've been neglecting you my ACM 1 year Anniversary Alan Turing Coffee Mug and matching blog slash tangent to CS520 and moreover the Sun WJ Series Java Tutorials and PDF certificates of completion that has stolen so many hours in the first two weeks of this class, but I am now attempting to salvage an A before it is too late, and at this very moment attempt to tease out the peculiarities of Java's syntax regarding the use of a case statement.

I learned a very important lesson. Don't cut from display oriented programs into development oriented programs, the hidden characters are worse than the ticks. Open in a development oriented program. So, when all is said and done. Some simple rules apply to cases, don't use anything but integers or final strings assigned integers for your cases. Don't be afraid to stick a println statement in to trace a value. Oh, and drink plenty of fluids and take your vitamins.

Friday, November 13, 2009

Cookies

I still haven't completed the last lab in the WJ-2752. It's not that it is hard, it's that I have been busy with higher priority items, and baking. I had a homework that I needed to do because it was grade. It wasn't much of a challenge, but it was hard enough to be pleasant more than just a distraction from what I really want to do, which is find work and make enough money to provide for myself and dragonboy (my son). To that effect I had a Reuben sandwich in Fort Washington. Actually, I went to Fort Washington for an interview. The Reuben sandwich was a foolish afterthought I hope the world isn't so cruel as to punish me for, at least not more than what corned beef already does to my life expectancy.

The interview was for a position programming in VB, SQL, and a smattering of C# with lots of currency conversions and a wide variety of user roles. I hope I get it. I think I would do pretty well in that position, and the commute would be a breeze with a pair of boots (it is getting to be that time of year).

My homework consisted of creating an object to parse a string into multiple variables of different types, creating some JFrames, drawing a smiley face, assigning button behavior, and tiling those JFrames in a cascading fashion when populated by a button click. It was fun. There was a little exception handling too. It would probably be easiest to display an image of a smiley instead of paint one, but that wasn't really in this week's lesson plan, soooo....

I made lemon bars and nutty sugar cookies and dough to use later. I might make some more tommorow depending on ingredients and space to store said cookies. Mike made peanut butter cookies, and the were good and the right shape. My cookies were good, but a little odd shaped. The lemon bars turned out pretty good, even though I think the pan I used was a tiny bit too big.

But I digress...

Friday, November 06, 2009

At long last after a week and a half of causal play like study lower in priority than my school work, working the polls, and doing odd chores about the house (truth be told this Java stuff being easy and kind of fun makes it unofficially tied with chores for priority), WJ-2752-6E is nearly complete. At this moment I embark on the last exercise of the last lab of this course and ready myself for the future. I think I am going to complete this series of course before doing the 1XXX and editing this blog.

Distractions, distractions, distractions. I am still going to try and finish this lab before the weekend is over, but I just realized I am no longer a week ahead in class, so I need to remedy that first as it is higher on my list of priorities. Ok, I submitted this week’s assignment. I am going to take the quiz this evening and I am going to do next week’s reading. I am so glad these courses complement each other.

You know I might just put off this week’s reading until the week it is due in. Yes, I am well aware of the colloquial connotations contained in the phrase “this week”, and I am also aware of the denotative and prescriptive semantics and syntax implied in it as well, but in the broader context in which I am using it, it is a variable to which I assign assignments for the purpose of maintaining the illusions that I intend not to ever have a hand at programming robotic chore delegates festooned with awards for the passing and upgrading to pass real world exceptions to the subroutines, though it is actually used for maintaining a study schedule that follows the lesson plans. I had intended to accelerate in my formal studies at the expense of rapid completion of the Sun WJ-275X-Series Java CBTs. And Instead this of I ramble on aimlessly hoping to hint at my activities regarding this other Java course I am trying to pawn off on the moisture farmers.

Utinni!

WJ-2752 Lab 5 Exercise 2:

I love the Jawa Iziz in the Knight of the Old Republic game. He’s a funny little guy and surprisingly knowledgeable about the history of mining on Tattooine. His buddies were being held hostage by the Sand People. I think they were impressed with Revan’s shining armor and diplomatic relations were tense but the Mighty Chieftain secured many blessings for his people. Uhh… please pay attention to the heading.
How’s this for digression I just read the first lecture for next week (i.e. this week’s (see above))? It was great. These courses really complement each other. I had my suspicions confirmed for the effect of certain methods that appear at certain cursor positions relative to identifiers when you press Ctrl+space in Eclipse. I am curious to see if I remember to when I go over the labs I have taken so far to let my dreamer have a longer leash, maybe one of those one’s that are like tape measures and wind up with a spiral spring, with the Ctrl+space exploratory combinatorical randomizers in ape suits. I just imagine a pair of monkeys with little green accountant’s visors flipping coins and rolling dice and marking the results on a chalkboard, and one in the corner wearing a dunce cap and trying to apply the same method to build a typewriter that increases the odds of random button strokes writing Hamlet. Me I just assign each letter key a 26th of Hamlet in auto complete and tell myself that someday I will write a macro to randomize the assignments.
The next lecture is on exception handling. I am quite pleased as neither the WJ-2751 nor the WJ-2752 Sun CBTs have covered this, and I need to know for the sake of the monkeys in my brain screaming program better! program more! Program now! I kid. There are no monkeys in my brain screaming. And even if there were, how would I understand what they are screaming? They’re monkeys not people. No, I have some distant elevator music in my head. It’s soothing but I can’t quite make out the tune. It makes me want to listen to the Fallout3 soundtrack, and that kind of makes me want to hear the O’ Brother Where Art Though soundtrack. The last lecture was about the String object and its methods. I am so going to let myself make some sort decoder ring or something.

Oooh, a third lecture and hooray its drawing! I wonder how long it will take me to draw a Jawa. And a third? Event handling? Huzzah! And I was worried that the pace of the course would be merely leisurely, this is brisk. Huzzah! You know, dorkus, everybody else isn’t a speed reading genius. Don’t be jealous. For money I can teach you stuff I know about speed reading and geniuses. This week’s lectures almost seem like a crash course in the J in AJAX or a casual imperative to make a graphing calculator when you get the free time.

"Look Java, next time you wanna talk to me, come see me yourself. Don't send one of these twerps."-

Friday, November 6, 2009

Sand stays. All else changes. (Jawa Programming 2)

A Jawa programmer? But this R2 unit has a bad motivator. Enough! Pay attention, sit up straight and for the love of all that is good and decent try and look like you’re trying.

I actually read somewhere that daydreamers tend to be more productive than average. I suppose it has to do with how much brain power is actually used pretending to be deeply engaged in some activity other than slacking off, and making sure the people around you are aware of the faces you are making at your work when you are trying to look as if you are doing it. I know I tend to be quite productive when I haven’t a care in the world. I mean when I am skipping and smiling and daydreaming about fairies and unicorns and frolicking in the woods, and not worrying about getting beat up for it because I am bigger than everyone and skipping is good for your endurance and all-around ass-kicking power, I get a lot done. Why is that? You, see skipping engages the muscles of the thighs and calves and causes them to demand an increased blood flow as well as muscle building proteins… Oh, the other thing. Because, I am smart. See, I could furrow my brow and stare intensely at the thing that is in some respects an impediment to my doing what I like, frolicking or kung fu or drawing robots or what-have-you, or I could get it done quickly and correctly, not only maximizing the amount of time I have to frolic and leap tall buildings and such, but also stimulating the release of reward chemicals in my brain with a self-serving neuro-synaptic pat on the back for a job well done.

Back to solving the world’s problems err… this Java lab. I bet I could solve some of the world’s problems. I am pretty smart and I care about umm… things.

JAVA! WJ-2752-6E Lab 5 Exercise 1:

In this lab we have five tasks: Modifying the Bank class, Modifying the Customer Report class, Deleting the Current TestReport class, Copying the New TestReport class, Compiling said TestReport class, and of course running said TestReport.
Briefly, seeing that the other tasks do not require much in the way of completion of the previous tasks I am going to do them slightly out of order. This I can do because in the magical world of make believe I encountered a wizard who granted me powers to peer through project dependencies and traverse the points of view of stakeholders near and far. Some psychologists or another might say no Tom it is because you have an IQ over 140 on the Wechsler culture fair that you can do this. Personally, I find it hard to believe that anyone would prefer hearing about my psychometrics to hearing about wizards.

Anyway…

The work breakdown at a level just above this one (the lab assignment) has only three tasks: “Do the thing to the bank thing.”, “Do the thing to the one report thing.” and “Do the thing to the other report thing.” The thing I have to do to the other report thing is half done already because of the way I have chosen to do this lab in Eclipse. I just have to copy the new TestReport class from the folder I have installed it in. I am going to open it in Notepad++, just because I don’t want NetBeans (my default Java editor) to draw me in with its pleasant came with my new JDK smell. It’s not too hard to find files on my computer since I make adequate use of shortcuts. I really have been meaning to pick up some books on topology. I really expect it to be a worthy distraction that might lead to revolutionary advances in data, file, and object modeling.

I just need to make sure my imports are reflective of the new package… and ok, back to step one. I should probably fix all the import statements in all the classes while I am doing that… ok, done. Now all of our classes are talking to the right classes in the right packages.

In task one, we are changing all of the instance variables and methods of the bank class to static. After a typing the keyword static a few too many times to feel like a genius and then copying and pasting the rest in, we have now introduced a bunch of errors that we are going to fix in a manner different than un-introducing the causes of them namely the static keyword. A little peek at the UML model (still level 1) to make sure our publics aren’t supposed to be privates, and everyone is protected by their hash signs, and all that rot, and we are ready to move on to the next task.
I had a few variables that I had to make local to the methods that used them to bring the bank class in line with the UML diagram. I also had to turn the constructor private. All the errors went away after I realized I only had to make the methods and variables static, not the constructor. Apparently we are not allowed to make constructors static. I suppose that makes sense… sort of. Since the constructors belong to the instances of the class… sort of.

Task two has us modify the CustomerReport class to access the bank class as a utility class. As it stands now all the errors are gone only the warnings pertaining to no accessing the Bank class in a static way remain, and the code runs. Since my customer report class instantiated the bank objects by referring to them with a lower case to differentiate them from the Bank class modifying this class was simply a matter of capitalizing the bank in bank.method() when those static methods were called.

On a side note: static integer variables with a constructor that increments the variable can be used to keep track of the objects. Just in case my gibberish was to passive in voice, we are done with lab 5 exercise 1 now, and we didn’t peek at level two at all. We are good.

Utinni, utinni!

Friday, November 06, 2009

Lab 5, this is the final lab in the WJ-2752-SE6 course. We are in the home stretch now. After this the decision: Do I proceed forward and take the WJ-2753 course, or do I get side-tracked with these other courses that judging by the numbers (WJ-1XXX) in the series I should’ve taken first,… or do I go over the courses I have taken thus far with the intent of turning my blog posts into something that doesn’t infringe any copyrights but nonetheless clearly demonstrates the technical acumen I demonstrated in completing these courses on level one, save for one lazy exercise in lab 4 where I peeked (just peeked) at level two. I really wouldn’t have peeked if I hadn’t gotten the notion of overloaded constructors in my head. I really thought that lab was implying their use. I think this lab will use them. I really should make a habit of doing the lab after the section it applies to instead of doing them all at the end of the course.

Sorry about the wait. I just discovered Lexulous on Facebook. Oh, how I miss playing Scrabble with the Mensans and the Facists. This game is based on Scrabulous which had to change its name after being sued for copyright infringement. Of the many projects I have started for fun and never quite finished my Scrabble database was, while I was playing scrabble the most fun. I think I am going to revisit it in Java, or at least revisit Scrabble as an inspiration for fun little hobby projects. I think Lexulous has its levels arranged like those of these WJ course labs, in that they are ranked by accomplishment decrementing to number one rather than incrementing by difficulty to most hard. Wait, how did I lose to level 1 and 10 but not 6? I get it Lexulous gets to make up words like howf, and miggles.
Ok, that’s enough of a diversion for now. Let’s get back to the project at hand. In lab 5 exercise 1 we are going to modify the Bank Project we have been working on throughout this course, again. I think this is some sort of heuristic to drive home the notion of the reusability and maintainability of code afforded by the object oriented approach. Either that or that was the excuse given for not creating a wider variety of labs for this course. I would personally like to see a Scrabble based lab, perhaps where we create and instantiate tiles from the tile class, and then call the methods like getAdjacentTiles(), getSquareMult() or calcTileOnSquare(), getWordsWithTiles(), or… but I digress.

In this exercise we are going to modify the Bank class. In order to do this I am going to need to copy the project into Eclipse. So far I have made a separate package for each lab and exercise. This allows me to go over them as each lab that reused parts of a previous one had me modifying or deleting something or another. The advantage of keeping them separate is that with each lab when I go to edit the gibberish I have been blogging thus far, I can read the lab and look at the finished code and even look at the project prior to it. If I had used NetBeans and simply worked in the same project and package as instructed in the lab I would have to do each lab over again from the beginning, sure I would probably burn the lessons deeper into my brain, but, as we have see thus far doing each lab from the beginning has had the effect of me blogging gibberish. It is therefore the case that using NetBeans would make me blog gibberish… again, iteratively, and then I would give up on Java, and that would be a shame because I like it… again.

A little Eclipse tip for you: If like me you find yourself naming packages according to the implicit requirements of some Sun CBT, say WJ-2752-6E, and you are ending up with names like lab5.exercise1, lab5.exercise1.domain, and lab5.exercise1.etc. Make sure to put a class in lab5.exercise1 before any other package or else Eclipse will be sneaky and hide your empty top level packages while your off making waffles or a tuna sandwich, as the case may be.

A Jawa programmer? But this R2 unit has a bad motivator. Enough! Pay attention, sit up straight and for the love of all that is good and decent try and look like you’re trying.

Thursday, November 5, 2009

I am still bigger than you. Don't hit the nerds.

Thursday, November 05, 2009

Haha, exercise three is advanced and has no other levels to peek at. Take that lazy me. Without any ability to sacrifice my self-esteem you are left with only the ability to submit to diligent me. Unless you can summon a mighty sleepiness, that at 6:30pm is unlikely. Yeah, lazy, yeah, in your face! Save for spelling Accumulate Acculumulate and needing to remember to call getters instead of attributes (duh), I am advanced number one again and the only thing you can do is not change my
spelling. Hah! Err… damn spoke too soon, but I am going to make you fix the spelling.

Yeah, so umm… huh. I fixed it. I was getting a null pointer exception owing to the setter method having this on the left, err… right side of the assignment operator, and then another one that was just a side effect of my playing with the iteration direction. I turned it to decrement and left a dangling 1 when I needed a zero, no biggie. All that said and done, I won. Hahahaha. One more lab to go and I will have completed two courses in two weeks while taking a graduate course in the subject. Ah, sweet simple self serving pride… please don’t ruin this for me.

Pobody's Nerfect

Thursday, November 05, 2009

WJ-2752-6E Lab 5 Exercise 2: Creating a Heterogeneous Collection of Customer Accounts (Level 1)

Ooh, yummy more arrays. Sorry, I got distracted. I got to level thirty in Fish World and now my shark is eating all my fish. I seem to have been painted into a corner by the test conditions supplied. I am feeling a little lazy so I am peeking at level 2. I just couldn’t grasp how I was supposed to simultaneous return two different types. I really need to read up on overloaded constructors. It seems that I had read too much into this lab. I wasn’t supposed to overload the account constructors… nope just initialize an array in the existing one. Ok, it works, I didn’t get to do all of them on level 1 on the first try but hey, I occasionally get a B. I am ok with that. I can validate myself as a person. I am good enough, I am smart enough, and doggone it, people like me. :P

Wednesday, November 4, 2009

You want a cup of Jawa juice?

Thursday, November 05, 2009

It seems I am done my homework. It would seem I had been done, save for making sure the output of a particular method was converted to integer from double. Now that that is done, I am going back to work on these labs. I am wondering if I should have done the WJ-1xxx before the WJ-2xxx courses. Oh, well I am going to be working on WJ-2752-SE6 Lab4 exercise 1 for this post. Let’s see what happens when we create inheritances and polymorphisms and overrides and stuff.

Ok, a little of this and some super() and voila. That was easy except for the fact that I assumed some level of implicitness to the whole inheritance thing. Actually, I thought this implied super for the super constructor. Don’t ask me why. I forgot how to program when I got interested in girls. I think I used to write in C and BASIC before I started growing hair where my extremities met the rest of my body, long before I went to school for anything even remotely computer related, besides the Oregon Trail of course. Good night.

Monday, November 2, 2009

I could be mistaken about why it works. It does however work.

Monday, November 02, 2009

So, after RSVPing some events and going hiking yesterday and casually mentioning some opportunities to volunteer at the lovely five mile woods (I really love fmw, my daughter told me we were ethereal there when I took her there at age four or five), and sending my resume off so that I might serve on the Frankford Community Development Corporation, but before I go that meeting tonight to prepare for volunteering tomorrow at the polls, I am making time to continue my studies in Java.
Today’s lab: WJ-2752-6E Lab 3 - Exercise 2 – Using Arrays to Represent One-to-Many Associations (Level 1). Sounds exciting!

We are starting with the banking project that we did in earlier labs. Specifically we are going to use the customer class objects in the array attribute of the same name belonging to the bank class of objects we are going to be creating.
So, four hours have passed. I keep on getting null pointer exceptions. I have an array of objects I am passing values into through their objects. Ok, I peeked at level two, but this one just kept rotating through null pointer exceptions and array index out of bound exceptions. Truth be told I had already figured out what level two told me about my array being set too small. Somehow I was expecting to have dynamically resizable arrays in Java. I guess that wouldn’t really make sense though given that Java manages its own memory. I hate feeling like I have outgrown a language before I really get my feet wet.

So I have learned that we need to declare our arrays to be of a length and I suppose it would be wide to learn to copy arrays so that when their sizes get exceeded error handling could be set up to automatically copy the array to a larger one created… I am hungry or else I might try and do this.

Saturday, October 31, 2009

Sunny Day Tests

public class TestArrays {

/**
* @param args
*/
public static void main(String[] args)
{
MyArrays array1 = new MyArrays();
array1.setArray();
array1.printArray();

System.out.println();

MyArrays array2 = new MyArrays();
array2 = array1;
array2.printArray();

System.out.println();

array2.arraySet[0] = 0;
array2.arraySet[2] = 2;

array1.printArray();

System.out.println();

array2.printArray();

}

}

Sunny Day Objects

import java.util.Scanner;
public class MyArrays
{
int n;
int[] arraySet;
Scanner input = new Scanner(System.in);

public void setArray()
{
System.out.println("Enter Array Length");
n = input.nextInt();
arraySet = new int[n];
for (int i=0; i < arraySet.length; i++)
{
System.out.println("Enter Array Value for Position " + (i+1));
arraySet[i] = input.nextInt();
System.out.println("Array Position " + (i+1) + " = " + arraySet[i]);
}
}
public void printArray()
{
System.out.print('<');
for ( int i = 0; i < arraySet.length; i++ )
{
System.out.print(arraySet[i]);
if ( (i + 1) < arraySet.length ) {
System.out.print(", ");
}
}
System.out.print('>');
}

}

More sunny days in Philadelphia.

Lab 3 Arrays Exercise 1:

Aww… there isn’t a level one in the first exercise. Oh well. Looking at the project in NetBeans it looks as if I am creating the test objects for this one as well. What now? Eclipse. What are you doing? I know. I am happy we can search strings in other strings. We can also use that code along with the java.util.Arrays.toString method to parse the array into text, and that’s great, thanks, but can we please run the project package I am working in, please? Thank you. Now, umm… what were you saying?

So what happened was this. Eclipse had been distracting me by executing a program I had written for a previous lab having to do with searching text with loops and charAt. So, I went to all of this trouble to make a string something like this 1,2,3,4,5. And then I was going to parse it into an array. I think you can tell my programming background is kind of shell and batch oriented. And wouldn’t you know it: Java isn’t ksh or bash it’s Java. Fortunately for me Java makes sense, sort of, especially when you are writing it OO. I actually made this lab a lot harder than it needed to be. I still didn’t peek ahead though(yay me). It wouldn’t have been much of a challenge if I had just created new arrays and set their values with curly braces as the lab instructed, but I wanted more. I had to have an interactive application that polls you for your array length and then requests values for each place while iterating through a count from zero to the array length.

The lab of course taught the lesson that, while arrays are not primitive data types, caution should be taken to assure that in setting two separate arrays to the same starting set will propagate changes to one to them all if their values are assigned as being equal to each other rather than to the same data set.
I decided to have the methods of the object return according to type to remind myself not to leave related but functionally separate (i.e. setters and getters, ins and outs, frics and fracs, yings and yangs) statements together in a single methods. I also wrote the same functionality of statements in lines for console and window alerts. I commented out the console and affixed comments of the type mentioned in the first paragraph to both types of matching functionality. This should be sufficient to create test inputs and outputs to provide a modicum of change control as both versions could be edited by separate developers pursuing identical functional requirements thereby integrating testing. A technique like pseudocoding and then translating amenable to iterative development risk control…. but I digress.
Oklee, doke. So this weeks (next weeks) assignment has us write Java in a procedural manner and then translate that into object code. The object code be demonstrative of there being multiple companies with multiple share prices and quantities of shares outstanding. This assignment requested specific classes by name which along with a one paragraph narrative sufficed to describe the functional requirements. I could’ve made a UML diagram and worked from that but the design constraint explicated in the assignment documents were more than sufficient to hammer out methods from the procedural codes. It really was a matter of shuffling more than naming.
CS520 Module 2:

I seem to be at an impasse. I am thoroughly secure in the satisfaction of the functional requirements for this project. I am, however, tempted to explore the features and options available in eclipse and Java to shift commentary in order to have lines suffixed “//swap JOptionPane;” and “//swap.console” exchange their places behind their column delimited comment delimiters (I should check on the formatting, and maybe craft an XML schema to aid in parsing the butterfly methods and global variables into some database or another. You know what. I should probably do this… module lesson, er… object code reusability… personal library… umm… huh).

Thursday, October 29, 2009

Work while your exhausted? That's not very smart.

Exercise 3: Using Nested Loops (Advanced)

So tired must I? Tonight? Sleepy, Strings not having string methods. How did I create Strings after error they created. I woke up this morning and saw that I was doing string comparisons instead of character comparisons. I think I overcomplicated the issue. I fixed it. Now I just need to suppress the dialog for each check. I must say I am at least twenty percent smarter after a good night’s rest. I am still a little iffy on the necessity of a return statement outside of my if and loop statements that have returns, but it works so why should I complain?

Wednesday, October 28, 2009

Autocorrect

I am reading some of the help comments some of my fellow students have left. One of the ones that caught my eye had to do with "smart quotes", or error ticks not to be confused with deer ticks, which carry lime disease. Error ticks are just bugs in almost every programming language.

This one has guards on him: '“'

The suggest for preventing some of these guys had to do with changing the autocorrect options in MS Word. That reminded me of another tab in that same dialog window options thingy. I love Autocorrect. You can have so much fun with it. Mean fun, but fun anyway. I set it to replace my first name spelled in all lower case with my first name spelled in all lower case followed by the words "is a douche".

I wouldn't do that to anyone else. I wonder if a Tier 1 support technician could figure out why Microsoft Word has is making fun of a fat girl named Peggy, while she is in tears on the line. Poor, poor fat piggy. I told you it was mean. Which is why I only do it to myself.

I actually saw an episode of the office where umm... the protaganist(Mike, maybe?) confessed to writing a macro to do call Dwight a weenie or something. Betcha, disable macros occurs in a troubleshooting flowchart before autocorrect.

Of course it doesn't have to be used for nefarious purposes. Autocorrect can be used force people to stop using texty slang. This of course could be done in a mean way too though. For example you could have "ur" replaced with "you're", or "Type the @#$%ing word 'you're' you lazy @#$%ing good for nothing @#$%!" If you're feeling in the mood for little fun with cultural sensitivity, you might want to try autocorrecting "OMG" with "OMG-D, please." I always like replacing common texting slang with strings of nonsense letters. Something like replacing LOL with a brace expansion of each letter of LOL against each letter of the alphabet all concatenated together.

More puppets? Yes, more puppets. Think of the money you'll save on dry erase markers.

Well since I am supposed to be reusing the packages from the previous account lab I might as well load them. I was off feeding my virtual fish, not that you would have noticed since this is print… that gets time stamped.

I am going to skip to Tasks 2 and 3, still not peeking at level 2 or three. The last exercise only had the one level. Task 3 is dependent on the completion of Task 2, but neither requires 1, and they’re both short tasks.

Now for one. I am supposed to test the operation of some if statements. And return them. And the really wasn’t very hard. Even though I had imported the wrong packages, and I kept getting errors that were just not possible given the code I had to change for this lab. It’s a shame I was referencing a different lab. Maybe I should give the package jazzier names, make their differences really stand out.
Instead of names like lab2.exercise2.domain and lab1.exercise2.domain, I could name them things like mad.max.domain and lord.humongous.domain, or godzilla.domain and peewee.domain. Then I could printout pictures and use them in puppet shows that demonstrate the interactions between packages… and it’s a quarter till one.

Get back to work you slacker.

WJ-2752-SE6: Lab 2, Exercise 2: Using Conditional Statements in the Account Class (Level 1)

Another one? How much practice do I need with account stuff? I have a bank account, a reasonably high IQ, and an imagination. When are we going to program some stuff for proton beam ignition driver? Or a airfoil deformation controller? Or a great big demon with big old horns that has red glowing eyes and breathes fire and and shoots lightning and drops rare loot, ooh, like a helmet with big horns that grants fire protection, or something like that.

Fine, we’ll make another accounts doohickey. Like an off-the-shelf product doesn’t already blow this stupid little class out of the water. Ah, heck what do I care, it’s not like you’re paying me for this. I am only hoping someone might.

Oh, well. Carry on then.

/* Sorry sir, I almost forgot. I made a test. The outputs should be the same. Mind the comments. You look perplexed. Should I write a manual? Five or ten pages? */
public class FooBarBaz
{
public static void main(String[] args)
{
String foo;
String bar;
String baz;
int n;
n = 1; //set n to one to align 50 and 1
for (int i=50; i>0; --i) // the loop counts down but the game ticks forward... from zero, oops.
{
// System.out.println(n); // Remove comment to print n on a separate line from the ducks and geese
if (n%3==0 && !(n%3==0 && n%5==0) && !(n%3==0 && n%7==0) && !(n%3==0 && n%5==0 && n%7==0))
System.out.println("N is equal to " + n + " I is equal to " + i + " foo");
// foo, foo bar, foo bar baz, foo baz
else if (n%5==0 && !(n%5==0 && n%5==0) && !(n%5==0 && n%7==0) && !(n%3==0 && n%5==0 && n%7==0))
System.out.println("N is equal to " + n + " I is equal to " + i + " bar");
// bar, bar baz
else if (n%7==0 && !(n%7==0 && n%5==0) && !(n%3==0 && n%7==0) && !(n%3==0 && n%5==0 && n%7==0))
System.out.println("N is equal to " + n + " I is equal to " + i + " baz");
// baz & null makes 8 or 2^3, 4 remain unaccounted for.
else if (n%3==0 && n%5==0 && n%7==0)
System.out.println("N is equal to " + n + " I is equal to " + i + " foo bar baz");
// foo bar baz accounted for, 3 left, sir requesting leave. I am not required for this maximum i sir. 3*5*7 > 50, QED.
else if (n%3==0 && n%5==0)
System.out.println("N is equal to " + n + " I is equal to " + i + " foo bar");
// foo bar present and accounted for sir! c--
else if (n%3==0 && n%7==0)
System.out.println("N is equal to " + n + " I is equal to " + i + " foo baz");
// foo baz, sir bar baz is the only one unaccounted for sir!
else if (n%5==0 && n%7==0)
System.out.println("N is equal to " + n + " I is equal to " + i + " bar baz");
// bar baz reporting sir! All present and accounted for sir!
else
System.out.println("N is equal to " + n + " I is equal to " + i);
n++;
}
}

}

All that time for this?

// cute little guy isn't it?

public class DuckDuckerDuckest
{
public static void main(String[] args)
{
int n;
n = -10; //set n to one to align 50 and 1
for (int i=51; i>0; --i) // the loop counts down but the game ticks forward... from zero, oops... or -10
{
String foo;
String bar;
String baz;
foo = " ";
bar = " ";
baz = " ";
// System.out.println(n); // Remove comment to print n on a separate line from the ducks and geese
if (n%3==0)
foo = " foo ";
//
if (n%5==0)
bar = " bar ";
//
if (n%7==0)
baz = " baz ";
//
System.out.println(foo + bar + baz + n);
n++;
}
}

}

The babbling imbecile is just making up words, he is.

Weird. I am sure I have an elegant solution but now I have an unreachable code error and a dead code warning. Even weirder the hints seem to have directed me away from this elegant solution: … that still has the problem, err… umm… oh duh, else if doesn’t belong where two conditionals might be satisfied and you really don’t feel like spelling it out in Java’s version of combinatorical L… err… umm… this stuff:

(n%3==0 && !(n%3==0 && n%5==0) && !(n%3==0 && n%7==0) && !(n%3==0 && n%5==0 && n%7==0))

Which basically says n is a multiple of 3, but not 3 and 5, and not 3 and 7, and most certainly not 3 and 5 and 7. Yeah… getting rid of the else if, really simplified the code.

Is he making puppets from paperclips and Post-its?

I turned my decrement to an increment and let it run. The last line of the output was N is equal to 486276 I is equal to 486325 foo. I think I need additional if for the cases of common multiples. It may not be the most elegant method. But you can count the combinations on your fingers, so does it matter? It works!

Scrolling further down the lab assignment I find that if I left ln of the print method… Of course that puts everything on one line with adding breaks about when it increments the … you ready? The Determinator!(as opposed to the backwards running Looperator) or n as he is known to his friends.

He thinks he's figured it out.

While I was hammering my pseudo-code into Java, I came across the decision to decouple the logic count from the loop count, Huh, I am done. I suppose the test file with its while loops was just supposed to hint at the solution. I was playing with the code and noticed that 15 doesn’t print for 3 and 5 at the same time. I spoke too soon.

What's this think he's guy doing?

WJ-2752-SE6: Lab 2, Expressions and Flow Control.

I started this lab by navigating to the project in NetBeans and copying out the test class. It was in a default package (which is discouraged by the Eclipse IDE and a few other reputable Chaps) but I put it in one appropriate to my study records. I need something to validate the PDF cert I get to print out on completion of the course. I misnamed the class for this iterator class DuckDuckerDuckest. I am still having it print the three letter variables I am going to assign later, but which are not in the lab assignment. This is a print on a multiple of 3 or 5 or 7 between one and fifty.

Levels

I know what you are thinking. Why is this jerk so proud that he didn't get past level one. My Paladin is level 65 and I am not very proud.

The truth be told when I say it to myself it doesn't seem like much for me to do level one but not two or three. Well, it is, sort of. In these labs I am doing each level gets progressively easier. Level three is an exercise in cut and paste. Level two specifies in detail what you need to do. Level one says little more than here's a UML diagram make this class and when its done it should work with these other classes to do this thing.

See it really is better to be number 1. Yay me.

Watch this. He thinks he's learned something.

WJ-2752-SE6: Exercise 2, Creating Customer Accounts.

Again I am working from scratch in Eclipse. Not to worry I have NetBeans handy, and more importantly I have the lab files so I don’t need to create the classes that the lab is dependent on the preexistence of.

Done! I ran into a couple of errors here and there. I kind of fixed them too quickly to write them down or figure out what they were. One of them was a silly one where I was outputting instead of returning values. The one that took me the longest amount of time and almost frustrated me seems to be the point of the lesson.
Recall in exercise one of this same lab the equal sign we used with end and stray that changed end to stray even though we only set stray after we had end set? Well I am sure there is a reason but in this one we declared some variables for a constructor that were supposed to be passed variables from the class and to make a long story and a bunch of semantic errors short we set the constructor values to the variables instead of the variables to the constructor values. How’s that for a tricky little caveat?

I still completed level one without peeking at level two or three. I think I spell peek peak in some previous posts. Huh.

I really thought he'd give up and blame the tools.

Huzzah! I may not know the why but I know the how. So I needed to instantiate the variable point1 as a constructor value new point. Then, I needed to assign values to the point1.x and point1.y values. Ah, ha. They mean it when they say Java is strongly typed. Now in finishing the exercise which requires I set one of the three points equal to the other, I see reciprocity in the assignments as the second point to the equality reassigned affects the assignment of the first. Here is the output:

Start point is [10,10]
End point is [20,30]
Stray point is [20,30]
End point is [20,30]
Stray point is [47,50]
End point is [47,50]
Start point is [10,10]

What happened was we set stray = end. We then reassigned stray and the new values went into end. Neat trick or frustrating caveat? Only time will tell.

We'll show him!

WJ-2752-SE6: Exercise 1. Investigating Reference Assignment.

I created a separate project for WJ-2752-SE6 in Eclipse. I am thinking about going back over WJ-2751 in Eclipse before progressing to 2753. The lab actually comes with readymade projects. But I am having a go at it separately.

Our first task in this lab appears to be to create a class with an x and y integer attributes and a method called toString(). We ran into a small snag doing it from scratch. The exercise already had some classes defined. I copied them into NotePad++ and then recreated them in Eclipse in the package I am using for this exercise.
Array constants can only be used in initializers! Thank the CS department at Cornell for getting to the top of Google on that search term. What I need to do is assign the values x and y in the declaration of the point. Of course I still seem to be missing something. Opening NetBeans shows me that clearly there is something important in the IDE files that I remain ignorant of. Apparently there is something specific to the instantiation of a variable in a constructor that I am not really certain as to the meaning of.

So joyously smug...

Wednesday, October 28, 2009

I just turned in my first assignment for CS520. I am debating on whether or not to take the quiz today. I am getting a good handle on the language. That is to say my code kicks few errors back and I troubleshoot them pretty readily. Not too shabby for a beginner.

I did the labs for WJ-2751-6E in NetBeans. I installed Eclipse on the recommendation of the lecture notes for CS520. I like Eclipse. It is familiar, relatively so. It’s similar to the new DB2 Workbenches that are replacing the control center. I played around with them and they started to make a lot of sense.

I am going to do the WJ-2752-6E labs in Eclipse now. I am actually pleased with myself for having done all of the 2751 labs at level 1. I was tempted but I didn’t peak at level 2 or 3. I was tempted to peak at my labs when I did my first assignments for CS520, but I didn’t. I took a break after missing something obvious and there it was plain as day. I had commented a hypothesis for why it wasn’t working, but it was just a simple non-quotation for the values assigned to the variable. My string values in my methods were right I just assigned my variable values that were interpreted as identifiers that hadn’t been declared.

But, I digress.

Tuesday, October 27, 2009

Another little poem, perhaps

package, import, import, bugsplat@
method, method, where's the curly at
variable declared input/output strongly typed
JVM or .NET is this more than vendor hype?
Do I worry? Is SOA much more than that?

Object Oriented (OO)

I like object oriented analysis and design, and presumably that means I like object oriented programming (OOP). OOP automates a lot of best practices in procedural programming. It forces modularity. Objects are practically modules already. It forces permissions management. Attributes and methods need to be declared private or protected, and occasionally public. You didn't really need to do think about setting permissions besides execute with modules hanging out in files, but you should have.

All in all OO is a good thing. Of course the thing I like most about it is that it really lends itself to a puppet show and using the word magic. The magic inventory item walks on stage and requests to know where it is and how many friends it has there, having been asked by a talking window that can only ask such things when it calls itself someone who is allowed to asks such questions. The magic window itself knows that it is actually just relaying the message from someone who not only is permitted to ask such questions but knows the secret key phrase that proves they are who they claim to be. The window doesn't actually know the secret word jumble but it brings along the magic lock's grandson and he, being a magic lock of sorts himself, knows all about secret keys, but especially about secret keys his buddy the window needs to know about. I am really thinking about starting a non-profit that promotes using cartoons and puppet shows as part of a comprehensive object oriented design methodology.

Things I Know or Learned About Java

Java is a fantastic language and only tiniest bit less so since Microsoft came out with the .NET family of languages. As I understand it Sun Microsystems developed this, the first truly portable programming language, for microwaves ovens, and toasters, and refrigerators and stuff.

They didn't call it Java back when it was used to program coffee pots. What they did do back then was develop a two-stage compile process that turned the high-level language (the sort of human readable programming language) into byte-code which could be compiled specifically for the machine. This saved a lot of money programming coffee pots as each coffee pot didn't need to have the high level language compiled for it. This in turn meant that those people whose coffee fueled lifestyle had them living by the second hand could setup there coffee pots before bed and wake up to freshly brewed coffee.

Ouch, My Combinatorical Engine Hurts!

1. I love learning new things.
2. I love depth-wise tree searches, even though they are not always optimal.
3. I loved taking Math in college.
4. It felt magical to be able to predict the next lesson.
5. I love that basic principles of combinatorics are the reasons for 2, 4, and by extension of 4, a part of the reason for 3.
6. I am not too fond of being reminded of that Socratic maxim to acknowledge how little you by the crushing breadth of the tiniest area of a specific discipline.
7. I love that those sort of crushing breadths might someday be tamed by a team of topologists, educators, and two-banana code monkeys.
8. Of course if that works out I going to need to extract me some monkey brains and get to work applying n-space concepts to data management.
9. Ouch, my combinatorical engine has requested more depth probing threads than I can provide without my vision blurring and my fingers refusing to type.

Why Coffee Cups?

Yesterday, my ACM 1-Year Anniversary Alan Turing coffee mug came in the mail. Yesterday, I also started programming in Java for CS520. Subsequently, I opened CoffeeCup HTML editor for this first time in a year. I had an Applet to write. Of course, I didn't need to write the HTML as Eclipse has an Applet viewer.

These coincidences and an article I read, on some career website that isn't paying for a plug, compelled me to start a new blog. I also wrote a poem. I don't know if it qualifies for honorable mention anywhere, but a poem I wrote about the joy inherent in understanding reality in terms of wave-particle hyper-finite matrices did. I don't know what to call it so I am naming it after this article.


Why Coffee Cups?

There are cups o' coffee three
Count them all 0,1,and 2
Monday brought big mail for me
At ACM a whole year is through
Renew though it cost me a bit
Started Java in Fall two
HyperText cup counts to edit
Self-cert courses got them too