Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

John Philippe

Greenhorn
+ Follow
since Apr 06, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by John Philippe

the errors are everywhere (in eclipse the squiggly red) because I don't know how to switch over to the buffereader, and also I lose the ability to use the "scan.findWithinHorizon"
12 years ago
I went and tried to scwitch to use the buffereReader but I have to say that it doesn't look like I know how to do it ocrrectly because I am now having all kinds of error message.
How would I go about performing this switch over please?

John
12 years ago
Thank you Michael,

I will try that right now and post back my findings

John
12 years ago
Hi David,

I did this how I could, I'm very new, and very open on how I do things.
Would you mind presenting me with an example of how your suggestion would work?

Thanks
John
12 years ago
Thank you Michael,

I tried to attach a sample code as txt, zip, or log and the system always tells me "not allowed as attachement in the message.


the sample txt file looks like this:


Jun 2 03:26:53 macbookscuba Dock[215]: Corrupt JPEG data: premature end of data segment
Jun 2 03:26:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]:
Tue Jun 2 03:26:53 macbookscuba.local Dock[215] <Error>: Corrupt JPEG data: premature end of data segment
Jun 2 03:26:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]:
Jun 2 03:53:53 macbookscuba Dock[215]: Corrupt JPEG data: premature end of data segment
Jun 2 03:53:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]: Tue Jun 2 03:53:53 macbookscuba.local Dock[215] <Error>: Corrupt JPEG data: premature end of data segment
Jun 2 03:53:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]:
Jun 2 04:08:49 macbookscuba Translator[838]: Invoked to sync conduit ExchangeConduit for entityNames: anything
Jun 2 04:20:53 macbookscuba Dock[215]: Corrupt JPEG data: premature end of data segment
Jun 2 04:20:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]: Tue Jun 2 04:20:53 macbookscuba.local Dock[215] <Error>: Corrupt JPEG data: premature end of data segment
Jun 2 04:20:53 macbookscuba [0x0-0xa00a].com.apple.dock[215]:

John
12 years ago
Anybody have any ideas?

Thanks

John
12 years ago
Good evening,

I am looking for some help in understanding my mistake(s).
I am trying to parse a log file to see how many error messages in total I receive per day, that appears to function; however I am also looking to see how many error messages per hour I am getting and that's not wokring the way I would like it to be.



my ouptut is as follows:
please wait while it is performing the calculations
Number of error messages on June 2nd: 1729 errors
Number of messages per hour for 03 am:1 errors
Number of messages per hour for 04 am:1 errors
Number of messages per hour for 05 am:9 errors

for the 03 am I'm suppose to get 8 errors instead of 1 and for 04 am I'm suppose to get 9errors instead of 1 being displayed.
05am having 9 errors is correct but what seems to occur is that when I had a "result = scan.findWithinHorizon("\\s05:\\d\\d:\\d\\d\\s", 0);
" the previous one stops fucntioning correctly.

Could someone please help me figure out where I am going wrong.

THank a lot

John,

PS: the log file used to get the data from is attached.
12 years ago
Good evening,

I apologize in my slownest to respond but quite a lot happens in a day, and I like to study and try out what I am given before responding, and I'm really slow at that.

The code that Sridhar Gudipalli provided me with was extremely helpful, and I would like to thank him once again for I spent so much time on this trying to get it to work on my own and really truely couldn't; that's why when I get stuck like that I come and humbly ask the help of the people that knows.

I looked and spent a good amount of time through the code to make sure I understood it, once again thank you for your all's help.

John.
12 years ago
Thank you Sridhar Gudipalli,

I now have to study your example so I can comprehend what was done.

John
12 years ago
thank you Fred,
I will try that

John
12 years ago
good morning,

I run it with this:


Could somebody please help me with how NOT to keep on re-opening it?

Thank you,

John
12 years ago
Thank you for such a quick response Henri.

May I ask you, how I could avoid writing over it?
And obtain my desired output

Thank you

John
12 years ago
Good evening,

I am fairly new at java and need help.

I have spent so much time trying to understand how to output my recursive solution to the tower of hanoi problem that I am now having a hard time seeing where I am going wrong.
I would like to output my result into a text file, instead of having this expected resulted in my text file as follows:

1 --> 3
1 --> 2
3 --> 2
1 --> 3
2 --> 1
2 --> 3
1 --> 3

I get this in my text file:
1 --> 3

To me it looks like my code solution is not going through the whole recurtion but I don't know how to fix it.
If somebody could help me, I would really really appreciate it.




Thank you in advance,
John
12 years ago
Thank you Ritchie for the tips for the editors.
13 years ago
I am really really new at java and I have jsut figured out why my output window was just giving me one thousand ones instead of the decimal to the E power as I was awaiting.

Apparently when using this method I can have one thousand ones converted to a decimal number:

public class test2
{
public static void main(String args[])
{
String bin = "1111111111111111111111111";
double ctr=1, decimal=0;

for (double i = bin.length()-1; i>=0; i--)
{
if(bin.charAt((int) i)=='1')
decimal+=ctr;
ctr*=2;
}
System.out.println ("Decimal: "+decimal);
}
}

but using this method:
int value = Integer.parseInt(line, 2);

I receive just the binary number not converted, just all the ones.

I really don't want to be annoying but could I ask what else I could do in order for me to convert that many 1 to a decimal equivalent. I looked at all hte option when I select the "." after Integer. like MAX_VALUE, getInterger, etc... but none seem like they would allow me to convert such a large binary number.

Once again thank you for your help.




13 years ago