Install4j - how to exit when "insufficient disk space" - install4j

I use the installation components screen, and I have selected the option for insufficient disk space warning. This works - I get a warning when there's not enough disk space, and the user is presented with a prompt along the lines of continue y/n...
The thing I can't figure out is how to exit the installer when they select n. As it stands, when there's not enough disk space, and the user selects n (to "not continue"), the installer loops back to the installation components selection again, and cycles through the warning again - basically an endless cycle.
There's no "quit on failure" option for the screen, so how do I cancel the install when the user elects to not continue since there's not enough disk space?
Thanks....

There is no way to insert code there, the loop goes back so you can select another installation directory with more space. I have created an issue so that canceling will be added as an option in console mode.
To check this condition beforehand, compare
SystemInfo.getFreeDiskSpace(context.getInstallationDirectory())
with
com.install4j.runtime.installer.helper.content.ContentInstaller.
getInstance().getMinSize() * 1.1
(the above is not in the public API)
You can do that in a run script action that is guarded with Util.isConsole(). Returing false and setting the failure strategy property of the action to "Quit on failure" will exit the installer.

Related

forcing matlab not to pause on warnings

I have encountered a weird situation recently: when I am running my programs, sometimes the execution pauses when it reaches some warning statements (yet, sometimes it doesn't stop in identical situations, and just outputs the warning statement). I cant force the program not to stop. when I click on the small triangle below the "run" or "Breakpoints" in the editor "stop on warning" is sometimes checked, If I remove its tick, it becomes checked again after a while and the program stops on some warnings!
Has anybody encountered similar issue? is there a way to force the program not stop (maybe using some code)
Programmatically, you can use dbstop and dbclear to set and clear break conditions.
In your case, use dbclear if warning.
And see https://www.mathworks.com/help/matlab/ref/dbclear.html

How to stop the simulation when an error occurs in Dymola?

In Dymola, if an error occurs during the simulation, the calculation would be jammed. How could I stop the simulation now? I tried a lot of methods, but the only way that works right now is using the task manager to terminate the Dymola process.
There are multiple ways to stop a stuck simulation in Dymola
The "Stop" button next to the "Simulation" button. The short-cut for this is F12
Create a empty file "stop" (with no extension) in Dymola's working directory.
Within the (Windows) command-window, hitting CTRL-C a different number of times
once: will give you a status of the progress of the integration
twice: will pause the simulation and will give you some online debugging possibilities
three times: stops the simulation (this will sometimes give you more of the result in the plots than using (1.)
Also you will find the sections "Diagnostics for stuck simulation" and "Debug facilities when running a simulation", which corresponds to (3.), in the Dymola Manual (I think it was Volume 2).

Can I watch what accesses a particular address?

With Cheat Engine it is possible to watch a particular address and keep track of what has accessed a particular memory address. I was wondering if this can be done too with OllyDbg or IDA. I could not find anything that would do that.
You can use hardware log breakpoint for that purpose.
Go to the address you want to monitor in the dump window (e.g here, I want to monitor 0xCB7008):
Press CTRL+F5 on the chosen address in the dump window (or right click and `breakpoint > hardware log):
Set Break on to Access R/W
In Expressions enter once again the address in square brackets
Set Pause Program to never if you don't want to stop on each access.
Set Log values of expressions to Always
Note that the data size if not really important (1 byte will break for 2 or 4 bytes access).
Go to the log window (ALT+L), press CTRL+X to clear it, and run your program (F9).
In the log window: you should see all accesses to the memory (the leftmost column indicates the code address where the read/write happens):

waitbar matlab before start a standalone script

I did a standalone application in Matlab and it works. The only problem is that when I launch the application, it takes time before start asking to the user some file (it is the first think the program has to do). The user does not understand if the program is working or not, since no message neither symbol of working progress appear on the screen.
My idea is to show a waitbar until the window asking the file to user appears.
How can I do this? is it possible to use the waitbar outside a loop?
The script starts as follow:
close all
clear all
[filename,pathname] = uigetfile({'*.xlsx'},'Opening File','C:\');
I don't know why, it takes time before open the window for choosing the file.
The time between launch and file selection input appearing is most likely due to the time it takes to load the MCR. You could add a splash screen to your compilation.
If the end user is running from a command line wrap your exe in a system/shell which writes to the command window that the application is starting.
Your issue is most likely the use of clear all. This makes MATLAB remove all variables (in scope, global and persistent), and compiled scripts from memory, forcing it to recompile and load everything again.
If your purpose is to clear all variables in the current scope, you should be able to increase the initial speed of your script by only running clear instead.
Even faster speed can be achieved if you specify which variables to clear using clear var1 var2 ...

MATLAB code break

I have started running a script on MATLAB that takes days to finish. Usually, if I changed my mind and I don't want wait for it to finish and I get content with the intermediate results, I highlight the command window and press Ctrl-C to break the code.
Now, I have run MATLAB. But its desktop got kinda stuck in the background. When I try to restore the desktop from the toolbar, it does not restore. But I know from the task manager that the process is running and is consuming Memory and CPU performance. So, I am kinda stuck. I don't want to kill the process because I need the intermediate values in the workspace, and I can't open the desktop to break the code using ctrl-c.
Is there any solution? For example, is there any command that can be used in the command prompt to act as ctrl-c for MATLAB?
I am using MATLAB R2012b and Windows 8.
Quick try to fix the recent Problem:
Try ty set a higher priority to matlab.exe in the Task Manager. (Right click -> Priority -> Higher than normal). Then see if you can get the window to front.
Some approaches to avoid this problem in future:
Try to optimize your code. For starters look at: http://de.mathworks.com/help/matlab/matlab_prog/vectorization.html
Use Matlab compiler for faster execution: http://de.mathworks.com/products/compiler/
Include some drawnow commands at stratetic positions in the code. This allows matlab to process the Event Queue and capture ctr-C commands.
Save intermediate results to output files. For example you could write an output file all 30 min with your intermediate results. Easyiest way would be just save(filename). Then a .matfile with all your workspace variables is generated. You can than kill the process in the task manager, without loosing too much results.