I created an installer with Installshield for my MATLAB GUI. Installer copies all files of my program to c:/Program files/Program_name. When I run it from shortcut, an error appears that can't overwrite some file. I think this is a permission error because my program is in OS partition. I have some functions like mget , mput and fprintf for some text files in that directory and some times my software download some files from FTP and copy them in discoursed directory.
When you copy some codes that have functions like these and run your code from C:/ (OS partition), you have this problem (without using any installer). I need an automatic solution because this program is going to install on some computers.
How can I solve this problem?
Thanks.
Write to MyDocuments instead (e.g. appdata) - that's the one place where the user is guaranteed to have write permissions.
(Jonas comment. Thank you for your answer)
Related
I have a problem with unzipping files. Usually I use a PowerShell script, that I run through SQL Server database (procedure) and it will unzip my files how I want them (database shouldn't be any issue).
Main part of script:
exec '"for %i in ("'+#path+'\*.zip") do "C:\Program Files\7-Zip\7z.exe" x "%i" -o"'+#to+'""'
But for once in a while there is a .zip file that if run through this script will extract files with names of files encoded badly and to prevent that I need to manually open every .zip file and click to extract in 7-zip GUI and that will returns names of files correctly.
This manual way of doing things very, very slow. Because it needs to be done on a server, God forbids if I am on VPN at home. So let's say I have 5 zip files (3 GB), it will take me hours to unzip. If I do it, through server it takes like 2 minutes.
So I just trying to find out how to unzip it with script, what is the difference between my script and manual extraction?
The root-cause is likely to be files that were created with a setup that doesn't match the codepage of your windows environment. Are any of the zip file publicly available? If so, can you provide a link?
To deal with these problem files, you need to know what encoding was used for the filenames. If the 7z gui can handle these files automatically there must be an option to tell it what encoding to use.
Once you know the encoding you can use the -scs option in 7z to decode the filenames correctly.
Modern zip files don't have this issue because they store filenames in UTF-8.
I have a Dell PC with Win7 64 using what I believe is the latest version of AutoHotKey.
I wrote an Installer App with AutoHotKey to create two directories with a number of sub directories then install an exe program and a number of data files into those directories. The App installs into the existing C:\Program Files and C:\Program Data directories.
The Installer App creates the sub directory C:\Program Files\DSOSort then installs the file DSOSort.exe. The installer App then creates the sub directory C:\Program Data\DSOSort and installs a number of additional sub directories with all the associated text data files.
I used the FileCreateDir and FileInstall instructions in the Installation App to create the directories and install the files.
Everything in the Installer App and in the exe program works as it should except that the exe will not make any changes to the text data files in the newly created C:\Program Data\DSOSort directory. I have to open the directory with Properties and allow Users to Write. Once that is done the exe will change data in the text data files correctly and all is well.
If I change the Installer App to create a directory C:\DSOSort then install all the sub directories and data files in there instead of into C:\Program Data\DSOSort the exe can write to the text file. I do not have to change any permissions with Properties.
I tried using the various copies of the C:\Program Data\DSOSort directory I found in C:\Documents and Settings and also in C:\Users. The exe can read them but no Write.
I only have this problem with newly installed directories and again as I said earlier it can be corrected with Properties.
The exe program was written for people with enough knowledge to run the Installation App but do not understand Properties or making changes to the directories.
I could just leave the data files in a C:\DSOSort directory but would prefer to put them in a C:\Program Data\DSOSort directory.
Is there a way for AutoHotKey to check the user permissions and changing them if necessary before installing the data files?
Is my PC behaving properly? Is it supposed to create directories without allowing Write to the files?
Some of these directories, like "Program Files", require admin privileges to modify. I believe that is why you're experiencing that. Have your app run as an admin and it should be fine. The setting for you EXE can be found in the properties.
The A_IsAdmin built-in variable returns whether the current user has admin rights.
I have a zip file which contains lot of dlls. Using power shell I unzip them and then import one dll to perform some operations. It works for the first time
Expand-ZipArchive "Myzip.zip" #this operation unzip all files
import-module "test.dll" #load the dll from zip file
perform some operations
But when I run it again Expand-ZipArchive fails to replace the dll files because the power shell is still holding it even after the execution. I am getting below error
"The process cannot access the file test.dll because it is being used by another process.\""
The only solution is close the powershell command prompt and then start a new window. But this will not help me in actual production enviornment
I tried to unload the module but still no help. I need to unzip every time because the zip will have new releases
I think I explained the issue in a very bad way. Any suggestions would help
I am trying to install the pg_similarity extension for Windows PostgreSQL 9.1 x64.
I believe I have placed the necessary files into the /share/contrib directory and also the /share/extension directory as instructed in the documentation.
When running CREATE EXTENSION pg_similarity; I get this error:
ERROR: could not access file "$libdir/pg_similarity": No such file or directory
I believe this is because I do not have the pg_similarity.dll file in the /lib/ directory.
The instructions at https://github.com/eulerto/pg_similarity (for Windows) say to generate that file by "executing pg_config --libdir" which obviously does not work in and of itself. I assume other steps are implied or left out.
Could someone please explain how to complete that part of the installation and/or generate the needed .dll file and provide it? The installation instructions for Windows are not very detailed.
The only other part of the instructions I did not follow was:
"Edit contrib/Makefile and add pg_similarity to SUBDIRS variable;" however that file already contains a line subdir = contrib/pg_similarity which sounds as though that has already been set. If not I certainly don't know what needs to be changed and that's all there is to the explanation of what to change.
I'm having some issues with a MATLAB compiled code under mac. I've tested the same program under windows and linux aswell with NO issue at all.
My program needs two folders to work properly, but it seems that mac doesn't like them, because it can't see them. On the contrary win and linux have no problem seeing and using that folders.
I just want to underline that I obviously put these folders in the deploytool package before creating the package.
Any idea?
Maybe I'm running the program unproperly setting the environmental variables in an unproper way.
edit:
matlab error just after the program has started.
Warning: Name is nonexistent or not a directory: materials
but materials folder is in my "current directory" and I did put that in the deploytool folder too, why it can't see that? It seems an addpath error, but why it doesn't appear under linux and windows?!
Here are a few things to think about:
Have you set your permissions to the folders correctly? I would assume the permissions for OSX should be the same as you used in Linux, but perhaps you forgot to update them after you created the folders?
Is Matlab running as the user you think it is? I don't know about Matlab specifically, but its possible it runs as a particular user depending on the environment you are in.
Is your error definitely that the folders are not found? Sometimes errors regarding disk IO are vague or misleading (like when due to permissions - see point 1 and 2).