save

C4 saving part of an image

本秂侑毒 提交于 2019-12-02 04:49:51
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 gives me an error. any other attempts or thoughts? Do I have to go through the pixels of my screenshot,

Saving data in application

梦想与她 提交于 2019-12-02 04:12:06
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 button1; Chronometer chromo; protected long time; @Override protected void onCreate(Bundle

Where do I find the Saved Image in Android?

亡梦爱人 提交于 2019-12-02 03:52:10
Excuse me, quick question: I have this routine of video stream, where I receive packets, convert them to byte[] ,then to bitmaps, then display them on the screen: dsocket.receive(packetReceived); // receive packet byte[] buff = packetReceived.getData(); // convert packet to byte[] final Bitmap ReceivedImage = BitmapFactory.decodeByteArray(buff, 0, buff.length); // convert byte[] to bitmap image runOnUiThread(new Runnable() { @Override public void run() { // this is executed on the main (UI) thread imageView.setImageBitmap(ReceivedImage); } }); Now, I want to implementing a Recording feature.

File name has two backslashes C#

我们两清 提交于 2019-12-02 01:43:32
There is probably an easy answer for this, but when I added DateTime.Now.ToString() to my fileName it adds an extra \ for every \ I have so C:\Temp becomes C:\\Temp which causes the file not to save. This is the code in question String fileName = @"C:\Temp\data_" + DateTime.Now.ToString() + ".txt"; For example the output could be C:\\Temp\\data_12/04/2012 20:08:40.txt It should be C:\Temp\data_12/04/2012 20:08:40.txt Nope, that string really has single backslashes in. Print it out to the console and you'll see that. If you look at it in the debugger , you'll see the backslashes escaped - but

How to brush the plot and then save the brushed data in GUI?

ε祈祈猫儿з 提交于 2019-12-02 01:00:01
I have read couple of posts on how to save brushed data, however, on trying the suggestions on these posts ( this , this , this , this and this ), none of them seem to be working. One of the problem I encountered while trying these suggestions is that the program runs all the way through the end before any data is brushed, and therefore, the saved data is an empty matrix. My objectives are: Brush the data, and Save the brushed data. This is what I tried from here but it didn't seem to work: t=0:0.2:25; plot(t,sin(t),'.-'); brush on hBrushLine = findall(gca,'tag','Brushing'); brushedData = get

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

强颜欢笑 提交于 2019-12-02 00:57:54
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 this? codeninja.sj This is the sample xml file which I have used for testing your scenario: <dataset>

Unity. Android. Save files disappears after updating an App

若如初见. 提交于 2019-12-02 00:33:53
I'm creating pretty simple game in Unity, and want to save results, time, etc. I use System.IO for it, and everything works fine, but when i update my app from '.apk' all the results disappear. So how can i create file, which won't be deleted after update? public static void Save() { string[] lines = new string[] { Language, First_Test.ToString(), Last_Test.ToString(), MakeLine(ref Attention_Results), MakeLine(ref Memory_Results), MakeLine(ref Reaction_Results), Attention_Best.ToString(), Memory_Best.ToString(), Reaction_Best.ToString(), LastSend.ToString(), UserName, FlyTime.ToString() };

Fluent NHibernate Composite ID table problem

廉价感情. 提交于 2019-12-01 23:44:55
I'm kinda new to nhibernate and i ran into a problem. I have the following tables: Table 1: Table Name: Users, Column 1: ID, Column 2: Name Table 2: Table Name: Missions, Column 1: ID, Column 2: Description Table 3: Table Name: UserToDoMissions, Column 1: UserID, Column 2: MissionID, Column 3: Rank Here is the code: MissionMap: public class MissionMap : ClassMap<Mission> { public const string TableName = "tblMissions"; public const string c_id = "achID"; public const string c_name = "achName"; public MissionMap() { Table(TableName); Id(x => x.ID).Column(c_id).Not.Nullable(); Map(x => x.Name)

OpenCV2.3 imwrite saves black image

杀马特。学长 韩版系。学妹 提交于 2019-12-01 23:44:17
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); The following code works for me on 8bit (1 and 3 channel) images: std::vector<int> qualityType; qualityType.push_back(CV_IMWRITE_JPEG_QUALITY); qualityType.push_back(90); cv::imwrite("Final.jpg",image,qualityType); In your code

How can I save a plot with closed boxed area in MATLAB?

扶醉桌前 提交于 2019-12-01 23:17:25
问题 How can I close the plot area with black lines in the top and right side when I save a plot? I don't have any idea how to make it or how to search, if anyone knows please tell me. For example look at the plot shown below, where the lines are missing: 回答1: Before you save your image, use the box command. This will enclose your plot to have the surrounding black box as you have specified in your example image. Simply call: box on; To turn it off, do: box off; Example: %// Plot a line from 1 to