Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Please be aware of the following forum rule:
Do provide evidence of having done some work yourself if posting questions from school or work assignments

Post your code and specific questions about what is troubling you and what you have tried.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You didn't provide CollegeMember with a zero-argument constructor, which your Lecturer constructors are trying to call implicitly.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Netbeans, Eclipse, and IntelliJ IDEA are all widely used tools.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You miss my point. A NullPointException occurs when you attempt to call a method on or otherwise access an object reference that has not been initialized. I can guess pretty easily what 'lstEvents' is but that doesn't address whether or not that you initialized it. You need to verify that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Is it possible that 'lstEvent' is null? That is where you should start with any NullPointerException.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

assertEquals() would not apply here since you aren't testing equality. Take a look at the other assert methods and find one that could assert your condition.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Assert that the absolute value of the difference is less than your threshold.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I'm not sure what to tell you then, because I took this fragment that you posted earlier this works just fine with both my pattern and Taywin's

String holder = "<div id=\"mess130268\" class=\"mChatBG2 mChatHover\"><span style=\"float:left;\"><a class=\"mChatScriptLink\" href=\"javascript<b></b>://\" onclick=\"insert_text('@&nbsp;Run You Camper, ', false);\" title=\"Respond to user\"><span style=\"color: #ffFF15\"><strong>@</strong></span></a>&nbsp;<a href=\"./memberlist.php?mode=viewprofile&amp;u=18216\" style=\"color: #ffFF15;\" class=\"username-coloured\">Run You Camper</a> - Fri Oct 28, 2011 9:17 am</span><span style=\"float:right;\"><input type=\"hidden\" id=\"edit130268\" value=\"me n him brought down a whole igc lobby ourselves... :D\" /> <a href=\"javascript<b></b>://\" onclick=\"mChat.del('130268');\"><img src=\"./mchat/del.gif\" alt=\"Delete\" title=\"Delete\" class=\"mChatImage\" /></a></span><br /><div class=\"mChatMessage\">me n him brought down a whole igc lobby ourselves... <img src=\"./images/smilies/icon_e_biggrin.gif\" alt=\":D\" title=\"Very Happy\" /></div></div> "+
"					"+
"					<div id=\"mess130269\" class=\"mChatBG1 mChatHover\"><span style=\"float:left;\"><a class=\"mChatScriptLink\" href=\"javascript<b></b>://\" onclick=\"insert_text('@&nbsp;Run You Camper, ', false);\" title=\"Respond to user\"><span style=\"color: #ffFF15\"><strong>@</strong></span></a>&nbsp;<a href=\"./memberlist.php?mode=viewprofile&amp;u=18216\" style=\"color: #ffFF15;\" class=\"username-coloured\">Run You Camper</a> - Fri Oct 28, 2011 9:17 am</span><span style=\"float:right;\"><input type=\"hidden\" id=\"edit130269\" value=\"then godfather dashboarded cuz of it and ended game 30 secs early. -.- lol\" /> <a href=\"javascript<b></b>://\" onclick=\"mChat.del('130269');\"><img src=\"./mchat/del.gif\" alt=\"Delete\" title=\"Delete\" class=\"mChatImage\" /></a></span><br /><div class=\"mChatMessage\">then godfather dashboarded cuz of it and ended game 30 secs early. -.- lol</div></div>";
Pattern pattern = Pattern.compile("value=\"(.+?)\" />");
//Pattern.compile("value=\"([^\"]*)\"", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(holder);

while (matcher.find()) {
    System.out.println(matcher.group(1));
}

I can't speak for any data other than that tested.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This works perfectly fine for me

String holder = "value=\"Hey there... blah blah\" /><more /><asd value=\"another\" /><more><asdf value=\"third line\" />";
Pattern pattern = Pattern.compile("value=\"(.+?)\" />");
Matcher matcher = pattern.matcher(holder);

while (matcher.find()) {
    System.out.println(matcher.group(1));
}

Group 1 is the portion of the match string that you were wanting to capture.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, my bad, my over-escaping caution has led this astray. Just use Pattern.compile("value=\"(.+?)\" />");

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@aanders5: Change \\> to just /> and add the question mark in (.+?)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

The "=" and ">" don't need to be escaped.

True. I've gotten overly cautious about escaping all reserved characters in the expressions, but evidently it's okay with those as written even though = and > are used in some pattern constructs.

But the problem with the regex above is that it will grab the last " it sees in the string.

My last change above to use (.+?) should resolve that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just go through your string and add a backslash escape for each backslash and quote you are using in your expression. You'll have to get used to this at some point. Escaping regex pattern literals is a pain :)

Also note that I corrected my original pattern to use the forward slash in front of the ">".

I think you'll also want to use a reluctant qunatifier to keep it from grabbing multiple elements, so instead of (.+) use (.+?)

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And what is the error?

Edit: You have to escape all of the " and \ with additional \ in your string.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Well, the simplest case regex would be something like value\=\"(.+)\" /\> You would retrieve your text from group 1. Of course, you may have to tune that for variability.

Edit: Oops, used the wrong direction slash. Corrected.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you asking what the regex would be or do you already have an expression that you are trying to tune?

