save

How to save file and read

此生再无相见时 提交于 2019-12-12 02:45:31
问题 I create a program that place random image in grid layout format. The size of the grid layout is 6 x 6 = 36. Only 10 were filled with images (each image was different) and the rest were empty. alt text http://freeimagehosting.net/uploads/bfb7e85f63.jpg How can I save it to a file and read it again, so it will display the same images with same placement on the grid? Here is the code that I used to save the images: //image file String []arrPic = {"pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg",

Saving a text file to public internal memory location in Android

穿精又带淫゛_ 提交于 2019-12-12 02:28:00
问题 I am writing an App, in which I would like to append a text file, as various user actions happen. I would like the text file to be located in internal memory. I would like the text file to also be visible under Windows Explorer, if the user connects the tablet with a usb cable. I have looked at many examples, and have been able to write a text file to internal memory, but I can not seem to make the file visible in File Manager. Does anyone know if it is possible to write a text file to

Python 2.7.8 - Dictionary to file and back with style

本小妞迷上赌 提交于 2019-12-12 02:21:02
问题 def __init__(self): self.bok = {'peter': 123, 'maria': 321, 'harry': 888} def save(self): file = open('test.txt', 'w') file.write(str(self.bok)) file.close() print "File was successfully saved." def load(self): try: file = open('test.txt', 'r') newdict = eval(file.read()) self.bok = newdict file.close() print "File was successfully loaded." except IOError: print "No file was found." return How do i make it look like this inside the text file: value1:key1 value2:key2 ==> 123:peter 321:maria

How can I save HighCharts image into the project folder in PHP?

爱⌒轻易说出口 提交于 2019-12-12 02:05:26
问题 Im using highcharts to display some results, but i need to save the chart as an jpg image into the project folder to email it. There is a way to save the image without involve the "download" of the browser, just save it to a destinated folder. Thanks. 回答1: If you create your own export server like what is described here (I use the Java + phantomJS setup). You can then send via the command line the json to build the chart and the output type (jpeg, pdf, etc) and then you can redirect this

How to programmatically 'Print to figure' in a Simulink Scope

倾然丶 夕夏残阳落幕 提交于 2019-12-11 23:56:17
问题 Inside a Simulink Scope , it is possible to select Print to Figure . This will open a figure with the same content as the original scope. Is there a way to perform this action programmatically? See also this help page, this help page and this page. 回答1: Depends a little on how fancy you want/need to get. If you really want to use exactly the same code as the UI callback then you'll need to investigate how to use the callback functions in the following directory/package: MATLABROOT\toolbox

VBA Excel Macro save as part of cell with date

可紊 提交于 2019-12-11 22:56:03
问题 I have the following VBA code saving workbook1 sheets to a folder where workbook1 file is saved. Example: workbook1 has 31 sheets. The code saves each sheet to a new workbook with the same name as the sheet. (Sheet1, Sheet2, etc). Sub SaveShtsAsBook() Dim Sheet As Worksheet, SheetName$, MyFilePath$, N& MyFilePath$ = ActiveWorkbook.Path & "\" & _ Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4) With Application .ScreenUpdating = False .DisplayAlerts = False ' End With On Error Resume Next '

Same data saved generate different images - Python

百般思念 提交于 2019-12-11 19:49:23
问题 I have in my code two methods to save images data, one to just save it values in greyscale and another one to generate a heat map image: def save_image(self, name): """ Save an image data in PNG format :param name: the name of the file """ graphic = Image.new("RGB", (self.width, self.height)) putpixel = graphic.putpixel for x in range(self.width): for y in range(self.height): color = self.data[x][y] color = int(Utils.translate_range(color, self.range_min, self.range_max, 0, 255)) putpixel((x,

Saving and restoring Activity State when Activity is closed by pressing back button by user

依然范特西╮ 提交于 2019-12-11 19:05:46
问题 I am working on an App for collecting Customer Details like personal, business, assets etc. The app shows a ListView with options and based on options Activities are started. After entering details in personal user presses back button and returns to MainActivity ( Activity with a ListView ) and selects another option like business details and assets detail. User enters the details and come back to MainActivity by Back button and selects another option. I tried to save my Activity s using

Replace attachment when uploading a new attachment

倖福魔咒の 提交于 2019-12-11 18:58:16
问题 I have a simple form and body field. when user upload an attachment I want to remove any attachment already in the body field of the document. how can I do this in my save button. I have tried to set the properites on the fileUpload control to always change the filename to tha same name but this does not replace the file, instead it adds a new file and add a new sequential number to it <xp:fileUpload id="fileUpload1" value="#{userdoc.Body}" filename="profile" seUploadname="false"></xp

Why is my dataOfType: not called when saving?

给你一囗甜甜゛ 提交于 2019-12-11 18:48:06
问题 I have an NSDocument that contains a dataOfType method, but it is not called when I do a save. - (NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)outError { NSLog(@"db: %@", db); return [NSKeyedArchiver archivedDataWithRootObject:db]; } Why is this not called? Specifically, are there any reasons why my current document should not be the first responder that the menu-item "Save" points to? 回答1: Did you leave 'Use Core Data' checkbox unchecked on create new project