Basically I used an isolate to convert a changeable number of image files from a system directory using the Image package and the Foundation Isolate.
await compute(xyzFunc, abcArg);
The function which does the things will take the list of image paths in the arguments
xyzFunc(abcArg) {
for(String path in abcArg) {
resize(path);
This will go until some point and throws an error of main() spawn exited with some error. The isolate was killed. There's no indication of any message anywhere. Need help in this.enter code here
Related
Repo for all code I've been using is updated here . When I run the requestor script it exits with a runtime error 2 (File not found). I am not sure how to further debug this or fix it. So far I've converted my code over to a python slim docker image to better mirror the example. It also works for me when I spin up a docker image that typing and running "/golem/work/imageclassifier.py --trainmodel" works from root. I switched all my code to use absolute paths. I also did make sure the shebang (#!) uses linux end of file characters rather than windows before which was giving me errors. Fixed a bug where my script returns error code 2 when called with no args to now pass.
clf.fit(trainDataGlobal, trainLabelsGlobal)
pkl_file = "classifier.pkl"
with open(pkl_file, 'wb') as file:
pickle.dump(clf, file)
is the only piece I could think of that causes the issue, but as far as I can tell this is the proper way to pickle something in python. Requestor script is also heavily based on the simple service example and I tried to mirror my design to that. I just need help in getting more information while debugging, or guidance on how to move forward from here
I want to present images (given as a collection of StorageFiles) in a FlipView.
Images are in a custom format and decoded by:
async Task<WritableBitmap> MyDecodeImage(StorageFile sf) { ... }
The WritableBitmap can be assigned to image.Source.
There can be hundreds of files so they should be decoded on demand rather than all at once.
How to declare my FlipView? It should normally show Images, but for files that have decoding errors it should show an error message.
Use lots of code behind and the ContainerContentChanging event to start/cancel loading the images. Use a prioritized list to make sure you first load an image for the currently visible item rather than something that's virtualized to show something soon. Use StorageFile.GetThumbnail() rather than loading the entire image until you zoom in on the image to use less memory and speed up loading time, especially after the system has already cached the thumbnail.
Once the decoding task is complete - you can write code to specify what should show up in a FlipViewItem.
I need to write some commands in command window using C++ code. How to implement it. I have tried with CreateProcess function but it seems some wrong in it. Please refer my code below:
STARTUPINFO sInfo = {0};
sInfo.cb = sizeof(sInfo);
PROCESS_INFORMATION pInfo = {0};
CreateProcess("C:\\WINDOWS\\System32\\cmd.exe",""0,0,TRUE,
NORMAL_PRIORITY_CLASS,0,0,&sInfo,&pInfo);
It opens the command window successfully. My doubt is how to write command through code in it.
First thing, you need not to create a separate process just to write text output to a console window.
It depends what and how you want to write. You may create a console application itself, or create a console itself, and attach to the current process. You need to use pipes for the same and redirect the output to given pipe (i.e. send data to pipe). At the other end of pipe, you will read the text/buffer and render the output wherever you would like to.
These articles may help:
Console Output from GUI program
Real time Console Output redirection
Since your question is not very clear, this is just assumption.
Or, are you playing with the console itself - like changing colors, dimension etc?
Background
Our build script use Install() and InstallAs() to install a number of .dylib and .so files to a "dist" directory.
Install(dist_dir, 'libfoo')
Install(dist_dir, 'libbar')
...
The problem
After the library files are copied to dist_dir, we would like to run a custom function on each of the files. That custom command is as followed:
def add_magic(lib_filename, arg1, arg2, arg3)
We appreciate any help to achieve our goals.
What have we tried so far?
We just started looked into creating custom builder via Builder()
We also looked at Command() builder
We also looked at the AddMethod() function to create pseudo-builder
Right now our bets are on the first two approaches, we are reading the user guide and working on simple examples. We are no where near the end and appreciate any tips/hint.
You can try something like this:
AddPostAction(target, action)
env.AddPostAction(target, action)
Arranges for the specified action to be performed after the specified
target has been built. The specified action(s) may be an Action
object, or anything that can be converted into an Action object (see
below).
When multiple targets are supplied, the action may be called multiple
times, once after each action that generates one or more targets in
the list.
Example:
installBarCmd = Install(dist_dir, 'libbar')
AddPostAction(installBarCmd, Action(...))
Just like the title says...
Example: I have a file called copy.py. That file wants a path to a file/folder which it will move to another directory and will then return "done" if it successfully moved the file. For some reason I have to run my copy.py file from another python program (it's not given that both files are in the same directory) and wait for copy.py to finish its actions. When it is finished, it should tell me "done" or, let's say, "error", so I know if it actually was successful or not.
Please answer in a way a python beginner can understand...
Often, you can just import the module and call its functionality, but if it's a stand-alone program that expects command-line arguments, etc., then you may want to separate the command-line handling from the functional part of the code, so that you can import and call it as I suggested at the beginning.
Failing that, just treat it like another program:
with os.popen('python copy.py {0} {1}'.format(src, dst)) as copy:
output = copy.readlines()
if 'error' in output:
# Oops...