w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
An exception occurred while invoking executor 'executor://mstestadapter/v1': Type is not resolved for member
I my case, this was a null reference behind the scenes. You should investigate where the type is used where he is complaining about. If you find it you can debug it by inserting the following line's of code: Debugger.Attach(); Debugger.Break(); To fix it, you can do a better test setup or use the following line to skip the code generating the error. var processName = Process.GetCurrentProcess().ProcessName; if(processName == "vstest.executionengine.x86"){ /*Do something else*/ } What I also suspected is [assembly: AssemblyCulture("")] because the test that failed depended on the Culture and I'm assuming the test runner runs without culture.

Categories : Dotnet

difference between executor.submit and executor.execute in this code in Java?
The difference is that execute simply starts the task without any further ado, whereas submit returns a Future object to manage the task. You can do the following things with the Future object: Cancel the task prematurely, with the cancel method. Wait for the task to finish executing, with get. The Future interface is more useful if you submit a Callable to the pool. The return value of the call method will be returned when you call Future.get. If you don't maintain a reference to the Future, there is no difference.

Categories : Java

Using WebDriver JS Executor to execute a .js file --> Null Pointer Exception
Make the JavascriptExecutor instance local to that method. JavascriptExecutor js = (JavascriptExecutor) driver; // give jQuery time to load asynchronously driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS); js.executeAsyncScript(jQueryLoader);

Categories : Java

Chutzpah throws exception in TFS Build: 'executor://chutzpah-js/': Method not found: 'System.String .. get_SolutionDirectory()'
This looks to be an issue when you deploy a VSIX package that depends on VS2013 version of IRunContext and try to run it in VS2012. This particular property is not available in the older version and you get an exception.

Categories : Tfs

Injecting BeanFactory into a Bean
Your bean can implement BeanFactoryAware. By implementing this interface, your bean will receive the BeanFactory through a call to this method: void setBeanFactory(BeanFactory beanFactory) throws BeansException By the way, there is a similar interface (ApplicationContextAware) in order to retrieve the ApplicationContext if you need to.

Categories : Java

