0

Why Window’s ad campaign may fail miserably in Canada

Posted by samson on May 31, 2010 in Life's little pleasures

Everyone most likely have noticed that Microsoft ‘I am a PC!’ advertisement all over the net.

I don’t see the point of this aside from fighting back, Apple went out of their way to make their computers standout, they went all the way from saying how easy it is to use their product to stating that their machine is not a computer. Maybe they are right, an Apple is not a ‘personal computer’, an Apple is a fruit, an eye candy, a whatever it is that you want to call it, but it is most definitely not a personal computer!

That is why I have been ignoring those ads, I think of my Macbook as a Personal Computer, it is a computer for me and my creativity. I don’t have to ‘share’ it with other people, it is not a public computer, it is my personal computer. Hence I don’t believe the message is right to begin with.

Well, after ignoring both sides for as long as I can, one of my friends, who is a liberal supporter, started adding that ‘I am a PC’ tag line to his email signature. This kind of pushed me overboard a bit, and I started saying….

I AM A200px-Parti_PC_Party_Canada_1996.svg.png!!

Tags:

 
0

Using Pulpcore properly in your own project!

Posted by samson on May 28, 2010 in PulpCore

Proper coding practises dictates that we classify our code according to the nature and function of the class, making it as descriptive as possible. However, using Pulpcore Module for Netbeans, we cannot do that.

By default, we are prompted for a new project name, which is used only as the directory name, while the rest of the generated files are simply copied over and dump into the directory. When starting a new Pulpcore full project, we will be presented with the following listing for files.

After you have converted the pulpcore libaries to the latest release, you are still stuck with a group of files that would compiled to display ‘Hello World’, with a program title called ‘Hello World’ and a class called ‘Hello World’!

My method of changing this with little to no headaches is using Netbean’s refractor.

The following window will then pop up, change the class name to whatever you want.

Remember to check ‘Apply Renmae on comments’ as that will make your JavaDoc making more sense should you refer to the class that you are changing name for.

Now, if you attempt a build, it will actually compile. However, if you launch it, the player will state that it can’t find the class ‘HelloWorld.jar’. So to fix that we have a few more steps to take.

Next, navigate to and change the two ‘HelloWorld’ to ‘MovingText’ or whatever you name your former ‘HelloWorld’ class.

Then, let’s navigate to and change all the ‘HelloWorld’ to ‘MovingText’ or whatever you name your former ‘HelloWorld’ class.

Lastly, navigate to your Netbean’s project folder and find a file called ‘build.properties’, open it notepad or other simple text editor. Replace all ‘HelloWorld’ with the new name of the class file.

Now, you can go back to NetBeans and have the system ‘Clean and build’ again. All files in the ‘build’ folder will now be regenerated and linked properly to launch ‘MovingText’ instead of ‘HelloWorld’

 
0

Pulpcore and JavaDoc

Posted by samson on May 27, 2010 in PulpCore

One of the major personal love for Java is its JavaDoc description, it is extremely handy when you are coding something and is on a quest for the proper method to resolve your problems, especially when you are not extremely familiar with the library that you are using. However, upto the latest post I wrote on Pulpcore, we are still getting a screen that looks like this when we attempt to read the documentations within Netbeans.

Annoying isn’t it? We know there’s JavaDoc with Pulpcore, in fact, we can easily access it online! Don’t believe me? Click here for the Pulpcore 0.11.5 JavaDoc API!

So, how do we go about doing this? According to the original authors of the NetBeans Module, you need to add some jar files and a brunch of doc files to get this up and running, I’ve found a more simple and reasonable approach.

Code Assist JavaDocs from what I recall back from Java 1.4 is actually source code related. If you have your source code there, the engine will first attempt to look for the method or variables and display the JavaDoc style comments you have included with that method or variable.

Luckily, Pulpcore is released with Source, we can easily take advantage of this.

  1. Navigate to your Pulpcore 0.11.5 folder and look for a zip file called ‘src.zip’ extract it to a sub folder called src.
  2. At this point, if your Pulpcore 0.11.5 files are in C:\pulp, then you should have a sub folder called C:\pulp\src\.
  3. Within C:\pulp\src, is a folder called src, and within this folder is a folder called pulpcore.

    You should have a file structure like C:\pulp\src\src\pulpcore\, if you don’t just look for the plupcore folder, the name of the parent folder of pulpcore is the one that you need to remember. For my example, it is C:\pulp\src\src.
  4. Go back to Netbeans and navigate to the project properties.
  5. Navigate to Java source Classpath
  6. click on
  7. Type in C:\pulp\src\src and click on open.
  8. Click OK to save the Project Properties.
  9. Test the Code assistant again.

You are done :)

Now, you are not only getting the live documentations from the Java code of Pulpcore 0.11.5, when you are running into problems during debugging, you can easily access the source code of the Pulpcore to find out whether you are using a method properly or not.

 
0

Pulpcore continued…

Posted by samson on May 26, 2010 in PulpCore

After publishing my previous post on Pulpcore, I realized that I have forgotten one of the major part I intended for that post, how to update your NetBeans Pulpcore libaries to the latest release. At the time of writing, Pulpcore is on Version 0.11.5.

