save

How to save configurations into web.config file?

旧城冷巷雨未停 提交于 2019-12-12 18:38:43
问题 I'm using a Asp.net dynamic web site application and can't save configurations into web.config file. I have tried something like this, but doesn't work! var configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~"); configuration.AppSettings.Settings["Value"].Value = "Some value"; configuration.Save(); Error I have got with 1. OpenWebConfiguration(Server.MapPath(".")) & OpenWebConfiguration(Server.MapPath("~"): The relative virtual path 'C:/...' is not allowed

Generic argument for fprintf in C

倾然丶 夕夏残阳落幕 提交于 2019-12-12 18:20:05
问题 I am writing a function that saves data to a file in C, making use of the fprintf function. However, this requires a placeholder as one of its arguments. For example: %s for strings, %d for integers... What should I do if the data type is generic, that is, the programmer using this function can set the data type of the variable I am writing to the file to anything he wants? Thanks! 回答1: you can open your file with the w+ inorder to write your data in binary format Then you can use fwrite() to

Making a gif from images

*爱你&永不变心* 提交于 2019-12-12 16:45:24
问题 I have a load of data in 100 .sdf files (labelled 0000.sdf to 0099.sdf), each of which contain a still image, and I'm trying to produce a .gif from these images. The code I use to plot the figure are (in the same directory as the sdf files): q = GetDataSDF('0000.sdf'); imagesc(q.data'); I've attempted to write a for loop that would plot the figure and then save it with the same filename as the sdf file but to no avail, using: for a = 1:100 q=GetDataSDF('0000.sdf'); fh = imagesc(q.dist_fn.x_px

How do I save all files (or save all buffers) in Emacs?

試著忘記壹切 提交于 2019-12-12 16:39:46
问题 C-x C-s saves only the current buffer. How do I save all files (or all buffers)? 回答1: Press "C-x s" and then choose "!" for saving all buffers. 回答2: Another way might be using list-buffers C-x C-b RET ; 3rd column shows '*' for modified buffers. s ; Mark the buffer at point to be saved. x ; Save and/or delete marked buffers. With ibuffer is slightly different: M-x ibuffer RET ; 2nd column shows '*' for modified buffers. m ; Mark the buffer at point. S ; Save the marked buffers. 来源: https:/

What is the efficient way to save the result in Matlab if I have to stop the iteration for some reason?

戏子无情 提交于 2019-12-12 16:07:35
问题 I am trying to minimize my objective function by running iterations and it could take a long time (may be a day or more). If for some reason I have to stop the program or it gets hung, what is the efficient way to save the results of the iterations that could have run till the time the program stops for some reason. The variables I want to save are: best_obj_fun and k_to_perturb_annealing_best NOTE: I am storing my best_obj_fun in matrix and I only want the value at the time of the last

Save text area to file

佐手、 提交于 2019-12-12 16:02:30
问题 Is It possible to save a textarea to a file? FileWriter fw = new FileWriter(file1.getAbsoluteFile(), true); BufferedWriter bw = new BufferedWriter(fw); bw.write(txtArea1); I get: txtArea1 cannot be resolved to a variable. What am I doing wrong? 回答1: See JTextComponent.write(Writer). Stores the contents of the model into the given stream. By default this will store the model as plain text. Thus, your example might look something like: FileWriter fw = new FileWriter(file1.getAbsoluteFile(),

Exporting Charts as images in Android

只愿长相守 提交于 2019-12-12 15:28:45
问题 I'm stucked in this for almost a month. I have a perfect chart in my android code using 'afreechart', however, the library does not seem to have support for exporting the chart as an image yet (since it's based on 'jfreechart' and this one does the job). I tried to get the view of the chart, convert it into canvas and save using the compress functions of the bitmap library, however everytime i try this i get a totally black image as a result. I tried this same method and it works for the

Save something into JAR

喜夏-厌秋 提交于 2019-12-12 14:11:01
问题 I have a java app, that needs to save and load user settings. I want to save them in a file located in the JAR file, how could I achieve this? 回答1: That's not possible. Rather consider using java.util.prefs.Preferences which is designed for exactly this purpose. See also this little guide. 回答2: This is not a sensible course of action. A JAR file is basically just a ZIP file. To rewrite its contents you need to extract them in full, make changes as needed and then write them to a new file that

JFrame intercept exit on close to save data

自作多情 提交于 2019-12-12 13:27:13
问题 I created a window and want to intercept the exit with the method windowStateChanged to save the data before the application closes. However, it doesn't appear to be saving the data before it closes. How can I correct this? see code below: public class InventoryMainFrame extends JFrame implements WindowStateListener{ //set up the main window - instantiate the application private InventoryInterface inventoryInterface; //panel that contains menu choices and buttons public InventoryMainFrame(){

Matlab saving cell array to text file

℡╲_俬逩灬. 提交于 2019-12-12 13:18:26
问题 After searching mathworks' website and here too I managed to find the code that is SUPPOSED to work for saving cell data to a text file... but every variation I found doesn't work. Here's my current code (and the one that has appeared the most here and on mathworks) - please help me figure out why it's not working for me...: first attempt: array = cell(1,10); for i=1:10 array{i} = 'someText'; end fid = fopen('file.txt', 'wt'); fprintf(fid, '%s\n', array); fclose(fid); Error: Error using