Flub, I think it'll be easier if you just used std::cout rather than typing using std::cout. I might be wrong on this though, but I find it cleaner to just type std::cout rather than what you're doing.
Flub, I think it'll be easier if you just used std::cout rather than typing using std::cout. I might be wrong on this though, but I find it cleaner to just type std::cout rather than what you're doing.
Just look at "while"
Damn...wrong button.... :´(
This it the code for my Save As button that iv made on my project.
private void saveAsToolMenu_Click(object sender, EventArgs e)
{
saveFD.InitialDirectory = "C:";
saveFD.Title = "save a text file";
saveFD.FileName = "";
saveFD.Filter = "Text Files|*.txt|All Files|*.*";
if (saveFD.ShowDialog() != DialogResult.Cancel)
Its works fine but i don't know what the code would be for the Save button where you don't actually choose a place to save it to it just updates the last save you made and saves it to that with out having to scroll through your files and folders. Can any one help?
Look at this part of my program
Works, but I want show each information of x person. Don't appears...Code:void Salvar(USUARIO *x) { fseek(fp, 0L, SEEK_END); if (fwrite(&x, sizeof(x), 1, fp) != 1) { fprintf(stderr, "Erro ao salvar o registro"); exit(1); } fprintf(stdout, "Registro salvo com sucesso!"); } void ProcessOpen() { if ((fp = fopen("Registros.dat", "wb")) == NULL) { fprintf(stderr, "Erro ao abrir o registro"); exit(1); } } void Ler(USUARIO *x) { rewind(fp); while (fread(&x, sizeof(USUARIO), 1, fp)) fprintf(stdout, "Nome: %s\nSexo: %s\nIdade: %d\nTelefone: %d\nSalário: %.2f\nRegistrado: %d/%d/%d\n", x->nome, x->sexo, x->idade, x->telefone, x->salario, x->registrado.dia, x->registrado.mes, x->registrado.ano); }
Obs.: Some parts are in portuguese (dun worry)
I got a problem.
I want to make a broadcast, that sends a String to every connected client. but when I execute the command, then I get the following error, at this point:
Error:
A disposed object can not be accessed.
Object: "System.Net.Sockets.Socket".
Code:
The error probably only happens, when it tries to send the message to "127.0.0.1"Code:sent += socket.Send(buffer, offset + sent, size - sent, SocketFlags.None);
Whole Network code:
http://pastebin.com/D01U4GTy
Execution code:
Code:private void btn_send_01_Click(object sender, EventArgs e) { string str = "Teststring"; //String that gets send to the client foreach(ServerThread th in cNetListener.threads) { Socket sck = th.connection.Client; th.Send(sck, Encoding.UTF8.GetBytes(str), 0, str.Length, 1000); } }
Also, can someone take a look at my network code, and tell me if the network shit I coded is bullshit?
In C# how could i have a texture manager hold all the images and then have the classes point to the image they need? (while using safe code)
In C+ I would do something like.
MyClassImagePointer = TextureManager.GetImage(blah);
But from what i can remember c# would create a copy of the image not a pointer to it
I've tried taking a look at my webgl project once again, and I just seem unable to find the problem... I'm sure I'm missing something really obvious but I just can't quite pinpoint it. Would anybody care to take a look at it and see if they can spot my mistake?
The textured quads doesn't show up at all while the lines works fine. I'm also very certain that the texture is right as it works in my c++ opengl engine, but just not with webgl.
Here's a link to it: http://dl.dropbox.com/u/40398697/Web...bGLProject.rar
Any help is appreciated!
C# is more likely to create a reference to it than a copy. You normally don't need to explicitly use pointers and ref objects.
More specifically, all class objects in C# are reference types, not value types, just like in Java. Only value types (primitives and structs) get copied.
I mainly do it because I just want to keep a bunch of statements I'm gonna use at the beginning of every shitty program I write, so I don't have to rewrite it each time.
Basically I just erase everything in int main(){} when I want to write a new program for practice.
It's a long shot, but in the source engine, anyone know why tracelines might not be registering hitboxes unless the traceline passes through the bbox of a player?
I know for a fact this doesn't happen in dod:s for example, a player can be prone on the ground and their bounding box covers their torso at most yet the trace still impacts with the player hitboxes.
Here's an example of it in my mod:
You can see the bbox around the player, the hitboxes on the player and the white lines representing the traces. They don't register hitting the arm hitboxes because it was outside the bbox. If I turn around slightly and shoot at the same arm hitbox but make it clip through the edge of the bbox, it works as intended. Any ideas?
Someone could help me how to use time.h ? Please. I want put automatically the time when the user data was registered.
It's probably because the Engine uses the Bounding Box as a fast pre-pass test. Since it never enters the bounding-box it never tests the hit boxes.
Not sure there is an easy solution unfortunately. :(
So I've hit sort of a brick wall. I know what I want to do, I know how to do it in most sane languages (C, Python, Lua, etc.), but there isn't a single way to do it in Javascript that isn't fucking horrible.
What I want to do is stop execution, then resume at the same point in code. Really, nothing more than a non-busy wait... something to indicate to the VM that it can take a break and go work on something else for a while. JS is probably the only language in the world that doesn't have such a thing, and, ironically, it's probably the only language in the world that really needs it, since you're sharing resources with lots of other JS programs and browsers don't have multitasking schedulers.
The setTimeout solution for this particular problem is really filthy.
How was it that you get a point in say a 2d image using an index?
I seem to remeber it was something like:
x = i / width;
y = i % width;
It's either:
x = i % w; y = i / w;
or:
y = i % h; x = i / h;
Depending on whether your image is column-major or row-major.
2 C# questions, REALLY fucking urgent.
First, how do I make it so a program opens a file in the software it's meant to be opened in (like a word document in word etc)
Second, when using openxml, how do I stop the error where an edited excel file doesn't say it's unreadable when you try to open it afterwards and all the crap related to that. Thanks.
Sounds simply like you're not masking your trace correctly.
The traces are being masked perfectly fine, I managed to find some of the engine level tracing stuff (from the hl2 leak by chance) and Lord Ned was right, it doesn't bother searching for hitboxes because it was using the bbox as a faster pre-pass test. Managed to work around it anyway.
-snip nevermind, cant read atm-
I'm going to need some pathfinding but i'm not using tiles. So i'm thinking of using preset waypoints and just loop through them to find the closest to the target, and then move the NPC to the closest waypoint or something.
Could I still use A* for something like that or what?
You can use A*, just make areas into nodes(they should be equal in size) and the NPCs will just follow the nodes to their destination node.
Snip, wrong thread![]()
Hey guys, I need help with infix to prefix conversion, I understand the concept but I don't exactly know where to start out.
For infix to RPN (postfix): http://en.wikipedia.org/wiki/Shunting_yard_algorithm
I find that useful because RPN is easily parsed by a simple stack machine. You would probably be able to modify it a little bit to produce prefix, though.
So, I need some help guys..
I've made a resource manager, which scans a given folder and loads all the resources it can find. I also have a resource base class which have child classes for different kind of resources.
My resource manager contains a factory to create resource instances of the different types.
The problem I have is that when it finds a file, how does it know which kind of resource to instantiate?
You could try to look for the extension, as in : .txt, .png, etc.
My first solution was to allow the user to map simple wildcard patterns to resource types, like a "*.png" maps to a ImageResource, but then you can also do more advanced stuff like "map*.png", which would perhaps map to a MapResource. But then "map01.png" would match both the "*.png" and "map*.png", so which one should it choose?
I'm not even sure I need that level of versatility![]()
Just use nongreedy matching - that way the wildcard in map*.png will match anything it can up to .png but it won't match the .png.
For every supported resource type, include a type checker in addition to the loader. For binary formats, it's usually as simple as checking the magic number and version numbers.
i.e.
bool isbsp(uint8_t *data, int n) { if (n < 4) return false; return data[0] == 'I' && data[1] == 'B' && data[2] == 'S' && data[3] == 'P'; }
Then you do:
if (isbsp(data, n)) return loadbsp(data, n); if (ispng(data, n)) return loadpng(data, n); if (isjpg(data, n)) return loadjpg(data, n); // etc...
Of course it's a little more difficult for plaintext formats. At that point you pretty much have to guess by the extension/source. I've never been a fan of file extensions, though.
I wouldn't really go for wildcard-matching. I don't really have a good reason, it's just personal preference. I'd just split the last period-delimited substring off and check that against an extension string. IMHO, simpler, cleaner.
Thank you, this was helpful, it got my cogs going again.
C# doesn't have any concept of 'primitives'
You'll find that there are a decent number of things with Source that are like this. You're best keeping an extracted copy of the leak for reference; I do and it helps a lot.
Glad you found out the issue.
What does it mean to "return f( x, y, z )" as opposed to "return n" in a function, in C++, whereas f is a function?
It means return whatever the function f(x, y, z) returns
So it runs the function f inside of the function where return f(x, y, z) was located?
Any idea why this snippet of C code makes me unable to type anything in the console?
char opt; do { opt = getchar(); } while (opt != 'e')
why are you storing getchar in a char
Fixed it, never mind. Didn't freeze - it just took a while the first time I ran the program which is weird.
I omitted the other code that comes in after "opt = getchar()" in the loop because it wasn't relevant to the problem.esalaka posted:
opt should still be an int.