jwenting 1,905 duckman Team Colleague

you were given 2 ways to do that, which one is appropriate for your scenario and the implementation details are up to you to figure out.

jwenting 1,905 duckman Team Colleague

hmm, there's rather frequently a need to add request headers.
Of course you will usually need to send things like username and password as an MD5 or SHA hash rather than in plaintext in that header.

Think of things like OAuth2 tokens as well.

More common though is to have those things sent as HTTP headers:
http://www.mkyong.com/webservices/jax-ws/application-authentication-with-jax-ws/

jwenting 1,905 duckman Team Colleague

Stating "X is twice as expensive as Y" makes sense. So does, technically, "Y is half as cheap as X" (though I seriously dislike the phrase).
But "Y is two times cheaper than X" is just as flawed as stating that "X is two times more expensive than Y".
Saying "X is two times more expensive than Y" is possible, but means something else, it means that X is 3 times as expensive as Y (another thing many people get wrong).

jwenting 1,905 duckman Team Colleague

The Win32 API still exists, the operating system translating for you to Win64 equivalent calls.
If it didn't, 32 bit applications would not work on a 64 bit version of Windows.
In theory Win16 APIs would be similarly translated or emulated.

BUT there are major differences in the hardware environment on which those operating systems were designed to work.
As a result those calls might not be possible to be translated, as they refer to things that no longer exist as such.
E.g. there's no more memory segments, so any calls relating explicitly to handling those are now meaningless.
Any application that relies on such calls to have meaning becomes itself meaningless.

And the further back you go, the worse it gets.
Current videocards for example have completely different programming models from those of 20 years ago. Thus any old softwre that writes into physical hardware space on the video hardware can't work, even emulated.
Ditto with CPUs and RAM.

jwenting 1,905 duckman Team Colleague

the main problem defining whether a piece of software is correct is the lack of a closed definition of what that piece of software is supposed to do.
More often than not (even with mission critical systems where even a cornercase failing could lead to a loss of life or massive financial or material loss) the specifications documents are not closed. They don't define what the system is to do in any well defined way, especially fault conditions and border cases (e.g. things like what do in case of a lack of input data is often not described, even if there is an expected way for the system to react to such a condition, which is then only discovered during field testing, with the software engineers being blamed rather than the people missing that when writing and accepting the specifications).

Most teams of professionals can deliver a reasonably solid piece of software, or at least know how to deliver such.
But if they get faulty specifications and/or don't get the resources required to create that product, they can't be expected (yet are expected) to do so.
E.g. a team gets told that they shouldn't write unit tests "because that takes time away from writing the actual software" (and yes, that's still an extremely common mantra coming out of managers).
Or they're not supplied with the equipment and time to do proper testing (can't count the number of times I've experienced the situation where we had to …

jwenting 1,905 duckman Team Colleague

yes, and if your area is very large, maintain a larger box around the player, check all objects if their centers are in that box, then if they are check if there's a collision.

jwenting 1,905 duckman Team Colleague

well, Windows XP went the way of the dodo years ago, and has now officially become a fossil.

But then, you're running 30+ year old software on it so you shouldn't complain about running unsupported operating systems, nor should you expect support from us for using that 30+ year old software.

Windows 8 works well enough, only fools and dinosaurs who refuse to put in a few minutes to figure out the user interface scream about it the way you do.
Of course that 30 year old software isn't going to run on it the way it did on the 30 year old operating system it was designed for.
What'd you expect?
Given the changes in hardware architecture alone it's not going to run well, even if you got a 30 year old operating system to install on a current computer (tip: don't bother to try, it will almost certainly fail).

jwenting 1,905 duckman Team Colleague

best way to hold a referendum. Make sure nobody goes and votes, then claim you can ignore the outcome because no representative percentage of the electorate showed an interest.
You've still shown "you're engaging the voters by allowing them to voice their opinion" and can now use that as munitions in the next election cycle.

That's where EU governments went sorely wrong when deciding on the "EU constitution".
They'd thought the voters would stay home and they'd then just put it into effect and when the complaints started point to the invalidated referenda about it.
Instead the voters were highly interested and overwhelmingly rejected it. Now they had to jump through hoops to find excuses to ignore the voters and pass the thing into law anyway, leading several countries to come up with "the people didn't understand properly what they were voting against so the outcome should be ingnored" (I kid thee not).

