FAQ Database Discussion Community


Save generated Word file with unique name (mailmerge)

excel,vba,save,mailmerge
I need help with my macro. I need to save the generated Word file via mail merge. Sub RunMerge() Dim wd As Object Dim wdocSource As Object Dim strWorkbookName As String On Error Resume Next Set wd = GetObject(, "Word.Application") If wd Is Nothing Then Set wd = CreateObject("Word.Application") End...

Angular $resource POSTS $promise and $resolved to server on $save

javascript,json,angularjs,resources,save
I am having trouble with $resource on one of my angular projects. All of a sudden it has started to mess up the objects that are sent to the server on $save. Calls to $save on $resource objects does not strip away $resolved and $promise from the JSON data that...

Change a selected value based on selection

javascript,php,select,save,onchange
Here is what I am trying to do: If the user select the "add new" option, I would like to add an text box and take the user input and save it into my post. This part is working. The while loop gives other options that already exist in my...

Python save matplotlib figure with exact pixel size

python,matplotlib,save,pixel
I want to save an matplotlib figure with an exact size in pixels. In the code below, this exact size is 500x500 pixels. Whilst the saved image is 500x500 pixels it includes padding around my shape and plot area. I want the circle to be tight to the borders. Instead...

After stringWithContentsOfURL cookies not save in UIWebView. iOS

html,ios,cookies,save,nsurlconnectiondelegate
I want get html from url and I use: NSString *URLtoHTML = [NSString stringWithContentsOfURL:self.url encoding:NSUTF8StringEncoding error:nil]; [self.webView loadHTMLString:URLtoHTML baseURL:nil]; But after this my cookies clean in UIWebView. But if i use load request without stringWithContentsOfURL cookies save: [self.webView loadRequest:[NSURLRequest requestWithURL:self.url]]; I have tried it but cookies not save too: NSURLConnection...

C# - Unity3d save some variables in game?

c#,unity3d,save
I would make sure when I close The Game , he saved automatically some variables ( scores ), and show them once started ? To do this i need to use these to save an float? void Awake void Load or i need these? public void Load public void Save...

python how to store a list in a file and get it back

python,list,file,save
I have a list with a lot of things in. At the end of my script I would like to store it in a file. And when I start another script another day, I would like to extract my list from my file and then use it. I don't know...

read data to load game from text file

