I've tried to google that, but can't find anything ... Well, I'm just happy that my app now works :D It could be that this doesn't happen in .NET 2.0 ether :) Anyway, thanks for helping :)
xx77abs
Posts
-
How to catch all unhandled exceptions ? -
How to catch all unhandled exceptions ?In my last post I've told daveauld that I've turned strict on in my whole project :) As for Application.ThreadException and Appdomain.UnhandledException, I know that they have different parameters, that's why I have overloaded ReportError sub, so that they booth can use it ;) Like this:
Public Sub ReportError(ByVal sender As Object, ByVal e As System.Threading.ThreadExceptionEventArgs) Try MsgBox("Unhandled error has occured !!" & vbCrLf & vbCrLf & e.Exception.Message & vbCrLf & \_ErrorTitle & " will now close.", \_ CType(MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, MsgBoxStyle), \_ErrorTitle) WriteError(sender, e.Exception, "Yes") If Not System.Diagnostics.Debugger.IsAttached Then Application.Exit() End If Catch End Try End Sub Public Sub ReportError(ByVal sender As Object, ByVal e As System.UnhandledExceptionEventArgs) Try MsgBox("Unhandled error has occured !!" & vbCrLf & vbCrLf & CType(e.ExceptionObject, Exception).Message & vbCrLf & \_ErrorTitle & " will now close.", \_ CType(MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, MsgBoxStyle), \_ErrorTitle) WriteError(sender, CType(e.ExceptionObject, Exception), "No") If Not System.Diagnostics.Debugger.IsAttached Then Application.Exit() End If Catch End Try End Sub
And I've told you, this is not working only in .NET Framework 3.5 (after creating HTTPWebRequest object) ;) Right now I've switched my project to .NET Framework 4.0, and the same code is working perfectly
-
How to catch all unhandled exceptions ?I've tried to replace
req = CType(HttpWebRequest.Create(New Uri("http://test.com")), HttpWebRequest)
with
req = WebRequest.Create(New Uri("http://test.com"))
but the result is the same - program can't catch any error after that line ... As for using CType, I must use it because I've turned strict on in my project ;)
-
How to catch all unhandled exceptions ?After trying everything, I've created new project and started to copy parts of my project in which error handling is broken ... And I've found out that my application catches all exceptions until this line: req = CType(HttpWebRequest.Create(New Uri("http://test.com")), HttpWebRequest) So what's the problem ? I don't think that I've did any thing wrong. Another interesting thing is that if I change my project to .NET framework 4.0 (currently it's 3.5), it works OK ... So is this kinda of bug in 3.5 or what ? Thanks :D
-
How to catch all unhandled exceptions ?Hello ! I'm having a problem with catching all unhandled exceptions, without try ... catch block, so that if my program get's exception that I didn't count on, it could write it to file or send it to me over the net and close "nicely". So far I've been using this:
' Add the event handler for handling UI thread exceptions to the event. AddHandler Application.ThreadException, AddressOf ErrorReporting.ReportError ' Set the unhandled exception mode to force all Windows Forms errors to go through ' our handler. Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException) ' Add the event handler for handling non-UI thread exceptions to the event. AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf ErrorReporting.ReportError
and it was working perfectly ... Until few days ago :( Now it doesn't catch anything. Even when I'm running program from Visual Studio 2010, if unhandled exception occurs, my program just shuts off, and Visual Studio doesn't show me where exception occurred or what the exception was ... Please help me somehow, because this is very frustrating, and it's making programming impossible ... Thanks :)
-
Help with this expressionSo that's it :) Thanks for explaining ;)
-
Help with this expressionThank you for your help, but if you mean that error was this line: $i++; outside of foreach loop, I've already fixed it before trying the sample and it still don't work ... http://x.xx77abs.com/example.php[^] As you can see, it tells me that if found zero at index 1, and you can see source code that was executed (it is yours :) ) ;)
-
Help with this expressionYeah, I know a little about that, and I know that operator === will work correctly as it will check for type and content of variable, but I just wanted one-line explanation ;)
-
Help with this expressionI've tried that, and it returned: still looking found You at index 1! So PHP thought that "a" was equal to 0 ... again, string is equal to zero, like in my first post ... what's going on ? is it maybe just error in my php installation ?? Right now, I'm very confused :D BTW, I've just tried that script on some other web server, result is the same ... is this kind of bug in PHP or what :D ? Thanks
-
Help with this expressionHello ! I have very simple expression in if statement: "d"==0 So in my code it looks like this: if ("d"==0) { //do something } Of course, booth sides aren't always like that, they are variables, but I saw that I had bug somewhere and it turned out that error occurs always when on one side is string and on other zero ... Can anyone explain to me why does this return true ?? I can't see why string would be equal to zero ... Thanks :)
-
Need algorithmThanks, I'll read it :)
-
Need cut optimization algorithThanks, I'll read that :)
-
Need cut optimization algorithharold aptroot wrote:
I don't really know what you mean by that - could you explain it in more detail?
I meant that I'll try and make recursive function that will implement memoization and try to find best possible solution. Then I'll run it with various number of elements and determine what's the case in which recursive function works OK(not too slow). And if that's OK for the person that has requested the program from me - problem solver :)
harold aptroot wrote:
I have a couple of idea, but none of them are really good: 1) directly use the positions of the rectangles to calculate intersections (slow) 2) use a bitarray (too much memory) 3) hybrid: store big rectangles as rectangles, but use bitarrays to store the small rectangles (justification: in general the small rectangles will end up close to each other since using small rectangles leaves small gaps) Very complex though, and it may not be worth the effort You're welcome, but I have the nagging feeling that there is a better solution - I just don't know what it is.
1. Yes, I think that would be too slow 2. Yes, it would take too much memory if big rectangles maximum size if 32000x32000. But if it is 10000x10000, then memory consumption would be about 100 MB (that I can spare). So this is maybe good solution (I have to contact the person that has requested the program ...) 3. Well, I'm not even sure how to implement this :) Yeah, I too have feeling that there's a better solution - maybe already completed algorithm ...
-
Need cut optimization algorithYeah, you're helping and thanks for that :-D :-D Anyway, I don't think that coordinates will be bigger than 32000 (maybe not bigger than 10 000). I've thought of similar approach with recursion and memoization, but I'm not sure how to do it (I think I'll run into memory problems). And yeah, non-optimal but "good" result should be OK. I'm not familiar with Branch&Bound, but I'll research it and try to learn something :) And one more thought ... Should I try placing every rectangle two times(normal and 90 degrees rotated) in the big rectangle and use memoization? Then I can determine how must small rectangles can there be for that algorithm to be executing in about 10 seconds ? And I also have one more problem ... What's the best way to remember what parts of big rectangle I've already used ? I don't know how to do it ... Should I try with some custom class or ?? Please tell me if you have any ideas :) And one more time, thanks for your big help !
-
Need cut optimization algorithYes, rectangles are allowed to be turned 90 degrees. I don't know possible sizes, they can be anything. Is there any way to somehow calculate coordinates of rectangles inside big rectangle? What do you mean by greedy approach ? Is there any kind of already made algorithm that could help me ?
-
Need cut optimization algorithHello ! I'm making cut optimization software, and have problem with the cut optimization algorithm. I have one big rectangle, and x smaller rectangles (that may and may not be of the same size). Now I need way to calculate optimum position of these rectangles, so that as many as it is possible can fit into big one ... Also I need to draw that positions somehow ... Can anybody help ? Thanks
-
Need algorithmYea, that's what I'm writing ... Cut optimization software :) Thanks for suggestion for google search, I'll try it :)
-
Need algorithmThanks for reply, I'll look into that :)
-
Need algorithmhehe, that's kind of what I've thought of ;) Thanks anyway
-
Need algorithmHello ! Is there any kind of algorithm that will calculate how many rectangles can if in one big rectangle ? I have following problem: have big rectangle, and then many smaller rectangles. I need to fit as much rectangles as it is possible in the big one. Can anyone help ? Btw, I was trying to make something myselft, but I only came out with recursive solution, and I think that it will be too slow (especially when you have maaaaany rectangles). Thanks :)