handle

How do you obtain Current Window Handle Count and Window Handle Limit in .NET?

穿精又带淫゛_ 提交于 2019-12-03 12:09:05
I want to obtain the current number of window handles and the system-wide window handle limit in C#. How do I go about this? If you read Raymond Chen's post, you'll probably find it as annoying as I did. You're only "probably doing something wrong" because you're doing something Windows isn't capable of. In my application, the first time a user visits a tab page, I create and lay out all the controls on that page. This takes a noticeable amount of time - there can easily be 50 controls on a page. So I don't discard the controls on a tab page after populating it, if it's at all possible, and

How do i mock a method that accepts a handle as an argument in OCMock?

早过忘川 提交于 2019-12-03 11:03:09
I'm trying to mock a method that has the equivalent of the following signature: - (NSDictionary *) uploadValues:(BOOL)doSomething error:(NSError **)error I want it to return a small dictionary so that my test can make sure the code uses the dictionary properly. however, no matter what i do OCMock always returns nil from the method, regardless of how i stub it out. The error begins as nil in the code i'm testing, and these are the different ways i've tried stubbing it: NSError * error = nil; [[[mock stub] andReturn:someDict] uploadValues:YES error:&error]; [[[mock stub] andReturn:someDict]

Runtime error handling in Swift

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 10:15:34
I am fully aware that Swift doesn't have a try/catch mechanism to catch exceptions (OK, Swift 2.0 now supports them). I also understand that many API methods return a NSError that will be filled with an error object if something goes wrong. So please don't point me to this question: Error-Handling in Swift-Language But this still doesn't explain how to react to runtime errors in your own code, like array-out-of-bounds accesses or force-unwrapping an optional value that is nil. For example: var test: String? test = nil println(test!) //oops! or var arr = [0,1,2] for i = 0...3 { println(arr[i])

Jquery UI sortable, button is not working as handle

心不动则不痛 提交于 2019-12-03 09:27:27
I am trying to sort tr's in a table. code $("table tbody").sortable({ handle: 'button' //handle: 'img' }).disableSelection(); live fiddle now the problem is when using img as handle its working fine but when using button as handle its not working I checked for many jquery ui sortable ques for my ans but of no help can anyone plz explain why is this happening Thanx in advance Nal The cancel option defaults to :input,button which conflicts with your handle setting. Just setting it to an empty string works fine. $("table tbody").sortable({ handle: 'button', cancel: '' }) http://jsfiddle.net/22C2n

Broadcast Receiver Still Running after app close - Android

倖福魔咒の 提交于 2019-12-03 08:50:45
I'm using some code from this tutorial on how to receive SMS messages: The code works perfectly, and does exactly what I want. I am having 1 issue with it. I want my app to run in the background, but when it's closed I want it to stop intercepting SMS messages. My question is, why is my app still intercepting SMS messages after it's been closed? I guess I have to find a "on close" handler and close the Broadcast Receiver then. (If there is a "on close" event handler..?). If anyone can provide some insight I would be very grateful. Thanks! By putting your BroadcastReceiver in your Manifest, it,

How many Windows handles in use is “too many”?

↘锁芯ラ 提交于 2019-12-03 07:30:19
问题 I understand that the answer to this question may depend on registry settings and on the version of Windows, and perhaps on the amount of RAM if there is not enough memory. For the sake of this question, assume that the server has plenty of RAM (3+ GiB). If an application (3rd party application in this case) leaks handles at a few hundred an hour, how many total handles can that application leak before other applications will run into troubles? By "troubles" I mean, for example, fail to start

how to properly reuse a curl handle

孤人 提交于 2019-12-03 05:46:57
问题 I want to properly reuse a curl handle, so that it won't give me errors and function normally. Suppose I have this piece of code: CURL *curl; curl_global_init(CURL_GLOBAL_ALL); curl = curl_easy_init(); curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0..."); curl_easy_setopt(curl, CURLOPT_URL, "http://www.google.com"); curl_easy_perform(curl); curl_easy_setopt(curl, CURLOPT_URL, "http://www.bbc.com"); curl_easy_perform(curl); curl_easy_cleanup(curl); curl_global_cleanup(); Would this be a

AppVerifier reports “Invalid handle - code c0000008” when closing valid handle

孤人 提交于 2019-12-03 03:51:53
I have a simple test program which fails with exception when run under AppVerifier . The program duplicates STD_INPUT_HANDLE and then tries to close it using CloseHandle() . The program works fine without AppVerifier returning TRUE for CloseHandle . But if run under AppVerifier with Lock , Heaps and Handles enabled it throws an exception. Details are below. Can anybody comment why it is happening? Is it an AppVerifier bug? */ // stdintst.cpp : Defines the entry point for the console application. // // // This code fails if run under AppVerifier x64 4.0.0665 // Test is compiled under VS 2005 //

Catching/hijacking stdout in haskell

徘徊边缘 提交于 2019-12-02 23:40:27
How can I define 'catchOutput' so that running main outputs only 'bar'? That is, how can I access both the output stream (stdout) and the actual output of an io action separately? catchOutput :: IO a -> IO (a,String) catchOutput = undefined doSomethingWithOutput :: IO a -> IO () doSomethingWithOutput io = do (_ioOutp, stdOutp) <- catchOutput io if stdOutp == "foo" then putStrLn "bar" else putStrLn "fail!" main = doSomethingWithOutput (putStr "foo") The best hypothetical "solution" I've found so far includes diverting stdout, inspired by this , to a file stream and then reading from that file (

How many Windows handles in use is “too many”?

别来无恙 提交于 2019-12-02 21:02:15
I understand that the answer to this question may depend on registry settings and on the version of Windows, and perhaps on the amount of RAM if there is not enough memory. For the sake of this question, assume that the server has plenty of RAM (3+ GiB). If an application (3rd party application in this case) leaks handles at a few hundred an hour, how many total handles can that application leak before other applications will run into troubles? By "troubles" I mean, for example, fail to start a thread, fail to open a file, and so on. I've seen some servers (lightly loaded) run just fine with a