w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Using a try-catch to display an image in a new browser window C#
To open that image in internet explorer: Process.Start("iexplore.exe", @"http://www.companysite.com/img/XL/"); You can have it open in any browser that is installed by changing the first parameter to the name of the executable of browser you want to use, for example, chrome would be "chrome.exe"

Categories : C#

Using try-catch and if-else statement to open new browser window
Try Catch won't trigger in this. See the link below How to: Request Data Using the WebRequest Class 4.. You can access the properties of the WebResponse or cast the WebResponse to a protocol-specific instance to read protocol-specific properties. For example, to access the HTTP-specific properties of HttpWebResponse, cast the WebResponse to a HttpWebResponse reference. The following code example shows how to display the status information sent with a response. Console.WriteLine (((HttpWebResponse)response).StatusDescription); Add logic around the status return.

Categories : C#

Any way to know if a XMLHttpRequest has completed within a separate XMLHttpRequest scope?
jQuery's ajaxStart() only fires for the XMLHttpRequests come from jQuery itself. One alternative approach may be to maintain a counter by yourself, increasing it after xhr.send and decreasing it in onreadystatechange function.

Categories : Jquery

Catch JavaScript Errors in Selenium WebDriver – Browser Independent
I don't know of any way to directly catch Javascript code errors by a test framework. If I were to guess, I would use PhantomJS. Or, maybe something like MITM Proxy would work? As a sidenote, if you run Selenium2 Grid Hub with a separate Node, you can pass a Java option to the JVM of the node like this that will allow a proxy through Fiddler to work. Fiddler listens (by default) on port 8888. With this method you can watch packets. :: batch script: Set JAVA_OPTS java options to JVM SET "JAVA_OPTS=-Dwebdriver.chrome.^ driver=%CHROMEDRIVER%" IF "%PROXY_TO_FIDDLER%"=="true" SET "JAVA_OPTS=%JAVA_OPTS% -DproxySet=true^ -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=8888" I created scripts you can use to start your grid and node here. It seems to me that you could use this method to

Categories : Java

