parameter-passing

Postgres: How to use arrays as stored procedure parameters efficiently?

偶尔善良 提交于 2019-12-11 05:49:59
问题 I need to create a Postgres 9.1 PL/pgSQL stored procedure that, among other parameters, takes a sequence of values that directly reference values in one of my database columns. As far as I can tell, the canonical way to do this in Postgres is an array. This is a rather basic task, of course. My problem is scalability: My code basically works, but performs badly once the sequences passed in get large (as in a few hundreds or thousands of values): Even rather simple SELECT statements within my

Passing parameters on button click in Rails

北城以北 提交于 2019-12-11 05:12:35
问题 Right now, I have it so that when users pick an option from collection_select , a div is populated based on the event_id of their choice. Depending on the Event , there will be multiple EventOption shown, each with their own unique ids. (I have EventOption as belongs_to Event , each of which has_many of them.) This is what I have populating via JS/Ajax when they select an Event : <div class="center" > <h2>Available Options for "<%= @event.name %>":</h2> <% @event.event_options.each do |e| %>

How to store parameters for action to be used again later

感情迁移 提交于 2019-12-11 04:57:34
问题 I have a list view that can be sorted, searched and filtered. From that list view the user can edit items in multiple steps. Finally after editing and reviewing the changes the user goes back to the list. Now I want the list to use the same sorting, search term and filters that the user set before and show the correct results. How can multiple paramters (sorting, search, filter) be stored and reused when showing the list action? Possible unsatisfactory ways that I thought of: pass through all

Drupal 7 - get variables from hook_theme

為{幸葍}努か 提交于 2019-12-11 04:52:00
问题 I tried to pass a variable from a custom module to a tpl file. In my custom module (named example) 1. I created a route with an argument via hook_menu : function example_menu() { $items['example/fancybox-photos/%'] = array( 'page callback' => 'example_display_fancybox_photos', 'page arguments' => array(2), 'type' => MENU_CALLBACK, 'access arguments' => array('access content'), ); return $items; } 2. I created my page callback function : function example_display_fancybox_photos($nid) {

Pass array of tags to a plpgsql function and use it in WHERE condition

和自甴很熟 提交于 2019-12-11 04:41:36
问题 I'd like to create a function that returns items based on their tags . However, I do not know how to format an array in the IN() clause. I believe that is why I get no result. Here is what I got: CREATE OR REPLACE FUNCTION getItemsByTag(tags text[]) RETURNS TABLE (id bigint, title text, tag text[]) AS $$ BEGIN IF array_length(tags, 1) > 0 THEN EXECUTE format(' SELECT d.id, d.title, array_agg(t.title) FROM items d INNER JOIN item_tags dt ON dt.item_id = d.id INNER JOIN tags t ON t.id = dt.tag

How to access params from URL after redirect to different site (Express)

被刻印的时光 ゝ 提交于 2019-12-11 04:38:36
问题 The SurveyMonkey API (documentation) requires implementation of oauth to let the user decide which scopes of their account the developer has access to. I have the following code (adapted from this question) as a means to implement the first two steps in their documentation: app.get('/surveymonkey/oauth', function (req, res) { const code = req.query.code; const post_body = querystring.stringify({ "client_secret": <client_secret>, "redirect_uri": "https://b2e3b137.ngrok.io/surveymonkey/oauth",

How to get data from a pl/sql function if a parameter have more than one value in function with single parameters

我是研究僧i 提交于 2019-12-11 04:18:31
问题 I am developing a procedure in pl/sql that get a data set from a cursor executed in a function. For example: Function: f_process_data(id_process IN NUMBER, id_product IN NUMBER) Returns : v_result_cursor sys_refcursor; But the problem is that in the search of the cursor I need to send at time more than one id_product. Something like this: id_product: 1240 (sausages) id_product: 1260 (ham) ¿How can I send (or get) more than one product in the function? I understood that it's possible with a

f:param to composite components

元气小坏坏 提交于 2019-12-11 03:48:39
问题 In JSF2.1 composite component if we try to pass f:param to a composite component (command button) and recieve in the component as editableValueHolder ,It doesn't seems to be working, Any ideas? <mycomp id="button" outcome="newpage" > <f:param name="foo" outcome="bar" for="button"/> </mycomp> compositeComponent.... <cc:interface> <cc:attribute name="action" targets="commandLink" required="true" /> </cc:interface> <cc:implementation> <h:commandLink id="commandLink" action="#{cc.attrs.action}">

How to pass an array from view to controller in Ruby on Rails

余生长醉 提交于 2019-12-11 03:39:18
问题 In my view I need to add (dynamically) text inputs and I need to get theirs values in the controller (once the user submit the corresponding form). My inputs are: <input type="text" name="airports_input_origin" class="airports_input_origin" id="airports_input_origin_0" size="40"/> <input type="text" name="airports_input_origin" class="airports_input_origin" id="airports_input_origin_1" size="40"/> etc... etc... They all have the same 'name' attribute.... so I guessed that if I do params[

calling C++/CLI from C# with out parameter

十年热恋 提交于 2019-12-11 03:09:47
问题 Need some references to better understand the out parameter (and the '%' operator used) when interfacing C# with C++/CLI. Using VS2012 and this msdn reference:msdn ref C++ DLL code compiled with /clr #pragma once using namespace System; namespace MsdnSampleDLL { public ref class Class1 { public: void TestOutString([Runtime::InteropServices::Out] String^ %s) { s = "just a string"; } void TestOutByte([Runtime::InteropServices::Out] Byte^ %b) { b = (Byte)13; } }; } And the C# code: using System;