Win a copy of Event Streams in Action this week in the Java in General forum!

since Feb 18, 2005

Cows and Likes

Cows

Total received

16

In last 30 days

5

Total given

0

Likes

Total received

73

Received in last 30 days

2

Total given

49

Given in last 30 days

6

Forums and Threads

Scavenger Hunt

Rancher Scavenger Hunt

Ranch Hand Scavenger Hunt

Greenhorn Scavenger Hunt

I don't know if it's better form to reply to my own post with additional information or to edit the previous post, so...

More explicitly, "You bet," means, "I am so committed to doing exactly what you requested that you can make a bet with someone else that I will do it and you'll have a very good chance of winning the bet."

I don't feel that "You bet" makes a statement one way or the other about whether he had pre-existing plans. However, if he did have plans, he will feel free to follow through with them as requested.

Ryan McGuire wrote:In general, "You bet," means, "I will do exactly as you requested."

More explicitly, "You bet," means, "I am so committed to doing exactly what you requested that you can make a bet with someone else that I will do it and you'll have a very good chance of winning the bet."

I don't feel that "You bet" makes a statement one way or the other about whether he had pre-existing plans. However, if he did have plans, he will feel free to follow through with them as requested.

11 hours ago

Linwood Hayes wrote:Last week, we planned a picnic with a few friends and families. I offered a ride/carpool to a friend saying "We can drive and if you want to go with us, let me know." Then I realized he was little hesitating, so I added "If you have other plan, feel free to go ahead with your plan..". He said "You bet." Can somebody tell me what does "you bet" mean here ? Does it mean he did have other plans or what ? You may ask why I didn't ask himself what it meant that time. Be honest, I just didn't want to make myself look dumb by letting people feel I couldn't grasp English..

In general, "You bet," means, "I will do exactly as you requested."

In this case, your friend is saying, "I will indeed feel free to go ahead with any plans that are already in place and not feel obligated to ride with you."

12 hours ago

Thank you! What a pleasant surprise!

I've been in a few conversations with a couple of the other new Ranchers and I have to say I'm honored to be included in their company.

I've been in a few conversations with a couple of the other new Ranchers and I have to say I'm honored to be included in their company.

1 day ago

Carey Brown wrote:You are comparing the references to "ab" and "ab " (note the extra space).

The '+' operator has a higher precedence than the '==' operator.

Exactly. Line 9 is equivalent to...

...which, as Carey pointed out, is comparing "ab" to "ab<space>"

You probably want to change that to...

Similarly, line 11 is equivalent to...

...in which the == is comparing "true ab" to "ab".

2 weeks ago

A few things:

1. As Liutauras mentioned before, indentation!

2. Also on the subject of code formatting. Always use braces. For instance, I'd rewrite lines 21 and 22 as...

Yes, it's perfectly valid to leave the braces out. If you scoff at my suggestion, continue to omit braces in such cases and ever admit to getting bitten by something like...

... I will just point and laugh. Ok, maybe that's a bit harsh. I'll probably have some sympathy for you, but you see my point.

3. You might consider sorting the array at the beginning of binarySearchRecursive() if a==0 and z==arr.length-1.

[EDIT: In retrospect number 3 is goofy. Sorting an unsorted array has O(N log N) complexity in general, which is horrible compared to the expected O(log N) time complexity of a binary search. Even just*verifying *that the array is sorted is O(N) and requires you to look at every array element, also ruining the advantage of a binary search over a linear one. Forget I suggested it.]

1. As Liutauras mentioned before, indentation!

2. Also on the subject of code formatting. Always use braces. For instance, I'd rewrite lines 21 and 22 as...

Yes, it's perfectly valid to leave the braces out. If you scoff at my suggestion, continue to omit braces in such cases and ever admit to getting bitten by something like...

... I will just point and laugh. Ok, maybe that's a bit harsh. I'll probably have some sympathy for you, but you see my point.

3. You might consider sorting the array at the beginning of binarySearchRecursive() if a==0 and z==arr.length-1.