java,swing,file,save,load
Hi am working on a game which saves several states once my save button is cliked, such as: name, totalScore ... This is how I saved it: public static void save() { fileName = new File("Saved Game"); try { fw = new FileWriter(fileName,true); } catch (IOException e) { e.printStackTrace(); JOptionPane.showConfirmDialog(frame,...

Save file to server for each user [closed]

php,html,file,save,server
I created website which currently has only login function. I want to make so every user can edit txt file and save it on server. But I want to make it private - user can see only their file. Do you have any ideas what I will need and how...

Does VS-2013 main window get saved?

visual-studio-2013,ide,save,preferences
Every time I launch Visual Studio 2013, the main window pops up with the default width, height, and position on my screen. This forces me to resize and move it the the way I want every time. Did I miss an option somewhere to make the window retain its settings...

How do I save progress in batch

windows,batch-file,save
I am making an interactive fiction game using windows batch script. I sorta figured out how to do it, but I can't for the life of me figure out why it wont work. This is the loader: @echo off cls :load set /p s_name=Name: if not exist "savedata/%s_name%/" goto user_error...

How to make a save button

java,swing,save,jbutton,joptionpane
I am trying to make a save button but I don't know how to do it. I will explain a little bit about my program. When someone start the program it shows a JOptionPane and the user need to write a nickname and then when he clicks on OK button...

How to select “My Documents” path to save a file

java,file,path,save,jfilechooser
I want to do that: JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(System.getProperty(**MY DOCUMENTS PATH **))); All I want to do is to put the "My Documents" path, that it changes in different windows versions, but I don't know how to do it. I can't use a "literal path" I need...

SQL Oracle - How to save the query output with spool on a text file?

text,save,output,spool
I'm using spool to save the output of my query into a text file but what is actually doing is save the sql commands into the file. I have: SPOOL D:\sqltestes\sql_test.txt SELECT max(column1) from my_table; SPOOL OFF; And this, is writting on the text file the "SELECT max(column1) from my_table;"...

VB Clear text file before writing

vb.net,visual-studio,text,save
On the click of a button I want to write my textbox.text into a text file. I got this code working, but I want to clear the textfile before writing and not just add text. Dim file As System.IO.StreamWriter file = My.Computer.FileSystem. _ OpenTextFileWriter(mfileName, True) file.WriteLine(TextBox1.Text) file.Close() Any help appreciated....

Writing Another Text File based on Saved File from Tkinter

python,file,tkinter,dialog,save
I prompt the user to save a file, and I want to automatically save a file along with it. For example, let's say the user saves a text file under my program called "foo.txt", I want to automatically make a text file called "lengthfoo.txt". The word "length" before "foo", and...

How to save a data frame in R

r,save,data.frame
According to the answer to this question, you can save a data frame "foo" in R with the save() function as follows: save(foo,file="data.Rda") Here is data frame "df": > str(df) 'data.frame': 1254 obs. of 2 variables $ text : chr "RT @SchmittySays: I love this 1st grade #science teacher from...

C# - Settings.Default.Save() is very slow

c#,save,settings
I want to save some UI changes when the program closes. I've read that one of the simplest ways to do that is with settings. I figured I'd save those changes to the settings whenever the program closes, instead of saving it everytime the user changes those settings. So, I...

How to save result text after web scraping

python,save
I am studying Python to make a web scraper. This below code is good working by helping. Then I wonder how to save result? Could you help this issue? import nltk import urllib import readability from bs4 import BeautifulSoup from readability.readability import Document import mechanize url = "http://www.nytimes.com/2015/06/02/science/medicines-hidden-roots-in-an-ancient-manuscript.html?ref=science&_r=0" br =...

How to save PhoneGap App

android,cordova,jquery-mobile,save,local-storage
currently I am developing an app using PhoneGap and JQueryMobile. By now, the functionality is pretty simple: All the user can do, is to create some buttons and dynamically add them to the screen. What I want to do now, is to make this list of buttons storable. On local...

atomic write/read of a file in nodejs

node.js,save,load,atomic
My nodejs application is built around a "project file". Several modules (by "module", I mean a simple javascript file of my project) of this application need to load, modify and save this file often, via streams (fs.createReadStream, fs.createWriteStream), and since those modules are executed independently from each other, with sometimes...

Handsontable - Metadata definition object

merge,save,metadata,state,handsontable
In Handsontable, it is possible to get data object via getData function. I also need to save metadata of Handsontable instance e.g. actual column sizes, merged cells etc. Is it possible to get one object which describes actual state of table and use it to save and load state along...

Unity - Save Progress In Game?

c#,android,unity3d,save
Hi I am creating a small game with Unity3d. But now I have trouble saving some variables. Now I am using the following code void Awake(){ proiettili = PlayerPrefs.GetFloat ("PallottoleOgniSecondo"); } void OnApplicationQuit(){ PlayerPrefs.SetFloat ("PallottoleOgniSecondo", proiettili); PlayerPrefs.Save(); } This way I can save the variable, but only when I try...

Linq to Entities & WPF - save only entities related to a view

c#,linq,entity-framework,save,instance
[EDITED] I am looking for a way to implement Linq To Entities in a WPF (MVVM) application and make each View (or ViewModel) responsible to manage their underlying entities separately. Here is an example of a simple structure and what I would like to achieve: [Customers] (1..1) <----> (0..* )...

How do I save an object list when I close the program, and load it when I open it again? [duplicate]

c#,list,object,save
This question already has an answer here: Serialize an object to XML 10 answers How do I save an object list to the computer as XML when I close the program, and load it when I open the progam again? This is my test code with the object list...

Xamarin Studio. Save failed: couldn't perform atomic initialization

osx,xamarin,save,filesystems
I'm at a loss, the disk has around 300GB free and when checking on finder all the files are read/write enabled.

Python - How can I make this un-pickleable object pickleable?

python,save,pygame,pickle,renpy
So, I have an object that has quite a bit of non-pickleable things in it (pygame events, orderedDicts, clock, etc.) and I need to save it to disk. Thing is, if I can just get this thing to store a string that has the progress (a single integer is all...

Optimizing Save and Load of Settings in VB.Net Application

vb.net,optimization,save,load,application-settings
I am working on a VB.Net installer and it was all going well. We had / have over 20 thousand users. But this month I faced a problem... As I am updating the installer, constantly I am adding new options to the installer and adding new features. ...and in my...

Parse saveInBackground when iPhone is locked?

ios,iphone,parse.com,save,request
I want to be able to save a users information while the iOS device is locked. I'm using background modes but the saveInBackground only seems to work for about 5 seconds then it stops saving. When re open the app it saves them all at once. is there a way...

Save data from JTextField in columns in .csv File

java,swing,csv,file-io,save
I have the coded the following program to get user input in four JTextFields and than saves it in a .csv file. But I am getting it in different rows. I want the output in the .csv file to be from column to column My code is as follows: public...

How can I save a variable which has the same value after an update as before?

swift,save,app-store,updates
I created an iPhone game in Swift and I want to submit it to the app store. My question: when I create an update for the app how can I make that after the update the "highscore" integer has the same value as before? Do I need to save the...

Jmeter doesn't save response data or headers

save,load,jmeter,performance-testing
I'm building some simple load testing for my API, and to make sure everything is on the up and up I'd like to also review the response headers and data. But when I run my test using the command line and then re-open the GUI to add a View Results...

Vb.net Save data from datagridview to txt and load it

vb.net,datagridview,save,load
i'am new programmer and just studying about Visual Basic, and to complete my exams The Data i have Tool_1 screwdriver Tool_2 screw Tool_3 Magnet And many more i've create project, it have Data Grid View(two columns, Tools & Names) and two Button(btSave & btOpen) i just try it with this...

java.io.FileNotFoundException: /storage/sdcard/MyApp/questions.txt: open failed: EACCES (Permission denied)

java,android,eclipse,save,android-manifest
I have a problem when I try to save a file. First of all, it worked correctly when I try it on an older Eclipse, but I have to use new Eclipse so I export the project from the older Eclipse and import it on the new. Now it doesn't...

saving matlab file (.mat) with dynamic name

matlab,dynamic,save
for m = 1:length(lst_region) out=cellfun(@(x) str2double(x(1:strfind(x,'_')-1)),lst_region(m)); str=[num2str(out(1)) '.mat']; save ( str ,distance); end Error using save Argument must contain a string. Line 3 I want to save files like '1.mat' '2.mat' etc.. but i have error can you please help me to fix it...

How do you save an image file with html/angularjs?

javascript,angularjs,image,parse.com,save
I want to allow a user to save an image on one page/state of my app and then programmatically call that image on a different page/state of my app. I considered three approaches thus far for saving the image but none of them seem to be working for me: First...

Storing an int value in android

android,save,int
I'm making an app that gives players a high score. However, the int for the high score resets when I reset the app. Is there a way to save the int so the high score is saved even when the app is restarted? (I used this code to restart the...

Showing drop pin after relaunch app?

ios,xcode,swift,annotations,save
I have application with map where you can make an annotation by dropping a pin. How can I save the annotation, so you can see it when the application is closed and re-opened? My code's for annotation func addAnnotation(gesture: UIGestureRecognizer) { if gesture.state == UIGestureRecognizerState.Began { var touch = gesture.locationInView(self.Mapa)...

How do I fetch information (an account name) from a save file (N:\userFile) on Python

python,save
I have created a banking ATM machine for a school computing project, so I am novice at coding in Python. I have created a piece of code that saves a User's name and PIN code, but I dont know how to get the programme to remember the name and link...

Overloading fstream << operator to save “any” kind of data

c++,save,operator-overloading,ostream
I have created a Test class that has a public variable double x. I have overloaded the ostream << operater to be able to print out the variable x. I have also written an external save(filename, object) function that would save the content of the object in a particular way....

Matlab - Easy way to save entire figure/GUI

matlab,user-interface,save
I'm looking for an easy way too save the current state of my GUI and be able to load this saved state again. I know there is a video for this (http://blogs.mathworks.com/videos/2010/12/10/how-to-save-and-restore-state-of-a-gui-in-matlab/) but somehow it doesn't work on my computer. I thought of something like this: (I used gcf because...

Extracting class attribute from objects in non class array in python

python,class,save
I am trying to make a concatenated list of a class attribute from an array that contains class members but is not in the class itself. class Direction: def __init__(self, array, dir_name): self.array = array self.dir_name = dir_name This enables me to create four class members, say L, R, U,...

Laravel how to get object after and before saving this?

laravel,save
I'm using Laravel 4.2 My model has a function like this: ServiceLog::saved(function($servicelog) { if($servicelog->date_created != $old_date_created) { //do something here } }); I want to compare the value of the field date_created after and before saving $servicelog How do I get the $old_date_created ?...

“InvalidCastException: Cannot cast from source type to destination type.” when loading serialized data

c#,serialization,save,loading
I'd sincerely appreciate if you looked through some of my code as I can't seem to be able to fix it myself, and this will also hopefully help others understand serialization better. I have four pieces of related code here, with anything seemingly irrelevant cut out. I'm trying to create...

Android working with JSON

android,json,save
I'd like to use a JSON to store 3 values more comfortable. The Values I want to store are String, String and Boolean. Where the first string should be used to identify the 3 values from other in the JSON. At the end - after the user set his setting...

Batch save all open files?

batch-file,save
Is it possible to make a batch file save all open documents/things that can be saved? When I search it up on Google all it gives me is "How to save a batch of Photoshop", just if anyone knew :) Thanks in advance!...

c++ Getting a portion of a file

c++,save,loading
How can I skip parts of a file, then ifstream until a certain character is reached? For example, in a text file, this is written: 'SaveNameExample' variableExample = 5; How would I get only the SaveNameExample without the 's , store that as a std::string variable, and then only get...

Debugging save() returning false CakePHP 3.0

debugging,cakephp,save,cakephp-3.0
I have some code which has broken somewhere along the way and I'm having trouble debugging it. This is a simplified version of it. $data = $this->request->data; $form = $this->Forms->get($data['id'], [ 'contain' => ['FieldsForms' => ['data'] ] ]); $form = $this->Forms->patchEntity($form, $data, ['associated' => [ 'FieldsForms.Data', ] ]); if ($this->Forms->save($form))...

Download and save image into Application.persistentDataPath hangs the app

c#,image,unity3d,download,save
I wrote a game that can download images from server and then store them inside Application.persistentDataPath. My problem is when saving few images the scene hangs and when it is done saving, it executes the rest of the code. How can I solve this issue? Saving image into device local...

How to save a CoreGraphics Drawing in Swift

ios,swift,uiview,save,core-graphics
I want to make an application where the user can draw on the screen and then save their drawings. Below is my UIView draw code: import UIKit class DrawView: UIView { var lines: [Line] = [] // Line is a custom class, shown below var lastPoint: CGPoint! required init(coder aDecoder:...

Pointer on classelement and save the Pointer in a array

c++,arrays,class,pointers,save
this is my code: class Node { private: unsigned number; unsigned color; public: Knoten(unsigned int number = 0, unsigned int color = 0) {} void set_number(unsigned int a){ number = a; } void set_color(unsigned int b){ color = b; } unsigned int get_number(void){ return number; } unsigned int get_color(void){ return...

Android Studio - How do you get image from gallery and then save it

image,imageview,save
I have an app that contains a button. when you press the button, the application will send you to your mobile phone's image gallery. you then select the image and it will appear on an imageview above the button. This all goes without a problem but the only bad thing...

how to save file with savedilogue javafx

excel,javafx,save
I have created excel file and I want that file to show as "File Name" box in JavaFx file chooser. So I can save that file wherever I want with the use of SaveDialogueBox. Code : WriteExcelFile test = new WriteExcelFile(); File exlFile = new File("c:/temp/"+tabName+".xls"); WorkbookSettings wbSettings = new...

Saving Multiple record related to the same Model in Cakephp

cakephp,save,cakephp-2.0
I have a rating system the user should input his data in the input table for each year(All the years are listed) then he save all the input data at once, if the data is exist previously then the system should display the data in the input field so the...

Save As Using Variable Names Gives Error

excel,vba,excel-vba,save
Trying to save a new, not yet named, workbook (that I added using another sub) with variables for the name. When I place everything within the quotation marks it works to save (not with variables). But this code constantly gives the run-time errror '1004': Method'SaveAs'of object '_workbook' failed. Sub SalvarTabela30()...

Sitecore Auto-Save If Sublayout Added on the Page

save,sitecore,components,sublayout
Is there anyway to make auto-save once I added a sublayout component? I created one sublayout and if I add it on the page in page editor, it doesn't appear on that time. By saving the item, it appears on the page editor. So, I'd like to make if sublayouts...

Save and Load Font/FontColour

java,swing,fonts,save,load
I have a bunch of customized setting in the program I'm working on where the user can change the font and the font colour and also the background colour but for now ill start with the font and font colour currently I'm saving the title to a text file with...

R save list in disk

r,list,save
I have a list var1: var1 <- list(c("parts of a day", "time in astronomy", "star"), c("tree tall", "pine tree"), c("environmental condition", "climate")) I want to save it in disk. For example, the saved file in disk must have the following in each row of the csv file: "parts of a...

CSV file converter using VBA error when saved

excel,vba,excel-vba,save
The codes below is for CSV file converter into excel tabled form. The problem is that when the whole workbook is being saved (MACRO-ENABLED EXCEL FORM), the problem begins. When the workbook is NEW and when I copy pasted the program and run it without saving it, the program runs...

Using matlab record and save in a specific folder

matlab,user-interface,save,record,wav
I'm recording a sound and using wavwrite to save the wav file, but I need to save it in a specific folder in C:, such as in c:\monitoringsystem. That's a part of my code: format shortg c = clock; fix(c); a=num2str(c); year=strcat(a(1),a(2),a(3),a(4),a(5)); month=strcat(a(19),a(20)); day=strcat(a(34),a(35)); hour=strcat(a(48),a(49)); min=strcat(a(63),a(64)); sec=strcat(a(74),a(75)); name=strcat(year,'-',month,'-',day,'-',hour,'-',min,'-',sec); wavwrite(y,44100,name); y=[];...

Android: How to write a Bitmap to internal storage

java,android,bitmap,save,storage
I am making an app that gets images from a URL. I want to be able to store these images on the phone so that if the url is the same as before, the user won't have to wait for the image to load but instead the app will pull...

How to save a changed item to an external file? (Python 3)

python,save,external
I'm fairly new to python, but I'm making a script and I want one of the functions to update a variable from another file. It works, but when I exit the script and reload it, the changes aren't there anymore. For example (this isn't my script): #File: changeFile.txt number =...

Write points drawn over a chart control to a text file the but only once each coordinate?

c#,.net,winforms,save,points
In a button click event: private void chart1_MouseClick(object sender, MouseEventArgs e) { if (outofrange == false) { valuePoints.Add(new PointF(X, Y)); paintToCalaculate = true; if (X > 0 && Y > 0) { chart1.Invalidate(); SavePointsCoordinates(); } } } And the SavePointsCoordinates method: StreamWriter w; int countPoints = 0; private void SavePointsCoordinates()...

PHP - file_put_contents Save file in folder

php,html5,wordpress,save,file-put-contents
Trying to save an attachment from email into my server, the script I have so far works fine however, it saves the file in my wp root folder. foreach ($attachments as $key => $attachment) { $name = $attachment['name']; $contents = $attachment['attachment']; file_put_contents($name, $contents); } How can I save the file...

apply formatter only on edited code - eclipse [duplicate]

java,eclipse,save,formatter
This question already has an answer here: How to turn off the Eclipse code formatter for certain sections of Java code? 10 answers I have implemented a formatter in eclipse for my code, when I try to save the changes it applies formatting on complete file. Is it possible...

UIWebView not save cookies

ios,cookies,uiwebview,save,httpcookie
I use UIWebView that users login in accounts. Users may login with facebook account. He is click button Facebook and opens UIWebView. After login UIWebView close and users may use your personal account. But when I close my app and open it again users not login. UIWebView not save cookies....

Losing values after reading from file and saving np array to the same file

python,numpy,save
I have a function which reads and writes to a file but after each run and write cycle , i keep losing some part of the string and part of the float. The function is given below with output which is saved in a file : def stringlist(self,name,price): b =...

save button in android programing

android,button,layout,save
hey guys I'm working on an android project and I want to add a button in my app that when user click on it,it save an image in res to sdcard and it shows a toast "image saved in sdcard" please help me

Saving custom object to sdcard (Android)

android,file,object,save
I'm exploring saving internally versus saving on the sdcard. Currently, I'm trying to save a custom object (DummyTwice) on the sdcard, like so: String root = (Environment.getExternalStorageDirectory().toString()); File dir = new File(root + PUB_EXT_DIR); dir.mkdirs(); File file = new File(dir,FILE_NAME); try { DummyTwice dt = new DummyTwice(textEnter.getText().toString()); FileOutputStream os =...

Save web pages with rich content in local on Android [closed]

android,html5,save
I need to save several web pages in html5 on android. Those pages could include content such as images, scripts for interactible application or video, and I am looking for ways to do that. I've seen the saveWebArchive function of the webView. Is it able to save the html file,...

save numpy array in append mode

python,numpy,save
Is it possible to save a numpy array appending it to an already existing npy-file --- something like np.save(filename,arr,mode='a')? I have several functions that have to iterate over the rows of a large array. I cannot create the array at once because of memory constrains. To avoid to create the...

Returning save! value after code with DRY

ruby-on-rails,save,dry
Hi I'm trying to write a code that is functionally equivalent to: def model_method(args) ... obj.save! ... void code assuming save! worked ... return obj.save! end Normally I would use an after_save callback, however there are arguments passed into this model's method that I need to use for the ...code......

Disable Excel save option but allow macro save

excel,vba,excel-vba,save
I'm creating an excel file and I want to disable the 'save' and 'save as...' option. I found a lot of solutions on the internet, like this one in VBA: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) MsgBox "You can't save this workbook!" Cancel = True End Sub...

How to save output from python like tsv

python,save,output
I am using biopython package and I would like to save result like tsv file. This output from print to tsv. for record in SeqIO.parse("/home/fil/Desktop/420_2_03_074.fastq", "fastq"): print ("%s %s %s" % (record.id,record.seq, record.format("qual"))) Thank you....

Atom text editor remove trailing whitespace on save

save,whitespace,sublimetext3,removing-whitespace,atom-editor
I am switching from Sublime text to Atom text editor. I believe it is the right decision for me. However, something is bothering me. When I save any file in sublime text it does not include any trailing blank line. But saving any file in Atom text editor leaves a...

What happens when you save an exe file in a text editor?

text,save,editor,exe,executable
A long time ago I remember opening an executable file (.exe) in a text editor, and saving it back to the hard drive. The executable, needless to say, didn't open. My understanding is that a file is a series of bytes. In the case of a text file, these bytes...

How do I save a BufferedImage to a pgm file?

java,save,bufferedimage,jai,pgm
I looked through the internet but I could not find an answer. I have a pgm file which I use as a BufferedImage to do a convolution (I use JAI for that) but I am having trouble in saving it back to a pgm file. So far I used following...

Java - File save does not work

java,file,save,javafx-2
I would like to save an ArrayList's content to file (the user should choose the .txt's location) but I am not sure how to do that since that code does not work properly. Do you have any idea how to do that? package vizsgaquiz; import java.io.File; import java.util.ArrayList; import javafx.application.Application;...

Quickest way to save massive amount of lines to text file in c#

c#,save
Im currently programming a program which needs to save multiple megabytes worth of data to text files. that data is saved inside a string < list > my current code (allusernames is the list variable name) string alltoappend = ""; string speichern = "C:\\Users\\" + Environment.UserName + "\\Desktop\\scraped.txt"; progressBarSetValue(progressBar1, 100);...

Saving elements of a list as data.frames using R

r,list,save,lapply
How can I save each element of a list in a in a separate .RData file? Consider the following example: # Generating a list containing 3 matrices set.seed(1) mylist=list(M1=matrix(LETTERS[sample(1:26,9)],3),M2=matrix(LETTERS[sample(1:26,9)],3),M3=matrix(LETTERS[sample(1:26,9)],3)) mylist[1:2] # $M1 # [,1] [,2] [,3] # [1,] "G" "U" "W" # [2,] "J" "E" "M" # [3,] "N" "S"...

c# Save Streamwriter after every 200 Cycles without Closing

c#,file,save
I'm using a StreamWriter to write some data to a file. System.IO.StreamWriter file = new System.IO.StreamWriter(path); while(something_is_happening && my_flag_is_true) file.WriteLine(some_text_goes_Inside); file.close(); What i noticed is, till the close is called no data is written to the file. Is there any way i can save the contents to the file before...

How to select a path to save a file “near” user.dir

java,file,path,save,jfilechooser
I want to do that: JFileChooser fileChooser = new JFileChooser(); fileChooser.setCurrentDirectory(new File(System.getProperty("user.dir" + "\\datos_medidas"))); But I recieve a NullPointerException. All I want to do is to put the current directory path on a folder that is in the user.dir folder, I have a folder in user.dir and I want to...

Open in same view controller as closed on (swift)

swift,view,controller,save,nsuserdefaults
I am making a simple fact app (In swift) and all the facts are in separate view controllers and when the user closes the app, it all goes to the main page and you have to start from fact 1 again. I want to know how to save what view...

How to load file and create infinite save files?

python,text,tkinter,save
So, I'm creating a little game in python to learn more about this language and I have two questions: First - There is a way to every time that the player click on the 'new game', the program create a new save file? Second - How can I load the...

How do I select a name from a list on python 2.7

python,python-2.7,save
More help with my banking ATM school project. The problem is that I have created a program that lets the users enter a name into a save elsewhere, but I cant select a name from that save to use again. This is my code. f1 =open('C:\NameAgeFile', 'r') filedata = f1.read()...

How do you load information from a .txt file in batch?

batch-file,save,load
So I have been doing some small batch programs lately but I can't manage to make the batch file load information. This is how i would do it. :load_game ) set /p something= ) > something.txt In the txt file: something_is_awesome That is it^^ If i remember it right that...

I Need to add items to array, not replace them

php,arrays,session,save,cart
I have a little script system. It replaces the array but I need it to add to the array. This is what I have: $_SESSION['cart']=array(); // Declaring session array array_push($_SESSION['cart'],'item1'); // Item added to cart If after this I submit: $_SESSION['cart']=array(); // Declaring session array array_push($_SESSION['cart'],'item2'); // Item added to...

Saving data with HABTM and HasMany looses foreignKey

cakephp,model,save,has-and-belongs-to-many
I have a User model with two relations: HasAndBelongsToMany public $hasAndBelongsToMany = array( 'group' => array( 'className' => 'group', 'foreignKey' => 'user_id' ) ); HasMany public $hasMany = array( 'phonenumber' => array( 'className' => 'phonenumber', 'foreignKey' => 'user_id' ) ); Phonenumber and Group have set public $belongsTo = array( 'User'...

How writeToFile in a .playground?

swift,save,plist,swift-playground
I have edited a .plist file. How I understood it: because of sandboxing it is only possible to read files inside the .playgrounds file in a Resources directory. But how is it possible to write the edited file to this folder? // read file let xmlPath: String = NSBundle.mainBundle().pathForResource("Settings", ofType:...

save() in php dom saves numbers at the end of the file

php,dom,save
The below code successfully saves the child div but also saves some numbers in the file at the end. I think its the bytes of data present, how do i get rid of the numbers it saves? $file = '../userfolders/'.$email.'/'.$ongrassdb.'/'.$pagenameselected.'.php'; $doc = new DOMDocument(); $doc->load($file); $ele = $doc->createElement('div', $textcon); $ele...

Saving the click counts of an item each item it is clicked

javascript,php,count,save,value
Currently I try to build up a like counter for my web page. Below you can see the click counter. It's fully working. Sadly (but for sure) just for the current session... Is there any possibility to store the value forever? One last thing! On the website is more than...

Write a program to save web-page to a computer [closed]

java,save,local-storage,webpage
I want to write a program to save web site when we enter web site link. What is the easiest programming language to do that. I want to save entire web site to my computer. I know there is way to write a program to save web page. But my...

JSon Output jQuery div Containers with Children & Attributes

javascript,json,save,jsplumb
I am currently working with jsPlumb & got stuck at saving & loading the containers. I figured out how to save the endpoints, connections & positions. But I can't figure out, how to save the div containers, including their attributes, children & the children's attrubites. Here's a snippet of the...

Rotate Image from URI and save the rotated image to the same place

android,image,bitmap,save,uri
I'm trying to create a Bitmap from an existing URI, rotate the Bitmap and save it to the same place as a JPEG file. This is my current code after having tried several solutions: try { // Get the Bitmap from the known URI. This seems to work. Bitmap bmp...

Save Game data - Java

java,save
I've created a rudimentary game with a few objects. I'd like to give the user of the program the ability to save and load the state of the program. I've researched multiple articles and read through a lot of overstack posts. I was surprised by the amount of methods, and...

Saving a picture in Python

python,image,file,save,jython
In Python I have created a picture using the "makeEmpyPicture" function in Python. How do I save this as an external file. I have a string that I want to call it. All I want to do is to be able to save it without importing any libraries into my...

Programmatically saving a file on an Android device

android,file,save,screenshot
I'm writing some UI tests, and I need to be able to have those tests programmatically take screenshots of my application at certain points. I wasn't really sure how to even take a screenshot from inside a UI test, but I've figured that out and have slightly modified some code...

C# — Safe Multiple Thread Save File Access

c#,multithreading,logging,save
I am currently developing a C# application that uses two separate threads, the first is the main thread which the program operates on and the second is the log thread. The log thread is basically a loop that runs every second or so and breaks only when the application is...

parse saveInBackgroundWithBlock

multithreading,parse.com,save
I am new to objective c. I'm trying to set save button unable when I press save button. And doing saveInBackgroundWithBlock as well. *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIKeyboardTaskQueue waitUntilAllTasksAreFinished] may only be called from the main thread.' here is my code ` saveButton.enabled = NO;...

YII - Why to use beforeSave() when you can code before Save() function

php,yii,save,before-save
I am aware of functionality of function beforeSave() in YII that this function is used to perform something which we want to perform before our data saved. However, as far as we want to implement this before our data got save to database, can't we directly write this code before...