Search Results

Search found 53 results on 3 pages for 'camilo'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Django Formset validation with an optional ForeignKey field

    - by Camilo Díaz
    Having a ModelFormSet built with modelformset_factory and using a model with an optional ForeignKey, how can I make empty (null) associations to validate on that form? Here is a sample code: ### model class Prueba(models.Model): cliente = models.ForeignKey(Cliente, null = True) valor = models.CharField(max_length = 20) ### view def test(request): PruebaFormSet = modelformset_factory(model = Prueba, extra = 1) if request.method == 'GET': formset = PruebaFormSet() return render_to_response('tpls/test.html', {'formset' : formset}, context_instance = RequestContext(request)) else: formset = PruebaFormSet(request.POST) # dumb tests, just to know if validating if formset.is_valid(): return HttpResponse('0') else: return HttpResponse('1') In my template, i'm just calling the {{ form.cliente }} method which renders the combo field, however, I want to be able to choose an empty (labeled "------") value, as the FK is optional... but when the form gets submitted it doesn't validate. Is this normal behaviour? How can i make this field to skip required validation?

    Read the article

  • Allowing user to select a UIPickerView row by tapping.

    - by camilo
    Hi. I'm trying to use a UIPicker View with a behavior somehow different of what's usually seen in iPhone code examples. What I want to do is to allow users to scroll through the picker contents, but not to select a picker's row automatically (using the "didSelectRow" method from picker's delegate). Instead, I want to allow the user to touch the center row of the picker, which gets highlighted, and becomes the selection. Is there any way to achieve this? Thanks in advance.

    Read the article

  • bundle .NET dlls to run application in .NET-less machine?

    - by Camilo Martin
    AFAIK, ngen turns MSIL into native code (also reffered to as pre-JIT), however I never payed too much attention at it's startup performance impact. Ngen'd applications still require the .NET base class libraries (the runtime). Since the base class libraries have everything our .NET assemblies need (correct?) would it be possible to ship the framework's DLLs with my ngen'd application so that it does not require the runtime to be installed? (e.g., the scenario for most Windows XP machines) Oh, and please don't bother mentioning Remotesoft's Salamander Linker or Xenocode's Postbuild. They are not for my (and many's) current budget (and they seem to simply bundle the framework in a virtualized enviroinment, which means big download sizes and slow startup times I believe) EDIT: I know now, ngen doesn't do what I thought it did. But is it possible to bundle the .NET files with an application, without using a VM?

    Read the article

  • use ngen and bundle .NET dlls to run application in .NET-less machine?

    - by Camilo Martin
    AFAIK, ngen turns MSIL into native code (also reffered to as pre-JIT), however I never payed too much attention at it's startup performance impact. Ngen'd applications still require the .NET base class libraries (the runtime). Since the base class libraries have everything our .NET assemblies need (correct?) would it be possible to ship the framework's DLLs with my ngen'd application so that it does not require the runtime to be installed? (e.g., the scenario for most Windows XP machines) Oh, and please don't bother mentioning Remotesoft's Salamander Linker or Xenocode's Postbuild. They are not for my (and many's) current budget (and they seem to simply bundle the framework in a virtualized enviroinment, which means big download sizes and slow startup times I believe)

    Read the article

  • Are there old versions of Windows UX guidelines somewhere?

    - by Camilo Martin
    Since I've read Windows User Experience Interaction Guidelines (there's a PDF download avaliable) I've found it to be admirably self-deprecating, humbly pointing out their own horrible UI practices long scolded by Joel Spolsky. I'd like to know, however, what they had in mind while they made those mistakes. Is this (terrific) UX Guidelines document something new, or were there previous issues of such? If so, where can I find them? My prayers to Google yielded no leniency.

    Read the article

  • How to get the size of a NSString

    - by camilo
    Hi. A "quicky": how can I get the size (width) of a NSString? I'm trying to see if the string width of a string to see if it is bigger than a given width of screen, case in which I have to "crop" it and append it with "...", getting the usual behavior of a UILabel. string.length won't do the trick since AAAAAAAA and iiiiii have the same length but different sizes (for example). I'm kind of stuck. Thanks a lot.

    Read the article

  • iPhone NSCFString leaks in fetchRequest

    - by camilo
    In the following code: - (NSMutableArray *) fetchNotesForGroup: (NSString *)groupName { // Variables declaration NSMutableArray *result; NSFetchRequest *fetchRequest; NSEntityDescription *entity; NSSortDescriptor *sortDescriptor; NSPredicate *searchPredicate; NSError *error = nil; // Creates the fetchRequest and executes it fetchRequest = [[[NSFetchRequest alloc] init] autorelease]; entity = [NSEntityDescription entityForName:@"Note" inManagedObjectContext:managedObjectContext]; [fetchRequest setEntity:entity]; sortDescriptor = [[[NSSortDescriptor alloc] initWithKey:@"noteName" ascending:YES] autorelease]; [fetchRequest setSortDescriptors:[NSArray arrayWithObject:sortDescriptor]]; [fetchRequest setReturnsDistinctResults:YES]; searchPredicate = [NSPredicate predicateWithFormat:@"categoryName like %@", groupName]; [fetchRequest setPredicate:searchPredicate]; [fetchRequest setPropertiesToFetch:[NSArray arrayWithObject:@"noteName"]]; result = [[managedObjectContext executeFetchRequest:fetchRequest error:&error] mutableCopy]; // Variables release return result; } ... I Fetch notes for a given categoryName. When I'm running Instruments, it says that a NSCFString is leaking. I know leaks are mean for iPhone developers... but I don't have any idea on how to plug this one. Any clues? All help is welcome. Thanks a lot!

    Read the article

  • Save UITextView content in NSString.

    - by camilo
    Hi, I'm trying to save the contents of an UITextView into a NSString which I will somehow persist later. The problem is that the UITextView "text" property doesn't save all the rows in the textView (after touching "return"). I tried print the TextView object and the textView.text, and they're different. Does anybody know how (after editing the textView) I can save its content into a String (or something else that I can later access and share through different views and persist in the database)? Thanks a lot. Pretty sure it is simple, but I'm honestly not finding the solution.

    Read the article

  • UIButtons creating a native-like keyboard behavior.

    - by camilo
    Greets. A somehow detailed explanation on my problem, and what I have already done, and what I cannot do. I want to create a behavior resembling the one in the iPhone's keyboard. Basically, I want a view to appear when the user taps a button and WHILE the user taps that button. This, I accomplished. When the user lets go of the button WHILE his finger is on that button's area, I want to trigger an action "doing stuff". This, I was also able to do. Since all the buttons are near (like in the keyboard) and I don't want the user to select other button than the one he pressed, I reduced the hit area for the button using the -(BOOL)pointInside:(CGPoint)point withEvent:(UIEvent )event function. When the user presses the button, not lifting its finger, and dragging outside the button area, I want another action to trigger. This is the first problem... This function only triggers when the user's finger is far from the buttons' area, and this time the pointInside function is not being my friend. How can I detect the user finger "left" the button area the moment it exits its bounds? This, in case you didn't realize... was problem 1. The second problem is related with the drag enter. Again, I need to limit the area like in the drag exit. But I suppose that when I solve one of these, the other is the same. The problem is that in order to have a behavior like in the keyboard, I may need to detect the user started the touch in another button, never lifted his finger, and changed to another button. I can detect drag enter and drag exit IN THIS ORDER while on the same button. I cannot detect drag enter when the user first touched anywhere else other than the button where I want to detect the drag enter event. Basically what I need is to detect touch on any button (and not anywhere else in the view), and while the user is changing buttons without lifting the finger, I want to detect the new button being touched. This gigantic paragraph was problem #2. Any help, as you might guess, is highly appreciated. Best Regards. Thanks a lot!

    Read the article

  • Preview rounded image in iphone

    - by camilo
    Hi, can anyone tell me how can I create an image preview inside a customized cell with the aspect of the ones loaded in the mms'. I've been trying to do it by changing values in IB and I haven't been able to. Thanks a lot!

    Read the article

  • VB.NET: Dialog exits when enter pressed?

    - by Camilo Martin
    Hi all; My problem seems to be quite simple, but it's not working the intuitive way. I'm designing a Windows Forms Application, and there is a dialog that should NOT exit when the enter key is pressed, instead it has to validate data first, in case enter was pressed after changing the text of a ComboBox. I've tried by telling it what to do on KeyPress event of the ComboBox if e is the Enter key: Private Sub ComboBoxSizeChoose_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBoxSizeChoose.KeyPress If e.KeyChar = Convert.ToChar(Keys.Enter) Then Try TamanhoDaNovaFonte = Single.Parse(ComboBoxSizeChoose.Text) Catch ex As Exception Dim Dialogo2 As New Dialog2 Dialog2.ShowDialog() ComboBoxSizeChoose.Text = TamanhoDaNovaFonte End Try End If End Sub But no success so far. When the Enter key is pressed, even with the ComboBox on focus, the whole dialog is closed, returning to the previous form. The validation is NOT done at all, and it has to be done before exiting. In fact, I don't even want to exit on the form's enter KeyPress, the only purpose of the enter key on the whole dialog is to validate the ComboBox (but only when in focus, for the sake of an intuitive UI). I've also tried appending the validation to the KeyPress event of the whole dialog's form, if the key is Enter. NO SUCCESS! It's like my code wasn't there at all. What should I do? (Visual Studio 2008, VB.NET)

    Read the article

  • A NSMutableArray is destroying my life!

    - by camilo
    EDITED to show the relevant part of the code Hi. There's a strange problem with an NSMutableArray which I'm just not understanding... Explaining: I have a NSMutableArray, defined as a property (nonatomic, retain), synthesized, and initialized with 29 elements. realSectionNames = [[NSMutableArray alloc] initWithCapacity:29]; After the initialization, I can insert elements as I wish and everything seems to be working fine. While I'm running the application, however, if I insert a new element in the array, I can print the array in the function where I inserted the element, and everything seems ok. However, when I select a row in the table, and I need to read that array, my application crashes. In fact, it cannot even print the array anymore. Is there any "magical and logical trick" everybody should know when using a NSMutableArray that a beginner like myself can be missing? Thanks a lot. I declare my array as realSectionNames = [[NSMutableArray alloc] initWithCapacity:29]; I insert objects in my array with [realSectionNames addObject:[category categoryFirstLetter]]; although I know i can also insert it with [realSectionNames insertObject:[category categoryFirstLetter] atIndex:i]; where the "i" is the first non-occupied position. After the insertion, I reload the data of my tableView. Printing the array before or after reloading the data shows it has the desired information. After that, selecting a row at the table makes the application crash. This realSectionNames is used in several UITableViewDelegate functions, but for the case it doesn't matter. What truly matters is that printing the array in the beginning of the didSelectRowAtIndexPath function crashes everything (and of course, doesn't print anything). I'm pretty sure it's in that line, for printing anything he line before works (example): NSLog(@"Anything"); NSLog(@"%@", realSectionNames); gives the output: 2010-03-24 15:16:04.146 myApplicationExperience[3527:207] Anything [Session started at 2010-03-24 15:16:04 +0000.] GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all Attaching to process 3527. Still not understanding what kind of stupidity I've done this time... maybe it's not too late to follow the career of brain surgeon?

    Read the article

  • Disable animations when ending search in iPhone

    - by camilo
    Hi. A quicky: is there a way to dismiss the keyboard and the searchDisplayController without animation? I was able to do it when the user presses "Cancel", but when the user presses the black "window thingy" above search field (only visible while the user hasn't inserted any text), the animation always occurs, even when I change the delegate functions. Is there a way to control this, or as an alternative, to disable the user to end searching by pressing the black window? Thanks in advance.

    Read the article

  • Locking a file to verify a single execution of a service. How reliable?

    - by Camilo Díaz
    Hello, I am deploying a little service to an UNIX(AIX) system. I want to check if there is no active instance of that service running when starting it. How reliable is to implement that check like this? Try to acquire a lock on a file (w/ FileChannel) If succeeds, keep lock and continue execution If fails, exit and refuse to run the main body I am aware of software like the Tanuki wrapper, however, I'm longing for a simpler(maybe not portable) solution. Regarding PIDFILE(s): I want to avoid using them if possible, as I don't have administrative rights on the machine, neither knowledge in AIX's shell programming.

    Read the article

  • How do I know if I'm iterating on the last item of the collection?

    - by Camilo Martin
    I want to do something different on the last KeyValuePair of the Dictionary I'm iterating on. For Each item In collection If ItsTheLastItem DoX() Else DoY() End If Next Is this possible? Edit: As Jon correctly remarks, Dictionaries are not the kind of thing that's sorted, so I should mention that I only want to do this when displaying results to the user, and it doesn't matter if later on the last item is different. In another note, I'll use my own answer but I'll accept the most upvoted one after I check back in some hours.

    Read the article

  • Problem when exiting search in iPhone

    - by camilo
    Hi. I have a search display controller, and it is searching well. I'm searching in a table with several sections and I have a viewForHeaderInSection function working as it's supposed to. When I start searching, my numberOfSectionsForTableView returns 1, and I have a special view saying "Search Results" wich I use in self.searchDisplayController.searchResultsTableView. The problem happens when I select a row in my searchResultsTableView: I change the view, and when I return and try to exit the searchDisplayController (by pressing the CancelButton), the tables change nice, but changing the viewforHeader for my first section is not "pretty". I have a "kind-of-click" anymation. I would like it to not be so noticeable for the user, having a more "fluid" change. Anybody had the same problem and knows how to solve it? In a different question (which would work as a workaround): how can I hide the keyboard while searching without pressing the Cancel or Search buttons? Thanks a lot!

    Read the article

  • Detect iphone region

    - by camilo
    Hi. In my app, the user is supposed to insert a phone number, which is then displayed somewhere else. In the contacts application, when displaying a phone number, it automatically appears in the format of the language selected by the user. Is there a way to do this automatically, or a way to detect the region and then adapt the displayed string?

    Read the article

  • Why can't I write just a try with no catch or finally?

    - by Camilo Martin
    Sometimes I do this and I've seen others doing it too: VB: Try DontWannaCatchIt() Catch End Try C#: try { DontWannaCatchIt(); } catch {} I know I should catch every important exception and do something about it, but sometimes it's not important to - or am I doing something wrong? Is this usage of the try block incorrect, and the requirement of at least one catch or finally block an indication of it?

    Read the article

  • Have my UIPickerView having the same behavior than the keyboard.

    - by camilo
    Hi. So I have a UITableView where one of its rows is a UITextView. When the user is writing something to UITextView (using the keyboard) the user can scroll the tableview and select another cell. Everything works. When the user selects another cell, a datePicker appears, and the user can select a given date. I want the user to be able to scroll the tableView the same way like when the keyboard is on the screen. The problem here is that when I scroll with the picker, the table bounces back to the previous position (with some cells hidden by the picker). I assume that this happens because I add the picker to the main window, as a subview... but I'm honestly not sure... Where (and how) should I add my picker so that it "appears" where the keyboard appears? Not sure I was clear... Thanks a lot.

    Read the article

  • Search the public stream in Facebook

    - by camilo_u
    Hi, Is there any change i can search for anything in the Open Stream in Facebook? Let´s say that i want to look for "obama", this will return all of the obama mentions for a bunch of people in their streams, so far I haven't found anything like this, probably only looking in one user stream, but not the whole stuff. So, i haven't found a way to do this, but how come, sites like socialmention.com can do it? Do they query user by user streams? and how to do it without users permissions? What do you guys think? Thanks in advance! Camilo

    Read the article

< Previous Page | 1 2 3  | Next Page >