Animation Suite – JavaDoc

Working on generating JavaDoc for my Animation Suite assignment. I’m still following the standards set in place for XHTML Strict 1.0 haha.

It helps so, so much that I comment my code continuously as I write my code, change it and when I feel it’s finished. This is the first time I’ve done JavaDoc. For future notice, I’ll be making the majority of my comments conform to JavaDoc standards now so it won’t be the effort of converting/moving comments like I am now.

Advertisements

Customising osCommerce

To customize osCommerce, I first changed some of the settings on ‘My Store’ to reflect what they would actually be like should it be a real store (i.e. changing the location to United Kingdom as opposed to United States).

I also added a new Category in Software called RPG, and then added a product in this called Final Fantasy Tactics. After that, I added another product in an existing category (Strategy), StarCraft.

I made up the prices of these two items but the images and information about the games I got from their respective Wikipedia websites and is not of my own work but of community contribution on a public website, used just as practice for this assignment.

After the games, I added a retro joystick, again with images and information from Wikipedia.

 

Finally I added the usage of GBP Sterling currency, uploaded a custom header and edited some of the CSS for the page a tiny bit.

Installing osCommerce

As the next part of my assignment I was asked to install osCommerce on my web server. This was done smoothly and fairly easily. I’m looking forward to seeing what I can do with this!

Though, the default page layout that has been provided appears to be very ugly in the way it is set out. I am not sure if this is just how the page is/how it is uncustomized or if the appearance did not install correctly. I did see a classmates osCommerce page after install and theirs also seemed to look this way too and so I’m not worried at the moment in time.

 

EDIT: After finding that there were no true customization options in the Admin panel, I realized that it really shouldn’t look so bad. After looking at the Aber Comp Sci Q and A Facebook page, I found many others with the same issue and that a fix for this had been posted.

It turned out that some .htaccess files in the sub-directories were stopping the page layout and images from loading correctly. In order to fix this, I used a command that a user had provided:

“find -name “.htaccess” -exec sed –in-place ‘/Indexes/d’ {} ; -exec sed –in-place ‘/Follow/d’ {} ;”

 

Now everything is correct!

Destroy to Create anew…

I’m working on an assignment for CS124 (Software Development) where we have to create a 2D Animation Suite in Java. The basic outline is fairly simple and was pretty easy to figure out and build up. So, I went on to add additional features.

Most of these have been added quite quickly or not needed much thought. Notably, extra tools, a bunch of functionality in the menu for the Suite and some crafty stuff with flicking through the frames. I have a few more plans of what I want to add before I can call this ‘finished’ just yet though.

One of the main things I wanted to get to doing was creating a larger colour palette.

I started with 3 colours, then moved up to 7. I was originally just showing the user some colours on JButtons that corresponded to chars in the Model that would be set in a 2D char array to serve as a ‘grid’. As effective as this was, the code looked like it needed a lot of refactoring and I wanted to expand my colour palette much further. I played around with JColorChooser. It’s a great feature! However, I didn’t want that much functionality and so my quest began to find my own way..!

 

Firstly, I created my own class (MyColor) that inherited Java’s Color class and added a constructor to it that took r, g, b, char and then I added a method to return said char. After this I made another class (ColorHolder) to hold 36 of these colours (r 0-255, r 0-255 + b 0-255, etc) and handle any operations of iterating through the collection of them and getting whatever colour the user wished to use/the application required.

 

In the previous design I had each JButton for the char colours set separately (i.e. redButton = new JButton(“red”), yellowButton = new JButton(“yellow”), etc), with each assigned with ActionListener(this). This made the code feel very clunky and I knew it could be cut down a lot.

To save code, in the new system each colour is an instance of a single JButton, colorButton, and with each created they are stored in an ArrayList<JButton> and then added to the JPanel. A normal ActionListener assignment doesn’t work for this (it only gets set for the last element) and so I had to hunt down how best to get this method to work.

To overcome the problem, I wrote my own Inner class called ColorListener, inheriting from MouseAdapter. In this I wrote a constructor to take the ‘index’ location of the JButtons/colours as they were added. When the user clicks on a JButton, the ColorListener gets the source (left/right button for correct assignment) and gets the colour that is stored in the ArrayList at the index of the JButton in the list from ColorListener.

From there it was simply a case of calling the ‘getChar()‘ method I made in the MyColor class to use with the assignment specifications of using chars in a 2D array for the grid of colours and passing it to my Model.

 

The re-writing on my code took some time in order to get everything to settle back to how it was but converting the old system to the new was not too difficult. The tricky part was dealing with black/white.

When a user calls to use ‘White’, what the program actually needs to do is use ‘Black’ with a drawRectangle method as opposed to fillRectangle like every other colour. Due to the way I have created MyColor, White is actually ‘White’ (0, 0, 0). When the Model read the char for White, it was then creating a completely blank grid (in truth, the grid was there, just White lines for the drawing!). This lead to a number of S.o.P.s to find out if there really was a color there before I realized what I needed to do.

Solution: setColor(Color.black). Rather than using my own MyColor for this one method, the simplest solution was to go back to using Color and pretend black is the new white! It felt a bit like cheating, but it works and is functional and so, that is that!

 

I have a number of other extra bits I want to add yet and I’m pretty sure I’ll be breaking another thing or two before I get done. The upside to this? It’s fun!

Customising WordPress

To customize my blog, I first went ahead and added a few plugins and then installed a theme, all of with I found on WordPress’ extend section.

The first plugin I installed was ‘Link Manager’, which allowed me to re-activate WordPress’ blogroll system. This lets me add links to other websites. In this case I have linked to my classmates blogs.

Next I added a plugin for my Twitter feed, which can be seen below. The plugin is called ‘Twitter Widget’. I set up a new Twitter feed for this, to keep my personal and professional social networks separate. I normally have my personal Twitter feed set to private, and so it would not update this widget either way.

My final plugin is ‘Contact Form Plugin’. Quite simply, this lets me create a contact form to have users e-mail me wherever I create it. After installing it, it required me to include a small bit of code into a text box that I added as a side widget to get the form to appear.

The theme you see me using here is ‘Amdhas’ by Hendro Prayitno. I had to edit some of the code using WordPress’ editor section in Appearance in order to get the page to display for the way I wanted it to, and this gave me the most trouble in getting correct. The theme has a number of very useful Options to pick from and I am happy with the result!

 

That’s everything I have done to customize this website so far. The header image and ghast face are of my own making, based on my running theme of ‘GhasT . Tooth’ which can also be seen on a website I created for another assignment. You can find that by clicking here, or on the ghast face image to the right.

 

– James

Installing WordPress

Hello!

This is my first post using the WordPress files installed on my central filestore. (Although if you are reading this, you probably already knew that!)

I didn’t encounter any real problems installing these files. I had to run the permission commands (using Putty for Windows) twice before the page allowing me to create the blog was displayed. Once that was done, it was smooth sailing and took no time at all.

I’m sure I’ll be posting here a little more often here on out!

-James