Tuesday, May 21, 2019

Give permission to execute Shell Script ; UNIX

chmod 0755 TestBash.sh






TestBash.sh contents are here
---------------
#!/bin/sh
java HelloWorld
result=$?
echo $result


Gets result from java to shell script----->https://www.chrisnewland.com/java-return-code-in-linux-shell-script-122

if  an error -  bad interpreter: No such file or directory


use below - 

$ sed -i -e 's/\r$//' TestBash.sh &

Friday, May 3, 2019

Setup build file with Ant Script ; JAVA

<project name="DLWSJavaSample" default="compile" basedir=".">
    <property file="build.properties" />
    <path id="lib.classpath">
        <fileset dir="${dir.lib}">
            <include name="*.jar" />
        </fileset>
        <fileset dir="${dir.lib.cli}">
            <include name="*.jar" />
        </fileset>
    </path>

    <!-- =================================================================== -->
    <!-- Clean the build directory                                           -->
    <!-- =================================================================== -->
    <target name="clean" description="Cleanup build artifacts">
        <delete dir="${dir.generated}" />
    </target>

    <!-- =================================================================== -->
    <!-- Prepare the build directory                                         -->
    <!-- =================================================================== -->
    <target name="setup" description="Prepare for build" depends="clean">
        <mkdir dir="${dir.generated}" />
        <mkdir dir="${dir.generated.java}" />
        <mkdir dir="${dir.generated.classes}" />
    </target>

    <!-- =================================================================== -->
    <!-- wsimport to generate the client stubs from the WSDL                 -->
    <!-- =================================================================== -->
    <target name="genclient" description="Generate stubs from the WSDL" depends="setup">
        <exec executable="${java.home}/../bin/wsimport">
            <arg line="-keep -d ${dir.generated.java} -extension -p com.bm.datalic.dlws.stubs ${dir.config.wsdl}" />
        </exec>
    </target>

    <!-- =================================================================== -->
    <!-- Compile the sample code     (stubs already compiled)                -->
    <!-- =================================================================== -->
    <target name="compile" description="Compile DLWS Sample Code" depends="genclient">
        <javac destdir="${dir.generated.classes}" classpathref="lib.classpath" debug="on" includeantruntime="false">
            <src path="${dir.src}" />
            <src path="${dir.generated.java}" />
        </javac>
    </target>

    <!-- =================================================================== -->
    <!-- Run (replace ${sampleName} and ${programFlag} appropriately)        -->
    <!-- =================================================================== -->
    <target name="run" description="Run DLWS Sample Code" depends="compile">
        <java fork="true" classname="com.bm.datalic.dlws.PerSecurity">
            <arg line="-s ${sampleName} -p ${programFlag}" />

            <classpath>
                <path refid="lib.classpath" />
            </classpath>
            <classpath location="${dir.generated.classes}" />
        </java>
    </target>
</project>

Run built JAVA program on linux with dependent jar files

/myapp/WL12c/app/oracle/jdk1.8.0_211/bin/java -cp /home/app/ERApp/lib/commons-cli-1.4/commons-cli-1.4.jar:/home/myapp/ERApp/lib/ojdbc14.jar: com.bloomburger.datalic.dlws.PerSecurity -s GetAllExRates -p scheduled &>>output.txt &


Explanation:

java installed location -> /app/WL12c/app/oracle/jdk1.8.0_211/bin/java

classpath or dependent jar locations-> -cp /home/app/ExchangeRatesApp/lib/commons-cli-1.4/commons-cli-1.4.jar:/home/app/ERApp/lib/ojdbc14.jar

in the generated classes folder-> com.bloomburger.datalic.dlws.PerSecurity (make sure you get to the folder where com(com.bloomberg.datalic.dlws.PerSecurity) exists and run above command in blue color)

Pass Arguments to the java class file : -s GetAllExRates -p scheduled

Save the logs to file exit with background running enable -> &>>output.txt &






Wednesday, August 22, 2018

Call external REST APIs from NodeJS AWS Lambda

This blog post explains you how to call REST APIs from AWS Lambda.

Tuesday, August 21, 2018

Postman App ; Call UiPath robots on Orchestrator using APIs

Amazed to find Postman app generating code for the parameters and headers passed

In this blog I would like to note down how this tool will be helpful in dealing with APIs

Fantastic explanation of the concepts by Nikhil Ashodariya

https://youtu.be/a2YlQMylshU

Also, here is the link for Ui Path documentation-

https://www.uipath.com/hubfs/Documentation/OrchestratorAPIGuide_2016.2/UiPathOrchestratorAPIGuide_2016.2.html


List of all APIs for UiPath Orchestrator-




Wednesday, June 27, 2018

Convert Number to String with Locale (Comma separated String)



import java.io.*;
import java.text.NumberFormat;
import java.util.Locale;

class MyCode {
  public static void main (String[] args) {
    int number = 1234567;
      NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
      String numberAsString = numberFormat.format(number);
      System.out.println(numberAsString);
  }
}

Monday, June 11, 2018

Popup Panel Window width ADF

This is how you can increase Popup width - use Content Width property of Panel Window.