fred rosenberger

lowercase baba
+ Follow
since Oct 02, 2003
fred likes ...
Chrome Java Linux
Forum Moderator
fred rosenberger currently moderates these forums:
St. Louis
Cows and Likes
Cows
Total received
51
In last 30 days
0
Total given
19
Likes
Total received
1662
Received in last 30 days
2
Total given
51
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by fred rosenberger

the unix cron i'm familiar with only goes to minutes...possibly seconds in some versions, but that's not one i've ever seen

I think millisecond timing would be rather hard, since you never know when you will get your cpu time. If something else is hogging the system, you may have to wait a while...
4 days ago
my concern with using "mary" is that there is nothing to prevent you from doing this:



Now both "mary" and "ruth" point to the same object...but which is it?

is there a reason you need a reference to each one? Why not use a collection (array, list, etc)?  
4 days ago
You shouldn't worry about performance unless you have a documented spec on what the performance should be.  "As fast as possible" is NOT a valid spec.  "less than 10 milliseconds" is.  

You should almost always focus on readability and maintenance over speed.  After all, if you save 1 millisecond by optimizing code, but then spend 20 hour debugging it in the future, you're probably going to be at a net loss - especially since a user won't ever notice the savings.
1 week ago
personally, I wouldn't try and write a monolithic expression that covers all the bases.  Your requirement are bound to change over time, and if you have a single expression, it gets EXTREMELY hard to adjust it later. It's almost impossible to adjust it without breaking something else.

I would instead consider writing many small expressions, each contained in their own boolean method, then aggregate those...



Now it's much easier to swap in and out various conditions as your requirements change.
1 week ago
Woody, Sam, Carla and Diane worked at the bar. Sam was an alcoholic, so he never drank (liquor).  

Norm, Cliff, Frasier and Lilith were regulars at the bar.
2 weeks ago
We also have the Cattle Drive.  The problems are posted and you can use them. If you want formal reviews, there is a fee for that.
1 month ago
I believe that generally on *nix platforms, it's usually "/home/<username>".  so if my username was "fred", my home directory would be "/home/fred".  I can also use the tilde character '~' as a reference to my home dir.  so wherever I am, "cd ~" would take me to my home.

I also think you can use the tilde so see someone else's directory, if you know their username. so you could do "cd ~fred" to see fred's home dir, or an "ls -al" to see the permissions on it.
1 month ago

D.J. Quavern wrote:2. oooh. Ok, I was really confused! I don't know why I did that retrospectively...


Just to emphasize the point...

a method should do ONE thing, and something simple, at that.  Your method was named fairly well as "minimal_distance".  That should clue you in that it should have NOTHING to do with TIME or seconds.  

I've moved on from doing much programming so I don't know if this still holds, but they used to say methods should be named like verbs - i.e. "get_minimal_distance".  then when you are reading the code that calls it, it sort of flows better...You could also combine lines 26 and 27 (in your original post/first code):


could be simplified to

1 month ago

Campbell Ritchie wrote:I think the confusion in that method is different from that, Fred.


i'm not saying mine is the only problem with that method...

But I stand by my statement that it makes no sense to add one second to a distance of 13 feet.
1 month ago
Your minimal_distance method is confused.  If it is trying to calculate the DISTANCE, why would you add one SECOND?  

What is the result of "13 feet + 1 second"?
1 month ago
I've heard of something similar to this at universities. Rather that give loans or grants, you agree to pay some X% of your salary for the next Y years.  There are caveats for going back to school, looking for work but not finding work, not looking, etc., but it does seem like an interesting model.

I have no idea if this site is legit or not...but the practice is not unheard of.
1 month ago
that sort of brings the question around do "do you need to know how to write a regex" or "do you need to match this string and/or do something to it...".  The details matter when it comes to getting the best possible help.
1 month ago
you need to be more specific.  something like this would match that string:

.*

if you want to get more precise, you could do it on digits and literals, i.e.

\d\d/\d\d....etc

if you then further want to validate the characters before the first slash resolve to a value less than 32, or are valid against the month specified (i.e. no "30" if the month is "02"), then you need more than just a regex.
1 month ago
Do you have to report THAT the list is out of order, or do you have to report all the ELEMENTS that are out of order?  The former lets you stop as soon as you find one, the latter requires you to check them all (or almost all).
2 months ago
Not to beat a dead horse, but by your logic, modulus would never return anything but zero.  12 divided by five would be 2.4, so 0 is the remainder.

15 divided by 8 is 1.875, so zero is the remainder...

etc.

Modus, by definition, is the leftover after integer division.  so 2 goes into 1 exactly zero times, with one left over. just like 5 goes into 12 two times, with two left over...
2 months ago