parameters

JQuery, Passing Parameters

杀马特。学长 韩版系。学妹 提交于 2020-01-06 03:09:45
问题 I'm working with some very basic jquery code and would like to condense what I've done into one function with passed parameters. I have a few of these: $(".about").hover(function() { $(this).attr("src","_img/nav/about_over.gif"); }, function() { $(this).attr("src","_img/nav/about_off.gif"); }); $(".artists").hover(function() { $(this).attr("src","_img/nav/artists_over.gif"); }, function() { $(this).attr("src","_img/nav/artists_on.gif"); }); $(".help").hover(function() { $(this).attr("src","

ForbiddenAttributesError for polymorphic model in Rails 4

假如想象 提交于 2020-01-05 13:53:19
问题 Rails 4 ships with strong_parameters, which is a great addition - but I've run into a problem with it. I have a polymorphic model Comment and I cannot for the life of me get the controller to accept the parameters it needs. Here is my code (shortened for clarity): Routes: resources :articles do resources :comments end Models: class Article < ActiveRecord::Base has_many :comments, :as => :commentable end class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end

setPreviewSize does not work on Nexus 5 kitkat

一笑奈何 提交于 2020-01-05 13:12:37
问题 In my app i need to set the camera preview size at 640x480. I tried my code on different devices and different android versions (for example 2.3.6 on samsung galaxy S2, 4.0.3 on asus tf101g, 4.3 on galaxy nexus), and at the last on the new Nexus 5 with android kitkat(4.4). My code works perfectly in all devices, but doesn't work on Nexus 5. Why? In fact after this steps: int PREVIEW_WIDTH = 640; int PREVIEW_HEIGHT = 480; if(isSupportedSize(PREVIEW_WIDTH,PREVIEW_HEIGHT,mCamera)){ /

JDBC PreparedStatement and parameters (?) in select query [duplicate]

旧时模样 提交于 2020-01-05 12:57:12
问题 This question already has answers here : Variable column names using prepared statements (6 answers) Closed 2 years ago . I have a connection with oracle database like this: String selectSQL = "SELECT ?,supplier_name FROM supplier WHERE supplier_id = ?"; PreparedStatement preparedStatement = con.prepareStatement(selectSQL); preparedStatement.setString(1, "supplier_id"); preparedStatement.setInt(2, 1); ResultSet rs2 = preparedStatement.executeQuery(); while (rs2.next()) { String userid = rs2

function mapping delphi/pascal dll in jna handle and string

微笑、不失礼 提交于 2020-01-05 12:07:08
问题 I'm trying to call a function in a delphi dll using JNA. the function definition is: function myFuncGetName (aHandle : THandle; var aBuf : pwideChar ): integer; export; my jna mapping looks like this: int myFuncGetName(PointerByReference aHandle, WString aBuf); the return value should be 0 for success and -1 for fail and I'm always getting -1. I have started up WinDbg and attached to the process and it breaks at myFuncGetName. 057cb384 eb11 jmp myDLL!myFuncGetName+0x87 (057cb397) 057cb386

int * vs int [] vs int (*)[] in function parameters. Which one should I use?

荒凉一梦 提交于 2020-01-05 09:30:59
问题 In the C-programming language there are many different ways to declare the parameter of a function that takes an array as an argument passed through a pointer. I have prepared an example that shows you what I mean. It is an implementation of the std::accumulate function in C++. It is a function that performes addition of all elements in an array and returns the result. I can write it like this: int accumulate(int n, int *array) { int i; int sum = 0; for (i = 0; i < n; ++i) { sum += array[i];

REST WCF Service - Consume QueryString Parameters

梦想与她 提交于 2020-01-05 07:57:30
问题 I have this REST WCF service. [WebInvoke(UriTemplate = "/GetNames/{Category}?order=asc", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] public List<Names> GetNames(string Category) { //Code to retrieve Names by category. } The Category parameter is mapped to {Category} in the Uri. But how can I map the order query string in the Uri to this method? Adding the order as a parameter method is not working. please help. thanks in advance. 回答1: Have

Enum as a Parameter in Dynamics AX

左心房为你撑大大i 提交于 2020-01-05 06:52:46
问题 My report has a parameter which uses a base enum. The enum has 4 different options to choose when running the report. How do I insert an option which uses all 4 at once? For example, I have an enum named Phone and it has 4 types: 1 = None, 2 = Home, 3 = Mobile, 4 = Work. In a drop down, how do I add option 5 = None+Home+Mobile+Work? Thank you! 回答1: Add anoher enum with value All (see NoYes and NoYesAll enums as example) 回答2: Some ways to solve your problem: You can alter your Enum and add a

How can you strip HTML comments out of a page generated with JSP/JSTL?

独自空忆成欢 提交于 2020-01-05 05:54:31
问题 I know some people use ANT to accomplish this, but I don't want to remove HTML comments from the actual jsp, I just want a way to strip them from output unless a users adds a parameter to the url to show the comments for debugging. 回答1: Here is HTMLCompressor lib that can be called either from code or as JSP tag to strip comments and more. 回答2: You can use JtidyFilter with hide-comments set to true . <init-param> <param-name>config</param-name> <param-value>hide-comments: true</param-value> <

Javascript Function Parameters Not Working

泪湿孤枕 提交于 2020-01-05 05:50:11
问题 Every site I've read says a function would just take a parameter if you declare it, however I can't get it to work here. Working like this: <script type='text/javascript'> function trackSubmit() { setTimeout(function(){ ga('send', 'event', 'category', 'action', 'link', 4); }, 100); } </script> And with: <form onsubmit="trackSubmit()"> However, if I try something like this, it doesn't work. <script type='text/javascript'> function trackSubmit(category, action, link) { setTimeout(function(){ ga