Passing a string as the name of a Mouse Event Listener function?
Hello,
I am trying to essentially pass a string as a function name into an event listener, but I am not sure how to approach this. Is there a way to convert a string into a function? I am not sure how to word my question, so I apologize.
Here is some code I have for me to show you what I am doing.
package{
//some import statements
public class changes extends MovieClip{
var functionName:String
var aBox:Sprite;
public function changes(){
functionName = "testThis";
createButtonBox(16, 16, 32, 32, functionName);
public function createButtonBox(anX:Number, aY:Number, aWidth:Number, aHeight:Number, aFunction:String){
aBox = new Sprite();
//Some drawing box code
aBox.addEventListener(MouseEvent.CLICK,[aFunction]()?)
addChild(aBox)
public function aFunction(event:MouseEvent){
trace("test");
Am I on the right track or is this not possible?
Anyhow, thank you in advance.
I guess I misworded my question. Essentially what I am trying to do is create buttons that have functions called to from an event listener, referenced by a string like this:
public class Document{
var functionName:String;
public function Document(){
createAButton("Test Button A", 32, 32, "testThis");
createAButton("Test Button B", 64, 64, "testThis2");
public function createAButton(textOnButton:String, anX:Number, aY:Number, functionToCallTo:String){
var aButton:Sprite = new Sprite();
//draw the button
//set a textfieldup for the button to have
aButton.addEventListener(MouseEvent.CLICK, functionToCallTo)
public function testThis(event:MouseEvent){
trace("testA");
public function testThis2(event:MouseEvent){
trace("testB");
Unfortunately aButton.addEventListener(MouseEvent.CLICK, functionToCallTo) gives me a coercian error, which is a given.
aButton.addEventListener(MouseEvent.CLICK, [functionToCallTo]()) gives me TypeError: Error #1006: value is not a function.
I mean I could create a bunch of if statements, but for the number of functions I plan to call to, like about 25 or so, that is pretty tedious.
Similar Messages
-
Using contents of a String as the name for a variable
I'm trying to write code that will evaluate the contents of a String variable and then use the contents as the name for an object. For example, my program will create an unknown number of Student objects. I would like to name the Student objects student1, student2,... . In the code below, how do I get the last line of the method to create a new Student called something like "student3" instead of "varName"? Thanks, Julie
int numberOfStudents= 0;
public void createStudent()
numberOfStudents++;
String varName = "student" + numberOfStudents;
Student varName = new Student();
}The name of the reference variable is irrelevant to the functional aspect of the application. The 'Name' should be a property of the student class. EG
class Student {
private String name;
public String getName() { return name; }
public void setName() { this.name = name; }
public Student() { this(null); }
public Student(String name) { setName(name); }
now your code becomes
public void createStudent() {
numberOfStudents++;
Student newStudent =
new Student("student"+numberOfStudents);
// now do something with the new student...
If you're expecting to use the 'Student' instance outside of this method you need to store a reference to it somewhere more accessible (like a field, in a list or an array) or return the reference from this method... -
Iocane: poison the rodent (simulate X11 mouse events from keyboard)
Iocane: the colorless, oderless, tasteless poision that will rid your system of its rodent infestation. Though no promises about its effectiveness against Rodents Of Unusual Size.
Iocane simulates mouse events from the keyboard. Iocane can be passed a few parameters which - ideally - could each have a key binding in your favorite window manager.
If iocane is called with no parameters it starts in interactive mode (which currently lacks documentation ... hey, I just wrote this this morning). In interactive mode the directional arrows or h/j/k/l keys move the mouse cursor. The number keys simulate button presses (1 = left button, 2 = middle, 3 = right). The page up and page down keys simulate mouse wheel activation. "q" quits from interactive mode returning any grabbed keys to their normal behavior. Key bindings are all controlled from a simple rc file.
Iocane can also be passed a series of commands on the command line or the filename for a script file with a list of iocane commands. Iocane can also read command from its standard input.
Iocane is conceptually similar to some functions of xdotool, but iocane should work under any window manager (or no wm at all), is much smaller, and the interactive mode allows for a sequence of many actions without the program having to start up and close down many times in rapid succession.
Please report bugs or feature requests here. Iocane is currently 127 lines of C, and it will remain small; in other words, features will only be added if the can be added without substantially increasing resource use.
EDIT: Version 0.2 is now in the AUR
Last edited by Trilby (2012-11-03 02:23:15)Any arbitrary number of buttons should be easy enough to simulate - provided the Xserver actually responds to events with that button number. An update I'll push to github tomorrow will include a few changes, including buttons 1-9, but if there is need/desire I could increase that. Sticking to 1-9 allows for the computationally cheaper hack of converting a string to a number by simple substracting 48 from the value of the first character; numbers greater than 9 would require the use of atoi() or some funky conditionals. In the grand scheme of things this is fairly trivial, but unless there is a real reason to use more than 9 mouse buttons I'd prefer to keep the lighter code.
Passing a window name and getting it's coordinates is possible but after considering it I've decided it wouldn't fit well in iocane. The reason being that to do a half-arsed job of it would be pretty easy. To do it properly, however, it would take quite a bit of scanning through recursive calls to XQueryTree, polling atoms/wmhints, matching strings, checking for subwindows in the case of reparenting window managers, and a bunch of other nonsense ... all to get two coordinates.
However iocane will play nicely with any tool that will provide those coordinates from a given window name, so I can imagine and invocation such as the following to move the mouse 10 pixels right and down from the top left of a window - lets call it FlamingSquirrel - and simulate a click there:
iocane $(cool_app FlamingSquirrel) : move 10 10 : button 1
Currently that could only be done from a command line invocation, not from a script or interactive session, as it requires shell processing for the command substitution. I can add support for this type of invocation in scripts and interactive mode as well. Then all you need to do is find (or write) a program that will give coordinates for a window given a title/name. I suspect such a program probably exists out there, or if you are comfortable with C, I could give you the starting framework for it as I made something that would have much code in common for another task on these forums (it's in jumpstart.c in the "misc" repo on my github).
In fact, you could use the following
xdotool mousemove --window FlamingSquirrel 0 0 && iocane offset 10 10 : button 1
Though if you are using xdotool anyways, I'm not sure if iocane would serve much of a purpose, unless you just prefer iocane's syntax.
Last edited by Trilby (2012-11-01 00:21:14) -
Finding Screen Location of the Cursor without a Mouse Event
How can I find the absolute screen location of the mouse cursor if I do not have a mouse event? I have an application where I need to warp the location of the mouse cursor using the robot class and would like to return the mouse cursor to its original location once I'm done.
I had similar problem and asked in the forums a while back, basically what I did was to set the mouse to a "Start" position and go from there.
I know this will not get it back to your current location. -
How to make the row header of the JTable respond to mouse events?
Is there an easy way to enable the row header of a JTable so it listens to mouse events? I have put a button in the first cell of the row header but I can't click in it.
I'm asking for an easy way because I've seen some fairly complicated examples on the web that seem close to what I want but I was hoping something simple like getRowHeader().setEnabled(true) would do the trick for my case...What's your row header, another JTable or something else? Check out camickr's [url http://tips4java.wordpress.com/2009/07/12/table-button-column/]Table Button Column.
db
edit Or to get better help sooner, post a [url http://mindprod.com/jgloss/sscce.html]SSCCE (Short, Self Contained, Compilable and Executable) example that demonstrates the problem.
Edited by: Darryl Burke -
ISQL*PLUS dynamic reports - how to pass connect string in the URL
When we run dynamic reports thru ISQL*PLUS, does anyone know how
to pass the connect string info in the URL
The following is the code from ISQL*PLUS users guide but it
dosen't show how to pass the connect string
when I tried to pass hr/your_secret_password@dbserver for userid
I got an error msg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<HTML>
<HEAD>
<TITLE>iSQL*Plus Dynamic Report</TITLE>
</HEAD>
<BODY>
<H1>iSQL*Plus Report</H1>
<H2>Query by Employee ID</H2>
<FORM METHOD=get ACTION="http://host.domain/isqlplus">
<INPUT TYPE="hidden" NAME="userid"
VALUE="hr/your_secret_password">
<INPUT TYPE="hidden" NAME="script"
VALUE="http://host.domain/employee_id.sql">
Enter employee identification number: <INPUT TYPE="text"
NAME="eid" SIZE="10">
<INPUT TYPE="submit" VALUE="Run Report">
</FORM>
</BODY>
</HTML>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks
JayThe form you use should work when your change
"hr/your_secret_password" to a valid username, password
and connect identifier like "hr/hr@MYDB". Don't forget to
configure MYDB in your tnsnames.ora file on the machine that has
the iSQL*Plus server.
What was the error you got?
The full URL syntax did seem to go missing from the 9.0.1 doc.
See below for the full syntax. This should be appearing in a
forthcoming FAQ.
- CJ
What syntax can I use to run an iSQL*Plus Dynamic Report?
You can run a dynamic report by entering the report URI in the
location field of your browser, or by making the report server a
link or the action for an HTML form. The iSQL*Plus 9i Release 1
documentation has examples of these.
The general syntax for running a dynamic report is:
{uri}?[userid=logon&]script=location[¶m...]
where uri
Represents the Uniform Resource Identifier (URI)
of the iSQL*Plus Server, for example:
http://host.domain/isqlplus
where logon
Represents the log in to the database to which you
want to connect:
{username[/password][@connect_identifier]}
where location
Represents the URI of the script you want to run.
The syntax is:
http://[host.domain/script_name]
The host serving the script does not have to be
the same as the machine running the iSQL*Plus server.
where param
Specifies the named parameters for the script you
want to run.
Named parameters consist of varname=value pairs.
iSQL*Plus will define the variable varname to equal value prior
to executing the script e.g.
...script=http://server/s1.sql&var1=hello&var2=world
This is equivalent to the SQL*Plus commands:
SQL> define var1=hello
SQL> define var2=world
SQL> @http://server/s1.sql
iSQL*Plus, SQL*Plus and SQL keywords are reserved
and must not be used as the variable names (varname). Note also,
that since variables are delimited by the ampersand character,
there is no requirement to enclose space delimited values with
quotes. However, to embed the ampersand character itself in the
value, it will be necessary to use quotes.
For compatibility with older scripts using the &1
variable syntax, varname may be replaced with the equivalent
variable position as in:
...script=http://server/s1.sql&1=hello&2=world
Note the & is the URL parameter separator and not
related to the script's substitution variable syntax.
Commands and script parameters may be given in any
order in the dynamic report URI. However, please note that if any
parameters begin with reserved keywords such as "script" or
"userid" then it may be interpreted as a command rather than a
literal parameter. -
How to read the name of a PDF file? - function module
Hi,
I have <b>some individual pdf documents in my desktop</b>.I need to <b>bulk-upload it to the content server and document related information to the SAP-DB</b>.
Need your guidance.
Regards,
John.try this code it will convert file to PDF file
REPORT ZWARUN_CONVERSION_PDF .
***********Tables***************
TABLES:VBRK.
***********Data Declaration***************
DATA: LV_NUMBYTES TYPE I,
LV_SPOOLNO TYPE TSP01-RQIDENT.
DATA:C_LAYOUT LIKE PRI_PARAMS-PAART VALUE 'X_65_132', "Layout
C_X TYPE C VALUE 'X'.
DATA: NUMBYTES TYPE I,
CANCEL.
***************Internal table of Pdf************
DATA: IT_PDF LIKE TLINE OCCURS 10 WITH HEADER LINE.
DATA:BEGIN OF IT_VBRK OCCURS 2,
FKART LIKE VBRK-FKART,
FKTYP LIKE VBRK-FKTYP,
VBTYP LIKE VBRK-VBTYP,
END OF IT_VBRK.
SELECTION-SCREEN BEGIN OF BLOCK BLK WITH FRAME.
SELECT-OPTIONS: S_BUKRS FOR VBRK-BUKRS,
S_GJAHR FOR VBRK-GJAHR.
SELECTION-SCREEN END OF BLOCK BLK .
PARAMETERS:
spoolno like tsp01-rqident,
DOWNLOAD AS CHECKBOX DEFAULT 'X',
P_FILE LIKE RLGRAP-FILENAME DEFAULT 'C:\warun1.pdf'.
START-OF-SELECTION.
SELECT FKART
FKTYP
VBTYP
INTO TABLE IT_VBRK
FROM VBRK
WHERE BUKRS IN S_BUKRS
AND GJAHR IN S_GJAHR.
END-OF-SELECTION.
DATA: LK_PARAMS TYPE PRI_PARAMS,
LV_VALID.
if not p_mailid is initial.
All the parameters passed are constants, so exceptions
doesn't get raised
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
IMMEDIATELY = ' '
LAYOUT = C_LAYOUT "'X_65_132'
NO_DIALOG = C_X
IMPORTING
OUT_PARAMETERS = LK_PARAMS
VALID = LV_VALID.
IF LV_VALID <> SPACE .
NEW-PAGE PRINT ON PARAMETERS LK_PARAMS NO DIALOG.
*--To display the final report
PERFORM PRINT_REPORT.
NEW-PAGE PRINT OFF.
*---To convert the download to PDF
PERFORM CONV_TO_PDF_DOWNLOAD.
PERFORM DOWNLOAD.
ENDIF.
endif.
*--To display the final report
PERFORM PRINT_REPORT.
*& Form print_report
FORM PRINT_REPORT .
*write:/ 'I will do it' color 4.
write:/ 'Yes' color 4.
write:/ 'we will do it' color 4.
write:/ 'lets talk abt changing life style' color 4.
write:/'By warun'.
LOOP AT IT_VBRK.
WRITE:/ IT_VBRK-FKART,IT_VBRK-FKTYP,IT_VBRK-VBTYP.
ENDLOOP.
ENDFORM. " print_report
*& Form conv_to_pdf_download
FORM CONV_TO_PDF_DOWNLOAD .
CLEAR IT_VBRK.
WAIT UP TO 2 SECONDS.
LV_SPOOLNO = SY-SPONO.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = LV_SPOOLNO
NO_DIALOG = ''
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
PDF_BYTECOUNT = LV_NUMBYTES
PDF_SPOOLID = pdfspoolid
LIST_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
TABLES
PDF = IT_PDF.
ENDFORM. " conv_to_pdf_download
*& Form download
FORM DOWNLOAD .
download PDF file ***********
CHECK DOWNLOAD = 'X'.
CALL FUNCTION 'DOWNLOAD'
EXPORTING
BIN_FILESIZE = LV_NUMBYTES
FILENAME = P_FILE
FILETYPE = 'BIN'
IMPORTING
ACT_FILENAME = P_FILE
FILESIZE = LV_NUMBYTES
CANCEL = CANCEL
TABLES
DATA_TAB = IT_PDF.
IF CANCEL = SPACE.
WRITE: / LV_NUMBYTES, P_FILE.
ENDIF.
ENDFORM. " download -
Is it possible to pass a string representing a class name in java as an arg
Hi, this is probably a bit of a stupid question, but one that has me quite confused all the same!
Is it possible to pass a string or class name etc. representing a type of class in java, to a method so that instead of having to redefine a method with say the following args:
public SolarPanels[] bestPVPanels(int budget, int percent) {
HashMap<Integer, SolarPanels> panelsMap = new HashMap<Integer, SolarPanels>();
}As at present needing to create a methods bestWindTurbine() and many others exactly the same, but for the type, I would instead like to be able to create a method like:
public Object[] bestRenewable(int budget, int percent, String aClassName) {
HashMap<Integer, aClassName > renewableMap = new HashMap<Integer, aClassName >();
}But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class name, any help or advance would be much appreciated.
Thanks in advance
Pat NevinpNev wrote:
But cant sus how to do this as passing a String is off course going to cause problems unless its it possible to cast a string to a class nameIt's not. You can do things like
Class.forName(classNameInString);But that will only return a Class object.
And as Java generics are erased at runtime, passing the class name to the method is useless as it is too late to use it anyways.
Ah, Peter's way is what I was thinking of. Too early in the morning.
Edited by: Kayaman on 23.6.2010 10:02 -
How to Pass a String as a MovieClip Name?
Hi everyone! I'm back with more doubts
I created 4 buttons with 4 animations each, one for each state (using tweens), so I have that imense list of 16 "addEventListeners" (don't know if there's another way to do it). But everything is working as I would like.
The problem is that I'm trying to create only 4 functions to take care of all the 4 buttons and those 16 eventListeners.
This is part of my AS3 file (still with the "traces", 5 secs of animation to check the animations and all).
empresa_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
empresa_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
empresa_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
empresa_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
parceiros_btn.addEventListener(MouseEvent.MOUSE_OVER, isOver);
parceiros_btn.addEventListener(MouseEvent.MOUSE_OUT, isOut);
parceiros_btn.addEventListener(MouseEvent.MOUSE_DOWN, isDown);
parceiros_btn.addEventListener(MouseEvent.MOUSE_UP, isUp);
var mouseState:String;
var mouseActive:String;
var txt:String;
empresa_btn.over.alpha = 0; empresa_btn.down.alpha = 0;
parceiros_btn.over.alpha = 0; parceiros_btn.down.alpha = 0;
function isOver (e:MouseEvent):void {
mouseActive = e.currentTarget.name;
mouseState = "isOver";
trace (mouseActive + " " + mouseState);
var isOver:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 1, 5, true);
function isOut (e:MouseEvent):void {
mouseActive = e.currentTarget.name;
mouseState = "isOut";
trace (mouseActive + " " + mouseState);
var isOut:Tween = new Tween(empresa_btn.over, "alpha", Strong.easeOut, empresa_btn.over.alpha, 0, 5, true);
Now, what I'm trying to do is use the var "mouseActive" that is returning the right button names inside the Tween as the movieClips.
The problem is that "e.currentTarget.name" is not the "movieClip" itself... it's just a String with the name of the movieClip.
Example: whenever I try to do something like this:
var isOut:Tween = new Tween(mouseActive.over, "alpha", Strong.easeOut, mouseActive.over.alpha, 0, 5, true);
It will return an error cause, as I said, mouseActive is not a movieClip, it's just a String (at least I think).
I already thank you for the help (again)
And please, mind my nicknameNed Murphy wrote:
You're welcome.
As a further opportunity to reduce code, since all your listeners are identical...
var btnArray:Array = new Array(btnNames go here, no quotes);
for(var i:uint=0; i<btnArray.length; i++){
btnArray[i].addEventListener(...OVER...);
btnArray[i].addEventListener(...OUT...);
etc... including where you set alpha = 0
Gosh Ned! I had about 25 big lines of code, including things like "buttonMode = true" and now I have less than 10
This is totally crazy! I always tried to understand this array thing and always failed. It's complicated but your code made some sense after a while
I'm running out of "thanks" to give you hehe. Everything is working just fine but one little thing. I have a sound that plays when a button is clicked. It's working fine but everytime I open the swf the sound autoplay once =/
I'm using this code:
var btnSound:Sound = new clickSound(); //"clickSound" is the className I choosed when exported the sound to AS from the library
and then, inside the function MOUSE_DOWN I have:
btnSound.play();
Everything is working but I always hear the button sound playing one time when I open the swf. Do you know why?
Well, you already helped me a lot. Even more that I could have asked for.
Thanks! -
I have a field that contains a comma separated string of sys_id’s that relate to another table.
I am trying to write a query that returns the name value from the reference table, so that the result is a comma separated string of the name field.
Can anyone help with the SQL required to split out the sys_id’s, do the look-up and return the names back into a string?
Table1
Number
Category
1001
Sys_id1, Sys_id3, Sys_id9
1002
Sys_id3
1003
Sys_id4,Sys_3
1004
Sys_id1, Sys_id9, Sys_id10, Sys_id6
Category Reference Table
Category Sys_id
Category_Name
Sys_id1
Consulting
Sys_id3
Negotiate
Sys_id4
Planning
Sys_id6
Building
Sys_id9
Receipt
Sys_id10
Complete
The result I am looking for would be.
Number
Category
1001
Consulting, Negotiate, Receipt
1002
Negotiate
1003
Planning, Negotiate
1004
Consulting, Receipt, Complete, BuildingI am not going to arguee regarding your model, but you should consider normalizing it.
The idea is to have a function to split the string and return a row for each element in the list. Dump the result into a table and then use FOR XML PATH to do the string aggregation.
To learn about different methods you could use to create the split function refer to this article.
Arrays and Lists in SQL Server
http://www.sommarskog.se/arrays-in-sql.html
Here is an example using XML methods. This is just an example and it doesn't deal with proper indexing, weird characters as part of the list that can't be translated as xml, etc.
SET NOCOUNT ON;
USE tempdb;
GO
DECLARE @T TABLE (
Number int,
Category varchar(50)
INSERT INTO @T (Number, Category)
VALUES
(1001, 'Sys_id1, Sys_id3, Sys_id9'),
(1002, 'Sys_id3'),
(1003, 'Sys_id4, Sys_id3'),
(1004, 'Sys_id1, Sys_id9, Sys_id10, Sys_id6');
DECLARE @R TABLE (
Sys_id varchar(15),
Category_Name varchar(35)
INSERT INTO @R (Sys_id, Category_Name)
VALUES
('Sys_id1', 'Consulting'),
('Sys_id3', 'Negotiate'),
('Sys_id4', 'Planning'),
('Sys_id6', 'Building'),
('Sys_id9', 'Receipt'),
('Sys_id10', ' Complete');
DECLARE @W TABLE (
Number int,
pos int,
Sys_id varchar(15),
PRIMARY KEY (Number, Sys_id)
INSERT INTO @W (Number, pos, Sys_id)
SELECT
A.Number,
ROW_NUMBER() OVER(PARTITION BY A.Number ORDER BY N.x) AS pos,
N.x.value('(text())[1]', 'varchar(15)') AS Sys_id
FROM
@T AS A
CROSS APPLY
(SELECT A.Category AS [text()] FOR XML PATH('')) AS B(c)
CROSS APPLY
(SELECT CAST('<l>' + REPLACE(B.c, ', ', '</l><l>') + '</l>' AS xml)) AS C(x)
CROSS APPLY
C.x.nodes('/l') AS N(x);
SELECT
A.Number,
STUFF(
SELECT
', ' + C.Category_Name
FROM
@W AS B
INNER JOIN
@R AS C
ON C.Sys_id = B.Sys_id
WHERE
B.Number = A.Number
ORDER BY
B.pos
FOR XML PATH(''), TYPE
).value('(text())[1]', 'varchar(MAX)'), 1, 2, '') AS Category
FROM
@T AS A;
GO
AMB
Some guidelines for posting questions... -
Passing a string into an SQL query IN statement
Hello,
I need to connect to a database to pull some data to dynamically create a form based on the data I pull back. My SQL query works fine when I manually run it through a SQL client tool, but when I try to pass it through my workflow I'm having trouble with passing my string into the IN part of the statement. So if for example my SQL query is:
SELECT Field1, Field2, Field3 FROM Table1 WHERE Field4 IN (?)
I have a process variable that has the string I'm trying to pass into the ?, but I don't seem to be able to get the query to run. I have tried setting up my query to run as a Parameterized Query (passing my string process variable into the ?), and by setting the query up through xPath (where I am calling my process variable with an xPath declaration), but am not having any luck.
The process variable I am trying to pass is formatted such that I'm passing 'Value1','Value2','Value3' but I can reformat this string if need be. Even with using test data I can't get the query to return anything. For test data I have tried: 'Value1','Value2','Value3' ; Value1','Value2','Value3 ; Value1,Value2,Value3 but the query never returns any data. I can't seem to see how to format the string to pass into the query. The Query will work with a single Value in the test data, but as soon as I try to pass multiple values within the string it fails. Any suggestions?The problem looks to be a limit on what I can pass into the SQL query component. My string is coming from data returned from another database. I take the xml output from that database call, pass it through a set variable component to remove my xml tags from the string, and then format the string in a script component (I have to do it this way because of the way the data coming out of my first database call). I've put in loggers, and can see that the string I'm passing into my query that is giving me problems, is formatted the same way as if I were to use the concat function Scott listed above. It looks like there is a limitation on what can be passed in my variable. I have tried creating my entire SQL query statement in a set variable component, and then just calling the process variable that holds that statement, but there is a character limit of 128 character for what can be passed in a variable through xpath in the SQL query component.
The next thing I tried was changing my SQL where clause. Instead of passing my variable directly into the IN statement I set up a PATINDEX('%:'+countyname+ ':%', ?) > 0 call to check for the values in my database call. As you can see I took out the "," that I was passing as part of my string, thinking that the SQL component was getting confused by them, and placed ":" characters around my values being passed in my string variable. No matter what I try to do though I'm not able to get the query to run. The component looks like it is taking my string, and is seeing the whole thing as a string instead of passing it as individual values within a string.
I think I'm getting close, but I keep getting a Content not allowed in prolog exception in the server logs. -
Getting the name of the executing method
Hello,
I'm looking for a way to get, in one method, an String with its name. For example, if the method's name is "testOne", I'm looking for getting a String with the name "testOne" in a sentence of the method.
Is there any way?
ThxIs this a good way to get it?
StackTraceElement pila[]=Thread.currentThread().getStackTrace();
String methodName=pila[pila.length-1].getMethodName();
There may be a lot of threads in my program, and I must be sure that this will work fine in all situations. -
How can I pass a String by reference in java?
Hello!
My question is how to pass a String by reference in java.
I tried to declare my variable, instead of using "String xxx = "f";", I used "String xxx = new String ("f");" :
public static void main (String []args)
String xxx = new String("f");
StatusEnum result2 = getErrorPointStr(xxx);
public StatusEnum getErrorPointStr(String text)
StatusEnum testStatus = StatusEnum.PASS;
StringBuffer buffer = new StringBuffer();
buffer.append("123");
text = buffer.toString();
return testStatus;
After calling to getErrorPointStr(String text) function, xxx = "f"
So it does not work.
How can I solve this? It is very important, the function will receive String and not something else.
Thanks!Tolls wrote:
Which is why I said:
Which is why you only managed to change what 'text' referred to in the methodExcept that's not why. Even if String was mutable, doing text = whatever; would have the same effect; it would change what that variable refers to in the method, but it would not change the object's state.
I meant that, since there was no way to actually change the data (ie the char[] or whatever) within the object 'text' referred to, the OP was attempting to change what 'text' referred to and hoping it would be reflected outside the method...which we know won't happen as Java is pass-by-value.\Ah, now I see.
These by-value/by-reference threads tend to get confusing, because usually the person is passing a String, so the immutability of String tends to get in the way and just muddy the waters. -
User to call the name on a linked list from the console
Hello,
My program has 9 linked lists and I need to manipulate them depending on which one the user wants to add or remove from. The problem is it's different every time. I need a way to allow the user to input the name of one of the linked lists, and then from there I can manipulate that list. My general idea is as follows though the syntax is wrong.
inputFrom = in.nextLine();
inputFrom = inputFrom.toUpperCase();
if (inputFrom.peek() != null){
System.out.println("This list has data);
{code}
My problem is that in that if statement I can not simply place the variable in front of the action I wish to perform and expext the variable to substitute for the actual list's name. How can I work around this? Thank you in advance.Create a Map<String, List>, where String is the name of the list. Then you can do map.get("listName");
-
Lookup the name of class where a methode is called from?
Hi
i have an object A and an object B. From A i call a methode in B and within that methode i need to find out ot which type the object is that called the methode.
Is there any methode to find out which object is calling the methode and to find out of which class type that object is (resulting in a String containing the name of that class)?
Thanks for your help.I can think of two ways to do this. First, you could get the current StackTrace and parse it up. You'd be looking for the stack trace element immediately before the current method is called if I understand your post correctly. If you are using JDK 1.3.1 or below, you'd have to print the StackTrace to a String. If you are using JDK 1.4, there is a new Object called StackTraceElement. You can get an array of them from an Exception object.
Second, you could use AspectJ to crosscut code into your application. AspectJ is complicated so I will just point you to their website for more information: http://www.aspectj.org.
Dave.
Maybe you are looking for
-
I can't authorize or deauthorize in my new Imac and I can't open my playlist
I bought an Imac for home and I transfer completely my account, my library, files, etc...But a the the moment to sync my ipod appears a message that indicates "error you permit or authorized" at the moment that I want to authorized simply I can't als
-
Unidentified network - when connecting on wireless
I have HP Pavillon notebook running Vista. When trying to connect to wireless I keep getting the unidentified network error. The other two laptops in my home can connect to the wireless just fine, so there is no issue with the wireless router or SP
-
Hi , We are implementing Project System for our client. For customer related project, requirement is to bill the customer by project expense through DP90. DIP profile is created for the "Billing and Result Analysis" Now SD team is saying to see the
-
Header Condtion Records-Transactional Table Details
Hi Folks, My client is having a requirement to generate a report which fetches the condition value details like (freight, Tax etc) against a particular sales orders. We have noted certain cases where the condition records at the header level can be m
-
Wireless Backup w/ time capsule
I was thinking about getting time capsule. I do have a question about wireless backup though. I travel a lot and I wondered if I were to leave my time capsule at my house and travel out of town will I still be able to backup things on the time capsul