~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
> public Payroll(String Name, String Id)
> public void setempId(String Id)

Follow Java naming conventions; `Name' should have been `name'. `setempId' should be `setEmpId'.

> private double empPR;            // holds the Employee Pay Rate
> private double empHR;            // holds the Employee Hours Worked
> private double grossPay;         // holds the Employee Gross Pay

Though not a big concern here, you should know that calculations using `double' and `float' are not exact. Always use the BigDecimal class when doing monetary calculations.

darkagn commented: Didn't know that about BigDecimal, cheers :) +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A lot of complicated terminology being thrown around here but a few points:

> A static member of a class is a shared location in memory between objects of that class.

Don't mix concepts and implementation details when explaining. From the JLS:

If a field is declared static, there exists exactly one incarnation of the field, no matter how many instances (possibly zero) of the class may eventually be created. A static field, sometimes called a class variable, is incarnated when the class is initialized

> static values are resolved at compile time, before objects are created.

A compile time constant expression when assigned to a static field[or not] is evaluated at compile time; a static field is incarnated when the class is initialized. There is no *static value*.

> Notice that in main of a different class file, I didn't need to create an object of MyClass in
> order to access sharedInt - the address of the reference-variable sharedInt is resolved at
> Compile Time and all MyClass objects have access to it.

`sharedInt' is a variable of Primitive Type and not Reference Type.

> If q is not a static member, then although each C class object has q, they have their own
> individual address for their reference variable and therefore

Each instance created has its own set of the state/member variables. There is no *individual address for their reference variables*.

> to access q …

Alex Edwards commented: Thanks for pointing that out @_@ +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Add this to the page that URL1 points to:

window.location = url2; //the url you want to redirect to.

The `location' property of `window' object is itself an object but you are assigning a string to it. Though it *works*, it's incorrect. You need to set the href property of the location object.

window.location.href = 'http://www.google.com/';

> I want to redirect a certain URL to another URL.

A better solution here would be to employ URL Rewriting; look into the mod_rewrite module of Apache Web server. Your solution fails if Javascript is disabled.

@scru
Concerning your rep comment given to `stultuske', consider the possibility of this thread originally being posted in some other forum and then being moved here.

scru commented: Didn't know. Usually they have moved: on them. Apologies. +4
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> And it worked. Although the file saved in my file system has extension .gif ??

The file name doesn't matter; its content does. I could have very well named it 'image.exe' and it still wouldn't have mattered. Maybe you overlooked the declaration File saveFile = new File("SemiTransparentSquare.gif"); in which the file name is pretty much a constant.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Is there a better way? There are actually many more than three subclasses that need the
> special handling, so that's a long if-else if-else statement.

Just create an interface Collidable which exposes a contract of the form Outcome collide(Collidable c) . Make classes implement this interface and implement the logic accordingly, which, based on the source and target colliding objects would determine the outcome of the collision. No need for any run-time type checks, the run-time method invocation based on the actual object in consideration will be automatically taken care of.

> You could use a State Machine, or State Pattern based on how many times an object has been
> encountered, or the State of an object can depend on the type of object it encounters...

KISS ;-)

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I *love* IE for two reasons:
• It brings out the real human within the developers.
• It makes me realize life is not always a bed of roses.

:-)

Aia commented: Glutton for punishment. ;) +9
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

IMO, the thread being on the first page has got nothing to do with its solved status; it depends on time the threads were `touched'. And BTW, the thread still isn't marked as solved by any moderator because there were no follow ups from the Original Poster[OP].

Members can contribute to the forum when solved threads are concerned. If you feel that a thread has been solved, you can report the same by using the `Flag Bad Post' link so it can be marked as solved by the moderator in case the OP is unaware of the `Mark As Solved' feature or forgets about it.

Danarchy commented: Gave me some new knowledge and pointed out my error. +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Osama Bin Laden

Dave Sinkula commented: Dead or Alive? +17
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The term 'best' would be relative in the context you mention. There is no single 'do-it-all' library out there. For e.g. Ogre is a pretty good game engine but the most complicated all of them out there. Irrlicht is pretty much easier to pick up but doesn't provide the fine grained control that Ogre does.

The only option is to patiently click through all those links, go through the details, get a feel of the community and user base and decide for yourself which library is worth working with.

Ezzaral commented: Reality is so complicated. +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Learning the craft; though a nice article on learning the crafts of programming, it draws on some of the finer points like needing a mentor and reading good books. Even though the article is about software development, the concept more or less applies to almost all professions out there.

