Search Results

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

Page 18/164 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • ruby keyword arguments of method

    - by Yang
    How can I declare a method with keyword arguments just like rails do. some examples may be Person.find(:all, :conditions => "..."). How can I use symbols to create methods similar to the above? I am very new to ruby. Thanks in advance!

    Read the article

  • VB.NET Use With keyword on existing object?

    - by ropstah
    Is it somehow possible to use the 'With' keyword on an existing object? I would like to do the following using LINQ to objects and can't seem to find a way: From m as Product in Me _ Select m With {.Match = m.Name.IndexOf(query)} _ Where m.Name.IndexOf(query) > 0

    Read the article

  • Movable Type: Specify only one keyword from MTEntryKeywords

    - by kohei
    Hi, I have several keywords (1~3 words) stored in <MTEntryKeywords> field separated by commas. I want to take out the first keyword from MTEntryKeywords. Example 1: In the Keywords field I have entered: gadgets,phone,apple, Want to display: gadgets Example 2: In the Keywords field I have entered: food,coffee,apple, Want to display: food Any ideas?

    Read the article

  • Incorrect syntax near the keyword 'select' while execuing query

    - by sam
    I am getting Incorrect syntax near the keyword 'select' after executing the following code. declare @c int SELECT @c = COUNT(*) FROM (select id, max(date_stored) from table B INNER JOIN table P ON B.id = P.id where id = 3) select @c I want to select total no of records having max stored dates in database. Can any one plz tell what I am doing wrong

    Read the article

  • Use the keyword class as a variable name in C++

    - by Leif Andersen
    I am having trouble writing C++ code that uses a header file designed for a C file. In particular, the header file used a variable name called class: int BPY_class_validate(const char *class_type, PyObject *class, PyObject *base_class, BPY_class_attr_check* class_attrs, PyObject **py_class_attrs); This works in C as class isn't taken as a keyword, but in C++, class is. So is there anyway I can #include this header file into a c++ file, or am I out of luck? Thank you.

    Read the article

  • dbExpress error in Delphi 2010

    - by JosephStyons
    The below code works in Delphi 2007, but it gives me this error in Delphi 2010: --------------------------- Error --------------------------- Cannot load oci.dll library (error code 127). The oci.dll library may be missing from the system path or you may have an incompatible version of the library installed. --------------------------- OK Details >> --------------------------- The exception is raised when I set "connected" to "true". I have tried placing a copy of "oci.dll" in the same folder as the .exe file, but I get the same message. I also get this message when using the form designer and a visible TSQLConnection component. Any thoughts? function TDBExpressConnector.GetConnection(username, password, servername: string) : TSQLConnection; begin //take a username, password, and server //return a connected TSQLConnection try FSqlDB := TSQLConnection.Create(nil); with FSqlDB do begin Connected := False; DriverName := 'Oracle'; GetDriverFunc := 'getSQLDriverORACLE'; KeepConnection := True; LibraryName := 'dbxora30.dll'; ConnectionName := 'OracleConnection';; Params.Clear; Params.Add('DriverName=Oracle'); Params.Add('DataBase=' + servername); Params.Add('User_Name=' + username); Params.Add('Password=' + password); Params.Add('RowsetSize=20'); Params.Add('BlobSize=-1'); Params.Add('ErrorResourceFile='); Params.Add('LocaleCode=0000'); Params.Add('Oracle TransIsolation=ReadCommited'); Params.Add('OS Authentication=False'); Params.Add('Multiple Transaction=False'); Params.Add('Trim Char=False'); Params.Add('Decimal Separator=.'); LoginPrompt := False; Connected := True; end; Result := FSqlDB; except on e:Exception do raise; end; //try-except end;

    Read the article

  • Python interface to PayPal - urllib.urlencode non-ASCII characters failing

    - by krys
    I am trying to implement PayPal IPN functionality. The basic protocol is as such: The client is redirected from my site to PayPal's site to complete payment. He logs into his account, authorizes payment. PayPal calls a page on my server passing in details as POST. Details include a person's name, address, and payment info etc. I need to call a URL on PayPal's site internally from my processing page passing back all the params that were passed in abovem and an additional one called 'cmd' with a value of '_notify-validate'. When I try to urllib.urlencode the params which PayPal has sent to me, I get a: While calling send_response_to_paypal. Traceback (most recent call last): File "<snip>/account/paypal/views.py", line 108, in process_paypal_ipn verify_result = send_response_to_paypal(params) File "<snip>/account/paypal/views.py", line 41, in send_response_to_paypal params = urllib.urlencode(params) File "/usr/local/lib/python2.6/urllib.py", line 1261, in urlencode v = quote_plus(str(v)) UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 9: ordinal not in range(128) I understand that urlencode does ASCII encoding, and in certain cases, a user's contact info can contain non-ASCII characters. This is understandable. My question is, how do I encode non-ASCII characters for POSTing to a URL using urllib2.urlopen(req) (or other method) Details: I read the params in PayPal's original request as follows (the GET is for testing): def read_ipn_params(request): if request.POST: params= request.POST.copy() if "ipn_auth" in request.GET: params["ipn_auth"]=request.GET["ipn_auth"] return params else: return request.GET.copy() The code I use for sending back the request to PayPal from the processing page is: def send_response_to_paypal(params): params['cmd']='_notify-validate' params = urllib.urlencode(params) req = urllib2.Request(PAYPAL_API_WEBSITE, params) req.add_header("Content-type", "application/x-www-form-urlencoded") response = urllib2.urlopen(req) status = response.read() if not status == "VERIFIED": logging.warn("PayPal cannot verify IPN responses: " + status) return False return True Obviously, the problem only arises if someone's name or address or other field used for the PayPal payment does not fall into the ASCII range.

    Read the article

  • Razor - Unexpected "foreach" keyword after "@" character

    - by Jaco Pretorius
    I have a partial view done in razor. When I run it I get the following error - it seems like Razor gets stuck into thinking I'm writing code everywhere. Unexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@" Here is my view @model IEnumerable<SomeModel> <div> @using(Html.BeginForm("Update", "UserManagement", FormMethod.Post)) { @Html.Hidden("UserId", ViewBag.UserId) @foreach(var link in Model) { if(link.Linked) { <input type="checkbox" name="userLinks" value="@link.Id" checked="checked" />@link.Description<br /> } else { <input type="checkbox" name="userLinks" value="@link.Id" />@link.Description<br /> } } } </div>

    Read the article

  • Setting html attribute that is reserved keyword in Html.CheckBoxFor in ASP.NET MVC

    - by dormisher
    Hi, I am using the HtmlHelper to create a checkbox in my view like so: <%= Html.CheckBoxFor(model = model.SeatOnly, new { checked = "checked" })% However, an error is being thrown as checked is a reserved keyword. I have found a couple of people saying that you must use the 'reserved word prefix' and simply put an uderscore in front of the attribute like so: <%= Html.CheckBoxFor(model = model.SeatOnly, new { _checked = "checked" })% This does not generate an error but in the generated html the attribute is actually '_checked' which means it doesn't work (if I use firebug and remove the underscore the attribute then takes effect). Does anyone know a way around this while still using CheckBoxFor? Thanks

    Read the article

  • ruby super keyword

    - by ash34
    Hi, From what I understand, 'super' keyword invokes a method with the same name as the current method in the superclass of the current class. Below in the autoload method, there is a call to 'super'. I would like to know in which superclass I would find a method with the same name or what does the call to 'super' do module ActiveSupport module Autoload ... def autoload(const_name, path = @@at_path) full = [self.name, @@under_path, const_name.to_s, path].compact.join("::") location = path || Inflector.underscore(full) if @@eager_autoload @@autoloads[const_name] = location end super const_name, location end .... end end module ActiveRecord extend ActiveSupport::Autoload ... autoload :TestCase autoload :TestFixtures, 'active_record/fixtures' end This code is from the rails master branch. Thanks much.

    Read the article

  • Delphi Phrase Count / Keyword Density

    - by Brad
    Does anyone know how to or have some code on counting the number of unique phrases in a document? (Single word, two word phrases, three word phrases). Thanks Example of what I'm looking for: What I mean is I have a text document, and i need to see what the most popular word phrases are. Example text I took the car to the car wash. I : 1 took : 1 the : 2 car: 2 to : 1 wash : 1 I took : 1 took the : 1 the car : 2 car to : 1 to the : 1 car wash : 1 I took the : 1 took the car : 1 the car to : 1 car to the : 1 to the car : 1 the car wash : 1 I took the car to : 1 took the car to the : 1 the car to the car : 1 car to the car wash : 1 I need the phrase, and the count that it shows up. Any help would be appreciated. The closet thing I found to this was a PHP script from http://tools.seobook.com/general/keyword-density/source.php I used to have some code for this, but I cannot find it.

    Read the article

  • "TypeError: draw() takes exactly 1 non-keyword argument (3 given)"

    - by Amorack
    I wrote this code to open a window with Pyglet in Python... import pyglet from pyglet import window class Window(pyglet.window.Window): def __init__(self): super(Window, self).__init__() myLabel = pyglet.text.Label("Prototype") windowText = myLabel.draw(Window, "Hello World", font_name = "Times New Roman", font_size = 36, color = (193, 205, 193, 255)) def on_draw(self): self.clear() self.label.draw() if __name__ == '__main__': window = Window() pyglet.app.run() however every time I run it I get this error: TypeError: draw() takes exactly 1 non-keyword argument (3 given) AFAIK the "(3 given)" means the problem is with the font_size or color arguments but I'm not sure. Could someone explain what's wrong and help me make this work?

    Read the article

  • LISP: Keyword parameters, supplied-p

    - by echox
    At the moment I'm working through "Practical Common Lisp" from Peter Seibel. In the chapter "Practical: A Simple Database" (http://www.gigamonkeys.com/book/practical-a-simple-database.html) Seibel explains keyword parameters and the usage of a supplied-parameter with the following example: (defun foo (&key a (b 20) (c 30 c-p)) (list a b c c-p)) Results: (foo :a 1 :b 2 :c 3) ==> (1 2 3 T) (foo :c 3 :b 2 :a 1) ==> (1 2 3 T) (foo :a 1 :c 3) ==> (1 20 3 T) (foo) ==> (NIL 20 30 NIL) So if I use &key at the beginning of my parameter list, I have the possibility to use a list of 3 parameters name, default value and the third if the parameter as been supplied or not. Ok. But looking at the code in the above example: (list a b c c-p) How does the lisp interpreter know that c-p is my "supplied parameter"?

    Read the article

  • JavaScript function binding (this keyword) is lost after assignment

    - by Ding
    this is one of most mystery feature in JavaScript, after assigning the object method to other variable, the binding (this keyword) is lost var john = { name: 'John', greet: function(person) { alert("Hi " + person + ", my name is " + this.name); } }; john.greet("Mark"); // Hi Mark, my name is John var fx = john.greet; fx("Mark"); // Hi Mark, my name is my question is: 1) what is happening behind the assignment? var fx = john.greet; is this copy by value or copy by reference? fx and john.greet point to two diferent function, right? 2) since fx is a global method, the scope chain contains only global object. what is the value of this property in Variable object?

    Read the article

  • DRYing Search Logic in Rails

    - by Kevin Sylvestre
    I am using search logic to filter results on company listing page. The user is able to specify any number of parameters using a variety of named URLs. For example: /location/mexico /sector/technology /sector/financial/location/argentina Results in the following respectively: params[:location] == 'mexico' params[:sector] == 'technology' params[:sector] == 'financial' and params[:location] == 'argentina' I am now trying to cleanup or 'DRY' my model code. Currently I have: def self.search(params) ... if params[:location] results = results.location_permalink_equals params[:location] if results results = Company.location_permalink_equals params[:location] unless results end if params[:sector] results = results.location_permalink_equals params[:sector] if results results = Company.location_permalink_equals params[:sector] unless results end ... end I don't like repeating the searchs. Any suggestions? Thanks.

    Read the article

  • MySQL to SQL Server - Incorrect syntax near the keyword 'mictest'

    - by Champi Ardon
    First, I tried to migrate my databases with SQL Server Migration Assistant for MySql and it worked fine. But now, I have some problems with my code. I had this line on MYSQL version : $fct="SELECT * FROM `users` WHERE `USER` LIKE CONVERT( _utf8 '$LOGIN' USING latin1 ) COLLATE latin1_swedish_ci AND `PASS` LIKE CONVERT( _utf8 '$PASS'USING latin1 ) COLLATE latin1_swedish_ci"; This line worked fine but when i try to put this on my SQL Version i get : Error : SQLSTATE[42000]: [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax with the keyword 'mictest'. (which is my $LOGIN) I though it was a problem with "quotes" so I also tried this but it is not working : $fct="SELECT * FROM users WHERE USER LIKE CONVERT( _utf8 '$LOGIN' USING latin1 ) COLLATE latin1_swedish_ci AND PASS LIKE CONVERT( _utf8 '$PASS' USING latin1 ) COLLATE latin1_swedish_ci";

    Read the article

  • Using a ref Parameter with the this Keyword?

    - by grefly
    Is there a way to force the this keyword to act as a ref argument? I would like to pass in a visitor that modifies multiple properties on the object, but this only wants to act like a value parameter. Code in Object: public void Accept(Visitor<MyObject> visitor) { visitor.Visit(this); } Code in Visitor: public void Visit(ref Visitor<MyObject> receiver) { receiver.Property = new PropertyValue(); receiver.Property2 = new PropertyValue(); }

    Read the article

  • C# where keyword

    - by Carra
    Our Indian overseas developers have written the following piece of code (C# 2.0): public abstract class ObjectMapperBase<T> where T : new() { internal abstract bool UpdateObject(T plainObjectOrginal, T plainObjectNew, WebMethod fwm, IDbTransaction transaction); } Inheritor example: public abstract class OracleObjectMapperBase<T> : ObjectMapperBase<T> where T : new() { internal override bool UpdateObject(T plainObjectOrginal, T plainObjectNew, WebMethod fwm, IDbTransaction transaction) { //Fancy Reflection code } } I've never seen the where keyword before after the class name. What does this do?

    Read the article

  • PHP & Regular expression: keyword just occurs once

    - by lauthiamkok
    Hi, how can I make sure a certain keyword just occurs once in the input with regular expression? I think there is some mistakes in the expression below as I can repeat the same keywords, if (!preg_match('/\b(.php?){1}\b/', $cfg_path)) { $error = true; echo '<error elementid="cfg_path" message="PATH - make sure you have a \'.php?\' in the path."/>'; } I just want this to be true, form.php?category=something or form.php? but not this, form.php?.php?category=something or form.php?.php? please let me know how to fix it. thanks.

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >