If & then calculation

Hello Experts!

I have a knowledge base, but need help. Creating a page buget and need assistance of som as follows:

Variable inputs:

Area 1: Expenses amount (for example: $100.00)

Field 2: Drop-down list with the following:

1. " - "

2. "weekly".

3. "monthly".

4. "per year".

Fixed results:

Area 3: Give the weekly expense

Area 4: Give the monthly expense

Area 5: Will give the annual load

In summary, no matter what either the frequency of admission (weekly, monthly, yearly), the formula will calculate all the three results IE weekly, monthly and annually.

Thanks in advance guys.

Nick

OK... the thing down sweater could get rather complicated and send round you in circles, but your code looks quite plausible. However, I see an error that hangs on everyone.

To see if the values are equal, never, never just use the "equals" sign = because it does not have what you think and breaks everything!

Use two equal signs if (v2 == "monthly"). More information: comparison of JavaScript and logical operators

Other problems: there are two lists of names of things. One is the name of the field (amount, frequency) and one is the name of the variables (v1, v2). You connect with getField, but you can never use the domain names in JavaScript otherwise. Then note that when you write amount / 52 and so on, you need to use the variable name, not the name of the field.

Tags: Acrobat

Similar Questions

  • Sum of columns together in the responses, and then calculated off summary columns

    I have three questions answers (with 4 columns) that I have gathered the results for:

    Four columns are: campaign # promoted # Respones, # Respones promoted

    Query 1:

    Campaign, # promoted, 0, 0

    Query 2:

    Campaign responses #, 0, 0,.

    Query 3:

    Campaign, 0, 0, # promoted Respones

    My query returns the following (assuming that the campaign code is ABC) 3 rows:

    Campaign of # Promoted # Responses # Promoted answers
    ABC10000
    ABC0120
    ABC009

    I want to put in place so that it adds campaign to get a row of results as follows:

    Campaign of # Promoted # Responses # Promoted answers
    ABC100129

    I can get this result using the conversion to a PivotTable (won't go thought road if possible because I have other calculations that I need to add).   Once I get this summary to a single row result I then do a few such analyses that create:

    1. Response % (Respones # / # promoted)
    2. Promoted to the rank of % (# promoted answers / # promoted)

    When I add the calculatinos to the percentages to the United query I get null or zero for my results.   I used the Add button to insert a calcuation and then I used the following formula: saw_2 / saw_3

    Here's what I would preferably:

    1. Sum of answers (not a pivot table) Table columns.
    2. Add columns calculated at United query that will produce results based on the combined pivot columns
    3. If I use the PivotTable, and then how to get the values calculated for work

    Thank you...

    Ben,

    Try to use the rule of aggregation on the columns in the Table view and see if that makes a difference.

    I just tried this and the SUM of each of the criteria provided the results I wanted, which in turn you are looking for.

    If nothing works for you send me the screenshot of what you are trying to do at vijaybez at gmail and I can understand what is happening properly...

  • Calculation of signal to noise ratio

    Hello.

    I was wondering if it was possible to calculate the SNR of a signal with LabView? I use a DAQ hardware and an accelometer to measure a force.

    Is that being said, possible to calculate SNR by looking at the graph of spectrum or vague? When there is no g on the accelerometer, there is a signal with a little noise... and I can see that in the spectrum of frequecny all the way to the cut-off frequency. What is the background noise?

    I'd appreciate any help!

    Thank you!!

    Abraham_E,

    Thanks for the data.  Curiously, the data do not seem to care what language you were using when you got it.

    The first data column appears as timing information.  The dt in who is 0.0005, which corresponds to a frequency of 2 kHz.  You said 400 Hz in one of your messages.  The discussion at the point 2 below corresponds to a frequency of 2 kHz sampling.

    1. you are right that SINAD is not very useful. SINAD assumes that all the power of the signal is the dominant frequency component that is not quite true for ECG.

    2. the size of the FFT of the signal shows the dominant signals at 50 and 100 Hz which is likely to be able to line with frequency. Al here also erase lines 200 and 250 Hz. You certainly do not want to calculate SNR under the assumption that the desired signal is 50 Hz.  The SINAD VI calculates the fundamental frequency than 49,97 Hz.

    3. If you don't know the 50 Hz and harmonic components, there is no obvious lines in the spectrum remaining. I interpret this means you have the significant variation of heart rate data.  This means that the heart rate is modulated in frequency. Frequency modulation broadens the spectrum.

    4. because there is not predominant in the spectrum, it is unlikely that frequency domain techniques will be worth any in the determination of the SNR.

    So, what can you do? Looking at the data graphic, I think a peak signal to noise power ratio could be significant. There are little noise, even at spikes, if it has a few problems too.  I have divided the data set in 1 second segments. For heart rate in these data, each segment contains one or two beats.  In each segment, I found the maximum and minimum values.  I set the value from Ridge to Ridge for the segment of the difference. I also calculated the RMS value for the entire segment. Then the SNR is the signal from Ridge to Ridge divided by the RMS value. It is probably more accurate to use the RMS value of the QRS and exclude parts QRS of the RMS of noise, but to do both is algorithmically and by the much more difficult calculation. It would be also better force segments contain exactly one beat of each. Again, it is much more complicated.  I then calculated the average of the SNR segment values and call it mean SNR.

    As I pointed out, there are some problems with the definition (peak to peak/RMS).  If you just want to compare signals within your lab to see which improves things, this should be good.  If you want to publish data and compare to other published results, you have to find how they define and measure SNR.

    In the attached VI I read the file once and recorded values in an array as a default value. Then I removed the file played screws and just worked with the data. To try this with other data simply insert read VI file in the appropriate place.

    Lynn

  • Help with a complex calculation of Acrobat Javascript

    I am trying to establish an if / then calculation for an Acrobat form and it is difficult.

    The premise is that when a customer enters a quantity of 3 and checked a box indicating a different package type, then apply a different price.

    I am trying to automate that in the area of totals.

    The Qty fields are labels: pre1, pre2. ... pre6

    Box is: pre_keg

    Total amount: Texte28

    the total cost is: pre_cost

    field reg price is: pre_bottle_cost

    field of different packaging: pre_keg_cost

    Guidance on how to get this working? Must it be done differently?

    There is not many or comparison of value, you have to test each value individually.

    var nSubTotal = this.getField("Text28").value;

    var bMember = this.getField("pre_keg").isBoxChecked (0);

    If ((nSubTotal == 3 || nSubTotal == 6 || nSubTotal == 9) & (bMember)) event.value = nSubTotal * 66.6666667;

    of other if(!bMember) nSubTotal = event.value * 75.

    You might also want to round the value of the event as it is financial and amounts of finance Word calculations are not performed in mils.

  • Need help for calculation script

    I was instructed to convert an Excel file into a fillable PDF, with formulas and calculations. Unfortunately, I'm a complete newbie to creating forms using calculations and javascript, but so far, I was able to use the built-in functions or to find examples of javascript for the formulas that I am duplicating. However, my final calculation stuck me.

    Basically, I do an if / then calculation based on a field being greater or less than another. If the result is greater, the script should return a 'YES', if it is lower, it should return a 'no' the excel function is as follows:

    = IF(C45>C32,"YES","NO")

    Could someone help me with this script?

    Here is the code for calculating customized to do this, assuming that the names of the other fields are C45 C32 and that their format is set to number:

    c45 var = getField("C45").value;

    c32 var = getField("C32").value;

    If (c45! = "" & c32! = "") {}

    If the two fields are not empty, compare them...

    Event.Value = c45 > c32? "YES": "NO";

    } else {}

    If the fields are empty, reset this field

    Event.Value = "";

    }

  • Lexicographical image processing

    I want to treat an image Board lexicographically (sense of reading what you write, so from left to right). Normal arithmatic (division, multiplication etcetera) functions increasing the table in its entirety, but I want to push the upper-left pixel through my algorithm, and then the one to the right and after that one to the right of that, until the last pixel, and then it starts with the a pixel under the first line all the way on the left.

    To illustrate, imagine an image of 12 X 16 pixels:

    I want to calculate the value that each pixel is supposed to have. I got this by comparing the actual value with the value I want. Calculate the value, it must be a certain pixel by examining to what extent it is originally. The origin lies in the Center:

    Then the distance from the origin and the actual pixels is the following:

    The length of this "vector" is then calculated by dividing this partly horizontal and vertical:

    The length is then squared the x axis and the y-squared added, then the root of this number is taken. It's basically the Pythagorean theorem. I know that in this case, the found length is not the actual length, because you use x = 1 and y = 1. So first off I subtract 8.5 from the value of x and 6.5 of the value of there before going any further.

    But I want to treat the pixels in the order of y = 1 x = 1, 2, 3, 4, 5, 6, 7, 8 etc., then y = 2 x = 1, 2, 3, 4, 5, 6, 7 and so on. Exactly what is the lexicographical treatment. But how do I get this to work? In my VI, you can see how I currently exports only the numbers of the total size of the image (or frame of a video), but I want to treat them one by one. I looked a little useful Labview files that do something similar, as the VI "check the Pixel value", but there you have to manually scroll through the data. I want it to happen automatically.

    So, how can I treat the pixels of an image lexicographically?


  • Calculate the square of cyclical report

    Hi all

    I'm acquisition (with USB-6212) a square wave, "100 Hz" with variable right cycle - which can be 20%, 50% or 80% - for decoding issues; the frequency of acquisition is set to 4 k. Actually, I said, frequency is 100 Hz, because I get a front amount every 10 ms, but the length of the high level is set by the communication protocol and that's what I called the service cycle (even if it does not match the exact definition of this property)

    Because I need decode the information contained by the wave, it is necessary for me to be able to say what is the duty cycle. I did this until taking the derivative of the signal, and then calculating index of ridges and troughs in the form of wave and finally, taking as shown below.

    It works well almost the whole opeartion, however, the acquisition is not 100% accurate. Sometimes I get the signal in A picture, which is ideal for what I wanted.

    Other times, the signal is like B and derived amplitude does not cross my threshold, although there is a rising edge. For example, I could lower my threshold to 2, but then I would get vulnerable to signal in photo C, which accuses the 2 peaks instead of one.

    Anyone has an idea on how to get around this or any other more reliable method than taking the derivative of the signal?

    Hornless.Rhino wrote:

    Jeff Bohrer says:

    johnsold wrote:

    Alternatively, do the way of Jeff.

    Lynn

    Well I have a magic 8 ball...

    You can put it in a sub - vi for the rest of us?

    Course

  • Why overlays take much longer on grayscale images single precision

    Hello

    I came across a rather curious problem. In a Visual inspection machine, we create 8-bit 16MPixel images. These are then calculated in single precision images. After processing the image display us certain types of images of result to the user. Here, the user can use the mouse on the image display and gets a reading of the current image of the sector where the mouse is currently positioned. If the image is RGB or U8, fine.

    However, if the display holds one of the 32-bit grayscale images things become quite slow, by a factor of 5 to 10 about. Now I can see that 32-bit is quite a bit more than 8 bits, so I guess an increase in lap by a maximum factor of 4 times.

    Since the images are large enough, an update takes about 90-100 ms with the 32-bit image, while the same action requires little more than 10 to 20 ms with U8 and same RGB. Because the movement of the mouse is caught by a structure of the event, all movements are processed and finally the tail to cause a blockage of the software that all these events are processed. This leads to ridiculously long 'freeze' time in the software, sometimes as long as 20 sec, as I saw through a log of the events has been implemented for this purpose.

    Attached is an example of code that shows the unusually long processing time for overlays on SGL-images. If there is any suggestion, I would be happy to read them. Thanks in advance.

    Falk

    After in-depth discussions with German support NOR we have understood that it is not primarily the recovery action that consumes time, but rather my screen image update after each action of the event. As my goal was to provide the user with the most recent image information available as close to the position of the mouse as possible there is no another way to do it without compromising the goal that I have explained.

    Several alternative ideas, we had (some don't work well) are briefly explained below:

    1. Use the property of the band of the art instead of creating an overlay

      • PRO: ultra fast response because no update of the display image is needed, easy to implement
      • Cons: Stationary, takes advanced band rest a while to appear, requires the user to stay in the same place on the screen for a while, the band faded unpredictable (in my test) and reappears only after leaving and returning to the display picture more keep the mouse pointer for a few seconds
    2. Use an extra (classic style) indicator string to display the desired text in the desired position
      • PRO: also very fast
      • CON: kind of hassle to the code, because it implies the correct calculation of the desired position of the channel indicator using the position of the window of the façade, the image appears indicator and the position of the mouse. Actually not hard I know, but nothing that see you with your mind on your dinner... You'll need a bunch of different reference types here to acquire the position necessary to window VI, indicator to display Image and mouse properties
    3. As 2 but without moving the indicator
      • PRO: fast and easy to implement
      • CON: not as easy to use since the indicator is stationary somewhere around the display of images and not at the mouse position.
    4. copy/typecast image SGL U8 image and move forward with overlays
      • PRO: the response is improved to the level that I used
      • CON: 'problem' with the update of the display image remains and therefore increases the response time the picture gets
    5. Use the property of the information string Image instead of creating an overlay
      • PRO: would be faster than 1., since no required update picture
      • k.o. - CON: property seems to be Read-Only, so no changes defined by the user of the text is possible

    I guess my choice will be 2.

    If anyone has other ideas on this subject, I will be always happy to hear about them.

  • How to send the value of inside while loop outside

    Hello

    The goal of my project is to control the height of a ball in a tube (there is a fan down low to lift the ball to the top and bottom) and a Top ultrasound sensor read the distance of the ball.

    I am currently using a PWM signal to control the speed of the fans (which works fine) and I use the VISA blocks read/write to communicate to my sensors (which works also very well - I can get the distance to the ball - when I move the ball up and down changing the duty cycle).

    My problem:

    Now, to create a control problem, I need read the distance of the ball, have some sort of controller and feed in this output as my new duty cycle for the fans... However, I need loops I have (running fans and continuous sensors to run (I guess? unless there is a way around it.) so the fans continue to work and sensors keep reading.) I need to get the measure of the distance of the loop of the sensor (after its been read) passed out of the loop and to be updated of course - then calculations can be made on that and then can be used as my duty.

    Someone in a way that I can do this? Its all tied to your reference, version of labview 8.6.

    Thanks heaps!

    Nick.


  • data storage

    Hello

    I have a few questions about how to manage and store data.

    I am witing a calibration software where I need to display the chart with the probes.

    then table of current vs probe 10 times Ref then calculations such as average, sigma, then conversion and data storage.

    Using data from the previous program files, I have identified a type of format.

    I reproduced it as a cluster with cluster as table follows this im using as a temporary variable when acquiring and pending approval of the user.

    After that I'll have to move from cluster to a vi convert txt to be operated by another application.

    My question is:

    is it a good way cluster using rather vs. string table

    one is typed so much more easy don't make mistake affecting each measure and the data calculated in the right place

    but less if the cluster size has to change

    with an array of strings, change can be easier but it is easy to make the mistake of index and by placing it in the wrong cell

    What would you use?

    Best regards

    Tinnitus

    Attached cluster VI

    While I agree with Mark that by using the software OpenG is write a much easier configuration file (in fact you can use the variant to the ini cluster just write the table once), it seems you are actually asking how to store data, no?  In this case, the format of configuration file would seem inappropriate if you plot the data that you need another script to extract data from this format.  If you try to write data that the customer can extract, then the way you suggest (without having seen) is not unreasonable.  Have that said, you considered PDM.  There are plugins for playback of this format for several packages of data analysis (Igor, Matlab, Excel, etc.) and writing to the file in this format is child's play.  There were converters even in ascii as others have developed on this site (I have not really tested it).  Anyway, just a thought.

    Cheers, Matt

  • SEARCH in a table, delete

    I have this table.

    I want to remove random noise.

    but I don't know where to start.

    I think I can remove row3 equal = 0.

    How can I do this?

    I want it to look like this

    Now that's a different problem.

    The file data you posted is not all zeros inside. The maximum and minimum temperature data are 51.1 and 12.9.

    I found the minimum and maximum for each column and then calculated the ratio. "Quiet" channels have ratios ~1.04 while the channels and large increases in temperature have > 1.7 reports there are also a few channels with little noise (such as channel 60 in your picture) with the rations between these values. Maybe you could use the max/min ratio to determine what are the desired channels.

    Lynn

  • error compiling video uknown

    Hi I export the video on cc 2015.

    at the beginning that I couldn't make it, that i ended up solving simply but made separate media and reissue of links there.

    Then I could make everything but could not export. It says error at 36%, which I then calculated part of the sequence has been screwing things up. I deleted it and then I managed to make it once, to put in place without a lut and managed to make it once again, once I put lut it gave me one error somewhere else...

    I don't understand what the problem with that.

    It started on a separate computer, and i have tried to import into different project or copy again to sequence and get the same thing all the time.

    I can playback all

    do you have the exact same 1080 p but over media encoder and worked!

  • How to make the transfer Budget in Hyperion Planning

    Hi Experts,

    I designed the data with the following contact information form

    Page: Scenario (Plan), Version (V1), company (oil, gas, oil and gas), year (FY13)

    Lines: Account (revenue, expenses)

    Columns: Period (Jan, Feb, Mar)

    My requirement is

    Once I entered the values of loads to the oil company, but also the gas for the period January. Then both the values of corresponding business costs should be consolidated and the result will be stored in the Oil & Gas Company for the period Jan. Finally, value of the expenditure for the oil company, but also the gas should get zero.

    Entry

    Plan FY13 oil V1

    Jan

    Feb

    Mar

    Recipes

    Fees

    100

    Plan FY13 gas V1

    Jan

    Feb

    Mar

    Recipes

    Fees

    150

    Result

    Plan of Oil & GAS FY13 V1

    Jan

    Feb

    Mar

    Recipes

    Fees

    250

    After the consolidation, the values for the oil company, but also the fresh gas should get zero.

    Plan FY13 oil V1

    Jan

    Feb

    Mar

    Recipes

    Fees

    0

    Plan FY13 gas V1

    Jan

    Feb

    Mar

    Recipes

    Fees

    0

    Kindly guide me how to achieve this task.


    Concerning

    Ravi

    You can try this:

    DIFFICULTY ('Plan', 'V1', "FY13")

    "Expenses".

    (

    "Oil & gas"-> "Jan" = "Oil"-> "Jan" + "Gas"-> "Jan";  / * If oil and gas are not consolidate oil gas & if they are grouped according to the outline, then calculating members is enough * /.

    )

    ENDFIX

    DIFFICULTY ('Plan', 'V1', "FY13")

    "Expenses".

    (

    'Oil'-> 'Jan' = 0;

    "Gas"-> "Jan" = 0;

    )

    ENDFIX

    See you soon... !!

    Rahul S.

  • How can I Zoom in a knot is centered in a ScrollPane?

    I created a small example application to zoom a node.

    The application is currently running to stapling the node when the node becomes larger than the visible area of its container.

    I would like to place the node in a ScrollPane and maintain the following properties:

    1. If the display window available scrollpane is greater that the node, the node is centered in the display window.
    2 scroll of the mouse wheel anywhere in the display zoom in and out, node it is not pan the node.
    3. when zooming in or out on the node, the node does not move autour, but zooms still inside or out on the current center of the display window.
    4. by pressing and dragging the mouse over the node you can pan the visible portion of the node in the display window.

    The behavior of zoom without pan around all node should be exactly the same as the behavior that is clipped by the sample application.

    What is the change of the sample request needed to obtain the desired behavior?
    import javafx.application.Application;
    import javafx.beans.value.*;
    import javafx.event.*;
    import javafx.geometry.Bounds;
    import javafx.scene.*;
    import javafx.scene.control.*;
    import javafx.scene.image.*;
    import javafx.scene.input.*;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.*;
    import javafx.stage.Stage;
    
    public class GraphicsScalingApp extends Application {
      public static void main(String[] args) { launch(args); }
    
      @Override public void start(final Stage stage) {
        final Group group = new Group(
            createStar(),
            createCurve()
        );
    
        Parent zoomPane = createZoomPane(group);
    
        VBox layout = new VBox();
        layout.getChildren().setAll(
            createMenuBar(stage, group),
            zoomPane
        );
    
        VBox.setVgrow(zoomPane, Priority.ALWAYS);
        Scene scene = new Scene(
            layout
        );
    
        stage.setTitle("Zoomy");
        stage.getIcons().setAll(new Image(APP_ICON));
        stage.setScene(scene);
        stage.show();
      }
    
      private Parent createZoomPane(final Group group) {
        final double SCALE_DELTA = 1.1;
        final StackPane zoomPane = new StackPane();
    
        zoomPane.getChildren().add(group);
        zoomPane.setOnScroll(new EventHandler<ScrollEvent>() {
          @Override public void handle(ScrollEvent event) {
            event.consume();
    
            if (event.getDeltaY() == 0) {
              return;
            }
    
            double scaleFactor =
              (event.getDeltaY() > 0)
                ? SCALE_DELTA
                : 1/SCALE_DELTA;
    
            group.setScaleX(group.getScaleX() * scaleFactor);
            group.setScaleY(group.getScaleY() * scaleFactor);
          }
        });
    
        zoomPane.layoutBoundsProperty().addListener(new ChangeListener<Bounds>() {
          @Override public void changed(ObservableValue<? extends Bounds> observable, Bounds oldBounds, Bounds bounds) {
          zoomPane.setClip(new Rectangle(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight()));
          }
        });
    
        return zoomPane;
      }
    
      private SVGPath createCurve() {
        SVGPath ellipticalArc = new SVGPath();
        ellipticalArc.setContent(
            "M10,150 A15 15 180 0 1 70 140 A15 25 180 0 0 130 130 A15 55 180 0 1 190 120"
        );
        ellipticalArc.setStroke(Color.LIGHTGREEN);
        ellipticalArc.setStrokeWidth(4);
        ellipticalArc.setFill(null);
        return ellipticalArc;
      }
    
      private SVGPath createStar() {
        SVGPath star = new SVGPath();
        star.setContent(
            "M100,10 L100,10 40,180 190,60 10,60 160,180 z"
        );
        star.setStrokeLineJoin(StrokeLineJoin.ROUND);
        star.setStroke(Color.BLUE);
        star.setFill(Color.DARKBLUE);
        star.setStrokeWidth(4);
        return star;
      }
    
      private MenuBar createMenuBar(final Stage stage, final Group group) {
        Menu fileMenu = new Menu("_File");
        MenuItem exitMenuItem = new MenuItem("E_xit");
        exitMenuItem.setGraphic(new ImageView(new Image(CLOSE_ICON)));
        exitMenuItem.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent event) {
            stage.close();
          }
        });
        fileMenu.getItems().setAll(
            exitMenuItem
        );
        Menu zoomMenu = new Menu("_Zoom");
        MenuItem zoomResetMenuItem = new MenuItem("Zoom _Reset");
        zoomResetMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.ESCAPE));
        zoomResetMenuItem.setGraphic(new ImageView(new Image(ZOOM_RESET_ICON)));
        zoomResetMenuItem.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent event) {
            group.setScaleX(1);
            group.setScaleY(1);
          }
        });
        MenuItem zoomInMenuItem = new MenuItem("Zoom _In");
        zoomInMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.I));
        zoomInMenuItem.setGraphic(new ImageView(new Image(ZOOM_IN_ICON)));
        zoomInMenuItem.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent event) {
            group.setScaleX(group.getScaleX() * 1.5);
            group.setScaleY(group.getScaleY() * 1.5);
          }
        });
        MenuItem zoomOutMenuItem = new MenuItem("Zoom _Out");
        zoomOutMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.O));
        zoomOutMenuItem.setGraphic(new ImageView(new Image(ZOOM_OUT_ICON)));
        zoomOutMenuItem.setOnAction(new EventHandler<ActionEvent>() {
          @Override public void handle(ActionEvent event) {
            group.setScaleX(group.getScaleX() * 1/1.5);
            group.setScaleY(group.getScaleY() * 1/1.5);
          }
        });
        zoomMenu.getItems().setAll(
            zoomResetMenuItem,
            zoomInMenuItem,
            zoomOutMenuItem
        );
        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().setAll(
            fileMenu,
            zoomMenu
        );
        return menuBar;
      }
    
      // icons source from: http://www.iconarchive.com/show/soft-scraps-icons-by-deleket.html
      // icon license: CC Attribution-Noncommercial-No Derivate 3.0 =? http://creativecommons.org/licenses/by-nc-nd/3.0/
      // icon Commercial usage: Allowed (Author Approval required -> Visit artist website for details).
    
      public static final String APP_ICON        = "http://icons.iconarchive.com/icons/deleket/soft-scraps/128/Zoom-icon.png";
      public static final String ZOOM_RESET_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-icon.png";
      public static final String ZOOM_OUT_ICON   = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-Out-icon.png";
      public static final String ZOOM_IN_ICON    = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-In-icon.png";
      public static final String CLOSE_ICON      = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Button-Close-icon.png";
    }

    Well, it wasn't what I had to do today...

    A couple of minor changes first: I wrapped the StackPane in a group so that the ScrollPane component would be informed of these changes to the transformations, according to the ScrollPane Javadocs. And then I have to the minimum size of the StackPane of the size of the viewport (keeping centered content when it is smaller than the viewport).

    Initially, I thought I should use a processing of scale to zoom around the display Center (i.e. the point on content that is at the center of the display window). But I found that I still need to set the scroll position subsequently to keep the same display Center, so I dropped that and has been restored by using setScaleX() and setScaleY().

    The trick is to set the scroll position after descaling. I calculated the scroll offset in local coordinates, the content scroll and then calculated the new scroll values necessary after scaling. It was a little tricky. The basic observation is that
    (hValue-hMin) /(hMax-hMin) = x / (contentWidth - viewportWidth), where x represents the horizontal offset of the left edge of the display window from the left edge of the content.
    Then you have centerX = x + viewportWidth/2.

    After scaling, the coordinate x of the old centerX is now centerX * scaleFactor. So, just set the new hValue to the new Center. There is a bit of algebra to understand this.

    After this, panoramic moving was pretty easy :).

    import javafx.application.Application;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.value.*;
    import javafx.event.*;
    import javafx.geometry.Bounds;
    import javafx.geometry.Point2D;
    import javafx.scene.*;
    import javafx.scene.control.*;
    import javafx.scene.image.*;
    import javafx.scene.input.*;
    import javafx.scene.layout.*;
    import javafx.scene.paint.Color;
    import javafx.scene.shape.*;
    import javafx.stage.Stage;
    
    public class GraphicsScalingApp extends Application {
      public static void main(String[] args) {
        launch(args);
      }
    
      @Override
      public void start(final Stage stage) {
        final Group group = new Group(createStar(), createCurve());
    
        Parent zoomPane = createZoomPane(group);
    
        VBox layout = new VBox();
        layout.getChildren().setAll(createMenuBar(stage, group), zoomPane);
    
        VBox.setVgrow(zoomPane, Priority.ALWAYS);
    
        Scene scene = new Scene(layout);
    
        stage.setTitle("Zoomy");
        stage.getIcons().setAll(new Image(APP_ICON));
        stage.setScene(scene);
        stage.show();
      }
    
      private Parent createZoomPane(final Group group) {
        final double SCALE_DELTA = 1.1;
        final StackPane zoomPane = new StackPane();
    
        zoomPane.getChildren().add(group);
    
        final ScrollPane scroller = new ScrollPane();
        final Group scrollContent = new Group(zoomPane);
        scroller.setContent(scrollContent);
    
        scroller.viewportBoundsProperty().addListener(new ChangeListener() {
          @Override
          public void changed(ObservableValue observable,
              Bounds oldValue, Bounds newValue) {
            zoomPane.setMinSize(newValue.getWidth(), newValue.getHeight());
          }
        });
    
        scroller.setPrefViewportWidth(256);
        scroller.setPrefViewportHeight(256);
    
        zoomPane.setOnScroll(new EventHandler() {
          @Override
          public void handle(ScrollEvent event) {
            event.consume();
    
            if (event.getDeltaY() == 0) {
              return;
            }
    
            double scaleFactor = (event.getDeltaY() > 0) ? SCALE_DELTA
                : 1 / SCALE_DELTA;
    
            // amount of scrolling in each direction in scrollContent coordinate
            // units
            Point2D scrollOffset = figureScrollOffset(scrollContent, scroller);
    
            group.setScaleX(group.getScaleX() * scaleFactor);
            group.setScaleY(group.getScaleY() * scaleFactor);
    
            // move viewport so that old center remains in the center after the
            // scaling
            repositionScroller(scrollContent, scroller, scaleFactor, scrollOffset);
    
          }
        });
    
        // Panning via drag....
        final ObjectProperty lastMouseCoordinates = new SimpleObjectProperty();
        scrollContent.setOnMousePressed(new EventHandler() {
          @Override
          public void handle(MouseEvent event) {
            lastMouseCoordinates.set(new Point2D(event.getX(), event.getY()));
          }
        });
    
        scrollContent.setOnMouseDragged(new EventHandler() {
          @Override
          public void handle(MouseEvent event) {
            double deltaX = event.getX() - lastMouseCoordinates.get().getX();
            double extraWidth = scrollContent.getLayoutBounds().getWidth() - scroller.getViewportBounds().getWidth();
            double deltaH = deltaX * (scroller.getHmax() - scroller.getHmin()) / extraWidth;
            double desiredH = scroller.getHvalue() - deltaH;
            scroller.setHvalue(Math.max(0, Math.min(scroller.getHmax(), desiredH)));
    
            double deltaY = event.getY() - lastMouseCoordinates.get().getY();
            double extraHeight = scrollContent.getLayoutBounds().getHeight() - scroller.getViewportBounds().getHeight();
            double deltaV = deltaY * (scroller.getHmax() - scroller.getHmin()) / extraHeight;
            double desiredV = scroller.getVvalue() - deltaV;
            scroller.setVvalue(Math.max(0, Math.min(scroller.getVmax(), desiredV)));
          }
        });
    
        return scroller;
      }
    
      private Point2D figureScrollOffset(Node scrollContent, ScrollPane scroller) {
        double extraWidth = scrollContent.getLayoutBounds().getWidth() - scroller.getViewportBounds().getWidth();
        double hScrollProportion = (scroller.getHvalue() - scroller.getHmin()) / (scroller.getHmax() - scroller.getHmin());
        double scrollXOffset = hScrollProportion * Math.max(0, extraWidth);
        double extraHeight = scrollContent.getLayoutBounds().getHeight() - scroller.getViewportBounds().getHeight();
        double vScrollProportion = (scroller.getVvalue() - scroller.getVmin()) / (scroller.getVmax() - scroller.getVmin());
        double scrollYOffset = vScrollProportion * Math.max(0, extraHeight);
        return new Point2D(scrollXOffset, scrollYOffset);
      }
    
      private void repositionScroller(Node scrollContent, ScrollPane scroller, double scaleFactor, Point2D scrollOffset) {
        double scrollXOffset = scrollOffset.getX();
        double scrollYOffset = scrollOffset.getY();
        double extraWidth = scrollContent.getLayoutBounds().getWidth() - scroller.getViewportBounds().getWidth();
        if (extraWidth > 0) {
          double halfWidth = scroller.getViewportBounds().getWidth() / 2 ;
          double newScrollXOffset = (scaleFactor - 1) *  halfWidth + scaleFactor * scrollXOffset;
          scroller.setHvalue(scroller.getHmin() + newScrollXOffset * (scroller.getHmax() - scroller.getHmin()) / extraWidth);
        } else {
          scroller.setHvalue(scroller.getHmin());
        }
        double extraHeight = scrollContent.getLayoutBounds().getHeight() - scroller.getViewportBounds().getHeight();
        if (extraHeight > 0) {
          double halfHeight = scroller.getViewportBounds().getHeight() / 2 ;
          double newScrollYOffset = (scaleFactor - 1) * halfHeight + scaleFactor * scrollYOffset;
          scroller.setVvalue(scroller.getVmin() + newScrollYOffset * (scroller.getVmax() - scroller.getVmin()) / extraHeight);
        } else {
          scroller.setHvalue(scroller.getHmin());
        }
      }
    
      private SVGPath createCurve() {
        SVGPath ellipticalArc = new SVGPath();
        ellipticalArc.setContent("M10,150 A15 15 180 0 1 70 140 A15 25 180 0 0 130 130 A15 55 180 0 1 190 120");
        ellipticalArc.setStroke(Color.LIGHTGREEN);
        ellipticalArc.setStrokeWidth(4);
        ellipticalArc.setFill(null);
        return ellipticalArc;
      }
    
      private SVGPath createStar() {
        SVGPath star = new SVGPath();
        star.setContent("M100,10 L100,10 40,180 190,60 10,60 160,180 z");
        star.setStrokeLineJoin(StrokeLineJoin.ROUND);
        star.setStroke(Color.BLUE);
        star.setFill(Color.DARKBLUE);
        star.setStrokeWidth(4);
        return star;
      }
    
      private MenuBar createMenuBar(final Stage stage, final Group group) {
        Menu fileMenu = new Menu("_File");
        MenuItem exitMenuItem = new MenuItem("E_xit");
        exitMenuItem.setGraphic(new ImageView(new Image(CLOSE_ICON)));
        exitMenuItem.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            stage.close();
          }
        });
        fileMenu.getItems().setAll(exitMenuItem);
        Menu zoomMenu = new Menu("_Zoom");
        MenuItem zoomResetMenuItem = new MenuItem("Zoom _Reset");
        zoomResetMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.ESCAPE));
        zoomResetMenuItem.setGraphic(new ImageView(new Image(ZOOM_RESET_ICON)));
        zoomResetMenuItem.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            group.setScaleX(1);
            group.setScaleY(1);
          }
        });
        MenuItem zoomInMenuItem = new MenuItem("Zoom _In");
        zoomInMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.I));
        zoomInMenuItem.setGraphic(new ImageView(new Image(ZOOM_IN_ICON)));
        zoomInMenuItem.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            group.setScaleX(group.getScaleX() * 1.5);
            group.setScaleY(group.getScaleY() * 1.5);
          }
        });
        MenuItem zoomOutMenuItem = new MenuItem("Zoom _Out");
        zoomOutMenuItem.setAccelerator(new KeyCodeCombination(KeyCode.O));
        zoomOutMenuItem.setGraphic(new ImageView(new Image(ZOOM_OUT_ICON)));
        zoomOutMenuItem.setOnAction(new EventHandler() {
          @Override
          public void handle(ActionEvent event) {
            group.setScaleX(group.getScaleX() * 1 / 1.5);
            group.setScaleY(group.getScaleY() * 1 / 1.5);
          }
        });
        zoomMenu.getItems().setAll(zoomResetMenuItem, zoomInMenuItem,
            zoomOutMenuItem);
        MenuBar menuBar = new MenuBar();
        menuBar.getMenus().setAll(fileMenu, zoomMenu);
        return menuBar;
      }
    
      // icons source from:
      // http://www.iconarchive.com/show/soft-scraps-icons-by-deleket.html
      // icon license: CC Attribution-Noncommercial-No Derivate 3.0 =?
      // http://creativecommons.org/licenses/by-nc-nd/3.0/
      // icon Commercial usage: Allowed (Author Approval required -> Visit artist
      // website for details).
    
      public static final String APP_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/128/Zoom-icon.png";
      public static final String ZOOM_RESET_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-icon.png";
      public static final String ZOOM_OUT_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-Out-icon.png";
      public static final String ZOOM_IN_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Zoom-In-icon.png";
      public static final String CLOSE_ICON = "http://icons.iconarchive.com/icons/deleket/soft-scraps/24/Button-Close-icon.png";
    }
    
  • CF 10 &amp; 11 licenses on Virtual Machines

    I tried to get a response from Adobe for the month, but have gotten the runaround.

    Here's the question I asked. We have a lot of licenses that we need to upgrade before the end of support core. If we don't get answers, we may be forced to use another provider.

    I needed to clarify a finer ColdFusion licenses for v9 and v10.

    Of the license of the v10 (http://wwwimages. ) Adobe.com/www. ( Adobe.com/content/dam/licenses-Terms/pdf/Adobe%20ColdFusion%C2%AE%2010.pdf ):


    1.5 "CPU" is each separate central processing unit (virtual or physical) within the computer capable of manipulating independently and the operating system. Each processor can contain one or more processing cores. The total number of cores operating the software in the computer can not exceed the allowed quantity and will be higher for the exact number of cores operating the software in the case when the licensee configures the computer (using a reliable and verifiable means of hardware or software partitioning) such that the total number of CPU cores working in fact the software is less than the total number of cores on this computer , or, (ii) the sum of all the kernels in each Jepp on the computer. The total number of processors on a computer is then calculated by dividing the total number of cores, the operating software of 4, rounded to the whole number in case the quotient of the division by 4 is not an integer. For example, if the total number of cores, the operating system is 12, then the total number of processors equals 3. If the total number of cores, the operating system is 14, the total number of processors equals 4.


    A couple of things:

    1. I can't understand when scenario would never be of and (ii). It seems that (ii) would be still greater (so why even talk about 'i'). Could you explain that?
    2. I have a physical machine with a ton of CPU cores. Let's say that in total, the machine has 32 cores. However, on this machine (host) is running a VM guest that is limited to only 8 of the 32 hearts of the host. Since a company unique license covers 2 CPUs (or 8 cores, as defined in another section of the license) and the virtual machine uses only 8 of the 32 physical cores of the host, I think the spirit of the license would I just need only one license. Is this true?
    Thank you

    Jamie

    My apologies for the inconvenience caused. I'll send your contact to the team of sales/Licensing. They would be in touch with you.

    Kind regards

    Anit Kumar

Maybe you are looking for