Google’s new development language was released, and I am shaking my head with the rest of the world. How does this enhance Google’s brand? Google has long since been known for/as a search destination, and their huge company considered devoted to search and only search.
From here:
What is the purpose of the project? More »
I don’t know why, but the Enum class’ usefulness has always eluded me. Early attempts just didn’t work out, and I just found ways around using it. Recently, I am writing a program that needs to have a certain status be toggled between a known, fixed list of values-with a default value if nothing else matches. This real world project accelerated my learning how to use Enum effectively-much more so that the urgency to simply learn more about the language (i.e. no practical application of said knowledge).
I also wanted this magical class to determine for itself which value from the aforementioned list the thing that had the Enum in the first place should be. In other words, I wanted the method to do the determination to be inside the Enum class itself. I didn’t know if this was possible, but as I went over all the other ways to accomplish this, any other solution was too costly and inelegant.
To give you an idea of what I am trying to accomplish, consider this Test.java:
public class Test {
public static void main(String[] args) {
EventType etX = EventType.Default;
EventType etY = EventType.Default; String sEvent = "this is just a test!";
System.out.println("etX.getEventType: " + etX.getEventType(sEvent));
etY = etX.getEventType(sEvent);
System.out.println("print etX: " + etX);
System.out.println("print etY: " + etY);
System.out.println("All EventType(s):");
EventType allEventTypes[] = EventType.values();
for (EventType x: allEventTypes){
System.out.println(x);
}
}
}
[AS2, Flash CS4 Professional]
This might sound silly, but it is extremely useful. I just did a job for a client that needed to rotate their banners on a site that they had done for them 4 years ago. The site was hard coded to:
MovieA_______________________________________________
loadMovie(”flash/MovieB.swf”, intro_mc);
intro_mc is a simple, 1 frame movie in MovieA’s library that holds a Rectangle shape the size of the banner area. You use this rectangle to precisely position the asset in Movie A. intro_mc is placed as soon as it is needed, sometimes before the frame here that loads it.
MovieB_______________________________________________
This movie has the job of loading banners and displaying them. This is a great approach for lots of reasons, but for us the most important is that we don’t have to hard-code our banner rotation worker, MovieB, into MovieA or any other caller.
MovieB loads it’s movies from an XML file called banners.xml, which looks like this:

A fast one for everyone.
If you have occasion to use POSIX based systems like Linux, UNIX, and yes, even Macintosh, then you will end up using cron eventually to schedule things to be done on your behalf. Cron is the tool built into these operating systems, and can seem intimidating to a new user/admin. Here are two quick tips to making cron immediately useful.
1. Generate a cron template.
2. Generate a local copy of your cron jobs.
Create a file in your home directory called cronjobs. Copy and paste the below template, and use it when needed to make a cronjobs file for another user: More »
guys,
Thanks for the suggestions. I ended up using xstream, but it was very difficult to figure out how to do it right. One of the problems was/is that I’m using xml from a web service. Most of the stuff out there requires simple xml without any preamble.
(from MDB fed by stateless ws bean)
TextMessage tm = (TextMessage)msg;
String sMsg = tm.getText();
XStream xstream = new XStream(); // used xpp3, as it is supposed to ignore xml declarations…
xstream.alias(”Command”, com.entities.Command.class); // HAD to give explicit location
com.entities.Command c = (com.entities.Command)xstream.fromXML(sMsg);
System.out.println(”Name: ” + c.name);
System.out.println(”Command: ” + c.command);
Command.class:
public class Command {
public String name, command;
}
This took a LOT of time to get right, and virtually nothing I saw in many, many searches helped. I hope someone else with this problem finds this post faster than it took me to get this working…
So what was I doing? Passing an object from a VB.NET client to a J2EE web service (and subsequent beans).
Thanks again!
Bogus Exception

Categories
Tag Cloud
Blog RSS
Comments RSS

Void « Default
Life
Earth
Wind
Water
Fire
Light 