Jump to content
Xtreme .Net Talk

PlausiblyDamp

Administrators
  • Posts

    7016
  • Joined

  • Last visited

Everything posted by PlausiblyDamp

  1. Not tested it but it should at least compile ;) void CalcAABBFromOBB(Microsoft.DirectX.Vector3[] obb, Microsoft.DirectX.Vector3 minB,Microsoft.DirectX.Vector3 maxB) { System.Diagnostics.Debug.Assert(obb != null); minB.X =maxB.X = obb[0].X; minB.Y =maxB.Y = obb[0].Y; minB.Z =maxB.Z = obb[0].Z; for (int i=1;i<8;i++) { if (obb[i].X < minB.X) minB.X=obb[i].X; if (obb[i].X > maxB.X) maxB.X=obb[i].X; if (obb[i].Y < minB.Y) minB.Y=obb[i].Y; if (obb[i].Y > maxB.Y) maxB.Y=obb[i].Y; if (obb[i].Z < minB.Z) minB.Z=obb[i].Z; if (obb[i].Z > maxB.Z) maxB.Z=obb[i].Z; } }
  2. would it be possible to post a bit more code? Without knowing what minB, maxB and oob are it is very hard to translate the code... Assert evaluates whatever is passed in to either a true or a false - if it equates to false then it kicks out an error message and prompts to debug when compiled in debug mode; In release mode assert doesn't do anything.
  3. Just wrap the call to the .DownloadFile method within a try ... catch block, did you even read the link coldfusion posted?
  4. Is there any reason why using a Try ... Catch wouldn't work? It will allow you to handle the error however you see fit.
  5. In a nutshell you cannot rely on just counting the number of processes, using a mutex you have control over a single instance per server or per session...
  6. Although the performance differrence is probably not a reason to use the mutex based code, try running both on a terminal server based system when multiple sessions want to run the same application multiple times.
  7. There is no _asm directive in C#, you would either have to go through the method in the post you refer to or possibly put the asm in a C DLL and call that from C#.
  8. You could still open the .cs file in somethng like notepad though...
  9. It looks like the attachment is C#, if you only have VB installed then you will get an error opening the project.
  10. Have you looked at the following? http://www.xtremedotnettalk.com/showthread.php?t=85526&highlight=mysql http://www.xtremedotnettalk.com/search.php?searchid=102954
  11. http://www.xtremedotnettalk.com/showthread.php?t=83092 may be worth a read
  12. http://www.xtremedotnettalk.com/showthread.php?t=89413 http://www.xtremedotnettalk.com/showthread.php?t=75065
  13. You could probably also do it from the Form_load event of your main form, personally I tend to start my apps from a sub main so I just wrote the code that way.
  14. On way is to handle the Appdomain's UnhandledException event Public Shared Sub Main() 'setup global error handler AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf AllErrorsCaughtHere Dim f As New Form1 Application.Run(f) End Sub Private Shared Sub AllErrorsCaughtHere(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs) 'deal with errors here End Sub I would still continue to use try catch blocks within procedures as it makes more sense to handle errors specifically whenever possible; the above code will just catch unhandled errors - the problem is you are then potentially keeping yur application alive but no longer know the state of various objects within it due to the previous error.
  15. Performance wise it should make very little difference, from a code point of view though if the variable is only used within the block then declaring it within the block makes the code's intention that bit clearer and allows the compiler to enforce the variable scope.
  16. have you looked at either of the following? http://www.xtremedotnettalk.com/showthread.php?t=70318 http://www.xtremedotnettalk.com/showthread.php?t=70320 They should give you a good idea of what is required, if they don't help could you post some of the code you are using?
  17. Application.ExecutablePath is probably the one you are after.
  18. Not too sure what you mean by . Would it be possible to post the code you have and indicate what you are trying to do?
  19. Could you post the relevant code? Or at least give afew more details about what the callback function does.
  20. What is the problem?
  21. e.Handled was what I meant :o - just didn't have VS handy at the time.
  22. You could use the Dataset's GetChanges method to find the appropriate rows, or alternatively a DataView and it's RowStateFilter property would work. If you are using a DataAdapter to populate the dataset you could use the DataAdapter's Update method to push the changes back.
  23. I would rarely recomend explicitly managing garbage collection, far too often it will cause more problems than it solves. It may be easier if you tell us what you are trying to acheive, there may be an alternate solution to the problem.
  24. The thread function is just like any other function it starts, runs to completion and then stops. Your code public void Run() { MessageBox.Show("Still running"); moving.Suspend(); } displays a messagebox and then suspends the thread (I'm assuming moving is declared at the form level). If you want the thread to be executed multiple times then you will need to either make it loop or spawn multiple copies.
  25. lst.Items.Clear() should do the trick.
×
×
  • Create New...