Is it possible to both catch browsers width and still adjust the content when browser is made smaller
You set the width to 70em. That's a fixed width (more or less considering it's based on font size). Within the media query you do not set the width anywhere. You just set the background. You would need to adjust the width of the object you want to resize within the media query. So if you have body{ width:70em; } @media only screen and (min-width: 481px) and (max-width: 1024px) { body { background : #B0E0E6 url(img/bg.jpg) no-repeat; width: 50em; } } That would resize the body based on the media query that you specify. Also, you may wish to look up CSS units to make sure you want to use em (because by your description, % may work for your needs): http://www.w3schools.com/cssref/css_units.asp

Categories : HTML

What is the difference between the 3 catch block variants in C# ( 'Catch', 'Catch (Exception)', and 'Catch(Exception e)' )?
First version catches all exceptions deriving from the Exception class. The second version catches specified exception. The third version catches a specified exception with a declared name. Then in the catch block you can use this object, for example, to see the complete error: e.ToString(); Read more here.

Categories : C#

What is the reason of try-catch-rethrow without additional processing in catch block?
You're right - it's generally pointless. I have seen people include it so that they can put a break point on the throw line (so they get to see when an exception is thrown, even if they're not breaking on exceptions in general). Unfortunately it often gets left in there after the debugging session has finished. If you encounter this within a code base you control, I suggest you remove it.

Categories : C#

Using try-catch to catch string input of fractions from JTextField in Java
There is no problem with the line test1.matches("(d+)(p/)(d+)"); It will return either true or false. But will not throw any exception . to do this you can check the boolean value of mathes method if(!test1.matches("(d+)(p/)(d+)") // show the dialog

Categories : Java

How can you catch a "permission denied" error when using fopen in PHP without using try/catch?
I think you can prevent the error by using this solution. Just add an extra check after tempnam line $tempfile = tempnam('res/', TINYIB_BOARD . 'tmp'); # Since we get the actual file name we can check to see if it is writable or not if (!is_writable($tempfile)) { # your logic to log the errors return; } /* Create the temporary file */ $fp = fopen($tempfile, 'w');

Categories : PHP

c++ catch catch bad_alloc and delete pointer
Decision can be like this: List_Node*List::copy(const List_Node* list) { if(list == nullptr) { return nullptr; } else { List_Node* temp = 0; try { temp = new List_Node(list -> value_); temp -> next_ = copy(list -> next_); return temp; } catch (bad_alloc& ) { delete temp; throw; } } } Or use auto-ptr in the first case.

Categories : C++

How to catch and log exception inside Using statement without using try-catch?
A using statement involves try/finally; there is no catch. But frankly, your concern is overkill; multiply-nested and complex try/catch/finally is "undesirable" because: it makes the code hard to read and even harder to get right (most people get it wrong, alas) it is frequently misused it suggests your method is doing too much With using, this isn't an issue; it makes the intent very clean, without adding complexity or concern. I would just use: using (some_resource) { try { // some code } catch (Exception ex) { LogIt(ex); throw; } }

Categories : C#

Try/Multi-Catch vs Single Catch
tl;dr Mutlicatch handles things singlehandedly, multiple catch blocks are more flexible and nicer to operations. The two techniques can be combined. If you have a try statement that can throw many different exception types, you'll want the multiple catch blocks. It's a bit more code but offers far greater flexibility. For instance, if working with sockets, a SocketException may be caught with nothing more than a reconnect and/or an error message (as something as simple as an inadvertently disconnected cable may cause this) If a null pointer exception(although it's unchecked) is caught, you're going to want to write to a log and make an emergency landing here, cleaning up what you can, and backtracking quite a bit codewise, possibly. In addition, this can be subdivided even further, whe

Categories : Java

can a Try Catch work within a Catch
Yes, it is possible to put a try/catch block in a catch block. However, from your description, it sounds like you want more 'intelligent' exception catching. You can do something like this: try { // some operations including something with a database } catch (DatabaseException $e) { // the exception thrown by the code above was a DatabaseException // output some error message without using the database } catch (Exception $e) { // the exception thrown by the code above could have been any type of exception EXCEPT a DatabaseException // so you can still try to use the database to compose the error message } Note that anything that can throw exceptions can also throw these exceptions when run from a catch block. For example, when the try block throws an exception befor

Categories : PHP

Firefox blocked the ads
Add an exception in your ad blocker. While on your page, click on the icon of your ad-blocking extension (there should be one somewhere), and add your domain to the whitelist (ex add "librax.net*" to the whitelist), or click a button like "Don't block ads on this page". This would depend of the firefox addon you use.

Categories : HTML

PHP exec is blocked by ISP
Is there an alternative way to do this ? There also are system and shell_exec, but I'd assume this to be disabled for the same reasons. Like pointed out in the comments, you could also just provide your server's static IP instead of having the script determine it. However, chances are sockets are disabled as well, so don't put your hopes too high. Do all Isp's block this ? Most Hosting Providers do. Obviously a hosting service doesn't want you to run arbitrary commands on the shell that could potentially reconfigure the machine. What can I do? Get paid hosting that allows you to exec. A VPS or a dedicated server comes to mind.

Categories : PHP

SelectorImpl is BLOCKED
If you can elaborate more on what your Netty is doing it could be helpful. Regardless - please make sure you are closing the channels. Notice from the Channel javadoc: It is important to call close() or close(ChannelPromise) to release all resources once you are done with the Channel. This ensures all resources are released in a proper way, i.e. filehandles If you are closing the channels, then the problem may be with the logic it self - running into infinite loops or similar - which may be able to explain the high CPU.

Categories : Java

Query on users blocked
If i have understood your question right, you want to search all the records where block_user_id is not equal to 1 and records are present in both the tables. Mat be this below mentioned query will help you Try this: SELECT U.first_name, U.sex, U.age, U.id, UB.request_user_id, UB.block_user_id FROM users U INNER JOIN users_blocked UB ON U.id = UB.block_user_id WHERE U.sex <> 'm' AND UB.block_user_id != 1

Categories : Mysql

Is there a way to find out, whether a thread is blocked?
Use Boost Asio. It has its own thread pool management and scheduling framework. The basic idea is to push tasks to the io_service object using the post() method, and call run() from as many threads as many CPU cores you have. You should create a work object while the calculation is running to avoid the threads from exiting if they don't have enough jobs. The important thing about Asio is never to use any blocking calls. For I/O calls, use the asynchronous calls of Asio's own I/O objects. For synchronization, use strand objects instead of mutexes. If you post functions to the io service that is wrapped in a strand, then it ensures that at any time at most one task runs that belongs to a certain strand. If there is a conflict, the task remains in Asio's event queue instead of blocking a wor

Categories : C++

.js file being blocked by all browsers
I get a warning message that content unsecure content is being blocked. You seem to be on a secure (HTTPS) site and loading your scripts via HTTP. All ressources need to be loaded with a secure connection otherwise the page would be corrupted.

Categories : Javascript

why the agent is blocked for my code?
I think the problem is with this line: (def total (apply + result)) It should be: (def total (apply + @result)) It wasn't actually blocking, it was throwing an exception. One more note: you should consider using recur in doin3, instead of direct call, as it's in a tail position already.

Categories : Clojure

semaphore p3 blocked forever?
you are right - deadlock - nothing printed. at deadlock: p3 is waiting at second P(C). either p1 or p2 has done its first iteration, the other - zero iteration. both p1 and p2 is waiting at P(A). value of d depends on race between p1 and p2 - which entered first iteration.

Categories : Misc

Click seems to be blocked by blur
In my trials, I did not find any issue with your code. However, if you really have a scenario in which the blur and the click of the button seem to conflict, you could have a variable that is set when the validity is being triggered and reset once the validation is completed. Basically, in your linking function on the directive, have the following: //Keeps track of the validation being active var validationInProgress = false; function dovalidation () { validationInProgress = true; //Validation code goes here if (EMAIL_REGX.test(elm.val())) { ctrl.$setValidity('emails', true); } else { ctrl.$setValidity('emails', false); } //Set this after validations are over //Should be the last statement in this function validationInProgress = fals

Categories : Javascript

GET xmlHTTPrequest not working
The XmlHttpRequest object is asynchronous, which means that when it has the data ready, it returns it in a method. It is best to create a function to act as an event handler so that when the server responds, it calls the event handler function. I think the solution you need is similar to here: How to get the response of XMLHttpRequest?

Categories : Javascript

XDomainRequest Vs XMLHttpRequest on IE8 and IE9
First note this: IE11 deprecates the XDomainRequest object and it is not available in IE11 Edge mode. 1) What is XDomainRequest and why IE has this object? Several years ago then XMLHTTPRequest 2 spec was developing by W3C all browsers build level 2 over XMLHTTPRequest level 1 Microsoft create the XDomainRequest. So XDomainRequest is not a subclass, this is a non-standard IE feature. 2) Yes, XDomainRequest lacks the "withCredentials". Because: In order to prevent misuse of the user’s ambient authority (e.g. cookies, HTTP credentials, client certificates, etc), the request will be stripped of cookies and credentials and will ignore any authentication challenges or Set-Cookie directives in the HTTP response. XDomainRequests will not be sent on previously-authenticated connecti

Categories : Javascript

XMLHttpRequest.readyState
readyState changes in a few places, check out Mozilla's documentation for more information. req.readyState = 0 means that req.open() has not been called yet. Also, depending on what browsers you are trying to support with this code, you can look into using some of the features from XHR2, including a req.onload() function that would change your code to: function callAJAX(url, pageElement, callMessage) { var elem = document.getElementById(pageElement); elem.innerHTML = callMessage; var req = new XMLHttpRequest(); req.onload = function() { elem.innerHTML = req.responseText; }; req.open("GET",url,true); req.send(null); }

Categories : Javascript

XMLHttpRequest charset
As far as I remember, the default charset for XMLHttpRequest is utf-8, which you can (and should) use to send Hebrew. However, you can set the charset encoding yourself with: xmlhttp.setRequestHeader("Content-Type", "text/plain;charset=UTF-8");

Categories : PHP

Get URL # fragment XMLHttpRequest
Can you please post your response, executing a console.log(xhr.response, xhr.responseText) and post it here (modifying accordingly with some dummy data)? I think you need to manipulate some strings to get the value you need.

Categories : Javascript

xmlHttpRequest to absolute url in WP8
Solution for this was to move the timout to below the open.. so: var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function (){ if(xhr.readyState == 4){ if(xhr.status==200){ alert(xhr.responseText); }else{ console.log("Error: "+xhr.responseText); } } } xhr.open("POST","http://google.com",true); xhr.timeout = 30000; xhr.setRequestHeader("Content-Type",contentType+"; boundary=" + boundary); //other headers / auth etc xhr.send(bodyBuf);

Categories : Windows Phone 8

Blocked insecure content chrome
All your assets and objects being loaded should all come from SSL. Normally what is happening here is that you are calling something like a script or css file that is pointing to http rather than https. Your best bet is to load all resources and assets using schemeless urls src="//somedomain.com/asset.css" for example.

Categories : Google Chrome

JQuery Wrap Does not Effect because Blocked by CSS
To do what you're after I think you just need to remove .slide-slide from your jQuery() as looking through your url I don't see that element. To do it a slightly different way we can assume that because the links are being put on via jQuery they don't need to be indexed (SEO). So you could just try binding a click to the .slide-content-x, .slide-slide or parent element and change the window location? Using: http://avonmore.ac.nz/? $( '#orbit-inside' ).on( 'click', '.slide-content', function() { var url = 'http://avonmore.ac.nz/'; if ( $( this ).hasClass( '.slide-content-1700' ) ) { url += '/courses/hairdressing/'; } if ( $( this ).hasClass( '.slide-content-1702' ) ) { url += '/courses/freight-warehousing/'; } if ( url != 'http://avonmore.ac.nz/

Categories : Jquery

Mouse events blocked because of QGL View
I can confirm that this is a regression. Tested on OS X 10.8.4. It works under Qt 4.8.5, doesn't work under Qt 5.1.0. You should report it as a bug. Below is a sane single-file test case that you will know to produce the next time you post to stackoverflow :) //main.cpp #include <QApplication> #include <QPushButton> #include <QStackedWidget> #include <QVBoxLayout> #include <QGraphicsView> #include <QtOpenGL/QGLWidget> class TestView : public QGraphicsView { public: explicit TestView(QWidget* parent = 0) : QGraphicsView(parent) { setViewport(new QGLWidget()); setScene(new QGraphicsScene(this)); scene()->addEllipse(-50, -50, 100, 100, QPen(Qt::red), QBrush(Qt::lightGray)); } }; class Pane : public QWidget { public:

Categories : Qt

Java concurrency - is monitor blocked?
Is there a way to tell from one thread (say the one which locks a monitor object) if another thread is block/waiting on same monitor? No, not from the object itself. You can, as @Evgeniy mentioned, use other of the java.util.concurrent.locks.* classes which allow you to view the queued members, but not from a synchronized (lock) type of object monitor. I would like the collector to know that when he finishes collecting, a possible data update is pending which yield the collected data might already be invalid. How about having a BlockingQueue of updates so the collector could check the queue and see if it is non-empty. The updater thread(s) would just be adding Update information to the BlockingQueue and the collector would dequeue the updates and make the adjustments. It then

Categories : Java

pop up alert triggers when blocked and allowed
Instead of a pop up window I would recommend using a javascript modal pop up instead. Modal pop up windows will not be blocked and are not as intrusive as a pop up window. Here is a demo: http://www.jacklmoore.com/demo/modal/modal2.html http://www.jacklmoore.com/colorbox/example1/ Outside HTML (Ajax) would be the best example for you. Have a look at the source code to see how to call this if this is what you want. There are many options for this. Here are a couple jquery options: http://www.jacklmoore.com/colorbox http://jqueryui.com/dialog/#modal

Categories : PHP

Why does Threads in BLOCKED state do not get interrupted?
Blocked Threads can receive Interrupts. You may have to check Thread.currentThread().interrupted() to see whether Thread got interrupt when it was waiting to acquire any resource. See Also Lock::lockInterruptibly()

Categories : Java

Email sent from VPS going into spam folder or being blocked
One reason why your messages may be going to the SPAM folder is the lack of a positive reputation. Look at it from Gmail's perspective... about 80% of new sources of email are spewing malicious messages. Often times Gmail and other mailbox providers look upon new sources of email as guilty until proven innocent. ReturnPath, a email reputation company shows your IP as not having sent very much mail. https://senderscore.org/lookup.php?lookup=174.136.14.186 By sending good mail to people who want to receive your messages your mail will begin to more often land in the inbox. Your only other options are to play around with your content. Try using different local address portions, domains, subjects, and content. If you include URLs like bit.ly which is a domain commonly abused you could

Categories : Email

FB.login() after FB.getLoginStatus() being blocked on Safari
Rather than calling the asynchronous method FB.getLoginStatus(), just check to see that FB.getUserID() is not null, undefined, or 0. var userID = FB.getUserID(); if(!!userID){ //user is logged in } else { //user is not logged in so call }

Categories : Facebook

Blocked iframe in google chrome
I am afraid I do not have the reputation of marking it as a possible duplicate. Hence my only option is to paste the link here. Hope it helps. Unsafe JavaScript attempt to access frame with URL - in the same domain

Categories : Javascript

CPWindow is blocked after closing CPPanel
It's likely you're not dismissing your panel successfully, and so its modal state remains active. Try this in the code responsible for closing your panel: [CPApp abortModal]; [thePanel close];

Categories : Misc

SendKeys not working/being blocked in my c# application
As @Jordy said, SendKeys.SendWait was the solution to the problem. This waits for the input to be processed, thus avoiding anything else being done before the keystroke's action takes place. SendKeys.SendWait("{TAB}"); instead of SendKeys.Send("{TAB}");

Categories : C#

SendInput is blocked in fruit ninja for pc
I suggest You are simulating only mouse move. You should simulate mouse drag. First do mouse down -> mouse move -> mouse up Here some code from my old project: namespace Clicker.Enums { public enum MouseEvents { MOVE = 0x0001, /* mouse move */ LEFTDOWN = 0x0002, /* left button down */ LEFTUP = 0x0004, /* left button up */ RIGHTDOWN = 0x0008, /* right button down */ RIGHTUP = 0x0010, /* right button up */ MIDDLEDOWN = 0x0020, /* middle button down */ MIDDLEUP = 0x0040, /* middle button up */ XDOWN = 0x0080, /* x button down */ XUP = 0x0100, /* x button down */ WHEEL = 0x0800, /* wheel button rolled */ VIRTUALDESK = 0x4000, /* map to entire virtual desktop */ ABSOLUTE = 0x8000 /* absolut

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.