Reading the article brings back memories of the time when I first started programming (not too long back) without a formal computer science teaching and with bills to pay. It sure was tough without having someone with a similar interest set in my vicinity or someone to turn to in case of queries. Having a mentor helps you understand things really fast; things which would have taken us hours to understand and grasp completely. It's not that I am against reinvention of the wheel, it's just that nothing beats having expert, professional and sound advice when you need.

I am sure there are many out there who irrespective of their profession can pretty much relate to the philosophy of the article.

Nick Evan commented: Good article! +9
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
Ezzaral commented: Good link. I've recommended that one several times for Java game programming questions. +11
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

i don't understand how byte stream could read images. does it need help of applets or else.

Since you seem to be thoroughly confused here, I will just post a minimalistic non-working snippet and allow you to fill the gaps. Anything more and I might be forced to give up my Moderator title for breaking the rules. :-)

try {
      URL url = new URL(SAMPLE_URL);
      // 'in' and 'out' declaration goes here
      try {
        byte buf[] = new byte[4 * 1024];  // 4kb buffer
        int read = -1;
        in = url.openStream();
        // create a new File 'f' which the output stream will write to.
        // Create it at a location of your choice with name as that of the image
        out = new FileOutputStream(f);
        while((read = in.read(buf)) != -1) {
          out.write(buf, 0, read);
        }
        out.flush();
      } finally {
        if(in != null)  in.close();
        if(out != null) out.close();
      }
    } catch(IOException ioe) {
      ioe.printStackTrace();
    }
Alex Edwards commented: =P +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though this approach leads to compact code, it's not really necessary since it performs a lot of voodoo like image encoding under the hood. Plus, you can be rest assured that the ImageIO approach will always be slower than pulling raw bytes over the wire and directly writing them to disk.

If performance is not a concern, the ImageIO approach seems good enough.

sciwizeh commented: true engough +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Maybe this might get you working in the right direction:

<!--
    Calculate the difference between the two dates.
    Copyright (C) 2008  sos aka Sanjay

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Script-Content-Type" content="text/javascript">
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>Date examples</title>
  <script type="text/javascript">
  // Error checking kept to a minimum for brevity
  
  function setDifference(frm) {
    var dtElem1 = frm.elements['dtTxt1'];
    var dtElem2 = frm.elements['dtTxt2'];
    var resultElem = frm.elements['resultTxt'];
    
    // Return if no such element exists
    if(!dtElem1 || !dtElem2 || !resultElem) {
      return;
    }
    
    //assuming that the delimiter for dt time picker is a '/'.
    var x = dtElem1.value;
    var y = dtElem2.value;
    var arr1 = x.split('/');
    var arr2 = y.split('/');
    
    // If any problem with input exists, return with an error msg
    if(!arr1 || !arr2 || arr1.length != 3 || arr2.length != 3) {
      resultElem.value = "Invalid Input";
      return;
    }

    var dt1 = new Date(); …
Kusno commented: Thanks a lot !!! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Ok Avenged Sevenfold is good and I love the drum solos, but if you really want a good heavy band, you should look at UnderOath or All That Remains. Two extremely good bands. And if you're into amazing drumming like me listen to the song "My Fears Have Become Fobias" by As Blood Runs Black. It's Insane!

A few songs with good drumming IMO

• System Of A Down - Snowblind
• Slayer - Seasons in the Abbys
• Iced Earth - The Setian Massacre
• Avenged Sevenfold - Blinded In Chains
• Avenged Sevenfold - We Come Out at Night
• Megadeth - Fight For Freedom (FFF)
• Haste The Day - If I could see
murderotica commented: These are awsome bands. :) +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

What I have done before is just pull a timestamp and innitially add it to session and database record. The the next page request I pull the timestamp record from the database, compare it with the session, if the two match, pull the most current timestamp, replace the session timestamp and the database timestamp with the most current and allow access. If they don't compare I force a login for that user.

Though it means that for *every* request you end up making an extra database read and write call. Though it might be a really good solution for normal sites, high traffic sites can't afford this overhead. Yes, there has to be a better way of doing it. :-)

The distinct advantage of using mature technologies is that you don't have to worry about such details, you pay for it and you get the service. For e.g. when developing a J2EE application using the IBM stack, a few configuration changes here and there using the administrative console of the Application Server and you are good to go with Single Sign On, Session management and the likes.

scru commented: High traffic sites shouldn't use shared hosting. +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> A way to work around this is to store the IP address of the user at login, and keep checking
> it on every page.