How do I know which version of Pulpcore Libaries I am using?

That is actually really difficult to answer, as I don’t recall seeing any ‘Pulpcore version’ indication in the compiled code, the only way you can tell is from the console within the Pulpcore player itself. However, as we are all Java Adicts, we have a better way of finding that out from the code, we look for deplicated methods in the Library!

In class Pulpcore.sprite, there is a method called ‘setAnchor(int anchor)’

It was originally designed to allow users to set the anchor point on a sprite allowing for a easier point of reference. In the original pulpcore libraries, the method setAnchor would take in an interger presenting one of nine points, which looks like this:

        NW     N     NE
          +----+----+
          |         |
        W +    *    + E
          |         |
          +----+----+
        SW     S     SE

With a predefined list of integers in the Sprite class in the form of Sprite.NORTH, Sprite.NORTH_EAST, etc…

However, this method is now deplicated in Pulpcore 0.11.5, the new setAnchor accepts two double, AnchorX and AnchorY.

setAnchor(double anchorX, double anchorY)

        (0.0,0.0)  (0.5,0.0)  (1.0,0.0)
            +----------+----------+
            |                     |
            |                     |
            |                     |
            |      (0.5,0.5)      |
  (0.0,0.5) +          *          + (1.0,0.5)
            |                     |
            |                     |
            |                     |
            |                     |
            +----------+----------+
        (0.0,1.0)  (0.5,1.0)  (1.0,1.0)

With this as our weapon, we can easily find out whether we are using the newer Pulpcore Libaries or not.

NetBeans upgrade proceedures

So, continuing from yesterday’s post, now you have your first ‘Hello World’ program in pulpcore, let’s convert it to Pulpcore 0.11.5!

  1. Expand the file browser tree under projects like so…
  2. Double click on HelloWorld.java
  3. Navigate till you find something that looks like this

    If this code compiled fine as it is, then you are not using 0.11.5 or later.
  4. To ensure we are indeed not using 0.11.5, change the code from (Sprite.CENTER) to (0.5, 0.5), Netbean’s compiler errors should immediately light up like a christmas tree like how we have here.
  5. Open your favorite file explorer and navigate to your NetBeans files. (eg: c:\NetBeansProjects\Hello World\pulpcore_dependencies\)
  6. Open your favorite file explorer and navigate to where you have extracted the Pulpcore 0.11.5 files, if you don’t have it, obtain it here!
  7. Navgate, in your Pulpcore folder, to the build folder. (eg: C:\pulpcore-0.11.5\build\)
  8. Select all of those JAR files and copy them over to your NetBeans Project folder’s pupcore_dependencies folder, replacing everything.
  9. Go back to NetBeans and click on the ‘Clean and build’ button , you should see compile error gone, replaced by 18 warnings saying that the setAnchor method is deplicated.
  10. At this point, your Pulpcore library is 0.11.5, to remove the warnings, simply go over all the setAnchor methods and replace them with the newer style instead of the older setAnchor method style.

 
0

Using Pulpcore with NetBeans

Posted by samson on May 25, 2010 in PulpCore

After talking about Pulpcore in a previous post and another post on Netbeans IDE, let’s talk about using them together to create our first ‘Hello World’ Pulpcore game.

Please have Pulpcore Libraries Extracted to a location on your local hard drive and Netbeans IDE properly installed before you begin the following.

Navigate to the Netbeans Module for Pulpcore page using this link. Follow the installation instructions by the author of the netbeans Module.

I have duplicated the instructions here for easy access, it is simply 9 Steps.

  1. Download the Netbeans Module (nbm) file.
  2. Open Netbeans
  3. Navigate to “Tools” -> “Plugins”
  4. Click on the “Downloaded” tab.
  5. Click “Add Plugins”.
  6. Find your downloaded nbm file.
  7. Click “Open”.
  8. Click “Install”.
  9. Follow on-screen instructions.

Now you are ready to create the Hello World program. Follow these steps:

  1. Create a New Project
  2. Expand ‘Samples’
  3. Select ‘Java’
  4. Select ‘PulpCore Full Template’
  5. Click Next
  6. Type in ‘Hello World’ where it saids ‘Full’
  7. Copy down the Project Location, this is usually your ‘NetBeansProjects’ folder within your ‘My Documents’ folder.
  8. Click on ‘Finish’
  9. Press ‘Shift+F11′ to ‘Clean and build’

This will actually build your Pulpcore program already and if you click on Netbean’s build-in ‘Run Project’ buttons, it will launch the program. However, I don’t suggest this method for testing your code as the player doesn’t exit properly in Netbeans yet. It would be more ideal to launch the program directly with a browser. So, navigate to the Project Location you copied from Step 7 above and find the NetBeansProject folder. The folder structure should be like this:

‘NetBeansProject’ -> ‘Hello World’ -> ‘build’ -> ‘applet’

Find index.html and launch it using your browser.

If all goes right, you should see something like this.

Copyright © 2010 Pleasant Lifestyle All rights reserved. Theme by Laptop Geek.