Test string equals syntax in configure.ac
Hi all, I recently started a project that uses autoconf, and many examples around the place use the following syntax for string equality tests:
if test "x$str" = "xyes"; then ...
I was wondering why this is used as opposed to
if test "$str" = "yes"; then ...
which seems a bit more elegant and in plain bash seems to work fine (even with empty strings etc). Anyone know the reason why it is usually done the first way and not the second?
but autoconf was made for POSIX sh (not sure what that supports exactly), and so many developers try to be overly cautious. I know we are not with the linux-only product.s.
it might also be a holdover from people writing tests without the quotes, like if x$var = xyes; then ...
if you write without the x and $var is an empty string, you'll get a syntax error
Similar Messages
-
I periodically get a stuck Execute thread on my Weblogic 8.15 server
during a call to a Stateless Session Bean. When I do thread dumps, the
thread is always stuck in the same place (in
java.lang.String.equals(String.java:619) or in the call immediately above it
java.util.LinkedList.indexOf(LinkedList.java:397)). Even though the thread
dump indicates that the thread is in a runnable state, if I do multiple
thread dumps over a period of time, the stack trace always indicates that
the thread is in the same place. The thread remains stuck until Weblogic is
restarted. Other client applictions can make session bean calls, but each
stuck thread seems to still take up lots of CPU time. I have let the stuck
threads run overnight, and the stack trace from the thread dump always shows
them executing the same String/LinkedList code. In each case, our code is
trying to iterate over a collection
Does anybody know what could cause this problem, and how to fix it? I get
StuckThreadMaxTime errors in the log:
####<Dec 4, 2005 10:47:25 AM EST> <Error> <WebLogicServer> <nybill>
<myserver> <weblogic.health.CoreHealthMonitor> <<WLS Kernel>> <>
<BEA-000337> <ExecuteThread: '4' for queue: 'weblogic.kernel.Default' has
been busy for "1,263" seconds working on the request
"ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl", which
is more than the configured time (StuckThreadMaxTime) of "1,200" seconds.>
Here are some stack traces from different thread dumps (I have the full
thread dumps if necessary):
"ExecuteThread: '10' for queue: 'weblogic.kernel.Default'" daemon prio=5
tid=0x7720eb98 nid=0xd68 runnable [571f000..571fdb0]
at java.lang.String.equals(String.java:619)
at java.util.LinkedList.indexOf(LinkedList.java:398)
at java.util.LinkedList.contains(LinkedList.java:176)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getDailyCallSummary(XMLBillCr
eation.java:1992)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getGraphs(XMLBillCreation.jav
a:1931)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
java:2618)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
.java:236)
at
ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
nSessionEJB.java:341)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
ml(BillAdminSession_uli3xb_EOImpl.java:100)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
oke(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
"ExecuteThread: '22' for queue: 'weblogic.kernel.Default'" daemon prio=5
tid=0x772538d0 nid=0xe24 runnable [497f000..4fdb0]
at java.lang.String.equals(String.java:619)
at java.util.LinkedList.indexOf(LinkedList.java:398)
at java.util.LinkedList.contains(LinkedList.java:176)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getMostExpensiveOrLongestCall
s(XMLBillCreation.java:1892)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReport(XMLBillCreati
on.java:1798)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReports(XMLBillCreat
ion.java:1751)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
java:2612)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
.java:236)
at
ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
nSessionEJB.java:341)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
ml(BillAdminSession_uli3xb_EOIm.java:100)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
oke(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
"ExecuteThread: '21' for queue: 'weblogic.kernel.Default'" daemon prio=5
tid=0x76afb060 nid=0x498 runnable [48af000..48fdb0]
at java.lang.String.equals(String.java:619)
at java.util.LinkedList.indexOf(LinkedList.java:398)
at java.util.LinkedList.contains(LinkedList.java:176)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getMostFrequentlyCalledNumber
sOrCitiesReport(XMLBillCreation.java:1839)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReport(XMLBillCreati
on.java:1772)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getTopTenReports(XMLBillCreat
ion.java:1743)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.getLocations(XMLBillCreation.
java:2612)
at
ncss.billing.broadviewBill.xml.XMLBillCreation.createXMLBill(XMLBillCreation
.java:236)
at
ncss.billing.ejb.billAdmin.session.BillAdminSessionEJB.getBillAsXml(BillAdmi
nSessionEJB.java:341)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl.getBillAsX
ml(BillAdminSession_uli3xb_EOImp.java:100)
at
ncss.billing.ejb.billAdmin.session.BillAdminSession_uli3xb_EOImpl_WLSkel.inv
oke(Unknown Source)
at
weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at
weblogic.rmi.cluster.ReplicaAwareServerRef.invoke(ReplicaAwareServerRef.java
:108)
at
weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:363)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:147)
at
weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at
weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:3
0)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:219)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:178)
The code in LinkedList that it seems to be executing is the following:
Line#
397 for (Entry e = header.next; e != header; e = e.next) {
398 if (o.equals(e.element))
399 return index;
400 index++;
401 }
I am running Weblogic 8.15 on Windows 2000.
Thanks for any help,
- Donnjb7ty wrote:
I suggest dropping that example program and concentrating on reading a book on Java such as 'Head First in Java'. Otherwise, you will spend a lot of time trying to get something to work and gain little value from it.Likewise... Jumping into reflections before you can [read a stack-trace|http://www.0xcafefeed.com/2004/06/of-thread-dumps-and-stack-traces/] is like signing up a toddler for the New York Marathon... it's probably simply beyond your skill level... so step back... go read a book, do some tutorials, get your head around just the process of the designing, writing, compiling, running, and debugging java programs... and what the different diagnostics mean... Then, equipped with your nose-clip and your trusty stone ;-) you contemplate leaping into the deep end ;-)
Cheers. Keith. -
String equal method Vs Object equal method.
hello, Can anybody explain me difference between equal method in String class and equal method in Object class. We have equal method in object classes. and object class is the super class of all classes, so why we need equal method in String class.
RGEO wrote:
hello, Can anybody explain me difference between equal method in String class and equal method in Object class. We have equal method in object classes. and object class is the super class of all classes, so why we need equal method in String class.Because "equal" means different things for different objects. For a String, "equal" would mean that both Strings being compared have the exact same characters, in the same sequence. For an Integer, "equals" would mean that both objects have the same integer value. -
Warning in SLIN:'Does not test for equality'
Hi i get the following error
In "SELECT SINGLE ...", the WHERE condition for the key field "MATNR" does not
test for equality. Therefore, the single record in question may not be unique.
for the following code
SELECT SINGLE * FROM zgd_phant_status
INTO t_phant_status
WHERE sellable = p_l_matnr
AND opsys = g_opsys
AND rellvl = g_rel
AND serlvl = g_ser
AND lang = g_lang.Hi Kitty,
Then there is no other solution (that's why it is only a WARNING message in the extended program check. Or you could bypass like this:
SELECT *
FROM zgd_phant_status
UP TO 1 ROWS
INTO t_phant_status
WHERE sellable = p_l_matnr
AND opsys = g_opsys
AND rellvl = g_rel
AND serlvl = g_ser
AND lang = g_lang.
ENDSELECT.
Regards,
John. -
Compareto versus equals performance for strings equality
Hi
Just wanted to know whether compareto and equals method performance for checking whether the two strings are equal or not .
Which one is good with respect to bytecode , speed performance.
Im not asking for the difference, only asking which one is good to use most number of times for comparing two strings for equilaty.
Thanks.Hi
Ya they are both for different purposes. No doubt.
t which one is faster among the two for string
equality?
compareto or equals.
thanksHis point is that it doesn't matter. You shouldn't worry about optimization for small details like this. Unless you are profiling your code and find a large slowdown with that code, then don't worry about their performance. Use the one that best suits your purpose. If you want to know if they're equal, use equals(), if you want to know their order, use compareTo(). -
Hi,
I've recently had a problem with string equality. My problem is the following:
element.getName() == String2
(getName() method returns a string)
returns false, but both strings really seem to be equal, that is:
System.out.println(String1 +"/"+ String2 +"=" + (String1 == String2));
prints
LAMES/LAMES=false
which seems pretty strange to me.
I searched both is the javadocs and in the tutorial, but I did not find any solution to my problem. How that 2 strings containing the same Characters are not equal.
NicolasThis has been stated NUMEROUS times throughout the forums...
== compares Objects (two String Objects will most likely NOT be equal, even if both contain the same characters in the same sequence)
String.equals(...) compares the equality of the contents of the Strings -
[svn] 4422: Add configSuite tests to cover a few configuration exceptions.
Revision: 4422
Author: [email protected]
Date: 2009-01-07 10:13:54 -0800 (Wed, 07 Jan 2009)
Log Message:
Add configSuite tests to cover a few configuration exceptions.
checkintests: passed
Added Paths:
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/factories/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/factories/NonExistentClassTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/factories/NonExistentClassTest/e rror.txt
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/factories/NonExistentClassTest/s ervices-config.xml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/properties/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/properties/serverSettings/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/properties/serverSettings/Invali dClusterMessageRoutingTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/properties/serverSettings/Invali dClusterMessageRoutingTest/error.txt
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/properties/serverSettings/Invali dClusterMessageRoutingTest/services-config.xml
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/tokens/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/tokens/InvalidTokenTest/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/tokens/InvalidTokenTest/error.tx t
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/tokens/InvalidTokenTest/services -config.xmlHi Scott,
I'm not sure I get all of what the plugin that "provides an EntityManagerFactory via OSGI plugin" is doing, but it looks like it is assuming to get injected, and I saw further down that you are using DS, so are you expecting DS to inject it?
Assuming you are getting an EMF injected as you expect then the output log should show the entity classes that are getting processed. Set the eclipselink.logging.level to FINEST to get all of the config info, and set the GEMINI_DEBUG property described here and then please post that output. If it is too big then just attach it as a file.
A couple things to fix:
- The examples from the EclipseLink wiki are for using the obsolete native EclipseLink OSGi support. They should be ignored.
- org.eclipse.persistence.jpa.equinox, org.eclipse.persistence.jpa.equinox.weaving, and org.eclipse.persistence.jpa.osgi JARs should not be installed or used with Gemini. They were for the obsolete OSGi support and are no longer used.
A couple of style suggestions:
- Don't ever initialize an id variable in place, particularly one that is supposed to be auto-generated.
- You should not include both a Require-Bundle as well as an Import-Package for the same packages. It is confusing and error-prone.
-Mike -
Nano syntax highlighting: catch-all syntax for configuration files
After years of using nano, I only recently learned that it supports syntax coloring... (Why would they turn that off by default? ) Well, I thought I'll make up for it by making extra good use of it from now on...
Unfortunately it didn't ship a highlighting syntax for the the kind of files that I use nano the most for: system configuration files.
So I wrote my own, and after tweaking a bit here and there whenever I encountered a config file for which the highlighting wasn't satisfactory at first, I think the result is now good enough (screenshots below) that it's worth sharing with my fellow Arch users:
Code & Instructions:
Here is the syntax definition:
# config file highlighting
syntax "conf" "(\.(conf|config|cfg|cnf|rc|lst|list|defs|ini|desktop|mime|types|preset|cache|seat|service|htaccess)$|(^|/)(\w*crontab|mirrorlist|group|hosts|passwd|rpc|netconfig|shadow|fstab|inittab|inputrc|protocols|sudoers)$|conf.d/|.config/)"
# default text
color magenta "^.*$"
# special values
icolor brightblue "(^|\s|=)(default|true|false|on|off|yes|no)(\s|$)"
# keys
icolor cyan "^\s*(set\s+)?[A-Z0-9_\/\.\%\@+-]+\s*([:]|\>)"
# commands
color blue "^\s*set\s+\<"
# punctuation
color blue "[.]"
# numbers
color red "(^|\s|[[/:|<>(){}=,]|\])[-+]?[0-9](\.?[0-9])*%?($|\>)"
# keys
icolor cyan "^\s*(\$if )?([A-Z0-9_\/\.\%\@+-]|\s)+="
# punctuation
color blue "/"
color brightwhite "(\]|[()<>[{},;:=])"
color brightwhite "(^|\[|\{|\:)\s*-(\s|$)"
# section headings
icolor brightyellow "^\s*(\[([A-Z0-9_\.-]|\s)+\])+\s*$"
color brightcyan "^\s*((Sub)?Section\s*(=|\>)|End(Sub)?Section\s*$)"
color brightcyan "^\s*\$(end)?if(\s|$)"
# URLs
icolor green "\b(([A-Z]+://|www[.])[A-Z0-9/:#?&$=_\.\-]+)(\b|$| )"
# XML-like tags
icolor brightcyan "</?\w+((\s*\w+\s*=)?\s*("[^"]*"|'[^']*'|!?[A-Z0-9_:/]))*(\s*/)?>"
# strings
color yellow "\"(\\.|[^"])*\"" "'(\\.|[^'])*'"
# comments
color white "#.*$"
color blue "^\s*##.*$"
color white "^;.*$"
color white start="<!--" end="-->"
To install, save the above above code snippet as a file called conf.nanorc in the folder /usr/share/nano/ (or /usr/local/share/nano/ or similar if you feel strongly about the /usr <--> /usr/local separation), and then add the following to the end of the file /etc/nanorc:
## Configuration files (catch-all syntax)
include "/usr/share/nano/conf.nanorc"
Hints:
The colors I chose look good (imo) with the terminal background and color settings that I use, but might not look good, or even readable, with yours, so simply change the color names in the code snippet to whatever you prefer - valid color names are:
If you use a console with white background, you'll have to change at least the white color I chose for comments and punctuation.
The first code line in the snippet includes a regular expression that defines for which file names this syntax highlighting should be used. Whenever you encounter a config file that is not matched by this, but you would still like to open it with syntax highlighting, you can manually select this syntax with nano's -Y switch, like so:
nano -Y conf myConfigFile
Technical Note:
It's implemented as a single catch-all syntax, since nano chooses which syntax to apply based on the filename, and in the case of config files usually not much can be learned about the content format from the file name extension (.conf can by anything from flat key/value tuples to XML, .ini can be the official INI format or something else, etc...).
This means that some compromises have been made, so with this highlighting syntax probably no config file looks 100% as good as a highlighting syntax that would be specifically optimized for one kind of config format, but all in all the vast majority of config files should look pretty good.
Screenshots:
/etc/rc.conf, /etc/hosts:
/etc/pacman.conf, /etc/group:
xorg.conf, some .desktop file:
httpd.conf (Apache config), php.ini:
More screenshots:
/etc/fonts/fonts.conf (uses XML)
/etc/inittab
/etc/fstab
/etc/inputrc
/etc/mime.types
/etc/protocols
/etc/xinetd.conf
See Also:
nano syntax highlighting: GNU makefiles
Update [2012-01-28]: Made some more improvements to the syntax definition (see post)
Last edited by sas (2012-02-01 15:26:43)doug piston wrote:I deal with alot of .mk files and would love to see it there.
You mean GNU makefiles?
I'm afraid they might be out of scope for this generic config-file syntax.
Logically they're not system config files, and technically they're a pretty specialized and complex format (different "types" of rules, rules spanning multiple lines, rules containing arbitrary Bash code, etc.).
This is how an .mk file currently looks with this highlighting syntax:
$ nano -Y conf /usr/lib/httpd/build/rules.mk
And apart from highlighting variables of the form $$abc or $(abc), I'm not sure how much can be improved here without breaking the highlighting for more conventional config files.
It would probably be better to create a specialized highlighting syntax just for .mk files.
EDIT: I sat down and did just that, here's the result: nano syntax highlighting: GNU makefiles, and here is how the above makefile snipped looks with it:
Last edited by sas (2012-02-01 15:18:52) -
On String Equality (using ==)
Hello. I am trying to create a program that will merge sentences on their first similar word occurence, i.e.:
Given "good day. i would like to see you at the office"
and "how are you feeling today?"
It will produce "good day. i would like to see you feeling today".
If there are no similar words, the program will just concatenate the Strings.
I tested the examples above and I got "good day. i would like to see you at the office how are you feeling today". Obviously, something's wrong.
So I fiddled around my code putting printlns here and there. Then I found out that my comparison loops doesn't stop. Equality ( == ) always evaluates to false.
On my tester class, I tried the following:
String intro = "good day. i would like to see you at the office";
String outtro = "how are you feeling today?";
String[] fooArray = intro.split(" ");
String[] barArray = intro.split(" ");
String foo = fooArray[7];
String bar = barArray[2];
System.out.println("Is foo equal to bar? " + foo == bar);The abovementioned code returned false.
Then I tried the following
String intro = "good day. i would like to see you at the office";
String outtro = "how are you feeling today?";
String[] fooArray = intro.split(" ");
String[] barArray = intro.split(" ");
String foo = fooArray[7];
String bar = barArray[2];
System.out.println("How about chars? " + foo.charAt(0) == bar.charAt(0));This time around, it returned true.
So I'm guessing that maybe I should just create a function that will loop through the chars of the String and compare them.
However, I am bothered by how Java handled foo == bar . Can someone explain to me why this happened? Is there a workaround to this one or should I always create a function that loops through chars everytime I want to compare Strings?
Thanks!== compares references for equality. When you want to compare two Object instances for equality you use the equals method. This applies not only to String but any other type of Object..
-
Hi All,
I would like to know what is the syntax to be used to check if a particular word exists in a sentence. I tried the below, but it is not giving me the desired result. I am checking to see if the word Comp exists in the name & also would like to know is this a case-sensitive search? i.e would Comp be treated differently from comp? if i want the search to check for 'comp' irrespective of the case, how should i do it?
SELECT SINGLE NAME1 FROM KNA1 INTO Y_NAME1
WHERE KUNNR EQ VBRK-KUNRG.
IF Y_NAME1 CA 'Comp'.
Y_TYP_SAL = 'INTERNAL'.
ELSE.
Y_TYP_SAL = 'EXTERNAL'.
ENDIF.Hi,
To search a character field for a particular pattern, use the SEARCH statement as follows:
SEARCH <c> FOR <str> <options>.
The statement searches the field <c> for <str> starting at position <n1>. If successful, the return code value of SY-SUBRC is set to 0 and SY-FDPOS is set to the offset of the string in the field <c>. Otherwise, SY-SUBRC is set to 4.
<str>----Function
<pattern>--Searches for <pattern> (any sequence of characters).--
Trailing blanks are ignored.
.<pattern>.----
Searches for <pattern>. Trailing blanks are not ignored.
*<pattern>----
A word ending with <pattern> is sought.
<pattern>*----
Searches for a word starting with <pattern>.
Words are separated by blanks, commas, periods, semicolons, colons, question marks, exclamation marks, parentheses, slashes, plus signs, and equal signs.
<option> in the SEARCH FOR statement can be any of the following:
ABBREVIATED
Searches the field <c> for a word containing the string in <str>. The characters can be separated by other characters. The first letter of the word and the string <str> must be
the same.
STARTING AT <n1>
Searches the field <c> for <str> starting at position <n1>. The result SY-FDPOS refers to the offset relative to <n1> and not to the start of the field.
ENDING AT <n2>
Searches the field <c> for <str> up to position <n2>.
AND MARK
If the search string is found, all the characters in the search string (and all the characters in between when using ABBREVIATED) are converted to upper case.
Ex.
DATA STRING(30) VALUE 'This is a little sentence.'.
WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
ULINE /1(26).
SEARCH STRING FOR 'X'.
WRITE: / 'X', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'
SEARCH STRING FOR 'itt '.
WRITE: / 'itt ', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'
SEARCH STRING FOR '.e .'.
WRITE: / '.e .', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
SEARCH STRING FOR '*e'.
WRITE: / '*e ', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
SEARCH STRING FOR 's*'.
WRITE: / 's* ', SY-SUBRC UNDER 'SY-SUBRC',
SY-FDPOS UNDER 'SY-FDPOS'.
Regards,
Bhaskar -
Doubt in String Equals_
if(filePath != "") {
getExcelData(filePath);
}same as
if(!filePath.equals("")) {
getExcelData(filePath);
}The can both be used interchangeably right ?kajbj wrote:
(You should really open a textbook and read about Strings, or google)fortunatly i know this :)
if you do
String str = "abc"
str =="abc" // will always return true.
but str==(new String("abc")) // will always return false.
But as per the query posted i am referring to the first case :) -
Change Equal Function to Configurable
The idea is to change Equal? function in a way, that it will be configurable, and will have one input as function "Equal To 0?". Sometimes you need to evaluate number of loops execution in While Loop (or not just it), and when you put standard Equal? function, some of wires will be not aligned in a straight line (either which is connected to Index output, or which is connected to Loop Condition), and you need to move up/down one of terminals.
So, you can see it from the attached picture.So you are saying on you want a small version of an Express VI, but you don't want an express VI, even one that is set to show as icon?
That express VI's are intended for kids in kindergarten, but you still want something that hides code from the programmer?
It might sound like we are being negative here. And we are. You are asking for something that already exists, but you don't want to use that because it isn't exactly what you want it to be.
I don't want NI wasting time making a new variation of an express VI, which any experienced LabVIEW programmers avoid, just because you think the current Express VI is too big, and don't want it to look like a cartoon intended for new LabVIEW programmers (which is exactly what an Express VI is meant to be.)
Don't create an idea for a configurable comparison that is like an express VI, but you don't want an express VI because it is too big. Ask for a redesign of the appearance of the current Express VI. -
Testing Object Equality using Serialization
Hey everyone! I was wondering if somebody could help me figure out how to compare two objects using serialization.
I have two objects that I'm trying to compare. Both of these objects extend a common "Model" class that has a method getSerialized() that returns a serialized form of an instance, shown below:
// Serialize the object to an array
ByteArrayOutputStream baos = new ByteArrayOutputStream(1000);
ObjectOutputStream oos;
try {
oos = new ObjectOutputStream(baos);
oos.writeObject(this);
oos.close();
} catch (IOException e) {
e.printStackTrace();
//Deserialize array into a String array
return baos.toByteArray();This Model class also has an equals(Model obj) method that allows for the current model object to be compared to a model object that is passed in:
//Store both models' serialized forms into byte arrays
byte [] thisClass = this.getSerialized();
byte [] otherClass = obj.getSerialized();This is where things get a little funny. The byte arrays don't equal - one array is a byte larger than the other. If a byte-by-byte comparison is done, the arrays are equal for the first 15-20% and then not equal for the rest. If I deserialize the byte arrays back into Models and do a toString() on those models, I find that they are equal.
I have a feeling there's something about the serialization process that I don't fully comprehend. Is there a way to properly implement object comparison using serialization?
Thanks in advance!When you serialize an object, you also serialize the entire tree of references based on that object (except for transient variables). That tree is the complicated business you described there. Serialization stores all the objects in the tree, along with data that explains which objects refer to which other objects. Furthermore if the tree is actually a graph, and there are multiple ways to get to an object, it still only stores each object once. I don't see any reason to believe that all that relationship data would be encoded identically for a pair of trees that you deemed to be equal. And your experiment shows that indeed it isn't.
-
I got some problem and it is very weird for me ...
For example:
call method: toCompare("hello");
method: toCompare(String s) {
String sa [] = //get all the filename from a file ...// for examle sa contain hello
// loop
if (sa.equals(s) ...){ // it actually return true // others matches ..startsWiths .....
however ...
when I call method: toCompare(s[0]);
in the method is actaully return false ...
I am passing the same value ...
Please help..
I don't understand why ...
Thanks>>>
"if (sa.equals(s) ...){ // it actually return true // others matches ..startsWiths .....
however ...
when I call method: toCompare(s[0]);
in the method is actaully return false ...
I am passing the same value ..."
>>>
I'm assuming that by toCompare you mean compareTo...?
if so, compareTo() returns an int, not a boolean. If it returns 0, then the two Objects being compared are equal. -
Test script for syntax without running.
I have always wondered how to do this. Is there any way to have sql*plus check a script for correct syntax and column names, but NOT execute the code. I know that sql*plus doesn't have a TEST option, but it sure would be nice. Currently the only way to check code (especially updating code) is to let it rip and have a rollback at the end. Not the greatest way to do it.
EXPLAIN PLAN will only work for a single SQL statement.
If the script comprises a single transaction, one technique which might work is to first SET TRANSACTION READ ONLY.
This will attempt to execute every line in the script, but any statements which try to update the database will fail with "ORA-01456: may not perform insert/delete/update operation inside a READ ONLY transaction". Similar to what the original post described with a rollback at the end, but without the I/O.
Maybe you are looking for
-
How do I change Adobe Flash Settings to never allow pop-ups?
How do i change AFP to never allow pop-ups, especially and particularly pop-ups asking to use storage space on my computer?
-
Extended classic scenario local PO
Hi All , Need some inputs on the extended classic scenario local PO. There is couple of functionality which we need to do for the PO. I mean when the PO gets created automatically after shopping cart completely approved We can change the same PO from
-
Creating PDF's in SL 10.6.1
I am playing around with FH 11.0.2 in SL 10.6.1 on a macbook pro (sept 2009) Saving files as templates seems to be working again. If I want to create a PDF file out of FH, I select all, convert type to paths and then print the postscript file. In dis
-
RE: How can I call Windows .DLL components in Java
Hi, there, I have a wondows dll component registered on my server. I want to call this componet in my Java application(Servlet). Could you tell me the syntex or is this possible to do in this way? TIA, Xin
-
Firefox Does not load most of websites but other browsers does
Hello, I have a problem.. Suddenly my firefox stopped working properly. I didnt install or changed a setting lately but still... most of the pages does not load, or it take ages to load. With other browsers works fine, it loads really fast... I don't