And what are you going to do about users who are behind a common proxy which is almost the case with all corporate organizations. Employees never directly connect to the internet, it's always done via a proxy, so a IP address based solution is as brittle as it gets.

Kavitha Butchi commented: sure, i shall take care of that now +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> More like my tenth.

See! And you wonder why the quality of Daniweb threads is declining these days. Oh and BTW, in reply to the previous reputation comment, I really think you are 10. Sheesh, cocky kids...

John A commented: Ban him, BAN HIM! :icon_biggrin: +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> Why not just stop worrying about it?

Why? Because it ends up wasting precious time of all the people involved in the process; precious time which could have been otherwise used to help out people.

Leaving those things apart you would be surprised at the number of repeat offenders. I can understand people new to forums getting things wrong on their first attempt but repeating the same mistake after being nicely pointed in the right direction is insanity.

> So just get rid of it all, and we can just go back to yelling at them when they screw up.

Please don't; it feels bad to yell at someone only to be ignored. ;-)

> Heck, I stopped regularly visiting there months ago

I guess the same is the case with Java, or I should say the most active programming sub-forums out there. Why? Because most of them are the ones who end up multi posting their queries in hope of getting an answer from at least one of them.

peter_budo commented: I agree, to go through unformated code is difficult. +10
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I know it's kinda against the rules

And the reason it is against the rules is because instead of the thousands of beginners / needy out there, only a single person gets the solution. Reading individualistic emails / PM's would be kind of difficult given the little time I get for helping people out, not to mention the moderation duties which need to be performed. I hope you understand.

You have been supplied with a lot of good ideas and I am pretty sure you will be able to come with a relatively better implementation than your peers. And hey, getting things right in the first go is kind of a sin. :-)

Alex Edwards commented: Lol, I suppose so. Thanks for all of your help! +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Hope you have gone through enough S.H.I.T. in humor to understand this one. :-)

Ancient Dragon commented: LOL :) +34
itdupuis commented: good stuff, keep it up! +1
Scuppery commented: dude that was so good I had to put it on myspace...keep it up +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I really like the idea of pieces not being capable of moving but knowing their legal moves.

I am yet to see a game where the pieces don't move. Each and every piece is capable of moving though the set of legal moves differ from game to game. IMO, the pieces should be capable of moving be always passed a valid position so that they can dumbly and safely move to the position mentioned. Maybe a common interface like Moveable should do the trick here. Also consider abstracting the 'position' concept in your game inside a class which will provide you the flexibility of switching between 1D, 2D and 3D.

Since you are into a client server architecture, you might as well have a Game class whose instance will be a game in progress having attributes like total game time, the game name, the reference to the board in use and the players involved in the game.

There are many other finer points which come to mind but I think the above mentioned ones should get you going.

Alex Edwards commented: Totally approved =) +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> concentrate on eval() function in javascript by googling

As in concentrate on swatting a fly with a hammer? eval sort of fires off a mini-compiler which dynamically evaluates the string passed to it. Look for better ways of doing things and use eval only when required. E.g. when evaluating a random expression entered by the user when creating a calculator application in Javascript.

> You should use parseInt .

Surprise surprise!

parseInt("09") + parseInt("09")

Moral: Always specify the base when using parseInt .

> This additionally ensures that values like: 1.356 + 6.32 don't get rounded into a sum of
> say 7, so you get the correct value of 7.676

I would still stay away from all those parseXXX variations since they give results which you least expect.

alert(parseFloat("1asldfjas"));
alert(Number("1asdfsdf"));
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The getElementsByName seems to be flawed when working with dynamically added elements in IE. I guess adding elements by using innerHTML is the only way of making IE aware of the existence of new elements.