jwenting 1,905 duckman Team Colleague

yes, that one's bugged me for a long time.
On a similar level as laundry detergent commercials claiming their product "washes whiter than white".
Or commercials claiming that "our product is better". Better than what?

p.s. Of course "this book is of mine" could also be a corruption of "this book is property of the mine" ;)

jwenting 1,905 duckman Team Colleague

There exist already tablets that can have keyboards attached to them, they aren't replacing laptops because they're still cumbersome to use.
The main drawback of tablets as is is the small screen size, lack of connectors for external appliances (keyboard, mouse, screen, printer, harddisks, DVD drives, card readers, security devices, you name it). And if you add all that, it's too large to be useful as a tablet :)

jwenting 1,905 duckman Team Colleague

mind that the == comparison in this specific case can't be relied upon to return false.
The runtime (and even the compiler in this simplified scenario) might determine to optimise things in such a way that both point to the same String as stored on the String constant pool in permgen space.

Which teaches an important lesson: never rely on == in case of Strings :)

jwenting 1,905 duckman Team Colleague

Each rectangle is a tile, or can be thought of as living inside a tile if it's rotated.

What you need is to determine the bounding boxes around your objects, and then determine whether those bounding boxes overlap.
If your objects are simple rectangles that aren't rotated, the rectangle itself is its bounding box (though you might want to add a few pixels if you want to detect a collision before it actually happens).

So you have for example 2 boxes of 10x10 pixels, existing at <12, 23> and <21, 19>.
It's now a simple matter of geometry to determine whether those two boxes overlap (these two do).

jwenting 1,905 duckman Team Colleague

"if id of table"? What "id of table"?
You make no sense.
The table has no id. If you select out of it and pass a record identifier you should only get 1 row so there's no need to sort anything.

Or are you maybe refering to an id of another table with which the one you intent to sort a selection from has a foreign key relationship?

jwenting 1,905 duckman Team Colleague

start with the data. That's the important bit after all.
So you have entities "STUDENT", "COURSEMODULE", "CLASSSESSION", "SCHEDULE".
In addition you need to have some way to record attendance, so an "ATTENDANCE" table.
And something for scheduling staff members.
So a "STAFF" and "STAFFSCHEDULE" table.

CLASS SESSION, and MODULE are best avoided as they're reserved words in many languages.

Based on those, there's no doubt need for proper normalisation of the data to 2nd or 3rd normal form, which will introduce several more tables.
You're also going to need foreign key relations between the tables.

So start with your data model, properly design it to have all the data in it that you need in a correctly normalised form, and only THEN start thinking about how to write an application that uses that data.
You're talking about a database course after all, else why would you have posted your question here...

jwenting 1,905 duckman Team Colleague

