Search Results

Search found 4088 results on 164 pages for 'params keyword'.

Page 96/164 | < Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >

  • RoR custom routing/Method/View problem all methods come back as undefined

    - by Jeff
    I am playing with custom view and routes. I think that I have everything right but obviously not. Essentially I tried to copy the show method and show.html.erb but for some reason it will not work. My controller class fatherController < ApplicationController def show @father = Father.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @father } end end def ofmine @father = Father.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @father } end end end My routes.rb Parent::Application.routes.draw do resources :fathers do resources :kids end match 'hospitals/:id/ofmine' => 'father#show2' end when I go to 127.0.0.1:/father/1 it works fine but when I try to go to 127.0.0.1:/father/1/ofmine it gives the following error. It doesn't matter what the variable/method that is called; it occurs at the first one to be displayed. Both show.html.erb and show2.html.erb are the exact same files My Error from webserver commandline > Processing by fathersController#show2 > as HTML Parameters: {"id"=>"1"} > Rendered fathers/show2.html.erb within > layouts/application (31.6ms) Completed > in 37ms > > ActionView::Template::Error (undefined > method `name' for nil:NilClass): > 4: <td>Name</td><td></td> > 5: </tr> > 6: <tr> > 7: <td><%= @father.name %></td><td></td> > 8: </tr> > 9: <tr> > 10: <td>City</td><td>State</td> app/views/fathers/show2.html.erb:7:in > `_app_views_fatherss_show__html_erb___709193087__616989688_0' Error as displayed on actual page NoMethodError in Fathers#show2 Showing /var/ruby/chs/app/views/fathers/show2.html.erb where line #7 raised: undefined method `name' for nil:NilClass Extracted source (around line #7): 4: Name 5: 6: 7: <%= @father.name % 8: 9: 10: CityState If anyone could tell me what in the world I am doing wrong I would appreciate it greatly.

    Read the article

  • C++: Short question regarding switch and break

    - by oh boy
    Example: switch( x ) { case y: if ( true ) { break; } cout << "Oops"; break; } If the switch statement selects y, will Oops be written to the standard output? - Is break in switch statements a dynamic keyword like continue which can be called under conditions or static like a closing bracket }?

    Read the article

  • Unusual RJS error

    - by rrb
    Hi, I am getting the following error in my RoR application: RJS error: TypeError: element is null Element.update("notice", "Comment Posted"); Element.update("allcomments", "\n\n\n \n\n waht now?\n\n \n\n \n\n \n\n asdfasdfa\n \n\n \n\n asdfasdf\n \n\n\n\n\n"); But when I hit the refresh button, I can see my partial updated. Here's my code: show_comments View: <table> <% comments.each do |my_comment| %> <tr> <td><%=h my_comment.comment%></td> </tr> <% end %> </table> show View: <div class="wrapper"> <div class="rescale"> <div class="img-main"> <%= image_tag @deal.photo.url %> </div> </div> <div class="description"> <p class ="description_content"> <%=h @deal.description %> </p> </div> </div> <p> <b>Category:</b> <%=h @deal.category %> </p> <p> <b>Base price:</b> <%=h @deal.base_price %> </p> <%#*<p>%> <%#*<b>Discount:</b>%> <%#=h @deal.discount %> <%#*</p>%> <%= link_to 'Edit', edit_deal_path(@deal) %> | <%= link_to 'Back', deals_path %> <p> <%= render :partial=>'deal_comments', :locals=>{ :comments=>Comment.new(:deal_id=>@deal.id)} %> </p> <div id="allcomments"> <%= render :partial=>'show_comments', :locals=>{ :comments=>Comment.find(@deal.comments)} %> </div> Controller: def create @comment = Comment.new(params[:comment]) render :update do |page| if @comment.save page.replace_html 'notice', 'Comment Posted' else page.replace_html 'notice', 'Something went wrong' end page.replace_html 'allcomments', :partial=> 'deals/show_comments', :locals=>{:comments=> @comment.deal.comments} end end def show_comments @deal = Deal.find(params[:deal_id]) render :partial=> "deals/show_comments", :locals=>{:comments=>@deal.comments} end end

    Read the article

  • SVN tags: How not to update/checkout them?

    - by Boldewyn
    In many projects, I check out the complete repository and have then the standard directory structure: project/ branches/ tags/ trunk/ If I do an svn up project, it's all fine with the branches and trunk folders, but, of course, the tags folder is updated, too, and filled with (mostly) lots of tagged versions that are of no value for my work and only occupy disk space. How can I except the tags folder from an svn update? Especially, how can I do this locally only, that is, without committing that back to the repository, as a solution with the svn:ignore keyword would do?

    Read the article

  • So, I have this jquery bit that adds a row to a table the way I need it to, but it's UGLY

    - by dhoss
    I have a table that looks like this: <table name="exercises" id="workout-table"> <tr> <th>Name</th> <th>Reps/Intervals</th> <th>Sets</th> <th>Weight/Distance/Time</th> </tr> [%- i=0 %] [% WHILE i<=10 %] <tr class="workout-rows"> <td><input type="text" name="workout[exercise][[% i %]][name]" /></td> <td><input type="text" name="workout[exercise][[% i %]][repetitions]" size="3"/></td> <td><input type="text" name="workout[exercise][[% i %]][sets]" size="3"/></td> <td><input type="text" name="workout[exercise][[% i %]][weight]" size="4"/></td> </tr> [% i = i + 1 %] [% END %] </table> That template code is Template::Toolkit code that basically just generates an index so I can keep track of elements in what will become an HoAoH from Catalyst::Plugin::Params::Nested. This is the javascript that actually adds the row to the table on button click: $("#add-row").click(function(){ var size = $(".workout-rows").length; //size += 1; var row ='<tr class="workout-rows">' + '<td><input type="text" name="workout[exercise][' + size + '][name]" /></td>' + '<td><input type="text" name="workout[exercise][' + size + '][repetitions]" size="3"/></td>' + '<td><input type="text" name="workout[exercise][' + size + '][sets]" size="3"/></td>' + '<td><input type="text" name="workout[exercise][' + size + '][weight]" size="4"/></td>' + '</tr>'; $("#workout-table >tbody tr:last").after(row) }); I really really don't like the idea of copy-pasting the table row markup into the script itself, as it's repetitive and non-intuitive. I've tried .clone stuff, which works great for copying the row verbatim, but it doesn't keep track of the number of rows dynamically like I need it to. So basically I've pared it down to needing to find out how to mess with the name of each input so that it can reflect the loop index appropriately, so Catalyst::Plugin::Params::Nested will build the correct structure. Thoughts?

    Read the article

  • Asp.net mvc class reference in session

    - by Billy
    Hi, if I put a custom class in session, then in an action method I get an instance of that class from session, and populate some fields, I noticed that when a different controller gets that class from session, those fields are populated. Even though after the first call didn't save the updated class back in session. is this typical behavior for session objects? I thought I had to use keyword 'static' on the class in session for this to happen thanks

    Read the article

  • RETS data fetching problem.

    - by Jimit
    Hello everyone, I am working on one real estate website which is Using RETS service to get the data to my local server. but I have one little bit problem here,I can fetch data from RETS which is having about 3lacks record in RETS Database but I didn't find the way,How can I fetch that all records in bunch of 50k at a time ? I didn't find any 'LIMIT' keyword on RETS.so how can I fetch without 'LIMIT' 50k records at a time? Please help me.

    Read the article

  • Exception from Response.Redirect?

    - by allencoded
    I keep getting an error: A first chance exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code The thread '' (0x27ee4) has exited with code 0 (0x0). I was told it was related to this: protected void Button1_Click(object sender, EventArgs e) { Response.Redirect("Results.aspx?Keywords=" + searchString.Text); } I figured it may help to include my complete code. The code above is the only C# code on my first asp page. That code relates to this code on this page. It is also the only C# code I have on my second page. I am simply just trying to pass a keyword from a search form to this block of code: if (Request.QueryString["Keywords"] != null){ string keywords = Request.QueryString["Keywords"]; string myAppID = "HIDDEN"; var xml = XDocument.Load("http://svcs.ebay.com/services/search/FindingService/v1?OPERATION-NAME=findItemsByKeywords&SERVICE-VERSION=1.0.0&SECURITY-APPNAME=" + myAppID + "&RESPONSE-DATA-FORMAT=XML&REST-PAYLOAD&keywords=" + keywords + "&paginationInput.entriesPerPage=5"); XNamespace ns = "http://www.ebay.com/marketplace/search/v1/services"; var titles = from item in xml.Root.Descendants(ns + "title") select new{ title = xml.Descendants(ns + "title").Select (x => x.Value), }; foreach (var item in titles){ Label1.Text += item; } } This block of code calls the keyword value and uses it in an api to perform a search. The code of the xml(api) formats like this: <findItemsByKeywordsResponse xmlns="http://www.ebay.com/marketplace/search/v1/services"> <searchReslut count="5"> <item> <title></title> </item> <item> <title></title> </item> <item> <title></title> </item> Why am I getting this error how do you fix it?

    Read the article

  • Dictionary w/ null key?

    - by Ralph
    Firstly, why doesn't Dictionary<TKey, TValue> support a single null key? Secondly, is there an existing dictionary-like collection that does? I want to store an "empty" or "missing" or "default" System.Type, thought null would work well for this. More specifically, I've written this class: class Switch { private Dictionary<Type, Action<object>> _dict; public Switch(params KeyValuePair<Type, Action<object>>[] cases) { _dict = new Dictionary<Type, Action<object>>(cases.Length); foreach (var entry in cases) _dict.Add(entry.Key, entry.Value); } public void Execute(object obj) { var type = obj.GetType(); if (_dict.ContainsKey(type)) _dict[type](obj); } public static void Execute(object obj, params KeyValuePair<Type, Action<object>>[] cases) { var type = obj.GetType(); foreach (var entry in cases) { if (entry.Key == null || type.IsAssignableFrom(entry.Key)) { entry.Value(obj); break; } } } public static KeyValuePair<Type, Action<object>> Case<T>(Action action) { return new KeyValuePair<Type, Action<object>>(typeof(T), x => action()); } public static KeyValuePair<Type, Action<object>> Case<T>(Action<T> action) { return new KeyValuePair<Type, Action<object>>(typeof(T), x => action((T)x)); } public static KeyValuePair<Type, Action<object>> Default(Action action) { return new KeyValuePair<Type, Action<object>>(null, x => action()); } } For switching on types. There are two ways to use it: Statically. Just call Switch.Execute(yourObject, Switch.Case<YourType>(x => x.Action())) Precompiled. Create a switch, and then use it later with switchInstance.Execute(yourObject) Works great except when you try to add a default case to the "precompiled" version (null argument exception).

    Read the article

  • Database model for storing expressions and their occurrence in text

    - by lisak
    Hey, I'm doing a statistical research application. I need to store words according to 2 initial letters which is 676 combinations and each word has its number of occurrences (minimal, maximal, average) in text. I'm not sure how the model/schema should look like. There will be a lot of checking whether the keyword was already persisted. I appreciate your suggestions. Edit: I'll be using either mysql or postgresql + spring templates

    Read the article

  • How to combine these three sql queries into one?

    - by lam3r4370
    How to combine these two sql queries into one? SELECT DISTINCT * FROM rss WHERE MATCH(content,title) AGAINST ('$filter') SELECT COUNT(content) FROM rss WHERE MATCH(content,title) AGAINST ('$filters') And if the result is 0 from the above query - SELECT DISTINCT * FROM rss WHERE content LIKE '%$filters%' OR title LIKE '%$filters%'; $filter .= $row['filter']; $filters = $row['filter']; $filters may be more than one keyword

    Read the article

  • Format String become 0001, 0010 etc

    - by trycatch4j
    Hi all.., I have number : 1, 2, 3, 4, 10 But I wanna print that number 0001 0002 0003 0004 0010 I have search in google, the keyword is number format. but I've got nothing, I just get, frmat decimal such ass 1,000,000.00. hope you can suggest me a reference or give me some problem solving. Thanks,

    Read the article

  • dismissing uiwebview

    - by chimgrrl
    Ok, I really spend 2 days on this and it has gotten me stumped. From my main UIViewController I called a WebViewController which is a UIViewController with a UIWebView inside: UOLCategoriesWebViewController *ucwvcontroller = [[UOLCategoriesWebViewController alloc] initWithNibName:@"UOLCategoriesWebViewController" bundle:nil]; [self presentModalViewController:ucwvcontroller animated:YES]; [ucwvcontroller release]; Inside the UOLCategoriesWebViewController I've call the delegate method shouldStartLoadWithRequest where when the user clicks on a particular type of link it parses out the params and return back to the main UIViewController (or at least that's what I want it to do): - (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType { BOOL continueOrExit = YES; NSURL *url = request.URL; NSString *urlString = [url relativeString]; NSString *urlParams = [url query]; NSArray *urlParamArr = [urlParams componentsSeparatedByString:@"&"]; NSLog(@"the url is: %@",urlString); //NSLog(@"the params are: %@,%@",[urlParamArr objectAtIndex:0],[urlParamArr objectAtIndex:1]); //BOOL endTrain1 = [[urlParamArr objectAtIndex:1] hasPrefix:@"subCatValue"]; //BOOL endTrain2 = ([urlParamArr objectAtIndex:1 //NSLog(@"Number of elements: %@",[urlParamArr count]); if (navigationType == UIWebViewNavigationTypeLinkClicked) { //NSLog(@"Enter into His glory"); if ([urlString hasSuffix:@"categories_list.php"]) { //NSLog(@"2nd Heaven"); continueOrExit = YES; }else if ([[urlParamArr objectAtIndex:1] hasPrefix:@"subCatValue"]) { continueOrExit = NO; NSLog(@"end of the train"); NSArray *firstParamStringArr = [[urlParamArr objectAtIndex:0] componentsSeparatedByString:@"="]; NSArray *secondParamStringArr = [[urlParamArr objectAtIndex:1] componentsSeparatedByString:@"="]; NSString *catSelected = [firstParamStringArr objectAtIndex:1]; NSString *subCatSelected = [secondParamStringArr objectAtIndex:1]; //go back to native app [self goBackToMain:catSelected andSubCat:subCatSelected]; } } return continueOrExit; } Actually in the above function where I am calling the goBackToMain method I want it to call the delegate method and return to the mainviewcontroller. Unfortunately after executing that goBackToMain method it goes back to this method and continue to return continueOrExit. Is there anyway to make it truly exit without returning anything? I've tried putting in multiple returns to no avail. Or can I in the html page pass some javascript to directly call this method so that I don't have to go through this delegate method? Thanks for the help in advance!

    Read the article

  • Regex to find A and not B on a line

    - by Zach
    I'm looking for a regex to search my python program to find all lines where foo, but not bar, is passed into a method as a keyword argument. I'm playing around with lookahead and lookbehind assertions, but not having much luck. Any help? Thanks

    Read the article

  • PHP alias @ function

    - by SyaZ
    I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping(). What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.

    Read the article

< Previous Page | 92 93 94 95 96 97 98 99 100 101 102 103  | Next Page >