save array as image, imwrite matlab - arrays

Few years ago I used this way to make black and white noise:
A=randn(300,300);
B=A*255;
C=ceil(B);
imwrite(C,'noise300.jpeg'). %% or A=rand(300,300)
Today I keep getting the following mistake:
??? Error using ==> imwrite at 457
Can't open file "noise300.jpg" for writing.
You may not have write permission.
Why can't I save an array (double) as jpeg/bmp or whatever as I did with imwrite?
Here http://www.mathworks.com/matlabcentral/answers/7864 I figured out that between matlab and windows 7 there is a conflict, but I have Vista.
If there is no way to fix imwrite for my case I will appreciate another way of making jpeg with b&w noise.
Thanx,
Dina.

The reason for Matlab error
'Error using imwrite (line 455)
Unable to open file "1.jpg" for writing. You may not have write permission.'
lies in the path of current folder. It may seem something like
'C:\Program Files\MATLAB\R2013a\bin'
It needs to be changed to some other path in D: or any other drive. It works fine there.
Thank you!

Related

npm run crashes when using Spacemacs

For some reason after I have run my react server and I use spacemacs in to edit any file it gives me the following error.
Error: ENOENT: no such file or directory, stat '/home/bitvivaz/Documents/tutorials/Website Development/reactJS/react-props-pokedex/src/components/.#Pokegame.js'
Note this is time I was trying to edit Pokegame.js. I however am capable to use vs code without any problems and can edit anything. I assume its the way spacemacs edit's a buffer or creates a temporarily file and the overwrites the old one?
Is there a way to fix this perhaps cause I've got quite costumed to spacemacs short cuts and keep pressing them in vs code. I use rjsx mode btw.
Thanks and sorry for any conveniences.
Temporary solution:
Try:
M-X Eval Expression
(setq create-lockfiles nil)
This has consequences, but will at least let us work for now with Emacs and React until someone figures out what's really going on.

adding multiple executables C-Lion

im pretty new in C-programming. I use CLion from JetBrains to program my stuff. I would like to know how to add multiple c files in the makelist.
i would like to just open a program and to execute it..if its possible
my ide works just for one file. so i always have to change the name of the c. file in the makelist
i have already tried a lot of combinations of the makelists file but nothing worked.
does somebody have an idea how to fix this problem?
I have edit two new pictures
In this example I have two c files which i would like to execute.
My goal is to add the whole c file tree on the left side to the CMakeList
Here are the pictures
!enter image description here
Here is the error log
enter image description here
Here is the solution. Thanks to your response someprogramerdude
I just added executables and i changed the project in the beginning. the reason why i use picture is that you can see the source files on the left side
enter image description here

Could not find file 'C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\...\MonitoringSystemDatabase.mdb'

I have a Menu Form and it has 7 UserControls every time I execute my program I keep seeing this error.
I have no idea what error is this. I tried searching but there are no error close related to mine. Then I compare my error with this Project Assemblies error
Can anyone help me with this? I have no idea what causes this error.
The error is caused by your code looking for the MS Access database file called:
MonitoringSystemDatabase.mdb
...is located at path:
C:\Users\crims\AppData\Local\Microsoft\VisualStudio\10.0\ProjectAssemblies\cjz5kapb01\
...but it is not.
Locate file MonitoringSystemDatabase.mdb (perhaps with +E to Search), note the actual path of the file, and correct the path in MainMenu.vb.
The error message is very clear, so why all the searching?
Either the file isn't there, or the application can't see it where it expects to find it.
Try moving the file to:
C:\Users\Public\Documents\MonitoringSystemDatabase.mdb
and adjust you project accordingly.

"Threat detected" from AVG when trying to run my C program

