Sodabread 88 Posting Whiz in Training

It depends on how you want to use the input. Do you want A1 to do one thing and B1 to do an entirely different thing, or do you want A to do one thing, and B to do another, or 1 to do something in addition to A and B, and 2 to do something different in addition to A and B?

Psuedo:

get input

if(input_character == "a1")
     do something
if(input_character == "b1")
     do something else

or

get input

if(input_character == "a")
     do something
if(input_character == "b")
     do something else

if(input_number == "1")
     do something in addition
if(input_number == "2")
     do something else in addition

Also, can the user input more than 1 character or more than 1 number in the same input? That can change how the program needs to work.

Sodabread 88 Posting Whiz in Training

It's kind of amazing, seeing so many people reply with the same answers that the current education systems are somewhat borked. I'm curious as to how many of the repliers are teachers, besides Ardav. Normally I see people furious that teachers get paid too much to "babysit" their kids and how their salaries should be cut and their pensions taken away and other numerous punishments.

JWenting, I couldn't agree more with your idea on low-skilled labor, or even regular skilled labor. There's actually an alternate high school in my area that people can go to learn "technical skills" like auto repair, woodworking, hair styling, metalworking, etc... I think the kids that don't want to learn typical high school classes like English and math could benefit greatly from more schools like that which focus on trades rather than college prep classes.

Vernon, it would be all fine and good to have 5-year moving averages for teachers' salaries if that's what the educator expected going into the position, like real estate or commission based retail. But to go from a set salary to performance based could have disastrous results for teachers in under-performing schools and could even go so far as to pushing them out of education for a higher paying business job. What would happen to the teachers that are already in low paying districts that get hit with salary cuts because they're in charge of general level classes full of students who just don't care?

Sodabread 88 Posting Whiz in Training

I'm hoping to be there. It's only about 60ish miles from my house to Jersey City. I just hope I can get a parking spot in Journal Square on a weekday =\

Sodabread 88 Posting Whiz in Training

Thanks Sodabread that did help :)

Glad to be of service =)

Sodabread 88 Posting Whiz in Training

Here's an example for first web apps, then Windows apps.

string str = new string(((Button)sender).ID);
string str = new string(((Button)sender).Name);

Hope that helps.

Omar123 commented: That fixed my problem, thanks +0
Sodabread 88 Posting Whiz in Training

Cast the sender object to a button and check the ID.

Sodabread 88 Posting Whiz in Training

You have to show us that you've put some effort into it before anyone will help. What exactly are you having trouble with?

Sodabread 88 Posting Whiz in Training

Anyone going to NYC for Internet Week? I'm thinking of taking a day off of work and heading into the city to check it out.

Sodabread 88 Posting Whiz in Training

I know of no one who eats the seeds intentionally.

I'll do it for a dollar.

Sodabread 88 Posting Whiz in Training

I'm not watching much live right now besides 24, but my favorite past shows have been such classics as The Office (original), The IT Crowd and Scrubs (haven't watched the new Scrubs, and I'm not sure if I want to). Oh yeah, and the cartoon Adult Swim stuff.

Sodabread 88 Posting Whiz in Training

Steelers >> Thief

