How to obtain a list of subcontext names within a context?
Hello, I'm just curious if anyone in here has overcome this issue. It'll be great if any of you can help me out a little.
For example...
1) Assume there is 2-3 subcontexts within a context, and 2-3 java objects that is also stored within that context.
2) When you do a search with the returning object flag in search control to true, I'll run to an error when I hit a subcontext, because I created a loop that will store the object into a list by something like
obj = sResult.getObject( ) ;
This came to a conclusion for me that before I store any object, I should obtain a list of the subcontexts within the context, so that I'll not call the getObject( ) method when I get to a subcontext.
Suggestion and advice is welcomed!
Thanks for reading!
Nevermind, problem solved! Thanks for reading... :)
Problem:
I am going through the NamingEnumeration list that gets returned when I call the search method, and within my loop, when I call the getObject( ) method, and if it is a subcontext, then I'll hit an exception which will stop my loop.
Try
Loop
Catch
Solution:
Now, in this case, I can loop, then in my try block, I will store my object, if I get an exception, then I know it is a subcontext, and I'll continue on within my loop.
Loop
Try
Catch
Hope that other people will benefit from this.
Similar Messages
-
How to obtain a list of all extra packages by name only
Please advise how to obtain a list of all extra packages by name only capable of being included in a file.
Romashka wrote:
stonecrest wrote:
Penguin wrote:mine's faster
running abs? i think not
Where do you see here running abs???
for each in $(ls /var/abs/extra);do ls /var/abs/extra/$each; done >file
You need to run abs before using the above line. Penguin's method uses the abs tree. If you don't have an up-to-date tree, your list will be inexact. -
How to put contact list in first name order
how to put contact list in first name order
Settings > Mail, Contacts, Calendars > Contacts > Sort Order/Display Order 'First, Last'
-
How to obtain JNIEnv pointer and jobject reference in arbitrary contexts?
Hi,
I need your hand. How to obtain JNIEnv pointer and jobject reference in arbitrary contexts? (See below source codes for details)
I made some tries according to JNI spec, but still failed to get it work. Could you please provide your solutions? Better show me some source codes.
Thank you very much !!!
#include <jni.h>
#include "MessageThread.h"
#include "MyServer.h"
// this is callback function called by the native C++ library
void processEvent(int progress)
in this function, i want to get "env", "obj" ( HOW? ),
then i can do below to invoke Java function "updateUI":
cls = env->GetObjectClass(obj);
mid = env->GetMethodID(cls, "updateUI", "(I)V");
env->CallVoidMethod(obj, mid, progress);
JNIEXPORT void JNICALL
Java_MessageThread_handleMessageQ(JNIEnv *env, jobject obj)
MyServer* server = MTMServer::Instance();
if (server != NULL)
// must register a callback function before "QueryProgress"
server->RegisterCallback(processEvent);
// query message within a loop, and callback "processEvent" frequently
server->QueryProgress();
return;
}jschell, thanks for your suggestions.
And caching the second is definitely wrong. Arguments are passed as local references. The reference lifetime is only guaranteed for the lifetime of the method call.In my case, it just works, because my "callback" is only called before the "handleMessageQ" returns, which means it's within the lifetime of "jobject", etc.
Use GetEnv to get the environment.Could you please provide some sample codes?
Create a static java method which returns the object reference. In your callback call that method to get the reference that you want to work with. I didn't really understand. Could you please show me some sample codes?
Thanks a lot! -
How to get a called procedure/function name within package?
Hi folks,
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
For example:
CREATE OR REPLACE PACKAGE BODY "TEST_PACKAGE" IS
PROCEDURE proc_1 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
api_log.trace_data(sysdate, 'END.' || ???????);
END;
PROCEDURE proc_2 IS
BEGIN
api_log.trace_data(sysdate, 'START.' || ???????);
proc_1;
api_log.trace_data(sysdate, 'END.' || ???????);
END;
END; I would like to replace "???????" with a function which would return a name of called procedure, so result of trace data after calling TEST_PACKAGE.proc_2 would be:
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_2*
11.1.2013 09:00:01 START.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_1*
11.1.2013 09:00:01 END.*TEST_PACKAGE.proc_2*I tried to use "dbms_utility.format_call_stack" but it did not return the name of procedure/function.
Many thanks,
Tomas
PS: I don't want to use an hardcodingYou've posted enough to know that you need to provide your 4 digit Oracle version (result of SELECT * FROM V$VERSION).
>
is it possible to obtain a called procedure/function name within package?
For a measuring and tracing purpose, I would like to store an info at the beginning of each procedure/function in package with timestamp + additional details if needed.
>
I usually use this method
1. Create a SQL type for logging information
2. Put the package name into a constant in the package spec
3. Add a line to each procedure/function for the name.
Sample package spec
* Constants and package variables
gc_pk_name CONSTANT VARCHAR2(30) := 'PK_TEST';Sample procedure code in package
PROCEDURE P_TEST_INIT
IS
c_proc_name CONSTANT VARCHAR2(80) := 'P_TEST_INIT';
v_log_info TYPE_LOG_INFO := TYPE_LOG_INFO(gc_pk_name, c_proc_name); -- create the log type instance
BEGIN
NULL; -- code goes here
EXCEPTION
WHEN ??? THEN
v_log_info.log_code := SQLCODE; -- add info to the log type
v_log_info.log_message := SQLERRM;
v_log_info.log_time := SYSDATE;
pk_log.p_log_error(v_log_info);
raise;
END P_PK_TEST_INIT;Sample SQL type
DROP TYPE TYPE_LOG_INFO;
CREATE OR REPLACE TYPE TYPE_LOG_INFO AUTHID DEFINER AS OBJECT (
* NAME: TYPE_LOG_INFO
* PURPOSE: Holds info used by PK_LOG package to log errors.
* Using a TYPE instance keeps the procedures and functions
* independent of the logging mechanism.
* If new logging features are needed a SUB TYPE can be derived
* from this base type to add the new functionality without
* breaking any existing code.
* REVISIONS:
* Ver Date Author Description
* 1.00 mm/dd/yyyy me Initial Version.
PACKAGE_NAME VARCHAR2(80),
PROC_NAME VARCHAR2(80),
STEP_NUMBER NUMBER,
LOG_LEVEL VARCHAR2(10),
LOG_CODE NUMBER,
LOG_MESSAGE VARCHAR2(1024),
LOG_TIME TIMESTAMP,
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT
) NOT FINAL;
DROP TYPE BODY TYPE_LOG_INFO;
CREATE OR REPLACE TYPE BODY TYPE_LOG_INFO IS
CONSTRUCTOR FUNCTION type_log_info (p_package_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_proc_name IN VARCHAR2 DEFAULT 'Uninitialized',
p_step_number IN NUMBER DEFAULT 1,
p_LOG_level IN VARCHAR2 DEFAULT 'Uninit',
p_LOG_code IN NUMBER DEFAULT -1,
p_LOG_message IN VARCHAR2 DEFAULT 'Uninitialized',
p_LOG_time IN DATE DEFAULT SYSDATE)
RETURN SELF AS RESULT IS
BEGIN
self.package_name := p_package_name;
self.proc_name := p_proc_name;
self.step_number := p_step_number;
self.LOG_level := p_LOG_level;
self.LOG_code := p_LOG_code;
self.LOG_message := p_LOG_message;
self.LOG_time := p_LOG_time;
RETURN;
END;
END;
SHO ERREdited by: rp0428 on Jan 11, 2013 10:35 AM after 1st cup of coffee ;) -
How to obtain the list of procedures and functions
hi,
how can I obtain the list of all the stored procedure & functions in the database?SELECT * FROM DBA_OBJECTS WHERE OBJECT_TYPE IN ('FUNCTION','PROCEDURE')
Cheers -
Hi,
I am trying to make a flexible script to get the Service Account Name from several servers.
I am using "servername.master.dbo.xp_instance_regread.......", but I want to use a variable for the servername.
So I started doing this:
Declare @servername varchar(100)
Declare @SQL varchar(1000)
Declare @agtServAccName varchar(250)
set @servername = 'Server1'
set @sql = @servername + '.master.dbo.xp_instance_regread
N''HKEY_LOCAL_MACHINE'',
N""SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT'',
N''ObjectName'',
@AgtServAccName Output,
N''no_output'''
Execute (@SQL)
How am I able to get a flexible script (@sql), which gives me the Service Account Name of the server called @servername after I execute this script (@sql)
If there is another way without this regread, I like to hear that too ofcourse...
EDIT: the reason I use a variable for the servicename is, that I am running it on a central management server and not on the server with this servername itself.This did the trick. Now I can loop through all my centrally managed servers and obtain the Service Account Names.
Thanks for the help. There's probably a better way to do it (sp_executesql?) , but at least I got something.
Declare @ServerName varchar(50)
Declare @SQL as varchar(500)
If object_id('tempdb..#ServAccName') is not null
drop table #ServAccName;
create table #ServAccName (ServAccName varchar(50))
set @ServerName = 'Server1'
set @SQL = '
declare @ServAccName varchar(50)
execute ' + @ServerName + '.master.dbo.xp_instance_regread
HKEY_LOCAL_MACHINE,
''SYSTEM\CurrentControlSet\Services\MSSQLServer'',
ObjectName,
@ServAccName OUTPUT
Insert #ServAccName Select @ServAccName
Exec (@SQL)
Select ServAccName from #ServAccName -
How to obtain the enhancement through exit name
Hi Folks,
I'm having some trouble finding the enhancement name for transaction SMOD through a given exit name. I was wondering how do you obtain the enhancement containing the exit.
In my particular case I'm looking for the enhancement for the exit: EXIT_SAPLFMFA_004.
Thanks in advance.
Regards,
Gilberto LiHi dyan,
You can see the enhancement of a particular exit in the table MODSAP.
In SE16 goto table MODSAP
In the selection field MEMBER give your name (ex: EXIT_SAPMQEVA_008)
The name field is your enhancement ( in this case QEVA0008 ).
Gilberto's trick wont work always. The above example shows you that.
if you want to see the project in which your enhancement has been added.
Got table MODACT and type your enhancement in the 'MEMBER' selection field.
This time the NAME is your project in which your enhancement has been implemented.
Cheers!!
~goldie. -
How to obtain plot list from xy graph
Hi!
I have a XY Graph and I wnat to get the number of Plots in that Graph. There is no Property for this.
Anyone knows how to do this?
Bya
hmannhi
i don't know, but try it with the "array size" function... a xy-graph is a 1d-array of clusters. in these clusters there are two 1d-array which represent x and y coords. the "array size" function should return the number of plots (clusters) of the xy-graph.... try it and let me know if it works..
ciao -
How to Obtain Detailed List of All Workbooks in Oracle Discoverer Database
Hi,
Is it possible to create a query that would give me a list of all workbooks in my Oracle Discoverer Database that includes what tables were selected to create the query including any conditions?
Please let me know.
Thanks.Hi Becky,
Discoverer should be bundled with the EUL V5 Business area. I'm not sure which versions have it, so i'm hoping its all of them. It allows you to construct reports on the workbooks in the database, when they were last run etc. I'm not sure if you can report on database tables though.
I found some useful documentation on installing and using this here http://download-uk.oracle.com/docs/html/B10270_01/eul_stat.htm#1004700
I hope this of use to you.
Regards,
Lloyd -
How to obtain a list of a manager's direct employees and the manager
Hi
Currently I am using the evalutaion path "MSSDIREC" for various reports, i.e. phonelist. We now want the reports extended so they not only shows the employees directly under the manager, but also the manager him-/herself.
Is there a standard evaluation path for this purpose. I have tried with O-S-P, but it also returns the employees of organizations under the manager, which is not what we want. We only want the first level under the manager.
Any suggestions?
/JakobHi Jakob,
Go to SM30 - T778A table.
Create a new evaluation path as follows:
01 S A 003 O
02 O B 003 S
03 S A 008 P
Regards,
Dilek -
Script to get tab delimited list of folder names within a main directory
I need a script to create a tab delimited text file of the names of each folder within a specific folder. Haven't found anything...Anybody have an idea how to proceed?
Muchas gracias!Now that I think about this a little more, I'm guessing you want two further pieces of information.
You don't want just the name of the folders, you want their path, and you want to capture subfolders as well, correct?
If that's the case, try this:
tell application "Finder"
-- get the starting folder
set topFolder to (choose folder with prompt "Please select the top folder")
-- get all subfolders
set subfolders to (every folder of entire contents of topFolder as alias list)
-- open a file to write the data to
set myFile to (open for access file (((path to desktop folder) as text) & "folders.txt") with write permission)
set eof myFile to 0
-- remember our current TIDs
set oldTID to my text item delimiters
-- iterate through the folders
repeat with eachFolder in subfolders
-- break the path based on colons
set my text item delimiters to ":"
set folderPath to text items of (eachFolder as text)
-- set the TIDs to a tab
set my text item delimiters to tab
- and convert the path to a tab-delimited string
set tabDelimitedText to folderPath as text
-- now write that text to the file
write tabDelimitedText & return to myFile
end repeat
-- clean up, restoring TIDs to what they were
set my text item delimiters to oldTID
-- and close the file
close access myFile
end tell -
WAD - How to obtain a button group list
Hi all, I'm trying to add in my report, using a WAD, a list of button.
In particular, adding a button_group_item, in a runtime scenario I obtain:
button1 button2 button3
How to obtain a list like this:
button1
button2
button3
in the same tray object ?
Thanks in advance for your collaboration
GianfrancoHello, I solve on my own using CONTAINER_LAYOUT.
Gianfranco -
A very simple question: how to obtain the mail server name?
In our JSP application, at one point an email will be sent to notify one event. Currently, that is done by using the html tag: mailto. To have more control on the email in tems of context format (a bad layout right now) and others. I would like to have it processed at servlet by using the JavaMail API, so that it have a nice format and have the sender's email address right in case email client is not installed in the machine where the browser in. The JavaMail API is straight forward. The question is how to obtain the mail server name, and the sender's email address if there is one?
Thanks.
v.How to obtain the mail server's name? It's your server, you should know its name. Or if it isn't your server, you should ask the administrator for its name. Point is, you need to decide in advance what server you are going to use and hard-code its name into the program or into a properties file.
And how to obtain the client's e-mail address? You have to ask the client, probably by putting a box in the HTML and asking them to type it. -
Does anyone know how to generate a list of file names in a book?
To generate a list of filenames you could create a new paragraph format, e. g. #Filename. Then insert a #Filename paragraph that contains only FM's filename variable. Repeat this for every chapter of your book.
Finally generate a list of paragraphs for the book, which lists all #Filename paragraphs.You may want to remove <$pagenum> from the LOP reference page so that it doesn't appear in the output.
If you have that generated list, you can either include it as part of the book or save as text to get a list of files externally. If you are just after the filenames, Arnis' suggestion is probably easier.
Johannes
Maybe you are looking for
-
Crystal Report 11 error "AccessViolationException was unhandled" on windows
We have migrated VB code to VS 2010. We are using Crystal Report 11 with Visual Studio 2010, Crystal report is working fine with other Windows OS but not working in Windows 7 OS it throws an error "AccessViolationException was unhandled". We are usin
-
Email PDF Form and Sign Entire Submission - Can this lock the form and show the signature?
Thanks to those who explained how to create a button that allows me to email a form as a PDF rather than XML. It helped me a great deal. Now I want to cause our time sheet adjustment form to be emailed from the employee to their supervisor, and have
-
Can't share files from GB to iTunes.
Now that I am using the new GB I am not able to share files with iTunes that I used to be able to share. I get a message saying "The bounce file exceeds the maximum file size." It says to change the format to CAF but I don't see where to do that.
-
Cant Open PDF document-its always ask me to save it first
I can not open a PDF document in adobe reader, it is always asking me to save it first
-
The windows keep opening randomly. Also, the screen content magnifies on its own.