Sodabread 88 Posting Whiz in Training

The answers, as always, is: it depends. Databases are often times best with online/browser based games, but Flash, I believe, can write save files to the computer on which it's being played. I don't work with Flash, so I'm not 100%.

In single-player, offline games a save file would probably be the best, as you don't really want to install a database instance for your game. I can't say I'd be ok with someone installing SQL on my machine just to save a game. Although, you can do a persistent/occasional network connection (which puts it in the online game category) in order to write the data to a database on your end.

Figure out what you want your game to be and how the player should be able to play it and you'll most likely have your answer.

neartoyou commented: Good analysis +0
Sodabread 88 Posting Whiz in Training

Check this page out to see if it helps you any: here. You should be able to drag your "guy" movie clip onto a newly created movie clip, then drag that one from the library onto your stage. Hope that helps.

Sodabread 88 Posting Whiz in Training
Sodabread 88 Posting Whiz in Training

Num is never going to equal 0 once you start adding to it. I'd say set another variable to int.Parse(Console.ReadLine()) then add it to num after checking if it's 0.

for (int i = 1; i <= 10; i++)
{                
   Console.Write("Enter the number:");               
   int x = int.Parse(Console.ReadLine());                 
   if (x == 0)                    
      break;
   num += x;           
   counter++;            
}
Sodabread 88 Posting Whiz in Training

3D Studio Max is that application, but it's $3600, I think, for a single license. There's another application that can do it, based on that linked thread, but it requires a valid 3DS license on your machine.

Your only other option seems to be using a combination of MilkShape & gmax.

Sodabread 88 Posting Whiz in Training

If you have 3DS Max, you can export it as a .obj from there. If not, check here for some more detail: gamedev.net

Sodabread 88 Posting Whiz in Training

For C-style file i/o, look into FILE *s and how to use them.

For using pointers with functions, write the function so it accepts a pointer and pass a pointer one of a few ways:

void stuff(int *x)
{
   *x = 4;
}
int main()
{
   int x;
   int *y;

   stuff(&x);
   stuff(y);
}
Sodabread 88 Posting Whiz in Training

It's cool. It always just seems that non-native english speakers get almost every other word right except 'please'.

Best of luck and welcome to DaniWeb =)

Sodabread 88 Posting Whiz in Training

1. The x variable doesn't exist in the change function. The function should accept an int reference if you want to change it in the func, then pass x in.

void change(int &x);
int main()
{
   int x = 4,y;
   ...
   change(x);
   ...
   return 0;
}
void change(int &x)
{
   x = x + 4;
}

2. YOU write C programs to do all that stuff, come back with actual questions and we'll do what we can to help.

Also, for future reference, post the errors you're getting with your code. The more you do to tell us what your issue is, the more likely we are to help you. Oh, and "plz" isn't a word.

Sodabread 88 Posting Whiz in Training

It can be saved as an exe, and there's also a web player build format, but I'm not too familiar with what that actually is.

Sodabread 88 Posting Whiz in Training

Yes, you can import other models into Unity.

I agree with Roswell too. There's a lot of tools out there to help you achieve what you want to do, I just speak about the ones I specifically know of.

Sodabread 88 Posting Whiz in Training

It all depends on how much work you want to do and/or how much time you want to spend learning something else.

If you want something up and running super quick, I think Unity would be your best bet, but Torque can still get the job done. Unity has a full on 3D editor which will allow you to build your house layout in the editor, and compile that as your application, then just walk through it. I haven't used it much, but I believe that's how it could work for a simple application like you have.

Ogre3D is purely graphics (and comes with OIS, which is used for input), which will work, but you'll need to build your house layout in another application (such as Blender or Milkshape) and load it into your application. You can find plugins for popular 3D applications which will allow you to export your objects directly to the .mesh format, which is what's used in Ogre.

As far as what you're looking to do, I think Unity or Torque would honestly be your best bet to get something up and running super quick. Check them both out & decide what you like best.

Hope that helps.

faroukmuhammad commented: Awesome explanation +2
Sodabread 88 Posting Whiz in Training

They don't need to "get into the protocol", whatever that means. All they need to do is pull the right strings to get the host to shut the site off. Not much can be done to defend against that.

Chances are, happygeek is correct and the EDL just sucks at the internet.

happygeek commented: correct :) +0
Sodabread 88 Posting Whiz in Training

For an easy library to get up and running, check out Ogre3D for graphics.

If you're looking to do even less work, you can check out Torque & Unity, as they're fully featured game engines, so you can just add your geometry (walls, floors, ceilings, etc..) and build and run.

