Search Results

Search found 2536 results on 102 pages for 'nested'.

Page 30/102 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • Nested loops through recursion with usable iterators

    - by narandzasto
    Help! I need to generate a query with loops,but there must be undefinitly numbers of loop or much as many a client wants. I know that it can be done with recursion,but don't know exectly how.One more thing. Notice,please,that I need to use those k,i,j iterators later in "if" condition and I don't know how to catch them. Thanks class Class1 { public void ListQuery() { for (int k = 0; k < listbox1.Count; k++) { for (int i = 0; i < listbox2.Count; i++) { for (int j = 0; j < listbox3.Count; j++) { if (k == listbox1.count-1 && i == listbox2.count-1 && j == listbox3.count-1) { if (!checkbox1) Query += resultset.element1 + "=" + listbox1[k]; if (!checkbox2) Query += resultset.element2 + "=" + listbox1[i]; if (!checkbox3) Query += resultset.element3 + "=" + listbox1[j]; } } } } } }

    Read the article

  • Django nested formsets

    - by dragoon
    Hi, I have an edit object view that contains a formset(one or many if this matters), now I want to create a page that can display multiple edit object forms and submit it in a single form. What is the correct way to achieve this task?

    Read the article

  • spring mvc nested model validation

    - by hguser
    I have two models : User,Project public class Project{ private int id; @NotEmpty(message="Project Name can not be empty") private String name; private User manager; private User operator; //getter/setter omitted } public class User{ private int id; private String name; //omit other properties and getter/setter } Now, when I create a new Project, I will submit the following parameters to ProjectController: projects?name=jhon&manager.id=1&operator.id=2... Then I will create a new Project object and insert it to db. However I have to validate the id of the manager and operator is valid,that's to say I will validate that if there is matched id in the user table. So I want to know how to implement this kind of validation?

    Read the article

  • Keep div:hover open when changing nested select box

    - by JMC Creative
    This is an IE-only problem. .toolTip becomes visible when it's parent element is :hovered over. Inside of .toolTip is a select box. When the user opens the select box to make a selection, the parent element is being "un-hovered", if you will. To put it another way, when I try to select something from the dropdown, the whole thing hides itself again. I'm sure it has something to do with the way IE interprets the stylesheet, but I don't know what or where. Here is some relevant code (edited for clarity): #toolBar .toolTip { position: absolute; display:none; background: #fff; line-height: 1em; font-size: .8em; min-width: 300px; bottom: 47px; left: -5px; padding: 0 ; } #toolBar div:hover .toolTip { display:block; } and <div id="toolBar"> <div class="socialIcon"> <a href=""><img src="/im/social/nytimes.png" alt="NY Times Bestsellers" /></a> <span class="toolTip"> <h1>NY Times Bestsellers Lists</h1> <div id="nyTimesBestsellers"> <?php include('/ny-times-bestseller-feed.php') ?> </div> <p><img src="/im/social/nytimes.png" alt="NY Times Bestseller Lists" /> Change List <select id="nyTimesChangeCurrentList" name="nyTimesChangeCurrentList"> <option value="hardcover-fiction">Hardcover Fiction</option> <option value="hardcover-nonfiction">Hardcover Nonfiction</option> <option value="hardcover-advice">Hardcover Advice</option> </select> </p> </span> </div> </div>

    Read the article

  • jQuery class selectors with nested div's

    - by mboles57
    This is part of some HTML from which I need to retrieve a piece of data. The HTML is assigned to a variable called fullDescription. <p>testing</p> <div class="field field-type-text field-field-video-short-desc"> <div class="field-label">Short Description:&nbsp;</div> <div class="field-items"> <div class="field-item odd"> Demonstrates the basics of using the Content section of App Cloud Studio </div> </div> </div> <div class="field field-type-text field-field-video-id"> <div class="field-label">Video ID:&nbsp;</div> <div class="field-items"> <div class="field-item odd"> 1251462871001 </div> </div> </div> I wish to retrieve the video ID number (1251462871001). I was thinking something like this: var videoID = $(fullDescription).find(".field.field-type-text.field-field-video-id").find(".field-item.odd").html(); Although it does not generate any syntax errors, it does not retrieve the number. Thanks for helping out a jQuery noob! -Matt

    Read the article

  • better way of handling nested list

    - by laspal
    Hi, I have list my_list = [ [1,2,3,4,5,6], [1,3,4],[34,56,56,56]] for item in my_list: var1,var2,var3,var4,var5,var6 = None if len(item) ==1: var1 = item[0] if len(item) == 2: var1 = item[0] var2 = item[1] if len(item) == 3: var1 = item[0] var2 = item[1] var3 = item[2] if len(item) == 4: var1 = item[0] var2 = item[1] var3 = item[2] var4 = item[3] fun(var1,var2,var3,var4,var5,var6) I have a function def fun(var1, var2 = None, var3 = None, var4 = None, var5=None, var6= None) Depending upon the values in my inner list. I am passing it to function. I hope I made it clear. Thanks

    Read the article

  • MVC4 Model in View has nested data - cannot get data in model

    - by Taersious
    I have a Model defined that gets me a View with a list of RadioButtons, per IEnumerable. Within that Model, I want to display a list of checkboxes that will vary based on the item selected. Finally, there will be a Textarea in the same view once the user has selected from the available checkboxes, with some dynamic text there based on the CheckBoxes that are selected. What we should end up with is a Table-per-hierarchy. The layout is such that the RadioButtonList is in the first table cell, the CheckBoxList is in the middle table cell, and the Textarea is ini the right table cell. If anyone can guide me to what my model-view should be to achieve this result, I'll be most pleased... Here are my codes: // // View Model for implementing radio button list public class RadioButtonViewModel { // objects public List<RadioButtonItem> RadioButtonList { get; set; } public string SelectedRadioButton { get; set; } } // // Object for handling each radio button public class RadioButtonItem { // this object public string Name { get; set; } public bool Selected { get; set; } public int ObjectId { get; set; } // columns public virtual IEnumerable<CheckBoxItem> CheckBoxItems { get; set; } } // // Object for handling each checkbox public class CheckBoxViewModel { public List<CheckBoxItem> CheckBoxList { get; set; } } // // Object for handling each check box public class CheckBoxItem { public string Name { get; set; } public bool Selected { get; set; } public int ObjectId { get; set; } public virtual RadioButtonItem RadioButtonItem { get; set; } } and the view @model IEnumerable<EF_Utility.Models.RadioButtonItem> @{ ViewBag.Title = "Connect"; ViewBag.Selected = Request["name"] != null ? Request["name"].ToString() : ""; } @using (Html.BeginForm("Objects" , "Home", FormMethod.Post) ){ @Html.ValidationSummary(true) <table> <tbody> <tr> <td style="border: 1px solid grey; vertical-align:top;"> <table> <tbody> <tr> <th style="text-align:left; width: 50px;">Select</th> <th style="text-align:left;">View or Table Name</th> </tr> @{ foreach (EF_Utility.Models.RadioButtonItem item in @Model ) { <tr> <td> @Html.RadioButton("RadioButtonViewModel.SelectedRadioButton", item.Name, ViewBag.Selected == item.Name ? true : item.Selected, new { @onclick = "this.form.action='/Home/Connect?name=" + item.Name + "'; this.form.submit(); " }) </td> <td> @Html.DisplayFor(i => item.Name) </td> </tr> } } </tbody> </table> </td> <td style="border: 1px solid grey; width: 220px; vertical-align:top; @(ViewBag.Selected == "" ? "display:none;" : "")"> <table> <tbody> <tr> <th>Column </th> </tr> <tr> <td><!-- checkboxes will go here --> </td> </tr> </tbody> </table> </td> <td style="border: 1px solid grey; vertical-align:top; @(ViewBag.Selected == "" ? "display:none;" : "")"> <textarea name="output" id="output" rows="24" cols="48"></textarea> </td> </tr> </tbody> </table> } and the relevant controller public ActionResult Connect() { /* TEST SESSION FIRST*/ if( Session["connstr"] == null) return RedirectToAction("Index"); else { ViewBag.Message = ""; ViewBag.ConnectionString = Server.UrlDecode( Session["connstr"].ToString() ); ViewBag.Server = ParseConnectionString( ViewBag.ConnectionString, "Data Source" ); ViewBag.Database = ParseConnectionString( ViewBag.ConnectionString, "Initial Catalog" ); using( var db = new SysDbContext(ViewBag.ConnectionString)) { var objects = db.Set<SqlObject>().ToArray(); var model = objects .Select( o => new RadioButtonItem { Name = o.Name, Selected = false, ObjectId = o.Object_Id, CheckBoxItems = Enumerable.Empty<EF_Utility.Models.CheckBoxItem>() } ) .OrderBy( rb => rb.Name ); return View( model ); } } } What I am missing it seems, is the code in my Connect() method that will bring the data context forward; at that point, it should be fairly straight-forward to set up the Html for the View. EDIT ** So I am going to need to bind the RadioButtonItem to the view with something like the following, except my CheckBoxList will NOT be an empty set. // // POST: /Home/Connect/ [HttpPost] public ActionResult Connect( RadioButtonItem rbl ) { /* TEST SESSION FIRST*/ if ( Session["connstr"] == null ) return RedirectToAction( "Index" ); else { ViewBag.Message = ""; ViewBag.ConnectionString = Server.UrlDecode( Session["connstr"].ToString() ); ViewBag.Server = ParseConnectionString( ViewBag.ConnectionString, "Data Source" ); ViewBag.Database = ParseConnectionString( ViewBag.ConnectionString, "Initial Catalog" ); using ( var db = new SysDbContext( ViewBag.ConnectionString ) ) { var objects = db.Set<SqlObject>().ToArray(); var model = objects .Select( o => new RadioButtonItem { Name = o.Name, Selected = false, ObjectId = o.Object_Id, CheckBoxItems = Enumerable.Empty<EF_Utility.Models.CheckBoxItem>() } ) .OrderBy( rb => rb.Name ); return View( model ); } } }

    Read the article

  • How to hide nested form from jQuery under IE8

    - by pduel
    An html segment with a div containing a form: <div class="hide"> Form header <form action='' method='post'> .... form content here </form> form footer </div> <script type="text/javascript"><!--// $(document).ready(function() { $('.hide').hide(); } //--></script> The jquery should hide the form, but does not do so under IE8. (version 8.0.60001) The form content gets hidden, as does the content within the class='hide' div but outside the form, but the form border continues to show, and retains its size. Does anybody have a workaround for this? jQuery is version 1.4.2 I tried to create a small problem demo in jsfiddle, but that site was not functional in the IE browser.

    Read the article

  • Closure and nested lambdas in C++0x

    - by DanDan
    Using C++0x, how do I capture a variable when I have a lambda within a lambda? For example: std::vector<int> c1; int v = 10; <--- I want to capture this variable std::for_each( c1.begin(), c1.end(), [v](int num) <--- This is fine... { std::vector<int> c2; std::for_each( c2.begin(), c2.end(), [v](int num) <--- error on this line, how do I recapture v? { // Do something }); });

    Read the article

  • Nested Data XML design

    - by esryl
    Looking to nest (to unlimited levels) elements in XML. Like so: <items> <item> <name>Item One</name> <item> <name>Item Two</name> </item> <item> <name>Item Three</name> <item> <name>Item Four</name> </item> <!-- etc... --> </item> </item> </items> However. While browsing for a solution I noticed in the comments of: http://stackoverflow.com/questions/988139/weird-nesting-in-xml while the above is well formed it would not validate against any sinsible DTD. Two things, what is a better way of nesting similar elements, and secondly what would be the design of the DTD. UPDATE: Would prefer to validate against an XML Schema rather than DTD.

    Read the article

  • Maps with a nested vector

    - by wawiti
    For some reason the compiler won't let me retrieve the vector of integers from the map that I've created, I want to be able to overwrite this vector with a new vector. The error the compiler gives me is ridiculous. Thanks for your help!! The compiler didn't like this part of my code: line_num = miss_words[word_1]; Error: [Wawiti@localhost Lab2]$ g++ -g -Wall *.cpp -o lab2 main.cpp: In function ‘int main(int, char**)’: main.cpp:156:49: error: no match for ‘operator=’ in ‘miss_words.std::map<_Key, _Tp, _Compare, _Alloc>::operator[]<std::basic_string<char>, std::vector<int>, std::less<std::basic_string<char> >, std::allocator<std::pair<const std::basic_string<char>, std::vector<int> > > >((*(const key_type*)(& word_1))) = line_num.std::vector<_Tp, _Alloc>::push_back<int, std::allocator<int> >((*(const value_type*)(& line)))’ main.cpp:156:49: note: candidate is: In file included from /usr/lib/gcc/x86_64-redhat->linux/4.7.2/../../../../include/c++/4.7.2vector:70:0, from header.h:19, from main.cpp:15: /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/vector.tcc:161:5: note: std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>] /usr/lib/gcc/x86_64-redhat-linux/4.7.2/../../../../include/c++/4.7.2/bits/vector.tcc:161:5: note: no known conversion for argument 1 from ‘void’ to ‘const std::vector<int>&’ CODE: map<string, vector<int> > miss_words; // Creates a map for misspelled words string word_1; // String for word; string sentence; // To store each line; vector<int> line_num; // To store line numbers ifstream file; // Opens file to be spell checked file.open(argv[2]); int line = 1; while(getline(file, sentence)) // Reads in file sentence by sentence { sentence=remove_punct(sentence); // Removes punctuation from sentence stringstream pars_sentence; // Creates stringstream pars_sentence << sentence; // Places sentence in a stringstream while(pars_sentence >> word_1) // Picks apart sentence word by word { if(dictionary.find(word_1)==dictionary.end()) { line_num = miss_words[word_1]; //Compiler doesn't like this miss_words[word_1] = line_num.push_back(line); } } line++; // Increments line marker }

    Read the article

  • Imploding nested arrays

    - by Alex Zylman
    Hey guys, If I have an array structured like this: $array[index]['first_name'] $array[index]['last_name'] Is there an easy way to implode it into something like first_name last_name,first_name last_name, etc. for all the indices? Implode didn't seem to do what I wanted for something like this. Currently I'm just looping over the whole thing, but it's a SIGNIFICANT bottleneck.

    Read the article

  • Setting synthesized arrays causing memory leaks using nested arrays

    - by webtoad
    Hello: Why is the following code causing a memory leak in an iPhone App? All of the initted objects below leak, including the arrays, the strings and the numbers. So, I'm thinking it has something to do with the the synthesized array property not releasing the object when I set the property again on the second and subsequent time this piece of code is called. Here is the code: "controller" (below) is my custom view controller class, which I have a reference to, and I am setting with this code snippet: sqlite3_stmt *statement; NSMutableArray *foo_IDs = [[NSMutableArray alloc] init]; NSMutableArray *foo_Names = [[NSMutableArray alloc] init]; NSMutableArray *foo_IDsBySection = [[NSMutableArray alloc] init]; NSMutableArray *foo_NamesBySection = [[NSMutableArray alloc] init]; // Get data: NSString *sql = @"select distinct p.foo_ID, p.foo_Name from foo as p "; if (sqlite3_prepare_v2(...) == SQLITE_OK) { while (sqlite3_step(statement) == SQLITE_ROW) { int p_id; NSString *foo_Name; p_id = sqlite3_column_int(statement, 0); char *str2 = (char *)sqlite3_column_text(statement, 1); foo_Name = [NSString stringWithCString:str2]; [foo_IDs addObject:[NSNumber numberWithInt:p_id]]; [foo_Names addObject:foo_Name]; } sqlite3_finalize(statement); } // Pass the array itself into another array: // (normally there is more than one array in each array) [foo_IDsBySection addObject: foo_IDs]; [foo_NamesBySection addObject: foo_Names]; [foo_IDs release]; [foo_Names release]; // Set some synthesized properties (of type NSArray, nonatomic, // retain) in controller: controller.foo_IDsBySection = foo_IDsBySection; controller.foo_NamesBySection = foo_NamesBySection; [foo_IDsBySection release]; [foo_NamesBySection release]; Thanks for any help!

    Read the article

  • Little CSS problem with Auto height and nested div's

    - by GeekDrop.com
    So I'm finally learning my way around CSS more and have run into a small problem. I have a container div, with a few divs inside of it, one of them is a bit if text (which can be a random height) and an image that will have a MAX height of 200px. I am using a dotted/colored background behind them that needs to auto expand to the height of whichever is the tallest, either the text or the image. Right now when i use height:auto on the container div it works perfect for the random height text: Example Screenshot But it's only adjusting according to the text's height; if the image is taller than the text, the image overflows the bottom of the background dotted/colored box. Example Screenshot The CSS I'm using currently is this: h1 div#like_detailed { margin: 0; font-size: 1.1em; width: 700px; } #details-image img { border: none; clear: left; float: right; margin: -45px 0 0 0; max-height: 200px; padding: 0 7px 0 10px; } #deets-container { background-color: #FEF; border: #190AE7 1px dotted; height: auto; margin-top: 0; margin-bottom: 30px; padding-top: 10px; padding-right: 10px; padding-left: 10px; padding-bottom: 0; } And the HTML for it is this: <div id="deets-container" class="rounded"> <!-- Button --> <div class="likebtnframe">(some code)</div> <!-- Button --> <div class="tweetbtnframe">(some code)</div> <!-- Button --> <ul id="share"> <li><a name="share">(some code)</a></li> </ul> <!-- Submitted By --> <div class="submitter_detailed"><span class="submitter-color smalltext">(some code)</span> (some code)</div> <!-- Image --> <div id="**details-image**">(some code)</div> <!-- Like / Quote --> <h1 id="**like_detailed**">(some code)</h1> </div> I have a feeling this is pretty easy but I'm running out of time to sort it out on my own. Anyone?

    Read the article

  • What are nested/unnested package in Scala 2.8?

    - by retronym
    In Scala 2.7, I could write: package com.acme.bar class Bar . package com.acme.foo class Foo { new bar.Bar } This doesn't compile in Scala 2.8 -- however this does: package com.acme package bar class Bar . package com.acme package foo class Foo { new bar.Bar } What was the motivation for this? What is the precise meaning, with regards to scope and visibility? When should I use one form over the other?

    Read the article

  • How to write a large number of nested records in JSON with Python

    - by jamesmcm
    I want to produce a JSON file, containing some initial parameters and then records of data like this: { "measurement" : 15000, "imi" : 0.5, "times" : 30, "recalibrate" : false, { "colorlist" : [234, 431, 134] "speclist" : [0.34, 0.42, 0.45, 0.34, 0.78] } { "colorlist" : [214, 451, 114] "speclist" : [0.44, 0.32, 0.45, 0.37, 0.53] } ... } How can this be achieved using the Python json module? The data records cannot be added by hand as there are very many.

    Read the article

  • using jquery into an ajax nested html file

    - by TrustWeb
    Hello, i am trying to solve this problem: i have a tab interface build with jquery.tools, more exactly i used the ajax tab to load external html files into div. you can see the example here: http://flowplayer.org/tools/demos/tabs/ajax.html i am trying to use jquery to animated the elements loaded by ajax, do you know if and how is it possible? i am trying both loading scripts outside, in the main page, or in the loaded page. thanks a lot

    Read the article

  • How do I get 2-way data binding to work for nested asp.net Repeater controls

    - by jimblanchard
    I have the following (trimmed) markup: <asp:Repeater ID="CostCategoryRepeater" runat="server"> <ItemTemplate> <div class="costCategory"> <asp:Repeater ID="CostRepeater" runat="server" DataSource='<%# Eval("Costs")%>'> <ItemTemplate> <tr class="oddCostRows"> <td class="costItemTextRight"><span><%# Eval("Variance", "{0:c0}")%></span></td> <td class="costItemTextRight"><input id="SupplementAmount" class="costEntryRight" type="text" value='<%# Bind("SupplementAmount")%>' runat="server" /></td> </tr> </ItemTemplate> </asp:Repeater> </div> </ItemTemplate> </asp:Repeater> The outer repeater's DataSource is set in the code-beside. I've snipped them, but there are Eval statements that wire up to the properties in the outer Repeater. Anyway, one of the fields in the inner Repeater needs to be a Bind instead of an Eval, as I want to get the values that the user types in. The SupplementAmount input element correctly receives it's value when the page loads, but on the other side, when I inspect the contents of the Costs List when the form posts back, the changes the user made aren't present. Thanks.

    Read the article

  • Understanding Nested If.. Else statements

    - by user1174762
    For some reason my PHP login script keeps returning "invalid email/password combination", yet i know I am entering the correct email and password. Does anyone see what I might be doing wrong? <?php $email= $_POST['email']; $password= $_POST['password']; if (!empty($email) && !empty($password)) { $connect= mysqli_connect("localhost", "root", "", "si") or die('error connecting with the database'); $query= "SELECT user_id, email, password FROM users WHERE email='$email' AND password='$password'"; $result= mysqli_query($connect, $query) or die('error with query'); if (mysqli_num_rows($result) == 1) { $row= mysqli_fetch_array($result); setcookie('user_id', $row['user_id']); echo "you are now logged in"; } else { echo "invalid username/password combination"; } } else { echo" you must fill out both username and password"; } ?>

    Read the article

  • Nested model form with collection in Rails 2.3

    - by kristian nissen
    How can I make this work in Rails 2.3? class Magazine < ActiveRecord::Base has_many :magazinepages end class Magazinepage < ActiveRecord::Base belongs_to :magazine end and then in the controller: def new @magazine = Magazine.new @magazinepages = @magazine.magazinepages.build end and then the form: <% form_for(@magazine) do |f| %> <%= error_messages_for :magazine %> <%= error_messages_for :magazinepages %> <fieldset> <legend><%= t('new_magazine') %></legend> <p> <%= f.label :title %> <%= f.text_field :title %> </p> <fieldset> <legend><%= t('new_magazine_pages') %> <% f.fields_for :magazinepages do |p| %> <p> <%= p.label :name %> <%= p.text_field :name %> </p> <p> <%= p.file_field :filepath %> </p> <% end %> </fieldset> <p> <%= f.submit :save %> </p> </fieldset> <% end %> problem is, if I want to submit a collection of magazinepages, activerecord complaints because it's expected a model and not an array. create action: def create @magazine = Magazine.new params[:magazine] @magazine.save ? redirect_to(@magazine) : render(:action => 'new') end

    Read the article

  • Jquery nested div .click event

    - by Sylph
    The link #loadContent will loads tree.html. Upon success loading the content, the script reinitialize some functions which is in tree.html. However, I am unable to get the .click event to function in the loaded content. Index.html <a href="#" id="loadContent">Load</a> <script type="text/javascript"> $(function() { $("#loadContent").click(function() { $.ajax({ url: "tree.html" ,success: function(data) { $('#result').html(data); $("#demo_1").tree({ rules : { use_max_children : false, use_max_depth : false }, callback : { onmove : function (NODE,REF_NODE,TYPE,TREE_OBJ,RB) { alert(TREE_OBJ.get_text(NODE) + " " + TYPE + " " + TREE_OBJ.get_text(REF_NODE)); } } }); } }); }); }); </script> <script type="text/javascript" class="source"> $(function () { $.tree.drag_start = function () { $("#log").append("<br />Drag start "); }; $.tree.drag = function () { $("#log").append(" ."); }; $.tree.drag_end = function () { $("#log").append(" Drag end<br />"); }; $("#demo_1").tree({ rules : { use_max_children : false, use_max_depth : false }, callback : { onmove : function (NODE,REF_NODE,TYPE,TREE_OBJ,RB) { alert(TREE_OBJ.get_text(NODE) + " " + TYPE + " " + TREE_OBJ.get_text(REF_NODE)); } } }); $("#demo_2").tree({ rules : { use_max_children : false, use_max_depth : false }, callback : { onmove : function (NODE,REF_NODE,TYPE,TREE_OBJ,RB) { alert(TREE_OBJ.get_text(NODE) + " " + TYPE + " " + TREE_OBJ.get_text(REF_NODE)); } } }); }); </script> <div class="demo" id="demo_2"> <ul> <li id="phtml_1" class="open"><a href="#"><ins>&nbsp;</ins>Root node 1</a> <ul> <li id="phtml_2"><a href="#"><ins>&nbsp;</ins>Child node 1</a></li> <li id="phtml_3"><a href="#"><ins>&nbsp;</ins>Child node 2</a></li> <li id="phtml_4"><a href="#"><ins>&nbsp;</ins>Some other child node with longer text</a></li> </ul> </li> <li id="phtml_5"><a href="#"><ins>&nbsp;</ins>Root node 2</a></li> </ul> </div> <div id="result"></div><br> <div id="log"></div> Tree.html <div class="demo" id="demo_1"> <ul> <li id="phtml_1" class="open"><a href="#"><ins>&nbsp;</ins>Root node 1</a> <ul> <li id="phtml_2"><a href="#"><ins>&nbsp;</ins>Child node 1</a></li> <li id="phtml_3"><a href="#"><ins>&nbsp;</ins>Child node 2</a></li> <li id="phtml_4"><a href="#"><ins>&nbsp;</ins>Some other child node with longer text</a></li> </ul> </li> <li id="phtml_5"><a href="#"><ins>&nbsp;</ins>Root node 2</a></li> <li><a class="preset_text" id="1">model 1</a> </li> <li><a class="preset_text" id="2">model 2</a></li> </ul> </div> <script type="text/javascript"> $(document).ready(function() { $('.preset_text').click(function(){ var target = $(this).attr("id"); alert(target); }); }); </script> In tree.html, I am unable to get the alert(target). However, If I moved this section out from the "div #demo_1" in tree.html, I am able to receive alert(target). <a class="preset_text" id="1">model 1</a> <a class="preset_text" id="2">model 2</a> How can I get to detect the item clicked in the div demo_1 ? Thanks

    Read the article

  • Cannot refer to a template name nested in a template parameter

    - by chila
    I have the following code: template <typename Provider> inline void use() { typedef Provider::Data<int> D; } Where I'm basically trying to use a template class member 'Data' of some 'Provider' class, applied to 'int', but I get the following errors: util.cpp:5: error: expected init-declarator before '<' token util.cpp:5: error: expected `,' or `;' before '<' token I'm using GCC 4.3.3 on a Solaris System.

    Read the article

  • The correct usage of nested #pragma omp for directives

    - by GoldenLee
    The following code runs like a charm before OpenMP parallelization was applied. In fact, the following code was in a state of endless loop! I'm sure that's result from my incorrect use to the OpenMP directives. Would you please show me the correct way? Thank you very much. #pragma omp parallel for for (int nY = nYTop; nY <= nYBottom; nY++) { for (int nX = nXLeft; nX <= nXRight; nX++) { // Use look-up table for performance dLon = theApp.m_LonLatLUT.LonGrid()[nY][nX] + m_FavoriteSVISSRParams.m_dNadirLon; dLat = theApp.m_LonLatLUT.LatGrid()[nY][nX]; // If you don't want to use longitude/latitude look-up table, uncomment the following line //NOMGeoLocate.XYToGEO(dLon, dLat, nX, nY); if (dLon > 180 || dLat > 180) { continue; } if (Navigation.GeoToXY(dX, dY, dLon, dLat, 0) > 0) { continue; } // Skip void data scanline dY = dY - nScanlineOffset; // Compute coefficients as well as its four neighboring points' values nX1 = int(dX); nX2 = nX1 + 1; nY1 = int(dY); nY2 = nY1 + 1; dCx = dX - nX1; dCy = dY - nY1; dP1 = pIRChannelData->operator [](nY1)[nX1]; dP2 = pIRChannelData->operator [](nY1)[nX2]; dP3 = pIRChannelData->operator [](nY2)[nX1]; dP4 = pIRChannelData->operator [](nY2)[nX2]; // Bilinear interpolation usNomDataBlock[nY][nX] = (unsigned short)BilinearInterpolation(dCx, dCy, dP1, dP2, dP3, dP4); } }

    Read the article

  • Rails 3 Nested Forms

    - by Mike
    I have a Person model and an Address Model: class Person < ActiveRecord::Base has_one :address accepts_nested_attributes_for :address end class Address < ActiveRecord::Base belongs_to :person end In my people controller I have @person.build_address in my new action. My forms builds correctly. The problem is that when I submit the form, a person record and an address record is created but they aren't linked via the address_id column in the Person table. Am I missing a step in the controller? Thanks! New Action UPDATE def new @person = Person.new @person.build_address respond_to do |format| format.html # new.html.erb format.xml { render :xml => @person } end end Form Code UPDATE <%= form_for(@person) do |f| %> <% if @person.errors.any? %> <div id="error_explanation"> <h2><%= pluralize(@person.errors.count, "error") %> prohibited this person from being saved:</h2> <ul> <% @person.errors.full_messages.each do |msg| %> <li><%= msg %></li> <% end %> </ul> </div> <% end %> <div class="field"> <%= f.label :first_name %><br /> <%= f.text_field :first_name %> </div> <div class="field"> <%= f.label :last_name %><br /> <%= f.text_field :last_name %> </div> <div class="field"> <%= f.label :email %><br /> <%= f.text_field :email %> </div> <div class="field"> <%= f.label :telephone %><br /> <%= f.text_field :telephone %> </div> <div class="field"> <%= f.label :mobile_phone %><br /> <%= f.text_field :mobile_phone %> </div> <div class="field"> <%= f.label :date_of_birth %><br /> <%= f.date_select :date_of_birth %> </div> <div class="field"> <%= f.label :gender %><br /> <%= f.select(:gender, Person::GENDER_TYPES) %> </div> <div class="field"> <%= f.label :notes %><br /> <%= f.text_area :notes %> </div> <div class="field"> <%= f.label :person_type %><br /> <%= f.select(:person_type, Person::PERSON_TYPES) %> </div> <%= f.fields_for :address do |address_fields| %> <div class="field"> <%= address_fields.label :street_1 %><br /> <%= address_fields.text_field :street_1 %> </div> <div class="field"> <%= address_fields.label :street_2 %><br /> <%= address_fields.text_field :street_2 %> </div> <div class="field"> <%= address_fields.label :city %><br /> <%= address_fields.text_field :city %> </div> <div class="field"> <%= address_fields.label :state %><br /> <%= address_fields.select(:state, Address::STATES) %> </div> <div class="field"> <%= address_fields.label :zip_code %><br /> <%= address_fields.text_field :zip_code %> </div> <% end %> <div class="actions"> <%= f.submit %> </div> <% end %>

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >