Phaelax 52 Practically a Posting Shark

Sounds tricky, but here's my first thought. Add a listener to the combo boxes. When a value is selected from one of them, retrieve a list of the other combo boxes from that row. A custom table model can help with that. You don't need to create a new JComboBox, only update their list of data. You can remove the selected item from the other boxes. Do all the rows contain the same items in the JComboBox? Because then it would be easy to keep a master list to help with the updates.

There's probably a better way but that's my idea.

Phaelax 52 Practically a Posting Shark

Even web designers are expected to know at least a little html/css. Not learning it you'd only be hurting yourself. And wysiwyg editors tend to make awful looking code and inefficient. HTML isn't that hard to learn.

Phaelax 52 Practically a Posting Shark

This will show/hide the textboxes when clicking the checkboxes. (seems to have an issue with IE though)

<head>
    <style type="text/css">
        .tb_hide{display:none;}
    </style>

    <script type="text/javascript">
        function myfunction(id){
            e = document.getElementById(id);
            tb = document.getElementById(id+"_tb");
            if(e.checked){
                tb.style.display = "inline";
            }else{
                tb.style.display = "none";
            }
        }
    </script>

</head>



<html>
<body>

<form>
    <input type="checkbox" onchange="myfunction('gas_cb')"  name="gas_cb"  id="gas_cb"  value="Gas">Gas
    <input type="textbox" class="tb_hide" name="gas_cb_tb" id="gas_cb_tb"><br/>
    <input type="checkbox" onchange="myfunction('toll_cb')" name="toll_cb" id="toll_cb" value="Toll Fee">Toll Fee
    <input type="textbox" class="tb_hide" name="toll_cb_tb" id="toll_cb_tb"><br/>
    <input type="checkbox" onchange="myfunction('gps_cb')"  name="gps_cb"  id="gps_cb"  value="GPS">GPS
    <input type="textbox" class="tb_hide" name="gps_cb_tb" id="gps_cb_tb"><br/>
    <input type="checkbox" onchange="myfunction('key_cb')"  name="key_cb"  id="key_cb"  value="Lost Key">Lost Key
    <input type="textbox" class="tb_hide" name="key_cb_tb" id="key_cb_tb"><br/>
    <input type="checkbox" onchange="myfunction('park_cb')" name="park_cb" id="park_cb" value="Parking Fee">Parking Fee
    <input type="textbox" class="tb_hide" name="park_cb_tb" id="park_cb_tb"><br/>
</form>


</body>
</html>
Phaelax 52 Practically a Posting Shark

What doesn't work exactly? Is the conversion not as you intended or what?

Phaelax 52 Practically a Posting Shark

You added the same listener to the save button twice.

Phaelax 52 Practically a Posting Shark

If you're already comfortable using Eclipse, stick with that as it's more often used professionally than Netbeans. I, however, use Netbeans at home because I find it easier to use.

Phaelax 52 Practically a Posting Shark

depends on your project and which platform you're more comfortable using. Why did you post this in the Java forum?

Phaelax 52 Practically a Posting Shark

You have the same problem that was already described to you in your other identical post. LINK and META do not have closing tags.

The correct form is:
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<link href="styles.css" rel="stylesheet" type="text/css"/>

And if you're changing the doctype, that could change how your page is displayed.

Phaelax 52 Practically a Posting Shark

Isn't the title of word documents just the first sentence in the file?

Phaelax 52 Practically a Posting Shark

I took another look at your program. Currently, what you're doing is getting a policy number from the client then comparing it to the strings in the array. That's all fine and dandy, except you seem to have forgotten what strings are in your array. Look at your addPolicyRecord() method again. See that big messy string you're adding to the array list? You should store Policy objects into the array list.

Ignoring for the moment that I don't see an iterator method in your PolicyTable class (maybe I just over looked it).

/**
 * @param policyId	The policy id as entered by the client
 * @return 		The policy matching the given id or null if no match found
 */
public getPolicyById(String policyId){		
	String pn = "user entered policy number";

	for(int i=0;i<policyInfo.size();i++){
		Policy p = (Policy)policyInfo.get(i);
		if (pn.equals(p.getPolicyNo()))
			return p;
	}
	return null;
}

There's another option as well. If this was a small list of policies that required frequent lookups, I'd probably use a Map.

HashMap<String, Policy> policies = new HashMap<String, Policy>()
policies.put("123456789", new Policy());
String policyId = "123456789";
Policy policy = policies.get(policyId);
TheStig01 commented: thanks +1
Phaelax 52 Practically a Posting Shark

Loop through all elements in the PolicyInfo array and retrieve the policy ID from that element. When it equals the ID you're looking for, that's the policy object you want.

Phaelax 52 Practically a Posting Shark

Your table header doesn't have a closing tag (just add a slash to the closing TR), but that's not really affecting anything.

You also have a closing OL tag, but I don't see an opening one. Also, doesn't matter since it won't affect the numbering of the LI tags due to their locations in the code. If you just want bullets and don't care about them being numbered, then you can omit the OL tag anyway.

Considering the only line which is missing the radio buttons, I looked there. You've omitted the opening TD tag on all 3 lines inside the second table row. Fix that and your problem is solved.

Phaelax 52 Practically a Posting Shark

Don't claim to be an expert on regular expressions, but I'll try to explain what the code does. preg_match will search a string and try to match the given perl-compatible pattern.

#user= will first try to find the word "user=". Next, it'll search for a digit (0-9), as represented by \d. The plus sign following it means to search for 1 or more of the previously noted character, which is a digit. This part is contained within parenthesis to specify a group. Once it reaches a non-digit, it terminates that particular match search and starts a new match to the pattern. Any text contained within the string which matches the pattern user=34895430 (or any number of digits following user=) will have the number added to the $m array, as it was the "grouped" part.

Here's a handy regular expression cheat sheet.

Phaelax 52 Practically a Posting Shark

Always happy to help out a fellow top gear viewer ;)

Phaelax 52 Practically a Posting Shark

I was just trying to figure out the same thing last week. Basically, your 'Word' nodes are still Elements with children. To get the text between the opening and closing tags, grab the element's first child node and retrieve its value instead of the parent element's value.

String xml = "<document>"+
                    "<Word>apple</Word>"+
                    "<Word>hat</Word>"+
                    "<Word>car</Word>"+
                    "</document>";
        try{
            DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
            Document doc = builder.parse(new StringBufferInputStream(xml));

            NodeList nodeList = doc.getElementsByTagName("Word");

            for(int i=0;i<nodeList.getLength();i++){
                if(nodeList.item(i).getNodeType() == Node.ELEMENT_NODE){
                    Element element = (Element)nodeList.item(i);
                    String innerText = element.getFirstChild().getNodeValue().trim();
                    System.out.println(innerText);
                }
            }
        }catch(Exception e){}
Phaelax 52 Practically a Posting Shark

Think of an ArrayList as table. You'd make 1 class for each different table, not each variable. Let's say you need to store customer information, a typical table would look like this:

Name	Address		Phone		Email
--------------------------------------------------------
John	123 main st.	555-1234	john@gmail.com
Sue	654 4th st.	555-6547	sue@gmail.com

Create a class which stores those 4 fields (UserDetails). Every row added to this 'table' (the arrayList) would be an object of UserDetails.

You might have another table called Transactions with other various fields. Create a class for that and store it in another ArrayList.

To manage all these ArrayLists, I'd use a HashMap and associate each array list with a 'table' name. That would make it easier to call on the table you want.

HashMap tables = new HashMap();
tables.put("UserDetailsTable", new ArrayList<UserDetails>());

public getTable(String name){
    return (ArrayList)tables.get(name)
}
Phaelax 52 Practically a Posting Shark

I looked at the link in IE6 and FF3 and could see anything wrong with the text or images.

Phaelax 52 Practically a Posting Shark

Someone replied to you on
http://www.developphp.com/dev_forum/view_topic.php?cat=5&otid=7604&forum_name=Flash%20CS3%20and%20ActionScript%203&title=Coding%20Sytax%20question

In short, yes you can use prev instead of prevPic, but I say stick with prevPic since it's easier to know what the function might do. prev could mean many things. It's just better coding practice to stick with descriptive names.

Phaelax 52 Practically a Posting Shark

Here's how you'd create a list:

<select name="jlist" onlick="function()" size="3">
<option value="A">Item A</option>
<option value="B">Item B</option>
<option value="C">Item C</option>
</select>

You can only return whatever value you have in the double quotes, but you can use that information to retrieve a specific class if you need. Write a javascript function that runs when a user clicks on the selection. Based on the value selected, you can do "switch" statement perform whatever operations you need. If you have to retrieve information from a database and don't want to have to refresh the page, look into ajax.

Phaelax 52 Practically a Posting Shark

Ok, so you were able to post your homework, but how about explaining what the problem is you're having?

Phaelax 52 Practically a Posting Shark

I would do something like this:

if (!(option == JOptionPane.YES_OPTION))
    stop = true;

I have no idea what the values are for the constants, so always better to use the constant name rather than a value like '1'.

Phaelax 52 Practically a Posting Shark

So you're saying the field 'stl' can be like 1 or 2 or 3 or 4 instead of where is was only like 1 before? Couldn't you group several like statements with OR?

((stl like '$st1') OR (stl like '$st2') OR(stl like '$st3'))

I might be missing what you're trying to do.

Phaelax 52 Practically a Posting Shark

Not entirely sure what you mean. Is the image left-aligned within photoshop? Or is it left-aligned in your web browser? If the latter, I'm guessing you used adobe's html export?

Phaelax 52 Practically a Posting Shark

Platform games are generally tile-based. So use a 2D array to store your map tiles. You only draw the tiles that are visible within the viewport (what the play can see on the screen). You'd basically have a map pointer that keeps track of what position in the map data it should start drawing. Using different layers (different Z-depth) you can create parallax scrolling backgrounds.

Don't use JPanel for drawing all these graphics. I never heard of GCanvas (i haven't done games in java) but if its designed for drawing graphics and game sprites, then it'll probably already be setup for double buffering.

Phaelax 52 Practically a Posting Shark

You probably need to add the labels to a jpanel then add that panel to the scroll pane.

Phaelax 52 Practically a Posting Shark

A server awaiting incoming connections may use an infinite loop, often in another thread.

Phaelax 52 Practically a Posting Shark

Might try asking in a Javascript forum under web development.

Phaelax 52 Practically a Posting Shark

Take a modular approach to your challenges. Start with a basic map of just some cubes to represent the world. Build your collision system. Once your character manages to stop walking through walls, add buildings it can walk into. Then work on a "trigger" system, as in setting up specific areas where your character can trigger an event, such as NPC interaction. Unfortunately, when I tried to google for rpg tutorials, I found mostly tutorials about the RPG language (which is used on those old as/400 beasts). I'm starting to see your problem finding resources on the matter as a new developer, sorta makes me want to create an RPG now and document the process. So will you be creating this in 3D or 2D? Starting with easier games is a good idea, and simple spaces shooters is always fun to make. Good luck with whatever you end up deciding.

Phaelax 52 Practically a Posting Shark

I really feel lazy to write my own code

You're also apparently too lazy to google search as well.

http://sourceforge.net/projects/vcard4j

Phaelax 52 Practically a Posting Shark

You can use the following equation of projectile trajectory to make your explosions.

x = v*cos(a)*t
y = v*sin(a)*t - ½gt²

Keep an array of 100 or so particles that will make up the firework. Given a random velocity (v) for each particle and a random angle (a). Then just step through the time, updating their positions.

Phaelax 52 Practically a Posting Shark

Seeing as the kid is talking about C

I was referring to the first post where he specifically asked for Java code, not the guy who attempted to hijack the thread.

Phaelax 52 Practically a Posting Shark

Do you know about classes and objects yet?

Phaelax 52 Practically a Posting Shark

In Windows, there might be a way of accessing those components by using the Window ID handle or something. I'm not entirely sure here, this is just a guess.

Phaelax 52 Practically a Posting Shark

So what trouble are you having? It's telling you exactly step by step what to do.

Step 1: q = a/b
q = 108/16
q = 6.75

Step 2: % is modulus or the remainder of a division. So 10/3 would 3 1/10, the remainder is 1.

The steps are pretty self explanatory. Set a to b, should be clear enough.

Phaelax 52 Practically a Posting Shark

Do you have the jacob.dll in your system32 folder? (not that that has anything to do with this error)

This is what I found with google searches:

this bug has been solved by turning off ad blocking in Norton Personal Firewall and by adding www.java.com and Sun Microsystems to the trusdted sites in the firewall

Not entirely sure what that would have to do with your error message, but its just what I found on Sun's java bug forum.

Btw, which version of Java do you have?

You can also try reinstalling the VM

Phaelax 52 Practically a Posting Shark

Are you using iTunes on Windows? Did you run the example script that is suppose to get iTunes playing songs? JACOB files in the correct locations?

Phaelax 52 Practically a Posting Shark

Alright Jimmy, what is the goal here? Once you've built this 4x4 matrix, what do you have to do with it?

Here's a simple 4x4 matrix created with the pattern you just showed above.

int[][] matrix = {{1,0,0,0},{1,1,1,1},{0,0,0,1},{1,1,1,1}};

Now what are you trying to do with it?

Phaelax 52 Practically a Posting Shark

I think what bugs me more than the lack of effort in describing the problem is the lack of effort in proper writing style. The Internet is not an excuse for poor grammar; feels like I'm reading posts by a 6yr old.

but current educational systems are ever more geared towards not making anyone fail, either by reducing the passing score

Oh, you mean DeVry? I'm ashamed to have attended there.


Almost forgot actual helpful advice.

