Monthly Archives: June 2009

Now that’s odd… Java really IS different


My friend Harrison sent me a  Java file that was giving him trouble. He wanted to read in an Integer from in a command-line program. He found the method readInt() in the class Console. But it wouldn’t compile:

for ( i = 0; i < 5; i++)
System.out.println(“Array[“+ i +”] = “+ array[i]);
String name = null;
int age = 0;
age = Console.readInt(“Enter Age:”);
}
}

PersonTest.java:74: cannot find symbol
symbol  : method readInt(java.lang.String)
location: class java.io.Console
age = console.readInt(“Int Enter Age:”);
^
1 errors

I did a little searching and found suggestions that he was going in the right direction:

   char letter = Console.readChar("Enter a letter: ");
   double d = Console.readDouble("Enter a real number: ");
   int i = Console.readInt("Enter an integer: ");
   String name = Console.readLine("Enter your full name: ");

http://faculty.cs.wwu.edu/martin/Software%20Packages/BreezyGUI/breezyguijavadoc/breezygui/console.html

hahaha! Turns out breezygui.console isn’t the same as console… the base language doesn’t actually have the readInt method, or readChar or readDouble. But apparently C# and or J++ and/or some dialect/library for C++ DO have a Console class with a readInt, readChar and readDouble members…

SO… you have to be VERY careful what the on-line document you’re counting on really says. It might have the method you want but only in a library you don’t have, or in another language completely. Ooof! is this fun or what???

Of course I showed Harrison how to get integer, double and char values he wanted. That’s what friends are for.

So be careful what you read and believe. Including this!

Advertisements

The best and worst plastic kits IMHO.


Which are the best and worst plastic model kits?

So many qualify, but the criteria I might use are worth discussing, even if nobody ought to care what my personal picks are.

But since you’ve asked, I’m presently listing some nominees at both ends of the spectrum:

Best Kits: Minicraft 1/144 MD-80. Other than the main gear leg covers, which need a bit of thinking to position correctly, everything just fits together, restrained surface detailing is appropriate. No mass-market kit of this subject was available, though a very reasonable Welsh Model’s vacuum-formed fuselage with injected wings, horizontal stabilizers and engines had been out for years.

Tamiya 1/24 sports & sporty cars: The Ford Mustang GT is a curbside -no engine, hood doesn’t open, but everything else is so nice, it all fits, looks great. Their Porsche 959 supercar is another winner, and comes with engine and a lot of the 4 wheel drive bits that put the horsepower down. Like the Mustang, the interior is thoroughly detailed, tires and wheels look great, brake discs and calipers are supplied, plenty of surface detail to reward a curious eye, or some gentle drybrushing. Building the model, you get a sense of how the real thing goes together.

Worst kits: Fujimi’s Vought F-8 Crusader just doesn’t look like a Crusader. Never mind what you can see through the engine air intake, there’s nothing accurate about the shapes, the rivets, ick. As far as I got with the one I tried it glued together ok, but it has no legitimate purpose. Its just ugly. More recently, Trumpeter’s 1/144 “Spitfire Mk V” is a very poorly imagined copy of the not-that-great Crown kit. The parts don’t really fit, things Crown got right – main landing gear legs, doors, wheels, engine coolant radiator, cockpit canopy, are hilariously wrong in the Trumpeter copy. The part breakdown makes for nasty seams and glue joints. Even the wing shape, the most famous in the 1930-1950 interval, is messed-up. Its pointless and sad. The same effort could have created a reasonable kit

What IS a plastic model  kit? A set of parts, injection molded, on runners or “trees”, vacuum formed on a sheet of plastic, cast in resin and attached to  “pour blocks”,  laid-up with resin  and fiberglass cloth backing, perhaps including some cast metal, photo-etched sheet copper,  brass or stainless steel, possibly vinyl or rubber, metal or plastic tubing, rod and sheet, lead or other soft metal foil, soft wire, music wire. Most kits contain waterslide decals, though dry transfers or preformed stencils are also seen.

A good kit can be assembled without having to be re-designed, re-engineered or re-built, by the builder.

So the shapes have to be correct, within the limits of the materials and techniques.

All the parts have to be supplied- what can be seen looking at the model from outside, but including what can be seen inside windows, doors, vents, hatches, etc.

The pieces supplied have to assemble correctly, without having to be modified or re-thought-out

It should suggest an accurate representation of a specific object- real, imaginary, even speculative, but always specific.

It should be consistant with itself- textures, features, thicknesses, transparent parts, blank holes or paint/decal for windows, etc., should all be similar across the whole of the model.

More as I get time to add it.

Completed Java 1, wrote a tidy bit of code:


If I’d turned in one last homework it would have been an “A”. Mia Culpa.  I nailed all the homework I did turn in- 12.5/12.5 for 1-6, but only got #7 ready to compile by the deadline.

Here’s I neat piece of code I wrote and used in a couple of places- give it a string containing a number and it will give you back the number- the base language doesn’t keep this in any obvious place, but perhaps I should check the utility library before claiming to have set them right. :^)
/* Here’s an object that packages the messy job of converting Strings that represent numbers into a double.  Int/float/double/long don’t appear to even offer a polymorphic solution. That I’ve found anyway.
Instantiate with a string,
get back a double

anything else I might want

Ok wise guy, how do you get the base classes text value??
Ah ha! String is final- no extending it! This class can HAVE one but can’t BE one
*/

public class NumericString{  // can’t “extends String” its final

String input;
Double value;
// Constructor

public void NumericString( String inputValue ) {

input = inputValue;

// later we can filter out all but the signed numeric nugget we care about…

if (-1 == input.indexOf(‘.’)) {   //only numerals, no decimal, its an integer.
value = (double) Integer.parseInt( input )
;
} else {   // there must have been a decimal, its a float/double
value = ((Double.valueOf(input).doubleValue()));
} // if -1 … else…
}

public Double num() {
return value;
}

} // class NumericString

Dr. G. R. Tiller, M.D. Murdered.


In memoriam, Dr. George Richard Tiller, M.D., August 8, 1941- May 31, 2009.

Rest in Peace, Dr. Tiller. If the name isn’t ringing a bell, he was a doctor, in Kansas, who would perform late term abortions. Constantly threatened, shot over a decade ago, he was assassinated as he ushered at his church, on Sunday. A victim of violence which can fairly be called terrorist. Not the first doctor assassinated by anti-abortion activists. FoxNews’s Bill BO’Rielly repeatedly rabble-roused against him in recent years. Why DOES O’Rielly hate our freedom?

If you don’t like abortions, don’t have one.

Want to stop other people from having abortions? Make accurate and complete sex education a priority, and make sure a wide variety of contraception alternatives are readily available. This is proven to work.

Love babies? Help some teenage mother take care of hers. Help her finish high school Help her get the training and experience for a real job that pays more than minimum wage. Do the same for the father. Nothing is better for a child than an educated, self-reliant parent. Two educated and self-reliant parents are even better.

Want to teach only abstenence, allow no abortions and restrict informations and access to contraception?  Sorry, you’re delusional. The data’s in. Whole, *European*, countries, Ireland and Romania, for example, tried it. It doesn’t work. Saudi Arabia has and carries out the death penalty for sex outside of marriage. That doesn’t stop it.