gusano79 247 Posting Shark

If you're using Visual Studio, I recommend you use its features rather than trying to make an end run around the system. This will help you avoid future headaches.

In VS2008, the "Add" submenu isn't where you add a reference. Right below it, you should see an "Add Reference..." menu option. You want that one. You can also right-click the "References" project node, and the "Add Reference..." menu option shows up there, too. And as skatamatic pointed out, the "Project->Add Reference" menu bar option also works. Any of these should allow you to add a reference to the Excel PIA.

gusano79 247 Posting Shark

Once you have an Assembly object to work with (for example, loaded with Assembly.Load), then you can call GetTypes on the assembly object to get all of the classes and structs defined in the assembly. Then you call GetMembers on each type to get its constructors, events, fields, methods, properties, &c.

gusano79 247 Posting Shark

Parallelization can be complicated. Some things can't be parallelized, and it can be difficult to extract the parallelizable parts from existing sequential code. I can't offer anything too specific without knowing what your algorithm is, but since it's an image processing job, I imagine you at least might be able to find ways to parallelize the feature-detection bits--either in detecting independent features in multiple threads, or if you can subdivide the image and work on each piece independently, that could work, too. Beyond that, we'd have to get into the details of your computation, what's independent, and what has to be shared, and how one might extract useful processes and keep them communicating effectively.

There also might be ways to improve your algorithm's basic performance without trying to parallelize it, but that would require detailed examination of your application. Have you tried running a profiler to see where your code is spending most of its time? That might be very illuminating.

gusano79 247 Posting Shark
int midpoint (int x, int y)
{
    x=2*(x1+x2);
    y=2*(y1+y2);
}

i cant run my program i think there's a problem in the function midpoint but i cant figure it out

Also, that's not how you calculate a midpoint. You should divide by two, not multiply.

gusano79 247 Posting Shark

Oh wow, L.O.R.D. has come flooding back to me... have a look at that for some inspiration; I remember it as being pretty nifty, back in the day.

You also might wander through the IF Archive; there are a lot of interesting text games and articles on game design in there. It's maybe a little different type of game than what you're looking for, but it's educational, anyway.

gusano79 247 Posting Shark

Of course, 5 minutes after I post that I fix it. *sigh*

That's usually how it works :)

What was the problem? Your solution might be useful to others who find this thread.

gusano79 247 Posting Shark

In my opinion, it doesn't matter which language you choose. The challenges and problems you will face are going to be independent of the implementation language. The major difference between languages as they relate to graphing functions will be in how you draw the graph and show it to the user. Java and VB.NET are different, but for your purposes, they're roughly equivalent.

If you're looking for a Java/VB.NET comparison, I'm sure a quick Internet search will turn up a wide variety of opinions.

gusano79 247 Posting Shark

I'm sure there are plenty of members that can help. We'll be the most helpful if you post specific questions that come up as you're working something out. For general coding questions, you'll get the best results from posting in the C# or VB.NET forums, depending on which language you're using with XNA. This forum is useful for asking game development questions that aren't specific to a particular language.

gusano79 247 Posting Shark

What are the specs on your development machine? Usually this will happen if you have a simple main game loop that doesn't check the time--it will just run as fast as possible with whatever machine it's on. If this is what's happening, then you should probably try to separate your game logic from the frame rate.

gusano79 247 Posting Shark

I've use to create this in Turboc++ 3.0
and there are four linker error
how could i fix this?

What are the linker errors? Please post them; it helps us help you faster, especially if we don't have Turbo C++ ourselves.

If I were to guess, I'd say you're missing a reference to the graphics library. I don't know how TC++ organizes things, but it'll be in a menu something like Options->Linker->Libraries. Borland might have even put in a "Graphics Library" option to make life easier.

gusano79 247 Posting Shark

{0} is the placeholder for the first argument after the format string, {1} is the second, and so on. For example, Console.WriteLine("{0}, {1}", "bleh", 53); would result in this line being written: bleh, 53 .

This is called composite formatting in .NET-land.

gusano79 247 Posting Shark

Is there any way to "clear" work space in Lua similar to the clear command in Matlab ?

There's not a built-in function to do that. Offhand, I think the simplest thing to do would be to run through the global environment, setting everything to nil . You'd have to be careful not to nuke any standard libraries you still want to have available, though--library functions are stored in global tables.

gusano79 247 Posting Shark

Hi, I'm currently learning C# and I'm currently learning how to do C# and Database's. Does anyone know why it isn't adding the data in the text boxes to the db.

