params

Mixing optional parameters and params when can't simply overload

拥有回忆 提交于 2019-12-06 18:07:55
问题 Similar to this question, I want to mix optional parameters with the params keyword, which of course creates ambiguity. Unfortunately, the answer of creating overloads does not work, as I want to take advantage of caller info attributes, like this: public void Info(string message, [CallerMemberName] string memberName = "", [CallerLineNumber] int lineNumber = 0, params object[] args) { _log.Info(BuildMessage(message, memberName, lineNumber), args); } Creating an overload without the optional

How do I get params attributes in post?

痴心易碎 提交于 2019-12-06 17:29:13
问题 I am using Sinatra with Ruby 1.8.7. I'm new to web development, so I don't totally understand get and post, but I got some stuff working. What I need to know next is how to interrogate params in post for certain attributes. In my main file, I have this code: get "/plan_design" do erb :plan_design end post "/plan_design" do # do stuff with params end In plan_design.erb, I have: <% if (hash[paramTitle].kind_of?(String)) %> <div> <input class="planDesignAsset" name="<%= paramTitle %>" value="<%=

How can I pass javascript variable to grails controller using remoteFunction

淺唱寂寞╮ 提交于 2019-12-06 15:06:01
I am working with grails 2.1.1. I have a remote function from where I want to pass more than one java script variable through g:remoteFunction. But no js variable is going to controller. My js variables are underlined and are not recognized. Can anyone please help me on this please ?!!! Here are my attempts below :: My function >>> function addNewBill(){ var orgId = $('#aaOrgIdAaOrg').val(); var ccId = $('#costCenter').val(); if(orgId != null && orgId != "null" && orgId != "" && ccId != null && ccId != "null" && ccId != ""){ $('#ccModal').modal('hide'); ${remoteFunction(action: 'createBill',

ActionController::ParameterMissing param is missing or the value is empty

不问归期 提交于 2019-12-06 13:08:32
问题 I can't solve this problem. When I try to use "Chatroom#new" method, I I got this error, ActionController::ParameterMissing param is missing or the value is empty . below codes are the ChatroomController. class ChatroomsController < ApplicationController before_action :find_room_owner,only:[:index] before_action :objects_for_index,only:[:index] def index #/users/:user_id/cart/items/chatroom sign_in @user if signed_in? if @seller && @buyer flash[:success] = "U are owners of the chatroom"

Rails 3: update URL params with AJAX request

痴心易碎 提交于 2019-12-06 08:33:31
问题 I have a filter and a list of products (id, name, creation_date). I can filter by id, name or creation_date. With an AJAX request I update a content div... but obviously the URL not change. How can I append params to URL? For example: localhost:3000/dashboard/catalog?name=radio&?date_creation=23-06-2013 I know that history.pushState(html5) exists... but I need that my app works in html4 browsers like IE9. I tried Wiselinks (https://github.com/igor-alexandrov/wiselinks) which it uses History

is there a rails method to loop through each line of uploaded file? “each_line” is an IO method but it's not working

狂风中的少年 提交于 2019-12-06 07:56:14
I'm attempting to upload a csv file, parse it, and spit out a file for S3 or just pass to view. I use a file_field_tag to upload the csv. I thought file_field_tag passes an object that is a subclass of IO and would have all ruby IO methods such as "each_line". I can call "read" on the object (method of IO class) but not "each_line"... so how can I iterate over each line of a file_field_tag upload? create method of my controller as: @csv_file = params[:csv_file] My show view which throws a no "each_line" method error: <% @csv_file.each_line do |line| %> <%= line %> <% end %> Yet I can use <%=

XSLT param identity transform without input XML

ぐ巨炮叔叔 提交于 2019-12-06 05:51:06
I'm trying this for days and no success. I have following XSLT which doesn't take any input XML, but has one param as XML: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" /> <xsl:param name="products"> <products author="Jesper"> <product id="p1"> <name>Delta</name> <price>800</price> <stock>4</stock> <country>Denmark</country> </product> <product id="p2"> <name>Golf</name> <price>1000</price> <stock>5</stock> <country>Germany</country> </product> <product id="p3"> <name>Alfa</name> <price>1200</price> <stock>19</stock>

print currently evaluated params during scipy minimization

谁都会走 提交于 2019-12-06 04:12:52
I am trying to minimize a function in Python using scipy.optimize.minimize , to determine four distinct parameters. I would like to print the currently evaluated params at each step of the optimisation algorithm, so I can use them to make my initial guess better. How can I do this? Use the callback keyword argument. scipy.optimize.minimize can take a keyword argument callback . This should be a function that accepts, as input, the current vector of parameters. This function is called after every iteration. For instance, from scipy.optimize import minimize def objective_function(xs): """

ActiveModel::ForbiddenAttributesError using update_attributes having created params hash myself

此生再无相见时 提交于 2019-12-06 02:39:54
问题 I’m trying to edit/update a model record using simple_form, but the form is not going to directly change a model field. Instead, I offer a couple of check_box_tag fields that tell update what fields need changed. As a result, update is not receiving a params[:device] hash that I can use to update the attributes. I am attempting to create this hash, but am getting ForbiddenAttributesError when I issue the @device.update_attributes(params[:device]). I believe my strong parameters list is

Volley string request error while passing string with null value as param

吃可爱长大的小学妹 提交于 2019-12-05 22:51:07
问题 I am using the following code for string request on volley pDialog = new ProgressDialog(context); pDialog.setMessage("Loading..."); pDialog.setCancelable(false); pDialog.show(); StringRequest strReq = new StringRequest(Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { pDialog.dismiss(); Log.e(tag, response); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { pDialog.dismiss(); } }) { protected