fred rosenberger

lowercase baba
+ Follow
since Oct 02, 2003
fred likes ...
Chrome Java Linux
St. Louis
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt Green check

Recent posts by fred rosenberger

well, here's the thing.  The structure tells you when to use it - when you need to access the most recent item put into a group.

In business accounting, there are two main methods used for keeping track of inventory costs.  First In, First Out (FIFO), or Last In, First Out (LIFO).  Say I buy 100lbs of steel at $1 per pound.  a week later, I buy another 100lbs of steel at $1.15 per pound.  The next week, I USE 80 lbs of steel. I want to record the expense of my inventory used to make $100 worth of my product.  I could use FIFO, and say that steel cost me $80.  That gives me a bigger profit today of $20 ($100 in product - $80 in material), but also leaves me with more money tied up in inventory ($20 of $1/lb steel, $115 in $1.15lb steel == $135) of materials not being used.

OR, I could use LIFO and say that steel used cost me $92 (80lbs at $1.15/lb).  Now my profit today is less  ($8), since my materials cost a bit more, but I have less money tied up in inventory (20lb * $1.15 + 100lb * $1/lb == $123) .

If i recall correctly, a business can use either method of LIFO or FIFO, but once they pick one, they have to stick with it.
3 days ago
Is there a reason for doing it this way?  Couldn't you use something like String.split() on whitespace characters, then check the specific array elements for the values?
1 week ago

Hanna Roberts wrote:So I ssh into a school server and work in there, im not sure if thats what you mean by network file?

These days it is not uncommon to have many computers (unix boxes, pcs, macs, etc) all connect to another box that is basically a HUGE set of disk drives. The box is built to be super-efficient at it, since it really only has to serve files.  It also makes it easier to add more disk space, manage the software for it, etc., as everything is in one spot, rather than spread out over 50 individual pc's, linux boxes, macs, etc.

So a network file basically means a file that is saved onto a hard disk that you connect to via the network/internet, instead of on your local machine.  If you ssh from your pc to a unix server, that unix box may then have a network attached storage device for saving files.  (It would also most likely have a local, smaller disk).
1 week ago

Carey Brown wrote:Fred, I mostly agree with you except for your step (1). I don't see where you get that from.

Java does not have 2-d arrays.  you have an array that holds arrays.  the OP needs to build many small int arrays, that then get put into the int [][].
2 weeks ago

Kory Perry wrote:I'm looking to populate a multidimensional array with integers that are read from a txt file by using a method.

This is more complicated than you make it sound.  it's not one thing, it's many.
1) You need to populate many arrays with integers you get from <somewhere>.
2) you need to populate an array of arrays of integers you get from <somewhere>
3) You need to read from a file
4) you need to parse data from that file
5) you need to validate the data in the file ( depends on how sure you are your file will only contain ints)

There may even be more steps.  But each of the above could really be a method in and of itself.

One of the hardest things to learn is that a method shouldn't do too much.  It's much better, safer, and easier to write a lot of small methods that each do one thing, and do it well, than to write a single, monolithic method that tries to do everything.  It also makes you program more flexible.  If your method that builds the array doesn't have any logic about getting the data, you can change it later...maybe you'll want to read from a database, or a port on a remote server...if the method for getting the data is completely separate from the method that uses the data, you can change one (or even replace it entirely) without worrying about the other.
2 weeks ago

Ginny Hub wrote: how do I code to only use one if statement

WHY do you need only one "if" statement?

I'll be honest, i didn't read much more of your post than that. But any time someone says "How do I do X using Y", that sounds to me like you are creating arbitrary limits.  If I said "How do I build a house using ONE nail?" you'd think I'm crazy, right?  Or "How do i print a .pdf file using a hammer and chisel?"  

Don't impose arbitrary limits on yourself. Use the right tool for the right job, in the right way.

2 weeks ago

Paul Clapham wrote:I'm sure we have an FAQ page for this question

3 weeks ago
The secret to being a good developer is to realize that coding is 90% thinking, and only 10% typing.

Never start off a project trying to figure out the syntax.  Start by writing out in English (or your natural language of choice) what you want to do, step by step.  Then revise those steps into smaller steps.  Keep revising it until your steps are clear enough that a 10 year old child (or a 5 year old) can understand them, follow them, and have no questions about what to do next.  

