Search Results

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

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

  • Get a list/tuple/dict of *all* the arguments passed to a function?

    - by Phillip Oldham
    Given the following function: def foo(a, b, c): pass How would one obtain a list/tuple/dict/etc of the arguments passed in? Specifically, I'm looking for Python's version of JavaScript's arguments keyword or PHP's func_get_args() method. What I'm not looking for is a solution using *args or **kwargs; I need to specify the argument names in the function definition (to ensure they're being passed in) but within the function I want to work with them in a list- or dict-style structure.

    Read the article

  • WTF why does this SQL work in VS but not in CODE?

    - by acidzombie24
    The line cmd.ExecuteNonQuery(); cmd.CommandText CREATE TRIGGER subscription_trig_0 ON subscription AFTER INSERT AS UPDATE user_data SET msg_count=msg_count+1 FROM user_data JOIN INSERTED ON user_data.id = INSERTED.recipient; The exception: Incorrect syntax near the keyword 'TRIGGER'. Then using VS 2010, connected to the very same file (a mdf file) i run the query above and i get a success message. WTF!

    Read the article

  • Should the argument be passed by reference in this .net example?

    - by Hamish Grubijan
    I have used Java, C++, .Net. (in that order). When asked about by-value vs. by-ref on interviews, I have always done well on that question ... perhaps because nobody went in-depth on it. Now I know that I do not see the whole picture. I was looking at this section of code written by someone else: XmlDocument doc = new XmlDocument(); AppendX(doc); // Real name of the function is different AppendY(doc); // ditto When I saw this code, I thought: wait a minute, should not I use a ref in front of doc variable (and modify AppendX/Y accordingly? it works as written, but made me question whether I actually understand the ref keyword in C#. As I thought about this more, I recalled early Java days (college intro language). A friend of mine looked at some code I have written and he had a mental block - he kept asking me which things are passed in by reference and when by value. My ignorant response was something like: Dude, there is only one kind of arg passing in Java and I forgot which one it is :). Chill, do not over-think and just code. Java still does not have a ref does it? Yet, Java hackers seem to be productive. Anyhow, coding in C++ exposed me to this whole by reference business, and now I am confused. Should ref be used in the example above? I am guessing that when ref is applied to value types: primitives, enums, structures (is there anything else in this list?) it makes a big difference. And ... when applied to objects it does not because it is all by reference. If things were so simple, then why would not the compiler restrict the usage of ref keyword to a subset of types. When it comes to objects, does ref serve as a comment sort of? Well, I do remember that there can be problems with null and ref is also useful for initializing multiple elements within a method (since you cannot return multiple things with the same easy as you would do in Python). Thanks.

    Read the article

  • Passing data between blocks using sinatra

    - by Dan Galipo
    Hi All I'm trying to pass data between blocks using sinatra. For example: @data = Hash.new post "/" do @data[:test] = params.fetch("test").to_s redirect "/tmp" end get "/tmp" do puts @data[:test] end However whenever i get to the tmp block @data is nil and throws an error. Why is that?

    Read the article

  • Linq List contains specific values.

    - by Raffaeu
    I need to know if the List I am working with contains only some specific values. var list = new List<string> { "First", "Second", "Third" }; If I want to know if the List contain at least one item with the value "First" I use the Any keyword: var result = list.Any(l => l == "First"); But how I can write a Linq expression that will return true/false only if the List contains "First" and "Second" values?

    Read the article

  • call a Javascript function from controller more than once (in Rails)

    - by mm1
    hi. I have a multiple file upload form(html5) and want to update my view as soon one of the images is transfered to my image server. Currently I upload the files with ajax and use response_to_parent to update my upload view when all images are transfered to the image server. Is it possible to call a Javascript function from the controller more than once per action? def upload params[:images].each do |file| upload_to_image_server(file) #page << Update upload View end end Thanks, Michael

    Read the article

  • Syntax highlighting Abbreviations

    - by Nimbuz
    I'm using Google prettify for syntax highlighting and I'd like to modify the colors to match my website theme, but I don't understand some of the abbreviations from these: str = string atw kwd = keyword tag = tag com = comment typ = type? atn dec = declaration? lit pun = punctuation? like colons, braces? pln prettyprint

    Read the article

  • [Grails] HibernateException: No session currently bound to execution context

    - by user289206
    I'm trying to create a very basic REST-ish web service with Grails and Postgres. I have the read() & delete() methods working, but I can't get create() to work. Hibernate just gripes, "HibernateException: No session currently bound to execution context." Here's my create method: def create = { def member = new Member(params) member.save() render(status: 201) } Any advice would be great. Thanks.

    Read the article

  • Rails saving data to model that has multiple has_many

    - by Ajey
    So I have a product model that looks like belongs_to :seller has_many :coupons And coupon model that looks like belongs_to :seller belongs_to :product And in my Products controller I use @seller = current_user @coupon = @seller.coupons.create(params[:coupon]) to create the coupons for the seller While the coupon is being created, I need to associate it with the product too, i.e When a new coupon is created it should be saved for the seller AS WELL AS for the product.

    Read the article

  • Start Line with (New... in VB.net

    - by pedro_cesar
    Hello; Why can't I start a line using a parenthesis followed by the keyword new?? For example: (New <custom_obj>).foo(var) In that case is obvious that I'm trying to avoid creating a named instance of the the <custom_obj> because I know that I'll only be using it at that sentence. Note that actually creating a named instance is not a problem for me... I just wanna know the reason why this is not possible.

    Read the article

  • how to get an xml in a variable

    - by sam
    I have a stored procedure that will return xml. I have delared a variable of type xml and trying to execute the following code declare @v xml set @v = execute get_xml @id, 33 whereas id is returned by another query. now it keeps compalinng about the following error Incorrect syntax near the keyword 'execute'.

    Read the article

  • Accessing weakly typed facebook sdk result object properties in .NET 3.5 using the API?

    - by John K
    Consider the following in .NET 3.5 (using the Bin\Net35\Facebook*.dll assemblies): var app = new FacebookApp(); var result = app.Get("me"); // want to access result properties with no dynamic ... in the absence of the C# 4.0 dynamic keyword this provides only a generic object. How best should I access the properties of this result value? Are there helper or utility methods or stronger types in the facebook C# sdk, or should I use standard .NET reflection techniques?

    Read the article

  • passing a parameter from an other model on ruby

    - by MAGE
    I'm very newbie in ruby and need your help. I must save a "Topic" and make it like this : @topic = Topic.new(params[:topic]) But I would like to pass an other information to this topic. It has a field "community_id" that link it to a community. The logged user has this information on his table. How can I pass the "community_id" from the logged user to the "community_id" of the "topic" created ? thx for your help

    Read the article

  • "Share on LinkedIn" widget chokes on encoded spaces in url param

    - by David Droddy
    Does anyone know why I am not able to include my own, URL encoded URL params with URL encoded spaces? See the URL on my jsBin page constructed from LinkedIn's example--I have added (%3FnestedParam%3Done%20space) at the end of the "URL" value. THEN, if you remove the encoded space (%3FnestedParam%3DoneSpace) it works fine: Try it out: http://jsbin.com/acosa3/3 Thanks!

    Read the article

  • Why does this SQL work in VS but not in code?

    - by acidzombie24
    The line cmd.ExecuteNonQuery(); cmd.CommandText CREATE TRIGGER subscription_trig_0 ON subscription AFTER INSERT AS UPDATE user_data SET msg_count = msg_count + 1 FROM user_data JOIN INSERTED ON user_data.id = INSERTED.recipient; The exception: Incorrect syntax near the keyword 'TRIGGER'. Then using VS 2010, connected to the very same file (a mdf file) i run the query above and i get a success message.

    Read the article

  • reducing loading time of 100 pages of google

    - by Nikhil
    for my project i need to access entire pages(100) of google at a time for a particular keyword.I used 'for' loop for accessing pages in url written in my c# code.But it is taking more time to access.Some times it showing HttpRequest error.Any way to increase the speed?

    Read the article

  • C# Why does code compile fine when there is an ambiguous virtual method?

    - by Jimbo
    I have a class (Class B) that inherits another class (Class A) that contains virtual methods. Mistakenly, I omitted the override keyword when declaring a (supposed to be) overriding method in Class B. Class A public class ClassA{ public virtual void TestMethod(){ } } Class B public class ClassB : ClassA{ public void TestMethod(){ } } The code compiled without a problem. Can anyone explain why?

    Read the article

  • Why can't i define recursive variable in code block?

    - by senia
    Why can't i define a variable recursively in a code block? scala> { | val fibs: Stream[Int] = 1 #:: fibs.scanLeft(1){_ + _} | } <console>:9: error: forward reference extends over definition of value fibs val fibs: Stream[Int] = 1 #:: fibs.scanLeft(1){_ + _} ^ scala> val fibs: Stream[Int] = 1 #:: fibs.scanLeft(1){_ + _} fibs: Stream[Int] = Stream(1, ?) lazy keyword solves this problem, but i can't understand why it works without a code block but throws a compilation error in a code block.

    Read the article

  • Is there a way to catch an attempt to access a non existant property or method?

    - by Tor Valamo
    For instance this code: function stuff() { this.onlyMethod = function () { return something; } } // some error is thrown stuff().nonExistant(); Is there a way to do something like PHP's __call as a fallback from inside the object? function stuff() { this.onlyMethod = function () { return something; } this.__call__ = function (name, params) { alert(name + " can't be called."); } } // would then raise the alert "nonExistant can't be called". stuff().nonExistant();

    Read the article

  • Regular Expression: Match untill pattern is found

    - by ZafarYousafi
    Hi, I want to extract the status from the string untill I found a timespan. My input is something like "Something in start but not with this keyword of sure. STATUS: My Status Is Here Which can be anything but timespan 23:59:01 and so on. I want to extract the string after STATUS: untill 23:59:01 is found. How can i achieve this through regex. this 23:59:01 is a timespan and it is always in this format hh:mm:ss

    Read the article

  • Skipp default parameters in Delphi

    - by Vijay Bobba
    Hi Is there any way to skip the default params, say suppose my method declaration is like this: procedure Myfunc1(var isAttr1: Boolean = FALSE; isAttr2: Boolean = FALSE; isAttr3: Boolean = FALSE); I can't call the function like this: Self.Myfunc1( , , Attr3); because I don't want unnecessary var declarations, at the same time I want the last param return value (it is a var type) Thank for help in advance

    Read the article

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