Do you get any error messages when you try to run it, or does it just fail silently? I was able to get your code to run against a SQL server with my own connection string, and everything inserted fine.

A few notes:

Your connection string doesn't specify a database name. You should probably add a "Database=somedatabasename" bit in there.

You don't need a SqlDataAdapter for what you're doing here; you can just create a SqlCommand object and use it directly.

It's considered good practice to create connections in a using block, like this:

using(SqlConnection cs = new SqlConnection("connection string"))
{
    cs.Open();

    // Your code here
}

The using block automatically closes the connection for you, even if an exception is thrown. Much safer that way.

gusano79 247 Posting Shark

Hi,

I would like to know the significance of lua methods beginning with an underscore.. for example __init().. Thanks !!

The only place I'm aware of that double underscores mean anything to Lua is in metatables.

Basically they allow you to create custom behavior for certain object; it's an operator overloading feature.

For example, you create a struct or class in your C/C++ code, add it to a Lua state as a userdata object, add a Lua function to the object's metatable with the key "__add", and then that function will be called when your objects are added in Lua with the + operator. The section of the Lua Reference Manual I linked explains in more detail.

gusano79 247 Posting Shark

i replace int main...but the there are still error....i really need help....

We're glad to help, but you need to give us a little more information. Please post the actual error messages you're getting, and tell us what you don't understand about them.

