Search Results

Search found 4676 results on 188 pages for 'john nash'.

Page 112/188 | < Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >

  • MVC binding form data problem.

    - by John
    I am using an object that matches all the fields in my form. I then use the default binding to populate the object in my action, like this; public ActionResult GetDivisionData(DivisionObj FormData) My DivisionObj initializes all it's values to string.empty in the constructor. The problem is that when the binder populates the model from the posted form data, any data that is not posted is set to null in the object, eventhough I initialized the object to contain empty strings. Is there a way to change this so that unposted data will be an empty string.

    Read the article

  • Override Django inlineformset_factory has_changed() to always return True

    - by John
    Hi, I am using the django inlineformset_factory function. a = get_object_or_404(ModelA, pk=id) FormSet = inlineformset_factory(ModelA, ModelB) if request.method == 'POST': metaform = FormSet (instance=a, data=request.POST) if metaform.is_valid(): f = metaform.save(commit=False) for instance in f: instance.updated_by = request.user instance.save() else: metaform = FormSet(instance=a) return render_to_response('nodes/form.html', {'form':metaform}) What is happening is that if I change any of the data then everything works ok and all the data gets updated. However if I don't change any of the data then the data is not updated. i.e. only entries which are changed go through the for loop to be saved. I guess this makes sense as there is no point saving data if it has not changed. However I need to go through and save every object in the form regardless of whether it has any changes on not. So my question is how do I override this so that it goes through and saves every record whether it has any changes or not? Hope this makes sense Thanks

    Read the article

  • Can an ASP.NET user control determine its context or its parent .aspx file

    - by John Galt
    Is it possible for a user control to determine its "context" or its parent .aspx page in some way? Right now I have a user control that is declared on a typical .aspx page as follows: <%@ Register TagPrefix="uc1" TagName="ManageTitle" Src="../UserControls/ManageTitle.ascx" %> The user control currently emits a textbox as follows: <asp:textbox id="txtTitle" runat="server" MaxLength="60" ToolTip="Describe the item with a short pithy title - most important keywords first"/> The page_load for this .ascx file is currently like this: Me.txtTitle.Text = SetPageTitle() While some places in this web app need this (i.e. a textbox where end-user can type a "title"), I have other places where I want to show the "title" information in a "read-only" way. For example, rather than a textbox, I could use a label control or a textbox with Enabled="false" to prevent data entry. I suppose I could clone this small .ascx file and append a suffix to its name like _RO.ascx or something but I am wondering what the best approach would be. In short, can a user control get some sort of "context" from the page that declares it or is there an altogether better way to accomplish this sort of thing? Thank you.

    Read the article

  • Whats wrong with my script??

    - by John Augst
    Hi guys; Could you tell me whats wrong with this script: I think the error is in IF statment <script> productID=new Array() variaveis=location.search.replace(/\x3F/,"").replace(/\x2B/g," ").split("&") if(variaveis!=""){ for(i=0;iflash1"); } else if (flash = "flash2") { document.write("flash2"); } else { document.write("another"); }

    Read the article

  • Is my code really not unit-testable?

    - by John
    A lot of code in a current project is directly related to displaying things using a 3rd-party 3D rendering engine. As such, it's easy to say "this is a special case, you can't unit test it". But I wonder if this is a valid excuse... it's easy to think "I am special" but rarely actually the case. Are there types of code which are genuinely not suited for unit-testing? By suitable, I mean "without it taking longer to figure out how to write the test than is worth the effort"... dealing with a ton of 3D math/rendering it could take a lot of work to prove the output of a function is correct compared with just looking at the rendered graphics.

    Read the article

  • Building drag and drop interface on iphone

    - by John Stewart
    I am trying to build an app which will have a bunch of cards that the user needs to drag and drop them onto specific drop zones. How would one go about detecting this and if the card is not on the drop zone then it should slide back. Any suggestions on how to structure this app?

    Read the article

  • C++: How would I get unix time?

    - by John D.
    I need a function or way to get the UNIX epoch in seconds, much like how I can in PHP using the time function. I can't find any method except the time() in ctime which seems to only output a formatted date, or the clock() function which has seconds but seems to always be a multiple of 1 million, nothing with any resolution. I wish to measure execution time in a program, I just wanted to calculate the diff between start and end; how would a C++ programmer do this? EDIT: time() and difftime only allow resolution by seconds, not ms or anything too btw.

    Read the article

  • Can I use "map" as a substitute for "for each"/"for in"?

    - by John Mee
    For a little while now javascript has the "map" function to loop over arrays. It appears possible to use it as a 'foreach' operator for example: var arr = ['a','b','c'] var doubles = arr.map(function(val){ return val + val }) Is this better or worse than saying for(var i in arr){ ... 50/50: saves having to use the index but adds a callback; it doesn't seem very common so I hesitate to use it but still want to.

    Read the article

  • add element to the DOM with JS

    - by john
    I want add element with JS. I have code: var collection = document.getElementsByTagName('body');<br> var a = document.createElement('div');<br> a.innerHTML = 'some text';<br> collection.item(0).firstChild.appendChild(a);<br> and simple HTML: <html> <head> </head> <body> </body> </html> When is misstake?

    Read the article

  • how to preform an activity at the android lock screen?

    - by John
    I would like to perform an activity at the key guard screen, but the only way I can find to do so is to disable the key guard, do my activity, then re enable the key guard. This would be ok if it didn't cause the key guard screen to flash off and on (disable makes it disappear then re enable brings it back). I am wondering how I can perform an activity with it still being displayed? Kinda like how when the alarm goes off it shows a pop-up which is displayed over the key-guard screen?

    Read the article

  • Make text in a <div> wrap around a child element.

    - by John
    In Word you can place an image on a page and have the text flow nicely around it. I was wondering how far one can get towards this using CSS, noting that is has to work in IE6. I already have something sort of close using float, but the floated child-element still 'blocks' text above it. So it partially wraps. Is it possible to put a child div at some arbitrary position in the parent, and have text flow around it freely? The actual use-case here is to put illustrations inside the main content , where each illustration is implemented inside a child . I repeat, it has to work on IE6. And I don't want to get too involved in browser-specific hacks... floating the child at least works on IE6 with no tweaking. Currently I have like this: <div> <div class="illustration"> <img src="image1.png" /> <p>Illustration caption</p> </div> <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. Atvero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. </p> </div> div.illustration { float:right; border-top: 1px solid #505050; border-left: 1px solid #505050; border-right: 1px solid #505050; border-bottom: 1px solid #505050; margin-right:30px; margin-top:100px; text-align:center; padding:2px; background: #96C3FF; } div.illustration p { margin:0; font-size:small; font-style:italic; padding:0; }

    Read the article

  • How to get file path using FileUpload to be read by FileStream?

    - by john ryan
    I have a Method that open excel file and read it through exceldatareaderClass that i have downloaded in codeplex by using filestream. Currently I just declared the exact directory where the filestream open an excel file.And it works fine. Stream stream = new FileStream("C:\\" + FileUpload.PostedFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); Now i need to read the excel file wherever location the user place it like on windows forms fileupload.FileStream needs the exact location where the file is located. How to do this.? Example: Sample.xls is located on My Documents the file path should be like : C:\Documents and Settings\user\My Documents\ string openpath ="" ;//filepath Stream stream = new FileStream(openpath+ FileUpload.PostedFile.FileName, FileMode.Open, FileAccess.Read, FileShare.Read); Thanks in Regards

    Read the article

  • How to install older Android SDK in Eclipse

    - by John Brunner
    I'm working at the moment at a simple app in eclipse for android. Just receiving and sending data, and using the camera API. I've set the minSDKversion to 8, because I think that has the widest user base. But at the beginning of the project eclipse was asking me which target SDK version I would use, and because I had just one installed (the latest 4.0.3) I've took this. Now I'm asking me if it wouldn't be wiser to install a lower SDK, like Android 2.2, because it would be not that big (compared to the 4.0.3) and my app would not have included all the fancy new features, which are not used in any way?! Or is this complete nonsense I'm talking here, and just should take my 4.0.3 SDK? When not, how can I install a lower version? Help -> SDK Manager is not showing old SDKs...

    Read the article

  • Templates in C#

    - by John Doe
    I know generics are in C# to fulfill a role similar to C++ templates but I really need a way to generate some code at compile time - in this particular situation it would be very easy to solve the problem with C++ templates. Does anyone know of any alternatives? Perhaps a VS plug-in that preprocesses the code or something like that? It doesn't need to be very sophisticated, I just need to generate some methods at compile time.

    Read the article

  • Why does C++ linking use virtually no CPU?

    - by John
    On a native C++ project, linking right now can take a minute or two, yet during this time CPU drops from 100% during compilation to virtually zero. Does this mean linking is primarily a disk activity? If so, is this the main area an SSD would make big changes? But, why aren't all my OBJ files (or as many as possible) kept in RAM after compilation to avoid this? With 4Gb of RAM I should be able to save a lot of disk access and make it CPU-bound again, no?

    Read the article

  • .gitignore not working for me

    - by John Grey
    Hi, I'm trying to create a new git repository from existing folder. I've created a .gitignore file in the root of the folder. But if I say 'git add *' 'git commit' 'git push' files that should be ignored still get commited to the remote repository. I'm on Windows. Also I've bought a license for SmartGIT. It also seems to ignore .gitignore. I have to manually select which new files to commit. What am I doing wrong?

    Read the article

  • How is location accuracy measured in Android?

    - by John Palmer
    Does anyone know the proper interpretation of the accuracy measurements returned by getAccuracy()? For instance, are they calculated as: Circular Error Probability (meaning, if i understand correctly, radius of a 50% confidence circle)? Radius of 95% confidence circle? something else? Many thanks for any advice you can give me.

    Read the article

  • Save object in CoreData

    - by John
    I am using CoreData with iPhone SDK. I am making a notes app. I have a table with note objects displayed from my model. When a button is pressed I want to save the text in the textview to the object being edited. How do I do this? I've been trying several things but none seem to work. Thanks EDIT: NSManagedObjectContext *context = [fetchedResultsController managedObjectContext]; NSEntityDescription *entity = [[fetchedResultsController fetchRequest] entity]; NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context]; [newManagedObject setValue:detailViewController.textView.text forKey:@"noteText"]; NSError *error; if (![context save:&error]) { /* Replace this implementation with code to handle the error appropriately. abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. If it is not possible to recover from the error, display an alert panel that instructs the user to quit the application by pressing the Home button. */ NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } The above code saves it correctly but it saves it as a new object. I want it to be saved as the one I have selected in my tableView.

    Read the article

  • CakePHP Observe field for validation check(already exists)

    - by deck john
    i have already user observe field in cakephp 1.3 Now i want to do the same thing in cakephp 2.0 I have one form.there is a one field named email. When user insert email. onblur there is a popup one message that displays "email already exists" or "right" for that i have write below code in my projects. the below code is my add file code <?php $options = array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exist'); echo $this->ajax->observeField('UserEmailId',array('url' => array( 'controller' => 'users', 'action' => 'is_exist'), 'update' => 'email_exists')); ?> In my controller i have created one function like public function is_exist($id = null) { $result = "yes"; $this->set('existdata',$result); } i have also created is_exists.ctp fiel in view/uers. i dont know why its not working. i did the same thing in Cakephp 1.3 and its working file but not in cakephp 2.0 can anyone tell me how i implement this ? thanks in advance

    Read the article

  • Keeping messages in queue in case of receiver crash

    - by John Doe
    Hi, We've a Spring JMS message listener container for receiving messages asynchronously. Using DefaultMessageListenerContainer and in sessionTransacted mode. I understand being in sessionTransacted mode means in case of an exception the message will be put back into the queue. But how can I make sure the message won't be deleted from the queue even if the receiver (which is picked the message) crashes or just the machine running it looses power? At first I thought CLIENT_ACKNOWLEDGE acknowledge mode should save me, but apparently it's not the case, Spring calls .acknowledge() no matter what. So here's my question, how can I guarantee the delivery? Using a custom MessageListenerContainer? Using a transaction manager?

    Read the article

< Previous Page | 108 109 110 111 112 113 114 115 116 117 118 119  | Next Page >