Site Sponsors:
Virtual Box Broken 
For everyone who follows this blog (you both know who your are =-P) we just discovered that Oracle's Virtual Box (was 4.1.10 this morning - is now 4.1.12 as I write this - we can all surely relate to that type of effort!) is broken. It seems that the shipping version is no longer able to import a virtual appliance.

I noticed the problem today under Ubuntu 64 - 10.04 LTS. Have not tried elsewhere yet.

For those who share the woe, just:

sudo apt-get remove virtualbox*


-Then reinstall your last working version. (For me, that version was 4.1.8 r75467, aka "virtualbox-4.1_4.1.8-75467~Ubuntu~lucid_amd64.deb".)

---Sharing is caring,

-Rn

(p.s. From what I can tell, there is a problem in the decompression, as well as the CRC settling, library routines. Upon terse review, it looks like the OVA importation installation seems to hiccup when switching between artifact types. (Check those deltas - we probably just need to 'memset something back to zero, guys?))

.02 ends


[ view entry ] ( 1736 views )   |  permalink  |  related link
UML Primer Updated 
Just a quick note to let everyone know that I just updated the UML Primer on YouTube. I wanted to increase the volume so as to re-use the video in a class we are teaching next week for the U.S. Army.

[ view entry ] ( 2246 views )   |  permalink  |  related link
Faster Field Support using Enumeration & Arrays 
The humble 'enum' has come a long way. --Indeed, when I first taught the 'enumeration concept' (i.e why use numbers, when you can use names) a few decades ago, I was using C/C++.

Today both .Net and Java have their humble 'enum' equivalent:

enum codes {
one, two, three
}

--Easy enough to understand.

Object Members


What is interesting to note however is that, unlike C/C++, any 'enum' in either Java or .Net is not merely about mnemonic substitution. Rather, the enum keyword in both technologies creates a fully-qualified Object:


public String get(codes which) {
return vals.get(which.ordinal());
}

public String set(codes which, String sWho) {
return vals.set(which.ordinal(), sWho);
}


Like any Object, any instance of 'enum' in .Net and Java has member functions. Amongst other things, by default the members of an 'enum' allow us to translate between a set of zero-based integers, as well as any enumerated token.

Enumerated Rarefactions


Since by default the enum uses a zero-based ordinal (read i-n-t-e-g-e-r ;), the use of any enumerated set of tokens readily transfers over to a zero-based array usage. The piratical :) application of this default numbering series is that any set of arbitrary enumerators can be used to quickly create a class, with just as many value-storage opportunities:

class ClientSettings {
ArrayList<String> vals = new ArrayList<String>();

public enum codes {
// We could also use enums like name, address, phone (etc)
one, two, three
}

public ClientSettings() {
codes[] set = codes.values();
for (codes code : set) {
vals.add(code.name());
}
}

public String get(codes which) {
return vals.get(which.ordinal());
}

public String set(codes which, String sWho) {
return vals.set(which.ordinal(), sWho);
}

public static void main(String[] args) {
ClientSettings ref = new ClientSettings();
if (ref.get(codes.two).equals(codes.two.name()) == false) {
System.out.println("Error - Conceptual failure #1.");
}
String sTest = "Enumerated arrays are so easy, they are scary.";
ref.set(codes.two, sTest);
if (ref.get(codes.two).equals(sTest) == false) {
System.out.println("Error - Conceptual failure #2.");
}
}

In short, no mater if we have 2 or 200 values. -Whenever we want to quickly create a class to support the storing of one or all of them, all we have to do is to update a single 'enum'. --The rest is as good (or evil ;) as is the enumerated set of tokens we choose to represent our data_stored therein.

Enjoy,

-Rn

(p.s: The above is a Java demonstration. The proof of concept is in main().)

[ view entry ] ( 2843 views )   |  permalink

<<First <Back | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | Next> Last>>