How I use an array in class2 if I create it in class1
I have 2 class
class1
create array1
class2
how I use the array1
public class Class11 {
public static void main(String[] args) {
char[] c = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h' };
Class22 c2 = new Class22(c);
class Class22 {
char[] c;
Class22(char[] p) {
c = new char[p.length];
System.arraycopy(p, 0, c, 0, p.length);
}Mark
Similar Messages
-
How to use OracleDbType.Array provided by ODP with User defined type ?
Can anyone help me how to use OracleDbType.Array provided by ODP.NET ?
I need to pass string array to a oracle stored procedure .
User defined array type defined in oracle is :
CREATE TYPE TYPE_NAME IS TABLE OF varchar2(20) ;
This type is defined outside of any package , and i have tested that if definition of type is modified to
CREATE TYPE TYPE_NAME IS TABLE OF varchar2(20) index by binary_integer , i am able to pass array as AssociativeArray to my Stored Procedure.
But how to pass array object if the Type's definition does not contain index by clause ?
Please help how to pass Array object to Oracle Stored Procedure ?The solution described in Passing Array of UDT or Collection as IN OUT using OracleDbType.InputOutput
is working for me.
Edited by: stzueger on Jan 2, 2012 10:32 AM -
How to use the default database service name on creating procedure for data
how to use the default database service name on creating procedure for datagaurd client failover ??? all oracle doc says create a new service as below and enable at DB startup. but our client is using/wanted database default service to connect from application on the datagaurd environment (rac to non rac setup).please help.
Db name is = prod.
exec DBMS_SERVICE.CREATE_SERVICE (service_name => 'prod',network_name =>'prod',failover_method => 'BASIC',failover_type => 'SELECT',failover_retries => 180,failover_delay => 1);
says already the service available.
CREATE OR REPLACE TRIGGER manage_dgservice after startup on database DECLARE role
VARCHAR(30);BEGIN SELECT DATABASE_ROLE INTO role FROM V$DATABASE;
IF role = 'NO' THEN DBMS_SERVICE.START_SERVICE('prod');
END IF;
END;
says trigger created, but during a swithover still the service is listeneing on listener.
tns entry.
prod =
(DESCRIPTION =
(ADDRESS_LIST =
(LOAD_BALANCE = YES)
(ADDRESS = (PROTOCOL = TCP)(HOST = prod1)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = prod2)(PORT = 1521)) ---> primary db entry
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = proddr)(PORT = 1521)) --> DR DB entry
(CONNECT_DATA =
(SERVICE_NAME = prod)
thanks in advance.
Edited by: 854393 on Dec 29, 2012 11:52 AMHello;
So in the example below replace "ernie" with the alias you want the client to use.
I can show you how I do it :
First an entry need to be added to the client tnsnames.ora that uses a SERVICE_NAME instead of a SID.
ernie =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = Primary.host)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = Standby.host)(PORT = 1521))
(CONNECT_DATA =
(SERVICE_NAME = ernie)
)Next the service 'ernie' needs to be created manually on the primary database.
BEGIN
DBMS_SERVICE.CREATE_SERVICE('ernie','ernie');
END;
/After creating the service needs to be manually started.
BEGIN
DBMS_SERVICE.START_SERVICE('ernie');
END;
/Several of the default parameters can now be set for 'ernie'.
BEGIN
DBMS_SERVICE.MODIFY_SERVICE
('ernie',
FAILOVER_METHOD => 'BASIC',
FAILOVER_TYPE => 'SELECT',
FAILOVER_RETRIES => 200,
FAILOVER_DELAY => 1);
END;
/Finally a database STARTUP trigger should be created to ensures that this service is only offered if the database is primary.
CREATE TRIGGER CHECK_ERNIE_START AFTER STARTUP ON DATABASE
DECLARE
V_ROLE VARCHAR(30);
BEGIN
SELECT DATABASE_ROLE INTO V_ROLE FROM V$DATABASE;
IF V_ROLE = 'PRIMARY' THEN
DBMS_SERVICE.START_SERVICE('ernie');
ELSE
DBMS_SERVICE.STOP_SERVICE('ernie');
END IF;
END;
/lsnrctl status - should show the new service.
When I do this the Database will still register with the listener. I don't give that to the clients. That one will still be available but nobody knows about it. Meanwhile "ernie" moves with the database role.
So in my example the default just hangs out in the background.
Best Regards
mseberg
Edited by: mseberg on Dec 29, 2012 3:51 PM -
1,How to use PS to judge the existence of a folder in the specified directory?(use javascript)
2, how to use PS in the specified directory to create to create the folder?(use javascript)
Thanks you!Thanks you!
-
How to use Javascript array in the JSP
hELLO Friends,
I am creating an String array using the values
in the list of a jsp page using Java script..
How can I use this array in the same jsp
file for processing...
any help in this regard would be highly appreciated.
thanks in Advance...
ashishyou cannot pass values from javascript to JSP without having to form-post to another JSP page.
-
Hi, i'm trying to automate a questionary using array.
// In the compositionReady for the stage
sym.actual = 0;
sym.arr = [ "Hi","Love","You" ] // This is my question array.
sym.checkArr = function(){ // this the function that i use to check whis question of the array i'm going to use.
sym.Question = arr[actual]; // i want to use the value "Hi", and then increase my "actual" var and then use the value "Love"
// In my symbol timeline i use a trigger, in that trigger i use
sym.stop();
sym.quest = sym.getComposition().getStage().Question; // I'm getting the Question value;
sym.$("Ask").html(quest ); //"Ask" is an empty textfield;
sym.getComposition().getStage().actual ++; // Increase "actual" for the nex time.
But the code doesn't work, i think the problem is the way i use the array index.
Please help!
Thanks =)Hi there,
chino_10 wrote:
in te timeline trigger why did you use a local variable?
It's good practice to use local variables whenever possible. The quest variable will only apply to that trigger, and it won't carry over to another trigger in the same timeline. So when using a trigger to set the HTML of a text element in the same timeline, I find it cleaner to assign a new HTML value from a local variable.
chino_10 wrote:
and if you are calling the global variable "actual" from de compositionReady handler why didn'y you call it with all the path like "sym.getComposition().getStage().actual ++;"?
I think maybe I didn't express it as clearly as I could have. When you declare sym.actual in compositionReady, you actually have declared a variable scoped to the main stage symbol - it's not a global variable. To declare a global variable (which is not always best practice), your code in compositionReady would be:
actual = 0;
This actual variable would now be accessible from any element/symbol in the composition simply by assigning a value to actual. You may see how this could quickly get messy.
So getting back to variable scope: if you declare a symbol variable using sym.varName, then any element in the same scope can call it using sym.varName. So your main timeline triggers can call it without using the full addressing of sym.getComposition().getStage().actual++. Instead, you could just use sym.actual++. Less code, and easier to read. But if you wanted to call it from another symbol (outside of the scope of the main stage), then you'd have to use the full addressing to actually address the variable, i.e., sym.getComposition().getStage().actual ++.
hth,
Joe -
Morning all,
I am trying to setup an array of numbers however, by looking at the crystal reports help file, I cannot find out how to set one up.
I have created a new formula and inserted
Local NumberVar Array x := MakeArray (1, 2, 3, 4, 5);
however, it says you cannot set a result to an array.
I have also looked at the Array help, but Crystal shows a VB syntax instead of Crystal. (How helpful to show VB syntax in CR!)
My question is how can you use an array in your report that it shows numbers 1-5?
many thanks
Kind Regards
JehanzebThe question is - what you want to do with this array. Your code is correct , beside that you need to return something from formula and that needs to be discrete value.
Local NumberVar Array x := MakeArray (1, 2, 3, 4, 5);
"test" -
How to use an array in a SQL Query
Hi
I need to use an array of numbers such as a VARRAY or Associated Index Array so that I can do the following SQL:
select *
from *
where array is null or id is in array
So that if the array is empty it will return all the records, and if the array is not empty then it will return only the rows associated with the ids in the array.
Is this possible?
Regards,
Néstor BoscánActually, solution I posted returns all rows when VARRAY is empty, not when it is null. To return all rows when VARRAY is null, use:
SQL> select ename
2 from emp
3 where deptno in (select * from table(cast(sys.OdciNumberList(10,30) as sys.OdciNumberList)))
4 or sys.OdciNumberList(10,30) is null
5 /
ENAME
ALLEN
WARD
MARTIN
BLAKE
CLARK
KING
TURNER
JAMES
MILLER
9 rows selected.
SQL> select ename
2 from emp
3 where deptno in (select * from table(cast(null as sys.OdciNumberList)))
4 or null is null
5 /
ENAME
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
ENAME
JAMES
FORD
MILLER
14 rows selected.
SQL> SY. -
How to use Associative Array in sql query?
Hello,
I have a problem on using Associative Array variable on query; and my query is similar to the one below;
TYPE OTHERGENERICS IS TABLE OF NUMBER(10) INDEX BY BINARY_INTEGER;
othersGenerics OTHERGENERICS;
CURSOR cursor_othersGenerics IS
select master.GENERICCODEID
from ASMTRG_ARTICLEMASTER master
join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
group by MASTER.GENERICCODEID
minus
select FGG.GENERICCODEID
from asmtrg_icfocusgroup fg
join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
where fgc.channelid=1 and fg.isactive = 1
group by FGG.GENERICCODEID;
BEGIN
OPEN cursor_othersGenerics;
FETCH cursor_othersGenerics BULK COLLECT INTO othersGenerics;
CLOSE cursor_othersGenerics;
SELECT icfrd.*,
CASE
WHEN EXISTS(select ta.genericcodeid from <???XXX???> ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
ELSE icfrd.icfgroupid
END CLASSIFICATION
FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
AND (yearId IS NULL OR icfrd.YEARID = yearId)
AND (monthId IS NULL OR icfrd.MONTHID = monthId)
END;
By the way this is a part of my function.
The "othersGenerics" is my associative array variable and <???XXX???> is the place where I need to use my "othersGenerics" array to check. So far I've tried
"select ta.genericcodeid from table(cast(otherGenerics as OTHERGENERICS)) ta where ta.genericcodeid = icfgrp.genericcodeid",
"select ta.genericcodeid from table(otherGenerics) ta where ta.genericcodeid = icfgrp.genericcodeid",
"select ta.genericcodeid from otherGenerics ta where ta.genericcodeid = icfgrp.genericcodeid"
and these are not working.
What is your suggestions?Your type will have to be created as an independent object in your schema. So CREATE TYPE cannot be in your function declaration, it has to be outside it. (And then the line inside your declaration that defines the type will have to be removed.)
But now I can see that you use this array as a kind of "temporary lookup table" - you populate the array and then use it for lookup in your select statement. An alternative way of doing this could be like this completely without arrays:
with othergenerics as (
select master.GENERICCODEID
from ASMTRG_ARTICLEMASTER master
join ASMTRG_ARTICLEMAP map on MAP.ARTICLECODEID = MASTER.ID
group by MASTER.GENERICCODEID
minus
select FGG.GENERICCODEID
from asmtrg_icfocusgroup fg
join asmtrg_icfocusgrpchannel fgc on FGC.GROUPID = FG.ID and fgc.isactive=1
join asmtrg_icfocusgengroup fgg on FGG.GROUPID = FG.ID and FGg.ISACTIVE=1
where fgc.channelid=1 and fg.isactive = 1
group by FGG.GENERICCODEID
SELECT icfrd.*,
CASE
WHEN EXISTS(select ta.genericcodeid from othergenerics ta where ta.genericcodeid = icfgrp.genericcodeid) THEN -1
ELSE icfrd.icfgroupid
END CLASSIFICATION
FROM ASMTRGVIW_ICFOCUSREPORTDATA icfrd
LEFT JOIN ASMTRG_ICFOCUSGROUP icfgrp on icfrd.ICFGROUPID = icfgrp.ID
WHERE (channelId IS NULL OR icfrd.CHANNELID = channelId)
AND (asmCodeId IS NULL OR icfrd.ASMCODEID = asmCodeId)
AND (yearId IS NULL OR icfrd.YEARID = yearId)
AND (monthId IS NULL OR icfrd.MONTHID = monthId)
...The with clause (subquery factoring) you can think of as a kind of temp table called othergenerics created "on-the-fly".
The optimizer may decide to actually create a temp table for you and use in the lookup, or it may decide to rewrite the query into suitable joins or nested loops or hashing - whatever the optimizer decides will be the optimal way of doing things :-)
So unless you use your array other places in your function, I would recommend dropping the array completely, skip populating an array, and instead use a with clause for your temporary lookup. -
How to use same form for Editing info and creating info.
Hi all,
Here my aim is to select the user from list and edit the user info. There is one more option to create the new user.
Currently I am using two separate input forms one for Editing and one more creating new user.
Can anyone tel me, how to use the same form for both editing and creating.
Thanks,
Ramesh BiradarHi Ramesh,
I'll make some assumptions about how you're going about this, and then give you a possible solution:
I assume that you have a table with selection on one page. To edit an item, you wish to select it's radio button and click an edit button to take you to another page with the item filled in to edit it. To create a new item, you'd like to click a "new" button and go to the same page.
If this is correct, here's the basic steps:
1). Assuming you have both the list and edit pages already created, make sure you have a JSF navigation case defined going from the list page to the edit page. I'll call this navigation case "goToEditPage" for this discussion.
2). To make the edit button, drag a command button from the component palette and drop it on the af:TableSelectOne (the column in your table containing the radio buttons for selection).
3). Set the action property on this command button to "goToEditPage".
4). Now, to make the create button, drag a command button from the component palette somewhere on the page. I like to put mine in a panelButtonBar inside the actions facet of an af:Page component.
5). Now, for the Action property of this command button, bind it to a method in your page's backing bean. The code will look something like this:
public String performNew()
BindingContainer bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("Create");
Object result = operationBinding.execute();
if (!operationBinding.getErrors().isEmpty())
return null;
return "goToEditPage";
}Hope this is helpful, Ramesh.
Regards,
John -
How to use dynamic parameter when a report is created using Stored Procedures
Hi all,
any one have the idea of how to use dynamic parameter in crystal report XI R2
when report is created using Stored Procedure.
Regards
shashi kant chauhanHi
You can create an SQL command in Database Expert > Expand your datasource > Add command
Then enter the SQL query that will create the list of values to supply to the user
eg select field1,field2 from table
Then edit the parameter of the report. These will be the SP parameters adn can be seen in field explorer.
Change the parameter type to Dynamic
Under the word Value click on Click here to add item
Scroll down to your Command and select one of the values that you want to appear in the list
e.g field1
Then click on the Parameters field - this is essential to create the param
You can edit other options as required
That should do it for you.
I must say that i use CR 2008 connected to Oracle 10g SP, but i reckon this will work for SQL DB and CR XI as well
Best of luck -
I am giving the input below shows
<to>
<email>[email protected]</email>
<email>[email protected]</email>
</to>
i will put the while loop and i count the index values.
in while loop,it takes only one email id.
my coding is
<while condilition=('varindex'<ora:countnodes('inputvariable','payload',/client:to))>
<assign activity>
<first copy rule>
<vartemp= concat('vartemp',"",bpws:getvariabledata('email'))>
<second copy rule>
<varindex = vraindex+1>
</assign>
</while>
but vartemp adds only 1st email id.if i pass <vartemp= concat('vartemp',"",bpws:getvariabledata('email[varindex]'))> ,It shows error.
pls how to retrieve the two email ids using array index.
Edited by: user8984400 on Jan 13, 2010 11:22 PMhave you tried this :
http://clemensblog.blogspot.com/2006/03/bpel-looping-over-arrays-collections.html
or this :
http://oraclebpelindepth.blogspot.com/2008/09/arrays-in-bpel_21.html
your assign should be something like :
before this assign outside the loop you can assign the counter_index to some variable by ora:countnodes('inputvariable','payload',/client:to), and use this variable in the other xpaths
<from expression="concat('/ns1:to/ns2:mail[',bpws:getVariableData('Variable_Index_Counter'),']') "/>
<to variable="Variable_Xpath"/>
notice also the [] characters, you need those together with the index-value to be able to loop over the list of email-elements
hope its clear? -
How to use an array of references
Hi,
I defined a couple of GOOP objects, each of which has a reference. I want to dynamically add/remove these references into/from an array and, in my implementaion, I had this array a globle variable so that different VI's can access it.
But I always got a "refnum conflict" error when I tried to insert a new reference into the array.
Why? Thank you.
-JianchuThanks, Jim.
I am working on some plug-and-play medical instrumentation prototyping. Two GOOP objects (ECG,PO) are developed. In my LabVIEW code, I need to open/close these two objects when corresponding devices connected to/disconnected from the computer.
I want to build a reference array which I can use to operate (primary data storage) the appropriate object.
I browsed your webpage "Object Oriented Design methods in LabVIEW " on OpenG.org. I guess my problem is related to the so-called "Datalog File Refnum Shell", but I don't have an exact idea.
I attached the two GOOP files and a test fie showing the wiring error.
Your help is highly appreciated.
-Jianchu
Attachments:
test_refnum.vi 23 KB
ECG.llb 393 KB
PulseOx.llb 367 KB -
How to use an array for variable name of swing components using NetBeans
I'm completely new to Java and GUIs, so excuse me if I use the wrong terminology. I'm making a JFrameFrom in NetBeans. I'm getting really tired of typing instructions like jTextField15.setText(variable[15].text); I would like to make the variable names of my text fields an array so I can use a loop to change the values, text, tooltips, etc. When I click "change variable name" it won't let me put an array in. The code that Swing generates is protected and I can't change it. I know there must be a way to do this. Any help is appreciated.
Try not to use the NetBeans visual GUI builder. Then it should be easy to create an array of text fields:
JTextField[] tfs = new JTextField[15];
for (int i = 0; i < tfs.length; i++) {
tfs[i] = new JTextField(10);
}For laying out the text fields, see: [http://download.oracle.com/javase/tutorial/uiswing/layout/using.html] -
I want to link nine arrays whose dimension is 2*2 horizontally,but the function 'build array' (concatenated way) made them vertically.........help me please..........maybe this is too simple.........since I am only a students who learnd labview only few months..
Solved!
Go to Solution.A transpose operation only solves certain scenarios, but you don't give enough information on what you actually want.
For example, of you have 3 2x2 arrays:
a1 a2 b1 b2 c1 c2
a3 a4 b3 b4 c3 c4
What should the final vertical result be?
a1 a2
a3 a4
b1 b2
b3 b4
c1 c2
c3 c4
or
a1 a3
a2 a4
b1 b3
b2 b4
c1 c3
c2 c4
Or something else?
Please be much more specific. Maybe even attach a small VI containing typical default data.
LabVIEW Champion . Do more with less code and in less time .
Maybe you are looking for
-
How to delete duplicate entries in match code
I want to delete duplicate entries in match code.
-
Photostream cant be trusted!
When photostream was first announced I thought brilliant, I'm going travelling around the world for 12 months in October and photostream would be the perfect way to beam my photos back home so they are safe for when I return. Travelling with my camer
-
Why is my macbook making the cd startup sound every few hours or within the
first hour it's been on?
-
Friends, I had a question on Sales Document flow. When you expand the document flow of Sales Order or a delivery, you see different status like Sales, Delivery, Picking Request, Invoice & Accounting. In that, Can You give me steps to create Picking r
-
Hello, I have create a role with create, modify and eliminate queries permission. But when I create the query and try to save it, the role with the folder doesnt appear in the role area. I only can save my query in my favourites. Anybody knows what