Search Results

Search found 1612 results on 65 pages for 'ben rod'.

Page 9/65 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Form (or Formset?) to handle multiple table rows in Django

    - by Ben
    Hi, I'm working on my first Django application. In short, what it needs to do is to display a list of film titles, and allow users to give a rating (out of 10) to each film. I've been able to use the {{ form }} and {{ formset }} syntax in a template to produce a form which lets you rate one film at a time, which corresponds to one row in a MySQL table, but how do I produce a form that iterates over all the movie titles in the database and produces a form that lets you rate lots of them at once? At first, I thought this was what formsets were for, but I can't see any way to automatically iterate over the contents of a database table to produce items to go in the form, if you see what I mean. Currently, my views.py has this code: def survey(request): ScoreFormSet = formset_factory(ScoreForm) if request.method == 'POST': formset = ScoreFormSet(request.POST, request.FILES) if formset.is_valid(): return HttpResponseRedirect('/') else: formset = ScoreFormSet() return render_to_response('cf/survey.html', { 'formset':formset, }) And my survey.html has this: <form action="/survey/" method="POST"> <table> {{ formset }} </table> <input type = "submit" value = "Submit"> </form> Oh, and the definition of ScoreForm and Score from models.py are: class Score(models.Model): movie = models.ForeignKey(Movie) score = models.IntegerField() user = models.ForeignKey(User) class ScoreForm(ModelForm): class Meta: model = Score So, in case the above is not clear, what I'm aiming to produce is a form which has one row per movie, and each row shows a title, and has a box to allow the user to enter their score. If anyone can point me at the right sort of approach to this, I'd be most grateful. Thanks, Ben

    Read the article

  • Jquery selectors question

    - by Ben
    Hi all, I am not an expert at jquery but trying to get a menu to work. Basically, I have a menu made of up to 3 levels of nested lists. The first level has a little arrow has a background image that opens or close when opening the first level list. Any other nested lists don't need to have the background image. My script opens the menu when you click on it and is also supposed to switch the first level list from a class "inactive" to a class "active". Here is the script: $(document).ready(function(){ $("#left-navigation-holder ul.level1 li.inactive").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); $("#left-navigation-holder li a").click(function(){ menu = $(this).parent('li').children('ul'); menu.toggle(); }); }); The problem is that the toggle function also happens when clicking on second and third level lists causing the arrows to toggle even if the first level list isn't clicked on. I thought using $("#left-navigation-holder ul.level1 li.inactive").toggle would limit the function to the first level list with a class "inactive". Any help would be really appreciated. Ben

    Read the article

  • Wordpress/CSS: List Style Problem.

    - by Ben
    Hi all! I am reasonably new to Wordpress custom themes but I do have some knowlege of CSS, although I am terrible at customising other peoples code which is why I have the problem I am about to explain. I have started a website that my girlfriend and I are doing together. It uses the Simplo Wordpress theme which is pretty cool but when you add a post that has a list in it. It doesn't show the bullets on each of the items. I have tried adding 'list-style:circle;' to a the.postItem class and a couple of other divs and classes that I thought were relevant but it doesn't work. You can take a look for yourself, it may be easier to understand my problem that way. If you go to: http://brokeandstarving.com/234/bennos-shepherds-pie/ there is a list of ingredients and also the steps under the method is a list as well. My question is, where do I edit the CSS to make the bullets appear next to the list items? I hope that makes sense. Thanks in advance, - Ben

    Read the article

  • jquery tree traversing help

    - by rod
    Hi All, Given simple DOM: <form id="form1">...</form> <div> <div> <a href="#" id="export">Export</a> </div> </div> Starting with id=export, is there a way to go up a variable amount of divs and then get the closest form id? Thanks, rodchar

    Read the article

  • A GUID as the MySQL table's Primary Key or as a separate column

    - by Ben
    I have a multi-process program that performs, in a 2 hour period, 5-10 million inserts to a 34GB table within a single Master/Slave MySQL setup (plus an equal number of reads in that period). The table in question has only 5 fields and 3 (single field) indexes. The primary key is auto-incrementing. I am far from a DBA, but the database appears to be crippled during this two hour period. So, I have a couple of general questions. 1) How much bang will I get out of batching these writes into units of 10? Currently, I am writing each insert serially because, after writing, I immediately need to know, in my program, the resulting primary key of each insert. The PK is the only unique field presently and approximating the order of insertion with something like a Datetime field or a multi-column value is not acceptable. If I perform a bulk insert, I won't know these IDs, which is a problem. So, I've been thinking about turning the auto-increment primary key into a GUID and enforcing uniqueness. I've also been kicking around the idea of creating a new column just for the purposes of the GUID. I don't really see the what that achieves though, that the PK approach doesn't already offer. As far as I can tell, the big downside to making the PK a randomly generated number is that the index would take a long time to update on each insert (since insertion order would not be sequential). Is that an acceptable approach for a table that is taking this number of writes? Thanks, Ben

    Read the article

  • Remove polyline

    - by Fran Rod
    I have the next code which show a path using a polyline. How can I remove it? downloadUrl("myfile.asp", function(data) { var xml = xmlParse(data); var markers = xml.documentElement.getElementsByTagName("marker"); var path = []; for (var i = 0; i < markers.length; i++) { var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new google.maps.LatLng(lat,lng); path.push(point); }//finish loop var polyline = new google.maps.Polyline({ path: path, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2 }); polyline.setMap(map); }); //end download url I have tried it using the next function but I m not able to make it work. function removePath() { polyline.setMap(null) }

    Read the article

  • Unable to dismiss MFMailComposeViewController, delegate not called

    - by Rod
    HI, I am calling MFMailComposeViewController from UITableViewController. Problem is, delegate method mailComposeController:(MFMailComposeViewController)controllerdidFinishWithResult* is never called when I select Cancel or Send button in Mail compose window. Here is the table view class: @implementation DetailsTableViewController - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section==0 && indexPath.row==4){ //SEND MAIL MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init]; controller.mailComposeDelegate = self; if ([MFMailComposeViewController canSendMail]) { [controller setSubject:[NSString stringWithFormat:@"Ref %@",[item objectForKey:@"reference"]]]; [controller setMessageBody:@" " isHTML:NO]; [controller setToRecipients:[NSArray arrayWithObject:[item objectForKey:@"email"]]]; [self presentModalViewController:controller animated:YES]; } [controller release]; } } - (void)mailComposeController:(MFMailComposeViewController*)controllerdidFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { // NEVER REACHES THIS PLACE [self dismissModalViewControllerAnimated:YES]; NSLog (@"mail finished"); } The application don't crash. After Cancel or Send button is presses Compose Window stays on the screen with buttons disabled. I can exit application pressing Home key. I am able to open other Modal Views form TableView but not MailCompose.

    Read the article

  • help with $(this).val() toUpperCase()

    - by rod
    Hi All, Given: <script type="text/javascript"> $(document).ready(function () { var str = 'Test'; //alert(str.toUpperCase()); $('#stringFinder').keyup(function (e) { alert($(this).val()==str.toUpperCase()); }); }); </script> How do I make $(this).val() all upper case to get a like comparison? Thanks, rodchar

    Read the article

  • asp.net httphandler stay on page

    - by rod
    Hi All, I have an ashx custom handler I goto to view my images. When I come accross an image that's not there I'm trying to throw a JavaScript alert saying the file is not found. But I want it to stay on the page? Is this possible? Insted it just goes to the blank page of the ashx handler. Thanks, Rodney

    Read the article

  • MemoryStream instance timing help

    - by rod
    Hi All, Is it ok to instance a MemoryStream at the top of my method, do a bunch of stuff to it, and then use it? For instance: public static byte[] TestCode() { MemoryStream m = new MemoryStream(); ... ... whole bunch of stuff in between ... ... //finally using(m) { return m.ToArray(); } } Updated code public static byte[] GetSamplePDF() { using (MemoryStream m = new MemoryStream()) { Document document = new Document(); PdfWriter.GetInstance(document, m); document.Open(); PopulateTheDocument(document); document.Close(); return m.ToArray(); } } private static void PopulateTheDocument(Document document) { Table aTable = new Table(2, 2); aTable.AddCell("0.0"); aTable.AddCell("0.1"); aTable.AddCell("1.0"); aTable.AddCell("1.1"); document.Add(aTable); for (int i = 0; i < 20; i++) { document.Add(new Phrase("Hello World, Hello Sun, Hello Moon, Hello Stars, Hello Sea, Hello Land, Hello People. ")); } } My point was to try to reuse building the byte code. In other words, build up any kind of document and then send it to TestCode() method.

    Read the article

  • dynamic tag count on keyup

    - by rod
    Hi All, I have a div that contains many spans and each of those spans contains a single href. Basically it's a tag cloud. I have a textbox with a keyup event that filters the tag cloud div (It actually just hides the tags if not in filter condition). Is there a way to get a count of the tags shown as the keyup event occurs? Thanks, rodchar

    Read the article

  • tsql source control help please

    - by rod
    Hi All, According to the following section of BOL: How to: Use Source Control with SQL Server Management Studio If you have a source control client installed you should be able to choose it in the plug-in selection. I have both source control clients for Visual Studio 2005 and 2008 (tfs2005) installed and there's no plug-in to choose in the list for me.

    Read the article

  • Rails 3 Routing help

    - by Rod Nelson
    OK i'm new to rails 3 and the new routing is driving me mad. I just a good example i was looking at the info on http://rizwanreza.com/2009/12/20/revamped-routes-in-rails-3 but it don't make sense to me. i need an example please! I have my root down that's not hard. I have Site as my controller and i have index help and about then i have a second controller users with index and register on the register page i have 3 text boxes and a submit when i hit submit i get Routing Error No route matches "/user/register" if you need me to i will post my routes file

    Read the article

  • Difference between User Control and Custom Control Library

    - by Rod
    I'm working on creating a date/time user control in WPF using C# 2008. My first user control. I'm also using Matthew MacDonald's book, "Pro WPF in C# 2008". In that book he strongly recommended creating a user control using the WPF Custom Control Library project template; so I followed his suggestion. I've finished writing the code which would go into what I think of as the code-behind file. Now I'm ready to write the XAML. The only problem is, I just discovered there is no corresponding .xaml file? So, I don't get why using a WPF Custom Control Library project is better, or prefered, when writing a user control?

    Read the article

  • tag cloud filter help please

    - by rod
    Hi All, I have a div that contains many spans and each of those spans contains a single href. Basically it's a tag cloud. What I'd like to do is have a textbox that filters the tag cloud on KeyUp event. Any ideas or is this possible? Thanks, rodchar

    Read the article

  • Trying to condense javascript into for loop

    - by rod
    I've got the following code that I am trying to condense to a for loop but am having no luck: $("#motion1-sub1-1").hover( function () { $("#motion1-sub1-1 div").show(); }, function () { $("#motion1-sub1-1 div").hide(); } ); $("#motion1-sub1-2").hover( function () { $("#motion1-sub1-2 div").show(); }, function () { $("#motion1-sub1-2 div").hide(); } ); $("#motion1-sub1-3").hover( function () { $("#motion1-sub1-3 div").show(); }, function () { $("#motion1-sub1-3 div").hide(); } ); $("#motion1-sub1-4").hover( function () { $("#motion1-sub1-4 div").show(); }, function () { $("#motion1-sub1-4 div").hide(); } ); $("#motion1-sub1-5").hover( function () { $("#motion1-sub1-5 div").show(); }, function () { $("#motion1-sub1-5 div").hide(); } ); Here's the for loop code that have to condense the above code: for (var i = 1; i <= 5; i++) { $("motion1-sub1-" + i).hover( function () { $("motion1-sub1-" + i + "div").show(); }, function () { $("motion1-sub1-" + i + "div").hide(); } ); }

    Read the article

  • rewards the products qualify for

    - by Rod
    products purchased -------------------------- bana bana bana stra kiwi reward requirements table (related to a rewards table) reward id, products ---------------------- 1,bana 1,bana 1,bana 2,stra 2,bana 3,stra 4,cart 5,bana 5,bana 5,oliv Can you help me with sql to get rewards the products purchased qualifies for? In the case above the reward ids would be: 1 2 3 If there is a better design that would make the solution easier I welcome those as well. I'm using product names for the sake of easier explaining, I hope. (I'll replace with product ids later)

    Read the article

  • 2 ajax forms on the same page posting same textbox

    - by rod
    Hi All, Is it possible to post, say like a value in a textbox, to 2 different ajax forms that are on the same page? It doesn't have to be at the same time? What I'm trying to do is this: I have a search page that searches for customers and displays them on a paged grid. Users can specify up to 5 parameters (5 textboxes) to narrow the search. On the same page I have an export option. Well since I want all the customers for the search and not just the paged data I need a way to post back to the server for this option passing the same parameters used in the grid. I'm using a ViewModel which would be nice if I can pass that back to the server rather than the individual search fields that are backed by the view model. Thanks, rodchar

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >