autoconfir rmdir - octave

i am running a long matlab script and it should run when i am not around.
part of the script cleans up previous created folder structures (temp data).
rmdir('dir','s');
however matlabs rmdir will ask me the following:
remove entire contents of dir? (yes or now)
and i need to supply either yes or no to proceed.
i tried piping
pipe(printf('yes'),rmdir('dir','s'));
and other things but nothing works so far.
Problem
how do i autoconfirm with 'yes' to 'rmdir' so my script will not get stopped because of this issue?m

Using confirm_recursive_rmdir you can turn this question on or off. This is a feature of octave, matlab never asks to confirm rmdir

confirm_recursive_rmdir(0) will do the trick

Related

Error executing SQL script; The process cannot access the file because it is being used by another process:'C:\\Users\\......\....cnf'

I am trying to run a script to import data into MySQL. When I tried, this error shown up. I have searched for a workaround but none is helping. I deleted all the related .cnf file in the said path after a few attempts on trying to run the script but it kept on creating a new one. I have no other means of importing the data besides running that script. Terribly sorry if I somehow really ask a silly question about this but I am new with SQL, stuck and need help on the matter. Thanks in advance.
i have the same error as you, I've manage to solve it on my end by following these steps:
Rather than doing "run sql script", do "open sql script"
After the script open, Execute all (the lightning btn beside the save icon)
Hope this will work for you too!
I ran into this problem as well and, like #Alexandre-St-Amant, the size of my script prohibited opening the script as #vika suggests.
Before noticing #Kwaadpepper's suggestion, I tried using connecting to my database through mysqlsh.exe, then used SOURCE <data_file>. This has the added benefit of allowing linked scripts using SOURCE, solving #Adrian-Moldovan's issue.
Of course, this does not use mysql-workbench to solve the problem.
I had same problem with my sql script.
You may try reinstall the client and workbench. You should follow one version of applications. After that actions my script has worked.
My sql file was really big and I was not able to copy the contents or load the file. Instead, do this :
Server' -> 'Data Import
Dump the data from sql file from here. This worked for me.

Batch file doesn't work properly unless I'm watching it

I've searched for a solution to my issue, but it's strange and I can't exactly figure out where it's going wrong.
I have a batch file that seems pretty straightforward. In a directory that has two files, it's supposed to delete one, copy the other, then rename it to what the file just deleted was named. Everything seems to work properly except for the renaming. It almost appears that the script runs twice, but I can't find any actual evidence of this. Please see below:
SET filepath="\\server-name\directory with a space\"
SET oldFile=filename.csv
SET curFile=filename_*.csv
REM ===Delete current filename.csv===
IF EXIST %filepath%%oldFile% DEL %filepath%%oldFile%
REM ===Copy all versions of .csv files that begin with filename_ to the Archive folder===
IF EXIST %filepath%%curFile% COPY /y %filepath%%curFile% %filepath%%Archive
REM ===Rename the .csv file beginning with filename_ to filename.csv===
IF EXIST %filepath%%curFile% RENAME %filepath%%curFile% %oldFile%
If I run this manually, it appears to work fine. However, when I let it be called from a Scheduled Task, it appears to run twice... that is, it deletes the filename.csv, copies the filename_*.csv to the correct place, but then seems to delete the second file rather than rename it.
As I said, I'm really unclear on what is actually being done. I've tried logging the results in an output file, but there isn't anything helpful within.
Can anyone see anything I'm missing?
Thanks in advance.
Examine
IF EXIST %filepath%%curFile% COPY /y %filepath%%curFile% %filepath%%Archive
Note that archive appears to have a leading % - is this meant to be a directory "archive" or is archive set to something you're not showing us and therefore it should be ...%filepath%%Archive%
The consequence of the (?missing/stray %) is that the file would be copied to a file named archive or to a directory named archive if that directory already exists.
Personally, I'd use
SET "filepath=\\server-name\directory with a space"
where the quotes delimit the string to be assigned (so no stray trailing spaces are assigned to the variable) and then construct the source/destination names using "%var1%\%var2%" which ensures no double-" appear and the directory is obvious (but this is a matter of style).
It is a best practice to quote paths. In this case, where a space is involved, it is a requirement. It is easier to omit quoting from the varaiable definition and provide them where needed when the variable is used.
SET filepath=\\server-name\sharename\directory with a space\
IF EXIST "%filepath%%oldFile%" DEL "%filepath%%oldFile%"
In my experience, it is best to leave the directory at the end of a path without the trailing backslash. Also, a UNC path should have a sharename.
SET "filepath=\\server-name\sharename\directory with a space"
IF EXIST "%filepath%\%oldFile%" (DEL "%filepath%\%oldFile%")
I've finally discovered the solution to this. Turns out there was a copy of the task running on an older server that our new environment had been migrated from. It was running at the exact same time as the one on the new server, which is why it would run perfectly fine any way I tried to run it before or after the time the task was set to run. Disabling the old version of the task resolved the issue.
Thank you to those who provided feedback and suggestions on my commands!

Octave error : no such file

I'm running Octave 4.0.1 on windows 7 and I'm having this weird issue.
I created a functioning script which is saved under C:/User/Documents/Octave. This script also reads some files in a subfolder of this same location.
The problem is : my script correctly runs TWICE then I have the error "no such file" saying the software did not find my script (the same one I just ran). The only "solution" I have is restarting the whole software but then it still goes nuts on the third run.
In addition to that, my coworker tried it on an ubuntu machine and it seemed to work fine. Do somebody see an explanation?
Thanks
Here is the script :
data = [];
figure();
for i=1:200
filename = strcat('C:/Users/Utilisateur/Documents/Octave/data/DAQ_data_decoded_', num2str(1800+i))
d=lvm_import(filename);
data=[data d.Segment1.data(:,2)];
end;
data=reshape(data,6600,1);
hist(data);
The function lvm_import is a function I found on the web to extract data from a Labview data file. (d.Segment1.data(:,2) is a 33x1 array)
And the error message :
>> daqDataHist
error: no such file, 'C:\Users\Utilisateur\Documents\Octave\daqDataHist.m'
So I still don't really know what was going on but by adding fclose all at the end of the script I got rid of any error and can run the file as many times as I want. It was probably something going wrong with opening and closing the .lvm files and it "jammed" at some point.
Thanks anyway :)

VB Editor pops up for no reason

I have an MS Access form, and on a button click it runs VBA code to run the Shell Command.
private sub cmdOpen_click()
dim vValue as String
vValue = Listbox.column(1) 'Retrieving a path name from a list
shell "C:\Adobe's Path\Arco.exe " & vValue
end sub
When I first run this script the first time I open this database, it stops running, opens the script editor, and highlights the shell line. There is no error code, in fact if I just hit the Run button it finishes just fine. If run it a second time there is no issue. Only when I close it down and reopen it.
No there is no Breakpoints/stops in the code. Would anyone have any idea why this is happening? I can't seem to fine anyone else with a similar issue.
I have had issues with this in Access 2010. I found that there was a breakpoint on that line, and for some reason Access seemed to remember it even after closing the application. For me, it usually happened when I fixed code and someone else ran it.
The only thing I found that seemed to fix it was to set a breakpoint on that line, save the project, then clear it and save it again. Sometimes I had to open and close the project once or twice to get it to completely forget the breakpoint was there.
It seems to me that it's a random, esoteric bug in the Access IDE. It would be fantastic if they would actually make this a feature, but it's not even a bug that can be relied on.
I've had similar experiences with Access and what always helped for me is to copy the text into a Notepad .txt file (or other basic text processing program). Then select it all in the .txt and copy it back.
Decompiling the Access application will solve this too.
Previous SO question: How does one decompile and recompile a database application?

Accurev treats most of the source tree in workspace as external

I have this accurev issue where almost ALL source-controlled dirs under my workspace are shown as "external" eventhough they are not --accurev stat confirms the same externality. Accurev update has not solved the problem: just pulls down the entire source tree everytime, indicating that the existing file-structure is external to accurev. I have poked around accurev manauals but, have not seen anything specifics on what the problem(s) might be. Any help is appreciated.
In the past, when this has happened to me, deleting everything in the external view and repopulating the workspace fixed this problem.
I usually just delete from the GUI if possible. Then open a command prompt, browse to the root directory of the workspace in question and run:
accurev pop -R *
You may have had an "accurev update" fail for some reason, which has left the workspace out of sync. To find out if this was indeed the root cause, you can run "accurev show -fx wspaces" from a command prompt and compare the Target_trans and Trans values. If they are different, you have an inconsistent workspace.
To resolve this, you can run "accurev update -9" which will force the update level to the appropriate transaction. Subsequently you can delete all external files, as Josh indicated, and re-populate them. The command for this would be "accurev pop -R ."
Hope this helps...
I know this is an old question, but I just had this issue.
Updating my workspace with "Timestamp Optimization" unchecked resolved the problem.