Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
_aaron
Jul 24, 2007
The underscore is silent.
This is more of a general practice question instead of specific code stuff, but I assume this is an okay spot for it.

I have some user input that needs to be validated. This input will be stored in member variables in some model class. Is it better to call a validation method that will return a bool based on whether the data is valid, or should I throw an exception from the member variable's setter method? Basically this:
code:
if (validate(someData))
   myObject.SetSomeValue(someData);
or
code:
try {
   myObject.SetSomeValue(someData);
} catch (SomeException) {
   // handle something
}

Adbot
ADBOT LOVES YOU

_aaron
Jul 24, 2007
The underscore is silent.
I want to make an RSVP website where people can log in with a username and password and indicate whether or not they will be attending an event as well as how many others they will be bringing with them. I've never really done web work before, so I don't know where to start on something like this. What language(s) should I use? I will also need some kind of database; what's easiest/most useful for something like this? If I could just get pointed to a few tutorials, that would be great. Thanks!

_aaron
Jul 24, 2007
The underscore is silent.

tripwire posted:

genetic algorithms stuff
This doesn't really answer your question, but I'm curious. From your explanation, it seems like what you want to do is evaluate the same population on multiple processors, and each evaluation has the potential to select a different "loser." If that's the case, why not just evaluate it once and choose however many random losers you want? I may be missing something fundamental here, so go easy on me if I sound like a retard.

_aaron
Jul 24, 2007
The underscore is silent.

tripwire posted:

Lets say I have reference_pop, and I do a bunch of ticks on 3 different cpus, ending up with result1, result2, result3.

If result1 has 4 new guys, that means compared to reference_pop its also MISSING 4 guys; however it might be missing a different set of people than result2 is; or they both could have removed exactly the same guys; or they both could have removed SOME of the same guys, but other different ones.

My unified population at the end somehow has to have the same number of people, so I even if I remove everyone who was removed in any of the results I still won't have enough room for all the new guys who replaced them (between the different resulting populations, some of the removed dudes overlap, but none of the new guys should overlap).

Do the "individuals" in result1, result2, and result3 still have a fitness value associated with them at the point you want to merge your stuff? If so, you could merge the three populations, remove non-unique members, sort the remainder by fitness, then trim from the bottom until you get down to your correct population size.

The big issue I can see with this is that it won't guarantee that a loser removed on one CPU won't be re-added to the population. But the only way that would happen is if there were a significant number of worse members from the other CPUs.

This terminology is getting a little confusing, so if you want me to try to clarify anything, just ask.

_aaron
Jul 24, 2007
The underscore is silent.

DLCinferno posted:

You could do it the same way any other application finds out the internet is down: try to access an internet resource.

I'd just try to ping google.com every 30 seconds or something. If you don't get a response, maybe have a list of other major sites to try just in case google is down for some crazy reason. If after 5 tries you still don't get any responses you can probably assume it's down.
I can't remember the name/address of it, but isn't there some site setup with this as its sole purpose?

_aaron
Jul 24, 2007
The underscore is silent.

Look Around You posted:

Hey guys, I was wondering where I could find some programming exercises for someone who's had a few college courses in programming but hasn't taken any courses in it since then and wants to get back up to speed and get better at various languages. I've had Intro, Discrete Math, and Data Structures, all passed with B+'s or higher, but I stopped because a medicine I was taking kinda put me in a fog and made it harder to work on math and logic. I'm thinking of possibly getting a minor in CS to get background in case I want to work as a programmer (I would try to get an MS in this case), or in case I just wanted to keep programming as a hobby.

The short version is I'm looking to pick programming back up and need some things to do. Also, I'd like to learn some GUI frameworks if there's anything on those (Cocoa, GTK+, etc.).

Thanks!
http://codingbat.com/ is a good site for just really simple Java exercises. You run them right in the browser, so it's very easy to fly through a bunch of them without having to worry about setting up an IDE. You'll need to learn that eventually, but for just getting your feet wet, this is a good starting point.

After that, maybe try some problems at https://www.projecteuler.net. It's a bunch of math problems that you solve by programming.

_aaron
Jul 24, 2007
The underscore is silent.

thevoiceofdog posted:

factorial stuff
Think about how you would solve this problem on paper. Pretend you had to find the value of 10!. You probably wouldn't write out "1x2x3x4x5x6x7x8x9x10" and then solve it in one big step. You'd more likely take 1x2, then multiply that result by 3, then multiply that result by 4, etc. So you're cycling through all of the numbers and updating a running total each time. I don't want to give you code for a school assignment, but this should help you out.

_aaron
Jul 24, 2007
The underscore is silent.
I'm looking at getting a Master's degree, but I'd like to do it part-time, and online if possible. I see that the University of Illinois offers an online "Master of Computer Science" (http://courses.illinois.edu/cis/2011/fall/programs/graduate/computer_science.html). This is a non-thesis program, which differentiates it from the standard "Master of Science, Computer Science." What disadvantages would such a program entail? If I wanted a PhD in the future, would this be problematic? Would employers view MCS differently than MSCS? Is this really not a big deal at all?

_aaron
Jul 24, 2007
The underscore is silent.
Yeah, those were the types of answers I was looking for (although not really what I wanted to hear :(). Thanks for the replies.

Adbot
ADBOT LOVES YOU

_aaron
Jul 24, 2007
The underscore is silent.

Rocko Bonaparte posted:

I wondered if anybody here had opinions on any of those enterprising UML diagram/code generator tools, like Enterprise Architect. I wanted to dabble in something where I could doodle out general designs so people at work can see what crack I'm smoking, but then have it generate the code stubs so I could get right into it afterwards. I generally work with C#, Python, and C++--for example.
We also use EA at work. It's... alright. For class diagrams, it's pretty decent. As clayburn said, some things seem to take longer/more actions than you'd expect, but it gets the job done. Out of the box, code generation is not great. We end up needing to clean up all of the generated code, to the point where often it would be just as time consuming to write it manually. I believe there's a way to customize the code generation to possibly minimize the need for clean-up, but it's not something we've tinkered with. If all you want is a tool to build class diagrams, though, it's alright for that.

Sequence diagrams are another beast entirely, and I hate the way EA handles them. You have to manually draw lines, drag/drop 'fragment' boxes (things like loops or if/elses), etc. It's all done via drawing on a canvas. It tries to be smart about what you want, making assumptions about how you want the diagram laid out. But it is often terribly wrong, meaning that adding or deleting an action has catastrophic effects on the layout of the rest of the diagram. I much prefer a tool like Quick Sequence Diagram Edit. The diagram is generated from an almost psuedocode-like language. It's got its own quirks, and it's certainly not perfect, but it kills EA for drawing/editing sequence diagrams.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply