• What do you need help with? Version 1
    5,001 replies, posted
A ReaderWriterLock should do the trick, unless a Mutex is something you wanted to avoid.
[QUOTE=ZeekyHBomb;25685693]A ReaderWriterLock should do the trick, unless a Mutex is something you wanted to avoid.[/QUOTE] That seems to be exactly what I'm looking for. Thanks. :buddy:
I need some Help in flash with actionscript 2, im having some troubles making the screen follow the instance name "player" without using a vcam, i don't want to use a vcam because they just seem to bug out on me a lot, any reply would be awesome thanks!
[QUOTE=noctune9;25685244]In C#, I'm having a List with a lot of objects on. I have several threads iterating over the list, but I occasionally need to remove objects from the list, preferably in another thread. Can I in any way make it thread safe for multiple threads to iterate over and occasionally remove elements? Or should I use a database? MSSQL would be the obvious choice for C#, but I'd like it to be as cross-compatible as possible, so is MySQL a good alternative for C#?[/QUOTE] MySQL works well with C#, there's a connector on the MySQL Website. (.NET lib)
very dumb math question, I'm trying to get a value based on the players speed, and apply that to another value on the value I have 0 to 1, and the speed is 0 to 200. So if the player is at 100 (half speed), the value is 0.5. [quote] float speed = player->GetLocalVelocity().Length2D(); //between 0 and 200 float amount = 0.0 += ///WHAT GOES HERE? viewmodel->SetPoseParameter("move_x", amount); //this is the final value (between 0 and 1 )[/quote] [B]edit:[/B] ugh, I just have to divide it by the maximum. fuck my stupid brain
I'm not exactly sure of your question, but do you want float amount = float(speed) / 200 ? [b]edit:[/b] actually you don't even have to cast to float, speed is a float, I'm an idiot too (or I've been working in PHP too long)
yeah, I just realised that :v:
[QUOTE=noctune9;25685244]so is MySQL a good alternative for C#?[/QUOTE] I'm using C# and MySQL on a production site, works fine. You might also want to look into DbLinq, which provides Linq to MySQL.
[QUOTE=quincy18;25679090]I tried using farseer but my collisions are off, this is what I've posted on the farseer forums but no one answers ... [url]http://farseerphysics.codeplex.com/Thread/View.aspx?ThreadId=232205[/url][/QUOTE] Still no answer quoting for new page
In a CSharp class ("BaseClass") I've overloaded the <<= operator like this: [csharp]public static BaseClass operator <<( BaseClass me, SomeClass you ) { // shit happens return me; }[/csharp] So I can do: [csharp]BaseClass a = new BaseClass(); a <<= bluh;[/csharp] But if I have a class that extends "BaseClass", when I try: [csharp]ExtendingClass b = new ExtendingClass(); b <<= bluh;[/csharp] I get an illegal implicit conversion from "BaseClass" to "ExtendingClass" because the overloaded operator returns a BaseClass! How can I let classes which extend BaseClass use the <<= operator?
[QUOTE=Robert64;25700714]In a CSharp class ("BaseClass") I've overloaded the <<= operator like this: [csharp]public static BaseClass operator <<( BaseClass me, SomeClass you ) { // shit happens return me; }[/csharp] So I can do: [csharp]BaseClass a = new BaseClass(); a <<= bluh;[/csharp] But if I have a class that extends "BaseClass", when I try: [csharp]ExtendingClass b = new ExtendingClass(); b <<= bluh;[/csharp] I get an illegal implicit conversion from "BaseClass" to "ExtendingClass"! How can I let classes which extend BaseClass use the <<= operator?[/QUOTE] They're not inheriting it because it's a static member, probably. It would've helped if you gave us the exact error, but that seems like it.
[QUOTE=gparent;25700734]They're not inheriting it because it's a static member, probably. It would've helped if you gave us the exact error, but that seems like it.[/QUOTE] It is picking it up and trying to use the overload due to the error. Since the overload returns a BaseClass, and it is trying to directly assign that to the ExtendingClass instance, I get an illegal implicit conversion error. [editline]28th October 2010[/editline] I'm now using += but still the same issue. [editline]28th October 2010[/editline] I don't want to have to re-overload it for every extending class.
[QUOTE=Robert64;25700767]It is picking it up and trying to use the overload due to the error. Since the overload returns a BaseClass, and it is trying to directly assign that to the ExtendingClass instance, I get an illegal implicit conversion error. [editline]28th October 2010[/editline] I'm now using += but still the same issue. [editline]28th October 2010[/editline] I don't want to have to re-overload it for every extending class.[/QUOTE] Still, it helps when you point out the exact error (Error code!) I did misread that though. Never overloaded operators in C# cause I've never had to, so can't help too much.
[QUOTE=gparent;25701049]Still, it helps when you point out the exact error (Error code!) I did misread that though. Never overloaded operators in C# cause I've never had to, so can't help too much.[/QUOTE] It's a compiler error (won't let me compile until it is resolved), can't see the error code anywhere. [editline]28th October 2010[/editline] For now I've had to make a special handler class which handles the +=, using: [csharp]a.Handler += bluh;[/csharp] Looks nicer in context: [csharp]loops[ 2 ].Effects += new Echo( this ){ Fade = 0.9, Delay = 0.25 };[/csharp]
[QUOTE=Robert64;25701132]It's a compiler error (won't let me compile until it is resolved), can't see the error code anywhere.[/QUOTE] You can only overload left shift in C# if the second operand is an int, same for right shift too.
[QUOTE=raBBish;25702025]You can only overload left shift in C# if the second operand is an int, same for right shift too.[/QUOTE] I realized that, hence why I use += now. But that wasn't the cause of the original problem.
[QUOTE=raBBish;25702025]You can only overload left shift in C# if the second operand is an int, same for right shift too.[/QUOTE] That's weird, I wonder why it doesn't want to allow creation of operators like the stream-in and stream-out of C++.
[QUOTE=esalaka;25702787]That's weird, I wonder why it doesn't want to allow creation of operators like the stream-in and stream-out of C++.[/QUOTE] [quote]Use operator overloading in cases where it is immediately obvious what the result of the operation will be. For example, it makes sense to be able to subtract one Time value from another Time value and get a TimeSpan. However, it is not appropriate to use the or operator to create the union of two database queries, [b]or to use shift to write to a stream[/b].[/quote] [url]http://msdn.microsoft.com/en-us/library/2sk3x8a7(vs.71).aspx[/url]
[QUOTE=Robert64;25701132]It's a compiler error (won't let me compile until it is resolved), can't see the error code anywhere.[/QUOTE] Not that it matters too much now, but generally it starts by "CS" and is very obvious.
I'm not sure if this should go in here but I don't think it deserves it's own thread. I am trying to build this: [url]http://code.google.com/p/lugaru/[/url] But I have no idea what I'm doing...
[QUOTE=Paulendy;25708752]I'm not sure if this should go in here but I don't think it deserves it's own thread. I am trying to build this: [url]http://code.google.com/p/lugaru/[/url] But I have no idea what I'm doing...[/QUOTE] Maybe you outta start out smaller then?
[QUOTE=ralle105;25709355]Maybe you outta start out smaller then?[/QUOTE] Well I wasn't really planning on doing this very often, I just want to know how to compile this...
[QUOTE=Paulendy;25708752]I'm not sure if this should go in here but I don't think it deserves it's own thread. I am trying to build this: [url]http://code.google.com/p/lugaru/[/url] But I have no idea what I'm doing...[/QUOTE] I tried this the other day, apart from needing some openGL files installed it should work fine (mine didnt compile as i was missing said files) however i dont think they included the models for the game as its just the code thats open source not the actual content
[QUOTE=Richy19;25709596]I tried this the other day, apart from needing some openGL files installed it should work fine (mine didnt compile as i was missing said files) however i dont think they included the models for the game as its just the code thats open source not the actual content[/QUOTE] I bought the game so I have all of those files, this one has some added features that I'd like but they don't have any compiled binaries with those features included.
in that case open the .sln and click build in visual studio and tell us what errors you get
[QUOTE=Richy19;25711622]in that case open the .sln and click build in visual studio and tell us what errors you get[/QUOTE] Well this one says that you should use some program called CMake, but I have no idea how to use it...
[QUOTE=Paulendy;25712973]Well this one says that you should use some program called CMake, but I have no idea how to use it...[/QUOTE] Download, install and run CMake like the instructions tell. This will generate you a .sln
Does anyone know where I can find binaries for libev on Windows, or perhaps how I could build it myself? I'm trying to get Manos de Mono running on Windows, and apparently it requires libev to work.
In C#, I have a method with a whole bunch of lambdas, like so: [cpp] // Previewing! menuItem.DropDownItems.Add(Str._(Str.MenuItemBrowser), null, new EventHandler((sender2, e2) => { CloudAppItem senderItem = (CloudAppItem)((ToolStripMenuItem)sender2).OwnerItem.Tag; System.Diagnostics.Process.Start(senderItem.Url); })); menuItem.DropDownItems.Add(new ToolStripSeparator()); // Convenient URL grabbing menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyPrimary), null, new EventHandler((sender2, e2) => { CloudAppItem senderItem = (CloudAppItem)((ToolStripMenuItem)sender2).OwnerItem.Tag; Clipboard.SetText(senderItem.Url); })); // Convenient (re)direct URL grabbing if (item.ItemType != CloudAppItemType.Bookmark) { menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyContent), null, new EventHandler((sender2, e2) => { CloudAppItem senderItem = (CloudAppItem)((ToolStripMenuItem)sender2).OwnerItem.Tag; Clipboard.SetText(senderItem.ContentUrl); })); } else { menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyRedirect), null, new EventHandler((sender2, e2) => { CloudAppItem senderItem = (CloudAppItem)((ToolStripMenuItem)sender2).OwnerItem.Tag; Clipboard.SetText(senderItem.RedirectUrl); })); }[/cpp] Rinse, repeat. While I can understand what the code does it's not exactly the prettiest thing to look at. Turb looked at the code and gave me this: [cpp] void clickyshit(object sender, EventArgs e) { CloudAppItem senderItem = (CloudAppItem)((ToolStripMenuItem)sender).OwnerItem.Tag; System.Diagnostics.Process.Start(senderItem.Url); }[/cpp] [cpp] // Previewing! menuItem.DropDownItems.Add(Str._(Str.MenuItemBrowser), null, clickyshit); menuItem.DropDownItems.Add(new ToolStripSeparator()); // Convenient URL grabbing menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyPrimary), null, clickyshit); // Convenient (re)direct URL grabbing if (item.ItemType != CloudAppItemType.Bookmark) menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyContent), null, clickyshit); else menuItem.DropDownItems.Add(Str._(Str.MenuItemCopyRedirect), null, clickyshit);[/cpp] He tells me I can figure it out for myself, and it has to do with sender. Does that mean a switch with things like "case Str._(Str.blahblahblah)"?
No, when a WinForms control fires an event it does something along the lines of: [csharp] if(SomeEvent != null) SomeEvent(this, /* event args */); [/csharp] So you can use the 'sender' parameter to figure out what control fired the event.
Sorry, you need to Log In to post a reply to this thread.