@James shows how long ago it is I last used RMI, during my preparations for the 1.5 SCJD assignment around that same time which still required generating stubs using rmic (the requirements hadn't been updated from 1.4 yet).

Never used RMI before or since, except implicitly in EJB2 calls and there it's blissfully hidden by the application server.

jwenting 1,905 duckman Team Colleague

I know. But the comparison holds. If he didn't have health insurance for himself, his own doctor's bills would be of similar magnitude.

jwenting 1,905 duckman Team Colleague

hmm, even C++ may be too high level for that. C and ASM are where it's at.

jwenting 1,905 duckman Team Colleague

they have meaning, but the meaning is indeed mainly for marketing purposes. When they introduced 10g, "grid computing" was "hot". Now it's "cloud computing" so it's 12c.
And i? Probably stands for "improved" or something like that, adding letters like that to your version numbers was popular (and still is. Think what Apple does...).

If you mean 11gR1 and 112gR2, that's just Oracle's equivalent of "11.0" and "11.5".

jwenting 1,905 duckman Team Colleague

In any real world (rather than acedemic) environment, people tend to do whatever needs doing and not insist on "that's not part of my job description as per paragraph 325423.542435423 section a2".

Now, not every CS grad will be a programmer, just as not every programmer will be a CS grad. But a lot of them do end up as programmers.

jwenting 1,905 duckman Team Colleague

banks still try to run their own cables like that? Thought they'd stopped doing that over a decade ago and now use microwave or satellite links. Much cheaper to set up :)

jwenting 1,905 duckman Team Colleague

The only ways would be to either make a class containing the index and value, as James suggests, to create a separate array containing the indices of the values in sorted order, or to create a new array of the values in sorted order.

The very concept is weird btw, if you're going to sort it you're no longer interested in the original order so the original index should be of no consequence.

jwenting 1,905 duckman Team Colleague

Your personal doctor and meds would cost the same without them having bulk contracts with your insurance company, Stuugie.
That's part of the thing many people tend to forget.

Your health insurance negotiates prices with clinics and pharmacies for thousands of patients together. And more often than not have a "take it or leave it" attitude. If the doctor doesn't agree to their $10 per consult offer they'll just tell their customers to go to another doctor next door who did agree to that offer.

jwenting 1,905 duckman Team Colleague

could work. This is the way I've been doing it since enums were introduced, based on experimenting with some (at the time) colleagues.
May well be there are more efficient ways to do it, remember at the time it was all brand new and just figuring out this worked was helping us a lot getting things done.

jwenting 1,905 duckman Team Colleague
switch (x.toUpperCase) {
case "YES":
   ...
   break;
case "NO":
   ...
   break;
...
}

much clearer overall than a jungle of nested if statements.
Just about the only thing added to the Java language I like since generics.

jwenting 1,905 duckman Team Colleague

That's mainly for people who spent too much time on the floor in the casinos and can't afford the price of the ticket home...

jwenting 1,905 duckman Team Colleague

yes, that's a high price. Depending of course on what's included.
And where you are. If it's a small remote community with few pets and a single vet it's bound to be more expensive than in a large city with a lot of pets and a lot of competition.

jwenting 1,905 duckman Team Colleague

Similarly, you can add more fields to an enum and simply provide accessor methods to retrieve them.

For example you could change it to have an extra field indicating an output directory to write specific types of data to, and a getter method to return that directory.

jwenting 1,905 duckman Team Colleague

And for formating the output of the enum (rather than just returning a String containing the exact value like MARS in this code).
Mind this might under some conditions cause side effects, if there's something that relies on Foo.F being "F" exactly.

public enum Foo {
    F("f1"),
    G("f2"),
    H("f3");

    private final String f;
    private static Map<String, Foo> foos;

    private Foo(final String f) {
        this.f = f;
        Foo.foo(f, this);
    }

    private static void foo(String f, Foo foo) {
        if (foos == null) {
            foos = new HashMap<String, Foo>();
        }
        foos.put(f, foo);
    }

    public String toString() {
        return f;
    }

    public static Foo getFoo(final String f) {
        return foos.get(f);
    }
}

Also allows you to get a Foo from the user input using Foo.getFoo(input) using the new values rather than the internal name of the entries.

jwenting 1,905 duckman Team Colleague

snippets is fine, but entire solutions to common homework problems is not.

For example the following is helpful to a lot of people in real situations, but useless to a schoolkid trying to get away with not doing his homework:

String requestUri = request.getRequestURI();
StringBuffer requestURL = request.getRequestURL();
requestURL.delete(requestURL.length()-requestUri.length(), requestURL.length()+1);
requestURL.append(request.getContextPath());
jwenting 1,905 duckman Team Colleague

Cutting your dogs' ears is illegal (and rightly so, it's animal abuse) in many places. Would you like to have your ears cut off, AD?
If not, why do you tell people to do it to their pets' ears?

And with a pair of unsterilised cissors even, recipe for serious infections.

jwenting 1,905 duckman Team Colleague

and what's stopping you from finding that code? It's not as if there's not a gazillion examples of just that out on the web, in tutorials, books, your course notes, etc. etc. etc.

jwenting 1,905 duckman Team Colleague

define a variable called lastFoo of type Date...
Logical, once you think of it.

jwenting 1,905 duckman Team Colleague

Chrishea, emissions are only part of the equation.
Other pollution (and those "emissions" in that chart count only CO2, not ALL emissions, you can count on it that those are on a similar scale difference) like water and soil contamination, need also to be taken into account.
And those are extremely high for the mining and processing of the materials needed for the batteries in hybrid cars.

The article with that chart is good, but doesn't tell the entire story and is IMO too "polite" towards the green lobby's posterchild, even as it mildly attacks the claims of it being "green".

jwenting 1,905 duckman Team Colleague

you actually understood the question?

jwenting 1,905 duckman Team Colleague

and don't forget that calling the method that increases or returns the counter introduces a call to the class :)

jwenting 1,905 duckman Team Colleague