Anyways, try something simple like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Script-Content-Type" content="text/javascript">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Example</title>
    <script type="text/javascript">
    /**
     *  Dynamically create form elements with incremental names.
     *
     *  @param tableId The ID of the table element.
     *  @param elemName The name of the element to be dynamically created.
     */
    function addRow(tableId, elemName) {
      if(!tableId || !elemName) return;
      
      // Grab hold of a reference to the table element and return from the 
      // function if no table element exists for the given table id.
      var tblElem = document.getElementById(tableId);
      if(!tblElem)  return;
      
      // Insert a new row at the end of the table, a new cell at the start
      // of that row and a new text node to the newly created cell.
      var newRow = tblElem.insertRow(-1);
      var newCell = newRow.insertCell(0);
      var txtElem = document.createElement("INPUT");
      txtElem.name = elemName + "[" + (tblElem.rows.length - 1) + "]";
      newCell.appendChild(txtElem);
    }
    
    function getElementsThatStartWith(frmObj, str) {
      if(!str || !frmObj)  return;
      var elems = frmObj.elements, returnElems = [];
      for(var i = 0, maxI = elems.length; i < maxI; ++i) {
        var elem = elems[i];
        if(elem.name.indexOf(str) == 0) {
          returnElems[returnElems.length] = elem;
        }
      }
      return(returnElems);
    }
    
    function validateHobbies(frmObj) {
      var elems = getElementsThatStartWith(frmObj, "hobby");
      for(var i = 0, maxI = elems.length; i < …
jakesee commented: Very professional programmer +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> var numeric = /^[0-9]*$/ This isn't a valid RegExp since it also validates a blank string. Numeric RegExp validation would go something along the lines of /^[0-9]+$/ or simply /^\d+$/ . [0-9] stands for any numeric character (0-9) where - is the range operator. Regular expressions are different beasts altogether, a single post won't suffice the purpose of explaining it all to you. Read up more on it here.

OmniX commented: Very useful post and link. Thankyou! +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

I doubt the above code would even work in FF2 considering that you explicitly need to pass the event when registering the handler.

<a href="#" onclick="doSomething(event);">
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Look into window.open and window.onload for achieving your objective.

mcx76 commented: thanks for help +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster
jmasta commented: Solved it! +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Though I am not sure as to what you are trying to achieve, you are getting the mentioned error because the URL constructor (the call new URL() ) throws a checked exception which you need to either catch or make the method have a throws clause.

try {
  URL url = new URL("someURL");
} catch(MalformedURLException mue) {
  // received an invalid url
}

OR

public void doSomething() throws MalformedURLException {
  URL url = new URL("someURL");
}

And BTW, scriptlets are a strict no-no for a variety of reasons. Plus, it would be kind of difficult for you to get into J2EE if your basic Java concepts aren't clear enough.

Nick Evan commented: Good post. (and congrats on you 7th dot;) ) +6
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Yes we would, take a look at the documentation of the String object of Javascript; you would find all that you require to complete your task.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Damn, not being visibly active really sucks. ;-)

majestic0110 commented: lol - I've seen you do some great moderation too my friend! +3
peter_budo commented: You do a great job and I'm happy to share Web Development section with you +8
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> I have javascript and ALL of it works in IE but in FF NONE of it works at all.

You are in luck; just take a sneak peak at the Error Console of Firefox (Tools -> Error Console) for any Javascript related errors. Also if you are into extensive Javascript programming, grabbing hold of Firebug (a firefox extension specifically tailored for Javascript debugging) would do you a lot of good.

OmniX commented: Helpful as always :) +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

This thread is going off-topic is a big way. Thank you all for participating in this discussion; for more *god* related things, please feel free to start a new thread.

John A commented: It's about time. Though I disagree with the "starting a new thread" part. :P +15
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

A document describing the common compile time / runtime errors and ways to resolve them; beginners might find it to be useful.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> yeah sometimes i do say things like "i agree" but hey, thats how a conversation works

Maybe in the Geek's Lounge, yes, but definitely not for Tech related threads. IMO such monosyllables when used in excess tend to dilute the usefulness of the thread in consideration. If you wholeheartedly agree with someone, there is always the "Add to XXX's reputation" link...

Nick Evan commented: I wholeheartedly agree +4
Ancient Dragon commented: And so do I :) +28
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Just follow the golden rule of never using TABS in your source code along with following the 70/80 column limit by using good source code formatters and you should be good to go without having to rely on which algorithm is used to format/render your code.

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> This is a little function I wrote to verify form fields, all you need is an div with the id "error" to
> take the output.

A required addition to that script would be checking whether the element really exists and trimming the form values before comparing them with an empty string so that I can't get away by keying in just a few whitespace characters.

ShawnCplus commented: almost forgot that, thanks +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Since you need to set the bean in the session scope, you need to do something like session.setAttribute("YourBeanName", yourBeanReference); . Read the form values in a normal manner; the same way you would do for a normal form submission i.e. request.getParameter("formFieldName");

~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Where have you declared 'slopetop', 'slopebottom' and 'slopefinal'? And document.write() is evaluated as the page is being rendered. Plus Javascript is a client side technology; as soon as a page is submitted, what you get is a new page and the state maintained in Javascript variables is reset.

