Skip to content

Category: english

Glassfish on Linux

First, check if you have Java installed:

$ java -version
java version “1.6.0_10-rc”
Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b28)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode, sharing)

Now download the last version of Glassfish application server, I’m using Glassfish V2 for Linux. It’s a jar package. Execute it.

$ java -Xmx256m -jar glassfish-installer-v2ur2-b04-linux.jar

You be asked about the license agreement (CDDL+GPL).

Files will be decompressed in a directory named glassfish.

$ cd glassfish

Now we need to continue the installation. You can have Ant installed in your system or, like I’m doing, use a version that comes the Glassfish package.

$ chmod +x -R lib/ant/bin
$ lib/ant/bin/ant -f setup.xml

Tip: if you have more servers and want to create a cluster for load balancing, see this documentation. After ajust the setup-cluster.xml file you just need to run ant on it.

Let’s execute the server:

$ bin/asadmin start-domain

The default instance port is 8080. Try it on http://localhost:8080.

The default administrator port is 4848. Try it on http://localhost:4848.

The default user is admin and password is adminadmin. Log in.

Tip: you be asked for register your version. This register is not mandatory and not doing it will not limit the features of your Glassfish. It’s just a way they use to track the number of users. Aditionaly can have acess to newsletters, tutorials, screencasts, services and support. If you already have a SDN (Sun Developer Network) or Sun Online account you can use it for registration. If you simply doesn’t want to, you can skip this step.

For security reassons, click in the Application Server icon on the left sidebar and so in the Adminstrator Password tab. Chose a new password and click Save.

Let’s deploy a application. Download the file http://glassfish.dev.java.net/downloads/quickstart/hello.war.

Go to ApplicationsWeb Applications on the sidebar.

No application will be there. Click on the Deploy button.

In the next screen, on Location select the .war that you downloaded. Click Ok.

Your application is now deployed.

Try the application on http://localhost:8080/hello.

There other ways  less easy but more flexible) to deploy your application, you can take a look on this and others topics on Glassfish Quick Start Guide.

Try to explore the Glassfish admin interface. It’s very easy and intuitive.

JavaFX, comic balloon

A example of how flexible can be extending your own Custom Node. In this example I’m creating a comic ballon that can be simple created by:

Ballon {
   text: "I can has fx?"
}

That can also be incremented to work like this:

[youtube:http://br.youtube.com/watch?v=LexJbO1-ti4]

Here a simpler implementation of a balloon, without the dragging behavior but that can be used for creating comics.

import javafx.scene.CustomNode;
import javafx.scene.Group;
import javafx.scene.geometry.Ellipse;
import javafx.scene.geometry.Polygon;
import javafx.scene.geometry.ShapeSubtract;
import javafx.scene.paint.Color;
import javafx.scene.Font;
import javafx.scene.text.Text;
import javafx.scene.FontStyle;
import java.lang.Math;
 
public class Balloon extends CustomNode {  
 
    /* (cx,cy) center of the balloon */
    public attribute cx: Number = 100 on replace {
        distance = Math.sqrt(toX * toX + toY * toY);
    }
    public attribute cy: Number = 100 on replace {
        distance = Math.sqrt(toX * toX + toY * toY);
    }
 
    /* (toX, toY) point where balloon points at */
    public attribute toX: Number = cx on replace {
        distance = Math.sqrt(toX * toX + toY * toY);
    }
    public attribute toY: Number = cy on replace {
        distance = Math.sqrt(toX * toX + toY * toY);
    }
 
    /* what is writted in the balloon */
    public attribute text: String = "balloon";
 
    /* font for the text */
    public attribute font: Font = Font {
        size: 24
        style: FontStyle.PLAIN
    }
 
    /* Distance between (cx,cy) and (toX, toY) */
    private attribute distance: Number;
 
    /* Text inside the balloon */
    private attribute label = Text {
        font: bind font
        content: bind text
    }
 
    /* place the label correctly based on text */
    init {
        label.x = -label .getWidth() / 2;
        label.y = label.font.size / 2;
    }
 
    /* ballon body */
    private attribute body = ShapeSubtract{
        fill: Color.WHITE
        stroke: Color.BLACK
        blocksMouse: true
        a:  bind [
            Ellipse {
                radiusX: bind label.getWidth() / 2 + 20
                radiusY: bind font.size * 2
            },
            Polygon {
                points : [
                    10 * ( - toY / distance),
                    10 * (toX / distance),
                    10 * (toY / distance),
                    10 * ( - toX / distance),
                    toX,
                    toY
                ]
            }
        ]
    }
 
    public function create(): Node {
        return Group {
            cursor: Cursor.HAND
            content: [ body, label]
            translateX: bind cx
            translateY: bind cy
        }
    }
}

My Free Tileset, version 1

Although everything I do is under the license Creative Commons Attribution Share-Alike, I’m starting to group my pixelarts works  and release them in single files under the GPL.

Here the first and small release:

In summary: you can use them freely for open source or proprietary, games or prototypes, professionals or beginners developers, for study or for lucrative purposes, whatever you want. You don’t need even ask me for that, just use it (but I appreciate a reference). You can even modify them as long you also maintain the same freedom for the derivative work. For complete details, read the GPL or ask your questions in the commentaries.

If you are looking for a free, big and great tileset, look the wonderfull work of The Mana Word project (both code and art under GPL).

Soon I’ll group others pixel art drawings of others games I made in a single tileset file.

If you have a similar work in a compatible license we can make release of them togheter and create a big free tileset.

Quake 3 Arena on CAVE

Make sure watch until the gun part.

[youtube:http://www.youtube.com/watch?v=Gnq-8iaOcXk]

Information from the video:

A renderer for Quake 3 Arena maps in immersive environments, based on the Aftershock rendering engine and the CaveQuake wrapper. Shown here in the UC Davis KeckCAVES facility . The video was shot with a tripod-mounted video camera from outside the CAVE.