Noob question on function calls
I just converted a script from VBScript and wrote the function calls to look the same. The problem is the functions don't work as expected.
Here is my function to delete some characters I don't want from a string, and return the string back to me. I'm sure there is some very simple issue with the variable / object references that is the reason why the input string gets passed back unaltered,
even if it contains spaces or single quote marks.
This function is part of a section of code which converts people's names into logon names, by removing spaces and illegal characters from the names.
function CleanString($InputStr)
$DirtyChars = "?", "/", "\", ":", "*", '", "<", ">", ",", "&", "#", "~", "%", "{", "}",
"+", "_", ".", `', " "
foreach ($char in $DirtyChars)
$InputStr = $InputStr.Replace($char,"")
return $InputStr
Hi there,
It look like there's a problem with your $DirtyChars variable:
DirtyChars = "?", "/", "\", ":", "*",
'", "<", ">", ",", "&", "#", "~", "%", "{", "}", "+", "_",
".", `', " "
Similar Messages
-
Questions - dereferenced Function Call, form capitalization
Hey two quick questions.
I'm wondering if I can call a com object function given that
I have the string instead of the function name.
ie. Instead of
MyComObject.fucntionName(parameter);
something like this
stringVariable = functionName
MyComObject.stringVariable(parameter);
I know the syntax is incorrect but does anyone know how to do
this in coldfusion?
QUESTION #2 :
I'm doing something like the following,
for (keyName in FORM) {
if (FORM[keyName] IS NOT "")
WriteOutput("FORM." & Keyname & " has the value: "
& FORM[keyName] &"<br>");
However all the Keynames come out capitalized.quote:
Originally posted by:
BigRJJJ
Hey two quick questions. ... ...
However all the Keynames come out capitalized.
These are not really quick questions. Suggest you repost
question 1 on another thread and provide details of the COM
function and which CF version you are using.
As for CF uppercasing all the names of form fields, that's a
"feature"! ;-)
If you want the original case, then you need to process the
raw post for that.
See the attached code. -
How to call a C function calling a Java Method from another C function ?
Hi everyone,
I'm just starting to learn JNI and my problem is that I don't know if it is possible to call a C function calling a Java Method (or doing anything else with JNI) from another C function.
In fact, after receiving datas in a socket made by a C function, I would like to create a class instance (and I don't know how to do it too ; ) ) and init this instance with the strings I received in the socket.
Is all that possible ?
Thank you very much for your help !Hard to understand the question, but by most interpretations the answer is going to be yes.
You do of course understand that JNI is the "API" that sits between Java and C and that every call between the two must go through that. You can't call it directly. -
Java function call from Trigger in Oracle
Moderator edit:
This post was branched from an eleven-year-old long dead thread
Java function call from Trigger in Oracle
@ user 861498,
For the future, if a forum discussion is more than (let's say) a month old, NEVER resurrect it to append your new issue. Always start a new thread. Feel free to include a link to that old discussion if you think it might be relevant.
Also, ALWAYS use code tags as is described in the forum FAQ that is linked at the upper corner of e\very page. Your formulae will be so very much more readable.
{end of edit, what follows is their posting}
I am attempting to do a similar function, however everything is loaded, written, compiled and resolved correct, however, nothing is happening. No errors or anything. Would I have a permission issue or something?
My code is the following, (the last four lines of java code is meant to do activate a particular badge which will later be dynamic)
Trigger:
CREATE OR REPLACE PROCEDURE java_contact_t4 (member_id_in NUMBER)
IS LANGUAGE JAVA
NAME 'ThrowAnError.contactTrigger(java.lang.Integer)';
Java:
CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "ThrowAnError" AS
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
// Connect and verify new insert would be a duplicate.
public static void contactTrigger(Integer memberID) throws Exception {
String badgeId;
// Create a Java 5 and Oracle 11g connection.
Connection conn = DriverManager.getConnection("jdbc:default:connection:");
// Create a prepared statement that accepts binding a number.
PreparedStatement ps = conn.prepareStatement("SELECT \"Note\" " +
"FROM Users " +
"WHERE \"User\" = ? ");
// Bind the local variable to the statement placeholder.
ps.setInt(1, memberID);
// Execute query and check if there is a second value.
ResultSet rs = ps.executeQuery();
while (rs.next()) {
badgeId = rs.getString("Note");
// Clean up resources.
rs.close();
ps.close();
conn.close();
// davids badge is 105463705637
EConnection mEngineConnection = new econnection("10.25.10.5",8550);
mEngineConnection.setUserCredentials("choff", "badge00");
mEngineConnection.call("/epe/cfg/tagcommandadd?tagid=105463705637&cmd=mmt%203");
mEngineConnection.call("/epe/msg/tagsendmsg?tagid=105463705637&messagetype=instant&message=Hello%20World%20from%20Axium-Oracle");
Edited by: rukbat on May 31, 2011 1:12 PMTo followup on the posting:
Okay, being a oracle noob, I didn't know I needed to tell anything to get the java error messages out to the console
Having figured that out on my own, I minified my code to just run the one line of code:
// Required class libraries.
import java.sql.*;
import oracle.jdbc.driver.*;
import com.ekahau.common.sdk.*;
import com.ekahau.engine.sdk.*;
// Define class.
public class ThrowAnError {
public static void testEkahau(Integer memberID) throws Exception {
try {
EConnection mEngineConnection = new EConnection("10.25.10.5",8550);
} catch (Throwable e) {
System.out.println("got an error");
e.printStackTrace();
}So, after the following:
SQL> {as sysdba on another command prompt} exec dbms_java.grant_permission('AXIUM',"SYS:java.util.PropertyPermission','javax.security.auth.usersubjectCredsOnly','write');
and the following as the user
SQL> set serveroutput on
SQL> exec dbms_java.set_output(10000);
I run the procedure and receive the following message.
SQL> call java_contact_t4(801);
got an error
java.lang.NoClassDefFoundError
at ThrowAnError.testEkahau(ThrowAnError:13)
Call completed.
NoClassDefFoundError tells me that it can't find the jar file to run my call to EConnection.
Now, I've notice when I loaded the sdk jar file, it skipped some classes it contained:
c:\Users\me\Documents>loadjava -r -f -v -r "axium/-----@axaxiumtrain" ekahau-engine-sdk.jar
arguments: '-u' 'axium/***@axaxiumtrain' '-r' '-f' '-v' 'ekahau-engine-sdk.jar'
creating : resource META-INF/MANIFEST.MF
loading : resource META-INF/MANIFEST.MF
creating : class com/ekahau/common/sdk/EConnection
loading : class com/ekahau/common/sdk/EConnection
creating : class com/ekahau/common/sdk/EErrorCodes
loading : class com/ekahau/common/sdk/EErrorCodes
skipping : resource META-INF/MANIFEST.MF
resolving: class com/ekahau/common/sdk/EConnection
skipping : class com/ekahau/common/sdk/EErrorCodes
skipping : class com/ekahau/common/sdk/EException
skipping : class com/ekahau/common/sdk/EMsg$EMSGIterator
skipping : class com/ekahau/common/sdk/EMsg
skipping : class com/ekahau/common/sdk/EMsgEncoder
skipping : class com/ekahau/common/sdk/EMsgKeyValueParser
skipping : class com/ekahau/common/sdk/EMsgProperty
resolving: class com/ekahau/engine/sdk/impl/LocationImpl
skipping : class com/ekahau/engine/sdk/status/IStatusListener
skipping : class com/ekahau/engine/sdk/status/StatusChangeEntry
Classes Loaded: 114
Resources Loaded: 1
Sources Loaded: 0
Published Interfaces: 0
Classes generated: 0
Classes skipped: 0
Synonyms Created: 0
Errors: 0
.... with no explanation.
Can anyone tell me why it would skip resolving a class? Especially after I use the -r flag to have loadjava resolve it upon loading.
How do i get it to resolve the entire jar file?
Edited by: themadprogrammer on Aug 5, 2011 7:15 AM
Edited by: themadprogrammer on Aug 5, 2011 7:21 AM
Edited by: themadprogrammer on Aug 5, 2011 7:22 AM
Edited by: themadprogrammer on Aug 5, 2011 7:23 AM
Edited by: themadprogrammer on Aug 5, 2011 7:26 AM -
How to get transaction id of a function called in background
Hi all,
does someone know how to retrieve t-id of a function called in background (tRFC) client side? I found
'ARFC_GET_RECEIVER_TID'
'ARFC_GET_TID'
but these works server side (function called knows its t-id .. caller no). Is there some similiar client side so that after calling function I can retrieve its transaction id ? I know it's not the same context, for explaining better, what I need it's something like fork() in C, where process father (the one that forks) receive as return value process id of process forked.
SEARCHING ON FORUM I see that many people answered on question about transaction id with sy-tcode misunderstanding the question. This transaction id it's not the tcode. This is the char 32 unique transaction code
thank you
regards
GabrieleYou can have a look at function TRFC_RECEIVER_INFO
[qRFC API for the Inbound Queue|http://help.sap.com/saphelp_nw04/helpdata/en/21/5c5f3ca0dd9770e10000000a114084/content.htm] -
Function calling stored procedure that returns a cursor into a LOV
Hello,
Is it possible in HTML DB to implement a process that has a function that calls a stored procedure that returns a cursor, used to then populate a select list?
Or can I do a function call to a stored procedure in the 'List of values definition' box for the item itself that returns a cursor to populate the item's select list?Hi Vikas,
Actually, I just found another posting that shows how to do what I'm looking for:
Re: Filling a LOV with a cursor
Check it out. I posted another question in response to that discussion...maybe you could answer that? Thanks!
Laura -
Intermittent Runtime error - pure virtual function call
I have an intermittent runtime error - pure virtual function call & don't know what cause it? Since It only occurs & crashes once awhile therefore it's difficult to trap it for debugging.I suspect it come from TestStand ActiveX API which I use in my User Interface Application project but I'm not really sure.
Does anyone experience this kind of problem when working with TestStand API ? If so any
suggestion? I have noticed in the TestStand API header file teapi.tlh contain many raw_.... function defined as pure virtual function. What are these raw_... function ? I don't think I use any of these function in my project.
Many thanks!Danh,
I don't believe that your problem can be solved with the information you have provided unless someone else has experienced the same symtpoms which coincidentally have the same cause as in your case.
Is there any other information you can provide that can help localize the problem?
1) What is happening when the error occurs?
2) Does the error always occur in the same place?
3) Does it always occur with use of certain resources (e.g. DAQ, GPIB, VISA, printer)?
4) Does it occur when using the sequence editor?
5) Does it occur when using one of the shipping operator interfaces?
6) Does it occur only when using your operator interfaces?
7)Is it related to a specific sequence or any sequence?
8) Does it happen when you executed your sequence with/without a process model entr
y point (i.e. Execute>>Test UUTs, Execute>>Singal Pass or Execute>>Run MainSequence)?
9) How often does it happen?
10) What version of TestStand are you using?
11) With what language (include versions) are you programming your code modules?
12) With what language (include versions) are you programming your operator interface?
13) Is there any error code reported with this error message?
14) Is this error reported in a TS run-time error dialog or is it reported directly 1by the operating system?
15) Have you searched the web for related errors? For example, the following link describes a particular programming mistake that can lead to this error
http://support.microsoft.com/support/kb/articles/Q125/7/49.asp
By investigating answers to the above questions you may be able to narrow the cause of this error, which might allow you or others to help solve the problem. -
Erreur R6025 "pure virtual function call"
Bonjour
Ci-joint un Vi labview, crée par Signal express. Fonctionnent pendant 24h, puis erreur : R6025, Pure virtual function call .
On clique sur OK, puis fermeture de LABVIEW.
Ce programme, doit enregistrer 24/24 des mesures qui sont stockées dans des variables partagées.
Ces variables partagées sont remplies par un autre Vi d'acquisition.
Attachments:
Neutronique Harchivage.vi 301 KBBonjour,
L'erreur R6025 est une erreur Windows qui semble liée à des problèmes réseaux ou des paramètres Windows.
Vous pouvez essayer ces quelques solutions :
- désactiver le Firewall,
- désactiver les anciennes version du Run-Time Engine de LabVIEW.
Pour nous aider à mieux comprendre votre problème, voici quelques questions supplémentaires :
- Quelle version de LabVIEW et de SignalExpress avez-vous? Quelle version de Windows ?
- Est-ce qu'une mise à jour de Windows a eu lieu au moment de l'erreur ou dans les jours avant le lancement du programme?
- Est-ce que le programme a déjà fonctionné ?
Cordialement,
Charlotte F. | CLAD
National Instruments France
#adMrkt{text-align: center;font-size:11px; font-weight: bold;} #adMrkt a {text-decoration: none;} #adMrkt a:hover{font-size: 9px;} #adMrkt a span{display: none;} #adMrkt a:hover span{display: block;}
>> "Du 11 octobre au 17 novembre, 2 sessions en parallèle : bien démarrer - approfondir vos connais... -
Data error (invalid data type 17) in a Remote Function Call
Hi,
I am passing 2 select-option tables to RFC.
Tables have structures -
Table1 SIGN(C1)
OPTION(C2)
HIGH(C6)
LOW(C6)
Table2 SIGN(C1)
OPTION(C2)
HIGH(C20)
LOW(C20)
At the destination side, I have created two table types which have same structure.
But when I call the RFC , program terminates with error - "Data error (invalid data type 17) in a Remote Function Call"
Not able to understand the reason for this error. Please help.
Thanks,
SujeetHi,
check out this example
[LINK|http://abap.googlar.eu/viewtopic.php?f=5&t=28]
You have several ranges that you can use like RANGE_AUF.
Function example:
FUNCTION zexemple.
*"*"Interface local:
*" IMPORTING
*" REFERENCE(R_HORA) TYPE FLAG
*" REFERENCE(R_DIA_1) TYPE FLAG
*" REFERENCE(P_IDOC) TYPE FLAG
*" EXPORTING
*" REFERENCE(MSG) TYPE CHAR255
*" TABLES
*" T_OIFSPBL STRUCTURE OIFSPBL
*" SL_PBLNR STRUCTURE RANGE_PBLNR
*" SL_MATNR STRUCTURE RANGE_MATNR
*" SL_HORA STRUCTURE RANGE_UZEIT
*" T_ERROS STRUCTURE ZARSTRING
ENDFUNCTION.
Report:
SELECT-OPTIONS: sl_pblnr FOR oirbpblb-pblnr,
sl_matnr FOR a361-matnr.
~
Final question:
You are passing the values using TABLES and not IMPORTING right? -
Execute Oracle Package Function call from FORTE
Has anyone EVER successfully execute an Oracle Package Function call from FORTE
via " sql execute procedure "?
Here's my question, I am able to execute a stored procedure but hasn't figured
out a way to execute a function which defined in a package. The syntax goes
like this: sql execute procedure <PackageName>.<FunctionName> ( input
input_parm, output output_parm). If anyone EVER successfully execute a
function, please let me know, thanks.You'll need to provide a column alias for the function call:
select func(val) as alias from dual -
More function calls in stored procedure
Hi,
I would like to know if there are more function calls in a PL/SQL stored procedure, would it affect the performance of this procedure?
Or will it be more efficient to have the body of those functions inside the procedure itself.
Of course a method call is always costlier than the monolithic procedure but my question is how much would be difference in performance.
Rgds
VaradYes, avoid using UDF , means especially a scalar udf... See how you can re-write a scalar udf as table valued udf.
http://sqlblog.com/blogs/alexander_kuznetsov/archive/2008/05/23/reuse-your-code-with-cross-apply.aspx
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence -
OCI Function call vs Odatabase Class
In my application I've used ODatabase class to
open a database connection.
At the same time, I use OCI function calls method to connect to the same database. This is use to execute store procedure & query.
My question is that does it cause double connection to Oracle?Yes.
-
CATCHABLE EXCEPTIONS in the remote function call (RFC)
Please tell me what are the CATCHABLE EXCEPTIONS in the remote function call (RFC) and to which exception class do they belong????
Thanks in advance.
Dinesh DhimanHI,
With external function calls, the EXCEPTIONS addition of the CALL FUNCTION command can be used to assign return values to the exceptions defined in the interface of the called function module. Class-based exceptions cannot be propagated to the caller from a remotely-called function module, and have the effect of an exception that cannot be handled.
As well as the exceptions defined in the interface of the called function module, an external function call can also have the following predefined exceptions:
The <b>SYSTEM_FAILURE</b> exception is the response to a runtime error that occurs when the remotely-called function module is executed.
The <b>COMMUNICATION_FA</b>ILURE exception occurs when the connection to the partner system cannot be established or if the connection is lost during communication.
Note
We strongly recommend that you assign a return value to both these exceptions for every RFC, and that you handle this return value, as otherwise a runtime error will occur in the exception situations in question.
Regards,
Sesh -
Function calls to a dll compiled by matlab
In matlab I created a dll. I now need to access the functions within this dll from my java application.
How is this achieved?
Thanks,
Anuj.Could you provide example code to how a method in a dll,
that wasn't compiled in java can be accessed. The method
i am trying to call is called "test" and the dll is called test.dll.You cannot call a dll directly from java, as jsalonen suggested. Instead you have to create a JNI DLL and do all the native work you wand from there.
In the native implementation of the test method you should call LoadLibrary to load the matlab dll and GetProcAddress to get the addresses of the functions that you want to call. As you can see, we have now switched from Java Programming to Windows development, so if you have trouble doing the above, then you should try to find a more appropriate forum to post your questions
LoadLibrary function:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/loadlibrary.asp
GetProcAddress function:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getprocaddress.asp
DLLs in general
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/dynamic_link_libraries.asp
Hope these help. -
I know that every thread has it own stack which is not shared with the other threads.
Now for example, I have a program like:
Whenever a user connects to the server a separate thread is created and receive method is called.
mythread = new thread(this);
mythread.start();
public void run()
receive(3,4);
public void receive(int a, int b)
MyClass my = new MyClass();
my.add(a,b);
my.sub(a,b);
//MyClass is in separate file
public class MyClass
public void add(int a, int b)
a+b;
public void sub(int a, int b)
a-b;
}Now my question is that, weather the functions calling i.e, add(), sub(), in receive() method will be thread safe and will be in the same thread's stack they belong ???
Edited by: Muhammad Umer on May 3, 2011 12:08 PMHere is the actual code:
public boolean startServer()
boolean isServerStarted = true;
try
welcomeSocket = new ServerSocket(6789);
//System.out.println("Server is started on : "+welcomeSocket.getInetAddress()+"and on port: "+welcomeSocket.getLocalPort());
catch (IOException ex)
isServerStarted = false;
System.out.println("could not start server");
ex.getMessage();
while(true)
try
connectionSocket = welcomeSocket.accept(); // connectionSocket is class variable
System.out.println("client connected with address: "+connectionSocket.getRemoteSocketAddress());
// serverThread = new Thread(this);
// serverThread.start();
RequestHandler reqhanlder = new RequestHandler(connectionSocket);
reqhanlder.start();
catch (IOException ex)
isServerStarted = false;
System.out.println("could not start server");
ex.getMessage();
public void receiveData (Socket connectionSocket)
byte [] certData = null;
byte [] idData = new byte[13];
try
DataInputStream dataFromClient = new DataInputStream(connectionSocket.getInputStream());
byte[] data =new byte[dataFromClient.available()];
int read = dataFromClient.read(data);
System.out.println("Data length is: "+data.length);
if( read != -1)
certData = new byte[data.length - idData.length];
System.out.println("cert length is: "+certData.length);
System.arraycopy(data, 0, certData, 0, certData.length);
System.arraycopy(data, certData.length, idData, 0, idData.length);
try
this.userCertificate = CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(certData));
System.out.println("User certificate coming from card is: \n"+this.userCertificate);
System.out.println( caCertificate.getPublicKey() );
if( isOpen )
verifyCert = new VerifyCertificate();
boolean iVerified = verifyCert.verifyCertificate( userCertificate, caCertificate.getPublicKey() );
if( iVerified )
System.out.println("Certificate is verified");
else if( !iVerified )
System.out.println("Certificate is not verified");
else if( !isOpen)
System.out.println("could not set CA public key");
catch (CertificateException ex)
System.out.println("could not create the certficate");
ex.printStackTrace();
System.out.println("Data length is: "+data.length+"\nData received is: ");
else
System.out.println("Could not read data, \nData length is: "+data.length);
catch (IOException ex)
System.out.println("could not receive data from client");
ex.getMessage();
public class RequestHandler extends Thread
Socket connectionSocket;
Server server;
public RequestHandler(Socket connectionSocket)
this.connectionSocket = connectionSocket;
@Override
public void run()
server = new Server();
server.receiveData(connectionSocket);
}
Maybe you are looking for
-
My account was disabled how do i get it back
i have emailed them and got no answer, are they gonna con me out of my £11 credit
-
Java ME SDK 3.0 on Vista 64bit (JDK/JRE1.6U13 32-bit installed right before
I really would like to test the recently promoted release of Java ME SDK 3.0 on my Windows Vista Ultimate 64-bit. First I tried to install it using my previously installed JDK 1.6 64-bit. Installer failed to properly integrate with Vista's UAC. Then
-
Remove Album Artwork from iPod
I recently had to reset my iPod. Previously, I attempted to maximize my available space on my 2 GB iPod by changing settings to do not show my album artwork. I went to edit, preferences and clicked on music as the on-line instructions indicated. I co
-
A subobject type ZPLEQUI is created for EQUI to have additional events 'deleted' & 'undeleted'. before object delegation events "created" & "changed" are being raised but after delegation they are not being raised. Action is 'exception' and error mes
-
Why does my library keep disappearing??
Ok, this is happening on a regular basis - I save all my music to an external HDD through iTunes, but sometimes when I start up iTunes the whole library has disappeared and in the Advanced tab, my file save location has reverted back to the C drive,