Search Results

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

Page 32/164 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • How to "escape" the JavaScript class keyword to specify a CSS class value.

    - by Robert Claypool
    C# allows a reserved word to be used as a property name via the ampersand. e.g. // In ASP.NET MVC, we use @class to define // the css class attribute for some HtmlHelper methods. var htmlObject = new { readonly = "readonly", @class = "ui-state-highlight" } I want to do the same in JavaScript. e.g. function makeGrid(grid, pager) { grid.jqGrid({ caption: 'Configurations', colNames: ['Id', 'Name'], colModel: [ { name: 'Id', index: 'Id' }, { name: 'Name', index: 'Name', editable: true, editoptions: { readonly: 'readonly', class: 'FormElement readonly' } }, ], pager: pager, url: 'www.example.com/app/configurations") %>', editurl: 'www.example.com/app/configurations/edit") %>' }).navGrid(pager, { edit: true, add: false, del: false, search: false }, {}, {}, {}); } Note class: 'FormElement readonly' is supposed to set the css class value on jqGrid's edit dialog, but IE errors out on the reserved word. Is there an escape character in JavaScript too? #class? @class? &class? Otherwise, how might I tell jqGrid to set the css class on the popup editor? Thank you.

    Read the article

  • Invoke an Overloaded Constructor through this keyword (What's the Different between this two Sample code?)

    - by Alireza Dehqani
    using System; namespace ConsoleApplication1 { class Program { static void Main() { // Sample Sample ob = new Sample(); // line1 // Output for line1 /* * Sample(int i) * Sample() / // Sample2 Sample2 ob2 = new Sample2(); // line2 // Output for line2 / * Sample2() */ } } class Sample { // Fields private int a; // Constructors public Sample(int i) // Main Constructor { Console.WriteLine(" Sample(int i)"); a = i; } // Default Constructor public Sample() : this(0) { Console.WriteLine(" Sample()"); } } class Sample2 { // fields private int a; // Constructors public Sample2(int i) { Console.WriteLine("Sample2(int i)"); a = i; } public Sample2() { Console.WriteLine("Sample2()"); a = 0; } } }

    Read the article

  • iphone facebook friend status.

    - by Syed Faraz Haider Zaidi
    NSMutableDictionary * params = [[NSMutableDictionary alloc] init]; [params setValue:@"100000********" forKey:@"uid"]; [params setValue:@"1500" forKey:@"limit"]; [params setValue:@"results" forKey:@"callback"]; when im using this coding im getting my friend status... but when im using a dynamic value like this : [params setValue:[NSString stringWithFormat:@"%@", a] forKey:@"uid"]; im getting this error The operation couldn’t be completed. (facebookErrDomain error 10000.) looking forward for your help guys....

    Read the article

  • Update User Info with restful_authentication plugin in Rails?

    - by benoror
    Hi people, I want to give the users the ability to change their account info with restful_authentication plugin in rails. I added this two methods to my users controller: def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) # Only update password when necessary params[:user].delete(:password) if pàrams[:user][:password].blank? respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end Also, I copied new.html.erb to edit.html.erb. Considering that resources are already defined in routes.rb I was expecting it to work easily, bute somehow when I click the save button it calls the create method, instead of update, using a POST http request. Inmediatly after that it autocatically log out form the session. Any ideas?

    Read the article

  • Is there a way to implement Caliburn-like co-routines in VB.NET since there's no yield keyword

    - by Miroslav Popovic
    Note that I'm aware of other yield in vb.net questions here on SO. I'm playing around with Caliburn lately. Bunch of great stuff there, including co-routines implementation. Most of the work I'm doing is C# based, but now I'm also creating an architecture guideline for a VB.NET only shop, based on Rob's small MVVM framework. Everything looks very well except using co-routines from VB. Since VB 10 is used, we can try something like Bill McCarthy's suggestion: Public Function Lines(ByVal rdr as TextReader) As IEnumerable(Of String) Return New GenericIterator(Of String) (Function(ByRef nextItem As String) As Boolean nextItem = rdr.ReadLine Return nextItem IsNot Nothing End Function) End Function I'm just failing to comprehend how a little more complex co-routine method like the one below (taken from Rob's GameLibrary) could be written in VB: public IEnumerable<IResult> ExecuteSearch() { var search = new SearchGames { SearchText = SearchText }.AsResult(); yield return Show.Busy(); yield return search; var resultCount = search.Response.Count(); if (resultCount == 0) SearchResults = _noResults.WithTitle(SearchText); else if (resultCount == 1 && search.Response.First().Title == SearchText) { var getGame = new GetGame { Id = search.Response.First().Id }.AsResult(); yield return getGame; yield return Show.Screen<ExploreGameViewModel>() .Configured(x => x.WithGame(getGame.Response)); } else SearchResults = _results.With(search.Response); yield return Show.NotBusy(); } Any idea how to achieve that, or any thoughts on using Caliburn co-routines in VB?

    Read the article

  • Cannot have a qualifier in the select list while performing a JOIN w/ USING keyword.

    - by JuiceBerry123
    I am looking at a practice test that doesn't have explanations about the correct answers. The question I'm confused about basically asks why the following SQL statement can never work: SELECT oi.order_id, product_jd, order_date FROM order_items oi JOIN orders o USING(order_id); The answer it gave was: "The statement would not execute because the column part of the USING clause cannot have a qualifier in the SELECT list" Can someone elaborate on this? I am pretty stumped.

    Read the article

  • Count word occurrences in a text field with LINQ

    - by Yoann. B
    How can i get the occurrences count of a Word in a database text field With LINQ ? Keyword token sample : ASP.NET EDIT 4 : Database Records : Record 1 : [TextField] = "Blah blah blah ASP.NET bli bli bli ASP.NET blu ASP.NET yop yop ASP.NET" Record 2 : [TextField] = "Blah blah blah bli bli bli blu ASP.NET yop yop ASP.NET" Record 3 : [TextField] = "Blah ASP.NET blah ASP.NET blah ASP.NET bli ASP.NET bli bli ASP.NET blu ASP.NET yop yop ASP.NET" So Record 1 Contains 4 occurrence of "ASP.NET" keyword Record 2 Contains 2 occurrence of "ASP.NET" keyword Record 3 Contains 7 occurrence of "ASP.NET" keyword Collection Extraction IList < RecordModel (ordered by word count descending) Record 3 Record 1 Record 2 LinqToSQL should be the best, but LinqToObject too :) NB : No issue about the "." of ASP.NET keyword (this is not the goal if this question)

    Read the article

  • How to update user info with restful_authentication plugin in Rails?

    - by benoror
    Hi people, I want to give the users to change their account info with restful_authentication plugin in rails. I added this two methods to my controller: def edit @user = User.find(params[:id]) end def update @user = User.find(params[:id]) # Only update password when necessary params[:user].delete(:password) if pàrams[:user][:password].blank? respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'User was successfully updated.' format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end Also, I copied new.html.erb to edit.html.erb. Considering that resources are already defined in routes.rb I was expecting it to work easily, bute somehow when I click the save button it calls the create method, instead of update, using a POST http request. Any ideas?

    Read the article

  • Linq To Sql Left outer join - filtering null results

    - by Harry
    I'd like to reproduce the following SQL into C# LinqToSql SELECT TOP(10) Keywords.* FROM Keywords LEFT OUTER JOIN IgnoreWords ON Keywords.WordID = IgnoreWords.ID WHERE (DomainID = 16673) AND (IgnoreWords.Name IS NULL) ORDER BY [Score] DESC The following C# Linq gives the right answer. But I can't help think I'm missing something (a better way of doing it?) var query = (from keyword in context.Keywords join ignore in context.IgnoreWords on keyword.WordID equals ignore.ID into ignored from i in ignored.DefaultIfEmpty() where i == null where keyword.DomainID == ID orderby keyword.Score descending select keyword).Take(10); the SQL produced looks something like this: SELECT TOP (10) [t0].[DomainID], [t0].[WordID], [t0].[Score], [t0].[Count] FROM [dbo].[Keywords] AS [t0] LEFT OUTER JOIN (SELECT 1 AS [test], [t1].[ID] FROM [dbo].[IgnoreWords] AS [t1]) AS [t2] ON [t0].[WordID] = [t2].[ID] WHERE ([t0].[DomainID] = 16673) AND ([t2].[test] IS NULL) ORDER BY [t0].[Score] DESC How can I get rid of this redundant inner selection? It's only slightly more expensive but every bit helps!

    Read the article

  • Search function fails because it refers to the wrong controller action?

    - by Christoffer
    My Sunspot search function (sunspot_rails gem) works just fine in my index view, but when I duplicate it to my show view my search breaks... views/supplierproducts/show.html.erb <%= form_tag supplierproducts_path, :method => :get, :id => "supplierproducts_search" do %> <p> <%= text_field_tag :search, params[:search], placeholder: "Search by SKU, product name & EAN number..." %> </p> <div id="supplierproducts"><%= render 'supplierproducts' %></div> <% end %> assets/javascripts/application.js $(function () { $('#supplierproducts th a').live('click', function () { $.getScript(this.href); return false; } ); $('#supplierproducts_search input').keyup(function () { $.get($("#supplierproducts_search").attr("action"), $("#supplierproducts_search").serialize(), null, 'script'); return false; }); }); views/supplierproducts/show.js.erb $('#supplierproducts').html('<%= escape_javascript(render("supplierproducts")) %>'); views/supplierproducts/_supplierproducts.hmtl.erb <%= hidden_field_tag :direction, params[:direction] %> <%= hidden_field_tag :sort, params[:sort] %> <table class="table table-bordered"> <thead> <tr> <th><%= sortable "sku", "SKU" %></th> <th><%= sortable "name", "Product name" %></th> <th><%= sortable "stock", "Stock" %></th> <th><%= sortable "price", "Price" %></th> <th><%= sortable "ean", "EAN number" %></th> </tr> </thead> <% for supplierproduct in @supplier.supplierproducts %> <tbody> <tr> <td><%= supplierproduct.sku %></td> <td><%= supplierproduct.name %></td> <td><%= supplierproduct.stock %></td> <td><%= supplierproduct.price %></td> <td><%= supplierproduct.ean %></td> </tr> </tbody> <% end %> </table> controllers/supplierproducts_controller.rb class SupplierproductsController < ApplicationController helper_method :sort_column, :sort_direction def show @supplier = Supplier.find(params[:id]) @search = @supplier.supplierproducts.search do fulltext params[:search] end @supplierproducts = @search.results end end private def sort_column Supplierproduct.column_names.include?(params[:sort]) ? params[:sort] : "name" end def sort_direction %w[asc desc].include?(params[:direction]) ? params[:direction] : "asc" end models/supplierproduct.rb class Supplierproduct < ActiveRecord::Base attr_accessible :ean, :name, :price, :sku, :stock, :supplier_id belongs_to :supplier validates :supplier_id, presence: true searchable do text :ean, :name, :sku end end Visiting show.html.erb works just fine. Log shows: Started GET "/supplierproducts/2" for 127.0.0.1 at 2012-06-24 13:44:52 +0200 Processing by SupplierproductsController#show as HTML Parameters: {"id"=>"2"} Supplier Load (0.1ms) SELECT "suppliers".* FROM "suppliers" WHERE "suppliers"."id" = ? LIMIT 1 [["id", "2"]] SOLR Request (252.9ms) [ path=#<RSolr::Client:0x007fa5880b8e68> parameters={data: fq=type%3ASupplierproduct&start=0&rows=30&q=%2A%3A%2A, method: post, params: {:wt=>:ruby}, query: wt=ruby, headers: {"Content-Type"=>"application/x-www-form-urlencoded; charset=UTF-8"}, path: select, uri: http://localhost:8982/solr/select?wt=ruby, open_timeout: , read_timeout: } ] Supplierproduct Load (0.2ms) SELECT "supplierproducts".* FROM "supplierproducts" WHERE "supplierproducts"."id" IN (1) Supplierproduct Load (0.1ms) SELECT "supplierproducts".* FROM "supplierproducts" WHERE "supplierproducts"."supplier_id" = 2 Rendered supplierproducts/_supplierproducts.html.erb (2.2ms) Rendered supplierproducts/show.html.erb within layouts/application (3.3ms) Rendered layouts/_shim.html.erb (0.0ms) User Load (0.1ms) SELECT "users".* FROM "users" WHERE "users"."remember_token" = 'zMrtTbDun2MjMHRApSthCQ' LIMIT 1 Rendered layouts/_header.html.erb (2.1ms) Rendered layouts/_footer.html.erb (0.2ms) Completed 200 OK in 278ms (Views: 20.6ms | ActiveRecord: 0.6ms | Solr: 252.9ms) But it breaks when I type in a search. Log shows: Started GET "/supplierproducts?utf8=%E2%9C%93&search=a&direction=&sort=&_=1340538830635" for 127.0.0.1 at 2012-06-24 13:53:50 +0200 Processing by SupplierproductsController#index as JS Parameters: {"utf8"=>"?", "search"=>"a", "direction"=>"", "sort"=>"", "_"=>"1340538830635"} Rendered supplierproducts/_supplierproducts.html.erb (2.4ms) Rendered supplierproducts/index.js.erb (2.9ms) Completed 500 Internal Server Error in 6ms ActionView::Template::Error (undefined method `supplierproducts' for nil:NilClass): 10: <th><%= sortable "ean", "EAN number" %></th> 11: </tr> 12: </thead> 13: <% for supplierproduct in @supplier.supplierproducts %> 14: <tbody> 15: <tr> 16: <td><%= supplierproduct.sku %></td> app/views/supplierproducts/_supplierproducts.html.erb:13:in `_app_views_supplierproducts__supplierproducts_html_erb___2251600857885474606_70174444831200' app/views/supplierproducts/index.js.erb:1:in `_app_views_supplierproducts_index_js_erb___1613906916161905600_70174464073480' Rendered /Users/Computer/.rvm/gems/ruby-1.9.3-p194@myapp/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (33.3ms) Rendered /Users/Computer/.rvm/gems/ruby-1.9.3-p194@myapp/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.9ms) Rendered /Users/Computer/.rvm/gems/ruby-1.9.3-p194@myapp/gems/actionpack-3.2.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (39.7ms)

    Read the article

  • How do I use a string as a keyword argument?

    - by Issac Kelly
    Specifically, I'm trying to use a string to arbitrairly filter the ORM. I've tried exec and eval solutions, but I'm running into walls. The code below doesn't work, but it's the best way I know how to explain where I'm trying to go from gblocks.models import Image f = 'image__endswith="jpg"' # Would be scripted in another area, but passed as text <user input> d = Image.objects.filter(f) #for the non-django pythonistas: d = Image.objects.filter(image__endswith="jpg") # would be the non-dynamic equivalent.

    Read the article

  • is this a simple monad example?

    - by zcaudate
    This is my attempt to grok monadic functions after watching http://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads. h uses bind to compose together two arbitrary functions f and g. What is the unit operator in this case? ;; f :: int - [str] ;; g :: str = [keyword] ;; bind :: [str] - (str - [keyword]) - [keyword] ;; h :: int - [keyword] (defn f [v] (map str (range v))) (defn g [s] (map keyword (repeat 4 s))) (defn bind [l f] (flatten (map f l))) (f 8) ;; = (0 1 2 3 4 5 6 7) (g "s") ;; = (:s :s :s :s) (defn h [v] (bind (f v) g)) (h 9) ;; = (:0 :0 :0 :0 :1 :1 :1 :1 :2 :2 :2 :2 :3 :3 :3 :3 :4 :4 :4 :4 :5 :5 :5 :5)

    Read the article

  • Has Google introduced a system that allows multiple "keyword-only" domains per site?

    - by tags2k
    I've been told by a client that "a friend" told them that as of January 2010, Google allows multiple domain names that have keywords in them to be associated with a single site. To be honest this sounds rather April-foolish but I'm not sure when his "friend" told him so for the time being I have to take it at face value. I've heard nothing of this and have searched for such a thing this morning, to find nothing but warnings against this practice. Said client seems keen on buying up lots of domains today, so before he insists upon it I just want to be absolutely sure - has Google silently introduced such an allowance, or is there something else they introduced earlier this year that he could be getting confused with? Thanks for any light you can shine on this!

    Read the article

  • How to use LINQ to SQL to create ranked search results?

    - by quakkels
    I am looking for a way to use l2s to return ranked result based on keywords. I would like to take a keyword and be able to search the table for that keyword using .contains(). The trick that I haven't been able to figure out is how to get a count of how many times that keyqord appears, and then .OrderByDescending() based on that count. So if i had some thing like: string keyword = "SomeKeyword"; IQueryable<Article> searchResults = from a in GenesisRepository.Article where a.Body.Contains(keyword) select a; What is the best way to order searchResults based on the number of times keyword appears in a.Body? Thanks for any help.

    Read the article

  • How to iterate into a string for a word after a fixed keyword? [closed]

    - by Parth
    Possible Duplicate: I need to iterate a loop to every time find the string appearing after a particular string say “if(OLD.”, then which PHP function will be helpful for me? This is the string BEGIN IF (NEW.name != OLD.name) THEN INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.name, newvalue = NEW.name, field = "name"; END IF; IF (NEW.alias != OLD.alias) THEN INSERT INTO jos_menuaudit set menuid=OLD.id, oldvalue = OLD.alias, newvalue = NEW.alias, field = "alias"; END IF; END in which I am searching the particular word after " IF (NEW.", and after that particular others strings should not be displayed, hence whenever in a loop it finds " IF (NEW." I must get a word just next to it. And in this way an array should be ready for to use.

    Read the article

  • Accessing properties through Generic type parameter

    - by Veer
    I'm trying to create a generic repository for my models. Currently i've 3 different models which have no relationship between them. (Contacts, Notes, Reminders). class Repository<T> where T:class { public IQueryable<T> SearchExact(string keyword) { //Is there a way i can make the below line generic //return db.ContactModels.Where(i => i.Name == keyword) //I also tried db.GetTable<T>().Where(i => i.Name == keyword) //But the variable i doesn't have the Name property since it would know it only in the runtime //db also has a method ITable GetTable(Type modelType) but don't think if that would help me } } In MainViewModel, I call the Search method like this: Repository<ContactModel> _contactRepository = new Repository<ContactModel>(); public void Search(string keyword) { var filteredList = _contactRepository.SearchExact(keyword).ToList(); } I use Linq-To-Sql.

    Read the article

  • Is `eval`ing in a CPAN module without localizing $@ a bug?

    - by rassie
    I think I've encountered a bug in Params::Validate, but I'm not sure whether I identified the problematic code piece correctly. The code in question failed to pass exceptions up the chain (using Try::Tiny), so I started debugging and found out that a class used inside the try block has a destructor. This destructor calls object methods which use Params::Validate and looking into Validate.pm source I see an eval without $@ localization, i.e. the global $@ gets overwritten. Now I see two options: Params::Validate should always localize $@ and thus it's a bug that should be reported. The bug is in the class in question, because it shouldn't use Params::Validate in a destructor. Params::Validate can stay as it is now. Which one is it? How I should I handle this situation? PS: I think that CPAN modules should be rock-solid and neither break themselves nor their environment, hence the question title.

    Read the article

  • I am validating for RegEx errors -- how can I return which keyword, it failed on?

    - by Trip
    I'm passing new objects through this set of regex : (?i)exp\s|(?i)expire\s|(?i)print|(?i)mention|(?i)spring|(?i)summer|(?i)winter|(?i)jan(\s|\.)|(?i)january|(?i)february|(?i)feb(\.|\s)|(?i)march|mar(\.|\s)|(?i)april|(?i)june|(?i)july|(?i)august|(?i)aug(\s|\.)|(?i)september|(?i)sept(\.|\s)|(?i)november|(?i)nov(\.|\s)|(?i)december|(?i)dec(\.|\s)|(?i)holiday|(?i)christmas|(?i)holloween|(?i)easter|(?i)season|(?i)ends|(?i)end If it errors, for example on the word christmas , how can I dynamically pull the word it errors on, and display it as the cause of the error?

    Read the article

  • C++ Virtual keyword as away to avoid including code units.

    - by user394663
    Currently we have a body of code that allows service plugins which offer forms of communication to the core e.g tcp/ip, udp/ip, usb, etc... These service plugins feedback notifier class instances to the core for further processing. In the current implementation a service project (which is a separate dynamically linked library brought in at runtime by the core via dlopen and friends) will compile against the notifier.cpp file that resides in the core source code (a separate project). This gives access to the notifiers method implementations. This works perfectly no complaints. Two alternative options: 1. put the notifier method implementations in the header file. 2. declare the notifier methods virtual and delay binding until runtime. Avoiding the issues of computational overhead what are the impacts of option 2? Are there any other options available to us? Thanks

    Read the article

  • Is the 'var' keyword bad? Or am I just old school?

    - by WaggingSiberian
    Recently I overheard junior developer ask "why do you use 'var' so much?". The mid-level developer responded "I use VAR all the time. I love it! I don't have to figure out the type." I didn't have the time or energy to get into a religious war and hey, I'm still the new guy here :-) I understand var has its place. LINQ comes to mind. But I have also always been told the use of var represents lazy programming and I should just use the correct type to begin with. If it's an int, define it as an int, not a var. When reviewing code, seeing the type makes it easier to follow. My opinion is, it's just lazy but there are exceptions. Var also reminds me of the VB/VBA variant type. It also had its place. I recall (from many years ago) its usage being less-than-desirable type and it was rather resource hungry. Am I just being stuck in my ways? Should we start using var all the time as my co-worker does?

    Read the article

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