Sodabread 88 Posting Whiz in Training

You're incrementing 'i' before you print it out, so it's grabbing the width value of the next, uninitialized block.

blocks.Position[i] = new Vector2(width, height);
Console.WriteLine("Block#"+i+" Width: "+blocks.Position[i].X+" Height: "+height);
i++;
Sodabread 88 Posting Whiz in Training
public partial class Server

All code behind classes that match up with a .aspx page have to be partial classes. The page itself is part and the code behind is part.

Sodabread 88 Posting Whiz in Training

Re-reading your code, I'm thinking you want multiple structures, but correct if me I'm wrong.

You have products which have stock, price, sold... actual data.
You have a product type, such as shampoo, soap, tortillas, etc..., which have multiple products.

In the most basic sense, I think you could do something like:

struct product
{
    string brand;
    int stock;
    int sold;
    float price;
    // Other items that pertain to a product
}

struct productType
{
    product items[10];
    string name;
    int numOfProducts;
}

int main()
{
    productTypes inventory[10];
    int numOfTypes;
    cin >> numOfTypes;
    for(int i = 0; i < numOfTypes; i++)
    {
        cin >> inventory[i].numOfProducts;
        for(int j = 0; j < inventory[i].numOfProducts; j++)
        {
            //Take input for specific items
            cin >> inventory[i].items[j].brand;
            cin >> inventory[i].items[j].stock;
            ...
        }
    }
}

You should be able to figure out how to do the input using this method.

I think this is what you aimed to accomplish, but forgive me if I'm wrong.

Sodabread 88 Posting Whiz in Training

Input is only a single structure, so every time you input new data, it's overwriting what was previously there.

You can remove the "input" after your struct declaration and create an array of inventories in main, then apply the input to the specific product number that is put in.

Sodabread 88 Posting Whiz in Training

The easy answer is physics & "soft" targeting. Apply your x/y/z acceleration to the object, having it move toward the current node/point/target and once it gets within a pre-defined distance to that target, set it's new target to the next point and accelerate the object toward that new target. This should give a smooth transition, as long as you're not using a pure xVelocity = 2.0 type statement, but positive & negative acceleration.

Sodabread 88 Posting Whiz in Training

Yes, Excel should be able to be used as a "database". See www.connectionstrings.com.

Sodabread 88 Posting Whiz in Training

Change myMark[count].grade to myMark.grade.

Sodabread 88 Posting Whiz in Training

I don't know what your input is, don't forget that a character comparison is case sensitive. If you're entering "c" from the console, it won't match a grade of "C". You can use character arithmetic based on the ASCII table to determine whether input is lower or upper case and rectify it if it's not what you want.

Sodabread 88 Posting Whiz in Training

Check your if statement. Your comparison is not a comparison, but an assignment. A single = is assignment (int y = b), whereas a double == is comparison ( if(x == 5) ).

Change that if statement and let us know what happens.

Also, the sizeof(myMark) / sizeof(markRec) line is figuring out the count of records in your array of markRecs.

Sodabread 88 Posting Whiz in Training

Try: RequestedExecutionLevel level="requireAdministrator"

First link on Google with "C# run app as admin" yielded this.

Sodabread 88 Posting Whiz in Training

You have a few choices in databases. I recommend, as Chris does, that you get SQL Server Express. It's very easy to install and get up and running.

MySQL is also a good choice as it's free, open source, and works very very well, but the initial configuration can be a pain sometimes.

The last I would recommend, which is only a recommendation if you have MS Works or Office, is MS Access. I don't like it, in fact I hate it, but it's still usable and it's simple to setup new databases.

As for how to get another person to use your database enabled application, you'll have to make sure the other person has your choice installed, and build SQL scripts to set up the database in their installation. This is why MS Access is advantageous, as you can just ship that .mdb file with the executable and you're good to go, although the file can be changed rather easily.

Sodabread 88 Posting Whiz in Training

They look good to me. Check this page out for a rundown of the ASP.NET page life cycle so you can get a good idea of what happens when: http://msdn.microsoft.com/en-us/library/ms178472.aspx

Sodabread 88 Posting Whiz in Training

Eric's link is definitely a good one to start with. I would also recommend that you check out www.connectionstrings.com for when you're trying to figure out how to connect to your specific database. If when you're implementing your database stuff you have any questions, stop back and I'm sure many here would be glad to help out.

Sodabread 88 Posting Whiz in Training

For starters, gamedev.net is one of the best game development sites on the net. Lots of good tutorials and help there.