I've been working on a project I have to do for school,
They basically asked us to separate every question to a file of its own,
so what I was trying to do was comment the rest of the files or exclude them off the project, and when I try to 'Start without debugging', I end up getting this message. I did this before and everything was fine:
the weird part is that if i remove the solution and make a new one and only make one .c file it works...
I was also trying to remove the "Ex2" folder and made it again, it didn't help.
When I choose move to vault it doesn't find the file.
Edit: I've run a scan and it didn't find any infections on the computer and now that i'm trying to run the program i don't see the threat anymore, I only get this message:
Please, i would really appreciate some help (again... )
I it find very interesting that your build failed. As a result, it is HIGHLY likely that no output was built.Yet your virus scanner flags a compiled file.
If your code didn't compile, where did this executable come from?
Perhaps you do have a real virus?
It seems the last error, that is partially cut off, is "Link: Fatal Error LNK1104. Cannot Open File". That suggests that the file is locked, write-protected, or otherwise blocked.
Is anything else holding open your executable, which prevents recompilation?
I wouldn't blame your virus scanner from flagging an attempt to write to a running .exe as suspicious.

nsinstall: Bad file number error on Vista

I'm attempting to build Firefox on my Windows Vista Ultimate machine. I keep getting the following error:
nsinstall: Bad file number
I've read that this error is caused because of UAC in Vista. Here are the two articles that lead me to this conclusion. https://wiki.mozilla.org/Penelope_Developer_Page#Windows_Vista and http://www.kevinbrosnan.net/mozilla-build-error-nsinstall-bad-file-number
Using the standard "Run as Administrator", I've attempted to redo my build but I get the exact same error. I also started a normal command prompt as admin and then went to the batch file in mozilla-build (start-msvc8.bat) and ran it. Still, same error at the same point.
Any other insights on how I might either get around this error or perhaps something else is causing the error?
Note: I also posted something here in the hopes to get topic-specific help but I've not heard a peep... After I posted that I found the info on nsinstall. Anyway, I prefer SO so I thought I'd try here...
Update: I've attempted to completly disable UAC to correct the problem as is suggested by cnemelkasr. I've received the exact same error. This new knowledge is making me think that a file or folder is missing... Does anyone who has experience with NSInstall know what the given error -- Bad file number -- might mean? I figure it might be referring to a file handle...
If it really is a UAC error, you can try turning off UAC altogether. I've had to do this for several packages. There are numerous places on the web to get the instructions for doing that.
http://www.petri.co.il/disable_uac_in_windows_vista.htm is one of them.
I found the answer to my question. I'm posting the answer here to share the answer with others and to close this question.
After disabling the UAC, it was suggested that the directory depth was interfering with NSInstall. I moved the folder from c:/Users/Frank/Documents/hg-repos/firefox-src-hgRepo/mozilla-fv-expirement/ to C:/mozilla-fv-expirement/. Cleaned all previous build attempts and finally redid my build (with UAC off) and I received a working debug binary.
The suggestion was posted at: mozilla.dev.builds
The "Bad file number" message in the cases I have seen, is caused by too many arguments passed to execvp (command, argv) (or similar) function. But only from some programs. An old bash, sh or a Borland/Watcom program in your PATH is an likely candidate.
So when you shorten the name of the build directory, the total size of the command line (that eventually gets passed to CreateProcess()) gets shorter. I don't think UAC has anything to do with this since I've seen this on Win-XP too. But it's a bit strange Mozilla would not use relative paths while building. I guess it uses some directory prefix value in it's makefiles (I've never tried building it).
If you look at the documentation for _execvp():
http://msdn.microsoft.com/en-us/library/3xw6zy53.aspx
E2BIG is one of the possible errno values:
The space required for the arguments and environment settings exceeds 32 KB.
Now, here is the strange part.
Fact 1:
On Visual-C/MingW (any version), strerror(EBADF) doesn't return "Bad file number" .
(it return "Bad file descriptor").
Fact 2:
On Borland's CBuilder 5.6 and Watcom 1.9 (these do not use the MSVC runtime), strerror(EBADF) does indeed return "Bad file number".
Theory:
Is possible that Borland, Watcom (and other CRTs too?) mixes up the meaning of E2BIG and EBADF. Did that make any sense? Someone please correct me if you have a better theory.
I'm a bit confused myself...
Conclusion: Either shorten the size of your environment (easiest) or shorten the command-line (not always easy).
--gv

Resources