I have the problem that my Progressbar(Gui made with WPF) is freezing when I call a function.
I tired to solve the problem with start-job, but when I do it like that, I can't call a custom made function. I have found the paramter InitializationScript which allows me to use my functions.
But is there a better way to do it?
Thanks for your help
Related
I am looking at a two step approach for a optimization problem. My first step is using a MILP formulation of the problem and the second step involves using the solution from the first step as an initial solution but now with a MIQP formulation. I have been able to apply this concept in MATLAB using CPLEX. However, I am now trying the same using CVXPY with CPLEX as the solver. Now I know about the warm_start option but this does not work with the CPLEX solver. I am able to set CPLEX parameters but I am not sure how to initialize my solution. I am thinking of setting the ADVANCE START SWITCH parameter for CPLEX to 1, but now I need to set the initial solution. According to this page: http://www-eio.upc.es/lceio/manuals/cplex-11/html/usrcplex/solveMIP17.html, I need to use the method setVectors in a Concert Technology application, or by using CPXcopymipstart in a Callable Library application to set the initial solution. I am unsure of how to use this along with CVXPY.
The functionality you are looking for does not currently exist in CVXPY. CVXPY is a generic modeling layer that wraps around several solvers and it does not expose the CPLEX-specific CPXreadcopymipstarts nor CPXaddmipstarts functionality.
The fact that setting the value property of variables and using the warm_start option, as suggested in this answer, doesn't work, is a CVXPY issue. It looks like there is an open github issue for this here. In the future, this will likely be the intended solution to your general question.
For now, you'll have to use one of the CPLEX APIs directly. As you mentioned in the comments of this related stackoverflow question, you do not like the idea of using the lower-level CPLEX Python API. That leaves you with docplex as a viable option.
Is it possible in cleanup method in Spock check is feature (or even better - current iteration of feature) passed or failed? In java's JUnit/TestNG/Cucumber it can be done in one line. But what about Spock?
I've found similar questions here:
Find the outcome/status of a test in Specification.cleanup()
Execute some action when Spock test fails
But both seems to be overcomplicated and it was years ago. Is there any better solution?
Thanks in advance
Update: main goal is to save screenshots and perform some additional actions for failed tests only in my geb/spock project
It is not over-complicated IMO, it is a flexible approach to hooking into events via listeners and extensions. The cleanup: block is there to clean up test fixtures, as the name implies. Reporting or other things based on the test result are to be done in a different way.
Having said that, the simple and short answer to your question is: This still is the canonical way to do that. By the way, you didn't tell us what you want to do with the test result in the clean-up block. This kind of thing - explaining how you want to do something but not explaining why (i.e. which problem you are trying to solve) is called the XY problem.
I'm quite new to using electron and I'm having a problem that seems to be to do with the setInterval() function. I'm importing a library named exiftool-vendored which in turn depends on a library named batch-cluster.
Batch cluster is crashing when I import it because it expects a return value from setInterval() of class Timeout which is what the node implementation returns. Instead it returns an integer which is what chrome returns. See the docs here for the two different implementations:
https://nodejs.org/api/timers.html
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval
So I have a few questions in regard to this
Is the problem what I think it is?
How would I solve it? I'm thinking of forking the batch-cluster library, is there a better solution that doesn't require this?
Does this happen often in Electron? Are there functions defined in both Node and Chrome which have the same name but behave differently?
Thanks for taking the time to look at my question!
Josh
It's not a great idea to do long running tasks in the Electron main process, it can cause lots of issues.
I submitted a PR to batch-cluster which should fix the issues when it makes it into exiftool-vendored.
This is my first post in stackoverflow, eventhough I'v been reading here for more than a year.
I would like to ask some questions about function hooking, and would be really glad to have some answers.
Say I created an executable and I would like to hide it in the list of the task manager so it would be invisible.
I could hook the function in the task manager that is in charge of displaying all the running processes.
I know that in order to do such a thing I would need to start by injecting my own DLL to taskmgr.exe, and taking over the required function using one of many techniques.
My question are the following:
1.How could I get the name of my requested function ? Would I disassemble taskmgr.exe and search there ? I would like to hear a little more about techniques from this kind.
2.Say I know my function name, how could I get its run time address in order to invoke my hook ? Is the address I will find while disassembling the exe the same as the run time address ? If not, how would I find it ?
3.A general question about hooking functions, Say I hook windows messagebox function, and would override it so that each message that should be printed would print "ABCDEF", Would that affect each process that uses the messagebox function or only my process ? Would love to get an explanation about this issue.
Thanks alot in advance :)
Michael.
Hey, in my python modules (written in python) I want to be able to access the variables from the top level scope, that is, the file that is calling the modules. How would I go about doing this?
Thanks.
There's no way that will work in all environments, so a precise answer might depend on how you are running your top-level Python code. The best thing to do is to put the variables into an object and pass the object to the functions that need it.
In general, the way to do this is to provide some API to your plugins (e.g. a module that they import) to provide controlled access to the information they need.
If this information may vary by context, and passing in different arguments to a plugin initialisation function isn't appropriate, then an information API that uses threading.local under the covers may be of value.