Have you thought about trying one of the many HTML parsing packages like http://mozillaparser.sourceforge.net/, http://jtidy.sourceforge.net/, http://htmlparser.sourceforge.net/ ?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you going to ask an actual question or just hope someone wants to read all your code and try to figure out what it does and does not do?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're trying to access the third element of array[] and it doesn't have that many elements. Don't do that.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You're setting winner from the fourth column

int Winner = rs.getInt(4);

but winner is the fifth column your data set. Contrary to most any other indexing in Java, in ResultSet the first column is 1, not 0.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

i just don't know how to use color constructor

Just remove this line

public void Color(int r,int g,int b);

and this line

c = Color.magenta;

Your initial declaration is just fine.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Keep in mind rs.next() advances the result set, so when you call that again in your while() loop you're skipping over the first record to the next.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Why this on line 120?

if (!rs.next()) {

You don't want that block to execute if the query has results?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Don't define your class to be in java.lang package.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You can read some explanation about the R class in this tutorial for Hello World on Android.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@jQuery: The forums aren't here for you to promote your blog posts.

Thread closed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> But the later work was really quite good
I don't believe that the later work was his own any more than the first "attempt", which was directly copied from a book. He did not even have the TemperatureInfo class and merely copied yours into his program.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Does this Code answer that question?
If you can't tell, you need to stop wasting peoples' time here.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

See what you can come up with and ask specific questions about what you are having trouble with. What you posted above is a direct copy of code you found elsewhere, so that's not going to cut it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

@hfx642: No, the situation you describe would not compile. The variable would have no scope outside the method in which it was declared. It would complain "Cannot find symbol"

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Just below the text "Has this thread been answered?" there is a link to "Mark this Thread as Solved".

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This example app from the tutorials seems applicable:
http://xuggle.wordpress.com/2009/01/23/how-to-use-xuggler-to-decode-and-play-video/

They are updating a VideoImage frame with a BufferedImage from the stream. VideoImage just extends JFrame, so you could probably either look at that source or override paintComponent(Graphics) on a JPanel of your own and render the BufferedImage on that panel with drawImage().

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Moving to JavaScript.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

> Any suggestions?
Sure, start reading their tutorials on the site.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

And you can always start with the basic tutorial:
http://download.oracle.com/javase/tutorial/java/concepts/index.html

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This thread was just sock-puppet promotion for a particular product by Jones_nash and Shamrocks. Those posts have been deleted, but I will leave the rest of the replies up for the benefit of others.

Closed.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Post the code that you do have and ask specific questions.

From our forum rules:
Keep It Organized - Do provide evidence of having done some work yourself if posting questions from assignments.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

This was already answered in the OP's other thread for the same question but he chose to ignore the answers:
http://www.daniweb.com/software-development/java/threads/384210/1654757#post1654757

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It worked fine when I set the colors after creating the chart with JFreeChart chart = ChartFactory.createXYLineChart(... and then got the plot reference with XYPlot plot = chart.getXYPlot(); Give that a try and see if it helps.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I didn't say remove it - I said it may be the wrong one. Spelling counts.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Take a closer look at line 56 and note which method you are calling. It may not be the one you want.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Actually, on line 93 you are declaring a new variable "stkBean" which immediately goes out of scope in your loop.

StkBean stkBean = new StkBean();

Remove the declaration from that and just assign the new instance to your class-level stkBean reference.

Your current code is still using the single instance of stkBean that you initialized at declaration.

Alternately, you could move line 93 up to the beginning of the loop and do away with the class-level variable altogether. You don't have any use for stkBean other than adding to the arraylist.

while (results.next() )
            {
                StkBean stkBean = new StkBean();   
                //myList.add((results.getString(1)).trim() );
                stkBean.setStkSymbol(results.getString((1)).trim () );                
                stkBean.setCompanyName(results.getString((2)).trim() );
                stkList.add(stkBean);
             
            }//end do-while

Edit: Also, you may want to either override toString() in your StkBean class or print one of the properties like getCompanyName() in your option list output.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Are you creating a new StkBean each iteration of your loop to add to the array list?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Ok, there is no way I'm going to try to trace that mess of meaningless variable names, but I will say that all you need is a List or Set to keep the numbers you have already encountered and the String.replace() method.

In fact, you only need the list if you want to retain a listing of the unique numbers. If you just want to cleanse repetitions, all you need to do is loop forward and remove them.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

You don't want to create a new Date to compare to "d". You want to use the current instance value.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Yes, you declared the variable on line 27, but you haven't actually initialized it prior to using it. You still have to create an instance of new StkBean() before you can assign any values to it.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

I don't see where you have initialized "stkBean" prior to that line.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

It seems rather lazy and unproductive to me.

You could have tried it out yourself first and then if it didn't work you could have posted "Hey, I tried this... but it gave me this... what do I need to change?" If it did work, you could focus directly on the other query without taking up any more time on the first.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

That makes no sense at all.

Why not type the code into a simple query against your data and see if it works before you post it to a forum and ask others if it looks right?

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Per our forum rules:
Keep It Organized - Do provide evidence of having done some work yourself if posting questions from assignments.

Ezzaral 2,714 Posting Sage Team Colleague Featured Poster

Sorry Didnt Tried It Yet

Why bother to post this at all then? If you aren't willing to even try out any code on your own, why should others spend their time on it?