save

saving a json file to internal memory

こ雲淡風輕ζ 提交于 2019-12-02 09:03:28
hey there guys and girls i have this code that should download a json object and then save it to internal memory, i keep getting stuck here try{ //connects to mySQL HttpClient client = new DefaultHttpClient(); HttpPost post = new HttpPost("http://10.0.2.2/textures_story_list.php"); HttpResponse response = client.execute(post); //captures the response entity = response.getEntity(); }catch(Exception e) { Log.e("log_tag", "Error in http connection "+e.toString()); } try{ is = entity.getContent(); String FILENAME = "story.json"; //gives file name FileOutputStream output = openFileOutput(FILENAME,

Unity - Save Progress In Game?

匆匆过客 提交于 2019-12-02 09:00:29
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 on unity, if I try does not work on Android. you know how I can fix? This is how you do it for an example class called MyClass using UnityEngine; using System.Collections; using System; using System.Runtime.Serialization.Formatters

C4 saving part of an image

笑着哭i 提交于 2019-12-02 08:27:28
问题 Hei, I went through the example for saving images and afterwards I wanted to save only a part of the screen. I managed to save the part starting at the upper left corner of the image but I actually want to save the center of my screen. The magic to save only a part of an image is setting up the Graphics Context with a certain size, like this: UIGraphicsBeginImageContextWithOptions(CGSizeMake(300, 300), YES, 5.0f); I thought there might be a way to use a CGRect instead of the size, but that

Saving data in application

*爱你&永不变心* 提交于 2019-12-02 07:27:29
问题 I have made an application. It's a button that shows the time you have pressed it. Every time I "kill" the application, the timer starts at 0 again (naturally). How can I make the application save the time the button is pressed, so when the application is killed, and then you open it, the timer is at that time you stopped.I have red some about how this is done, and I think it has something to do with SharedPreferences. My code: public class MainActivity extends ActionBarActivity { Button

OpenCV2.3 imwrite saves black image

百般思念 提交于 2019-12-02 06:46:14
问题 I am trying to save a JPEG image onto the disk using imwrite, seems that I am missing something. I am always getting a black image of around 4KBs. What am I doing wrong here? Image I see seems fine but once onto the disk, its completely black. std::vector<int> qualityType(1); qualityType.push_back(CV_IMWRITE_JPEG_QUALITY); cv::imwrite("Final.jpg",image,qualityType); 回答1: The following code works for me on 8bit (1 and 3 channel) images: std::vector<int> qualityType; qualityType.push_back(CV

Best way to save the large number of records in hibernate

匆匆过客 提交于 2019-12-02 06:45:46
问题 I have 5000 records to be saved. what is the best way in the database point of view, whether to save individual records(save(record) 5000 times) or saveAll(list of 5000 records) in hibernate ...? As this kind of scenarios come regularly suggest me the best one.. 回答1: Use the feature batch Insertion in Hibernate. Batch Insertion is a powerful feature of hibernate particularly useful when you are importing data from other systems in batch. If you do not use batch feature of hibernate, your

IPython: how to automagically load npz file and assign values to variables?

江枫思渺然 提交于 2019-12-02 06:19:01
问题 I'm new to Python and I'm eagerly migrating from MATLAB to IPython as my preferred language for data analysis at the lab. In MATLAB, after a session of data crunching, I would do >>> save('myresults.mat','x','y','z'); and save the results of the variables x, y and z in a file called 'myresults.mat'. Later on, I could simply say: >>> load('myresults'); and MATLAB would load the .mat file AND assign the stored values of the variables to the current workspace. I've recently learned that I can do

1004 Error- issues with SaveAs

本秂侑毒 提交于 2019-12-02 05:28:00
savePath = "\\local drive path" myFileName = savePath & "Workbook Name " & saveDate Application.DisplayAlerts = False 'MsgBox (myFileName) wbTarget.Activate ActiveWorkbook.SaveAs Filename:=myFileName, FileFormat:=xlOpenXMLWorkbook When using the above code, I get an error 1004 "Method SaveAs of object_Workbook failed and can't figure out why. I'm relatively new to excel but belive I have everything set up right. Update: Sorry should have shown the more complete code. Sub SaveAs() 'Save As "Workbook Name" Dim wbTarget As Workbook Dim wbThis As Workbook Dim strName As String Set wbTarget =

How I can save a DatagridView in a Xml and Load A Xml to datagridView?

 ̄綄美尐妖づ 提交于 2019-12-02 05:16:51
问题 Hi I want to save and load data from a datagridview to a xml. My idea is that I can save my datagridview to a xml how this -> "[date]_[name].xml" and later I can load this data. For this two operations I want to use two methods --> Save() and Load() Here is my code for saving: private void Save(DataGridView grid) { try { xmlfile = @"C:\datagrid.xml"; dataset = (DataSet)InputDataGrid.DataSource; dataset.WriteXml(xmlfile); } catch (Exception ex) { MessageBox.Show(ex.Message); } } How I can do

Shiny downloadHandler doesn't save PNG files

允我心安 提交于 2019-12-02 05:08:14
问题 I've got my download function to do everything right, when the save as screen comes up, the file name I specified appears. When I click on save the window closes, but no file gets saved... The same plot works fine in the app, the only problem is I cant seem to save it to a PNG file. I run the shine app on my laptop and use RStudio. Here is some extracts of my code. ui.R downloadButton('downloadSMemPlot', 'Download Graph') server.R '#draw membersip plot s.MemPlotInput <- reactive({ '#some code