Batteries have different environmental problems (toxic waste rather than CO2 & air pollution) and most can now be recycled mitigating their environmental impacts.

wrong. Most batteries are dumped, with the cars.
And your claim that they last the life of the car which is 10 years is not holding water.
Many hybrids need to have their batteries replaced after 5-6 years, and most cars (certainly outside the US) go for 15-20 years before being scrapped, not 10.
If a hyrid indeed needs to be scrapped after only a decade, half the expected lifespan of its non-hybrid cousins, that's another major environmental impact factor that's not taken into account.

And oh, hybrids spew out as much NOx and SO2 as other cars that burn the same amount of fuel as well as the same amount of CO2 (which isn't even a problem, despite all the misinformation spread by the green maffia about it).

jwenting 1,905 duckman Team Colleague

And why isn't it?

compared to other cars in the same price range it's no more fuel efficient, yet has a higher environmental impact to manufacture and later dispose of.

Compared to other cars in the same size/weight range it's somewhat more fuel efficient yet still has that higher environmental impact to manufacture and later dispose of.

The "green" mantra about them is based exclusively on their lower CO2 emissions compared to other cards in the same size/weight range (so comparing a Honda Civic sedan with a Honda Civic Hybrid Sedan for example, or a Toyota Prius with a BMW 325i), when most sales of these cars replace sales of smaller cars in the same price range (a price range the hybrids are in only because of 30-50% subsidies on their purchase price) or lease price category (which they're in for much the same reason, and for the tax credits on the income tax of people driving them as company cars).
Without those subsidies, the vast majority of people who now drive hybrids would be driving cheaper, smaller, more fuel efficient cars.
In the US that effect might be less as hybrids are among the smaller cars on the road there as is, but worlwide that's a major factor in the purchase decision people make when selecting a hybrid, the tax credits more than compensating for the higher fuel and maintenance bills as compared to other cars in the 30k Euro ($40-50k) range.

jwenting 1,905 duckman Team Colleague

cout << "you're morbidly obese!" << endl

There you go.

jwenting 1,905 duckman Team Colleague

not compiler version, file format version.
Java 6 has compiler version 1.6.x, file format version 50.
Java 7 has compiler version 1.7.x, file format version 51.
Java 8 has compiler version 1.8.x, file format version 52 (I think, don't have that one installed to check).

A Java 6 compiled class with an inner class gives the following:

 C:\projects\sandbox\build\classes>javap -classpath . -verbose sandbox.NewClass
 Compiled from "NewClass.java"
 public class sandbox.NewClass extends java.lang.Object
   SourceFile: "NewClass.java"
   InnerClass:
    public #5= #4 of #2; //Inner=class sandbox/NewClass$Inner of class sandbox/Ne
 wClass
   minor version: 0
   major version: 50
   Constant pool:
 const #1 = Method       #3.#16; //  java/lang/Object."<init>":()V
 const #2 = class        #17;    //  sandbox/NewClass
 const #3 = class        #18;    //  java/lang/Object
 const #4 = class        #19;    //  sandbox/NewClass$Inner
 const #5 = Asciz        Inner;
 const #6 = Asciz        InnerClasses;
 const #7 = Asciz        <init>;
 const #8 = Asciz        ()V;
 const #9 = Asciz        Code;
 const #10 = Asciz       LineNumberTable;
 const #11 = Asciz       LocalVariableTable;
 const #12 = Asciz       this;
 const #13 = Asciz       Lsandbox/NewClass;;
 const #14 = Asciz       SourceFile;
 const #15 = Asciz       NewClass.java;
 const #16 = NameAndType #7:#8;//  "<init>":()V
 const #17 = Asciz       sandbox/NewClass;
 const #18 = Asciz       java/lang/Object;
 const #19 = Asciz       sandbox/NewClass$Inner;

 {
 public sandbox.NewClass();
   Code:
    Stack=1, Locals=1, Args_size=1
    0:   aload_0
    1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
    4:   return
   LineNumberTable:
    line 13: 0
    line 15: 4

   LocalVariableTable:
    Start  Length  Slot  Name   Signature
    0      5      0    this       Lsandbox/NewClass;


 }

The "class" and "method" entries seem to be imported classes and the methods …

jwenting 1,905 duckman Team Colleague

and oh, youtube videos are notoriously bad as a teaching tool.
While they can help, in combination with written material, to make concepts clearer, they're not to be used as your sole source of information, especially (because the average quality is very poor) if you don't have prior knowledge and can judge whether what you're seeing appears to be valid or not.

jwenting 1,905 duckman Team Colleague

Used to drive a Honda Insight, which has pretty similar performance to a Prius.
Nice car, but not really fuel efficient compared to cars in the similar price range like a VW Golf Diesel or Ford Focus Diesel.
Of course without the subsidies on hybrids it would be a lot more efficient than cars in the same price range, like a BMW 5 series or Ford Crown Vic.

I get the same fuel efficiency now driving a smaller non-hybrid car that's cheaper overall (initial price about 2/3 lower, lower taxes, lower maintenance bill, lower insurance cost) and large enough for me.

Would I get a hybrid again? Who knows. But I'm under no illusion it's "good for the environment" compared to other cars in the same price range as it's not.
I'll buy one if when I'm shopping for a new car I can get one that is economically priced, has similar or better fuel efficiency and maintenance cost as compared to other cars on my shortlist.

jwenting 1,905 duckman Team Colleague

well, it is a valid email address, just not an existing one.

That validator probably knew about a lot more address forms than just the (now) normal name@domain.tld form.
E.g. Lotus Notes, Novell Netware, and many other network systems all had/have their own addressing systems and while now seeming archaic in the past a generic address validator had to take all of them into account.

jwenting 1,905 duckman Team Colleague

To check whether you're allowed to camp free and where in and around national parks, check the national park service website at http://www.nps.gov/index.htm .

Yosemite is well worth visiting, unless things have changed for the worse a lot in the last 25 years or so (been that long since I've been to California).
Death Valley, just drive through it on the way from San Francisco to Las Vegas. Remember to pack tons of water, you will have to turn OFF your air conditioning for part of the trip to prevent your engine from overheating.
From people I've met who've been there, Zion NP is well worth visiting.
Grand Canyon of course. We took a 2 day tour by aircraft from Las Vegas, with one night in a hotel on the rim. Probably the best way to see the area unless you plan to hike the canyon itself (and even if, seeing it from the air is spectacular, well worth doing).
Moab is probably a bit out of the way, but spectacular as well.

jwenting 1,905 duckman Team Colleague

Current Tv shows actually have around 40 to 43 minutes, but the credits, the opening, the next episode ad are included as well. So basically, there is only 38 to 39 minutes of the actual show.

And of that 10 minutes at least is commercial breaks, so the actual feature show only lasts about 25 minutes.

jwenting 1,905 duckman Team Colleague

Which is worse in movies/shows from the 80s: the teased hair or the synthesizer music.

what's bad about either?

jwenting 1,905 duckman Team Colleague

It's for all the kids demanding we do their thinking for them and create their "final year project idea".
For myself I know what I want when I get home from the office, and that's a nice evening with a good book or talking to old friends :)

jwenting 1,905 duckman Team Colleague

you can access jars on remote systems IF you can add the location of the jars to the application classpath.
Now to find a JVM that allows for classloading using UNC paths (Windows drive shares with an assigned letter would work fine, they're seen as local drives to software running on the system).

jwenting 1,905 duckman Team Colleague

they'd better not try, or they'll have a fight on their hands.
I'm not giving the place up that easily :)

jwenting 1,905 duckman Team Colleague

Done that in the past, but last time was 10 years ago.
Hotels+rental car is far more flexible than campervan, as you're far more mobile (especially in towns and cities where the large size of the campervan makes for problematic driving, and there tend to be fewer if any reasonably safe places to stay with one overnight (your average big city trailerpark is NOT a nice place)).

I wouldn't get a Prius (or other hybrid). In the hot desert conditions their performance is terrible, the heat plays havoc on the batteries.
Better go for something like a Ford Focus. Still excellent mileage but more reliable.

Hotels, think Best Western, Holiday Inn, etc., and select hotels in smaller towns and cities near big ones. Often quite a bit cheaper that way.
They also typically come with free breakfast.

So between the lower fuel cost, lower parking fees (typically you'd pay more for a large campervan than for a compact or subcompact car), and the free breakfasts, you might well end up being cheaper than using a campervan for the trip.
And it's sure more comfortable :)

jwenting 1,905 duckman Team Colleague

yes, seems like the print statement is placed outside the method, which is illegal and generates a compiler error.