[JS] [CS3 onwards] Simplify some code

Hi.
I have been using a for loop to find a certain paragraoh by its style name for a while now, and I am wondering if I am using the best approach?
I am using:
for (x=0;x<=myStory.paragraphs.length-1;x++)
     if(myStory.paragraphs[x].appliedParagraphStyle.name == "SOS - Savings")
     code here...
but wondering if I can use somethng like:
mySavePrice = myStory.paragraphs.appliedParagraphStyle.name("SOS - Savings");
Just a thought...
Cheers
Roy

Roy,
I sometimes use this approach to processing a story. Usually, I'll have a large switch that operates on the appliedParagraphStyle.name property. But, unfortunately, this:
myStory = app.selection[0].parentStory;
myPSnames = myStory.paragraphs.everyItem().appliedParagraphStyle.name;
Doesn't work. So, instead, I use:
myStory = app.selection[0].parentStory;
myPstyles = myStory.paragraphs.everyItem().appliedParagraphStyle;
for (var j = myPstyles.length - 1; j >= 0; j--) {
     switch (myPstyles[j].name) {
          case ...
          case ...
etc.
Dave

Similar Messages

  • How can I simplify the code in this situation?

    I want to create some interaction about ABCDEFGHIJKLM objects. If I l click A and B, the screen will show F. If I click A and C, it will show G.  If I click A and D. it will show F..etc.  When I mouseove A , it will show only L. If I mouseover B, it will show M only. In this situation, I need to create each eventListener (MouseoverA MouseOverB CLICK A, CLICK B, bothAandBClick, bothAandCClick, bothAandDclick......) Can I use other method to simplify the code?
    import flash.display.MovieClip;
    import flash.events.MouseEvent;
    import flash.events.Event;
    import flash.ui.Mouse;
    var redbtn:MovieClip=new Redbtn();
    redbtn.x=321;
    redbtn.y=13;
    addChild(redbtn);
    var yellowbtn:MovieClip=new Yellowbtn();
    yellowbtn.x=130;
    yellowbtn.y=106;
    addChild(yellowbtn);
    var bluebtn:MovieClip=new Bluebtn();
    bluebtn.x=726;
    bluebtn.y=89;
    addChild(bluebtn);
    var blackbtn:MovieClip=new Blackbtn();
    blackbtn.x=236;
    blackbtn.y=479;
    addChild(blackbtn);
    var greenbtn:MovieClip=new Greenbtn();
    greenbtn.x=590;
    greenbtn.y=457;
    addChild(greenbtn);
    var page1:MovieClip=new relationship();
    var redBtnClicked:Boolean;
    var blueBtnClicked:Boolean;
    redbtn.addEventListener(MouseEvent.CLICK, onRedBtnClick);
    redbtn.addEventListener(MouseEvent.ROLL_OVER, onRedOver);
    redbtn.addEventListener(MouseEvent.ROLL_OUT, onRedOut);
    bluebtn.addEventListener(MouseEvent.CLICK, onBlueClick);
    bluebtn.addEventListener(MouseEvent.MOUSE_OVER, onBlueOver);
    function onRedOver(evt:MouseEvent):void{
              trace("redover");
              redbtn.gotoAndStop(2);
    function onRedOut(evt:MouseEvent):void{
              trace("redout");
              redbtn.gotoAndStop(3);
    function onBlueOver(evt:MouseEvent):void{
              trace("blueover");
    function onRedBtnClick(evt:MouseEvent):void{
              redBtnClicked=true;
              bothClickedF();
    function onBlueClick(evt:MouseEvent):void{
              blueBtnClicked=true;
              bothClickedF();
    function bothClickedF():void{
              if (blueBtnClicked&& redBtnClicked){
                        trace("two buttons are clicked");
                        addChild(page1);
                        redBtnClicked=false;
                        blueBtnClicked=false;
    page1.trailer_sex.addEventListener(MouseEvent.CLICK, page1Click);
    function page1Click(evt:MouseEvent):void{
       removeChild(page1);

    I means  this
    Click
    A and B  go to C
    A and D go to E
    A and F go to G
    A and I go to J
    A and N go to O
    B and D go to K
    B and F go to L
    B and I go to M
    B and N go to P
    F and I go to Q
    F and N go to R
    MouseOver
    A  over then appear S
    B  over then appear T
    D  over then appear U
    F  over then appear V
    I  over then appear W
    N  over then appear V
    There is not time limit.

  • How can I simplify this code?

    Here's some code I am working on for my CompScience class. If any of you more advanced java users can assist me in simpliying this code, it will be much appreciated. Thanks
    import javax.swing.JOptionPane;
    public class lab09b
         public static void main (String args[])     
              String str;     
              int num = 1, den = 1; //Initializes variables for use.         
              Rational2 r3 = new Rational2 (num,den); //Creates new Rational2 object to be used for math operations.     
              str = JOptionPane.showInputDialog("Enter Numerator 1:"); 
              num = Integer.parseInt(str);
              str = JOptionPane.showInputDialog("Enter Denominator 1:");     
              den = Integer.parseInt(str);
              Rational1 rA = new Rational1 (num,den); //Creates object to store original input of fraction 1.
              Rational2 r1 = new Rational2 (num,den); //Creates object to store reduced input of fraction 1.
              str = JOptionPane.showInputDialog("Enter Numerator 2:");
              num = Integer.parseInt(str);
              str = JOptionPane.showInputDialog("Enter Denominator 2:");     
              den = Integer.parseInt(str);
              Rational1 rB = new Rational1 (num,den); //Creates object to store original input of fraction 2.
              Rational2 r2 = new Rational2 (num,den); //Creates object to store reduced input of fraction 1.
              r3.add(r1,r2);
              JOptionPane.showMessageDialog(null,rA.getOriginal()+"+"+rB.getOriginal()+"="+r3.getRational()); //Outputs results of addition
              r3.multiply(r1,r2);
              JOptionPane.showMessageDialog(null,rA.getOriginal()+"*"+rB.getOriginal()+"="+r3.getRational()); //Outputs results of multiplication.                                 
              System.exit(0);     
    class Rational1
         protected int num; // Entered numerator.
         protected int den; // Entered denominator.
         private int getGCF(int n1,int n2) //Method for reduction.
              int rem = 0;
              int gcf = 0;
              do
                   rem = n1 % n2;
                   if (rem == 0)
                   gcf = n2;
                   else
                        n1 = n2;
                        n2 = rem;
              while (rem != 0);
              return gcf;
         public void reduce() //Modifies fraction to a equivalent simplified rational.
              int gcf = getGCF(num,den);
              num = num / gcf;
              den = den / gcf;
         public Rational1(int n, int d) //Constructs Rational1 without reducing it.
              num = n;
              if (d == 0)
                   System.out.println("Illegal denominator; altered to 1");
                   den = 1;
              else
                   den = d;
         public int getNum() //Returns Numerator.
              return num;
         public int getDen() //Returns Denominator.
              return den;
         public String getOriginal() //Returns Original Fraction.
              return ""+num+"/"+den;     
    class Rational2 extends Rational1 //Class used to modify fractions.
         public Rational2(int n, int d) //Constructs Rational2 using superclass constructor.
              super(n,d);
         public String getRational() //Returns the reduced fraction version.
              super.reduce();
              return ""+num+"/"+den;     
         public void add(Rational2 r1, Rational2 r2) //Adds two rationals together.
              den = r1.getDen() * r2.getDen();
              num = r1.getNum() * r2.getDen() + r2.getNum() * r1.getDen();
         public void multiply(Rational2 r1, Rational2 r2) //Multiplies two rationals.
              den = r1.getDen() * r2.getDen();
              num = r1.getNum() * r2.getNum();
    }

    seems simple enough to me.... you want complicated code... I could find you some good complicated code, and you'll look at yours and say, wow, this is pretty simple.
    What part are you expecting to simplify?
    Does it compile? Does it run? Does it do what you expect it to do?

  • Is there a way to address email (i.e. a word or some code) that would place that email in a specified inbox folder?  not using internal rule, rather the beginning of this sort happening as it comes in?

    is there a way to address email (i.e. a word or some code) that would place that email in a specified inbox folder?  not using internal rule, rather the beginning of this sort happening as it comes in?
    In other words
    I tell a friend if he is emailing me on a particular subject, is there something he can do at his end ([email protected]/research)
    like adding the word research at the end of my eamil address that would tell my inbox to place that in the inbox/research folder?
    If I have to use a rule on my end, then do I tell him to just place the word research in the subjct line and then I write a rule to place anything with the word research in the subject line in my inbox/research folder?
    will the subject line be required to only have the one word research to work, or will the rule look for any presense of that word in the subject line?
    thanks
    eric

    iCloud email supports 'plus' addressing. http://en.wikipedia.org/wiki/Email_address#Address_tags
    So your friend could just add '+research' to the username part of your email address, and you setup a rule at icloud.com to put all emails sent to that address into a particular folder.
    For example:
    [email protected]
    There's no way to do it without rules on the server though.

  • How do I execute some code when a line of a table control is selected?

    Hi,
    I would like to execute some code when a line of a table control is selected.  At the moment I have to select one or multiple rows and then press enter, this forces a screen refresh and my code is executed but I would like the code to be executed as soon as any line is selected.
    I've done something like this using ALV grids and object orientated code but is there a way of doing this in a normal non-OO table control?
    Thanks in advance.
    Gill

    Hi,
    U need to declare a char1 field for marking (mark field).  This will reflect with value 'X' in your tcontrol internal table for all the selected rows. 
    Now u need to handle the okcode for enter in your PAI.
    There u need to loop through the table for all marked fields.
    There after u can do what ever u want.
    Venkat.

  • "Premiere Pro CS3" is missing some codecs!

    Hi!
    First of all, thanks for stoping by and read my post.
    It's me first time ever using Premiere Pro CS3. I tried to some basic video editing on it, but I cannot hear any sound coming out of my laptop speakers; when i import the video clips. Even tho, I can hear them with "Windows Media Player". So, I investigated a bit and I did some of the things adviced by Adobe's knowledgebase thing.
    And, I came up with a paper saying to download "MediaInfo" and "GSpot" to find out the codecs of the "mpg" files. Here is a report i made with the information given by those programs:
    DVD "VOB" format
    Format: MPEG-PS
    MPEG-2 Program Stream << { 1 vid, 1 aud }
    Sys Bitrate: 10080 kb/s VBR
    Bit rate mode                    : Variable
    bit rate                 : 5 899 Kbps or 5 324 Kbps
    Nominal bit rate                 : 9 100 Kbps
    Width                            : 720 pixels
    Height                           : 480 pixels
    Display aspect ratio             : 16/9
    Frame rate                       : 29.970 fps
    Standard                         : NTSC
    Colorimetry                      : 4:2:0
    Scan type                        : Interlaced
    Scan order                       : Top Field First
    Codec(s) are Installed
    Audio
    ID                               : 128 (0x80)
    Format                           : AC-3
    Format/Info                      : Audio Coding 3 (AC3)
    Bit rate mode                    : Constant
    Bit rate                         : 256 Kbps
    Channel(s)                       : 2 channels
    Channel positions                : L R
    Sampling rate                    : 48.0 KHz
    Resumen:
    0xbd[0x80]:48000Hz  256 kb/s tot , stereo (2/0)
    Codec(s) Installed
    Missing:
    DSH FmtTag: 0x00ff    "MainConcept (Adobe2) AAC Decoder" {214CD0D1-FC06-41B1-8BB8-84DA4CFB17D9} 0x00600000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2daac.ax"
    DSH Video "MainConcept (Adobe2) H.264/AVC Decoder" {FF890B41-A4C5-4B19-87CF-65D86EC12F1C} 0x00600000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2dsh264.ax"
    DSH MPEG1Packet "MainConcept (Adobe2) MPEG Audio Decoder" {25AD5730-4DE0-4CF8-952A-2AEF53AC4321} 0x005fffff ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcdsmpeg.ax"
    DSH MPEG1Packet "MainConcept (Adobe2) MPEG Video Decoder" {25AD5740-4DE0-4CF8-952A-2AEF53AC4321} 0x005fffff ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcdsmpeg.ax"
    DSH MPEG1System "MainConcept (Adobe2) MPEG Splitter" {25AD5720-4DE0-4CF8-952A-2AEF53AC4321} 0x005fffff ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcspmpeg.ax"
    DSH Video "MainConcept (Adobe2) MPEG Encoder" {25AD5750-4DE0-4CF8-952A-2AEF53AC4321} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcesmpeg.ax"
    DSH YV12 "MainConcept (Adobe2) H.264 Encoder" {FF890B51-A4C5-4B19-87CF-65D86EC12F1C} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2esh264.ax"
    DSH RGB24 "MainConcept (Adobe2) MPEG Video Encoder" {25AD5760-4DE0-4CF8-952A-2AEF53AC4321} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcevmpeg.ax"
    DSH PCM "MainConcept (Adobe2) MPEG Audio Encoder" {25AD5770-4DE0-4CF8-952A-2AEF53AC4321} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mceampeg.ax"
    DSH MPEG1Video "MainConcept (Adobe2) MPEG Multiplexer" {25AD5780-4DE0-4CF8-952A-2AEF53AC4321} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2mcmuxmpeg.ax"
    DSH RGB24 "MainConcept (Adobe2) H.264/AVC Video Encoder" {FF890B61-A4C5-4B19-87CF-65D86EC12F1C} 0x00200000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2evh264.ax"
    DSH PCM "MainConcept (Adobe2) AAC Encoder" {866DFE40-5582-4FA6-B4BC-665781A007E6} 0x00100000 ** File Missing: "C:\Program Files\Adobe\Adobe Premiere Pro CS3\ad2eaac.a
    As you can see "Premiere Pro CS3" is missing some codecs, so my question is where can I download those?
    I forgot to tell you, that I use a HP laptop Dual core Intel processor with Win Vista Home 2 GB of RAM and 160 GB of HD
    Thanks in advance
    P.S. I am attaching the Diagdx.txt, even tho I don't think has to necesary
    P.S. 2. I just saw another post similar to this one, but it doesn't tell you how to make "Premiere Pro" get the audio to work in my clips and finished project

    Most good file converters can handle Video and Audio. If you are having issues with the Audio, both Audition and SoundBooth can convert to almost anything and any sample rate and bit depth.
    Here's a LINK to the PrPro Wiki. There are links to various aspects of conversion there.
    Now, remember that when working FROM MPEG-2 and also AC3, the files are compressed to begin with. Quality will suffer, and there is only one way around that - go back to the original source files. If not possible, then you have to determine if the quality has suffered too much.
    Good luck,
    Hunt

  • Change some code from as3 to as2

    Hi, I want to use as2 because it compatible with my website.
    I want to change some code from as3 to as2
    /////////////////////////////image1//////////////////////////////// if(MovieClip(this.parent).imagetxt.text == "a") {     var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";     var myrequest:URL = new URL(imgurl);     myloader.scaleContent = true;     myloader.load(myrequest); } /////////////////////////////image2//////////////////////////////// else if(MovieClip(this.parent).imagetxt.text == "b") {     var imgurl2:String = "http://aloflash.com/images/upload/3.jpg";     var myrequest2:URLRequest = new URLRequest(imgurl2);     myloader.scaleContent = true;     myloader.load(myrequest2); }thank you for your support.

    use:
    var myloader:MovieClip=this.createEmptyMovieClip("loader_mc",this.getNextHighestDepth());
    if (MovieClip(this._parent).imagetxt.text == "a") {
        var imgurl:String = "C:/Users/Thái/Desktop/ls/cotton-1.jpg";
        myloader.load(imgurl);
    } else if (MovieClip(this._parent).imagetxt.text == "b") {
        var imgurl2:String = "http://aloflash.com/images/upload/3.jpg
        myloader.load(imgurl2);

  • Flex iPad Application : Run code before application enters background  Application Type: Flex Mobile Application Target Platform: iPad AIR Version: 4.0 Development Environment: Flash builder 4.6  I want to run some code just before iphone application goes

    Application Type: Flex Mobile Application
    Target Platform: iPad
    AIR Version: 4.0
    Development Environment: Flash builder 4.6
    I want to run some code just before iphone application goes into background. I need function similar to didEnterBackground
    of native xcode app
    (https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplicationDelegat e_Protocol/Reference/Reference.h
    tml#//apple_ref/occ/intfm/UIApplicationDelegate/applicationDidEnterBackground:)
    I tried using devactivated function of flash.display.STAGE.
    I used following addEventListener:
    STAGE = this.parent.stage;
    STAGE.addEventListener(Event.DEACTIVATE, onAppDeactivated);
    It worked for me but only when device is connected to development environment in debug mode. When I create my release build
    it is not working.
    So how can I make sure that my code runs before application goes into background.

    Even I am facing almost same issue
    Problem installing Adhoc version to iPhone and iPad - Development Environment Is - Adobe Flash CS6

  • HT201252 can not restore ipod it is in disabled gets to the the middle of restore and some cod 9006 come up -

    can not restore iPOD it is in disabled ,some cod 9006
    need help

    Check your security software
    Related errors: 2, 4, 6, 9, 1000, 1611, 9006. Sometimes security software can prevent your device from communicating with either the Apple update server or with your device.
    Check your security software and settings to make sure that they aren't preventing a connection to the Apple servers.

  • [svn:fx-trunk] 11118: Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file .

    Revision: 11118
    Author:   [email protected]
    Date:     2009-10-23 16:35:38 -0700 (Fri, 23 Oct 2009)
    Log Message:
    Did some code cleanup on the Spark components to enforce the conventions about how to order stuff within an AS file.
    QE notes: None
    Doc notes: None
    Bugs: None
    Reviewer: None; no functional changes
    Tests run: ant checkintests
    Is noteworthy for integration: No
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/ButtonBar.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/CheckBox.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/DropDownList.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/List.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/NumericStepper.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Panel.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/RadioButton.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/Spinner.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextArea.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/TextInput.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ButtonBase.a s
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/ListBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/SkinnableTex tBase.as
        flex/sdk/trunk/frameworks/projects/spark/src/spark/components/supportClasses/Slider.as

    Hi Rod,
    different sources (i.e. different branches) are mapped to different local folders in your workspace - in fact you cant map two different server folder to the same local folder.
    In you example the mapping would be (for example) like this:
    Server path                                                          
    local path
    $/../WpfHelloWorld                                                
    C:\Src\WpfHelloWorld
    $/../WpfHelloWorldDev                                           
    C:\Src\WpfHelloWorldDev             
    You can see your Workspace mappings when you select "Workspaces..." in the Workspace selection drop down:
    Within the "Manage Workspaces" dialog select your workspace and klick "Edit" to see and edit all you mappings.

  • Dynpro application: how to perform some  code when user click window close

    Hello,
    I'm developing dynpro application. This application needs to perform some code when exiting.
    I can do that with MODULE xxxxx AT EXIT-COMMAND. But this code can't be performed when user of application click on button closing window (classic R/3 window, not pop-up).
    Does anybody know how to bind some code to clicking on button closing window?
    Best regards,
    Josef Motl

    As far as the prompt that you get when you close the last window is coming from the counter that SAP maintains regarding the number of open sessions(windows). When this counter reaches 1, I guess they have a check to issue a prompt. There was a discussion in this forum a long time back regarding how we can know that session id like SM04. There was no conclusion reached then. Theoritically, let us know you know this id for the session in which the user opened a particular page, then you can see if that session is deleted and then take the necessary action. There are some TH_* function modules that seem to be promising, but I was not able to conclusively achieve the control over a particular session.
    See if you can look at SM04 and get an idea. Please do let us know if you find the solution.
    Srinivas

  • When I add some code like the below to a webpage

    sometimes when I add some code like the below to a
    webpage[dwmr mx 2004 or cs4], the page destroyed/currupted like the
    css missing[is inside a template], well I think page stills
    displays ok online but in "design view" default fonts appear etc
    destructions, well how I recover page just prior entered the code ?
    <input name="st" type="hidden" value="<?=
    isset($_GET['sort'])?$_GET['sort']:(isset($_GET['price'])?'price':(isset($_GET['popular'] )?'popular':(isset($_GET['wd4'])?'wd4':(isset($_GET['salon'])?'salon':(isset($_GET['manual '])?2:1)))));
    ?>" />
    <script type="text/javascript">
    function highlightTableCells()
    document.getElementById('cars').style.backgroundColor='#00CC66';
    switch(document.getElementById('st').value)
    case "price":
    document.getElementById('price').style.backgroundColor='#00CC66';
    break;
    case "2": //manual
    document.getElementById('manual').style.backgroundColor='#00CC66';
    document.getElementById('manual2').style.backgroundColor='#00CC66';
    break;
    case "1":
    document.getElementById('auto').style.backgroundColor='#00CC66';
    document.getElementById('auto2').style.backgroundColor='#00CC66';
    break;
    case "salon":
    document.getElementById('salon').style.backgroundColor='#00CC66';
    document.getElementById('salon2').style.backgroundColor='#00CC66';
    break;
    case "wd4":
    document.getElementById('wd4').style.backgroundColor='#00CC66';
    document.getElementById('wd42').style.backgroundColor='#00CC66';
    break;
    case "0":
    document.getElementById('all').style.backgroundColor='#00CC66';
    break;
    case "popular":
    document.getElementById('popular').style.backgroundColor='#00CC66';
    document.getElementById('popular2').style.backgroundColor='#00CC66';
    break;
    case "4wd":
    document.getElementById('wd4').style.backgroundColor='#00CC66';
    document.getElementById('wd42').style.backgroundColor='#00CC66';
    break;
    case "mpvs":
    document.getElementById('mpvs').style.backgroundColor='#00CC66';
    break;
    case "cabrios":
    document.getElementById('open').style.backgroundColor='#00CC66';
    break;
    case "a":
    document.getElementById('a').style.backgroundColor='#00CC66';
    break;
    case "b1":
    document.getElementById('b1').style.backgroundColor='#00CC66';
    break;
    case "b2":
    document.getElementById('b2').style.backgroundColor='#00CC66';
    break;
    case "c":
    document.getElementById('c').style.backgroundColor='#00CC66';
    break;
    case "d":
    document.getElementById('d').style.backgroundColor='#00CC66';
    break;
    case "d1":
    document.getElementById('d1').style.backgroundColor='#00CC66';
    break;
    case "e1":
    document.getElementById('e1').style.backgroundColor='#00CC66';
    break;
    case "e2":
    document.getElementById('e2').style.backgroundColor='#00CC66';
    break;
    case "f":
    document.getElementById('f').style.backgroundColor='#00CC66';
    break;
    case "g":
    document.getElementById('g').style.backgroundColor='#00CC66';
    break;
    case "h1":
    document.getElementById('h1').style.backgroundColor='#00CC66';
    break;
    case "h2":
    document.getElementById('h2').style.backgroundColor='#00CC66';
    break;
    case "i":
    document.getElementById('i').style.backgroundColor='#00CC66';
    break;
    case "j":
    document.getElementById('j').style.backgroundColor='#00CC66';
    break;
    case "k1":
    document.getElementById('k1').style.backgroundColor='#00CC66';
    break;
    case "k2":
    document.getElementById('k2').style.backgroundColor='#00CC66';
    break;
    case "n":
    document.getElementById('n').style.backgroundColor='#00CC66';
    break;
    case "p1":
    document.getElementById('p1').style.backgroundColor='#00CC66';
    break;
    case "p2":
    document.getElementById('p2').style.backgroundColor='#00CC66';
    break;
    case "s":
    document.getElementById('s').style.backgroundColor='#00CC66';
    break;
    case "u":
    document.getElementById('u').style.backgroundColor='#00CC66';
    break;
    </script>

    Take a look at a previous thread on this topic: http://forums.adobe.com/message/5099353

  • Explanation of some code samples

    Hello,
    can you explain me some code samples?
    First:
    try{
    wdContext.currentBapi_Flight_Getlist_InputElement().
    modelObject().execute();
    catch (Exception ex){
    ex.printStackTrace();
    wdContext.nodeOutput().invalidate();
    Second:
    Bapi_Flight_Getlist_Input input =
         new Bapi_Flight_Getlist_Input();
    wdContext.nodeBapi_Flight_Getlist_Input().bind(input);
    input.setDestination_From(new Bapisfldst());
    input.setDestination_To(new Bapisfldst());
    Thanks for your help,
    André

    Hi Andre,
    I hope you know how Rfcs work so I shall start of from there. So i shall explain with the little amount of grasp I have in the topic
    First:
    What the first code does is, to connect to the R/3 system and execute the RFC/BAPI with the input populated in the context node.
    invalidate is used to refresh the output node .
    Second:
    This part of the code is to bind the imported model of the RFC to the context model node and also to instantiate an instance of the structure to input the values into the table(input.setDestination_From(new Bapisfldst())).
    Hope this would explain a bit.
    Do reply with your feedback.
    Regards
    Noufal

  • Simplify the code.

    My assignment was following:
    You are to create a lottery game program that allows a user to simulate playing the lottery. In
    this lottery game, the winning number combination comprises four unique numbers, each in
    the range of 1 to 42 (no duplicates).
    A winning ticket will match from one to four numbers and pay-out based on the following
    schedule: 1 number matched = $2.00, 2 numbers matched = $20.00, 3 numbers matched
    $100.00, and 4 numbers matched = $1,000.
    Your lottery game program should allow the user to:
    1. purchase and store from 1 to 5 lottery tickets. The numbers on each ticket are
    determined randomly. A single ticket cannot have duplicate numbers.
    2. print the purchased tickets in the following format (this example shows five tickets):
    Ticket 1: 21-17-22-30
    Ticket 2: 16-5-42-25
    Ticket 3: 40-11-28-7
    Ticket 4: 34-8-16-1
    Ticket 5: 26-37-15-40
    3. have the program choose and print the winning lottery number in the following format:
    Winning Numbers: 16-42-8-1
    4. check the tickets purchased against the winning number and print out the results as
    follows:
    Ticket 1: 2-17-22-30
    1 match: 17
    Ticket total $2.00
    Ticket 2: 16-5-42-25
    2 matches: 16, 42
    Ticket total: $20.00
    Ticket 3: 40-11-28-72
    no matches
    Ticket total: $0.00
    Ticket 4: 34-8-16-1
    1 match: 16
    Ticket total: $2.00
    Ticket 5: 26-37-15-40
    no matches
    Ticket total: $0.00
    Total Winnings: $24.00
    Here is my code:
    import java.util.Random;
    * @author
    * @version 0.9
    public class Lottery
    // instance variables
    private Random number;
    private int[] ticket1;
    private int[] ticket2;
    private int[] ticket3;
    private int[] ticket4;
    private int[] ticket5;
    private int[] winningTicket;
    private int totalMoney;
    public Lottery()
    number = new Random();
    ticket1 = new int[4];
    ticket2 = new int[4];
    ticket3 = new int[4];
    ticket4 = new int[4];
    ticket5 = new int[4];
    winningTicket = new int[4];
    totalMoney = 0;
    public void printTickets(int number)
    if (number > 0 && number < 6)
    for (int tickets = 0; tickets <= number; tickets ++)
    if (tickets == 1)
    ticket1 = this.tickets();
    if (tickets == 2)
    ticket2 = this.tickets();
    if (tickets == 3)
    ticket3 = this.tickets();
    if (tickets == 4)
    ticket4 = this.tickets();
    if (tickets == 5)
    ticket5 = this.tickets();
    System.out.println("Ticket 1: " + this.numbers(ticket1));
    System.out.println("Ticket 2: " + this.numbers(ticket2));
    System.out.println("Ticket 3: " + this.numbers(ticket3));
    System.out.println("Ticket 4: " + this.numbers(ticket4));
    System.out.println("Ticket 5: " + this.numbers(ticket5));
    else
    System.out.println("You only can buy 1 to 5 tickets.");
    * print out the winning ticket.
    public void printWinningTicket()
    winningTicket = this.tickets();
    System.out.println("Winning Numbers: " + this.numbers(winningTicket));
    * put the numbers of one ticket into string.
    public String numbers(int[] ticket)
    String numbers = ticket[0] + "-" + ticket[1] + "-" + ticket[2] + "-" + ticket[3];
    return numbers;
    * purchased the ticket with random numbers.
    public int[] tickets()
    int[] ticket = new int[5];
    int index = 0;
    while (index <4)
    int ticketNumber = number.nextInt(42) + 1;
    if ((ticketNumber != ticket[0]) && (ticketNumber != ticket[1])&&
    (ticketNumber != ticket[2]) && (ticketNumber != ticket[3]))
    ticket[index] = ticketNumber;
    index++;
    return ticket;
    * print out the result of the Lottery game'
    public void printResult()
    System.out.println("Ticket 1: " + this.numbers(ticket1));
    this.machingNumbers(winningTicket, ticket1);
    System.out.println("Ticket 2: " + this.numbers(ticket2));
    this.machingNumbers(winningTicket, ticket2);
    System.out.println("Ticket 3: " + this.numbers(ticket3));
    this.machingNumbers(winningTicket, ticket3);
    System.out.println("Ticket 4: " + this.numbers(ticket4));
    this.machingNumbers(winningTicket, ticket4);
    System.out.println("Ticket 5: " + this.numbers(ticket5));
    this.machingNumbers(winningTicket, ticket5);
    System.out.println("Total Winnings: $" + totalMoney + ".00");
    * compare the winning ticket with the tickets that user bought.
    * print out the maching numbers and winning money.
    * if there is no ticket, print out "no ticket."
    public void machingNumbers(int[] winning, int[] ticket)
    int maching = 0;
    String machingNumbers = "";
    int money = 0;
    for(int winningIndex = 0; winningIndex < 4; winningIndex ++)
    for(int index = 0; index < 4; index ++)
    if(winning[winningIndex] == ticket[index])
    maching ++;
    machingNumbers = machingNumbers + " " + ticket[index];
    if (ticket[0] == 0)
    System.out.println(" no ticket.");
    else
    if (maching == 0)
    System.out.println(" no maches");
    else
    System.out.println(" " + maching + " mach: " + machingNumbers);
    if (maching == 1)
    money = 2;
    if (maching == 2)
    money = 20;
    if (maching == 3)
    money = 100;
    if (maching == 4)
    money = 1000;
    System.out.println(" Ticket total: $" + money + ".00");
    System.out.println("");
    totalMoney = totalMoney + money;
    [code/]
    How can I simplify this code? Thank you very much!

    I'm not convinced that code will even compile.
    Why so many arrays of ticket?
    You should try harder to use code tags. What you have is unreadable.

  • Laura, I need some code samples you mentioned...

    Laura,
    I posted a message a few days ago regarding calling Stored Procedures in my JDev 3.1 (JDK 1.2.2) BC4J application. I need to be able to call them two different ways. The first involves passing some parameters to the SP and recieving back the ResultSet. In the other instance I simply need to make a call to them to perform some tasks on the DB side. Nothing will be returned from these SP's. You discussed implementing the SQL as a VO and gave me some code showing me how I might do this. You also mentioned that it is possible to create a method on the AppMod and call this from the JSP client. I need to know which method should work best for me and to get the code samples for the second option.
    Thanks.
    Rob

    Hi,
    Here is the code I used for the custom method on my VO (same could be used from the app module rather than a specific VO). The stored procedure I am calling here performs some calculations and returns an integer value:
    public int getTotalHits(String mon, String year) {
    CallableStatement stmt = null;
    int total;
    String totalhits = "{? = call walkthru.total_hits(?,?)}";
    stmt = getDBTransaction().createCallableStatement(totalhits, 1);
    try
    // Bind the Statement Parameters and Execute this Statement
    stmt.registerOutParameter(1,Types.INTEGER);
    stmt.setString(2,mon);
    stmt.setString(3,year);
    stmt.execute();
    total = stmt.getInt(1);
    catch (Exception ex)
    throw new oracle.jbo.JboException(ex);
    finally
    try
    stmt.close();
    catch (Exception nex)
    return total;
    After adding the custom method to your appmoduleImpl.java file and rebuilt your BC4J project, do the following:
    1. Select the Application Module object and choose Edit from the context menu.
    2. Click on the Client Methods page. You should see the method you added in the Available list.
    3. Select the method and shuttle it to the Selected list.
    4. Click Finish. You should see a new file generated under the application module object node in the Navigator named appmodule.java that contains the client stubs for your method.
    5. Save and rebuild your BC4J project.
    I wrote a custom web bean to use from my JSP page to call the method on my VO:
    public class GetTotals extends oracle.jdeveloper.html.DataWebBeanImpl {
    public void render() {
    int totalhits;
    try
    Row[] rows;
    // Retrieve all records by default, the qView variable is defined in the base class
    qView.setRangeSize(-1);
    qView.first();
    rows = qView.getAllRowsInRange();
    // instantiate a view object for our exported method
    // and call the stored procedure to get the total
    ViewObject vo = qView.getViewObject();
    wtQueryView theView = (wtQueryView) vo;
    totalhits = theView.getTotalHits(session.getValue("m").toString(),session.getValue("y").toString());
    out.println(totalhits);
    } catch(Exception ex)
    throw new RuntimeException(ex.getMessage());
    I just call the render method on this custom web bean from the JSP. I am not passing parameters to the render method of the bean, but instead access the parameters I need from the session:
    session.getValue("m").toString()
    I set these session parameters from the JSP that is called when the user submits their query criteria form. For example:
    // get the view parameter from the form String month = request.getParameter("month");
    String year = request.getParameter("year");
    // store the information for reference later session.putValue("m", month); session.putValue("y", year);
    Hope this helps.

Maybe you are looking for

  • Dd unix util producing corrupt ISO images

    This is the first time I've ever had reason to post to Apple Support. I'm going insane with this issue. I am writing an ISO-ripping util that is really just GUI slapped on top of dd, and I can't coax the thing to produce non-corrupt ISOs on Snow Leop

  • Asset Under Construcrion posting

    Dear all AUC has been settled/transfered to respective assets through TCode AIAB & AIBU.The whole amount has been transferred & financial documents also are updated .But amount is showing in the asset report. I tried to analyse if there are any unset

  • Hyperlink to other app

    Hi! Is it possible to create a hyperlink to a app installed on iPad? YouTube, mail, phone, sms is possible, but i want to create a hyperlink to a not preinsalled app, like eBay, Spotify, WordPress or whatever. BR Henrik

  • Simple pass is not woking properly

    simple pass is not woking properly I am unable to sign into mails. when i click the web card a box appiars and it says set ur default browser my default browser is IE9   Ineed updates to solve this problem

  • Help: error in server startup workshop 8.1sp2

    i get following error when i start weblogic server.i use my mail portlet in my application. error stack is <Mar 26, 2004 2:41:32 PM GMT+05:30> <Notice> <WebLogicServer> <BEA-000360> <Serv er started in RUNNING mode> <Mar 26, 2004 2:43:11 PM GMT+05:30