If you have access to such a child, give it to them and see how many errors and omissions you have, then repeat.

Eventually, you will have a pretty well defined list of steps.

Then start coding, but only in the smallest amount possible before you compile, test, debug, repeat until it's perfect. If I were doing this project, on my first pass, i would have the code print nothing more than a simple "hello".  

Once that worked, change it to print "Please enter your name: " (or something like that).  At this point, i'm not trying to GET the name, i'm merely asking the question.  Once THAT works, I add the next piece.  I may think "ok, i know how to ask for a name, so asking for age shouldn't be that much harder, so i'll work on getting the name".  Once i can get it and save it, then hopefully doing the same two steps for age will be easier.

Try that.  see how far you can get.  When you have something and get stuck, post your code here and someone will help you further.
3 weeks ago

Mario Gianota wrote:
The answer to 40 / 60... is 6 remainder 4, or 0.64

6 remainder 4 is not the same as 0.64.  
1 month ago
Let us also not forget the learning aspect. You can pair a junior and senior developer together. Or even a "database" person with a "GUI" person.  Both will learn from each other, and become better, more rounded developers.  Or a "business process" person with an "algorithms" person...And now you have TWO people who have worked on the code, both of whom have an understanding of it.  The next day, they can be paired with someone else and spread the knowledge further.

Another aspect that is occasionally forgotten is that there can be fewer distractions.  If i am in a cubicle by myself at work, I may think "oh, I'll look at for a few minutes and answer a question or two...", and then 30 minutes goes by while I type out some replies.  If I have someone in the cube with me, looking over my shoulder, i'm far less likely to do so.  Of course, depending on who my partner is that day, we might go off on a tangent discussing the latest Marvel movie, or SciFi TV show, or newest baking recipes...

There is a book by Fred Brooks called "The Mythical Man Month". It has many essays about programming, but the title refers to the concept that (people) x (hours) is linear - it's not always.  The classic example is "Nine women can't make a baby in one month".  On the other hand, sometimes talking through a problem sparks ideas.  I have often struggle with a problem for an hour (or more). Finally, I decide to go talk to a colleague.  I may not even get the problem halfway explained, when the solution pops into my head. Had that person and I been working together all along, talking through it, it's possible the solution comes in 10 minutes instead of an hour and ten minutes later.  Speaking engages a different part of your brain, allowing for other connections and leaps of logic to happen.

Is it guaranteed?  no.  Can pair programming be done wrong and slow things down? yes.  But if done right, it can be wonderful
1 month ago
I think your problem is here:

your loop says "print each character, followed by a dash"

but it seems like you don't want to do only want to print a dash if there is another character left to print.  So, you need some kind of condition around the printing of the dash.  Can you think about a way to determine if there is another character still?
1 month ago

Tim Holloway wrote:A web service???

That's DEFINITELY overkill here.

I was not seriously suggesting anyone take that approach.  My (apparently poorly made) point was that there is not a single, right way to do it.  There are many, many ways to solve this problem, and those were just some of the first few that came to mind.
1 month ago

Mui Goku wrote:So I have to first know about regular expressions to solve this problem?

No.  A regular expression (or "regex") is ONE way to solve this problem, but there are plenty more. Campbell pointed out one, where you iterate character by character.
You could build every possible substring with a couple of loops, and test each to see if each is numeric, and if so, save the largest.
You may be able to find a webservice call that does exactly what you want, and all you'd have to do is connect, pass the string, and get a result.  (this is unlikely to exist, but is theoretically possible).

Remember that programming is not about typing, but about thinking. Think about how you, personally, with pencil and paper, would tackle this problem. Break it down into steps, then break each of THOSE steps down into simpler steps...and keep repeating this until you have a very detailed list of directions. THEN start trying to covert that into code.
1 month ago
my thoughts on the original question is that like many things, some people value it more than others.  Cars, wine, art, time...everyone puts a different value on things.  The trick (in this case) is to find a company/manager who values your experience as much as you do.  That is by no means a trivial task, but i don't think it an impossible one.
1 month ago

Dave Tolls wrote:
The final jn the parameter just means you can't reassign the variable to a new object.
It doesn't mean you can't change the internal values of the object.

Thanks. it's amazing what you can forget after 10 years of not using something.  
2 months ago