Obfuscate program

Hi
i use jdev 11.1.1.7
Can i obfuscate java classes, beans and/or other source of project ? How ?
thanks

No, I don't work with such tools. I don't see why. There is no obfuscation which can't be undone. It's more a question how hard you try.
I don't know what you try to do or why you want to use obfuscation at all. Google for it and you find lots of discussions about this and how useful it really is.
You 2nd question: sure you can encrypt some files (property files or other reaources) within you application. However, as you have to decrypt the data before using it the algorithm used is easy to hack into.
Timo

Similar Messages

  • Any easier way to obfuscate email links?

    I don't want email links in my web site to draw spam, so I try to make them invisible to the spammers' web spiders. So far I just use a really simple method: the Obfuscator widget which converts the text into hex codes that all browsers display properly, but that have no @ sign to draw spam. Of course spammers will eventually get smart enough to beat this, but for now it's OK.
    It's a pain though that each time I make any tiny change in my web site, iWeb republishes the whole thing and I have to go into the HTML files with TextWrangler and edit all the emails. I've made it a little easier by saving a copy of the obfuscated version in a text file to paste.
    Has anyone found a simple way to automate this? Is there a handy program that will scan a website folder and fix all the email links for you before you publish?

    Thanks for this pointer. It looks like a really useful and flexible utility. It will be very easy to set it up for my simple edit.
    I will mark the question answered once I get it working.
    Of course it would be even better if iWeb had a preference to automatically obfuscate all mailto: links. That would be dead easy for them to implement, and ought to be the default.

  • Obfuscate in build.xml

    Hi,
    does obfuscating jars in ant in windows not work? I have the following code & get the error that seems to be related to obfuscation.
    <project name="sims" default="CustomerDist" basedir=".">
      <property file="ant.properties"/>
      <property environment="localenv"/>
      <!--
      <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="builder/proguard.jar" />
      -->
      <taskdef classpath="jcoverage.jar" resource="tasks.properties"/>
      <target name="init">
        <fail unless="PROPERTIESLOADED">missing PROPERTIESLOADED, have you renamed ant.properties.sample to ant.properties?</fail>
        <available property="elandlibs_DirectoryExists"
                   file="${elandlibs}"
                   type="dir"
                   />
        <fail unless="elandlibs_DirectoryExists">Cannot find the shared 'javalibs' CVS project. Have you checked this project out of CVS and set the elandlibs property in ant.properties?</fail>
        <mkdir dir="${testbuild}"/>
        <mkdir dir="${build}"/>
        <mkdir dir="${build2}"/>
        <mkdir dir="${dist}"/>
        <mkdir dir="distInternal"/>
        <mkdir dir="${libdir}"/>
        <fail unless="OBFUSCATE_JAR">missing environment variable OBFUSCATE_JAR from ant.properties</fail>
          <!-- Decide whether to OBFUSCATE  the sims jar file-->
          <condition property="obfuscate">
           <not><or>
            <equals arg1="${OBFUSCATE_JAR}" arg2="NO"/>
            <equals arg1="${OBFUSCATE_JAR}" arg2="No"/>
            <equals arg1="${OBFUSCATE_JAR}" arg2="no"/>
            <equals arg1="${OBFUSCATE_JAR}" arg2="False"/>
            <equals arg1="${OBFUSCATE_JAR}" arg2="FALSE"/>
           </or></not>
          </condition>
        <copy todir="${libdir}">
          <fileset dir="extra">
             <include name="com.ibm.mq.jar"/>
             <include name="com.ibm.mqjms.jar"/>
             <include name="elandjavadev-v2.1.008.jar"/>
             <include name="jbcl.jar"/>
             <include name="jgl3.1.0.jar"/>
          </fileset>
        </copy>
        <copy todir="${libdir}">
          <fileset dir="${elandlibs}">
             <include name="xmlrpc-1.1.jar"/>
             <include name="xercesImpl-2.4.jar"/>
             <include name="xml-apis-2.4.jar"/>
             <include name="xmlParserAPIs-2.4.jar"/>
             <include name="elandsdk-1.0.3.jar"/>
             <include name="rwos-v2.4.0.001_int-javaapi.jar"/>
             <include name="log4j-1.2.8.jar"/>
             <include name="oro-2.0.8.jar" />
             <include name="dom4j-1.3.jar" />
                <include name="castor-0.9.5.3-xml.jar"/>
                <include name="jta1.0.1.jar"/>
                <include name="xercesImpl-2.4.jar"/>
          </fileset>
        </copy>
          <path id="castor.classpath">
             <fileset dir="${elandlibs}">
                <include name="castor-0.9.5.3-xml.jar"/>
                <include name="jta1.0.1.jar"/>
                <include name="xercesImpl-2.4.jar"/>
             </fileset>
          </path>
      </target>
      <target name="installer" depends="CustomerDist">
         <copy todir="install">
             <fileset dir="${dist}"/>
         </copy>
         <ant antfile="build.xml" dir="install" target="installer"/>
      </target>
       <target name="refresh_config_beans" depends="init,cleancastorfiles">
           <property name="target_schema" value="RunwaySimulatorConfig.xsd" />
           <echo>Generating code for XSD Schema: ${target_schema}</echo>
          <copy file="RunwaySimulatorConfig.xsd" tofile="src/RunwaySimulatorConfig.xsd"/>
           <java classname="org.exolab.castor.builder.SourceGenerator"
            fork="yes" dir="${src}" classpathref="castor.classpath">
          <arg line="-i ${target_schema} -f -dest . -nomarshall -package com.elandtech.sims.config.castor"/>
           </java>
           <delete file="src/RunwaySimulatorConfig.xsd"/>
       </target>
       <target name="cleancastorfiles" depends="init">
          <delete dir="${src}/com/elandtech/sims/config/castor"/>
            <echo>Deleting the directory: ${src}/com/elandtech/sims/config/castor}</echo>
       </target>
      <target name="compile" depends="init,refresh_config_beans" description="compile the source " >
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.jpg"/>
        </copy>
        <javac srcdir="${src}" destdir="${build}" debug="on" optimize="on" deprecation="off">
          <classpath>
            <fileset dir="${libdir}">
              <include name="**/*.jar" />
            </fileset>
            <pathelement path="${build}" />
          </classpath>
        </javac>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.properties"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.gif"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.jpg"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.txt"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.ghost"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.dec"/>
        </copy>
        <copy todir="${build}">
          <fileset dir="src" includes="**/*.nan"/>
        </copy>
      </target>
      <target name="jar" depends="compile" description="generate JAR file" >
        <mkdir dir="${dist}/lib"/>
        <copy todir="${dist}/lib">
          <fileset dir="${libdir}"/>
        </copy>
        <jar destfile="${dist}/lib/sims.jar"  manifest="jars/sims.mf" >
           <fileset dir="${build}">
               <exclude name="**/itc/**"/>
               <exclude name="**/ghostengines/ITCGhostEngine.class"/>
               <exclude name="**/ghostengines/runway/**"/>
               <exclude name="**/ghostengines/RunwayGhostEngine.class"/>
           </fileset>
        </jar>
        <jar destfile="${dist}/lib/GhostEngineRunway.jar"
           basedir="${build}"
           excludes="*"
           includes="**/ghostengines/runway/** **/ghostengines/RunwayGhostEngine.class **/ghostengines/RequestResponsePair.class" />
        <jar destfile="${dist}/lib/GhostEngineRunway.jar"
           basedir="${build}"
           excludes="*"
           includes="**/ghostengines/runway/** **/ghostengines/RunwayGhostEngine.class" />
        <jar destfile="${dist}/lib/GhostEngineITC.jar"
           basedir="${build}"
           excludes="*"
           includes="**/itc/** **/ghostengines/ITCGhostEngine.class" />
        <!-- <echo>Obfuscate avoidance set to ${localenv.OBFUSCATE}</echo> -->
        <echo>Obfuscate avoidance set to ${OBFUSCATE_JAR}</echo>
      </target>
      <target name="obfuscate" depends="jar" description="obfuscate code" if="obfuscate" >
        <move file="${dist}/lib/sims.jar" tofile="${dist}/lib/sims_unobf.jar"/>
      <taskdef resource="proguard/ant/task.properties"
               classpath="builder/proguard.jar" />
       <proguard ignorewarnings="on" >
            -injars       ${dist}/lib/sims_unobf.jar
            -outjars      ${dist}/lib/sims.jar
            -libraryjars  ${java.home}/lib/rt.jar
            -printmapping progaurd_mapping.txt
            -keep public class com.elandtech.sims.Main {
                public static void main(java.lang.String[]);
            -dontshrink
            -dontoptimize
            -renamesourcefileattribute SourceFile
            -keepattributes InnerClasses,SourceFile,LineNumberTable,Deprecated,Signature,*Annotation*,EnclosingMethod
            <!-- Ghost Engine Classes.. -->
            -keep public class com.elandtech.sims.ghostengines.GhostEngine
            -keep public class com.elandtech.sims.ghostengines.GhostEngine  {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.SimsWithPaternMatchingGhostEngine
            -keep public class com.elandtech.sims.ghostengines.SimsWithPaternMatchingGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.SimsGhostEngine
            -keep public class com.elandtech.sims.ghostengines.SimsGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.RequestResponsePair
            -keep public class com.elandtech.sims.ghostengines.RequestResponsePair {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.ITCGhostEngine
            -keep public class com.elandtech.sims.ghostengines.ITCGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.RunwayGhostEngine
            -keep public class com.elandtech.sims.ghostengines.RunwayGhostEngine {
                public protected *;
            <!-- Logging interface.. -->
            -keep public class com.elandtech.sims.logging.LogManager
            -keep public class com.elandtech.sims.logging.LogManager {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogMessage
            -keep public class com.elandtech.sims.logging.LogMessage {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogGenerator
            -keep public class com.elandtech.sims.logging.LogGenerator {
                public protected *;
            -keep public class com.elandtech.sims.logging.Log4jLogger {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogListener. {
                public protected *;
            -keep public class com.elandtech.sims.logging.FileLogger {
                public protected *;
            <!-- Remote interface.. -->
            -keep public class com.elandtech.sims.api.Handler
             -keep public class com.elandtech.sims.api.Handler {
                  public protected *;
            -keep public class com.elandtech.sims.api.RemoteClient
              -keep public class com.elandtech.sims.api.RemoteClient {
                   public protected *;
            <!-- Configuration classes.. -->
            -keep public class com.elandtech.sims.config.SimsSettings
            -keep public class com.elandtech.sims.config.ConnectionSettings
            -keep public class com.elandtech.sims.config.SimsSettings {
                public protected *;
            -keep public class com.elandtech.sims.config.ConnectionSettings
            -keep public class com.elandtech.sims.config.ConnectionSettings {
                public protected *;
            <!-- Utility classes.. -->
            -keep public class com.elandtech.eland.commonx.text.EString {
                public protected *;
        </proguard>
        <delete file="${dist}/lib/sims_unobf.jar"/>
      </target>
      <!-- Create a Customer distribution. -->
      <target name="CustomerDist" depends="jar, obfuscate, readversion" description="generate the distribution" >
       <copy file="scripts/startup.bat" tofile="${dist}/startup.bat"/>
        <mkdir dir="${dist}/docs"/>
        <copy todir="${dist}/docs">
          <fileset dir="docs" includes="**/*.pdf"/>
        </copy>
        <copy file="RunwaySimulatorConfig.xsd" tofile="${dist}/docs/RunwaySimulatorConfig.xsd"/>
        <copy todir="${dist}">
          <fileset dir="configdist"/>
        </copy>
        <zip zipfile="RunwayHostsSimCustDist${version}.zip">
          <fileset dir="${dist}"/>
        </zip>
      </target>
      <target name="clean" description="clean up" >
        <delete dir="${testbuild}"/>
        <delete dir="${junitreports}"/>
        <delete dir="${build}"/>
        <delete dir="build2"/>
        <delete dir="${dist}"/>
        <delete dir="${libdir}"/>
        <delete dir="distInternal"/>
        <delete dir="tmp"/>
        <delete>
           <fileset dir="." includes="sims-**.zip"/>
        </delete>
      </target>
      <taskdef name="genjar" classname="org.apache.tools.ant.taskdefs.optional.genjar.GenJar" classpath="builder/GenJar.jar"/>
      <path id="classpath">
         <fileset dir="${libdir}">
             <include name="**/*.jar"/>
         </fileset>
      </path>
        <path id="classpath.sims">
            <pathelement location="${build}"/>
            <fileset dir="${libdir}">
                <include name="**/*.jar"/>
            </fileset>
        </path>
        <path id="classpath.build">
           <pathelement location="${build}"/>
        </path>
      <target name="includeAllResources" >
              <unzip dest="build2">
                <patternset>
                    <include name="**/*.properties"/>
                    <exclude name="**/*.java"/>
                    <exclude name="**/*.class"/>
                    <include name="**/*.gif" />
                    <include name="**/*.jpg" />
                </patternset>
                <fileset dir="extra">
                    <include name="**/*.jar"/>
                    <include name="**/*.zip"/>
                </fileset>
            </unzip>
      </target>
      <target name="gen-obfuscate"
              depends="jar"
              description="obfuscate the complete jar" if="obfuscate">
       <taskdef resource="proguard/ant/task.properties"
               classpath="builder/proguard.jar" />
       <move file="distInternal/sims.jar" tofile="distInternal/sims_temp.jar"/>
       <proguard>
            -injars       distInternal/sims_temp.jar
            -outjars      distInternal/sims.jar
            -libraryjars  ${java.home}/lib/rt.jar
            -printmapping progaurd_mapping.txt
            -keep public class com.elandtech.sims.Main {
                public static void main(java.lang.String[]);
            -dontshrink
            -dontoptimize
            -renamesourcefileattribute SourceFile
            -keepattributes InnerClasses,SourceFile,LineNumberTable,Deprecated,Signature,*Annotation*,EnclosingMethod
            <!-- Ghost Engine Classes.. -->
            -keep public class com.elandtech.sims.ghostengines.GhostEngine
            -keep public class com.elandtech.sims.ghostengines.GhostEngine  {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.SimsWithPaternMatchingGhostEngine
            -keep public class com.elandtech.sims.ghostengines.SimsWithPaternMatchingGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.SimsGhostEngine
            -keep public class com.elandtech.sims.ghostengines.SimsGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.RequestResponsePair
            -keep public class com.elandtech.sims.ghostengines.RequestResponsePair {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.ITCGhostEngine
            -keep public class com.elandtech.sims.ghostengines.ITCGhostEngine {
                public protected *;
            -keep public class com.elandtech.sims.ghostengines.RunwayGhostEngine
            -keep public class com.elandtech.sims.ghostengines.RunwayGhostEngine {
                public protected *;
            <!-- Logging interface.. -->
            -keep public class com.elandtech.sims.logging.LogManager
            -keep public class com.elandtech.sims.logging.LogManager {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogMessage
            -keep public class com.elandtech.sims.logging.LogMessage {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogGenerator
            -keep public class com.elandtech.sims.logging.LogGenerator {
                public protected *;
            -keep public class com.elandtech.sims.logging.Log4jLogger {
                public protected *;
            -keep public class com.elandtech.sims.logging.LogListener. {
                public protected *;
            -keep public class com.elandtech.sims.logging.FileLogger {
                public protected *;
            <!-- Remote interface.. -->
            -keep public class com.elandtech.sims.api.Handler
            -keep public class com.elandtech.sims.api.RemoteClient
            <!-- Configuration classes.. -->
            -keep public class com.elandtech.sims.config.SimsSettings
            -keep public class com.elandtech.sims.config.ConnectionSettings
            -keep public class com.elandtech.sims.config.SimsSettings {
                public protected *;
            -keep public class com.elandtech.sims.config.ConnectionSettings
            -keep public class com.elandtech.sims.config.ConnectionSettings {
                public protected *;
            <!-- Utility classes.. -->
            -keep public class com.elandtech.eland.commonx.text.EString {
                public protected *;
       </proguard>
        <delete file="distInternal/sims_temp.jar"/>
      </target>
      <!-- Create a combined distribution where all the classes and resources are combined in to one file. -->
      <target name="InternalDist"
              depends="readversion,jar,includeAllResources"
              description="Generates all in one Jar file">
        <copy file="${dist}/lib/sims.jar" tofile="distInternal/sims.jar"/>
        <!-- first perform the obfuscate  on the core SIMS product -->
        <antcall target="gen-obfuscate"/>
        <!-- Create a sims.jar file containing all the files required to run the sims-->
        <genjar jarfile="distInternal/sims${version}.jar">
          <class name="com.elandtech.sims.Main"/>
          <class name="com.elandtech.sims.ghostengines.SimsGhostEngine"/>
          <class name="com.elandtech.sims.ghostengines.SimsWithPaternMatchingGhostEngine"/>
          <class name="com.elandtech.sims.ghostengines.RunwayGhostEngine"/>
          <class name="com.elandtech.sims.ghostengines.ITCGhostEngine"/>
          <library jar="${libdir}/castor-0.9.5.3-xml.jar"/>
          <library jar="${libdir}/log4j-1.2.8.jar"/>
          <library jar="distInternal/sims.jar"/>
          <library jar="${libdir}/xmlrpc-1.1.jar"/>
          <library jar="${libdir}/xml-apis-2.4.jar"/>
          <library jar="${libdir}/xercesImpl-2.4.jar"/>
          <resource>
             <fileset dir="${build}">
               <include name="**/*.properties" />
               <include name="**/*.gif" />
               <include name="**/*.jpg" />
             </fileset>
          </resource>
          <resource>
             <fileset dir="${build2}">
               <include name="**/*.properties" />
               <include name="**/*.gif" />
               <include name="**/*.jpg" />
             </fileset>
          </resource>
          <classpath>
              <pathelement location="distInternal/sims.jar"/>
            <pathelement location="build"/>
            <fileset dir="${libdir}">
                <include name="**/*.jar"/>
            </fileset>
          </classpath>
          <manifest template="${src}/META-INF/sims.mf"/>
        </genjar>
        <copyfile src="scripts/startup_dist2.bat" dest="distInternal/startup.bat"/>
        <mkdir dir="distInternal/docs"/>
        <copy todir="distInternal/docs">
          <fileset dir="docs" includes="**/*.pdf"/>
        </copy>
        <copy file="RunwaySimulatorConfig.xsd" tofile="distInternal/docs/RunwaySimulatorConfig.xsd"/>
        <replace file="distInternal/startup.bat" token="${SIMS_FILENAME}" value="sims_${version}.jar"/>
        <copy todir="distInternal">
          <fileset dir="configdist"/>
        </copy>
        <zip zipfile="RunwayHostsSimIntDist${version}.zip">
          <fileset dir="distInternal"/>
        </zip>
        <delete file="distInternal/sims.jar"/>
      </target>
      <!--  ************************************************************
                         Create a jar containing the
                         Ghost Runway Ghost Engine API Only
            ************************************************************ -->
      <target name="genGhostEngine"
              depends="readversion,compile,includeAllResources"
              description="Generates all in one Jar file">
          <!-- -->
        <genjar jarfile="ghostEngine.jar">
          <class name="com.elandtech.sims.ghostengines.sample.TestRunwayGhost"/>
          <!--
          <resource>
             <fileset dir="${build}">
               <include name="**/*.properties" />
               <include name="**/*.gif" />
               <include name="**/*.jpg" />
               <include name="**/*.dec" />
               <include name="**/*.ghost" />
               <include name="**/*.txt" />
             </fileset>
          </resource>
          <resource>
             <fileset dir="${build2}">
               <include name="**/*.properties" />
               <include name="**/*.gif" />
               <include name="**/*.jpg" />
               <include name="**/*.dec" />
               <include name="**/*.ghost" />
               <include name="**/*.txt" />
             </fileset>
          </resource>
          -->
          <classpath refid="classpath.sims" />
          <!--<manifest template="${src}/META-INF/sims.mf"/> -->
        </genjar>
      </target>
      <!-- utility task to get version information and put it in to enviornment variables ${version} and ${cvsversion}-->
      <taskdef name="getversion" classname="com.elandtech.anttasks.GetVersion" classpath="builder/elandAntTasks.jar"/>
      <target name="readversion" >
         <getversion file="${app.version.file}" />
         <echo>Reading version information from file = ${app.version.file}</echo>
         <echo>version = ${version}</echo>
         <echo>cvsversion = ${cvsversion}</echo>
      </target>
      <!--
          These targets are defined in versionbuild.xml
      -->
      <!-- Tag all files using the variable ${cvsversion}  read in from ${app.version.file} -->
       <target name="cvstag" depends="readversion">
         <ant antfile="versionbuild.xml" dir="." target="cvstag"/>
      </target>
      <!-- increment mini version number-->
      <target name="newmini" >
         <ant antfile="versionbuild.xml" dir="." target="newmini"/>
      </target>
      <!-- increment minor version number-->
      <target name="newminor"  >
         <ant antfile="versionbuild.xml" dir="." target="newminor"/>
      </target>
      <!-- increment Major version number-->
      <target name="newmajor" >
         <ant antfile="versionbuild.xml" dir="." target="newmajor"/>
      </target>
      <!-- Turn beta version on-->
      <target name="betaon" >
         <ant antfile="versionbuild.xml" dir="." target="betaon"/>
      </target>
      <!-- Turn beta version off-->
      <target name="betaoff" >
         <ant antfile="versionbuild.xml" dir="." target="betaoff"/>
      </target>
      <!--
          These targets are defined in junitbuild.xml
      -->
      <target name="testall" depends="init,compile" description="Calls testall in junitbuild.xml">
         <ant antfile="junitbuild.xml" dir="." target="testall"/>
      </target>
      <target name="testsubset" depends="init,compile" description="Calls testsubset in junitbuild.xml">
         <ant antfile="junitbuild.xml" dir="." target="testsubset"/>
      </target>
      <target name="coverage" depends="init,compile" description="Calls coverage in junitbuild.xml">
         <ant antfile="junitbuild.xml" dir="." target="testall-coverage"/>
      </target>
    </project>and I get th errors:
    BUILD FAILED
    C:\myProjects\sims\build.xml:487: The following error occurred while executing this line:
    C:\myProjects\sims\build.xml:383: Expecting class path separator ';' before 'Files\Java\jre1.5.0_09/lib/rt.jar' in argument number 1
    can anyone help with this please?

    I ran into this same problem when using ProGuard 4.1 for Java obfuscation. The problem is that there is a space in the path to your JDK/JRE, for example: c:\Program Files\Java\jdk1.6.0_03. Because there is a space before the word "Files", it isn't working. The solution to to wrap quotes around that particular command-line argument. In ANT, I needed to use single-quotes (because double-quotes were already in use for the XML attribute) such as:
    <java jar="proguard.jar" fork="true" timeout="30000">
    <arg value="-libraryjars"/>
    <arg value="'${java.home}/lib/rt.jar'"/> <!-- Notice both double and single quotes used on this line. -->
    ...rest of the arguments go here...
    </java>
    Alternatively, using ProGuard's custom ANT Task, it would look something like (notice the use of double-quotes around the rt.jar location):
    <proguard>
    -libraryjars "${java.home}/lib/rt.jar"
    ...rest of the arguments go here...
    </proguard>
    Anyways, I hope this helps you or anyone else who runs into the same problem. Both of these approaches have worked for me.

  • Oneway Wrapping  PL/SQL Programs

    Hello,
    I have wrapped my PL/SQL package successfully through wrap utility, but it can be easily unwrapped by some websites like 'http://www.codecrete.net/UnwrapIt' or unwrap mechanism.
    I need one way encryption for my program. Please suggest if there is any alternative.
    Thanks & Regards
    Pritish
    Edited by: 1004790 on Jun 6, 2013 6:11 AM

    No computer program in any language can be encrypted in a way that prevents someone that owns the server on which the code is running from reversing that encryption. The code, after all, has to be sent to the CPU to be executed. You can find sites that unwrap PL/SQL just like you can find tools that will generate C source code for the Oracle executable or the Java source for whatever JAR file you'd like to consider.
    The best you can do is to buy something like PFCLObfuscate that will obfuscate the code before calling the wrap utility (and calling the older version of the wrap utility which is a touch harder to unwrap and for which there are fewer online unwrapping tools). That requires money to buy the tool, though, and it will add complexity to your code management and deployment process since you have to maintain both a readable and an obfuscated version of the code and ensure that the right thing gets deployed and that no one inadvertently causes there to be differences between the two. And an attacker could still unwrap your code and still see exactly what it is doing, it would just be a bit harder to follow.
    Justin

  • Problem with threads, program always crash

    new to threads, may be doing something COMPLETELY wrong. When I run the program I get a couple of NullPointerExceptions in Thread-0 and Thread-1. I'm confused because it screws up when I call size() for arrayList, and in the API size doesn't throw anything.
    public class ProducerConsumerRunner
       public static void main(String args[])
          Queue q = new Queue(QUEUE_MAX_SIZE);
          ProducerRunnable producer = new ProducerRunnable(q, ITERATIONS);
          ConsumerRunnable consumer = new ConsumerRunnable(q, ITERATIONS);
          //works good up to here
          Thread t1 = new Thread(producer);
          Thread t2 = new Thread(consumer);
          t1.start();
          t2.start();
       private static int ITERATIONS = 50;
       private static int QUEUE_MAX_SIZE = 25;
    import java.util.ArrayList;
    import java.util.concurrent.locks.ReentrantLock;
    public class Queue {
         public Queue(int maxSize)
              list = new ReentrantLock();
              underLimit = list.newCondition();
              MAX_SIZE = maxSize;
         public void add(String line)
              list.lock();
              try{
                           System.out.println("add method of Queue");
                   while(record.size() >= MAX_SIZE){//things get screwed up when this condition is evaluated
                        //size method is crashing the program
                        System.out.println("2");
                        underLimit.await();
                        System.out.println("3");
                   record.add(line);
              }catch(java.lang.InterruptedException e){
                   System.out.println("await interupted: "+e.getMessage());
              }finally{
                   list.unlock();
         public void remove(int line)
              list.lock();
              record.remove(line);
              list.unlock();
         public  ArrayList<String> record;
         private final ReentrantLock list;
         private final java.util.concurrent.locks.Condition underLimit;
         private final int MAX_SIZE;
    import java.util.Date;
    public class ProducerRunnable implements Runnable{
         public ProducerRunnable(Queue q, int itterations)
              this.q = q;
              ITTERATIONS = itterations;
         public void run()
              String date;
              for(int i = 0; i<ITTERATIONS; i++)
                   date = new Date().toString();
                   q.add(date);//this is where it screws up
                   System.out.println(date+" added");
                   try{
                   Thread.sleep(100);
                   }catch(java.lang.InterruptedException e){
                        System.out.println("ProduccerRunnable's sleep was interupted");
         private final Queue q;
         private final int ITTERATIONS;
    public class ConsumerRunnable implements Runnable{
         public ConsumerRunnable(Queue q, int itterations)
              this.q = q;
              ITTERATIONS = itterations;
         public void run()
              //Queue q = new Queue();
              int length;
              for(int i = 0; i<ITTERATIONS; i++)
                   length = q.record.size();//things are getting screwed up here
                   while(q.record.get(length) == null)
                        length--;
                   System.out.println((String)q.record.get(length));
                   q.remove(length);
                   try{
                   Thread.sleep(100);
                   }catch(java.lang.InterruptedException e){
                        System.out.println("ConsumerRunnable's sleep was interupted");
         private final Queue q;
         private final int ITTERATIONS;
    }

    question:
    this works right
         public void remove()
              list.lock();
              int line = 0;
              try{
                   *while(record.size() < 1)*
                        range.await();
                   record.remove(line);
                   range.signalAll();
              }catch(java.lang.InterruptedException e){
                   System.out.println("await interupted: "+e.getMessage());
              }finally{
                   list.unlock();
         }this is deadlock
    *int list = 0;*
    *while((list = record.size)<1) was screwing things up because of the assignment*record is ArrayList of strings. when better to use Vector instead of ArrayList? i notice no differnce and i use threads
    initially I thought record.size was being evaluated and before could be assigned to list, time slice ran out. this could not be case because I use ReentrantLock (list) to lock it.
    Edited by: bean-planet on Apr 1, 2009 4:31 PM

  • ITunes & Windows Vista Home - Error File C:\Program Data\Apple Computer\Installer\Cache\iTunes 10.5.142\iTunes.msi was rejected by digital signature policy.

    Tried
    https://discussions.apple.com/thread/2713232?start=0&tstart=0
    and
    http://www.vistax64.com/vista-general/159940-computer-blocking-anything-no-digit al-signature.html
    with no avail!!!
    iTunes opens after I click OK on the above message however I cannot do anything within the app its like Windows it preventing it from running.
    PLEASE HELP!!!

    Update:
    I tried what the diagnostic told me to do, and repaired the installation. I was able to burn a CD in iTunes, but after I restarted, the drives have disappeared again! Here's the diagnostic info now:
    Microsoft Windows Vista Home Edition (Build 6000)
    MICRO-STAR INC. MS-6728
    iTunes 7.6.0.29
    QuickTime 7.4
    CD Driver 2.0.6.1
    CD Driver DLL 2.0.6.2
    Apple Mobile Device 1.1.3.26
    iTunes Serial Number 20D6EAF059AB94B4
    Current user is not an administrator.
    The current local date and time is 2008-01-15 19:09:32.
    iTunes is not running in safe mode.
    Video Display Information
    ATI Technologies Inc., Radeon X1600/X1650 Series
    ATI Technologies Inc., Radeon X1600/1650 Series Secondary
    ** External Plug-ins Information **
    Plug-in Name: Last.fm iTunes plugin
    Plug-in Loaded: Yes
    Plug-in Version: 0.0.13
    Plug-in File Version: 2.0.13.0
    Plug-in Path: C:\Program Files\iTunes\Plug-ins\itw_scrobbler.dll
    No drives showed up to be tested.

  • Error while running a Java Program

    Can anyone help me,
    I am getting the following error while running a Java program, Below is the exception thrown, please help.
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RESummer1.run(RESummer1.java:505)
    java.nio.BufferOverflowException
    at java.nio.Buffer.nextPutIndex(Buffer.java:425)
    at java.nio.DirectByteBuffer.putChar(DirectByteBuffer.java:463)
    at org.jetel.data.StringDataField.serialize(StringDataField.java:295)
    at org.jetel.data.DataRecord.serialize(DataRecord.java:283)
    at org.jetel.graph.DirectEdge.writeRecord(DirectEdge.java:216)
    at org.jetel.graph.Edge.writeRecord(Edge.java:288)
    at com.tcs.re.component.RECollectCont.run(RECollectCont.java:304)

    Ok, let's see. Write the following class:
    public class Grunt {
      public static void main(String[] args) {
        System.out.println("Hello Mars");
    }Save it as "C:\Grunt.java", compile by typing:
    javac c:\Grunt.javaRun by typing:
    java -classpath "C:\" GruntDoes it say "Hello Mars"? If yes, go back to your program and compare for differences (maybe you used the "package" statement?).
    Regards

  • How do I install all my old programs and data from an old system folder after I have reinstalled the same OSX system after a crash?

    The system is OSX10.5.8 Leopard on a 2009 imac. A new system was installed from the installation disks and the original system saved to a folder.
    I need to use my Adobe programs, rescue my email, i-tunes and iphoto data.  The disk utility indicates that my Time Machine back-up disk is damaged and I don't want to take a risk of having Time Machine erase my hard drive and try to reinstall the exact system existing at the time of the crash.  There was over 650 gb of stored files that I was copying and removing from the drive at the time it crashed. The total size of the original system file is still about 650 Gb.
    I would prefer to go back in Time Machine and only rescue the programs as most of the files have been copied to external hard drives, but I can't access the back-up hard drive from the new version of the Time Machine.  Or by I don't want the Time Mchine to start copying the new operating system which would include all the data in the old system file. Time Machine was working fine at the time of the crash.

    No, the disk was backed up with time machine a few hours prior to the crash.  I was unable to open the computer when I tried to restart it- got a grey screen with the spinning disk- after a few minutes the screen would go black and would reboot continuously, but not load any images or programs. I started the computer from the 10.5.4 installation disks and checked both the time machine external hard drive and the Imac internal drive with the disk utilities. Both showed as damaged --the internal drive and permissions were repaired, but the external drive (time machine back-up)  was damaged and not repairable by disk utilities. I don't believe that the external drive for Time Machine was connected to the computer at the time of the crash as I was copying files to a different hard drive drive. And I was not having any problems with the TM back-up drive prior to the crash.
    I accessed the Imac internal disk by firewire (as a target disk) and copied as many data files as I had room for on my external hard drives available.  And I deleted quite a few files from the imac internal drive (mostly just jpegs, duplicate tifs, etc--nothing that was used by i-photos, i-tunes or the Mail program).
    Then I installed a new OSX10.5.4 system from the installation disk and the old system was moved to a folder on the hard drive.  I previousy had had the option to reinstall the complete system from Time Machine when I connected that drive and booted with the installation disks with the C key depressed.  But it didn't seem like a good option because I was unsure of the condition of that external disk and whether it would be able to reinstall my data correctly, once it had erased my internal hard drive. 
    I'm considering buying some new external hard drives and backing up the present system to time Machine (so I'll still have my old data in the old system folder).  And then I would try using the old Time Machine back-up to try to reinstall the sytem previous to the crash.  That back-up would reinstall about 700gb of data and operating software and programs which sounds like a lengthy back-up.  Since I have never used Time Machine to do a full reinstallation (I've only used it for individual files), I'm reluctant to do anything rash.
    I'm a professional designer (with a deadline) but I can still use my Illustrator and Photoshop by opening them from the old system folder and saving the files to an external drive.  So it's not neccessary to do anything hasty except to delete some of the excess art and document files that were causing the computer to run slowly and the  Adobe programs to crash when I tried to save my work. I have quite a few books on tape in the i-tumes folder which is probably talking up tons of space but I don't where the i-tunes files live.
    Thanks for any help. Peggy
    Message was edited by: peggy toole

  • Error:  "Could not complete your request because of a program error" (photoshop CS2 9.0.2 on MAC OSX

    Today I started my program (photoshop CS2 9.0.2) and opened a JPG file. When I went to print the file the program crashed and closed. When I restarted the program and went to open the file I got this error message, "Could not complete your request because of a program error".
    I have tried several different file types/sizes and all result in the same error message since the program crashed. It will not open any file I try to open. As I indicated above I am using Photoshop CS2 9.0.2 it is on a MAC with OSX 10.4.11.
    I called Adobe and the Rep directed me to Tech Note 331307 and told me to Re-create the Photoshop preferences files. Which I did and restarted the program, but when I tried to open a file (any file) I still get the same error message so it doesn't appear to be the preferences.
    Does anyone have any info as to what the problem may be and how to correct it.
    Thanks

    Thanks for the response. OK... This is the first day I have been able to get back to the problem.
    My system I am running Photoshop on is a Power Mac G4, AGP Graphics ATY Rage 128Pro chip set 16MB VRAM LCD 1280x1024 32-bit color, 500MHz, 1.75GB of memory, 1 MB L2 Cache, 100 MHz Bus Speed. I had installed the latest security update and repaired the permissions the day the problem started.
    Now to day I started the system and went in and created a Guest Account. I logged into the guest account and started Photoshop. Low and behold it worked just fine. So I logged out of guest and logged into my main user account And started Photoshop. Wouldn't you know it.... It works just fine. I can open any file I want with now problems.
    I got to thinking after I had done all of this that I wished I had tried to open a file in Photoshop today prior to creating the guest account to see if it still had the problem in my main user account.
    I did not change anything else on the system and all seems to work fine now. So at his point I am really not sure what the problem was.
    Again thanks for taking the time to respond to this issue.

  • Photoshop CS2 (program error msg)... Help please!!

    I have installed the full creative suite 2 on my new iMac. everything works fine except photoshop?!!?
    Illustrator works great, In-Design works great, But when i try to open a file or create a new page in PS it tells me "Could not create document because of a program error"???? ***?
    I had a previous version of CS and it worked fine for one day, then that started happening. I installed the CS2 trial version, and it would still give me the same error msg. I erased everything and installed the new CS2 (photoshop, illustrator , in-design and acrobat). It still gives me the same darn msg.???
    Any help would be greatly appreciated!
    thanks

    See the Adobe Knowledge Base document"Error 'Could not complete your request...' or 'Could not create a new document...' (Photoshop CS2 on Mac OS X v10.4)"
    I suggest whenever you have problems with third-party applications, the first place to start troubleshooting is with the application's documentation, then vendor's web site. Usually their sites have FAQs, lists of known bugs, or application-specific forums similar to these Discussions. Sometimes, unlike the Apple Discussions, the questions are even answered by employees of the vendor.
    The document cited above was found in 10 seconds by searching the Adobe support site.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • PhotoShop CS2 "Program Error" when printing

    I am posting this to the Adobe Forums as well, but thought someone here might have some ideas. am having an intermittent problem printing from PhotoShop CS2 to an Epson 9800. When printing large files (200 MB average) to the Epson, PhotoShop will spool the job, taking about 50% longer than normal, and when complete, displays the following message..."The file XXXX.tif could not be printed because of a program error" No job ever gets to the print que. This happens about 80% of the time when printing. Quitting and restarting PhotoShop generally fixes the problem, and the file can be printed from another computer without issue, so this is not file specific. I have 8GB of RAM installed and PhotoShop running under 100% available memory, cache level at 8, with a dedicated 180GB scratch disk. Memory should NOT be the problem, though I do often have the full layered version of the file open in the background (I am printing from a flattened copy. I have observed that the problem is less likely to occur if no other files are open. I have a second G5 with the exact same software setup (OS, Print Driver and PhotoShop down to the decimal version #) that works perfectly every time. I have run all of the System utilities (Repair Permissions, FSCK, etc), reset the OSX printing system, reset PS preferences, trashed and re installed CS, as well as the Epson printer driver, all with no success. Any other trouble shooting ideas would be greatly appreciated. I would love to avoid a System reinstall.

    See the Adobe Knowledge Base document"Error 'Could not complete your request...' or 'Could not create a new document...' (Photoshop CS2 on Mac OS X v10.4)"
    I suggest whenever you have problems with third-party applications, the first place to start troubleshooting is with the application's documentation, then vendor's web site. Usually their sites have FAQs, lists of known bugs, or application-specific forums similar to these Discussions. Sometimes, unlike the Apple Discussions, the questions are even answered by employees of the vendor.
    The document cited above was found in 10 seconds by searching the Adobe support site.
    Good luck!
    Dr. Smoke
    Author: Troubleshooting Mac® OS X

  • KABA connection issue - program not registered

    I am trying to troubleshoot a connection error between SAP and KABA.  I have the RFC created in SAP and when I test the connection I get a program not registered.  The KABA "amsproc" service on the KABA side has been restarted, we have occasionally received a password locked message in the SAP system log after restarting the KABA service (I believe this means SAP and KABA are communicating).  We have since reset the password, but we can not successfully test the RFC and when attempting to send IDOC's out we get the program not registered error.  Is there something on the SAP side that needs to be done to register the program or is starting the service on the KABA side going to register the program with SAP?  Any assistance would be appreciated.

    Hi,
    In Central Management Console ie, Admin application of BOE, you need to configure the BW system. Use the below URL,
    http://<serverhostname>:<port>/CmcApp
    After logging in Select the Authentication and SAP as authentication type.  Regarding how to configure, follow the configuration steps mentioned in the below article:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a00ee3b2-5283-2b10-f1bf-8c6413e0898f
    Once you import the roles with the above configuration, the user with which you are validating the RFC connection will be imported in the BOE.
    Now, verify the RFC in the BW system.
    Regards,
    Noor.

  • Help me to Edit this program

    Hi All,
    Can anyone kind enought to help me to add the START and STOP button for this "bouncing ball" program that i got from the internet ? Below is the java coding.
    import java.awt.*;
    import java.applet.*;
    class Obstacle
         public Rectangle r;
         Graphics g;
         public Obstacle(int x,int y,int w,int h)
              r=new Rectangle(x,y,w,h);
         public void paint(Graphics gr)
              g=gr;
              g.setColor(Color.lightGray);
              g.draw3DRect(r.x,r.y,r.width,r.height,true);
    class CollideBall
         int width, height;
         public static final int diameter=20;
         //coordinates and value of increment
         double x, y, xinc, yinc, coll_x, coll_y;
         boolean collide;
         Color color;
         Graphics g;
         Rectangle r;
         //the constructor
         public CollideBall(int w, int h, int x, int y, double xinc, double yinc, Color c)
              width=w;
              height=h;
              this.x=x;
              this.y=y;
              this.xinc=xinc;
              this.yinc=yinc;          
              color=c;          
              r=new Rectangle(150,80,130,90);
         public double getCenterX() {return x+diameter/2;}
         public double getCenterY() {return y+diameter/2;}
         public void alterRect(int x, int y, int w, int h)
              r.move(x,y);
              r.resize(w,h);
         public void move()
              if (collide)
                   double xvect=coll_x-getCenterX();
                   double yvect=coll_y-getCenterY();
                   if((xinc>0 && xvect>0) || (xinc<0 && xvect<0))
                        xinc=-xinc;
                   if((yinc>0 && yvect>0) || (yinc<0 && yvect<0))
                        yinc=-yinc;
                   collide=false;
              x+=xinc;
         y+=yinc;
              //when the ball bumps against a boundary, it bounces off
         if(x<6 || x>width-diameter)
              xinc=-xinc;
                   x+=xinc;
              if(y<6 || y>height-diameter)
              yinc=-yinc;
                   y+=yinc;
              //cast ball coordinates to integers
              int x=(int)this.x;
              int y=(int)this.y;
              //bounce off the obstacle
              //left border
              if(x>r.x-diameter&&x<r.x-diameter+7&&xinc>0&&y>r.y-diameter&&y<r.y+r.height)
              xinc=-xinc;
                   x+=xinc;
              //right border
              if(x<r.x+r.width&&x>r.x+r.width-7&&xinc<0&&y>r.y-diameter&&y<r.y+r.height)
              xinc=-xinc;
                   x+=xinc;
              //upper border
              if(y>r.y-diameter&&y<r.y-diameter+7&&yinc>0&&x>r.x-diameter&&x<r.x+r.width)
                   yinc=-yinc;
                   y+=yinc;
              //bottom border
              if(y<r.y+r.height&&y>r.y+r.height-7&&yinc<0&&x>r.x-diameter&&x<r.x+r.width)
                   yinc=-yinc;
                   y+=yinc;
         public void hit(CollideBall b)
              if(!collide)
                   coll_x=b.getCenterX();
                   coll_y=b.getCenterY();
                   collide=true;
         public void paint(Graphics gr)
              g=gr;
              g.setColor(color);
              //the coordinates in fillOval have to be int, so we cast
              //explicitly from double to int
              g.fillOval((int)x,(int)y,diameter,diameter);
              g.setColor(Color.white);
              g.drawArc((int)x,(int)y,diameter,diameter,45,180);
              g.setColor(Color.darkGray);
              g.drawArc((int)x,(int)y,diameter,diameter,225,180);
    public class BouncingBalls extends Applet implements Runnable
         Thread runner;     
         Image Buffer;
    Graphics gBuffer;          
    CollideBall ball[];
         Obstacle o;
    //how many balls?
    static final int MAX=10;
         boolean intro=true,drag,shiftW,shiftN,shiftE,shiftS;
         boolean shiftNW,shiftSW,shiftNE,shiftSE;
         int xtemp,ytemp,startx,starty;
         int west, north, east, south;
         public void init()
              Buffer=createImage(size().width,size().height);
              gBuffer=Buffer.getGraphics();                         
              ball=new CollideBall[MAX];
              int w=size().width-5;
              int h=size().height-5;          
              //our balls have different start coordinates, increment values
              //(speed, direction) and colors
              ball[0]=new CollideBall(w,h,50,20,1.5,2.0,Color.orange);
    ball[1]=new CollideBall(w,h,60,210,2.0,-3.0,Color.red);
    ball[2]=new CollideBall(w,h,15,70,-2.0,-2.5,Color.pink);
    ball[3]=new CollideBall(w,h,150,30,-2.7,-2.0,Color.cyan);
    ball[4]=new CollideBall(w,h,210,30,2.2,-3.5,Color.magenta);
              ball[5]=new CollideBall(w,h,360,170,2.2,-1.5,Color.yellow);
              ball[6]=new CollideBall(w,h,210,180,-1.2,-2.5,Color.blue);
              ball[7]=new CollideBall(w,h,330,30,-2.2,-1.8,Color.green);
              ball[8]=new CollideBall(w,h,180,220,-2.2,-1.8,Color.black);
              ball[9]=new CollideBall(w,h,330,130,-2.2,-1.8,Color.gray);
              o=new Obstacle(150,80,130,90);
              west=o.r.x;
              north=o.r.y;
              east=o.r.x+o.r.width;
              south=o.r.y+o.r.height;
         public void start()
              if (runner == null)
                   runner = new Thread (this);
                   runner.start();
    public void stop()
              if (runner != null)
         runner.stop();
         runner = null;
         public void run()
              while(true)
                   Thread.currentThread().setPriority(Thread.MAX_PRIORITY);
                   try {runner.sleep(15);}
         catch (Exception e) { }               
                   //move our balls around
                   for(int i=0;i<MAX;i++)
                        ball.move();
                   handleCollision();
                   repaint();     
         boolean collide(CollideBall b1, CollideBall b2)
              double wx=b1.getCenterX()-b2.getCenterX();
              double wy=b1.getCenterY()-b2.getCenterY();
              //we calculate the distance between the centers two
              //colliding balls (theorem of Pythagoras)
              double distance=Math.sqrt(wx*wx+wy*wy);
              if(distance<b1.diameter)                         
                   return true;          
                   return false;     
         void changeCursor(int x, int y)
              Rectangle r=new Rectangle(o.r.x+1,o.r.y+1,o.r.width-1,o.r.height-1);
              Frame BrowserFrame;
              Component ParentComponent;
              ParentComponent = getParent();
              while ( ParentComponent != null &&
              !(ParentComponent instanceof Frame))           
              ParentComponent = ParentComponent.getParent();          
              BrowserFrame = (Frame) ParentComponent;
              if(shiftNW||shiftSE)
                   BrowserFrame.setCursor(Frame.SE_RESIZE_CURSOR);
              else if(shiftNE||shiftSW)
                   BrowserFrame.setCursor(Frame.SW_RESIZE_CURSOR);
              else if(shiftW)
                   BrowserFrame.setCursor(Frame.W_RESIZE_CURSOR);
              else if(shiftN)
                   BrowserFrame.setCursor(Frame.N_RESIZE_CURSOR);
              else if(shiftE)
                   BrowserFrame.setCursor(Frame.W_RESIZE_CURSOR);
              else if(shiftS)
                   BrowserFrame.setCursor(Frame.N_RESIZE_CURSOR);
              else if(r.inside(x,y))
                   BrowserFrame.setCursor(Frame.MOVE_CURSOR);
              else
                   BrowserFrame.setCursor(Frame.DEFAULT_CURSOR);
         public boolean mouseMove(Event evt,int x,int y)
              //the corner areas of the obstacle
              Rectangle nw,sw,ne,se;
              nw=new Rectangle(o.r.x-2,o.r.y-2,4,4);
              if(nw.inside(x,y))
                   shiftNW=true;
              else shiftNW=false;
              sw=new Rectangle(o.r.x-2,o.r.y+o.r.height-2,4,4);
              if(sw.inside(x,y))
                   shiftSW=true;
              else shiftSW=false;
              ne=new Rectangle(o.r.x+o.r.width-2,o.r.y-2,4,4);
              if(ne.inside(x,y))
                   shiftNE=true;
              else shiftNE=false;
              se=new Rectangle(o.r.x+o.r.width-2,o.r.y+o.r.height-2,4,4);
              if(se.inside(x,y))
                   shiftSE=true;
              else shiftSE=false;          
              if(x>o.r.x-2&&x<o.r.x+2&&y>o.r.y&&y<o.r.y+o.r.height)
                   shiftW=true;
              else shiftW=false;
              if(x>o.r.x+o.r.width-2&&x<o.r.x+o.r.width+2
                   &&y>o.r.y&&y<o.r.y+o.r.height)
                   shiftE=true;
              else shiftE=false;
              if(y<o.r.y+2&&y>o.r.y-2&&x>o.r.x&&x<o.r.x+o.r.width)
                   shiftN=true;
              else shiftN=false;
              if(y>o.r.y+o.r.height-2&&y<o.r.y+o.r.height+2
                   &&x<o.r.x+o.r.width)
                   shiftS=true;
              else shiftS=false;
              changeCursor(x,y);
              return true;
         public boolean mouseDown(Event evt,int x,int y)
              Rectangle r=new Rectangle(o.r.x+2,o.r.y+2,o.r.width-4,o.r.height-4);
              if(r.inside(x,y))
                   drag=true;
                   startx=x;
                   starty=y;
                   xtemp=o.r.x;
                   ytemp=o.r.y;
              else drag=false;
              changeCursor(x,y);
              return true;
         public boolean mouseDrag(Event evt,int x,int y)
              intro=false;
              Rectangle bounds=new Rectangle(5,5,size().width-5,size().height-5);
              int endx, endy;          
              endx=x-startx;
              endy=y-starty;     
              //disable mouse actions past boundaries
              if(x<5)x=5;
              if(y<5)y=5;
              if(x>bounds.width)x=bounds.width;
              if(y>bounds.height)y=bounds.height;
              if(drag)
                   //disallow to move past border
                   int ox=endx+xtemp;
                   int oy=endy+ytemp;
                   if(ox<5)ox=5;
                   if(oy<5)oy=5;
                   if(ox>bounds.width-o.r.width)
                        ox=bounds.width-o.r.width;
                   if(oy>bounds.height-o.r.height)
                        oy=bounds.height-o.r.height;     
                   o.r.move(ox,oy);                    
                   west=o.r.x;
                   north=o.r.y;
                   east=o.r.x+o.r.width;
                   south=o.r.y+o.r.height;                              
              else
                   if(shiftNW){west=x;north=y;}
                   else if(shiftNE){east=x;north=y;}
                   else if(shiftSW){west=x;south=y;}
                   else if(shiftSE){east=x;south=y;}
                   else if(shiftW)west=x;
                   else if(shiftE)east=x;
                   else if(shiftN)north=y;
                   else if(shiftS)south=y;                                                       
                   //disallow resizing below 40*40
                   int MIN=40;
                   if(east-west<MIN)
                        //shiftNW=shiftNE=shiftSW=shiftSE=shiftW=shiftE=false;
                        if(shiftW||shiftNW||shiftSW)
                             west=east-MIN;
                        if(shiftE||shiftNE||shiftSE)
                             east=west+MIN;
                   if(south-north<MIN)
                        //shiftNW=shiftNE=shiftSW=shiftSE=shiftN=shiftS=false;
                        if(shiftN||shiftNW||shiftNE)
                             north=south-MIN;
                        if(shiftS||shiftSE||shiftSW)
                             south=north+MIN;
              //report altering of obstacle to ball objects and obstacle
              for(int i=0;i<MAX;i++)
                   ball[i].alterRect(o.r.x,o.r.y,o.r.width,o.r.height);
              o.r.move(west,north);
              o.r.resize(east-west, south-north);
              changeCursor(x,y);
              return true;
         private void handleCollision()
              //we iterate through all the balls, checking for collision
              for(int i=0;i<MAX;i++)
                   for(int j=0;j<MAX;j++)
                             if(i!=j)
                                  if(collide(ball[i], ball[j]))
                                       ball[i].hit(ball[j]);
                                       ball[j].hit(ball[i]);
         public void update(Graphics g)
              paint(g);
         public void paint(Graphics g)
              gBuffer.setColor(Color.lightGray);
              gBuffer.fillRect(0,0,size().width,size().height);
              gBuffer.draw3DRect(5,5,size().width-10,size().height-10,false);               
              //paint the obstacle rectangle
              o.paint(gBuffer);
              //paint our balls
              for(int i=0;i<MAX;i++)
                        ball[i].paint(gBuffer);     
              if(intro)
                   gBuffer.setColor(Color.red);
                   gBuffer.setFont(new Font("Helvetica", Font.PLAIN, 12));               
                   gBuffer.drawString("You can move and resize the rectangle!",20,30);
                   gBuffer.setFont(new Font("Helvetica", Font.PLAIN, 10));
              g.drawImage (Buffer,0,0, this);                    

    Hello, please use code tags next time you post code. You can do so by adding [code] [/code] round blocks of code. So
    [code]
    class Code {
    private static final String codeHere = "code here";
    [/code]
    will be rendered as
    class Code {
      private static final String codeHere = "code here";
    We will not do your homework for you, we will however help when you are stuck and point you in the right direction. So what have you tried? What happened?
    Don't know how to begin? What makes the ball move?

  • I dont see text options in the RFEBKA00 program

    Hello friends,
    When I run the RFEBKA00 program, I don´t see the text of the every radio button options.
    How I can solve this problem,
    Can you help me please,
    Regards
    David

    did you solve this problem? can you tell me how?

  • I am unable to open my Photoshop program after installing the entire Creative Suite: Premium Production 6. All other programs work, but with Photoshop it says that the program is "locked or in use by another user". I need this fixed immediately.

    I am unable to open my Photoshop program after installing the entire Creative Suite: Premium Production 6. All other programs work, but with Photoshop it says that it "Could not open a scratch file because the file is locked, you do not have necessary access permissions, or another program is using the file. Use the 'Properties' command in the Windows Explorer to unlock the file." Then I select "OK" and the next message comes up "Could not initialize Photoshop because the file is locked, you do not have the necessary permissions, or another program is using the file. Use the 'Properties' command in the Windows Explorer to unlock this file. I installed all of the programs on the same day from a CD. I need this fixed immediately.
    I am not interested in switching to Creative Cloud, so don't even suggest it. I spoke to Mashmi (or something to that effect) on the "Support" Chat and there was absolutely no support. Useless actually.
    Thanks in advance.

    Could not open a scratch file because the file is locked or you do not have the necessary access privileges. (…) | Mylen…
    Mylenium

Maybe you are looking for

  • After upgrade to iOS 8.3 screen reader in iBooks crashes

    It happened on my iPhone 4S and iPad Air today After an upgrade. When in iBooks, screen reader reads the page on the screen, finishes reading the text, turns the page but gives up (crashes?) immediately after. the reader "toolbar" simply disappears.

  • Insert flash video? Won't play

    Any tips on inserting Flash video into a project in Captivate 4? I can get video to appear an play in Preview, but after publishing, the video doesn't appear and the slide forwards. (Also, there seems to be a conssitent problme where preview is inacc

  • Matrix with excel output?

    Hi I was wondering if creating a matrix report with excel output is possible? _*                                                                                                                                                                          

  • WRT600N Security Log

    Is anyone else having this prob? When I view my logs , my security log keeps saying incorect username-password=admin and gives my laptop pc address. Starnge even though i can lod in with no probs with my password. I am hoping this is just a bug that

  • SAP BW OPENINGS

    Hai, I  finished my masters in information systems and planning to start my career in SAP BW. I just want to have an idea about the different areas  available in BW. Thanks