C++ is extremely widely used in game development for professional games for both PC and console. C# is also good, but its main benefit is the XNA framework which is Win/XBox only. There's also Java, Flash and Python which have some good game related frameworks. My personal favorite dev language is C++, because that's my first language and holds a special place in my heart. It's also damn powerful.

Sodabread 88 Posting Whiz in Training

Wow, am I blind. I completely missed that >< Sorry about that.

Sodabread 88 Posting Whiz in Training

This might be a long shot, but have you tried

using System.Data.SqlClient

That's where the SqlConnection type resides.

Sodabread 88 Posting Whiz in Training

Ok. Here's one possible solution. Hopefully this will help a little bit. What you want to do is pass in the int[], as well as an out variable to put in either your run count or the final index of the longest run.

static public int Function(int[] table, out int count)
{
    int counter = 0; // The current count of the run
    int finalCount = 1; // The highest run count
    int lastValue = 0; // The value of the previous array index - can also use [i-1]
    int finalIndex = 0; // The final index of the run
    for (int i = 0; i < table.Length; i++)
    {
        if (table[i] == lastValue) // If the current index matches the last value
        {
            counter++; // Current run increases
            if (finalCount < counter) // Final count should only be changed if less than the current run count
            {
                finalCount = counter;
                finalIndex = i + 1; // Current index is end of current highest run and accounts for base 0 indexing
            }
        }
        else
        {
            counter = 1; // Not a match, so the current run is now 1
        }

        lastValue = table[i]; // Set the lastValue to the current index
    }

    count = finalCount; // Set the out variable to the current count
    return finalIndex; // Return the last index of the highest run
}

With this method, you'll be able to take the final index, subtract the run length (out variable), and get the initial index.

I hope that all makes sense.

Sodabread 88 Posting Whiz in Training

Make sure you're taking it in as a System.Web.UI.WebControl or System.Web.UI.HtmlControl, whichever it is. If you've tried this already, post some code so we can have a better understanding of how you're doing what you're trying to do.

Sodabread 88 Posting Whiz in Training

Have you tried OnSelectedIndexChanged? Don't forget to check Google too when you have questions, as this is one that's got gobs and gobs of information out there.

Sodabread 88 Posting Whiz in Training

Ah, good. For a lot of your issues you may find that just running your app in debug (F5 to stop at the first breakpoint or F10/F11 to step through from the beginning) will help you find those small errors. Learning the debugger is HUGE in development rather than just trying to guess what you did wrong from the output it gives you.

Sodabread 88 Posting Whiz in Training

Ebay, does the compiler/IDE you're using have an integrated debugger?

Sodabread 88 Posting Whiz in Training

The better thing to do would be to let us know where you get stuck so we can help you *learn* specifics, rather than just getting a finished product and plugging that code into your project. I'm not saying that's exactly what you'll do, but it seems to be a habit of many around this site.

Sodabread 88 Posting Whiz in Training

As said by a shirt on ThinkGeek, In order to understand recursion, one must understand recursion.

Honestly, I think it's much easier to explain in pseudo code than actual code.

Directory dir = <location>
call renameFilesInDir(dir)

function renameFilesInDir(Directory dir)
    
    foreach(file f in dir)
        rename file

    foreach(directory d in Dir)
        renameFilesInDir(dir)

end

The directory ("C:\" as an example) is created, sending that down into a function. The function does its renames the files, then calls itself for each directory in the root directory. The subsequent call(s) treats the passed in dir (let's use "C:\Windows") as the root, then loops through that entire directory, performing the same exact steps; it renames the files, then calls the function once again for each directory that is in C:\Windows.

In this example, the function will continue to do this until it gets into a folder which has no more folders, so the renameFilesInDir function is not called, the function goes back to the previous call and calls the function again for the next Directory in dir.

Call 1:
dir = C:\

Call 2 (from C:\):
dir = C:\Documents and Settings\

Call 3 (from C:\Documents and Settings\)
dir = C:\Documents and Settings\User 1\

No directories in User 1
Fall back to Call 2

Call 3 (from C:\Documents and Settings\)
dir = C:\Documents and Settings\User 2\

No directories in User 2
Fall back to Call 2

No more directories in Documents …

jonsca commented: Good explanation +4
Sodabread 88 Posting Whiz in Training

Well, some code tags & code formatting would help us help you. It also helps to know what your error is.

Regardless, I'm going to assume that the compiler is spitting back an error saying that it's throwing back that ave needs a different type of variable passed into it. With that guess (however wrong it may be), ParentsAge itself is a pointer (as are all arrays). Just pass ParentsAge instead of &ParentsAge.

Sodabread 88 Posting Whiz in Training

You never initialize score. If you don't initialize or assign a value to a variable, it's filled with crap. No one likes a crap filled variable. No one.

Sodabread 88 Posting Whiz in Training

Well, here's one way you can do it. I'm not sure on the efficiency in general, but it will clean up the code a little bit and make it look pretty =)

