save

How to use python to imitate the opening and saving of an image file in an image editor?

旧街凉风 提交于 2019-12-25 09:08:44
问题 I encountered a certain problem with corrupt .png image files* that I was able to overcome by simply opening them in an image editor (Apple's Preview) and saving them back, without making any explicit changes. I have thousands of similarly corrupt image files that need to be subjected to the same procedure. Is there a way to automate it in python? The following naive code doesn't work: >>> with open('an_image.png', 'rb') as f: ... data = f.read() ... with open('an_image.png', 'wb') as f: ...

Saving String of Data as a file with HTML5 + Javascript without using URI [duplicate]

泪湿孤枕 提交于 2019-12-25 08:57:47
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Cross-browser Save As .txt I'm looking for a way to save a sting of data to a file only using HTML5 and Javascript, without using any server-side techniques (PHP, ASP etc..) I'm using URI for the moment : <script> var content = "test"; uriContent = "data:plain/text.," + encodeURIComponent(content); newWindow=window.open(uriContent, 'test'); </script> However the browsers don't name the file with the right

How to save images in Android?

北战南征 提交于 2019-12-25 08:47:51
问题 I'm very new to Android programming and I was wondering how can I make an app take a picture and save the image to the internal storage of a device, not to the SD card, because not everyone will have an SD card. 回答1: You can try saving it as an sqlite blob. This this thread for how to do the storage. Saying "not everyone will have external storage" is a bad excuse: you should handle both cases. If instead you want to implement it as a file (a perfectly good way to do it), you can look up an

How to save a dictionary of objects?

两盒软妹~` 提交于 2019-12-25 07:13:45
问题 I have a Python 3.5 program that creates an inventory of objects. I created a class of Trampoline s (color, size, spring, etc.). I constantly will create new instances of the class and I then save a dictionary of them. The dictionary looks like this: my_dict = {name: instance} and the types are like so {"string": "object"} My issue is that I want to know how to save this inventory list so that I can start where I left off the last time I closed the program. I don't want to use pickle because

Powershell Excel Automation Save Workbook by Date

你说的曾经没有我的故事 提交于 2019-12-25 06:58:45
问题 I am creating a powershell script to populate an excel workbook with information from the "get-vm" command in SCVMM. The save filepath is a work in progress at the moment. I would like to run the script daily or weekly and save the generated excel workbook using that days date as a filename. Is this possible? How can I generate a date and use it as my filename for saving the excel output? any help would be great. #run below line once and then comment out if not in VMM Command Shell. Will

Performing an auto-save with Adobe AIR with out a popup save box opening

爷,独闯天下 提交于 2019-12-25 06:51:05
问题 I've an AIR app that I'd like to implement a auto-save functionality. Currently I have a service that uses a timer to check the status of the current active file in my app, then if the file changes to a new file, the service checks the current file name if that has changed then the file has changed. When this happens I want to perform a auto-save, which I can do but the problem is that the save popup save box opens when the save is called, this is how I call the save function: var file:File =

Matlab - program freezes because of sudden high resource processing without running script

☆樱花仙子☆ 提交于 2019-12-25 06:44:27
问题 I'm running Matlab R2015b on my mac with OSX 10.11 El Captain. When starting Matlab, changing the directory in file explorer or when saving a file / running an unsaved file. A yellow processing box appears in the bottom left and Matlab consumes more and more resources. When the process is not canceled Matlab uses more than 400% CPU (low memory usage) and does not react for about 10 minutes or even more. Most times there is no feedback what happend - Today I got following error after start up

How to save Contact details in the phone's address book from any application

房东的猫 提交于 2019-12-25 06:29:01
问题 I am trying to create an application which will add contact details like phone number, email address and name in the phone's address book, but I have not idea how to do this. I know that we can access the contact details from the address book, but how can we add any new contacts from our application to the address book? How can this be done? 回答1: Look at http://developer.android.com/resources/articles/contacts.html under Example: Inserting a Phone Number Update/Edit: Above mentioned url isn't

Can't import an object saved to file with dput in R

∥☆過路亽.° 提交于 2019-12-25 05:48:15
问题 Hello I created an list object that contains boot the object returned by the boot::boot() function and a summary of results I build on the top of that. I saved such object to a file using dput. But now I can't regenerate the object using dget() or source() . I receive this error: bt <- dget(file.choose()) Error in sample.int(n, n * R, replace = TRUE) : object 'R' not found Since I called boot() and used dput in another function I suspected that to rebuild a bt object the R variable which was

Logging in a text file iPhone

柔情痞子 提交于 2019-12-25 04:19:56
问题 I have a score system and I would like to log all scores in a text file separated by line breaks. Here is my current save code: NSData *dataToWrite = [[NSString stringWithFormat:@"String to write ID:%i \n",random] dataUsingEncoding:NSUTF8StringEncoding]; NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *path = [docsDirectory stringByAppendingPathComponent:@"text.txt"]; // Write the file [dataToWrite