Circular dependency in spring beanfactory
If you create circular dependencies with setters, or fields, then there is really not that much of a problem. If initialization depends on these dependencies, then init must be done after all beans are constructed and injected. If they are constructor-injected, then it is pretty obviously not really possible to create the resulting objects. However, as e.g. Guice does, you can anyway, by injecting a "shell" proxy to one of the beans: When constructing A which needs B, you hack up an empty pass-through-proxy of B, and inject that. Then you construct B, giving it the proper A. Then you go back to the proxy and put B into the proxy. So now you have not the real B, but a proxy of B, in A. This might or might not be a problem. I tend to dislike this, finding the result unpredictable. (Bob "cra

Categories : Spring

Spring Framework: No BeanFactory available anymore (probably due to serialization)
You are creating a new ProxyFactoryBean yourself without help of Spring. ProxyFactoryBean needs a BeanFactory which is injected through setBeanFactory. Actually ProxyFactoryBean implements BeanFactoryAware. That means, when Spring creates the instance, it automatically inject the FactoryBean. You would have to manage this yourself with the Java configuration. However I think the XML or annotation-based is more the standard way to config Spring. Why do you want here to convert it to Java-based config?

Categories : Java

Can exception handler get access to globals and locals variables at exception raise?
The stack trace is a linked sequence of frame objects; each frame object has a reference to the globals and locals for that frame. The traceback object has a tb_frame attribute, this is the 'current' frame. The object also has a tb_next attribute, the link to the next traceback object in the stack. Each frame object has f_globals and f_locals attributes, both are dictionaries. The inspect module documentation has a handy overview of the attributes found on traceback and frame objects. You may want to look over the traceback module; it provides a higher-level API to manipulate and display tracebacks.

Categories : Python

what is the best way to check in C# .NET if a directory has access to list files or a unauthorized access exception would rise
The best way to check the permission, is try to access the direcoty (read/write/list) & catch the UnauthorizedAccessException. However for some reason out there, if you want to check permissions, following code should satisfy your need. You need to read Access Rules for the directory. private bool DirectoryCanListFiles(string folder) { bool hasAccess = false; //Step 1. Get the userName for which, this app domain code has been executing string executingUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; NTAccount acc = new NTAccount(executingUser); SecurityIdentifier secId = acc.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier; DirectorySecurity dirSec = Directory.GetAccessControl(folder); //Step 2. Get directory permission det

Categories : C#

Twitter access token and access secret is returning null exception after changing to twitter api version 1.1 in android?
Finally I have figured my problem. Just need to change these things: https://api.twitter.com/oauth/authenticate?force_login=true from http://api.twitter.com/oauth/authenticate

Categories : Android

Why I am getting exception after trying to access Box?
When a user logs in and accepts your app's grant, you exchange the authorization_code for an access_token and a refresh_token (response shown below). The reason your token invalidates is that the access_token expires in one hour. You can exchange the refresh_token, which is valid for 14 days, for another one-hour access token. This is why you'll want the app to store both the access_token and the refresh_token, ensuring that a user will only need to re-authenticate if they return to the app after more than 14 days. Using the refresh_token for another access_token will always return one more of each (refresh + access). { "access_token": "T9cE5asGnuyYCCqIZFoWjFHvNbvVqHjl", "expires_in": 3600, "token_type": "bearer", "refresh_token": "J7rxTiWOHMoSC1isKZKBZWizoRXjkQzig5C6jFgC

Categories : Android

How to use jsf add message when using executor service?
It doesn't work because the message has to go in the HTTP response. When you leave the thread serving the HTTP request with the intent to run asynchronously, you -obviously- lose control over the HTTP response. Even more, the FacesContext is not available in the other thread at all. The particular code would only end up in a NullPointerException. You've basically 2 options: Use polling. You can use <p:poll> for that. Poll in intervals to a session scoped bean as long as until there's a non-null message present. Then remove and display it and stop polling. The executor service should set the message as a property of that session scoped bean. Use pushing. You can use <p:socket> (PrimePush) for that. The executor should set the message via PushContext#push() on an unique chan

Categories : JSF

How to identify the right java Executor?
I think you are limiting your research to just the Executors.* factory methods. You should review what the range of constructors of ThreadPoolExecutor, you'll find a maximum thread pool size limit, among other things.

Categories : Java

Set a timeout in Executor.execute()
This can be done using Future object. ExecutorService executor = Executors.newSingleThreadExecutor(); Runnable task = new Runnable() { @Override public void run() { //do your task } }; Future<?> future = executor.submit(task); future.get(60, TimeUnit.SECONDS); // awaits termination

Categories : Java

Using fully qualified names in C++
They may have found it easier than answering lots of questions from people who tried the example code and found it didn't work, just because they didn't "use" the namespaces involved. Practices vary - if you're working on a large project with lots of diverse libraries and name clashes, you may wish to proactively use more namespace qualifiers consistently so that as you add new code you won't have to go and make old code more explicit about what it's trying to use. Stylistically, some people prefer knowing exactly what's being referred to to potentially having to dig around or follow an IDE "go to declaration" feature (if available), while other people like concision and to see fuller namespace qualification only on the "exceptional" references to namespaces that haven't been included -

Categories : C++

expected a qualified name after 'typename'
You want friend class SingleList<Type>; typename can be used instead of class inside the template parameter declaration, but not everywhere.

Categories : C++

JSP how to get the fully qualified name of a file in JSP
<html> <header></header> <body> <form method="POST" action="upload.do"> escolha o arquivo para fazer upload: <input type="file" name="ctrupload"><br> <input type="submit" name="submit" value="enviar..."> </form> </body> </html> try this public class Uploader extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletInputStream sis = request.getInputStream(); byte[] b = new byte[request.getContentLength()]; System.out.println(request.getContentLength()); sis.read(b,0,b.length);

Categories : Java

c++, error: Invalid use of qualified-name
You have to allocate space for it in global namespace #include<iostream> class sample { public: static int x; }; int sample::x = 20; int main() { sample s1; sample::x = 30; } You can the n set it normally in main or any other method. Here is a tutorial on the static keyword. I removed the using directive because it is bad practice to bring in the whole namespace, especially when you need none of it. The reason that static vars need to be initialized is global scope is because both static and global vars have static storage duration

Categories : C++

What is a qualified/unqualified name in Python?
It is the path from top-level module down to the object itself. See PEP 3155, Qualified name for classes and functions. If you have a nested package named foo.bar.baz with a class Spam, the method ham on that class will have a fully qualified name of foo.bar.baz.Spam.ham. ham is the unqualified name. A qualified name lets you re-import the exact same object, provided it is not an object that is private to a local (function) namespace.

Categories : Python

BAD ACCESS ZOMBIE EXCEPTION
Without any code provided, it is not possible to locate the error. But you could do the following: 1) Use ARC (automatic reference counting). With ARC, you should not have any overrelease of objects, as you obviously have. I strongly recommend to use ARC. It make life MUCH easier. 2) Enable exception breakpoints: In the navigator pane of Xcode, select the breakpoint tab, and click at the plus sign at left bottom. Select exception breakpoints and say done. Then the program will stop at the point where the overrelease is done. You could check then which object was released too early.

Categories : IOS

Executor does not handling tasks as expected
This behavior is due to the logic within the ThreadPoolExecutor where new threads are added if there is a failure to offer a task to the queue. Your queue is not bounded, so it effectively means that we will never grow above the core pool size and up to the maximum pool size. Try this example to see the difference: ExecutorService checkTasksExecutorService = new ThreadPoolExecutor(1, 10, 100000, TimeUnit.MILLISECONDS, new SynchronousQueue<Runnable>()); for (int i = 0; i < 10; i++) { checkTasksExecutorService.execute(new Runnable() { public void run() { try { System.out.println(Thread.currentThread().getName() + " running!"); Thread.sleep(

Categories : Java

Thread issue while using Executor service
As written by the @ReneLink in the comment to my question ,CPEMethodData.getLogDataMap was returning same instance of the hashmap...So by the time thread's run method was getting executed hashmap's content were getting modified.I created deep copy of the hashmap using Cloner facility and passed the same to the thread. Thanks @ReneLink for pointing out this to me.

Categories : Java

Shutdown hook is not killing executor
It is not shutting down because Timer() creates and starts a non-daemon thread ... which is then never stopped. There are two things that can cause the JVM to shutdown of its own accord: A call to System.exit() (or Runtime.halt()) The termination of the last remaining non-daemon thread. Since you have created a second non-daemon thread (in addition to the thread that is running main()) the second condition won't be met.

Categories : Java

Executor wait for ever in a singleton class
I tested your code but instead of using ArrayBlockingQueue I extended it with this... And it works. Try it: public static class MyBlockingQueue extends ArrayBlockingQueue<Runnable> { private static final long serialVersionUID= -9016421283603545618L; public static Lock lock= new ReentrantLock(); public static Condition condition= lock.newCondition(); public static volatile Boolean isWaiting= false; public MyBlockingQueue(int capacity) { super(capacity, true); } @Override public boolean offer(Runnable e) { if (remainingCapacity() == 0) { try { isWaiting= true; condition.await(); } catch (InterruptedException e1) { e1.printStackTrace(); } }

Categories : Java

Get qualified name of an XML element and it's child nodes with C#
Here you go... XmlDocument xDoc = new XmlDocument(); xDoc.Load("Query.xml"); XmlNamespaceManager xnm = new XmlNamespaceManager(xDoc.NameTable); xnm.AddNamespace("schemaLocation", "loc"); xnm.AddNamespace("payload", "loc2"); xnm.AddNamespace("a", "http://www.w3.org/2001/XMLSchema-instance"); xnm.AddNamespace("x", xDoc.DocumentElement.NamespaceURI); Inner Text For Query: xDoc.SelectNodes("//x:Query", xnm)[0].InnerText Inner Text For QueryId: xDoc.SelectNodes("//x:QueryId", xnm)[0].InnerText a:schemaLocation Attribute: string namespaceURI = xnm.GetNamespacesInScope(XmlNamespaceScope.Local).FirstOrDefault(el => string.Equals(el.Key, "a")).Value; var x = xDoc.DocumentElement.Attributes["schemaLocation", namespaceURI].Value;

Categories : C#

ResourceBundle fully qualified name with extensions
A fully qualified resource bundle has the following form: packagequalifier.bundlename + "" + language + "" + country + "" + (variant + "#" | "#") + script + "-" + extensions I don't think this definition is correct. Have a look at the Javadoc. Strangely, extensions (defined in Locale) don't get mentioned...

Categories : Java

ClojureScript macro error: "Can't def ns-qualified name"
htrhrthtrh gets namespace-qualified by syntax-quote in the output, so the result looks like (defn some.namespace/htrhrthtrh [] (js/alert "hi")) which is incorrect, as explained in the exception message. Presumably you'll want to use ~name in place of htrhrthtrh to include the name argument to defn+ in the output; this, or anything along similar lines, would fix the problem. To hard-wire this exact name you'd have to say ~'htrhrthtrh.

Categories : Clojure

Get Assembly qualified name of enum member
You could fake it with a concatenated result: class Program { static void Main(string[] args) { Cars car = Cars.Audi; Console.WriteLine("{0}.{1}", car.GetType().FullName, Enum.GetName(typeof(Cars), car)); } } enum Cars { Audi, BMW, Ford }

Categories : C#

C++11 ambiguity between single qualified name and two consecutive?
struct a ::b; doesn't declare a variable named b of type a, if that's what you are asking. It's a (redundant) forward declaration of the nested type a::b. Whitespace is not generally significant in a C++ program. So your program declares, but never defines, a variable named b. That's a violation of One Definition Rule: the program is therefore ill-formed, and the linker will tell you as much.

Categories : C++

Avoid using static access to Exception
The idea behind this warning is that if you embed the class names inside your code with the new keyword it will be hard to swap out these classes in testing and mock or stub methods that the code under test might call on them. See the explanation in the PHPMD rules. I think in your case this is false positive since exceptions usually doesn't have much behavior on their own but the class name (and class hierarchy behind it) of them is pretty much the only thing important about them.

Categories : PHP

Getting programatical access to the PostgreSQL exception
This information is only available as a text string in the error message in current versions of PostgreSQL. However, the upcoming 9.3 release will expose this as more detailed fields, see http://www.postgresql.org/docs/9.3/static/libpq-exec.html#LIBPQ-PQRESULTERRORFIELD for details. I would assume the JDBC driver will expose the same fields as well, though I'm not sure if they've defined the interface yet.

Categories : Java

Exception on trying to access the entity using key in GAE datastore
It looks like in your chatroomservlet you create an entity but you don't use your generated key. Thus, when you lookup by that key in the say servlet, the datastore won't be able to find the entity. Your chatroomservlet should create the entity using the userkey: Key userkey=KeyFactory.createKey("users", "user1"); System.out.println("user key in chatroom "+ userkey); Entity ent=new Entity(userkey);

Categories : Google App Engine

Access Violation (unhandled exception)
There is an error here: void Stack::Pop() { if(stackPtr = NULL) { ^ this should be == The same error in Stack::Push. In the destructor: Stack::~Stack() { item* p1; item* p2; p1 = stackPtr; while( p1 != NULL) { p2 = p1; p1 ->prev; // this statement does nothing

Categories : C++

how to prevent access denied exception
Do you need it to search in that folder? If so you will have to run it with administrator elevated user or you can create a user with read only access to that folder and run the application with that user. I would ask myself twice if my program needs to read that folder...

Categories : Java

Exception when access to ejb from managed bean
According to the EJB specification for TransactionAttributeType.MANDATORY: If a client invokes the enterprise bean's method while the client is associated with a transaction context, the container invokes the enterprise bean's method in the client's transaction context. If there is no existing transaction, an exception is thrown. As your "client" (the managed bean) has no transaction started, the EJB container throws an exception because you have annotated your session bean with TransactionAttributeType.MANDATORY. Instead of using MANDATORY as value to the @TransactionAttribute, use REQUIRED as this will force the container to start a transaction if there isn't an existing one. The specification about TransactionAttributeType.REQUIRED says the following: If a client invokes t

Categories : JSF

Selenium Javascript executor returns null
The problem is that you execute two statements in executeScript(). The function definition of tmp() and the function call of tmp(). I don't know the details, but the function definition seems to return null. Since executeScript returns the first value that can be returned, it returns null. If you don't define the function and write the code inline, it will work. JavascriptExecutor jsExec = (JavascriptExecutor) driver; Object inpType = jsExec .executeScript("var attrb = jQuery(jQuery("[name='q']")[0]).attr('type');"+ "if(typeof attrb !== 'undefined' && attrb !== false)" + "{return attrb;}" + "else{return '';}"); System.out.println("-------------- Type: " + inpType); This should print your expected value. Edit: Also, your posted code doe

Categories : Javascript

Sequentially processing file in threadpool executor
You can try: Increase the memory of JVM using the -Xmx JVM option Use a different executor to reduce the number of processed files at a time. A drastical solution is to use a SingleThreadExecutor: public class FileProcessor implements Runnable { public FileProcessor(String name) { } public void run() { // process file } } // ... ExecutorService executor = Executors.newSingleThreadExecutor(); // ... public void onNewFile(String fileName) { executor.submit(new FileProcessor(fileName)); }

Categories : Java

ScheduledExecutorService, how to stop action without stopping executor?
You can use the cancel() method from your ScheduledFuture object. Once cancelled, no further tasks will be executed. If you want your currently running task to stop, you need to code your run method so it is sensitive to interrupts and pass true to the cancel() method to request an interrupt.

Categories : Java

tracking tasks not completed in an executor framework
how to make sure that the program uses the results generated by all processing threads. I assume you are asking how does the consumer of the ExecutorCompletionService know when they have consumed the last task? Typically you count the number of jobs submitted to the ExecutorService and then stop taking from the completion service after you dequeue that many jobs. If you have a large number of jobs that you can't queue up all at once, you could have a counter as well as a boolean done status field. So the ExecutorCompletionService will be finished when done is true and the job counter matches. private class CompletedJobInfo { ExecutorCompletionService service; boolean done; int submittedCount; }

Categories : Java

Executor with limited thread count on demand
If a new task can't be queued, a new thread is created, unless you have already reached the maximum core pool size. In your case, the queue can only contain one task at a time so if you submit tasks quickly enough you reach the maximum pool size and get the exception. It works with CachedThreadPool because the maximum core pool size is large (Integer.MAX_VALUE). You need to use a different queue, for example a new LinkedBlockingQueue like in the the fixed threadpool example. Side note: checking the implementation documentation can help understand the details. In particular, the execute method of the ThreadPoolExecutor class has: /* * Proceed in 3 steps: * * 1. If fewer than corePoolSize threads are running, try to * start a new thread with the given command as i

Categories : Java



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