As nothing’s as straight forward as PHP, I had to write my own class to sort ArrayCollections. My work was inspired by what Peter Dehaan did.
The method is to be used as follows:
ArrayUtils.sort(games, "playerScore", "DESC", true);
to sort an ArrayCollection of games by player score, with a de ...
In Flex (as in Java, or even PHP) you can dynamically get references to a class from its name. Just to remind you, it’s that easy in PHP:
$className = 'User';
$myUser = new $className;
Not a lot more complicated in Java:
Class className = Class.forName("User");
Object myUser = className.newIns ...
As I was writing some Java code for my finale dissertation, I wanted to give my objects an unique ID in order to distinguish them easily. I thus wrote the following abstract class that does the job well for me:
package motd.utils;
/**
* Makes a class identifiable with an unique ID for its ob ...
Recently I had to develop a chat room system very quickly. I absolutely wanted to use my favorite language: PHP. So I had to figure out how do sockets work in PHP, and how to give PHP a daemon behavior (read: Give PHP a daemon behavior).
I found many resources on the Internet, more or less exact, m ...
Well, I fully admit PHP is not the best language to write daemons, because of all the performance issues we all know, and infinite loops are not the most beautiful thing you can see in a procedural script. However, it may happen that for a reason X or Y, you want to use PHP to write daemons (it has ...
It may be necessary to sort a dataset after a SQL request. And in a general case, I prefer using this function instead of dealing with the ORDER BY and LIMIT clauses.
So I wrote this method (which is part of my Utils class, in my own framework):
(more…)
...
I discovered libcurl a long time ago, but never really worked with… until yesterday! It was during a Solaris course, my classmate showed me some stuff he did with libcurl, and I was amazed of the capabilities! On the evening I jumped onto my macbook and wrote a class to manage cURL requests.
M ...