kami's hideout Gavrilov V. Miroslav

23May/100

A thing about motivation…

Filed under: other No Comments
14May/100

The Hell: Parts II and III

As the hell came to be simpler than I thought it'd be, here is the rest of the poem, including the first strophe again.

"Love seeketh not itself to please,
Nor for itself hath any care,
But for another gives its ease,
And builds a heaven in hell's despair."

So sung a little Clod of Clay,
Trodden with the cattle's feet,
But a Pebble of the brook
Warbled out these metres meet:

"Love seeketh only Self to please,
To bind another to its delight,
Joys in another's loss of ease,
And builds a hell in heaven's despite."

- The Clod and the Pebble, William Blake

Tagged as: No Comments
14May/100

Hell: Part I

'Love seeketh not itself to please,
Nor for itself hath any care,
But for another gives its ease,
And builds a heaven in hell's despair.'

- a part of "The Clod and The Pebble" by William Blake

The hell I'm going to talk about is OAuth2.0 authentication with Facebook. Once I wrote this, it seemed like a stupid, simple, straightforward thing, but believe me - you haven't spent the last three days learning the Facebook documentation by heart.

As you may or may not have learned, Facebook is changing their SDK to embrace the new Open Graph API. The simpler the API, the complicated the configuration, or so it seems.

10May/100

The Four Fs: Facebook, Fun, Fanaticism and Flash

Recently, I've got a new main-quest-type-of-job, developing a java game prototype into a full-fledged Facebook application. The goal is to make it #1 or at least show nice output with the public. I, also recently, deleted (not only deactivated) myself from this network, making it hard to work on, but I'll skip the details on that.

The chase: making a Facebook game that the public will like is an entrepreneur-only job. If you mean to win with it, you have to know what the people out there will play and how to keep that going. As much as the gamer-inside is objecting, the people out there are as anti-intuitive as any Corel program I've ever seen. In the next few hours, you are to experience the longest run on a topic I've done on this blog up to date. I hope you don't die from boredom.

11Apr/103

VBA Excel range copying macro

This macro is made for copying ranges from a table of this form:

Name | Duration | Beginning Date | Ending Date | Playing hours | Additional info ...

The selection is made using the "playing hours" field, so make sure to have it on the fifth position. The syntax of this field is defined as follows:

PLAYING_HOURS := INTERVAL ";" INTERVAL
INTERVAL := HOUR [ "-" HOUR ]
HOUR := {01...24}

The code supposedly helps humanity. :) Cheers!

Filed under: other Continue reading
17Jan/100

HashSet allowing duplicates?

What I'm running into is a problem with sets. An explanation would be appreciated, although I've easily counter-measured and skipped the error. So, here's what I have (in the class Attribute, but that's just for ease of reading later on).

12Jan/100

Secure Threads in Java

Working on a secret project (to be revealed soon), I was in need of a nice thread interface, as the Thread class in Java is in a very deprecated and unsecure condition. We are to construct a SecureThread class which will be a substitute for this. Let's give an outline.

8Jan/100

Dream of the Endless…

This is what I sometimes dream at nights and what tickles my days...

Screenshot from Prehistorik 2 - almost made me cry laughing; used to play it a lot when I was small, I still remember where to bang to get the big meat! :)

Mario.

This always scared me. Black Thorne.. Still one of the epics...

And speaking of epics..

Dune. The last epic thing made, except for the books. I'm so happy to play them again. Be sure to try...

Tagged as: No Comments
7Jan/100

Chrome on 64bit Windows 7

If you're having problems running this piece of beauty on Windows 7 on a 64bit machine, add a "-in-process-plugins" parameter behind it et voila! The day is once again saved! I've missed Chrome a lot...

7Jan/100

Checkboxes in listboxes in Java(boxes)

I vote the swing implementation of the ListBox as the most complicated model out there. It is pretty general and useful, it's just that minor modifications turn into some very excessive work and the net is full of useful-as-an-example-but-not-an-implementation tutorials of how to ruin good object-oriented code. The main problem with this is having programmers who think in other paradigms write object-oriented code. Then you end up with a class that embeds the main() method and does all the modifications to the JList, and actually is a JFrame. I've turned the code from codeguru.com - that exhibits this trait - into a class, the CheckListBox and it works out of the box, and extends JList, so that you could do things with it that you could do with an ordinary list. Here's a couple of screenshots; it has a scrollpane in itself, as demonstrated in the second one.
The download begins here.

To setup the CheckListBox, let's make a Test class:

public class Test extends JFrame {
	public static void main(String[] args) {
		new Test();
	}

	public Test() {
	}
}

Let's first import the component (if you've downloaded the .jar file, you also have to include it in your class path).

import kami.begaj.net.checklist.CheckListBox;

Next up, let's initialize the JFrame...

	public Test() {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			System.out.println("Unable to find System Look and Feel");
		}

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(350, 200);
		setVisible(true);
	}

Now, let's create the data list for our check list - the example on codeguru.com used fruits, so let's follow...

		String[] listData = { "Apple", "Orange", "Cherry", "Blue Berry",
				"Banana", "Red Plum", "Watermelon" };

Lastly, before setting up the frame, let's create the CheckListBox with the data given in this array:

		CheckListBox check = new CheckListBox(listData);

The most important part of the whole thing is to remember to add it to the form using the .setup() method, instead of the containers .add() method.

		// unless you're doing something extravagant...
		check.setup(this.getContentPane());

Why do we do this like this? For the implementation to be versatile enough, a ScrollPane has been added to it, so that the user could skip this part and just use the list. Using the .add() method actually adds the JList-extended CheckBoxList to the frame, not the ScrollPane. The .setup() method takes care of this. Also, if anyone extends the CheckBoxList, he would just redefine this .setup() method to meet his implementational needs.
The full grown code for our test example is now:

import javax.swing.JFrame;
import javax.swing.UIManager;

import kami.begaj.net.checklist.CheckListBox;

public class Test extends JFrame {
	public static void main(String[] args) {
		new Test();
	}

	public Test() {
		String[] listData = { "Apple", "Orange", "Cherry", "Blue Berry",
				"Banana", "Red Plum", "Watermelon" };

		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception e) {
			System.out.println("Unable to find System Look and Feel");
		}

		CheckListBox check = new CheckListBox(listData);
		check.setup(this.getContentPane());		

		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(350, 200);
		setVisible(true);
	}
}

The results are on the pictures above. Sun should really think about remodeling the UI packages for more comfort. As asked, here's the code of the CheckBoxList class packed in one .java file instead of a .jar.. The code is below, but for what it's worth, we could also skip showing it on the blog homepage, as it's quite longer than the previous cuts.. :)