gusano79 247 Posting Shark
while(s<=j){

You haven't initialized j before in your code.

Yes. Always, always read your compiler warnings! They are trying to tell you something, and very rarely should you ignore them.

gusano79 247 Posting Shark

Have you even tried to compile this? It won't, for at least five separate reasons. Do that first, and try to fix all of the build errors. Any you don't understand, please post them here and we'll help.

gusano79 247 Posting Shark

Do you know what the negative of a negative number is?

Big hint.

gusano79 247 Posting Shark

Here.

In the HTML you linked, the string "view.php?id=" shows up quite a few times, both inside the "<small>Recently Visited" ... </small> section and outside of it. As a result, CheckModify is returning false , which means it is working as designed.

As I'm not familiar with the codebase you're working with, I can't say why CheckModify was designed that way or what it's really supposed to mean. If there are any comments or other documentation, that would be the place to start.

gusano79 247 Posting Shark

segmentation fault...:(
some one help me pls..

Always, always check your compiler output. Does your compiler report any warnings? Mine does: "warning: 'temp' may be used uninitialized in this function" at line 28.

Your code declares temp as a char * , and then tries to strcpy into it without allocating any memory. This is why you get the segfault.

Depending on what how you intended the code to work, there are two possible solutions:

  1. Allocate some reasonably-sized memory for temp so you can strcpy into it.
  2. Don't use strcpy , just swap the pointers.

All else being equal, I'd recommend option (2).

gusano79 247 Posting Shark

Also: String.Split is convenient if you're allowed to use it.

gusano79 247 Posting Shark

I was watching a tutorial that says that we first need to check if any direction key was pressed, and only then we check which key was pressed, like this:

But then i tried to do it wihouth checking if any key was pressed and just jump to the specific key that was pressed:

And the thing is that for some reason when i use the tutorial method it works just fine, but when i use my method the surface moves when i press the button and when i let go of it. Why do we even need to check if any key was pressed?

if ( event.type == SDL_KEYDOWN ) //checking if any key was pressed

The comment "checking if any key was pressed" is misleading. Really it's checking if the specific key event we're responding to is a "key down" event. Without this line, your code executes on all key events, including "key up"--this is why it behaves the way you describe.

gusano79 247 Posting Shark

I've made only some ns2 scripts. Anyway, I know the vigenere cipher, but i don't understand how the algorithm works.

I'm not sure what exactly you mean by that; the cipher is the algorithm. Is there something specific about the code that is giving you trouble?

Here's a quick summary of what each function in the Vigenere class is doing:

  • Vigenere constructs a new cipher with the given key. All that if/else business makes it ignore parts of the key that aren't letters, and capitalizes everything.
  • encrypt does what it says on the box. More if/else to ignore characters that aren't letters and capitalize the ones that are. Note that the actual cipher is happening in the out += ... line; this is the algebraic version of the cipher.
  • Same goes for decrypt ; it's the algebraic version again.
gusano79 247 Posting Shark

I'm sorry, in the html file which is argument of this method there is "Recently visited".

For you, maybe. It's a PHP file, so the HTML is generated on the fly by the server. Visit it in your browser, save it as HTML, and post it here. Then we'll be talking about the same thing.

gusano79 247 Posting Shark

For reference, this is what it's supposed to be doing: Vigenère cipher

What programming background do you have?

--smg

gusano79 247 Posting Shark

Also: if(a>3<7) is bogus. Did a warning about it show up when you compiled?

gusano79 247 Posting Shark

http://www.mantisbt.org/demo/my_view_page.php

Well, that explains it.

The text "<small>Recently Visited" isn't there, and I count 25 separate instances of "view.php?id=" scattered throughout the page. So CheckModify should, as written, return false for this page.

Next step is to figure out what CheckModify is really there for, as in why are we checking for "view.php?id=" in the page? If it's commented, great; if not, you have some analysis to do.

gusano79 247 Posting Shark

Is that code what you were given with this assignment, or does it represent actual work you've done? It's not clear what you want help with--we're not going to do the work for you, but if you've made an effort and have something specific you're stuck on, we're happy to help with that.

gusano79 247 Posting Shark
private bool CheckModify(string html)
        {
            int recentlyVisitedBlockStartPosition = html.IndexOf("<small>Recently Visited");
            int mainTextStart = 0;

            if (recentlyVisitedBlockStartPosition != -1)
                mainTextStart = html.IndexOf("</small>", recentlyVisitedBlockStartPosition);

            return html.IndexOf("view.php?id=", mainTextStart) == -1;
        }

If CheckModify is returning false , that means it found "view.php?id=" somewhere in the page. I'm not too convinced by the "Recently Visited" detection code; it may not be detecting that section correctly and returning false because it found something that it should have skipped.

Can you post some of the HTML that is causing CheckModify to behave unexpectedly?

gusano79 247 Posting Shark

The problem gets when the window for sending the message gets to "Searching...".

What window are we talking about here? So far, we've only been talking about HttpWebRequest , which doesn't provide any UI.

I'm sending issues on a mantis web site.

So your code is submitting an issue to a Mantis site? Is that still a GET ? It's been a while since I've worked with Mantis.

I have a method CheckModify(string html) which checks if the html string contains "view.php?id=". If view.php link is found, some bug exists.
Can someone explain why? The code isn't mine.

Can you post some code? It's not very clear what you're asking here.

gusano79 247 Posting Shark

sfuo provided some concrete code examples; here's some theory:

Hi, I already tried searching through the array of tiles/pipes,
but I encountered a problem, since my current loop only searches downward,
I thought, what if the fuel is .. flowing up/ going northward(caused by tile/pipe orientation)

Right. This is why you should start thinking of your tiles as a graph, not an array. The actual implementation might be an array, but the graph concept provides a better perspective for spreading fuel throughout the system.

I think the solution requires adding another array search, but in a different direction
this requires more "for loops", making the code long/messy, and might make the game run slow.

You're on the right track with the "different direction" idea, but it's not an additional array search with a bunch of for loops. It's one search through the whole system, but not ordered by the shape of the array.

as for breadth-first search, Im still confused and cant think of a way to put my tiles/pipes into a tree...
bec. of the possibility that a child can have 3 parents and the child can also have 3children.

It's not a tree, it's a graph. A tree is a type of graph, but it's not what you want. A graph has no explicit root node, and there are no children, just connections between nodes. The article on graphs I linked above has a nice example of …

daniel955 commented: thanks for taking the time to help +2
gusano79 247 Posting Shark

But what I want to know is what is << doing exactly, I read something about moving the binary number

<< is a left shift. From the linked article: "Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n."

but since 1 is 1 in binary wouldn't this make it 1? And then the other 1 would not be 1 000 000? Why is that that it becomes 64?

In your example, the value of bits[i] is always 0 or 1, and i is the position of each bit, so shifting bits[i] left by i will get you the numeric value that bit represents in a byte.

Break it down:

The statement bits[] = {1, 0, 0, 0, 0, 0, 1, 0} is the same as

bits[0] = 1;
bits[1] = 0;
bits[2] = 0;
bits[3] = 0;
bits[4] = 0;
bits[5] = 0;
bits[6] = 1;
bits[7] = 0;

And the loop with character += bits[i] << i; is the same as

char character = 0;
character += bits[0] << 0;
character += bits[1] << 1;
character += bits[2] << 2
character += bits[3] << 3;
character += bits[4] << 4;
character += bits[5] << 5;
character += bits[6] << 6;
character += bits[7] << 7;

Substituting the values of the bits array:

char character = 0;
character += 1 << 0;
character += 0 << 1;
character += 0 …
gusano79 247 Posting Shark

You probably want a breadth-first search, with the tiles as nodes and edges between adjacent tiles in each of the four cardinal directions.

If you only have one fuel source in the game, that's your root node. If you have multiple fuel sources, just mark each of them as 'visited' to start with.

daniel955 commented: thanks for the information +1
gusano79 247 Posting Shark

I don't know anything about gltools, but if you have a position and orientation for the camera, you should at least be able to use glTranslate and glRotate to get the gun to match the camera.

gusano79 247 Posting Shark

Yes, I can view it when I write the url in a browser directly.
The url is someSite/login.php

Hmmm... try setting the request.UserAgent property. Make up your own string first--if that works, fine; if not, try one of the example user agent strings in the MSDN page I linked.

gusano79 247 Posting Shark

1 For a console app, does .NET need to be installed on a PC to run the app executable?

Yes, it still runs on the CLR and uses the .NET Framework Class Library.

2 What is the line code to launch an external program? I already have the drive and path variables set, but I don't remember how to have the app launch another program.

The Process class launches other programs. For a simple setup, Process.Start should work fine.

If the answer to #1 above is yes, is there a CS2CPP conversion I can do? I'm using VS2010.

There are various converters out there; I'm sure Google can find more than enough. Your mileage may vary, though, depending on which C# features and .NET Framework classes you're using that don't have a simple, native C++ equivalent.

My own experience with code converters is that they are all a bit shy of the glory--there's always some manual cleanup/conversion you'll have to do after the automated process is done.

gusano79 247 Posting Shark

When I'm in GET mode, in this line, the program crashes:

using (HttpWebResponse responseData = (HttpWebResponse)request.GetResponse())

The information in the catch block says:
The remote server returned an error: (403) Forbidden.

This could be a permissions problem on the Web server... what is the URL you're trying to get, and can you view it normally in a browser?

gusano79 247 Posting Shark

I have a question about C++ GUI's, with Code::Blocks as my IDE. Whenever I make a basic GUI with the Win32 API, it always creates a console _and_ the GUI (as shown in the picture attached). I was wondering how to only create the GUI, or at least make the console not visible.

Code::Blocks normally creates the console window when you run the "Debug" build target. If you switch the build target to "Release", it should only show the GUI.

You can change this if you want. Go to the "Project" menu and select "Properties". Under the "Build targets" tab, you'll see a combo box labeled "Type". For the "Debug" target, this is set to "Console application" by default. Change it to "GUI application", and *poof*--no more console window when running the debug build.

gusano79 247 Posting Shark
gusano79 247 Posting Shark

Thank you greatly, I could use a lot of this for future development! I'd love any other ideas for any other game aspects you might have, such as stat building, talent points and abilities and etc.

Thanks again

Half the fun is making it your own, and I don't want to prejudice you toward my RPG system preferences... but if you have a specific idea you've started to develop, I'd be happy to comment on it.

Also, you might have a look a Jared Presler's PORTAL system; he's got some interesting ideas in there about how stats and abilities relate.

gusano79 247 Posting Shark

Here are some thoughts, in no particular order:

Next, the crit calculator, which is the same for everyone save the damage that a critical hit does. Players get *3 damage while enemies get *2 damage:

the tagi variable is used to randomly generate a number between tagi and tagi +100. Using my very simple logic, here's an example: tagi = 5. Generate a number between 5-105. If the number is above 100, a crit occurs. Therefore, there is a 5% chance a crit will occur. Very sloppy indeed.

Dim random As New Random
    Dim crit As Integer = random.Next(tagi, 100 + tagi)
If crit >= 100 Then
    dmg = dmg * 3
    msg = "It was a crit! "
End If

This might have been just for the sake of your example there, but in case it wasn't: You don't want to Dim random As New Random every time; just do it once and then stash random somewhere the rest of your code can get at it.

Generating a number from 5-105 is a little confusing, and it's more complicated than it needs to be. How about just sticking with 1-100, and less than or equal to 5 is your 5%? One more step: because of the way random.Next works, get a number from 0-99, and less than 5 is your critical hit:

If random.Next(0, 100) < 5 Then
    dmg *= 3
    msg = "It was a crit! "
End If

Now, I have my "random encounter" algorithm as …

gusano79 247 Posting Shark

if anyone could see anything i might have missed in the process it would be much appreciated

I copied your code in, and it builds, but I also got 37 warnings, for example, "warning: unknown conversion type character 'l' in format" Are you getting these as well?

gusano79 247 Posting Shark

I may be thinking in a slightly different direction than you want to take for this project, but in the interest of development speed and spending more time on the game aspects than language specifics, have you considered using and/or extending a pre-existing embedded language?

I'm thinking of Lua in particular. It seems appropriate for what you're trying to do; here are a few ways it relates well to your project:

It will be written in C++.

The Lua interpreter is written in C, but will compile cleanly as C++, including exceptions.

it will contain features specific to games only. Screen, Texture, Sound, and Model will be data types just like int, float, and double in other languages.

While you wouldn't be writing the basic language yourself, you can write your game engine classes in C++, and expose instances of them to Lua, which essentially achieves what you're describing (see userdata and metatables).

1- Easy to learn: I intend to have a learning curve of maximum one week. It will be very easy for starting programmers to develop good games with it.

I believe the "easy" aspect of your language will depend mostly on your architecture and object model, rather than the language itself. At any rate, Lua is simple and easy, IMO.

2- Fast: this language will not be translated to executable files, but will be translated into C++ using OpenGL library for drawing, and then calling MingW …

gusano79 247 Posting Shark

I recommend that you decouple your drawing from the actual framerate. Basically, you keep track of how much time has elapsed since the last frame, and then draw only the part of the waveform that should have been drawn in that amount of time. That way, your framerate can be imprecise or even highly variable, but the effect is that the waveform appears to be drawn at a constant speed.

You might want to read Glenn Fiedler's article on this topic, especially starting at the "Free the physics" section. It's written with a focus on physics engines, but the concept applies just as well here.

vijayan121 commented: Yes +11
gusano79 247 Posting Shark

there is a name list in listbox and for each name there is details about that name i have kept on visual studio 2008 database.now how i show the details in another form when i click that item or name in listbox,hope u understand my term..

I think I understand what you're doing... let me know if I'm off.

The form that has your list needs to have a reference to the form that shows the details. When the SelectedIndexChanged event happens on your listbox, the event handler should set the details for the second form.

Here's a basic example of one way the forms might work together. There are other ways to manage this, depending on how you want it to work, but this should be sufficient to demonstrate the idea:

using System;
using System.Windows.Forms;

class Program
{
    static void Main()
    {
        Application.Run(new ListForm());
    }
}

class ListForm : Form
{
    ListBox listBox;
    
    DetailsForm detailsForm;
    
    public ListForm()
    {
        listBox = new ListBox
        {
            Dock = DockStyle.Fill
        };
        listBox.SelectedIndexChanged += ListBoxSelectionChanged;
        Controls.Add(listBox);
        
        Load += OnLoad;
    }

    void OnLoad(object sender, EventArgs e)
    {
        // Your own list-loading code goes here.
        listBox.Items.Add("uno");
        listBox.Items.Add("dos");
        listBox.Items.Add("tres");
        listBox.Items.Add("cuatro");
    }

    void ListBoxSelectionChanged(object sender, EventArgs e)
    {
        // Here's one place you could load the details for the selected item.
        string details = (string)listBox.SelectedItem;
        
        // This section manages whether or not to create a new details
        // form, setting the detail information on it, and showing the
        // form if it's not visible.
        if((detailsForm …
gusano79 247 Posting Shark

yes i meant the first one but a little bit broader like....

private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
// Get the currently selected item in the ListBox.
string curItem = listBox1.SelectedItem.ToString();

after getting item from listbox i want to show the details of that item on another form in form2 and the details of that item is situated on my database table.Now what is the code for that Form2 loading?

That depends on how you write the second form. Typically you'll want to create a method in the "Form2" class where you pass it the newly selected object. Then the second form can do the database lookup and display whatever details you want.

How is your application structured? I mean, when do your forms get created, and does one (or both) know about the other?

gusano79 247 Posting Shark

If you mean the currently selected item, you should investigate the ListBox.SelectedItem property. If you need to look at all of the items in a ListBox, then the ListBox.Items property is where to start.

Is that what you meant?

gusano79 247 Posting Shark

Not using looping could mean recursion or goto label, depending on definition.

Or you could just put one "round" in a function, and call it 10 times explicitly, returning any information you need to track across the whole game.

TrustyTony commented: Good thinking. +13
gusano79 247 Posting Shark

yes..i m ..

In that case, I'm not sure what is wrong here... Looking at the site you're submitting to, I see from the comments that other people have been having trouble with apparently working code as well. There are quite a few "runtime error(SIGSEGV)" results--this sounds like something you should take up with whoever manages the site.

As for the "time limit exceeded" error, the limit is only one second... your original code had an array size of 1000000 (one million); that might have had something to do with it.

gusano79 247 Posting Shark

In that case, which aspect of GP is giving you trouble? Have you written any code yet?