You need to dynamically update the value of a span or div element to get this code working as expected. Something like:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
            "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Expires" content="0" /> <!-- disable caching -->
    <title>Example</title>
    <script type="text/javascript">
    function calculate(frm) {
      if(!frm)
        return(false);
      var elems = frm.elements;
      var x1 = parseInt(elems['inpx1'].value, 10);
      var x2 = parseInt(elems['inpx2'].value, 10);
      var y1 = parseInt(elems['inpy1'].value, 10);
      var y2 = parseInt(elems['inpy2'].value, 10);
      var e = elems['result1'];
      alert("(" + x1 + "," + y1 + ")" + " and (" + x2 + "," + y2 + ")");
      var distance = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
      e.value = isNaN(distance) ? 'Invalid input' : distance;
    }
    </script>
</head>
<body>
  <form action="#">
    <div>(<input type="text" name="inpx1" size="5">,<input type="text" name="inpy1" size="5">)</div>
    <br>
    <div>(<input type="text" name="inpx2" size="5">,<input type="text" name="inpy2" size="5">)</div>
    <br>
    <input type="button" onclick="return calculate(this.form);" value="Calculate!">
    <br><br>
    <div>Distance: <input name="result1" readonly="readonly"></div>
  </form>
</body>
</html>
3265002918 commented: I suck a javascript (presently). Thanks. +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Please let us again not go path of discussing why and how ads are evil; this topic has been brought up and beaten to death time and time again. Maybe it's time to mark this thread as solved...

John A commented: sigh... +14
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Have a look at the Javaworld article 'Solving the logout problem elegantly' to get a fair idea of how to go about doing things.

Sulley's Boo commented: riiiiiiiiiiight +5
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

The == operator in case of references compares the references and not the values to which they refer. Since both id and key don't refer to the same string instance in memory, it always returns false. What you need here is to use the equals() method to do the same.

But seriously, this is the very basic of Java programming every programmer out there ought to know. I would recommend you go through the basic Java programming tutorials on the official Sun site before diving head first in J2EE.

oldestprofessional commented: Thanks! Your post helped me solve my silly mistakes too... +0
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Is it February already? Damn...

joshSCH commented: Spammer!!! :P +12
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Looks good except for the thing that you don't explicitly set the length of the string since it's a read only property and would have no effect. Instead set the value of the form element to an empty string. Something like els[i].value = '';

OmniX commented: Helped me continualy to get a solution, Thankyou. +1
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Sanjay! You best watch the Super Bowl! You don't want to disrespect American culture, now do you? :P

Now only if I could get those American channels on my idiot box... ;-)

Now I am getting curious too dear sos, pray tell me what does global "actually" mean?

Simple, we don't want people to go all "Remember, this is mostly a European and American audience". It doesn't matter which country the majority of the audience is from since we don't base our decisions on that factor. We cater/treat each and every member the same way and in the same light irrespective of the country they belong. Hence, deliberately posting things aimed to cause discomfort to a particular religion is discouraged.

This also means keeping your hate list to yourself. We have had cases of people expressing their dislike to a particular culture/person/religion and make a huge issue out of it. On some other forum we had a sucker who thought all Muslims were terrorists; he was of course banned. We have seen suckers acting all high and mighty just because they thought that being from *The Privileged Country*, they could spit out any amount of BS they wanted, which is obviously dead wrong.

In short, anything which hampers / hurts the community spirit in view of the fact that the community is formed by *members* of Daniweb and not some people from country A or country B. The decision of what exactly crosses the line is subject …

Ancient Dragon commented: well said +23
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> As the new Moderator on this forum, are you outlawing sarcasm?

My replies till now have got nothing to do with me being a moderator of this forum. I have been a member / moderator long enough to know when/where to draw a line. If I were to misuse my moderator powers to outlaw sarcasm as you say, I would have deleted his post and given him an infraction, which obviously hasn't happened.

> Remember, this is mostly a European and American audience

Remember, this is a global forum and has it's rules tailored for the same. Maybe you should go back and read the entire thread before coming to the conclusion that I am outlawing sarcasm.

nav33n commented: :) thanks for your kind words! But I gave him my answer already ! :P +3
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

Think of the include directive as a header file of languages like C/C++. When using the include directive, the combined contents of the original JSP page and all its included resources are translated into the same implementation servlet i.e. the contents of the included resource is copy pasted before translation to a servlet. The important thing here is that all this happens during translation time and only static content is supported.