static int main()
{
    List<List<string>> listList = new List<List<string>>();
    
    for(int i = 0; i < numLists; i++)
        listList.Add(new List<string>());
    ...
    if(ListsHaveVals(listList) == "")
        ...
}

private string ListsHaveVals(List<List<string>> listList)
{
    StringBuilder str = new StringBuilder();
    int counter = 0;

    foreach(List<string> li in listList)
    {
        if(li.Count <= 0)
        {
            str.Append(counter.ToString());
        }
        counter++;
    }
    return str.ToString();
}

Not sure if this fits your requirements, but it makes it easier if you need to change the number of lists. This way it will stay dynamic so you can have 3 lists for 40 lists and it will still work.

Sodabread 88 Posting Whiz in Training

What have you tried so far?

Sodabread 88 Posting Whiz in Training

That I'm not too sure about. You may want to mess around with the points/dimensions a little bit to see what fits your requirements but mostly what works. You may be able to search for the ratio between application coordinates and actual distance. Print something out, see where it lands on the piece of paper, put the paper back in, oriented differently and try again. There's got to be a way to do it without trial and error, but I don't know how.

Sodabread 88 Posting Whiz in Training

The reason for your error is that your permutation process stops as soon as your elements are in reverse alphabetical order.

When your code permutes "b", "c", "a", it swaps to cab, then cba, then your first while loop in the permute function determines that b ([1]) is greater than a ([2]), then subtracts from j (now 0), then determines that c ([0]) is greater than b([1]) and once again subjects from j (now -1). The negative one causes the loop to end and the func to return false.

One solution to this is to sort the input into alphabetical order, then do the permutations and that should work for you.

Sodabread 88 Posting Whiz in Training

http://msdn.microsoft.com/en-us/library/6he9hz8c.aspx

That link should get you to where you could print out the actual form.

As for printing an actual form-like document from an application, there are a couple ways that I can think of to do it, both probably being inefficient as I'm not that good at C# yet.

First, you can design the form in another application like Publisher or InfoPath. Print that out and use that as your paper for printing out form data from your actual form application. It may take you a while to nail down your positioning, but it would work. I know medical offices have applications that do something like this as HCFA forms are done this way many times.

Second, you could spend some time designing the form using the printing framework.

void PrintDoc_PrintPage(object sender, PrintPageEventArgs e)
{
    e.Graphics.DrawLine(new Pen(Color.Aqua, 2.0), new Point(5, 3), new Point(10, 6));
    e.Graphics.DrawRectangle(new Pen(Color.Azure), 250, 65, 20, 15);
    e.Graphics.DrawString(textBox.Text, new Font("Times New Roman", 12), Brushes.Bisque, 250, 65);
    ...
}
jonsca commented: Good advice +4
Sodabread 88 Posting Whiz in Training

Have you tried just Googling "C# Printing"? Seems there's a lot of good results from that.

Sodabread 88 Posting Whiz in Training

You can also create the array a after the input of the range as

int a[range]

.

Not exactly. You'd need to use new if you're doing it that way.

int *a = new int[range];
Sodabread 88 Posting Whiz in Training

What's happening is that in your for loop, you're looping while i is less than range. In your loop, the i++ is executed at the end of every loop, so when you put in your numbers, the i variable is being incremented one more time. If you put in a range of 4 and 4 numbers, the i variable ends up being 4 after the for loop. When you try to access a[4], it's producing that number because it's filled with crap as there's no value assigned to it and it wasn't initialized to anything.

Sodabread 88 Posting Whiz in Training

Check out this snippet: http://www.daniweb.com/code/snippet217084.html

Take that information and do a tad bit of research on regular expressions and you should have your answer in no time.

Sodabread 88 Posting Whiz in Training

You're getting hit by an unexpected case of the recursions!

int sqrt(int num){
	MyException excp("number is not perfect square");
	cerr <<"got Here!";
	double d_sqrt = sqrt(num);
	int i_sqrt = d_sqrt;
	if ( d_sqrt != i_sqrt ){
		throw excp;
	}
	return sqrt(num);

}

Your exception isn't causing any issue here, but you do continue to call your sqrt function over and over and over again. It keeps printing out your cerr because the function is being called by itself every time it gets into itself.

Sodabread 88 Posting Whiz in Training

Good catch, void. I think I need to up my C# knowledge a bit.