Review my Code

Good everyone,
Can someone look at my code to tell me if there is a way make it more compact. I want to stop users from entering the same data over and over.
<cfif 'FORM.StartUnits' eq 0>
<cflocation url="../errorPages/startunitsGTendunits.cfm">
<cfelseif FORM.StartUnits GT FORM.EndUnits>
<cflocation url="../errorPages/startunitsGTendunits.cfm">
<cfelseif IsDefined('FORM.Workorder')>
<cfelse>
<cflocation url="../Production/workordersearch.cfm">
</cfif>
<cfset FORM.DelayTime = (FORM.DelayTimeHours + (FORM.DelayTimeMinutes/60)) >
<cfset FORM.ProdTime = (FORM.ProTimeHours + (FORM.ProTimeMinutes/60)) >
<cfset FORM.CoTime = (FORM.CoTimeHours + (FORM.CoTimeMinutes/60)) >
<cfset FORM.UnitsProd = FORM.EndUnits - (FORM.StartUnits) + 1 >
<cfparam name="FORM.WorkOrder" default="1">
<cftransaction>
<cftry>
<cfquery name="insertProduction" datasource="#REQUEST.datasource#">
IF NOT EXISTS
select WorkOrder, StartUnits
from tbl_Assembly_Production
where workorder = '#FORM.Workorder#' and StartUnits = '#FORM.StartUnits#'
BEGIN
INSERT INTO tbl_Assembly_Production (dateProd, Shift, Area, Jig, EmpNo, WorkOrder, Item, Model, ProdTime, CoTime, startUnits, endUnits, NpTime, UnitsProd, ProdDelayTime, CoDelayTime, Comment)
VALUES ('#Trim(FORM.dateProd)#',
        '#Trim(FORM.Shift)#',
        '#Trim(FORM.Area)#',
        '#Trim(FORM.jig)#',
        '#Trim(FORM.EmpNo)#',
        '#Trim(FORM.WorkOrder)#',
        '#Trim(FORM.Item)#',
        '#Trim(FORM.Model)#',
        '#Trim(FORM.ProdTime)#',
        '#Trim(FORM.CoTime)#',
        '#Trim(FORM.startUnits)#',
        '#Trim(FORM.endUnits)#',
        '#Trim(FORM.NpTime)#',
        '#Trim(FORM.UnitsProd)#',
        '#Trim(FORM.ProdDelayTime)#',
        '#Trim(FORM.CoDelayTime)#',
        '#Trim(FORM.Comment)#')
END       
</cfquery>
Thank You. Work Order <cfoutput>#FORM.WORKORDER#</cfoutput> with Starting Unit <cfoutput>#FORM.StartUnits#</cfoutput> has already been entered. You can enter this unit only once!!!.
<cfcatch type="database">
Work Order <cfoutput>#FORM.WORKORDER#</cfoutput> with Starting Unit <cfoutput>#FORM.StartUnits#</cfoutput> is already entered.  Record Not Inserted!!!.
</cfcatch>
</cftry>
<cfquery name="insertAssemblyDelay" datasource="#REQUEST.datasource#">
INSERT INTO tbl_Assembly_Delay(ID, Code, DelayTime)
SELECT ID , '#Trim(FORM.Code)#', '#Trim(FORM.DelayTime)#'
FROM tbl_Assembly_Production
WHERE tbl_Assembly_Production.WorkOrder = '#FORM.WorkOrder#'
</cfquery>
<cftry>
<cfset list1 = #FORM.Unit# >
<cfset list2 = #FORM.WorkOrder#>
<cfset list3 = #FORM.YearAssy#>
<cfloop list="#list1#" index="j">
<cfloop list="#list2#" index="k">
<cfloop list="#list3#" index="m">
<cfquery name="insertunits" datasource="#REQUEST.datasource#">
IF NOT EXISTS
select ID, Workorder, Unit
from tbl_Assembly_Unit
where Workorder = '#k#' and Unit = '#m#'
BEGIN
Insert into tbl_assembly_Unit(ID, YearAssy, WorkOrder, Unit)
SELECT ID, '#Trim(FORM.YearAssy)#', '#Trim(k)#', '#Trim(j)#'
FROM tbl_Assembly_Production
WHERE tbl_Assembly_Production.Workorder = '#FORM.WorkOrder#'
END
</cfquery>
</cfloop>
</cfloop>
</cfloop>
Your Unit(s) have been added.
<cfcatch type="database">
The Unit(s) you listed cannot be more than once.
</cfcatch>
</cftry>
</cftransaction>

It's probably simpler than you think.  For the sake of this demo, I'll assume your 3 lists have the same number of elements.  You can simply do this.
<cfloop from = "1" to = ListLen(List1), index = "ii">
insert into your table (field1, field2, field3)
values
(ListGetAt(List1, ii)
, ListGetAt(List1, ii)
, ListGetAt(List1, ii) )
closing tags, proper syntax, etc.