(Yes, I know it's not stealers.)

Sodabread 88 Posting Whiz in Training

It really comes down to what you want to do with programming, I'd say. Do you want to make games? Go with C/C++. Want do develop web applications? C#/Perl/Ruby/PhP, there's a lot to choose from here. Want to write embedded apps? Desktop apps can be developed with just about any language out there. Find out what's available where you are and go from there if you're not picky about what you learn.

Sodabread 88 Posting Whiz in Training

Good catch, Mit.

Tally, what compiler/IDE are you using?

Sodabread 88 Posting Whiz in Training

Your switch statement is looking for selection to correspond with a number:

switch(selection)
{
case 1: doSomething()
    break;
case 2: doSomething()
    break;
case 3: doSomething()
    break;
}

This should be:

switch(selection)
{
case 'T':
case 't':
    doSomething()
    break;
case 'D':
case 'd':
    doSomething()
    break;
case 'A':
case 'a':
    doSomething()
    break;
}

Because your switch is actually checking for a number for the case, it's never actually falling into the case, and instead falling out and back into the do...while loop.

Sodabread 88 Posting Whiz in Training

Are they still working on that supposed Internet 2 so that they can have another international network for research? I heard something of the sort from a networking teacher a couple years ago. By Internet 2, I don't mean web2.0.

Sodabread 88 Posting Whiz in Training

Agreed all around. I need to start posting other suggestions with my solutions =\ My bad.

Sodabread 88 Posting Whiz in Training

Try:

IntegerSet(int a[]);
Sodabread 88 Posting Whiz in Training

*sigh* I'd love to say this is a surprise, but I'd be lying if I did. With the amount of phishing scams that go on with Facebook, it makes me wonder how this country ever accomplished anything with (what seems to be) the average person being such a frickin' moron.

Sodabread 88 Posting Whiz in Training

I don't know if this would be how you want to do it, but my team in school ordered all variables by byte order, largest (long, double) to smallest (char, bool), followed by variable size (strings, containers, etc...). I'm not sure if it really made a difference in compile times, but it was organized nicely.

Sodabread 88 Posting Whiz in Training

Hmm. Maybe it's because your parameters don't actually have any values in them?

Sodabread 88 Posting Whiz in Training

1. Use code tags.

2. What's the error you're getting?

Sodabread 88 Posting Whiz in Training

Sure.

ASP code:

<asp:Panel id="pnlValidate">
<asp:Textbox id="txtTest">
<asp:Button Text="Save" id="btnSave" onClick="btnSave_Click">

C# code:

protected void btnSave_Click(object sender, EventArgs e)
{
    // Only process the page if the form validates
    if(ValidateForm())
        { processPage... }
}

protected bool ValidateForm()
{
    // Set the return value to true to start
    bool isValid = true;

    if(txtTest.Text == null || txtTest.Text == string.empty() || txtTest.Text == "")
    {
        // Return value should now be false because the field was required, but empty
        isValid = false;

        // Create a new label
        Label errorLabel = new Label();
        errorLabel.Text = "Test is a required field!"

        // Add the label to the panel's controls
        pnlValidate.Controls.Add(errorLabel);
    }

    return isValid;
}

Obviously this example doesn't take care of your exact situation, but it's quite easy to adapt it to checking multiple fields in an if statement. It also may help that if you use this method, to create a method that takes a string (or more) and returns a label with that string as its text. Cuts down on the code when you start adding attributes to the label.

Sodabread 88 Posting Whiz in Training

Your problem lies in the page life cycle for .NET. The process of the page load causes validation to occur, then event handlers. This causes all validate controls to be processed, then the fields are set to invalid and setting up the validate functions to be called in the next step.

The way I tend to validate fields like that is to create a separate validate function that I call from the process button. The function returns true if the form is valid to my specifications and the form is processed as it should be. If any of the controls do not validate how I want them to, I add a label control to a panel dynamically when the control is found to be invalid and set the bool value to false, which I return after all the other controls have been checked.

That process may not be the best way to do it (I'm not experienced enough to know), but it works well for me when I have dependent text/check boxes/radio buttons as well as required field/regex combos on text boxes.

Sodabread 88 Posting Whiz in Training

Try:

TextBox6.Text = dr(0).ToString

I don't know VB, so however the syntax is supposed to be I have no clue, but this is the idea.

Because you're only selecting a single field, the reader only has that field, so it's at index 0 as far as the reader is concerned.

amalashibu commented: ya,ur code works well.The error was solved +0
Sodabread 88 Posting Whiz in Training

You never know. Maybe he was looking for somewhere that has good fried chicken & apple fritters.

Sodabread 88 Posting Whiz in Training

Check out GameDev.net for some tutorials.

Regardless if the game is for yourself or for anyone else to play, you'll still need to at least critically think about the technical design of the game if nothing else. Decide which modules you want to be talking to which other modules and lay that all out. Determine what each module needs to do in its entirety. It's difficult, but it's worth so much when you actually start developing. Yes, this may change as you're developing, but changing a plan is better than not having one.

Example: You'll have to have a rendering engine. How do you want to draw everything in your game? Do you want to have rendering bins for different parts of your game (tiles, characters, objects) that each of those parts can dump a rendering object into? Or would you rather have the rendering engine call a draw function in each factory/manager class that draws all the necessary objects that it contains? How are you going to load your images? Are you going to have any parallax scrolling?

There are going to be a lot of these questions for every subsystem you create and it's going to lead you to having better code if you really plan it out. Plus, having detailed documentation can help clear your mind about what your initial goals were when you started a certain system, if it happens to become cloudy when in development. That happens quite often.

Sodabread 88 Posting Whiz in Training

Yeah, the subway system does smell pretty rank most of the time. The cars don't necessarily smell any better than the stations either. The PATH station isn't too shabby, though. That's the train that goes between Jersey & NYC.

Sodabread 88 Posting Whiz in Training

Go to The Pink Teacup for breakfast. Fried chicken & apple fritters. So good. I don't know their new address as they've moved since I was there in October, but it was one of the best breakfasts I've ever had. Also, there's a lot of really good shopping spots near Washington Square Park & NYU. Yeah, shopping is touristy, but at least it's not Times Square shopping.

Sodabread 88 Posting Whiz in Training

Agreed, J, I just realized that I didn't mention that every single detail should be documented before implemented. It's amazing that I can write so much and miss something so crucial :)

Sodabread 88 Posting Whiz in Training

Games generally work a lot more phases than just game design => code. There's concept design (treatment, high concept, general ideas, etc...), game design (character development, level design, items, backstory, serious breakdown of algorithms & gameplay systems, etc...), tech design (module interaction, coding standards, class members & functions, etc...), then code.

It works a bit differently if you're part of a team where one person can focus on the design, another on the tech and another on art, because some parts can work in tandem. As a lone developer, you have a long road ahead of you if you want to make a full game. Take it from me. I've tried to make myself believe in the past that I didn't need full design & technical documentation, then the coding progress is terrible because I didn't think things out, and the gameplay turns into a jumbled mess of non-related systems that just don't flow.

Making a game really is more about forethought than it is about actual development. Yes, coding is key to getting the project done, obviously, but the pre-development stages can make (when it's done right) or break (when it's done wrong or not at all) any game development project.

Sodabread 88 Posting Whiz in Training

Why would having intimate relations with a sheep (a favourite pastime of my fellow compatriots) and letting it "have a reward" be more of a problem than say, transporting the thing for miles in a couped up shed on wheels and then killing it before chucking its remains on the fire on the off-chance that somebody will want to take a bite out of it? The world's mightily messed up.

Let me get this straight. You're saying it's better to have "intimate relations" with a sheep than to eat it? The former is just gross and the latter is the way nature works. It's the food chain, survival of the fittest if you will. To me, the rights issues need to not revolve around trying to make humanity vegetarian, but to have animals treated ethically. It's one thing to use an animal for food, for natural survival, but it's another thing to treat them like garbage the entire time they're alive just to be slaughtered in the end, which is where the rights should be changed, in my opinion. Animals eating animals is part of nature, but a species as intelligent as we are should also be a bit more compassionate about the treatment of the living. I'm not ALF or PETA, but I do think a line needs to be drawn somewhere.

Sodabread 88 Posting Whiz in Training

We are not giving up anything -- you can't give up something you never had in the first place. I'd choose sex anytime over immortality via cloning -- see Multiplicity

Now, immortality via respawn points is a different story. Nothing like some real life Quake 3 Arena.

Sodabread 88 Posting Whiz in Training

Just for craps and chuckles, have you tried using -0.2f? It's been a while since I've worked in 3D, so I'm not 100% on which coordinate system DX uses.

Sodabread 88 Posting Whiz in Training

This could have a negative impact on the "one man band" developers, though. If more big players start pushing out games onto mobile platforms, I think many people will gravitate toward those just like they have in the PC market. There are quite a few indie game developers out there that make PC games, but most people still go for the next biggest thing from <insert dev studio here>.

Obviously, there are exceptions as with any rule. Puzzle Quest is a great example of that. I'd like to think I'm wrong and indie developers will continue to thrive and possible even beat out the big boys on the iPhone/Driod/etc.., but seeing too many small studios go down from lack of marketing dollars has got me a bit cynical about the industry.

Sodabread 88 Posting Whiz in Training

You really think that Google is doing this for human rights and not as a PR stunt? It'd be the perfect opportunity for them to pull out of China seeing as how they're at about 25-30% of the market behind Baidu at 60ish%, and they're not gaining any ground. They can just pull out and melt the public's hearts by claiming it to be on grounds of human rights, when it's just to increase their margins. Call me cynical, but I have trouble believing that Google is anywhere close to as ethical as they claim to be.

Sodabread 88 Posting Whiz in Training

1. Please remove your line numbers and use code tags.
2. We can't help you unless you tell us what you need help with.

Sodabread 88 Posting Whiz in Training

I prefer Microsoft Visual Studio, but I think that may be because it's what I learned on.

Sodabread 88 Posting Whiz in Training

As those of you who pay attention to particle physics know, particles can appear out of nowhere in a vacuum, dance around a bit and disappear again as long as the equation always = zero (or, said differently, one side is equal to the other). One of the reasons that 'they' are looking for both 'dark matter' and 'dark energy' is that they expect the universe will add up to zero. At first they were expecting to find much more anti-matter to balance the equation. Take a look at some Feynman diagrams sometime and you will see a couple of really interesting events - the one I like is that the anti-particles behave like regular particles traveling backwards in time.

Thank you, Jack. I now have a headache. I'll have to check some of this stuff out when I get home. Seems quite interesting. I've never really been into physics more than motion-based, but something like that may get me deeper into it.

Sodabread 88 Posting Whiz in Training

Interesting theory, but then there are those of us who believe the Universe came first. Like the egg came before the chicken.

How did the gas particles (if that's what you think made the universe) exist, then? Trying to contemplate how anything existed to make anything gives me a headache, so I'll let you do it for me =)

Sodabread 88 Posting Whiz in Training

Well, with the advent of Google Apps for Business, and Microsoft's attempt at Google Docs (Office Online), it looks like all the big players are making a move to cloud hosted services. Even as far as jobs at a client go, desktop support techs will take a hit seeing as how a network administrator can easily re-ghost a computer. There's nothing really to support if all major applications (Word, Excel, Outlook, etc...) become web-based & cloud hosted. All that would be left is IE, which is impossible to support anyway, so why hire someone specifically to do it?

Sodabread 88 Posting Whiz in Training

Hi guyz,
could anyone please assist me with a code to load an image bmp, pln etc in C++. I'm using OpenGL Library. Please assist, in dire need.

Joel

Here's a thread with a code snippet I put up a while ago. This will work for .bmp files at least to get you started.

Anything else, you should be able to find on Google. Also, you can check out nehe.gamedev.net, which is an excellent OpenGL tutorial site. You can find some other tutorials on www.gamedev.net too.

Sodabread 88 Posting Whiz in Training

In order for the religious community to accept that god made the universe 6,000 years ago, they have to waffle around the fact that god would have to be a liar. He would have had to lie by creating an artificial age to the universe and the earth. And once you go down that road, then you might as well say that he created the universe 10 seconds ago including our memories etc. There is not way to prove or disprove either proposition - a 6000 yr old universe or a 6 second old universe so Occam's Razor says the universe is what we discover it to be.

I wouldn't so much as say that he'd have to be a liar, as all his creation wasn't started at day 1 of its life. Like someone stated in the thread Dragon linked to, Adam was created in manhood, not as an infant. Still, 6000 years is a very difficult pill to swallow and I'm much more inclined to believe the "days" stated in Genesis were metaphorical, rather than literal (I'm Christian, but not illogically so). Or rather, as discovered by Douglas Adams, our race is descended from humans from another planet, with silly jobs like hair dressers & telephone sanitizers.

Sodabread 88 Posting Whiz in Training

An interesting and mind-boggling thread. When God created the universe 6,000 years ago He made it look like the universe was 16 billion years old. Yea, right :)

At the risk of sounding fanatical, how do you know? I'm not saying that I agree that the universe is only 6k years old, but from a religious standpoint, God being all-powerful could have made Earth, the universe, physics, science, everything give humanity (and any other intelligent life elsewhere in the universe) the exact answers we've found. Not saying I believe that either, but it's an interesting view of religion explaining science rather than science attempting to disprove religion. Ultimately, I think that both science & religion are two fields of thought that humanity will never completely understand.

Sodabread 88 Posting Whiz in Training

You'll see stuff like this happening somewhat often in the game industry as many times. The developer is given a schedule from the publisher, who may not always have a firm grasp on how long things take to get done. Or they do and they don't care. Sometimes it's the developer's fault too (in any industry) for slacking off and/or not having the right type or right amount of people. There's too many factors to really say anyone's screwing anyone unless you really know the companies involved.

Sodabread 88 Posting Whiz in Training

All the points on cloud computing are good and I think i'm in agreement with what I see as the two main points: one- you don't own your data, and two- you lose internet and your employees are on vacation.

But i want to make a point on a different aspect of web applications. I am a hobbyist who likes to write applications, particularly games and such, and share them with a wide variety of people, many i only know of through the web. Getting people to download applications is typically harder than getting them to click on links. Also i can update my applications daily even, and they just click on todays link, which has a version number in the url. Also my code is now platform independent for the most part and people on different operating systems use it. Now i'm using java and i could accomplish this in stand alones, but from what i've heard its not as trivial though i could be wrong. A fellow i know distributing java apps said he had to compile it native ( code worked fine but required multiple computers to compile).

For these reasons i think a lot of hobbyist and student programmers, the type often on here, would benefit from applets because its easier to reach an audience and its easier to have a dynamic relationship with updates that dont require new downloads and installations.

Mike

I agree that there's great benefit in being able to update on the …

Sodabread 88 Posting Whiz in Training

This is assuming the error is coming from lines 32-37.

Your else statement is inside your if statement's braces. The error is produced by the IDE thinking there's no if statement before the else statement. It should look like the following:

if(check){
     // Do something.
}
else{
     // Do something else.
}

Also, an empty else statement serves no purpose that I know of. If you're not planning on doing any other functionality if the if statement doesn't execute, you don't need that else.

Sodabread 88 Posting Whiz in Training

Everything goes via https, so it is quite safe.

That's only effective via the internet for the most part. A lot of internal applications aren't written using HTTPS, and an internal attacker could compromise a web app a lot easier than a client app, at least with available attack information that I can find. I'm not much into security yet, but I do know some basics and so far it seems web application attacks are much easier to perform by savvy disgruntled employees.

By the way, wasn't a bug found recently in most browser implementations that allowed spoofing of certificates? I don't know if it's fixed yet, but that goes to show that HTTPS isn't a cure-all.

I agree, though, that downtime is one of the main killers of using the "cloud" (I hate that word now). For businesses, an internet outage requires the company to act on their disaster recovery plan because they would have zero application access from the business location if there was no connection redundancy.

For your last point, I'd think most CIOs/CTOs would be less worried about costs going up and more worried about no longer "owning" their data. When the data is in the hands of a third party and that third party goes belly up, and has an immediate shut down of services, how long will it be until you have access to the data that was being hosted there? It's a scary thought to not have the info your …

Sodabread 88 Posting Whiz in Training

I just read an article on The Register about Google Chrome OS introducing a new ActiveX style plug-in (Native Client) that allows the browser based OS to run native code and it just got me thinking. Am I alone in thinking that running *everything* on a browser isn't such a good idea? It seems like all these web 2.0 people are going nuts about cloud this and web application that, but I'm a bit hesitant to buy into all the hype.

From an ease of use standpoint, I can see the benefits of running business apps via the web, but from a security standpoint, doesn't it just add another layer of vulnerability with having the browser as an application with holes and the actual LOB application having different holes? I know the developer should be security minded, but there's no such thing as a 100% secure application. Plus, being a hobbyist game developer, I'm afraid WebGL won't compare to DirectX/OpenGL in terms of performance and graphics capabilities. I could be wrong, though.

Do I actually have a basis for my hesitance, or am I just trying to hold on to client apps with too hard a grip?

Sodabread 88 Posting Whiz in Training

The way I see your problem, it can be read in two ways. First, either you're not sure how to work with returned variables, or you're misunderstanding what return actually does.

1st understanding:

You need to catch the return from exitFailure and do something with it.

inFile.open(inputFilename, ios::in);
if (!inFile) 
{
	cerr << "Can't open input file " << inputFilename << endl;
	return exitFailure();
}

or

inFile.open(inputFilename, ios::in);
if (!inFile) 
{
	cerr << "Can't open input file " << inputFilename << endl;
	int retCode = exitFailure();
	return retCode;
}

2nd understanding:
Using return only exits the application if you're returning it from main(). If you use return in another function, it's going to return to the function that called the second.

int exitApp()
{
    return 1; // Returns 1 back to main
}

int main()
{
    exitApp(); // Call exitApp function
    
    return 0; // Exits the application and returns 0 to the OS's application layer (don't quote me on that)
}
Ancient Dragon commented: Nice explanation :) +25
Sodabread 88 Posting Whiz in Training
CPotion p2 = *(a.items_[0]); // error: conversion from ‘CItem’ to non-scalar type ‘CPotion’ requested

Don't forget you have to cast your item back to a potion. There are better ways to do this than the way I'm going to show you, as I'm still stuck being a hybrid C/C++ programmer.

C:

// if you want a pointer to the object
CPotion *p2 = (CPotion *)a.items[0];

// if you want the actual object 
CPotion p2 = (CPotion)*a.items[0];

C++:

CPotion *p2 = dynamic_cast<CPotion *>(a.items[0]);

I think that's how the C++ version works. I've never actually used it. I'm beginning to think my school didn't have it quite figured out when they taught us C++.