[EDIT: In retrospect number 3 is goofy. Sorting an unsorted array has O(N log N) complexity in general, which is horrible compared to the expected O(log N) time complexity of a binary search. Even just

3 weeks ago

Disclaimer: I know approximately zero Python.

That being said...

If node comes back from find_cheapest_node() as None, won't using None as the index/key into graph[] cause an error? Should that test be...

EDIT:

Now that I reread your post, I see you agree with me:

If the while loop should stop when node is None, then check node, not graph[node].

That being said...

If node comes back from find_cheapest_node() as None, won't using None as the index/key into graph[] cause an error? Should that test be...

EDIT:

Now that I reread your post, I see you agree with me:

Obviously the while loop should stop when the returned node is none?

If the while loop should stop when node is None, then check node, not graph[node].

1 month ago

Piet Souris wrote:hi DJ,

long time no see! You seem to be very busy, but that is a good thing.

I had to read that assignment twice, but I think I got it. You are given N cities (vertices) and M lines of input indicating where a pilot can fly to and from (edges). So, it is an undirected Graph with N vertices and M edges. And the question is what the shortest path is between any two cities. Correct me if I'm wrong. Now, first thing what comes to mind is Dijkstra's algorithm: Dijkstra.

So, have a read and see if you agree with me!

That's not how I read it. Given N vertices and M edges, I think it's asking for the minimum size of the subset of edges that connect all N verices (i.e. a spanning tree). That seems strange to me, since the minimum number of edges in a spanning tree of a graph with N vertices is always N-1. ...assuming the graph is indeed connected, which is guaranteed by the problem statement.

Let's look at the first test case given:

A fully connected triangle. The spy has to trust the pilot that travels between cities 1 and 2. Then he wants to get from city 1 to city 3. He can't do that flying with the one pilot he trusts so far, so he has to trust a second one, for a running total of 2 so far. Next he wants to fly from city 2 to city 3. At first it looks like he'll have to trust a third pilot to make that flight. But no... he could fly from 2 to 1 and then from 1 to 3 while flying only with pilots he already trusts. So the minimum number of pilots our spy has to trust to get from any city to any city is 2 - final answer.

I think the second example would have been more fun if it was more fully connected. i.e. instead of having the minimum of four required to connect all N=5 vertices, it should have had, say, seven or eight edges. That would have made it "juicier". Of course the answer

1 month ago

In the case of arguments 2, 2 and 4. Should you get both 2+2=4 and 2*2=4 or just the addition equation?

2 months ago

Stephan van Hulst wrote:If your method call can succeed or fail, there are two acceptable options:

Return a boolean value indicating success. This is appropriate if failure of the method call is a normal occurrence and can happen regularly. Throw an exception. This is almost always the more appropriate option, because failure is usually an exceptional situation.

Why would an SQL query fail, unless something exceptional happened? So throwing an exception is probably the way to go. Now, you have two ways of throwing the exception:

I know that in C# throwing an exception is a LOT more expensive than returning a primitive value. Is it the same in Java? If so and you're inserting 500 DB rows of data in a loop, i'd change the return type to a boolean (success/failure) or an int (either zero or one row inserted).

2 months ago

Paul Clapham wrote:Can you burp the alphabet?

One of the achievements of which I'm most proud is burping the entire alphabet and getting to 'L' the second time through. All it took was a can of warm Pepsi.

I remember some movie or maybe a TV show had an allusion to "burping the Greek", when you try to say the entire Greek alphabet in one burp. I wish I could remember where I saw that.

3 months ago

"I have some feedback for the end of our sprint," Tom said in retrospect.

6 months ago

Just watch out for the employee that gets microchip 666.

9 months ago

Fairies. Genies. Naiads. Kodama, which we could modify slightly for software to Codama (Code-ama?)

9 months ago

Michael Angstadt wrote:As a software developer, it's important to make your code readable so that other developers (as well as your future self) can understand what you've written. However, complex regular expressions are notoriously difficult to read. Do you have any tips for improving the readability of regular expressions? Thank you!

https://www.martinfowler.com/bliki/ComposedRegex.html

9 months ago

Henry Wong wrote:

Ryan McGuire wrote:

'nuff said.

Hee Hee. Only a fellow trainer would understand the significant of those numbers....

Too bad there are very little reasons to friend a trainer that you will never battle, raid, or trade with... or I would send an invite.

Henry

It depends on where you live. Different regions have different pokemon, so a trading with someone half-way around the globe would be worthwhile.

10 months ago