The include action <jsp:include> is almost similar to the include directive except for a few subtle differences. The include action is executed at request time as opposed to translation time. Thus instead of the content of the include file being included in the calling JSP, the output of the JSP is included or passed to the JSPWriter of the calling page. This allows us to include both static and dynamic content into the JSP page. Using the jsp action also allows you to explicitly pass parameters to the included page.

<jsp:include page="/index.jsp">
  <jsp:param name="name" value="sos" />
</jsp:include>
sree22_happy commented: good answers +2
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> looks like that I'm complicating my life with this xml and javascript exercise but now this
> problem get hold of me and I want to sort it

Frankly I don't know what exactly are you trying to achieve here. It seems more like the case of using the wrong tools for the job here. Why bother with the complications involved with rendering XML using XSL and that too involving a hefty amount of Javascript. Debugging in your case will be nothing short of hell.

Coming back to the problem I don't think this is correct:

<xsl:for-each select="propertyList/property">
	<xsl:if test="id/num = 1">
    	<xsl:value-of select="general/bedrooms"/>Bedrooms,<xsl:value-of select="general/type"/>, <xsl:value-of select="general/tenure"/>
    </xsl:if>
</xsl:for-each>

If you try the code which I have fixed, you will see that clicking on the "div" opens up a new page. From this we can conclude that the XSL processing of the XML document is one pass and if you need any sort of dynamic behavior *after* the rendering is complete, you would have to resort to some other means. What you have done just won't work.

Here is something which works (in a broken sense, of course):

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Preview</title>

<style type="text/css">
table { width:800px; border:solid; border-bottom-style:groove; border-width:thick; border-color:#DCF3F5;border-collapse:collapse; margin-top:20px;}
td {padding-top:8px; padding-bottom:8px; padding-left: 10px; padding-right: 10px;}
th {padding-top:8px; padding-bottom:8px; padding-left: 10px;}
td.just {text-align:justify;}
td.empty {padding-top:0px; padding-bottom:0px; padding-left: 0px; padding-right: 0px;}
</style>

<script type="text/javascript">
    var DOMCapable = !!document.getElementById;
    var propertyNum = null; …
peter_budo commented: Thank you for going trough the mess of my code and helping me find the solution. +7
~s.o.s~ 2,560 Failure as a human Team Colleague Featured Poster

> If need to type the contained ArrayLists but those can contain any type you can use
> <ArrayList<ArrayList<?>>
That way he would neither be able to instantiate nor insert elements into the given list.

A better way would be to do something like:

public class Lists {
    public static void main(String args[]) {
        /* First approach */
        List<List<? extends Object>> lists = new ArrayList<List<? extends Object>>();
        List<Object> listOne = new ArrayList<Object>();
        listOne.add("hello"); listOne.add(666);
        lists.add(listOne);
        List<Integer> listTwo = new ArrayList<Integer>();
        listTwo.add(1); listTwo.add(2);
        lists.add(listTwo);
        List<String> listThree = new ArrayList<String>();
        listThree.add("listry"); listThree.add("kaboom");
        lists.add(listThree);
        System.out.println(Arrays.asList(lists));
        
        /* Second approach */
        List<Klass> kLists = new ArrayList<Klass>();
        Klass klassOne = new Klass();
        klassOne.addToCharList("hello").addToNumList(34);
        kLists.add(klassOne);
        Klass klassTwo = new Klass();
        klassTwo.addToCharList("hi").addToCharList("bye").addToNumList(666);
        kLists.add(klassTwo);
        System.out.println(Arrays.asList(kLists));
    }
}

class Klass {
    private List<Number> numList;
    private List<CharSequence> charList;
    
    public Klass() {
        numList = new ArrayList<Number>();
        charList = new ArrayList<CharSequence>();
    }
    
    public Klass addToNumList(Number num) {
        numList.add(num);
        return(this);
    }
    
    public Klass addToCharList(CharSequence ch) {
        charList.add(ch);
        return(this);
    }
    
    @Override
    public String toString() {
        StringBuilder buf = new StringBuilder(1024);
        for(int i = 0, max = numList.size(); i < max; ++i) {
            buf.append(numList.get(i) + " ");
        }
        for(int i = 0, max = charList.size(); i < max; ++i) {
            buf.append(charList.get(i) + " ");
        }
        return(buf.toString());
    }
}

I find the second approach to be much more manageable than the first one.

Ezzaral commented: Good catch. Thanks. +5