save

Why won't my NSUserDefaults load?

So I have an iphone app that presents a modal view when it starts if the user has not registered. Once they register, it saves a user ID into NSUserDefaults. When the app starts at a later time, it needs to load this user id in the appdelegate file. //Registration.m NSUserDefaults *savedUID = [NSUserDefaults standardUserDefaults]; [save...

Visual C# - Write contents of a textbox to a .txt file.

I'm trying to save the contents of a textbox to a text file using Visual C#. I use the following code: private void savelog_Click(object sender, EventArgs e) { if (folderBrowserDialog3save.ShowDialog() == DialogResult.OK) { // create a writer and open the file TextWriter tw = new StreamWriter(...

What commit styles are available in MongoDB?

In some sense, the default "save" operation appears to be asynchronous in MongoDB. It seems that when a client saves a document, it will typically receive a successful response immediately from the server, even if the operation has not yet been applied to the database (let alone committed to disk). (I'm basing this model for how save()...

Get Pixel Values from Android Canvas

Hi, I'm currently writing an Android game using surfaceView. I've optimized the game as much as possible and it runs quite smoothly. However, I have collision detection incorporated which is a bit messy. I would like to do collision detection by reading pixels directly from the canvas. Is this possible to do? The closest to this that I ...

Django - Are model save() methods lazy?

Are model save() methods lazy in django? For instance, at what line in the following code sample will django hit the database? my_model = MyModel() my_model.name = 'Jeff Atwood' my_model.save() # Some code that is independent of my_model... model_id = model_instance.id print (model_id) ...

How to force Emacs to save even if it thinks (no changes need to be saved)

This happens to me all the time: I have a file open in emacs, I save it ('save-buffer), the file changes on disk (or get's deleted, moved, etc.) but I want it back, so I try to save again in emacs ('save-buffer) and instead of saving it says "(no changes need to be saved)" and does nothing. Is there a different function, or a setting...

Export/Import NSImage as ICO

Hi everyone, I would like to save and read an ICO file. It doesnt matter if its NSImage or NSBitmapImageRep or anything. It just needs to be done. How could this be accomplished? ...

Help preserving data after onDestroy() is called.

Hello, in my application I have a list of installed application. This list also contains the app name, icon, and intent to launch it. How would I go about saving this data so I don't have the need to load it each time. Thanks in advance ...

get_or_create() question

From the official documentation I can't understand what is default parameter. obj, created = Person.objects.get_or_create(first_name='John', last_name='Lennon', defaults={'birthday': date(1940, 10, 9)} Does it mean that it will look for fields which match both John and Lennon parameter and birthday will just insert? ...

NHibernate - save user id of creator from username

Hi all I'm trying to use NHibernate in a project. All my domain tables include a 'CreatedBy' field which is a foreign key to the Users table. Since this is an ASP.NET app, the only information I have about the user at the time of saving is the username, from the cookie. What is the best approach for obtaining the user ID and saving it ...

Cannot set entity properties in NHibernate event listener.

Hi all I'm overriding NHibernate's PreInsertEventListener in order to set the entity's DateCreated property to DateTime.Now. Here is my code: public bool OnPreInsert(PreInsertEvent e) { DomainObject domainObject = (DomainObject) e.Entity; if (domainObject.CreatedById == 0) throw new Exception("The " + domainObject.GetType().Name +...

Save button missing from Drupal site

Hi there, I'm in the middle of creating a Drupal site. It already has lots of content. This morning I found out that the "Save" button has now gone missing from my Page and News nodes. Users now have to click Preview before the Save button appears (both for creating new content and editing existing content). It was fine yesterday and I'...

Entity Framework - Initial Save is slow

We are implementing a system using EF4 and WPF. We are noticing an issue with the initial saving of data: when the initial SaveChanges is run there is a 4 to 6 second delay when context.SaveChanges() command is run. Every subsequent SaveChanges is very fast with no noticable delay. This is not a major issue - but an annoyance none-the-l...

How to tell if iPhone application was launched by backgrounding or not.

My application uses NSUserDefaults to store some values so that it can restore them on application update or if backgrounding is quit. Backgrounding automatically saves my integer values, but if the user quits the application from the launcher, the numbers are lost too, and the ViewDidUnload method I guess doesn't evoke when entering bac...

Editing .doc document using AppleScript

I am trying to batch convert some .doc files to .pdf I am pretty sure I've got the concept right, I just do not know how to reference the format to change the file format when I "Save As" set F to choose folder tell application "Finder" set P to (files of entire contents of F) repeat with I from 1 to number of items in P set this_it...

django: recursion using post-save signal

Here's the situation: Let's say I have a model A in django. When I'm saving an object (of class A) I need to save it's fields into all other objects of this class. I mean I need every other A object to be copy of lat saved one. When I use signals (post-save for example) I get a recursion (objects try to save each other I guess) and my...

Save an Android MapView and reload

Hi all! I had found a lot of stackoverflow post about save an Activity and the reload it. My question: How can I have an Activity with an MapView and after reload the same mapview ? What is the best way to switch between activity and views ? Thanks:Karoly ...

Current browser/OS support for JS called PRINT and SAVE dialogues?

I have a request to enable some links on a web page for PRINT and SAVE. Historically I've always avoided those as in the past they weren't supported in all browsers and OSes and, well, I also found them annoying as a user. I tended to opt for 'print friendly' functionality or, barring that, just proper print CSS. That said, I'm being a...

How do/should I prepare a folder for stored image, reference from sql, save the image location using C#

Really hoping someone can provide some code sample or point me in the right direction (with examples C#.net). I did try to check if this question was asked before.. but didn't really find code samples which answered all my questions. Image folder for saved files -should this be in the solution or somewhere else What kind of data type -...

How to change a NSMutableDictionary int value

I have a StateArray.plist set up with 50 dictionary entries each containing a string with the name of the state and a number 0. What I want to be able to do is change the 0 to a 1 through a segmented control and save the updated plist. The code I have is below and won't save the changed number. -(void) viewWillAppear: (BOOL) animated ...