save

backbonejs + cors and save() method

核能气质少年 提交于 2019-12-06 00:19:52
问题 I'm trying to execute a POST throw the save method. Here is my model. app.Models.Dummy = Backbone.Model.extend({ initialize: function () { url = 'http://anotherdomain/Hello/'; }, }); When i execute: dummy.save({text : "greg"}, { success : function(){ console.log('Ok!'); }, error: function(){ console.log('Error'); } }); The request is fired with an OPTIONS header (code 200) but the POST request is never fired. However When i execute: $.ajax({ type: 'POST', url: "http://anotherdomain/Hello/",

Alternative to locking file type on FileReference.save() AS3

我只是一个虾纸丫 提交于 2019-12-05 21:34:35
问题 Update: As discussed in Jacob's reply below, limiting or correcting the behaviour of FileReference.save isn't possible. Can anyone suggest an alternative (server is Apache/PHP) that matches all of my criteria from this post and avoids the pitfalls I discussed with Jacob? End edit I'm saving an image from my AS3 app using FileReference.save(). This is the code, which works fine: var encoder:JPGEncoder = new JPGEncoder(80); var byteData = encoder.encode(myBMD); //bitmap data object created

Best way to save/load pictures with .Net & SQL Server 2005?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 21:23:33
What is the typical way to handle product pictures in a web-page selling products? Say I had a database with books or computer components etc, all of which have their own sample pictures for example... Should I save them into the DB as binary data, or somehow handle them in the codebehind, saving them into a directory with the appropriate link to the picture file being saved into the product table in the DB? I'm trying to make a sales company example, and while I can come up with ways to do this, I wonder what is the typical norm used in the programming business? Update: Storing on another

How to run annotation processor in eclipse on save

落花浮王杯 提交于 2019-12-05 21:04:18
问题 Currently I generate files with an annotation processor in eclipse for a project by Right click on project > Run As > Maven Clean Right click on project > Run As > Maven install This is quite time consuming. How do I set up eclipse to make it run the annotation processor on save? I have the "Build Automatically" feature set but it seems to ignore the annotation processors. BTW I am using m2e apt plugin with "Automatically configure JDT APT activated". 回答1: I have annotation processing working

android saving to SD card

纵然是瞬间 提交于 2019-12-05 20:21:51
hi to all i have a small problem i have this code to save an image to an SD card public String SDSave( ) { //View arg0 // TODO Auto-generated method stub OutputStream outStream = null; File file = new File( extStorageDirectory , AdName + ".PNG"); try { outStream = new FileOutputStream(file); bm.compress(Bitmap.CompressFormat.PNG, 100, outStream); outStream.flush(); outStream.close(); Toast.makeText(WhereAmI.this, "Saved", Toast.LENGTH_LONG).show(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); Toast.makeText(WhereAmI.this, e.toString(), Toast

C# images cropping,splitting,saving

空扰寡人 提交于 2019-12-05 19:34:22
as stated in subject, i have an image: private Image testing; testing = new Bitmap(@"sampleimg.jpg"); I would like to split it into 3 x 3 matrix meaning 9 images in total and save it.Any tips or tricks to do this simple? I'm using visual studios 2008 and working on smart devices. Tried some ways but i can't get it. This is what i tried: int x = 0; int y = 0; int width = 3; int height = 3; int count = testing.Width / width; Bitmap bmp = new Bitmap(width, height); Graphics g = Graphics.FromImage(bmp); for (int i = 0; i < count; i++) { g.Clear(Color.Transparent); g.DrawImage(testing, new

Can't save my Preferences after app killed

戏子无情 提交于 2019-12-05 19:28:33
Hi I'm trying to implement a settings page on my Android App. I defined a xml Preference file, where I implemented CheckBoxPreference and EditTextPreference. All the settings work perfectly while running the app, but when I kill it I lose all the settings. Preference.xml file: <PreferenceCategory android:title="Connection"> <CheckBoxPreference android:title="Auto Log-In" android:summary="Auto connect " android:key="autoLogIn" android:enabled="true" android:selectable="true"/> <EditTextPreference android:name="Server" android:summary="Change the default server" android:defaultValue="www.google

How to save a picture to a file?

久未见 提交于 2019-12-05 19:18:05
I'm trying to use a standard Intent that will take a picture, then allow approval or retake. Then I want to save the picture into a file. Here's the Intent I am using: Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); startActivityForResult( intent, 22 ); The documentation says: The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value

C# - Saving a '.txt' File to the Project Root

帅比萌擦擦* 提交于 2019-12-05 18:54:26
问题 I have written some code which requires me to save a text file. However, I need to get it to save to my project root so anyone can access it, not just me. Here's the method in question: private void saveFileToolStripMenuItem_Click(object sender, EventArgs e) { try { string fileName = Microsoft.VisualBasic.Interaction.InputBox("Please enter a save file name.", "Save Game"); if (fileName.Equals("")) { MessageBox.Show("Please enter a valid save file name."); } else { fileName = String.Concat

How can I tell if I'm in beforeSave from an edit or a create? CakePHP

♀尐吖头ヾ 提交于 2019-12-05 18:50:01
问题 I have a model where I need to do some processing before saving (or in certain cases with an edit) but not usually when simply editing. In fact, if I do the processing on most edits, the resulting field will be wrong. Right now, I am working in the beforeSave callback of the model. How can I tell if I came from the edit or add? Frank Luke 回答1: function beforeSave() { if (!$this->id && !isset($this->data[$this->alias][$this->primaryKey])) { // insert } else { // edit } return true; } 回答2: This