Only when your are testing a Flow Service from webMethods Developer, you can pass an empty string ( or zero-length string ) to a service.
If you want to pass empty variables (variables that have no value), enable the "Include empty values for String Types" check box. When you enable this option, empty String variables are passed with a zero-length value. If you do not enable this option, the variables will be removed from pipelines.
Tuesday, January 27, 2009
Empty Values Assigned to Variables in webMethods
Posted by techgeek168 at 4:09 PM 0 comments
Labels: webmethods
Thursday, January 22, 2009
Map the first name from a document list
1. Add a MAP to your process flow
2. In Properties window, enter "Get the first name" to property Comments.
3. Drag a link line between records.name in Pipeline In to firstName in Pipeline Out.
4. Notice that when you click on the link, it displays the link's Properties.
5. Click on the "Edit..." button of the Indices property.
6. Enter 0 to the records text box, and then click on OK button
7. Notice that the color of the link changed to blue like below:
Posted by techgeek168 at 2:04 PM 0 comments
Labels: webmethods
Insert SYSDATE via JDBC Adapter Service
This is how you can insert a Date + Time to Oracle DATE field in webMethods:
1. Open a new Adapter Serivce
-> Select "JDBC Adapter" type, click Next
-> Select your database "Adapter Connection Alias", click Next
-> Select "InsertSQL" Template, click Next
-> Enter the name of your new Adapter Service, click Finish
2. Select your table under Table tab
3. Add the system date column under INSERT tab.
4. Highlight your date column
-> Double click on the Expression field
-> Enter TO_DATE(TO_CHAR(sysdate, 'DD-MON-YYYY hh:mi:ss'),
'DD-MON-YYYY hh:mi:ss')
Posted by techgeek168 at 1:40 PM 0 comments
Labels: webmethods
Oracle Triggers
CREATE OR REPLACE TRIGGER EBP.INSERT_EBP_TRADING_PARTNERS BEFORE INSERT ON EBP.EBP_TRADING_PARTNERS REFERENCING NEW AS NEW OLD AS OLD FOR EACH ROW DECLARE tmpVar NUMBER; v_fax_subject_line VARCHAR2(60); BEGIN tmpVar := 0; SELECT SUBJECT_LINE INTO v_fax_subject_line FROM EBP_BILLERS WHERE BILLER_ID = :NEW.BILLER_ID; IF :NEW.FAX_SUBJECT IS NULL THEN :NEW.FAX_SUBJECT := v_fax_subject_line; END IF; EXCEPTION WHEN NO_DATA_FOUND THEN dbms_output.put_line('Warning: The Biller_Id does not exist in EBP_BILLERS table.'); END ; /
Posted by techgeek168 at 9:16 AM 0 comments
Labels: Database
Select between dates in Oracle SQL
SQL> with t as (select to_date('01/01/2007', 'dd/mm/yyyy') as update_date from dual union all 2 select to_date('01/01/2007', 'dd/mm/yyyy') from dual union all 3 select to_date('03/01/2007', 'dd/mm/yyyy') from dual union all 4 select to_date('03/01/2007', 'dd/mm/yyyy') from dual union all 5 select to_date('03/01/2007', 'dd/mm/yyyy') from dual union all 6 select to_date('04/01/2007', 'dd/mm/yyyy') from dual union all 7 select to_date('05/01/2007', 'dd/mm/yyyy') from dual union all 8 select to_date('07/01/2007', 'dd/mm/yyyy') from dual union all 9 select to_date('07/01/2007', 'dd/mm/yyyy') from dual) 10 -- end of test data 11 select to_char(x.UPDATE_DATE, 'YYYY-MM-DD') as update_date, DECODE(t.update_date, NULL, 0, count (*)) as count 12 from (select to_date('2007-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')+ (rownum-1) as update_date 13 from dual 14 connect by rownum <= (to_date('2007-02-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS')- 15 to_date('2007-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS'))) x 16 LEFT OUTER JOIN t ON (x.update_date = t.update_date) 17 where x.UPDATE_DATE >= to_date('2007-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') 18 and x.UPDATE_DATE < color="navy">'2007-02-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') 19 group by to_char(x.UPDATE_DATE, 'YYYY-MM-DD'), t.update_date 20 order by 1 21 / UPDATE_DAT COUNT ---------- ---------- 2007-01-01 2 2007-01-02 0 2007-01-03 3 2007-01-04 1 2007-01-05 1
Posted by techgeek168 at 9:09 AM 0 comments
Labels: Database
Regular Expression Tips
JavaScript Tester: http://codespec.blogspot.com/2007/10/regular-expression-tips.html
foob.*r : matchs strings like 'foobar', 'foobalkjdflkj9r' and 'foobr'
foob.+r : matchs strings like 'foobar', 'foobalkjdflkj9r' but not 'foobr'
foob.?r : matchs strings like 'foobar', 'foobbr' and 'foobr' but not 'foobalkj9r'
fooba{2}r : matchs the string 'foobaar'
fooba{2,}r : matchs strings like 'foobaar', 'foobaaar', 'foobaaaar' etc.
fooba{2,3}r : matchs strings like 'foobaar', or 'foobaaar' but not 'foobaaaar'
Metacharacters \1 through \9 are interpreted as backreferences. \
Examples:
(.+)\1+ also match 'abab' and '123123'
(['"]?)(\d+)\1 matchs '"13" (in double quotes), or '4' (in single quotes) or 77 (without quotes) etc
Metacharacters - line separators
^ start of line
$ end of line
\A start of text
\Z end of text
. any character in line
Examples:
^foobar matchs string 'foobar' only if it's at the beginning of line
foobar$ matchs string 'foobar' only if it's at the end of line
\^foobar$ matchs string 'foobar' only if it's the only string in line
\foob.r matchs strings like 'foobar', 'foobbr', 'foob1r' and so on
Metacharacters - predefined classes
\w an alphanumeric character (including "_")
\W a nonalphanumeric
\d a numeric character
\D a non-numeric
\s any space (same as [ \t\n\r\f])
\S a non space
You may use \w, \d and \s within custom character classes .
Examples:
\foob\dr matchs strings like 'foob1r', ''foob6r' and so on but not 'foobar', 'foobbr' and so on
\foob[\w\s]r matchs strings like 'foobar', 'foob r', 'foobbr' and so on but not 'foob1r', 'foob=r' and so on
Posted by techgeek168 at 9:08 AM 0 comments
Labels: Regular Expression
CONCAT Strings in Oracle v.s. MySQL
Oracle uses the CONCAT(string1, string2) function or the || operator. The Oracle CONCAT function can only take two strings so the above example would not be possible as there are three strings to be joined (FirstName, ' ' and LastName). To achieve this in Oracle we would need to use the || operator which is equivalent to the + string concatenation operator in SQL Server / Access.
-- Oracle
SELECT FirstName || ' ' || LastName As FullName FROM Customers
MySQL uses the CONCAT(string1, string2, string3...) function. The above example would appear as follows in MySQL
-- MySQL
SELECT CONCAT(FirstName, ' ', LastName) As FullName FROM Customers
Posted by techgeek168 at 9:00 AM 0 comments
Labels: Database
Backup MySQL Database
Full backup:
echo "============================================================"
echo "Backup $dbName database to $dbFile"
# The following commands will be put to the beginning of the database dump file.
echo " 1. Creating header.tmp temporary file"
echo "SET AUTOCOMMIT = 0;SET FOREIGN_KEY_CHECKS=0;" > $dbDir/header.tmp
# Dumping the database.
echo " 2. Creating $dbName.tmp temporary file"
mysqldump --opt --user=$dbUSER --password=$dbPASSWORD $dbName > $dbDir/$dbName.tmp
# The following commands will be put to the end of the database dump file.
echo " 3. Creating tailer.tmp temporary file"
echo "SET FOREIGN_KEY_CHECKS = 1;COMMIT;SET AUTOCOMMIT = 1;" > $dbDir/tailer.tmp
echo " 4. Create today's backup file : $dbFile"
cat $dbDir/header.tmp $dbDir/$dbName.tmp $dbDir/tailer.tmp > $dbDir/$dbFile
Backup Schema Only:
$ mysqldump --no-data --user=$dbUSER --password=$dbPASSWORD $dbName > Schema20081003.sql
Posted by techgeek168 at 9:00 AM 0 comments
Labels: Database
Search by Attribute and print RANum and position()
XML:
<InvoiceAdj>
<RAInfo RANumType="79">
<RANum>RANumType_79</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88</RANum>
</RAInfo>
<RAInfo RANumType="79">
<RANum>RANumType_79_1</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82_1</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85_1</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88_1</RANum>
</RAInfo>
</InvoiceAdj>
XSLT: Search by attribute RANumType = 79 or 88
<xsl:for-each select="InvoiceAdj/RAInfo">
<xsl:choose>
<xsl:when test="@RANumType = 79 or @RANumType = 88">
<tr>
<td><xsl:value-of select="RANum"/></td>
<td><xsl:value-of select="position()"/></td>
<td></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
HTML:
<tr>
<td>RANumType_79</td>
<td>1</td>
<td></td>
</tr>
<tr>
<td>RANumType_88</td>
<td>4</td>
<td></td>
</tr>
<tr>
<td>RANumType_79_1</td>
<td>5</td>
<td></td>
</tr>
<tr>
<td>RANumType_88_1</td>
<td>8</td>
<td></td>
</tr>
xsl:for-each sample:
xml:
<InvoiceAdj AdjType="CS" AdjNumType="BP">
1. <xsl:for-each select="InvoiceAdj">
2. <xsl:for-each select="InvoiceAdj[@AdjType='CS']">
3. <xsl:for-each select="InvoiceAdj[@AdjType='CS' and @AdjNumType = 'BP']">
Legal filter operators are:
1. = (equal)
2. != (not equal)
3. < less than
4. > greater than
Posted by techgeek168 at 8:51 AM 0 comments
Labels: xslt
Search by Element and print RANum and position()
XML:
<InvoiceAdj>
<RAInfo RANumType="79">
<RANum>RANumType_79</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88</RANum>
</RAInfo>
<RAInfo RANumType="79">
<RANum>RANumType_79_1</RANum>
</RAInfo>
<RAInfo RANumType="82">
<RANum>RANumType_82_1</RANum>
</RAInfo>
<RAInfo RANumType="85">
<RANum>RANumType_85_1</RANum>
</RAInfo>
<RAInfo RANumType="88">
<RANum>RANumType_88_1</RANum>
</RAInfo>
</InvoiceAdj>
XSLT: Search by attribute RANum = 'RANumType_88'
<xsl:for-each select="InvoiceAdj/RAInfo">
<xsl:choose>
<xsl:when test="RANum = 'RANumType_88'">
<tr>
<td><xsl:value-of select="RANum"/></td>
<td><xsl:value-of select="position()"/></td>
<td></td>
</tr>
</xsl:when>
</xsl:choose>
</xsl:for-each>
HTML:
<tr>
<td>RANumType_88</td>
<td>4</td>
Posted by techgeek168 at 8:47 AM 0 comments
Labels: xslt
Increment a variable in for-each loop
Sorry, no can do.
XSLT is a declarative programming language. You can bind a value to a variable only once, you cannot change it later. <link>
Posted by techgeek168 at 8:46 AM 0 comments
Labels: xslt
string replacement
Sometimes you want to replace one string with another. This is done with the ex command "s". The form of the replacement is :
: line_range s/old/new/gex ( replace foo with bar from line 10 to 20 ) :
:10,20s/foo/bar/gYou can use visual mode to select the lines, when you type the colon to start the command it will use symbols for the visual line range.
Posted by techgeek168 at 8:45 AM 0 comments
Labels: UnixBashVi
vi commands
Switch to command mode
ESC | start command mode ( it starts in command mode ) |
i | change to insert mode |
:q | quit |
:wq | write and quit |
:w | write the file |
:# | goto line # |
/str | search down for "str" |
?str | search up for "str" |
dd | delete line |
x | delete character |
dw | delete word ( cut ) |
yy | yank line ( copy ) |
yw | yank word |
p | paste |
u | undo ( only limit is the last write ) |
. | repeat last change |
cw | change word |
Go to line number ## :##
Undo previous command: u
Undo all changes to line: U
Search backward for string: ?string
Search forward for string: /string
% (entire file) s (search and replace) /old text with new/ c (confirm) g (global - all): %s/oldstring/newstring/cg
Delete 5 lines (to buffer): 5dd
Delete lines 5-10:5,10d
Posted by techgeek168 at 8:44 AM 0 comments
Labels: UnixBashVi
Rounding Numbers
Need to be able to round numbers in bash to the nearest whole number? You can use a single line of code in AWK to do the job. For example, the following code will make the number 29.498398 round up to 29.50:
$ echo 29.498398 | awk '{ rounded = sprintf("%.2f", $1); print rounded }'
29.50
Posted by techgeek168 at 8:44 AM 0 comments
Labels: CygwinAwkCronSed
Remove first 3 lines in a file
$cat bearish.htm | awk 'NR>3'
Posted by techgeek168 at 8:43 AM 0 comments
Labels: CygwinAwkCronSed
while statement
C-style while loop:
#!/bin/bash # wh-loopc.sh: Count to 10 in a "while" loop. LIMIT=10 a=1 while [ "$a" -le $LIMIT ] do echo -n "$a " let "a+=1" done # No surprises, so far. echo; echo # +=================================================================+ # Now, repeat with C-like syntax. # Double parentheses permit space when setting a variable, as in C. ((a = 1)) # a=1 # Double parentheses, and no "$" preceding variables. while (( a <= LIMIT )) do echo -n "$a " ((a += 1)) # Double parentheses permit incrementing a variable with C-like syntax. done exit 0 # +=================================================================+ # reading a file line by line while read line do echo "${line}" done < ./straddle.prop
Posted by techgeek168 at 8:43 AM 0 comments
Labels: UnixBashVi
case statement
case $1 in
-s) sec=1; shift;;
-m) sec=60; shift;;
-h) sec=3600; shift;;
-d) sec=86400; shift;;
*) sec=86400;;
esac
Posted by techgeek168 at 8:42 AM 0 comments
Labels: UnixBashVi
Float/Real Number Comparison
if [ $( echo "5.5 > 10.5" | bc ) -eq 1 ]; then
echo 5.5 is greater than 10.5.
else
echo 5.5 is NOT greater than 10.5.
fi
=> 5.5 is NOT greater than 10.5.
Posted by techgeek168 at 8:41 AM 0 comments
Labels: UnixBashVi
Regular Expression in if in bash script
if echo "4567" | grep -q "^4"; then
echo "4567 is started with a 4."
elif echo "4567" | grep -q "^A"; then
echo "4567 is started with a A."
else
echo "4567 is NOT started with a 4 or A."
fi
Posted by techgeek168 at 8:41 AM 0 comments
Labels: UnixBashVi
Get Create Table statement from MySQL
$ sql "show create table my_table\G" | sed -e '1,2d;s/Create Table: //'
Note: sed -e '1,2d' removes the first 2 lines.
Posted by techgeek168 at 8:40 AM 0 comments
Labels: Database
Change Prompt
$
$ PS1="myPrompt> "
myPrompt>
myPrompt>
Posted by techgeek168 at 8:39 AM 0 comments
Labels: UnixBashVi
Calulation in bash
bash$
bash$ echo "1.5 * 2" | bc -l
3.0
bash$ echo "1/3" | bc -l
.33333333333333333333
bash$
bash$ echo "scale=3; 10/3" | bc
3.333
Posted by techgeek168 at 8:38 AM 0 comments
Labels: UnixBashVi
Finding Files with keywords
% grep "yourString" * | awk '{ if($1!=filename){ filename=$1; print $filename}}' 10000CSCO.txt: <xsl:with-param name="vars" select="yourString"/> 10000ELMR.txt: <xsl:with-param name="vars" select="yourString"/> 10000GLSW.txt: <xsl:with-param name="vars" select="yourString"/> 10000IN04.txt: <xsl:with-param name="vars" select="yourString"/> 10000ISAG.txt: <xsl:with-param name="vars" select="yourString"/> 10000KNG1.txt: <xsl:with-param name="vars" select="yourString"/> 10000KNGT.txt: <xsl:with-param name="vars" select="yourString"/> 10000NETF.txt: <xsl:with-param name="vars" select="yourString"/> 10000NGMK.txt: <xsl:with-param name="vars" select="yourString"/> 10000REPI.txt: <xsl:with-param name="vars" select="yourString"/> 10000SATL.txt: <xsl:with-param name="vars" select="yourString"/> 10000SMRT.txt: <xsl:with-param name="vars" select="yourString"/> 10000VINM.txt: <xsl:with-param name="vars" select="yourString"/> %
Posted by techgeek168 at 8:31 AM 0 comments
Labels: CygwinAwkCronSed
Wednesday, January 21, 2009
Force XDoclet to rebuild web.xml and jboss-web.xml
Add the following code to eclipse_project_root/xdoclet-build.xml, after XDoclet setup in Eclipse:
<target name="_xdoclet_generation_" depends="ForceRebuild,N65540,N67036"/>
<target name="ForceRebuild" description="Force XDoclet to rebuild web.xml and jboss-web.xml">
<delete file="WEB-INF/web.xml"/>
<delete file="WEB-INF/jboss-web.xml"/>
</target>
"Run XDoclet" in Eclipse does not overwrite WEB-INF/web.xml and WEB-INF/jboss-web.xml. Therefore, you'll have to remove them before running XDoclet.
Posted by techgeek168 at 4:02 PM 0 comments
Change home directory in Cygwin
Put the new home directory in /etc/passwd file.
i.e. Change the following line from:
$ more /etc/passwd
userID:unused_by_nt/2000/xp:57827:10513:LastName, FirstName,DomanName\userID,S-1-5-21-1123561945-1708537768-1801674531-47827: /OldHome/userID:/bin/bash
to:
$ more /etc/passwd
userID:unused_by_nt/2000/xp:57827:10513:LastName, FirstName,DomanName\userID,S-1-5-21-1123561945-1708537768-1801674531-47827: /NewHome/userID:/bin/bash
Posted by techgeek168 at 2:35 PM 0 comments
Labels: CygwinAwkCronSed
found in jboss-web.xml but not in web.xml
Solution:
This is the reason why you have to remove web.xml and jboss-web.xml before you run XDoclet in Eclipse.
The web.xml and jboss-web.xml are stored under WEB-INF directory.
========================================================
2009-01-21 12:50:49,855 WARN [org.jboss.web.tomcat.tc5.Tomcat5] Failed to parse descriptors for war(file:/C:/cygwin/usr/local/jboss/server/default/tmp/deploy/tmp64661smsj.ear-contents/smsjWeb.war/)
org.jboss.deployment.DeploymentException: Failed to parse WEB-INF/jboss-web.xml; - nested throwable: (org.jboss.deployment.DeploymentException: ejb-ref ejb/DailyKDSession found in jboss-web.xml but not in web.xml)
at org.jboss.web.AbstractWebContainer.parseMetaData(AbstractWebContainer.java:651)
at org.jboss.web.AbstractWebContainer.init(AbstractWebContainer.java:289)
at org.jboss.deployment.MainDeployer.init(MainDeployer.java:696)
at org.jboss.deployment.MainDeployer.init(MainDeployer.java:713)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:631)
Posted by techgeek168 at 12:01 PM 0 comments
Caught Remote Exception - javax.naming.NameNotFoundException: ejb not bound
Solution: Make sure the following XDoclet settings in Eclipse :
1. ejbdoclet.entitypk.pattern={0}PK
2. ejbdoclet.localhomeinterface.pattern={0}LocalHome
3. ejbdoclet.localinterface.pattern={0}Local
4. ejbdoclet.utilobject.pattern={0}Util
5. ejbdoclet.valueobject.pattern={0}Value
Before you re-run XDoclet in Eclipse, remove web.xml and jboss-web.xml under WFB-INF directory.
============================================
2009-01-21 10:16:16,459 ERROR [smsj.server.SMSActionProperty] Caught Remote Exception from WatchListSessionHome or WatchListSession objectejb not bound
2009-01-21 10:16:16,459 INFO [STDOUT] javax.naming.NameNotFoundException: ejb not bound
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:490)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.server.NamingServer.getBinding(NamingServer.java:498)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.server.NamingServer.getObject(NamingServer.java:504)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:248)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.server.NamingServer.lookup(NamingServer.java:251)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:530)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:644)
2009-01-21 10:16:16,459 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
2009-01-21 10:16:16,459 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
2009-01-21 10:16:16,459 INFO [STDOUT] at smsj.ejb.interfaces.WatchListSessionUtil.lookupHome(WatchListSessionUtil.java:17)
2009-01-21 10:16:16,459 INFO [STDOUT] at smsj.ejb.interfaces.WatchListSessionUtil.getHome(WatchListSessionUtil.java:36)
2009-01-21 10:16:16,459 INFO [STDOUT] at smsj.server.SMSActionProperty.reloadQuoteFiles(SMSActionProperty.java:170)
2009-01-21 10:16:16,459 INFO [STDOUT] at smsj.server.SMSServerConsole.setQuoteFiles(SMSServerConsole.java:219)
2009-01-21 10:16:16,459 INFO [STDOUT] at smsj.server.SMSServerConsole.run(SMSServerConsole.java:95)
Posted by techgeek168 at 10:00 AM 0 comments