Search Results

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

Page 121/164 | < Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >

  • Trouble with Action<T1, T2> and passing multiple parameters

    - by dotnetdev
    Hi, I have this code: s(x => x.Open()); s is a method which calls one parameter, which is perfectly fine, like so: public void s(Action<p1> action) {} Ignoring the naming conventions, if I make the method like the below: public void s(Action<p1, p2> action) {} How do I pass in more than one parameter? Out of interest, is there any way to use the params keyword with Action<? Also, I am using C# 4.0 so I would be interested to see how it can help me in an way. Thanks

    Read the article

  • Union All Won't work in stored procedure

    - by MyHeadHurts
    ALTER PROCEDURE [dbo].[MyStoredProcedure1] @YearToGet int AS Select Division, SDESCR, DYYYY, Sum(APRICE) ASofSales, Sum(PARTY) AS ASofPAX, Sum(NetAmount) ASofNetSales, Sum(InsAmount) ASofInsSales, Sum(CancelRevenue) ASofCXSales, Sum(OtherAmount) ASofOtherSales, Sum(CXVALUE) ASofCXValue From dbo.B101BookingsDetails Where Booked <= CONVERT(int,DateAdd(year, @YearToGet - Year(getdate()), DateAdd(day, DateDiff(day, 1, getdate()), 0) ) ) and (DYYYY = @YearToGet) Group By SDESCR, DYYYY, Division Having (DYYYY = @YearToGet) Order By Division, SDESCR, DYYYY union all SELECT DIVISION, SDESCR, DYYYY, SUM(APRICE) AS YESales, SUM(PARTY) AS YEPAX, SUM(NetAmount) AS YENetSales, SUM(InsAmount) AS YEInsSales, SUM(CancelRevenue) AS YECXSales, SUM(OtherAmount) AS YEOtherSales, SUM(CXVALUE) AS YECXValue FROM dbo.B101BookingsDetails Where (DYYYY=@YearToGet) GROUP BY SDESCR, DYYYY, DIVISION ORDER BY DIVISION, SDESCR, DYYYY The error I am getting is Msg 156, Level 15, State 1, Procedure MyStoredProcedure1, Line 36 Incorrect syntax near the keyword 'union'. But my goal here is the user inputs a year for example 2009, my first query will get all the sales made in 2009 to the same date it is was yesterday 12/23/2009, while the second query is getting 2009 totals up to dec 31 2009. I want the columns to be side by side not in one column

    Read the article

  • Named keywords in decorators?

    - by wheaties
    I've been playing around in depth with attempting to write my own version of a memoizing decorator before I go looking at other people's code. It's more of an exercise in fun, honestly. However, in the course of playing around I've found I can't do something I want with decorators. def addValue( func, val ): def add( x ): return func( x ) + val return add @addValue( val=4 ) def computeSomething( x ): #function gets defined If I want to do that I have to do this: def addTwo( func ): return addValue( func, 2 ) @addTwo def computeSomething( x ): #function gets defined Why can't I use keyword arguments with decorators in this manner? What am I doing wrong and can you show me how I should be doing it?

    Read the article

  • Trying to modify a constraint in PostgresSQL

    - by MISMajorDeveloperAnyways
    Postgres is getting quite annoying lately. I have checked the documentation provided by Oracle and found a way to do this without dropping the table. Problem is, it errors out at modify as it does not recognize the keyword. Using EMS SQL Manager for PostgreSQL. Alter table public.public_insurer_credit MODIFY CONSTRAINT public_insurer_credit_fk1 deferrable, initially deferred; I was able to work around it by dropping the constraint using : ALTER TABLE "public"."public_insurer_credit" DROP CONSTRAINT "public_insurer_credit_fk1" RESTRICT; ALTER TABLE "public"."public_insurer_credit" ADD CONSTRAINT "public_insurer_credit_fk1" FOREIGN KEY ("branch_id", "order_id", "public_insurer_id") REFERENCES "public"."order_public_insurer"("branch_id", "order_id", "public_insurer_id") ON UPDATE CASCADE ON DELETE NO ACTION DEFERRABLE INITIALLY DEFERRED;

    Read the article

  • Java data structure to use with Hibernate to store unknown number of parameters?

    - by Lunikon
    Following problem: I want to render a news stream of short messages based on localized texts. In various places of these messages I have to insert parameters to "customize" them. I guess you know what I mean ;) My question probably falls into the "Which is the best style to do it?" category: How would you store these parameters (they may be Strings and Numbers that need to be formatted according to Locale) in the database? I'm using Hibernate to do the ORM and I can think of the following solutions: build a combined String and save it as such (ugly and hard to maintain I think) do some kind of fancy normalization and and make every parameter a single row on the database (clean I guess, but a performance nightmare) Put the params into an Array, Map or other Java data structure and save it in binary format (probably causes a lot of overhead size-wise) I tend towards option #3 but I'm afraid that it might be to costly in terms of size in the database. What do you think?

    Read the article

  • What is @namespace field in C# class?

    - by MainMa
    Hi, I'm browsing the source code of StyleCop, and I found a curious thing: /// <summary> /// The namespace that the rule is contained within. /// </summary> private string @namespace; // [...] internal Rule(string name, string @namespace, string checkId, string context, bool warning) : this(name, @namespace, checkId, context, warning, string.Empty, null, true, false) { Param.Ignore(name, @namespace, checkId, context, warning); } What is this thing? Is it just a simple field where at-sign is used to indicate that it is a field, and not a namespace keyword? If so, may at-sign be used for any reserved word (for example @dynamic, @using, etc.)?

    Read the article

  • Network message serialization for game

    - by George R
    Exit-games make a network library product called photon, and they have and actively develop a limited mmo demo. Rather than shooting off json or XML, etc. saying "MovePlayer" (with associated params), they nut that message down to a 2 digit int, via an enum - something like Operations.MovePlayer. There's no denying that a 2 digit int is smaller than a longer string, however I really hate the idea of statically burning each and every message into an enum. Would there be an alternative way to have a MessageID property assign itself a unique 2 digit int based on a lookup table or something? Has anyone dealt with this kind of thing before?

    Read the article

  • Problems with Ruby "||" "or"?

    - by Kevin
    Beginning Ruby Question: I'm trying to see if a string variable's contents is either "personal" "email" or "password". I'm trying: if params[:action] == "password" || "email" || "personal" foo else don't foo end But that doesn't work and returns strange results, and using IRB to play around with "or" statements I have no idea why the following happens: irb(main):040:0> a = "email" => "email" irb(main):041:0> a == "password" || "email" => "email" irb(main):042:0> a == "email" || "password" => true I just want something that if any of the 3 variables are true no matter what order they are in it returns true, if not it returns false. Anyone want to help this n00b out?

    Read the article

  • How to grep lines having specific format.

    - by Nitin
    I have got a file with following format. 1234, 'US', 'IN',...... 324, 'US', 'IN',...... ... ... 53434, 'UK', 'XX', .... ... ... 253, 'IN', 'UP',.... 253, 'IN', 'MH',.... Here I want to extract only those lines having 'IN' as 2nd keyword. i.e. 253, 'IN', 'UP',.... 253, 'IN', 'MH',.... Can any one please tell me a command to grep it.

    Read the article

  • passing text_field values in ajx on rails

    - by user163352
    I'm using <%= text_field 'person', 'one',:id => 'test', :onchange=>remote_function(:url=>{:action=>"update"}, :update=>"test") %> <div id="test"></div> Now I just want to send the value of text_field with :action i.e :url=>{:action=>"update(value_of_text_field_entered"} Don't want to use params[:person][:one]. Any suggestions?or how can I use <%= observe_field % to send the value with action?

    Read the article

  • amp is included in url struts tag

    - by lakshmanan
    Hi, In my web application, I use strust2 url tag to pass parameters like id etc., For example, I use a link to delete an entity and I use param to pass the id of the entity to be deleted. And I follow this throughout my web app for adding, editing, deleting an entity. During run time, sometimes, I don't get the params to be stored in my action's bean properties. When I see the link that is generated, I get something like <a href='/projit1/p/discuss/viewDiscussion.action?d=11&amp;amp;amp;projid=11&amp;amp;disid=4'> What are these amps for ? why do they sit in between the action calls (made by link via url tag actions ) ? By the time I traverse back and forth in my web app, I get 10s and 20s of amp sitting in the request URL. What is the problem here ? Please help.

    Read the article

  • Confusion in bind call in socket programming

    - by Tarun
    i was learning socket programming in unix using c/c++. I am confused with one function call bind(params..). Actually it takes the adreess structure "sockaddr_in" and we can create the structure in the following way sockaddr_in.*** = somthing.. sockaddr_in..s_addr htonl(INADDR_ANY) **Passing INADDR_ANY will alow to bind all local addresses** My question is , why do we need to use "INADDR_ANY" ? In my knowledge every machine can has only one unique IP Address. In this way there is only one address associated with the machien. Thye bind call should directly bind the socket to the single available address. Please explain what are the different scenarios and why is it so?

    Read the article

  • How to call a Zend lucene search function?

    - by stef
    I inherited a Zend project devoid of comments and I didn't get to talk to the previous developer. Since I have no Zend experience I'm having some issues :) I'd like to print out some variables inside an function that indexes items from the site using Zend_Search_Lucene because I think something is going wrong here. From what I've read, ::create creates a new index and ::open updates it. So it's in this ::open function I'd like to print out some variables. The name and params of the function are below. Does anyone have any idea how this function can be called so I can run some tests? private function search($category,$string,$page = 1,$itemsByPage = 5) EDIT: OR, is there a way I can nuke the existing index and force it to be rebuilt completely, for example by deleting the index files on the FS and then performing some searches?

    Read the article

  • Will_paginate Plugin on two objects on same page

    - by piemesons
    Hello I am using will_paginte plugin on two objects on a same page. Like on stackoverflow. There is a profile page on which there is a pagination on two things QUestions and answers. I am having problem ie:-- when user is clicking on questions pagination page 2. answers page are also updating. The reason is both is sending a post variable ie params[:page] How to change this variable so that only one should be updated. and how to maintain that user should not lose the other page. ie he is on 3rd page of questions and 1st page of answers and now he click on 5th page of the questions the result should be 3rd page of questions and 5th page of answers.

    Read the article

  • Using special characters as keywords in latex listings package

    - by sha
    Hi, I am using the listings package for latex. I am using the SQL language definition and am adding some new keywords that I need, using morekeywords=. I have trouble defining some special characters as keywords, for example, I need [], <, &, and - to be considered as keywords and use the keyword style. I have tried adding these verbatim or with a preceding backslash. It did not work. Your help would be greatly appreciated. Thanks.

    Read the article

  • Child service not writing to event log

    - by Tommy Fisk
    I am having a very simple (but incredibly frustrating) issue with a parent service and the child service. Let's call the parent service "Service A" and the child "Service B". Both services reside on the same box. Using WCF Storm, when I send Service B a message, I see lots of entries in the event viewer for it. However, if I send a message to Service A, which calls Service B, I only see entries from Service A. So for some reason, the child logs are not written when the parent calls it, but if I call it myself, the logs do indeed show up, so I know it's not a problem with the logging or anything like that. Here is what I am using to write to the event log. // in some random static class private static EventLog el = new EventLog(); el.WriteEntry("In " + location + ", " + message); // params passed in Does anyone know why this is happening? And more importantly what I can do about it?

    Read the article

  • How do I create a point system in a Rails app that assigns points to users and non-authenticated-use

    - by codyvbrown
    I'm building a question and answer application on top of twitter and I'm hitting some snags because I'm inevitably dealing with two classes of users: authenticated and non-authenticated. The site enable users to give points to other users, who may or may not be authenticated, and I want to create a site-wide point system where the application stores and displays this information on their profile. I want to save this point data to the user because that would be faster and more efficient but non-authenticated users aren't in our system, we only have the twitter handle. So instead we display the points in our system like this: @points = point.all( :select => "tag, count(*) AS count", # Return tag and count :group => 'tag', # Group by the tag :order => "2 desc", :conditions => {:twitter_handle => params[:username]}) Is there a better way to do this? Is there a better way to associate data with non-authenticated users?

    Read the article

  • Rails - undefined method `name' for nil:NilClass

    - by sscirrus
    Hi guys, Quick question. Here is my code: #routes map.resources :customers, :has_many => [:addresses, :matchings] map.connect ":controller/:action/:id" #url path: http://127.0.0.1:3000/customers/index/3 #customers controller def index @customer = Customer.find(params[:id]) end #customers view/index.html.erb ... <%= @customer.name %> ... Error: undefined method `name' for nil:NilClass. Here's my reasoning. The parameter :id is coming from my url path (i.e. we're looking for customer #3 in the above path). @customer should find that array easily, then @customer.name should produce the name, but apparently @customer is blank. Why? I assume the problem is that I'm not producing an array in my controller?

    Read the article

  • Calling this[int index] via reflection

    - by tkutter
    I try to implement a reflection-based late-bound library to Microsoft Office. The properties and methods of the Offce COM objects are called the following way: Type type = Type.GetTypeFromProgID("Word.Application"); object comObject = Activator.CreateInstance(type); type.InvokeMember(<METHOD NAME>, <BINDING FLAGS>, null, comObject, new object[] { <PARAMS>}); InvokeMember is the only possible way because Type.GetMethod / GetProperty works improperly with the COM objects. Methods and properties can be called using InvokeMember but now I have to solve the following problem: Method in the office-interop wrapper: Excel.Workbooks wb = excel.Workbooks; Excel.Workbook firstWb = wb[0]; respectively foreach(Excel.Workbook w in excel.Workbooks) // doSmth. How can I call the this[int index] operator of Excel.Workbooks via reflection?

    Read the article

  • Ruby w/ Postgres & Sinatra - Query won't order right with parameter??

    - by alleywayjack
    So I set a variable in my main ruby file that's handling all my post and get requests and then use ERB templates to actually show the pages. I pass the database handler itself into the erb templates, and then run a query in the template to get all (for this example) grants. In my main ruby file: grants_main_order = "id_num" get '/grants' do erb :grants, :locals => {:db=>db, :order=>grants_main_order, :message=>params[:message]} end In the erb template: db = locals[:db] getGrants = db.exec("SELECT * FROM grants ORDER BY $1", [locals[:order]]) This produces some very random ordering, however if I replace the $1 with id_num, it works as it should. Is this a typing issue? How can I fix this? Using string replacement with #{locals[:order]} also gives funky results.

    Read the article

  • Checking if a boolean column is true in MySQL/Rails

    - by Pygmalion
    Rails and MySQL: I have a table with several boolean columns representing tags. I want to find all the rows for which a specific one of these columns is 'true' (or I guess in the case of MySQL, '1'). I have the following code in my view. @tag = params[:tag] @supplies = Supply.find(:all, :conditions=>["? IS NOT NULL and ? !=''", @tag, @tag], :order=>'name') The @tag is being passed in from the url. Why is it then that I am instead getting all of my @supplies (i.e. every row) rather than just those that are true for the column for @tag. Thanks!

    Read the article

  • What are the other new features of C# 4.0, after dynamic and optional parameters?

    - by Abel
    So, C# 4.0 came out yesterday. It introduced the much-debated dynamic keyword, named and optional parameters. Smaller improvements were the implicit ref and recognizing of indexed and default properties on COM methods, contra- and co-variance (really a .NET CLR feature, not C# only) and... Is that really it? Are dynamic and optional/named params the only real improvements to C#? Or did I miss something? Not that I'm complaining, but it seems a bit meager after C# 2.0 (generics) and C# 3.0 (lambda, LINQ). Maybe the language just reached actual maturity?

    Read the article

  • ruby on rails has_many through relationship

    - by BennyB
    Hi i'm having a little trouble with a has_many through relationship for my app and was hoping to find some help. So i've got Users & Lectures. Lectures are created by one user but then other users can then "join" the Lectures that have been created. Users have their own profile feed of the Lectures they have created & also have a feed of Lectures friends have created. This question however is not about creating a lecture but rather "Joining" a lecture that has been created already. I've created a "lecturerelationships" model & controller to handle this relationship between Lectures & the Users who have Joined (which i call "actives"). Users also then MUST "Exit" the Lecture (either by clicking "Exit" or navigating to one of the header navigation links). I'm grateful if anyone can work through some of this with me... I've got: Users.rb model Lectures.rb model Users_controller Lectures_controller then the following model lecturerelationship.rb class lecturerelationship < ActiveRecord::Base attr_accessible :active_id, :joinedlecture_id belongs_to :active, :class_name => "User" belongs_to :joinedlecture, :class_name => "Lecture" validates :active_id, :presence => true validates :joinedlecture_id, :presence => true end lecturerelationships_controller.rb class LecturerelationshipsController < ApplicationController before_filter :signed_in_user def create @lecture = Lecture.find(params[:lecturerelationship][:joinedlecture_id]) current_user.join!(@lecture) redirect_to @lecture end def destroy @lecture = Lecturerelationship.find(params[:id]).joinedlecture current_user.exit!(@user) redirect_to @user end end Lectures that have been created (by friends) show up on a users feed in the following file _activity_item.html.erb <li id="<%= activity_item.id %>"> <%= link_to gravatar_for(activity_item.user, :size => 200), activity_item.user %><br clear="all"> <%= render :partial => 'shared/join', :locals => {:activity_item => activity_item} %> <span class="title"><%= link_to activity_item.title, lecture_url(activity_item) %></span><br clear="all"> <span class="user"> Joined by <%= link_to activity_item.user.name, activity_item.user %> </span><br clear="all"> <span class="timestamp"> <%= time_ago_in_words(activity_item.created_at) %> ago. </span> <% if current_user?(activity_item.user) %> <%= link_to "delete", activity_item, :method => :delete, :confirm => "Are you sure?", :title => activity_item.content %> <% end %> </li> Then you see I link to the the 'shared/join' partial above which can be seen in the file below _join.html.erb <%= form_for(current_user.lecturerelationships.build(:joinedlecture_id => activity_item.id)) do |f| %> <div> <%= f.hidden_field :joinedlecture_id %> </div> <%= f.submit "Join", :class => "btn btn-large btn-info" %> <% end %> Some more files that might be needed: config/routes.rb SampleApp::Application.routes.draw do resources :users do member do get :following, :followers, :joined_lectures end end resources :sessions, :only => [:new, :create, :destroy] resources :lectures, :only => [:create, :destroy, :show] resources :relationships, :only => [:create, :destroy] #for users following each other resources :lecturerelationships, :only => [:create, :destroy] #users joining existing lectures So what happens is the lecture comes in my activity_feed with a Join button option at the bottom...which should create a lecturerelationship of an "active" & "joinedlecture" (which obviously are supposed to be coming from the user & lecture classes. But the error i get when i click the join button is as follows: ActiveRecord::StatementInvalid in LecturerelationshipsController#create SQLite3::ConstraintException: constraint failed: INSERT INTO "lecturerelationships" ("active_id", "created_at", "joinedlecture_id", "updated_at") VALUES (?, ?, ?, ?) Also i've included my user model (seems the error is referring to it) user.rb class User < ActiveRecord::Base attr_accessible :email, :name, :password, :password_confirmation has_secure_password has_many :lectures, :dependent => :destroy has_many :lecturerelationships, :foreign_key => "active_id", :dependent => :destroy has_many :joined_lectures, :through => :lecturerelationships, :source => :joinedlecture before_save { |user| user.email = email.downcase } before_save :create_remember_token validates :name, :presence => true, :length => { :maximum => 50 } VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, :presence => true, :format => { :with => VALID_EMAIL_REGEX }, :uniqueness => { :case_sensitive => false } validates :password, :presence => true, :length => { :minimum => 6 } validates :password_confirmation, :presence => true def activity # This feed is for "My Activity" - basically lectures i've started Lecture.where("user_id = ?", id) end def friendactivity Lecture.from_users_followed_by(self) end # lECTURE TO USER (JOINING) RELATIONSHIPS def joined?(selected_lecture) lecturerelationships.find_by_joinedlecture_id(selected_lecture.id) end def join!(selected_lecture) lecturerelationships.create!(:joinedlecture_id => selected_lecture.id) end def exit!(selected_lecture) lecturerelationships.find_by_joinedlecture_id(selected_lecture.id).destroy end end Thanks for any and all help - i'll be on here for a while so as mentioned i'd GREATLY appreciate someone who may have the time to work through my issues with me...

    Read the article

  • How do I resolve this scope issue in VB .NET?

    - by froadie
    I have a code structure something like this: For row = 1 To numRows Dim arrayIndex As Integer = 0 For column As Integer = bucketStartColumn To bucketEndColumn ' whatever code arrayIndex = arrayIndex + 1 Next Next Dim arrayIndex As Integer = 0 For column As Integer = bucketStartColumn To bucketEndColumn ' whatever code arrayIndex = arrayIndex + 1 Next Not exactly the code, so I don't really need suggestions about refactoring, but my problem is this - with this code I get a compiler error for the first Dim arrayIndex As Integer = 0 - "Variable 'arrayIndex' hides a variable in an enclosing block." As far as I can tell, arrayIndex is local to the first for loop and shouldn't exist by the time we reach the second loop. If I try to change the second declaration of arrayIndex to arrayIndex = 0, I get the error "Name 'arrayIndex' is not declared", as I expected. So is it visible, or not? Does this have something to do with the Dim keyword? Any suggestions of how to get around this, other than naming the second index variable something else?

    Read the article

  • How to write syntax highlighting? c++

    - by ML
    Hi All, I am embarking on some learning and I want to write my own syntax highlighting for files in C++. Can anyone give me ideas on how to go about doing this? To me it seems that when a file is opened: 1. it would need to be parsed and decided what type of source file it is. Trusting the extension might not be full-proof a way to know what keywords/commands apply to what language a way to decide what color each keyword/command gets I want to do this on OS X, C++ or Objective-C Can anyone provide pointers on how I might get started with this?

    Read the article

< Previous Page | 117 118 119 120 121 122 123 124 125 126 127 128  | Next Page >