Similar Messages

  • April 1 2013 - contact form not sending - need a review of code - see below

    i have a html5 responsive design for website - tested out the contact page and the [email protected] email links in the about and at bottom of website in dreamweaver CS5 on my computer and it works - these do not work when tested from iphone or other computer - can you review the code below and provide any soultions to get the email links and the contact page to work?
    <div class="space"> </div>
            <div class="clear"> </div>      
            <div class="clear"> </div>
          </div>
        </div>
        <div class="page" id="contact">
          <!-- page contact -->
          <h3 class="page_title"> Let's Get Started</h3>
          <div class="page_content">
            <fieldset id="contact_form">
              <div id="msgs"> </div>
              <form id="cform" name="cform" method="post" action="">
                <input name="name" type="text" class="whitetextcontent" id="name" onfocus="if(this.value == 'Full Name*') this.value = ''"
                                onblur="if(this.value == '') this.value = 'Full Name*'" value="Full Name*" />
                <input name="email" type="text" class="whitetextcontent" id="email" onfocus="if(this.value == 'Your Email Address*') this.value = ''"
                                onblur="if(this.value == '') this.value = 'Your Email Address*'" value="Your Email Address*" />
                <input name="subject" type="text" class="whitetextcontent" id="subject" onfocus="if(this.value == 'Subject*') this.value = ''"
                                onblur="if(this.value == '') this.value = 'Subject*'" value="Subject*" />
                <textarea name="message" class="whitetextcontent" id="message" onfocus="if(this.value == 'Your Message*') this.value = ''"
                                onblur="if(this.value == '') this.value = 'Your Message*'">Your Message*</textarea>
                <button id="submit" class="button"> Send Message</button>
              </form>
            </fieldset>
            <div class="clear"> </div>
          </div>
        </div>
        <div class="footer">
          <p><a href="mailto:[email protected]">© 2013 Karen P White Design, LLC</a></p>
        </div>
      </div>

    greetings everyone -
    thank  you for your quick replys - i reviewed and did some digging .....
    to answer some of your Qs:
    J Carp:  thanx for noting the blank between""   i found a contact.php file and added "[email protected]" between the "" so it would point to the PHP script that processes the form.
    M summers: the forms code is in php for the contact forms subscription.  index html for the main page and contact.php for form part
    Nancy O - not sure i understand this fully "
    "mailto: links only work on devices that have dedicated e-mail software installed on them.  If the end user doesn't have e-mail software, the mailto link does nothing.".... "
    Best practice is to use a form-to-email processing script that hides your address from robots and has spam prevention built in.
    Contact your web host.  Many hosts provide scripts on their servers which you can activate through your Admin Panel or by referencing the script in your form's action attribute.
         <form action="path-on-server/form-to-email-script.php">"
    BUT it helped me to see that i had to dig and look for other files that needed editing. thanx
    i have done testing from different browsers on different computers for the contact form send/submit page and it is working so far.
    thank you all for this information - it all has helped. i will be reviewing the email "mailto" href link now to see if that works....
    KPW

  • POF Extractor and Collections (review my code)

    I have the following requirement which I don't think the current POF extractors can meet:
    I have Class-A implementing PortableObject that has a number of fields. One of those fields (lets say POF index 103) is a Collection of Class-B which is also a PortableObject with a number of fields.
    Now... If I want to just extract the value of the Collection from Class-A I can just use a normal POF Extractor like this
    new PofExtractor(java.util.List.class, new SimplePofPath(103)); But... Say I want back all the instances of field 100 of Class-B from the Collection of Class-B instances in Class-A (returned as a Collection).
    As far as I know I cannot do this with SimplePofExtractor so I have written my own PofNavigator that works in the way I require.
    My code will navigate down a tree of PortableObject instances handling Collections as it goes.
    So in my previous example above if the field I wanted from Class-B was itself a PortableObject I could navigate
    further down to get values from that class (just like a normal SimplePofPath).
    So if anyone wuld like to review my code it is below.
    From testing it looks like it works but I would be grateful of any pointers to make it more efficient
    or if I have made any mistakes as being a hard core developer I have jumped straight into code
    rather than reading the POF spec from cover to cover :-)
    Cheers,
    JK
    P.S. Apologies for how wide this looks on the screen but my code appears to have stretched the formatting a little.
    * This is a version of a POF Navigator that
    * can deal with POF fields that are Collections.
    * <p/>
    * If any of the fields in the path of POF indexes
    * supplied to the constructor are Collections
    * then the result will be a Collection of all
    * of the results of the rest of the POF
    * tree navigation.
    * <p/>
    * @author Jonathan Knight
    public class PofCollectionPath extends AbstractPofPath {
         * The POF indexes to navigate
        private int[] elements;
         * Default constructor necessary for PortableObject interface
         * @see com.tangosol.io.pof.PortableObject
        public PofCollectionPath() {
         * Construct a SimplePofPath using an array of indices as a path.
         * <p/>
         * @param indices the list of POF indices to navigate.
        public PofCollectionPath(int... indices) {
            this.elements = indices;
         * Locate the PofValue identified by this PofNavigator within the passed PofValue.
         * @param pofValue the origin from which navigation starts
         * @return the resulting extracted PofValue.
         * @see AbstractPofPath#navigate(PofValue)
        @Override
        public PofValue navigate(PofValue pofValue) {
            return navigate(pofValue, 0);
         * Recursivley navigates down the POF tree
         * of values starting with the specified PofValue
         * and from the specified index in the array
         * of POF indicies for this PofNavigator.
         * @param pofValue the origin from which navigation starts
         * @param idx      the index number to start navigating from
         * @return the resulting extracted PofValue.
        PofValue navigate(PofValue pofValue, int idx) {
            PofValue result = null;
            int lastIndex = elements.length - 1;
            // Is the value a POF Collection
            if (!(pofValue instanceof PofArray)) {
                // No, we have a simple value, so extract the field
                PofValue child = pofValue.getChild(elements[idx]);
                if (idx != lastIndex) {
                    result = navigate(child, idx + 1);
                } else {
                    result = child;
            } else {
                // Yes, we have a collection
                try {
                    // Create the byte stream to hold the serialized results
                    // We make it as big as the current object as I don't think it
                    // could be bigger than this
                    ByteArrayOutputStream outStream;
                    outStream = new ByteArrayOutputStream(((PofArray)pofValue).getSize());
                    DataOutputStream dos = new DataOutputStream(outStream);
                    // Write the POF indicator for a Collection
                    dos.writeByte(0x55);
                    // Write the length of the collection as a POF integer
                    int length = ((PofArray) pofValue).getLength();
                    writePofInt(dos, length);
                    // Iterate over the collection
                    for (int i = 0; i < length; i++) {
                        // Get the child
                        PofValue child = pofValue.getChild(i);
                        // Get the value from the child for the pof index we require
                        PofValue value = child.getChild(elements[idx]);
                        // If we are not on the last index navigate down further
                        if (idx != lastIndex) {
                            value = navigate(value, idx + 1);
                        // write the result to the byte stream
                        dos.write(((SimplePofValue) value).getSerializedValue().toByteArray());
                    // Convert the byte stream's bytes to a POF value
                    result = PofValueParser.parse(new Binary(outStream.toByteArray())
                                                  , ((PofArray) pofValue).getPofContext());
                } catch (IOException e) {
                    e.printStackTrace();
            return result;
         * This method writes an Integer to a POF stream and is taken
         * verbatim from the POF documentation.
        private void writePofInt(DataOutputStream dos, int n) throws IOException {
            int b = 0;
            if (n < 0) {
                b = 0x40;
                n = ~n;
            b |= (byte) (n & 0x3F);
            n >>>= 6;
            while (n != 0) {
                b |= 0x80;
                dos.writeByte(b);
                b = (n & 0x7F);
                n >>>= 7;
            dos.writeByte(b);
         * Return a collection of path elements.
         * @return a collection of path elements
         * @see AbstractPofPath#getPathElements()
        @Override
        protected int[] getPathElements() {
            return elements;
         * Restore the contents of this PofCollectionPath instance by reading its state
         * using the specified PofReader object.
         * <p/>
         * @param pofReader the PofReader from which to read the object's state
         * @throws IOException if an I/O error occurs
         * @see com.tangosol.io.pof.PortableObject
        @Override
        public void readExternal(PofReader pofReader) throws IOException {
            elements = pofReader.readIntArray(101);
         * Save the contents of a POF user type instance by writing its state
         * using the specified PofWriter object.
         * <p/>
         * @param pofWriter the PofWriter to which to write the object's state
         * @throws IOException if an I/O error occurs
         * @see com.tangosol.io.pof.PortableObject
        @Override
        public void writeExternal(PofWriter pofWriter) throws IOException {
            pofWriter.writeIntArray(101, elements);
         * Compare the PofCollectionPath with another object to determine equality.
         * Two PofCollectionPath objects are considered equal if their indices are equal.
         * <p/>
         * @param o the Object to compare this PofCollectionPath to.
         * @return true if this PofCollectionPath and the passed object are equivalent
        @Override
        public boolean equals(Object o) {
            if (this == o) {
                return true;
            if (o instanceof PofCollectionPath) {
                PofCollectionPath that = (PofCollectionPath) o;
                return Arrays.equals(this.elements, that.elements);
            return false;
         * Determine a hash value for the SimplePofPath object according to
         * the general Object.hashCode() contract.
         * <p/>
         * @return an integer hash value for this PofCollectionPath object
        @Override
        public int hashCode() {
            int[] ai = this.elements;
            return HashHelper.hash(ai, ai.length);
         * Return a human-readable description for this PofCollectionPath.
         * <p/>
         * @return a String description of the PofCollectionPath
        @Override
        public String toString() {
            return ClassHelper.getSimpleName(super.getClass())
                    + "(indices=" + toDelimitedString(this.elements, ".") + ')';
    }

    Hi Nitin,
    1. Actually having Java objects on the server side is not really relevant in this case as using POF extractors is much more efficient. If we wanted to do something really complicated we would have the option of deserializing the classes in the cluster, but we don't need to do that now.
    2. The example I gave above will return what you want.
    3. The 101 index is just the POF index of the indicies field in the extractor. You can use any integer you want for the indexes, you do not have to start from zero so I just happen to use bigger numbers.
    You have to use a ContainsFilter for you query. This is because the PofCollectionPath class returns a List of values. In your case you have two extractors:
    PofExtractor nameExtractor = new PofExtractor(null, namePath);
    PofExtractor addressExtractor = new PofExtractor(null, addressPath);...both of these return a list.
    For example if you had an instance of A like that contained a list of B values like this:
    1. B.Name = "ABC" B.Address = "NY"
    2. B.Name = "DEF" B.Address = "WA"
    3. B.Name = "GHI" B.Address = "IL"
    4. B.Name = "JKL" B.Address = "IN"The nameExtractor would return a list of names: {"ABC", "DEF", "GHI", "JKL"}
    The addressExtractor would return a list of addresses: {"NY", "WA", "IL", "IN"}
    A ContainsFilter matches lists that contain a specific value. So if we have a nameFilter like this:
    ContainsFilter nameFilter = new ContainsFilter(nameExtractor, "ABC");...then it will match with our list of names as the list contains the value "ABC". If we have a nameFilter like this:
    ContainsFilter nameFilter = new ContainsFilter(nameExtractor, "STU");...then it will not match as our name list does not contain "STU".
    The same then applies to the address filter.
    If you try to use any of the other filters in Coherence they would be applied to the list of names or addresses in different ways.
    An EqualsFilter would apply to the whole List returned by the Extractor so for example:
    EqualsFilter nameFilter = new EqualsFilter(nameExtractor, "ABC");...would not match because it would try to compare the String "ABC" with a List {"ABC", "DEF", "GHI", "JKL"} which obviously does not match as they are not even the same type of Object. But...
    You could apply an EqualsFilter to the whole List returned by the Extractor, for example:
    System.Collections.ArrayList names = new ArrayList();
    names[0] = "ABC";
    names[1] = "DEF";
    names[2] = "GHI";
    names[3] = "JKL";
    EqualsFilter nameFilter = new EqualsFilter(nameExtractor, names);...this EqualsFilter would match because it is comparing a list with the same set of names in it as our extractor has extracted from the instance of A.
    I hope that helps
    JK

  • Tool to review JSP codes

    Dear All,
    Our current requirement is that we require a tool that could be used to review the JSP codes. Could you help us out with information regarding various tools that could be used to review JSP codes. Expecting your kind co-operation in this regard. Thanking you all in advance. - Kind Regards, VGlad

    Dear Ackumar,
    Thank u for the response. Could u specify some more details regarding the steps that should be used to review jsp codes using any particular tool. That would make my task easier.
    Thanking you in adv.
    Kind Regards,
    VGlad.

  • Review of code

    I am new to programming and I am seeing many sites that says code reviews have to be done for quality ... etc. How are the code reviews done?
    do you take print outs or reviewer checks at your computer for the code that has to be reviewed or use any other tool to do the same.
    Thanks.

    There are two standard tools, PMD and Checkstyle, that can be used for automated code reviews.
    http://sourceforge.net/projects/pmd and http://sourceforge.net/projects/checkstyle
    But I believe that "code review" is a more generic concept and includes human-made code reviews as well (for instance, checking if the code actually implements the specifications is a human job if the specification is done using natural language instead of some UML tool.)

  • Can someone review my code please

    I wrote a program for converting miles to kilometers and kilometers to miles. I've got it working good now, but there's something I can't figure out. The way I have it now, after you convert something, if you choose not to make another conversion, it exits the program. I'd like to make it go back to the main menu rather than exiting. In other words; if I convert miles to kilometers and then decide I want to do a kilometers to miles conversion, I'd like a way to return to the main menu without exiting the program. I would really appreciate any suggestions. Also, please feel free to give me pointers on better ways to make my code in general. Go easy though, I know I'm a newb. I didn't get any help making this, so please be kind. I apologize if it's hard to read; I wrote it in Jgrasp and it formated it weird when I opened it with wordpad.
    Thanks
    Here's the code:
    import java.util.*;
    public class Squires1
    Scanner keyboard = new Scanner(System.in);
         //Allows for keyboard inputs
         public void milesToKilometers()//Method for converting miles to kilometers
              double kilometers;
              String more;//Used in option for additional conversions
              final double OFFSET = 0.62136994949495;//number for conversion
              do
                   System.out.print( "Please tell me the number of miles: ");
              //Prompts user for miles
                   double miles = keyboard.nextDouble();
                   kilometers = (miles / OFFSET);
                   //calculates number of kilometers
                   System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
                   System.out.println("Would you like to make another conversion?");
                   System.out.println("Yes or No");
                   more = keyboard.next();
                        if
                        (more.equalsIgnoreCase("Yes"))
                             System.out.println("One Moment Please");
                        else
                             System.out.println("Thanks for using my program.");
                             System.out.println("Please tell your friends.");
                             System.exit(0);//Exits program if additional conversions are not desired
                   }while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
         public void kilometersToMiles()//Method for converting kilometers to miles
              double miles;
              String more;//Used in option for additional conversions
              final double OFFSET = 0.62136994949495;//number for conversion
              do
                   System.out.print( "Please tell me the number of kilometers: ");
              double kilometers = keyboard.nextDouble();
                   miles = (kilometers * OFFSET);//Converts kilometers to miles
                   System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
                   System.out.println("Would you like to make another conversion?");
                   System.out.println("Yes or No");
                   more = keyboard.next();
                   if
                   (more.equalsIgnoreCase("Yes"))
                        System.out.println("One Moment Please");
                   else
                        System.out.println("Thanks for using my program.");
                        System.out.println("Please tell your friends.");
                        System.exit(0);//exits program if user types "no"
                   }while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
              public static void main(String[] args)//main method
                   Squires1 s1 = new Squires1();//creates new instance of class      
                   int option;
                   Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
         System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
         System.out.println( "1. Convert miles to kilometers ");
                   System.out.println( "2. Convert kilometers to miles ");
                   System.out.println( "3. End our session. ");
         option = keyboard.nextInt();
              if (option == 1)
                   s1.milesToKilometers();//runs milesToKilometers method
                        if (option == 2)
                        s1.kilometersToMiles();//runs kilometersToMiles method                }
                        if (option == 3)
                             System.out.println("Thanks for using my program.");
                             System.out.println("Have a nice day.");
                   }while (option != 3);//Repeats main method as long as user doesn't type 3
    }

    Here's another instance of my code with tags.
    import java.util.*;
    public class Squires1
    Scanner keyboard = new Scanner(System.in);
    //Allows for keyboard inputs
    public void milesToKilometers()//Method for converting miles to kilometers
    double kilometers;
    String more;//Used in option for additional conversions
    final double OFFSET = 0.62136994949495;//number for conversion
    do
    System.out.print( "Please tell me the number of miles: ");
    //Prompts user for miles
    double miles = keyboard.nextDouble();
    kilometers = (miles / OFFSET);
    //calculates number of kilometers
    System.out.println(miles + " miles is equal to " + kilometers + " kilometers.");
    System.out.println("Would you like to make another conversion?");
    System.out.println("Yes or No");
    more = keyboard.next();
    if
    (more.equalsIgnoreCase("Yes"))
    System.out.println("One Moment Please");
    else
    System.out.println("Thanks for using my program.");
    System.out.println("Please tell your friends.");
    System.exit(0);//Exits program if additional conversions are not desired
    }while (more.equalsIgnoreCase("Yes"));//Repeats method if yes is typed
    public void kilometersToMiles()//Method for converting kilometers to miles
    double miles;
    String more;//Used in option for additional conversions
    final double OFFSET = 0.62136994949495;//number for conversion
    do
    System.out.print( "Please tell me the number of kilometers: ");
    double kilometers = keyboard.nextDouble();
    miles = (kilometers * OFFSET);//Converts kilometers to miles
    System.out.println(kilometers + " kilometers is equal to " + miles + " miles.");
    System.out.println("Would you like to make another conversion?");
    System.out.println("Yes or No");
    more = keyboard.next();
    if
    (more.equalsIgnoreCase("Yes"))
    System.out.println("One Moment Please");
    else
    System.out.println("Thanks for using my program.");
    System.out.println("Please tell your friends.");
    System.exit(0);//exits program if user types "no"
    }while (more.equalsIgnoreCase("Yes"));//Repeats loop if user types "yes"
    public static void main(String[] args)//main method
    Squires1 s1 = new Squires1();//creates new instance of class
    int option;
    Scanner keyboard = new Scanner(System.in);//allows for keyboard inputs
    System.out.println( "I can convert distances for you. Please tell me what you'd like to do.");
    System.out.println( "1. Convert miles to kilometers ");
    System.out.println( "2. Convert kilometers to miles ");
    System.out.println( "3. End our session. ");
    option = keyboard.nextInt();
    if (option == 1)
    s1.milesToKilometers();//runs milesToKilometers method
    if (option == 2)
    s1.kilometersToMiles();//runs kilometersToMiles method }
    if (option == 3)
    System.out.println("Thanks for using my program.");
    System.out.println("Have a nice day.");
    }while (option != 3);//Repeats main method as long as user doesn't type 3
    }

  • Review the code in SP

    I have a package with 3 SP's. Is there a way(SQL statement) by which I can find out the code for the SP?
    Thanks
    Sr

    Dear user13434651,
    As one of the users here has already mentioned but i would like to add;
    DBMS_METADATA
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm
    GET_XXX_FUNCTIONS
    http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_metada.htm#i1019414
    Regards.
    Ogan

  • Reviewing Source Code

    Anyone know how to print Captivate simulation source
    code?

    Captivate itself doesn't provide source code (depending on
    how you are using the term). But you can open the file in Flash
    2004MX (or Flash 8) and use the FLA source.
    Bear in mind that if you choose to do this, some elements in
    Captivate can't or won't be included in the import ... and in
    general, the behavior of Captivate projects, once opened in Flash,
    tends to be "squirrelly" as reported by some here.
    What is your reason for wanting to view the source code, if
    you don't mind sharing?
    Welcome to the Captivate User Community, Ann22630.

  • Help with Swipe+zoom. Please review the code.

    Hello there,
    I am trying to get the a page swipe and zoom work for a project for iPhone and iPad. I am not an expert in AS3 but have been able to put togather a piece of code with the helpful folks from this forum. My swipe works like a charm, but when I try to incorporate the code for zoom, the zoom/pinch part doesn't work. I know for people who know AS3 it might be a simple mistake on my part.
    Following is the code I have been playing with. Thanks for your suggestions in advance.
    regards,
    Umesh
    stop();
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.events.TransformGestureEvent;
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    var yourswipeobject:MovieClip;
    var swipeRange:uint = 100;
    yourswipeobject.initX = yourswipeobject.x;
    yourswipeobject.addEventListener(MouseEvent.MOUSE_DOWN,startDragF);
    yourswipeobject.addEventListener(MouseEvent.MOUSE_UP,stopDragF);
    yourswipeobject.addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom);
    function onZoom (e:TransformGestureEvent):void{
    yourswipeobject.scaleX *= e.scaleX;
    yourswipeobject.scaleY = yourswipeobject.scaleX;
    function startDragF(e:Event):void{yourswipeobject.startDrag(false, new Rectangle(yourswipeobject.initX-swipeRange,yourswipeobject.y,swipeRange*2,0));
    function stopDragF(e:Event):void{
    yourswipeobject.stopDrag();
    if(yourswipeobject.x<yourswipeobject.initX-swipeRange/2){
        if (currentFrame == totalFrames) {
            gotoAndStop(1);
        } else {
            nextFrame();
    } else if(yourswipeobject.x>yourswipeobject.initX+swipeRange/2){
            if (currentFrame == 1) {
            gotoAndStop(totalFrames);
        } else {
            prevFrame();
    yourswipeobject.x = yourswipeobject.initX;

    Hello there,
    I am trying to get the a page swipe and zoom work for a project for iPhone and iPad. I am not an expert in AS3 but have been able to put togather a piece of code with the helpful folks from this forum. My swipe works like a charm, but when I try to incorporate the code for zoom, the zoom/pinch part doesn't work. I know for people who know AS3 it might be a simple mistake on my part.
    Following is the code I have been playing with. Thanks for your suggestions in advance.
    regards,
    Umesh
    stop();
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.events.TransformGestureEvent;
    Multitouch.inputMode = MultitouchInputMode.GESTURE;
    var yourswipeobject:MovieClip;
    var swipeRange:uint = 100;
    yourswipeobject.initX = yourswipeobject.x;
    yourswipeobject.addEventListener(MouseEvent.MOUSE_DOWN,startDragF);
    yourswipeobject.addEventListener(MouseEvent.MOUSE_UP,stopDragF);
    yourswipeobject.addEventListener(TransformGestureEvent.GESTURE_ZOOM,onZoom);
    function onZoom (e:TransformGestureEvent):void{
    yourswipeobject.scaleX *= e.scaleX;
    yourswipeobject.scaleY = yourswipeobject.scaleX;
    function startDragF(e:Event):void{yourswipeobject.startDrag(false, new Rectangle(yourswipeobject.initX-swipeRange,yourswipeobject.y,swipeRange*2,0));
    function stopDragF(e:Event):void{
    yourswipeobject.stopDrag();
    if(yourswipeobject.x<yourswipeobject.initX-swipeRange/2){
        if (currentFrame == totalFrames) {
            gotoAndStop(1);
        } else {
            nextFrame();
    } else if(yourswipeobject.x>yourswipeobject.initX+swipeRange/2){
            if (currentFrame == 1) {
            gotoAndStop(totalFrames);
        } else {
            prevFrame();
    yourswipeobject.x = yourswipeobject.initX;

  • Help reviewing short code plz

    how can i write this neater?
    for (int i=1; i<=12; i++) {
                    int j=0;
                    for (int j=1; j<=8; j++) {
                        if (i1.equals("q")) {
                            letters[i][j+1] = "q";
                        else if (i1.equals("q")) {
                            letters[i][j+2] = "a";
                        else if (i1.equals("q")) {
                            letters[i][j+3] = "w";
                        else if (i1.equals("q")) {
                            letters[i][j+4] = "s";
                        else if (i1.equals("q")) {
                            letters[i][j+5] = "";
                        else if (i1.equals("q")) {
                            letters[i][j+6] = "";
                        else if (i1.equals("q")) {
                            letters[i][j+7] = "";
                        else if (i1.equals("q")) {
                            letters[i][j+8] = "";
    }here is some WRONG code to help explain my intention:
    //                     if (i1.equals("q")) {
    //                         String[][j] letters = {"q","w","a","s","","","",""};
    }i want to create a for loop which fills my subarray with the letters in the quotation, and once that is filled it goes to the next place in the main array and fills that subarray with different letters again

    I don't know what your intention was, it probably isn't implemented by that code, because it's equivalent tofor (int i=1; i<=12; i++) {
                    int j=0;
                    for (int j=1; j<=8; j++) {
                        if (i1.equals("q")) {
                            letters[i][j+1] = "q";
                        // those else-if's were testing a condition that could never be true
    }So perhaps explaining your requirements would work better.

  • XPath processing with namespaces does not work. Please review my code..

    Dear all,
    I am working on with the IMS Group's Enterprise XML standard (http://www.imsproject.org/enterprise/) and need to retrieve member information using XPath.
    After significant fault finding, I have narrowed down the problem to the XML file containing multiple namespaces in the root element. I have checked out some forum postings here and on Google (programmer's best friend) for possible solutions... namely the implementation of the my own NamespaceContext object. I have implemented and yet I am still not able to retrieve the data I want.
    Could someone advise where I am going wrong?
    When I remove the namespaces from the root element I can find out the number of member elements in the XML (just for testing atm). I could write a regular expression to remove the namespaces from my XML, but that's just dodgy..
    Here's a sample XML:
    <enterprise xmlns="http://www.imsproject.org/xsd/imsep_rootv1p01" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webct="http://www.webct.com/IMS">
    <properties>...</properties>
    <group>...</group>
    <membership>
    <member>...</member>
    </membership>
    </enterprise>
    My implementation of the a NamespaceContext object:
    public class IMSProjectNamespaceContext implements NamespaceContext {
    public String getNamespaceURI(String prefix) {       
    if(prefix == null) throw new NullPointerException("Null prefix");
    else if("xsi".equals(prefix)) return "http://www.w3.org/2001/XMLSchema-instance";
    else if("webct".equals(prefix)) return "http://www.webct.com/IMS";
    else if("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
    return XMLConstants.NULL_NS_URI;
    }// end of overriding getNamespaceURI method
    // This method is not necessary for XPath processing
    public String getPrefix(String uri) {
    throw new UnsupportedOperationException();
    }// end of overriding getPrefix method
    // This method is not necessary for XPath processing
    public java.util.Iterator getPrefixes(String uri) {
    throw new UnsupportedOperationException();
    }// end of overriding getPrefixes method
    }// end of IMSProjectNamespaceContext class
    My method attempting to use XPath... but not successful (it should print out the number of member elements if XPath works correctly with my XML file, but only prints out 0 each time):
    private void getSectionMembers(String dataXML) throws Exception {
    try {       
    InputSource inputSource = new InputSource(new StringReader(dataXML));
    XPath xPath = XPathFactory.newInstance().newXPath();
    xPath.setNamespaceContext(new IMSProjectNamespaceContext());
    XPathExpression xPathExpression = xPath.compile("/enterprise/membership/member");
    NodeList nodes = (NodeList)xPathExpression.evaluate(inputSource, XPathConstants.NODESET);
    System.out.println(nodes.getLength()); // Debugging
    } catch(Exception ex) {
    ex.printStackTrace();
    throw new Exception("XPath Querying Failed.");
    }// end of xPathQuery method

    Dear dvohra09,
    Thank you for your quick reply. Much appreciated. I have implemented a NamespaceContext object that is able to set more than one prefix for a URI as you suggested.
    It works when I remove the first namespace that is generated in the IMSProject Enterprise XML:
    xmlns="http://www.imsproject.org/xsd/imsep_rootv1p01"
    When I hack the XML and set a prefix for this ('default') namespace it works... For example:
    xmlns:ims="http://www.imsproject.org/xsd/imsep_rootv1p01"
    Is the NamespaceContext class supposed to handle for so called "default" namespaces (without needing to touch the XML)?
    My method is performing the XPath query is below:
    private void getSectionMembers(String dataXML) throws Exception {
    try {       
    InputSource inputSource = new InputSource(new StringReader(dataXML));
    IMSProjectNamespaceContext imsproject = new IMSProjectNamespaceContext();
    imsproject.setNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
    imsproject.setNamespace("webct", "http://www.webct.com/IMS");
    imsproject.setNamespace("ims", "http://www.imsproject.org/xsd/imsep_rootv1p01lme");
    XPath xPath = XPathFactory.newInstance().newXPath();
    xPath.setNamespaceContext(imsproject);
    XPathExpression xPathExpression = xPath.compile("//ims:enterprise/@xmlns/text()");
    NodeList nodes = (NodeList)xPathExpression.evaluate(inputSource, XPathConstants.NODESET);
    System.out.println(nodes.getLength()); // Debugging
    System.out.println(nodes.item(0).getNodeValue()); // Debugging
    } catch(Exception ex) {
    ex.printStackTrace();
    throw new Exception("XPath Querying Failed.");
    }// end of xPathQuery method
    Regards
    Zig

  • Password strength issue, please review my code for a mistake.

    Hello Guru's again,
    I am getting new password requirments for an external application that stores passwords in my database 10.1.0.3.0 Linux AS4, using forms 6i. I am getting my raise form_trigger_failure whenever I run this on my form and use what should be a valid password '1qaz!QAZ', it has an upper case, lower case, number and a special character check. I can't figure out why it is not working-- I think too many hours staring at it now confuses me. Please see below;
    FUNCTION PASSWORD_STRING (password tuser.password%type)
    RETURN BOOLEAN IS
    n boolean;
    m integer;
    chkchar char;
    punct_in_str integer;
    differ integer;
    isdigit boolean;
    iscapchar boolean;
    islowchar boolean;
    ispunct boolean;
    digitarray varchar2(20);
    lowchararray varchar2(52);
    highchararray varchar2(52);
    notpunctarray varchar2(128);
    BEGIN
    digitarray := '0123456789';
    lowchararray := 'abcdefghijklmnopqrstuvwxyz';
    highchararray := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';      
    notpunctarray := 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
    -- Check if the password contains at least one upper letter, one lower letter
    -- one digit and one punctuation mark.
    m := length(password);
    ispunct:=FALSE;
    FOR i in 1..m LOOP
    chkchar:=substr(password, i, 1);
    punct_in_str := instr(notpunctarray, chkchar);
    IF punct_in_str > 0 THEN
    ispunct:= FALSE;
    ELSE
    ispunct:=TRUE;      
    END IF;
    EXIT WHEN ispunct = TRUE;      
    END LOOP;
    IF ispunct = FALSE THEN
    raise form_trigger_failure;
    END IF;
    islowchar :=FALSE;
    FOR i IN 1..length(lowchararray) LOOP
    FOR j IN 1..m LOOP
    IF substr(password,j,1)= substr(lowchararray,i,1) THEN
    islowchar := TRUE;
    END IF;
    EXIT WHEN islowchar = TRUE;
    END LOOP;
    EXIT WHEN islowchar = TRUE;
    END LOOP;
    IF islowchar = FALSE THEN
    raise form_trigger_failure;
    END IF;
    iscapchar := FALSE;
         FOR i IN 1..length(highchararray) LOOP
    FOR j IN 1..m LOOP
    IF substr(password,j,1)= substr(highchararray,i,1) THEN iscapchar := TRUE;
    END IF;
    EXIT WHEN iscapchar = TRUE;
    END LOOP;
    EXIT WHEN iscapchar = TRUE;
    END LOOP;
    IF iscapchar = FALSE THEN
    raise form_trigger_failure;
    END IF;
    isdigit:=FALSE;
    FOR i IN 1..length(digitarray) LOOP
    FOR j IN 1..m LOOP
    IF substr(password,j,1) = substr(digitarray,i,1) THEN
    RETURN TRUE;
    END IF;
    END LOOP;
    END LOOP;
    IF isdigit = FALSE THEN
    raise form_trigger_failure;
    END IF;
    exception when others then raise form_trigger_failure;
    END;

    I think I see what your getting at, I should be returning true or false and let the on-update trigger and on-insert trigger handle to output message and not fire raise form_trigger_failure here.
    I am going to remove the reference and let the triggers handle it...I will update what I find.

  • Looking for Code Review Resources

    We have completed a complex project using jakarta struts and are in beta testing at the moment.
    Would like to have someone review our code but we have not been able to find expierienced developers in our (physical) area.
    Does anyone have suggestions on where I could look to find a qualified individual for independent code review.
    Thank you in advance for your suggestions.

    Just post it here. Some of our fine reviewers will be happy to serve you.
    P.S. Be sure to say that it's homework.

  • Code Review

    Hi folks,
    need your assistance here; an example, I gave you a sql statement of almost 20 lines, with so many joins/hint and a lot of other activities too.
    And you've been asked to review that code and provide your input/thoughts/suggestion/advises about this code.
    What'll be your approach, how you'll go about it?
    Statistics are already gathered for all the objects, now what'll be your steps and how you'll take care of this task, please try to explain in a step by step way.
    Thanks in advance.

    Let's take a step back... What is the goal of your code review?
    Are you reviewing the code to see if it returns the expected results? If so, you'd need to understand the requirements, your data model, etc.
    Are you reviewing the code to see if it reuses other code effectively? If so, are there existing views that join several of these tables with the same conditions that could be used so that if the conditions change in the future you only have to update one view rather than hundreds of queries? Are there functions that compute data that you are computing in the query? Are there negative performance implications to using those existing views or functions because, for example, they also join in additional tables that you don't need (note that in very recent versions, Oracle may be able to eliminate those joins)? If so, you'll need to examine whether the benefits of code reuse outweigh the cost of slighly slower performance.
    Are you reviewing the code to see if it follows your organization's standards? Does your organization have standards about SQL 99 join syntax versus older join syntaxes, for example? Does it have standards about how to alias tables in the query or how to indent the code or anything else that an organization might standardize on?
    Are you reviewing the code to examine the performance? If so, what criteria are you using? A code review implies that this is something you're doing before code goes to production. Normally, the developers would have verified performance in the lower environments by doing load tests on representative volumes of data to compare performance against whatever the
    requirements laid out as acceptable. Perhaps it makes sense to compare the query plan generated in production against the query plan that was verified as performing adequately in the lower environments in order to ensure that the performance isn't going to radically degrade when the query runs in production. Perhaps it makes sense to pull an AWR from the test environment from the period during the load test and to review the top SQL statements on that report if they are new. It generally doesn't make sense to try to review the query plan of every query before it goes to production if the developers haven't done the basic level of performance testing in advance-- no one is going to, in general, be able to look at a query plan and give you a "thumbs up" or a "thumbs down" with no context, no requirements, and no background. At most, you could look for yellow flags-- query plans that involve hitting every partition in a table rather than doing partition pruning, queries that return a single row that do table scans rather than using an expected index, queries that return millions of rows that use an index rather than an expected table scan-- in order to figure out what queries are worth focusing on.
    Justin

  • Code review sap standard naming standards

    Hi all,
       My requirement is to review the code for FM and want to document it according to sap standards because these objects will be sent to sap. It is a product development object and it will be reviewed and adopted by sap itself.
    send me some naming standards provided by SAP.
    Thanks,
    Arun.

    Hi,
    I agree that you should ask SAP but using code inspector (SCI) you can check your program for Naming conventions (Programming conventions). It has predefined values which should be similar/equal to what SAP use. You can also change it to your naming conventions.
    Cheers

Maybe you are looking for

  • After synching ipod file not found

    I am trying to sync a 20g ipod manually, it says it is synching...but at the end a note comes up saying that the file wasn't found. The ipod is only synching through 1/2 the alphabet.

  • Deactivate creation of new next inspection date on re-GR

    Our user created GR (MIGO) against a PO and subsequently a new batch with a next inspection date was created based on inspection interval set to 730 days. The user agin after a few days did GR against the same PO and the next inspection date was agai

  • Where is the Photo buttom in iTunes 11.1 ?

    Can anybody help me finding the Photo buttom on the new iTunes 11.1 which I had to update due to the new IOS 7? The iTunes help function still shows the old description for the previous iTunes version. Thank you and best regards, DrCausM

  • Customer recon account change

    Hello Friends, Our client had a requirement of changing the recon account for customer. Customer A (recon account 100) already had line items posted from last 2 years, these line items are cleared also. Now business wants the recon account for this c

  • BW Interview questions very urgent

    Hai, Any body having faq about bw please send me,this is ver urgent,i'm waiting for ur reply plese send to this id [email protected] thanku naveen