Jimmy, look at the Canvas class for drawing your snake or whatever. (assuming I'm thinking of the same game you have in mind) Read up on key listeners so the users can control the snake with their keyboard. I can offer you more advice after you've explain specifically where you're having trouble.

Phaelax 52 Practically a Posting Shark

Careful rajatC, with Strings you must compare them with the equals() method, as == is intended for primitives and String is an object.

JTextField guessI = new JTextField();
String g = new String("");
g = guessI.getText();
if(g.equals(word))
      //worked;
else
      //wrong;
Phaelax 52 Practically a Posting Shark

What happens? Does it print anything at all, wrong data or just blank? Any errors?

Also, if you wrap your code inside code tags, it'll be a lot easier for us to read it. [c o d e] my code here[/c o d e]

Phaelax 52 Practically a Posting Shark

To clarify, a constructor will have the same name as the class and not define any return type. If it does not have the same name as the class, then it is just a method and must have a return type defined. If your methods are not returning anything, you still need to specify "void" as the return type.

To create the constructors, change all those "Module" names to "Homeworkone".

Phaelax 52 Practically a Posting Shark

I believe there's a static variable or system propery that holds the proper return character for the system the vm is running on. Sorry I can't remember exactly what it was.

Phaelax 52 Practically a Posting Shark

I like 3D Studio Max best, my friend prefers Maya. It basically comes down to which package we've invested our time in learning. Pretty much most packages are capable of the same things. I know a lot of independent developers that will use Anim8er or Blender because the high end packages can be quite expensive. And as long as you have the skills, those cheap or free programs can still produce great results, and I've seen them do it.

iamthwee commented: And I know it. Blender is up there with max and maya. +9
Phaelax 52 Practically a Posting Shark

Do you get an error, can't find where to install it at, or what? Details!

Phaelax 52 Practically a Posting Shark

total + 1000 doesn't do anything. as you haven't defined a place for it to store the result of the addition. If you wanted total to equal itself plus 1000, how would you write it out on paper?

Phaelax 52 Practically a Posting Shark

Jus nid help wid sm few codings wich myt b of use to this game, aint askin ny1 to do it 4 me since it aint a homework bt jus a topic of interest i picked up frm smwea. Any help wil be appreciated. Thnx

Having a little trouble spelling words?

Obviously he hasn't done any code yet, otherwise he would already know what language he needs help in.
Pick a language to use, start working on the problem, then ask the forum if something 'specific' is troubling you.

Phaelax 52 Practically a Posting Shark

Have you tried File class?

File filePath = new File("C:/Temp/");
File[] files = filePath.listFiles(tifFilter);
 
files[0].delete();
files[1].delete();
...
Phaelax 52 Practically a Posting Shark

If you're the only one that needs access, I'd say put the file in a separate directory and use an htaccess file.

Phaelax 52 Practically a Posting Shark

This method would take the ball's coordinates from its center, its radius, and a Block object. It'll return true if they're overlapping.

public boolean overlap(int bx, int by, int radius, Block block)
{
     int x1 = block.getX();
     int y1 = block.getY();
     int x2 = block.getX() + 30;
     int y2 = block.getY() + 10;

     if ((bx+radius > x1) && (bx-radius < x2) && (by+radius > y1) && (by-radius < y2))
     {
           return true;
     }
     return false;
}

While this works for simple games, it only works as long as the ball's speed does not exceed the width or height of a brick. For instance, if a brick is 10 units tall and a ball moves vertically at 15units per loop, then there's a possibility that it could skip right over the brick and never trigger a collision. So even though we would see that the ball appeared to pass right through the block, the code never sees the two objects overlap.

A solution for this is to use swept-collision. This is where you take the ball's old position of the last game loop and its new position of the current loop and form a line segment. Then using line segment AB (the ball's path) you check if it intersects the rectangle of the block. The algorithm for that could return a time index of when the line would intersect the block. If the value is between o and 1, then there was a collision. Anything outside of that range …

Phaelax 52 Practically a Posting Shark

The charAt method returns a character and you're trying to assign it to a String variable. Fixing that should prevent the second error.
You can turn a character into a string by adding a blank string with it.

String s = ""+value.charAt(0);

Your output still won't look right since you're outputting carA and restA.

carA equals whatever the user inputted, its not changed anywhere. So the first part written to the screen will be the entire input string capitalized.

restA equals carA, the same thing minus the first character. When you pass only 1 argument when calling substring, it returns the rest of the string from that character position and on to the end.


For example:

String carA = "something";
restA = carA.substring(1);

restA will equal "omething".

You're using 'value' to grab the first character but never actually doing anything with it.


Here's an example:
String input = "this is a test";

String fixed = input.substring(0,1).toUpperCase() + input.substring(1).toLowerCase() + ".";

System.out.println(fixed);