Is it possible to defne a function inside a component ?
I'd want to can to define a function inside a simple component, for example a JtextArea
I don't know how to do this.
May I do it trought a propertychange event ?, but... I want to use my custom property.... (for example beginning = 15 )
( another way can be to define a custom component, I know ...)
private JTextArea getJTextArea_numlines() {
if (jTextArea_numlines == null) {
jTextArea_numlines = new JTextArea();
jTextArea_numlines.setPreferredSize(new Dimension(28, 206));
jTextArea_numlines.setBackground(new Color(240, 240, 240));
MY_FUNCTION_here<<<<
return jTextArea_numlines;
}Any Idea ? Thanks
tonnot wrote:
I'd want to can to define a function inside a simple component, for example a JtextArea
May I do it trought a propertychange event ?, but... I want to use my custom property.... (for example beginning = 15 )I think you need to describe your question a bit better.
What do you mean by a "my custom property", and what is "beginning = 15"?
If you mean some named constant, then define one. You can even make it public by putting it in a public class or interface; alternatively use an Enum.
As far as a function (I assume you mean method) goes, the same applies. First you need to ask yourself if it's likely to be used anywhere else except in that particular piece of code; if not, there's probably not much point in setting one up.
Winston
Similar Messages
-
How to check for the variable passed to a function inside a component
I'm trying to pass a variable to a function inside of a
component in a conditional statement.
How to check the existance of this variable inside the
function so that I can use the right <CFarguments>:
in aForm.cfm I have:
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="Min"></cfinvoke>
<cfset MCompIDs = ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(MCompIDs,attributes.CompID)>
<cfset isM = true>
<cfelse>
<cfset isM = false>
</cfif>
<cfinvoke component="#application.cfcroot#.business.Order"
method="selOrderItems"
returnvariable="q_OrderItems"
OrderItemAbbreviation="SMEnroll"></cfinvoke>
<cfset SM_CompIDs =
ValueList(q_OrderItems.OrderItemID)>
<cfif listFind(SM_CompIDs,attributes.CompID)>
<cfset isSM = true>
<cfelse>
<cfset isSM = false>
</cfif>
<CFIF isSM>
<cfset temppath = frmcreator.buildFrm(isSMFlag=isSM)>
<CFELSE>
<cfset temppath = frmcreator.buildFrm(isMFlag=isM)>
</CFIF>
On aFormComp.cfc where the function is,
I checked the existance of isSMFlag this way and I got error
saying that :
Context validation error for tag CFARGUMENT.; The tag must be
nested inside a CFFUNCTION tag.
How can I properly check the existance of isSMFlag inside the
function so I can use the right cfarguments?
<CFFUNCTION NAME="buildFrm" access="public"
returntype="String" output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION><CFFUNCTION NAME="buildFrm" access="public"
returntype="String"
output="No">
<cfif StructKeyExists(arguments, "isSMFlag")>
<CFARGUMENT NAME="isSMFlag" REQUIRED="YES"
TYPE="NUMERIC">
<cfelse>
<CFARGUMENT NAME="isMFlag" REQUIRED="YES"
TYPE="NUMERIC">
</cfif>
........ etc
</CFFUNCTION>
NOT this way, that is for sure.
The <cfargument ...> tag is for defining the arguments
a function
accepts either optional or not, but they are not required.
Give this a
try to see the differences.
test.cfc
<cfcomponent>
<cffunction name="a">
<cfdump var="#arguments#">
</cffunction>
<cffunction name="b">
<cfargument name="foo">
<cfargument name="bar">
<cfdump var="#arguments#>
</cffunction>
</cfcomponent>
test.cfm
<cfset something = createObject("component","test")>
<cfoutput>
#something.a("blue","green")#
#something.b("blue","green")#
</cfoutput>
Not tested or debugged so watch out for typos. -
Creating function inside a procedure.
Hi all I am on data base 10g,
is it possible to create a function inside a procedure I don't want to use package.
thanks in advance.Like
SQL> ed
Wrote file afiedt.buf
1 create or replace procedure demo1
2 as
3 dd number;
4 function demo2( a number, b number ) return number
5 as
6 begin
7 return a+b;
8 end;
9 begin
10 dd := demo2(10,30);
11 dbms_output.put_line(dd);
12* end;
SQL> /
Procedure created.
SQL> exec demo1;
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> /
Procedure created.
SQL> exec demo1;
40
PL/SQL procedure successfully completed.
SQL> -
** Embeding BPC functions inside VBA Code **
Hi all,
I am wokring in a BPC application which is a bit more customized and has some complexities.
Basically It's a client-server app, with BPC in backend and Excel as Front end.
Does anyone know whether it's possible to embed BPC functions inside VBA code?
For example, If I want to store a the value of a property of a dimension member into a VBA variable, is it possible?.
Inside VBA,
MyVar = EVPRO("MY_APPS","MEMBER-X","ACTIVE") won't work until VBA is told about the details of EVPRO.
Any idea whether this could work using some special techniques that tell VBA the details about EVPRO and other BPC
functions?
Thanks
DipMHi,
I am not sure if that is possible. Although you can try this below work around.
sheets(1).cells(1,1).value="= EVPRO(""MY_APPS"",""MEMBER-X"",""ACTIVE"") "
MyVar=sheets(1).cells(1,1).value
Although this is just a workaround but works smoothly. Hope this is of some use to you.
Regards,
Badrish -
Is it possible to define a function in the MathScript Node
Is it possible to define a function in the MathScript Node
You can not define a function inside of a MathScript Node, but only because it isn't necessary. The way custom functions work in MathScript is that they are saved in .m files located in paths in the MathScript path list. When the MathScript compiler receives a function that it doesn't recognize, then it searches for it in the path list, and upon finding it, compiles and loads the function. You can specify these search paths manually by going to File>>MathScript Preferences from the MathScript Window or dynamically by using the path() command within a script.
To answer your original question, if you would like to create custom functions dynamically within a VI, then you can simply build your custom functions using strings and then save them to an ASCII file with the extension .m. You could either save the file to a path already in the MathScript path list or you could dynamically specify the path by passing the path into a MathScript Node as a string and by using the path() command at the beginning of your script to set it.
Kind Regards,
E. Sulzer
Applications Engineer
National Instruments -
How to use analytical functions inside a mapping
Hello everybody. Here Isend you a trick that we are using for two years.
If you want to use a function (for instance :ROW_NUMBER() OVER (PARTITION BY ... ORDER BY ...)) inside a mapping you must create an expression with in the INGRP1 the fields you are going to use in the window function and in the OUTGRP1 the function you want. Create an Out -attribute with the expressión and link it to a distinct operator (using a "distinct" you encapsulte the sql and you will be able to use the function inside a filter - in the where clause.). The distinct can eliminate some register (depends on the function). If you validate the expression an error will appear (don't worry about that, the mapping will be ok).
But there is a limitation, you will not be able tou sum over, min over, max over (it detect that they are aggregator functions). Other limitation: the debugger doesn't run with this kind of functions.
Please publish this information on "The Warehouse Builder Utility Exchange". Mi email is [email protected] (if you need more information)It is possible to add SUM, MIN, MAX functions also to OWB releases prior to Paris - You have to put them in double quotes - write "MIN" "MAX" "SUM" etc. The rest of the rules (adding cut-off operator after the expression - as DISTINCT, or UNION ALL) is analogical to with ROW_NUMBER()
That means You can create mapping with following functionality:
SELECT
sum (salary) over (partition by DEPARTMENT) department_salary,
salary,
employee_id,
employee_name
FROM employees_salaries
writing it this way in OWB:
SELECT
"SUM" (salary) over (partition by DEPARTMENT) department_salary,
salary,
employee_id,
employee_name
FROM employees_salaries
Regards,
Martin -
Can i create any procedure or function inside a oracle reserve package?
Hi!
Can i create any procedure or function inside a oracle reserve package. Suppose, I want to create a function called x in the dbms_output package. Can i do that? Or can i extend the features of this package and create/derived a function from it like we extend any class in JAVA. I'm not sure - whether this is at all possible. I'll be waiting for your reply.
Thanks in advance.
Satyaki De.No, but you can write a wrapper package and use that instead of using the Built-In package directly. So, instead of calling DBMS_OUTPUT, you call your own Package.
Steven Feuerstein wrote a wrapper for DBMS_OUTPUT, called P:
Re: DBMS_OUTPUT.PUT_LINE -
Using the result of a function, inside a subselect
Hi!
I´m wondering if it´s possible to use the result of a function inside a subselect. Let me give you an example of what I´m trying to do here:
select * from t_node where node_pk in (get_node_parents_pk(22345));
The function get_node_parents_pk stands in for the following SELECT-statment:
select node_pk from t_node_child where parent_node_pk = 12345
The statement above would return something like this: 12435,23423,23453,23452
These values represent the node_pk value for the parent nodes.
I want the get_node_parents_pk function to return a result set similar to this so that I might call it inside the IN ( ) statement.
Any clue? =)I created a collection type in the database:
CREATE OR REPLACE TYPE nodes_pk_arr IS TABLE OF INTEGER;
The function get_node_parents_pk () is made to return the collection type above. However, this does not work. I get the following error message:
SELECT *
FROM t_node
WHERE node_pk IN
(SELECT * FROM TABLE (get_node_parents_pk (22345)));
ORA-22905: cannot access rows from a non-nested table item
However, if I insert a nodes_pk_arr collection directly into the SQL-statement, like I do below, it works:
SELECT *
FROM t_node
WHERE node_pk IN
(SELECT * FROM TABLE (nodes_pk_arr(24564,23545,34523));
So, when returning the collection from the function I´m told that the collection is not a nested table, when in fact it is. What gives?
Also, is there no way to return a result set directly from the get_node_parents_pk() function, making it possible to write the statement like that shown below?
SELECT *
FROM t_node
WHERE node_pk IN (get_node_parents_pk (22345));
Your reply is much appreciated!
Kind regards
Robert -
Custom aggregate function inside a package.
Hi there,
I'm trying to write a custom aggregate function and group that function inside a package together with some other functions that I have. As an example (to simulate the problem I have) suppose my custom aggregation to do a summation of numbers looks like:
CREATE OR REPLACE TYPE SUM_AGGREGATOR_TYPE AS OBJECT (
summation NUMBER,
STATIC FUNCTION ODCIAggregateInitialize(agg_context IN OUT
SUM_AGGREGATOR_TYPE) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT SUM_AGGREGATOR_TYPE,
next_number IN NUMBER) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT SUM_AGGREGATOR_TYPE,
para_context IN SUM_AGGREGATOR_TYPE) RETURN NUMBER,
MEMBER FUNCTION ODCIAggregateTerminate(self IN SUM_AGGREGATOR_TYPE,
return_value OUT NUMBER, flags IN NUMBER) RETURN NUMBER
CREATE OR REPLACE TYPE BODY SUM_AGGREGATOR_TYPE IS
STATIC FUNCTION ODCIAggregateInitialize(agg_context IN OUT
SUM_AGGREGATOR_TYPE)
RETURN NUMBER IS
BEGIN
agg_context := SUM_AGGREGATOR_TYPE(NULL);
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateIterate(self IN OUT SUM_AGGREGATOR_TYPE,
next_number IN NUMBER)
RETURN NUMBER IS
BEGIN
IF self.summation IS NULL THEN
self.summation := next_number;
ELSIF summation IS NOT NULL THEN
self.summation := self.summation + next_number;
END IF;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateMerge(self IN OUT SUM_AGGREGATOR_TYPE,
para_context IN SUM_AGGREGATOR_TYPE)
RETURN NUMBER IS
BEGIN
self.summation := self.summation + para_context.summation;
RETURN ODCIConst.Success;
END;
MEMBER FUNCTION ODCIAggregateTerminate(self IN SUM_AGGREGATOR_TYPE,
return_value OUT NUMBER, flags IN NUMBER)
RETURN NUMBER IS
BEGIN
return_value := self.summation;
return ODCIConst.Success;
END;
END;
If I write the following function definition:
CREATE OR REPLACE FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER PARALLEL_ENABLE AGGREGATE USING SUM_AGGREGATOR_TYPE;
and corresponding type declaration to test:
CREATE OR REPLACE TYPE VECTOR
IS
TABLE OF NUMBER;
this statement:
select my_sum(column_value) from table(vector(1, 2, 1, 45, 22, -1));
gives the correct result of 70. However, creating a package with the function definition:
CREATE OR REPLACE PACKAGE MY_FUNCTIONS AS
FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER PARALLEL_ENABLE AGGREGATE USING SUM_AGGREGATOR_TYPE;
END;
and calling it via:
select MY_FUNCTIONS.my_sum(column_value) from table(vector(1, 2, 1, 45, 22, -1));
explodes with:
ORA-00600: internal error code, arguments: [17090], [], [], [], [], [], [], [], [], [], [], []
Is it possible to have custom aggregate functions nested inside package declarations?
I'm using Oracle 11g, Release 2 (11.2.0.1.0).HiddenName wrote:
Is it possible to have custom aggregate functions nested inside package declarations?Yes, it is possible, you have succesfuly created your function. Your problem is that the database throws ORA-600 on execute. And with ORA-600 you can do 2 things: 1) google ORA-600 17090 or 2) contact your Oracle Support.
You could also try to declare the function without PARALLEL_ENABLE - just to try to see if it changes anything. You can also try to call your function against a regular table with rows and columns - not against an collection type with table() operator.
Anyway - these 2 tests should be usefull for Oracle Support.
I never tried to put a custom aggregate function into a package. First - the cases when you need a custom aggregate function to be written for your system are very rare. Second - even if I needed 1 then I never needed 2 or more custom aggregate functions on my system. And as I do not like to make my life more complex than necessary, I have created it as a stand-alone function. And it is works (slowly).I tried using a standard table as you suggested:
CREATE TABLE TEST_DATA
test_value NUMBER
INSERT INTO TEST_DATA
(SELECT column_value test_value from TABLE(vector(1, 2, 1, 45, 22, -1)));
COMMIT;
select my_sum(test_value) from test_data;
select my_functions.my_sum(test_value) from test_data;
I also tried removing the PARALLEL_ENABLE clause to create the package as follows:
CREATE OR REPLACE PACKAGE MY_FUNCTIONS AS
FUNCTION MY_SUM(input NUMBER)
RETURN NUMBER AGGREGATE USING SUM_AGGREGATOR_TYPE;
END;
And unfortunately it still breaks with the following error: SQL Error: ORA-00600: internal error code, arguments: [17090]. This looks like an Oracle bug to me as the PL/SQL parsing engine should have disallowed me to even create this if it is not supported in Oracle. Instead, it allows me to create the package, and breaks when I call the function with this weird error (additionally cutting my connection from the database) instead of disallowing me to do this altogether and printing a nice error message telling me that Oracle doesn't support this. How would I go about logging a ticket for this?
Edited by: wcmatthysen on Dec 1, 2010 12:51 PM -
How to passed an xsl parameter to a javascript function inside an xsl styel
Hi:
I am having problem passing an xsl param variable as a parameter to a javascript function inside an
xsl styelsheet.
Here is my xsl stylesheet.
>
<xsl:param name="numberOfRecordsFromDatabase" select="search-result/rec-num" />
<xsl:template name="Body">
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"
onLoad="cloneHeader();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);"
onresize="cloneHeaderResize();window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>);">
</body>
</xsl:template>
I am trying to pass a variable called numberOfRecordsFromDatabase to
a javascript function called window.parent.shrinkIFrame(<xsl:value-of select='$numberOfRecordsFromDatabase'/>).
Is this possible?
If not, is there a way to do this.
Any hint would be greatly appreciated.
Yours,
Frustrated.I would do it like this:
Load the "search-result/rec-num" value into a field within an invisible div tag:
<div id="miscproperties" style="visibility:hidden">
<input id="numberOfRecs" type="text">
<xsl:attribute name="value">
<xsl:value-of select="search-result/rec-num"/>
</xsl:attribute>
</input>
</div>Then, your js function can retrieve the value via
var x = document.getElementById("numberOfRecs").valueR. Grimes -
How to trace static functions inside binary?
Hello Everybody
Is it possible to trace all statically linked functions inside some application with DTrace?
Here is an explanation. I have an application with source code like this:
int main(int argc, char * argv[])
custom_init();
�
void custom_init()
function1();
function2();
�
This code compiled into one binary so all functions like function1, function2 and so on are �statically linked�. I�d like to see calls tree say for function custom_init. I do not know all function names that maybe called from custom_init so I need to log everything down from custom_init.
Is this possible with DTrace if I only have a binary and it contains symbolic info?
Thank youjonathan
Thanks, I got huge list of function names with
supplied command (# dtrace -l -n
'pid$target:myprog::entry' -c /myprog)
Now I'd like to trace all that comes from function
myfunc() inside binary myprog - how do I do this?The usual idiom for this is something like:
# cat > trace.d <<EOF
#!/usr/sbin/dtrace -s
#pragma D option flowindent
pid$target:a.out:myfunc:entry
self->on++;
pid$target:a.out::entry
/self->on/
pid$target:a.out::return
/self->on/
pid$target:a.out:myfunc:return
/self->on/
self->on--;
pid$target:a.out:myfunc:return
/self->on <= 0/
exit(0); /* we've gotten the data we wanted, so exit dtrace */
EOF
# chmod +x trace.d
# ./trace.d -c 'command args'
...This will only get the static functions in the binary; to get all shared library functions as well, s/:a.out::/:::/g.
Inside the {}s for :entry and :return, you can do additional work; for
example, you could print a nanosecond timestamp:
trace(timestamp);
or (for ::return) the return value:
trace(arg1);
etc.
Cheers,
- jonathan -
How to use function inside background job?
I try to call function inside job. It does not work. Is it possible to use function inside job or not. I hope you can help me. Here is my example code.
Start-Job -Name ForestJob {param($v01,$v02)
$line = @()
function test {
return "testvalue"
$t = test
$line += $t
} -ArgumentList $var01, $var02Hi,
Just checking in to see if the suggestions were helpful. Please let us know if you would like further assistance.
TechNet Subscriber Support
If you are
TechNet Subscription
user and have any feedback on our support quality, please send your feedback
here.
Regards, Yan Li -
ReFind question: is it possible to bridle this function? :)
Usually I have to make a loop to find a word using
ReFind(NoCase), changing start position inside on every step.
The question is:
is it possible to "bridle" ReFind function in order make it
return ALL occurences AT ONCE, using some special regular
expression.
For instance, ourString is "Our Rob is a robber of the Robson
bank"
and I want to find all inclusions of "rob"
I wish if
ReFindNoCase((something, but 'rob')*(rob)(something, but
'rob')*)*, ourString, 1, true)
would return all positions of 'rob' occurence here in pos and
len arrays....not sure exactly what you are asking for, but, this is how,
in my support trouble ticket app, i return details of a user query
of a keyword from the knowledge base. in this example, it will
highlight all instances of the "keyword" in either the problem
field or the solution field. just make sure you have a session var
to start of with....
<cfif IsDefined("SESSION.USERFILTER.KEYWORD")>
<cfset replaceWhat = SESSION.USERFILTER.KEYWORD />
<cfset problem = trim(rsGetTicket.Problem) />
<cfset solution = trim(rsGetTicket.resolution) />
<cfloop list="#replaceWhat#" index="what" delimiters="
">
<cfset problem = replaceNoCase(problem,what," <span
style=""background:##6fff68;""> "&what&"</span>
","ALL")>
<cfset problem = replaceNoCase(problem,what," <span
style=""background:##6fff68;""> "&what&"</span>
","ALL")>
<cfset solution = replaceNoCase(solution,what," <span
style=""background:##6fff68;""> "&what&"</span>
","ALL")>
<cfset solution = replaceNoCase(solution,what," <span
style=""background:##6fff68;""> "&what&"</span>
","ALL")>
</cfloop>
<cfoutput>#ParagraphFormat(trim(problem))#</cfoutput></p>
<hr width="100%" size="1" noshade>
<p align="left"><cfif #rsGetTicket.Complete# IS NOT
"0">Solution:<br>
<cfoutput>#ParagraphFormat(trim(solution))#</cfoutput><br>
<br>
Tech:
<cfoutput>#rsGetTicket.CompletedBy#</cfoutput><cfelse>Solution
for this Issue has not been satisfactorily reached. <br>
If you have this issue, please submit a <a
href="sendtt.cfm">trouble
ticket</a>.<br>
</cfif></p></cfif> -
How to find out list of procedures and functions inside a package
How I can find out the list of Procedures and Functions inside a Package.
Look at ALL_PROCEDURES and ALL_ARGUMENTS.
-
How to open labview program with Quit Labview function inside?
Hi Any idea how to open labview program with Quit Labview function inside?
I forgot to add and set the condition of the type for this program.
If the program is an application, it would close straight away.
If it is still labview work, it will go straight to editing program without closing.
So I need to recover, open it and make some changes.
Clement
Solved!
Go to Solution.Put the VI in a project and open it from there, then it shouldn't autorun. You can use App.kind property of application to decide whether to close or not.
/Y
LabVIEW 8.2 - 2014
"Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
G# - Free award winning reference based OOP for LV
Maybe you are looking for
-
Hi I'm Mohammed abwane from Saudi Arabia. I purchased my me I phone 5 last march 2013. One week ago I try to restore this phone but when I arrive to activation point, this ask for apple Id and password. Unfortunately I forget the password and email
-
Dynamic target direcoty - no mapping used
Hi All, I have a file to file scenario like this..... source: \folder1\source1.xml \folder2\source2.xml \folder3\source3.xml target: \test1\source1.xml \test2\source2.xml \test3\source3.xml The files from diffarent folders should be moved to the corr
-
Error "Licensing for this product has stopped working" when you launch Acrobat 9
Hi, I'm part of service desk and my company has several thousand users of Acrobat. There has been strange issues reported since upgrading from 7.0.5 to 9.1 and a lot of them are uhappy. The latest issue is users started to receive the following error
-
Integrating Jakarta taglibs in Jdev 9.0.4 (other than JSTL)
Hello -- I'm having difficulty getting the magic spell for proper integration of Jakarta taglibs other than the JSTL taglibs to work. I've gone into Tools->Manage Libraries->Jsp Libraries and created a new Jsp library based on the .tld file / archive
-
Okay. Question for all those IT wirzards (
Okay. Question for all those IT wirzards (& iTunes) experts out there. Anyone know why a playlist (Purchased) keeps dropping off my playlists in iTunes??l This has happened at least 15-20 times to me in the past couipe of years. Fofrtunately for me,