Need suggestion for variable size array of primitive type.

Hi all,
I am working on a problem in which I need to keep an array of primitive (type int) sorted. Also I insert new elements while keeping it sorted, and at times I merge two similar arrays with unique elements.
I would welcome suggestions on the implementation aspects as to which type/class to use. My primary consideration is performance. Here are my observations:
1. type int
Efficient operation, but arrays are fixed size so it makes clumsy code and overhead when the array is expanded or merged with another.
Methods in class Arrays can be used, incl. binary search and sort.
2. Vector, ArrayList, List, LinkedList
Accept objects only. I can use Integer instead of int, but it will involve overhead, and I'll need to write my own sort and search routines (already done).
For now, I choose option 2 using Vectors. Is there a better choice, or are there other options, given the conditions and consideration enumerated at the beginning?
Appreciate any input or comments.

mathmate wrote:
I have not had the occasion to use them in parallel to recognize the difference. It pays to talk to people!A small benchmark is easily constructed:
import bak.pcj.list.IntArrayList;
import java.util.Random;
import java.util.ArrayList;
public class CollectionTest {
    static void testObjectsList(ArrayList<Integer> list, int n, long seed) {
        long start = System.currentTimeMillis();
        Random rand = new Random(seed);
        for(int i = 0; i < n; i++)
            list.add(new Integer(rand.nextInt()));
        for(int i = 0; i < n/2; i++)
            list.remove(rand.nextInt(list.size()));
        long end = System.currentTimeMillis();
        System.out.println("objectsList -> "+(end-start)+" ms.");
    static void testPrimitiveList(IntArrayList list, int n, long seed) {
        long start = System.currentTimeMillis();
        Random rand = new Random(seed);
        for(int i = 0; i < n; i++)
            list.add(rand.nextInt());
        for(int i = 0; i < n/2; i++)
            list.remove(rand.nextInt(list.size()));
        long end = System.currentTimeMillis();
        System.out.println("primitiveList -> "+(end-start)+" ms.");
    public static void main(String[] args) {
        long seed = System.currentTimeMillis();
        int numTests = 100000;
        testObjectsList(new ArrayList<Integer>(), numTests, seed);
        testPrimitiveList(new IntArrayList(), numTests, seed);
}In the test above, Java's ArrayList is about 5 times faster. But when commenting out the remove(...) methods, the primitive 3rd party IntArrayList is about 4 to 5 times faster.
Give it a spin.
Again: just try to do it with the standard classes: if performance lacks, look at something else.

Similar Messages

  • How can I create a variable size array?

    How can I create a variable size array?

    ok then how can i create a new vector object?If you don't know that, you need to go back to your text book and study some more. Or read the tutorial on the basics of Java: http://java.sun.com/docs/books/tutorial/java/index.html
    After reading that you can move on to: http://java.sun.com/docs/books/tutorial/collections/index.html
    Anyway, the answer to your question is, of course:
    Vector v = new Vector();(But you should probably use ArrayList instead of Vector.)

  • Need Suggestion for Archival of a Table Data

    Hi guys,
    I want to archive one of my large table. the structure of table is as below.
    Daily there will be around 40000 rows inserted into the table.
    Need suggestion for the same. will the partitioning help and on what basis?
    CREATE TABLE IM_JMS_MESSAGES_CLOB_IN
    LOAN_NUMBER VARCHAR2(10 BYTE),
    LOAN_XML CLOB,
    LOAN_UPDATE_DT TIMESTAMP(6),
    JMS_TIMESTAMP TIMESTAMP(6),
    INSERT_DT TIMESTAMP(6)
    TABLESPACE DATA
    PCTUSED 0
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE (
    INITIAL 1M
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    LOGGING
    LOB (LOAN_XML) STORE AS
    ( TABLESPACE DATA
    ENABLE STORAGE IN ROW
    CHUNK 8192
    PCTVERSION 10
    NOCACHE
    STORAGE (
    INITIAL 1M
    NEXT 1M
    MINEXTENTS 1
    MAXEXTENTS 2147483645
    PCTINCREASE 0
    BUFFER_POOL DEFAULT
    NOCACHE
    NOPARALLEL;
    do the needful.
    regards,
    Sandeep

    There will not be any updates /deletes on the table.
    I have created a partitioned table with same struture and i am inserting the records from my original table to this partitioned table where i will maintain data for 6 months.
    After loading the data from original table to archived table i will truncating the original table.
    If my original table is partitioned then what about the restoring of the data??? how will restore the data of last month???

  • Need suggestion for designing a BEx report

    Hi,
    I need suggestions for designing a BEx report.
    Iu2019ve a DSO with below structure:
    1. Functional Location u2013 Key
    2. Maintenance Plan u2013 Key
    3. Maintenance Item u2013 Key
    4. Call # - Key
    5. Cycle u2013 Data Field
    6. Planned Date u2013 Data Field
    7. Completion Date u2013 Data Field
    This DSO contains data like:
    Functional -
    Plan --- Item -
    Call# --- Cycle -
    Planned Dt -
    Completion Dt
    Location
    11177 -
         134 -
         20 -
         1 -
    T1 -
         02-Jan-2011 -
         10-Jan-2011
    11177 -
         134 -
         20 -
         2 -
    T2 -
         15-Feb-2011 -
    11177 -
         134 -
         20 -
         3 -
    T1 -
         15-Mar-2011 -
    11177 -
         134 -
         20 -
         4 -
    M1 -
         30-Mar-2011 -
    25000 -
         170 -
         145 -
         1 -
    T1 -
         19-Jan-2011 -
         19-Jan-2011
    25000 -
         134 -
         145 -
         2 -
    T2 -
         20-Feb-2011 -
         25-Feb-2011
    25000 -
         134 -
         145 -
         3 -
    T1 -
         14-Mar-2011 -
    Now Iu2019ve to create a report which will be executed at the end of every month and should display the list of Functional Locations whose Cycles were planned in that particular month, along with the last completed Cycle/Date.
    Thus based upon above data, if I execute report at the end of (say) March then report must display:
    Functional ---     Curr. Cycle --- Planned Date --- Prev. completed Cycle --- Prev Completed Date
    Location
    11177 -
         T1 -
         15-Mar-2011 -
    ---     T1 -
    --     10-Jan-2011
    11177 -
         M1 -
         30-Mar-2011 -
    ---     T1 -
    --     10-Jan-2011
    25000 -
         T1 -
         14-Mar-2011 -
    ---     T2 -
    --     25-Feb-2011
    Any idea how can I display Previous Completed Cycle and Completion Date (i.e. the last two columns)?
    Regards,
    Vikrant.

    hi vikrant,
    You can a Cube at the reporting layer  which gets data from DSO and which has these 2 extra characteristics completion date and previous cycle along with other chars and keyfigures from DSO.
    You can populate these  based on your logic in the field routine.
    Hope it helps.
    Regards
    Dev

  • [svn] 1427: Fix a bug from my previous checkin: For variables that had a primitive value,

    Revision: 1427
    Author: [email protected]
    Date: 2008-04-26 07:47:02 -0700 (Sat, 26 Apr 2008)
    Log Message:
    Fix a bug from my previous checkin: For variables that had a primitive value,
    we were not preserving the variable's attributes, such as static,
    public/protected/private, etc.
    Modified Paths:
    flex/sdk/trunk/modules/debugger/src/java/flash/tools/debugger/concrete/DManager.java

    This should help you to get started !
    select banner as "Oracle version" from v$version where banner like 'Oracle%';
    create table otn5test(
      id number,
      data xmltype
    insert into otn5test values (1, xmltype('<catalog>
    <cd>
    <title>Hide your heart</title>
    <artist>Bonnie Tyler</artist>
    <country>UK</country>
    <company>CBS Records</company>
    <price>9.90</price>
    <year>1988</year>
    </cd>
    <cd>
    <title>Empire Burlesque</title>
    <artist>Bob Dylan</artist>
    <country>USA</country>
    <company>Columbia</company>
    <price>10.90</price>
    <year>1985</year>
    </cd>
    </catalog>
    select otn5test.id, x.*
    from otn5test,
         xmltable('/catalog/cd[artist/text()="Bob Dylan"]' passing otn5test.data
         columns title varchar2(20) path 'title') x;
    select otn5test.id,
           xmlcast(xmlquery('/catalog/cd[artist/text()="Bob Dylan"]/title'
                   passing otn5test.data returning content)
           as varchar2(20)) from otn5test;
    drop table otn5test;
    sqlplus> @otn-5.sql
    Oracle version
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    Table created.
    1 row created.
         ID TITLE
          1 Empire Burlesque
         ID XMLCAST(XMLQUERY('/C
          1 Empire Burlesque
    Table dropped.

  • I need example for VARIABLES with Customer Exit.

    hi every body i need example for Variable for Customer Exit.

    Hi,
    You can define 'Formula' variables in your customer exit..for example..
    you need to calculate no of machine running hours per month, in order to
    caculate the machine total utilization time..in this context.. you need to know
    how may hours are there in an month by month..
    you can define a variable and write the code in the customer exit for deriving the total no. of hours available for that month and get that value into a variable for further calution like deducting the down time and set up time so on..in your
    calculated KF..
    Hope this helps..
    Assign points if useful..
    Cheers,
    Pattan.

  • Array Of Primitive Type (kodo3.4)

    Hello,
    I want to map an array of primitive type (double[] or double[][] or...) to
    a blob, so I specified the mapping this way:
    <extension vendor-name="kodo" key="jdbc-field-map-name" value="blob">
    <extension vendor-name="kodo" key="column" value="DATA"/>
    </extension>
    As I use MySQL and not to have an exception, I have added:
    kodo.jdbc.DBDictionary: DriverDeserializesBlobs=false
    But when I tried to refresh using kodo.jdbc.meta.MappingTool, I get:
    [refresh] Exception in thread "main" kodo.util.FatalInternalException:
    Cannot map "fr.ifp.reservoir.model.business.geostat.Lithotype.facies".
    Check the class and make sure you are using only supported types.
    [refresh] at
    kodo.jdbc.meta.DynamicMappingProvider.createFieldMapping(DynamicMappingProvider.java:336)
    [refresh] at
    kodo.jdbc.meta.DynamicMappingProvider.getFieldMapping(DynamicMappingProvider.java:118)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:993)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:973)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:939)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:659)
    [refresh] at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:801)
    [refresh] at
    kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:341)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
    [refresh] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
    [refresh] at kodo.jdbc.meta.MappingTool.refresh(MappingTool.java:591)
    [refresh] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:941)
    [refresh] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:879)
    [refresh] at kodo.jdbc.meta.MappingTool.main(MappingTool.java:802)
    Thanks for your help.
    nicolas

    Hi,
    No more succes with persistence-modifier="persistent"...
    My class:
    public class ArrayWrapper {
    private String name;
    private double[] array;
    public ArrayWrapper(String name, double[] array) {
    this.name = name;
    this.array = array;
    public double[] getValues() {
    return array;
    public String getName() {
    return name;
    My metadata file:
    <jdo>
    <package name="model">
    <class name="ArrayWrapper">
    <field name="array" persistence-modifier="persistent">
    <extension vendor-name="kodo" key="jdbc-field-map-name" value="blob">
    <extension vendor-name="kodo" key="column" value="DATA"/>
    </extension>
    </field>
    </class>
    </package>
    </jdo>
    My StackTrace:
    refresh-mapping:
    [java] Exception in thread "main" kodo.util.FatalInternalException:
    Cannot map "model.ArrayWrapper.array". Check the class and make sure you
    are using only supported types.
    [java] at
    kodo.jdbc.meta.DynamicMappingProvider.createFieldMapping(DynamicMappingProvider.java:336)
    [java] at
    kodo.jdbc.meta.DynamicMappingProvider.getFieldMapping(DynamicMappingProvider.java:118)
    [java] at
    kodo.jdbc.meta.MappingRepository.getFieldMapping(MappingRepository.java:470)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:993)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getFieldMapping(AbstractClassMapping.java:973)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getMappings(AbstractClassMapping.java:939)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.getDeclaredFieldMappings(AbstractClassMapping.java:659)
    [java] at
    kodo.jdbc.meta.AbstractClassMapping.resolve(AbstractClassMapping.java:801)
    [java] at
    kodo.jdbc.meta.BaseClassMapping.resolve(BaseClassMapping.java:341)
    [java] at
    kodo.jdbc.meta.MappingRepository.resolve(MappingRepository.java:431)
    [java] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:349)
    [java] at
    kodo.jdbc.meta.MappingRepository.getMapping(MappingRepository.java:177)
    [java] at kodo.jdbc.meta.MappingTool.refresh(MappingTool.java:591)
    [java] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:941)
    [java] at kodo.jdbc.meta.MappingTool.run(MappingTool.java:879)
    [java] at kodo.jdbc.meta.MappingTool.main(MappingTool.java:802)

  • Does TopLink support arrays of primitive types?

    Does TopLink support arrays of primitive types?

    You must use a collection.
    If you really wanted to you could store the data as an array and use get/set methods to convert between the array and collection, or customize your own ContainerPolicy, however arrays a very inefficent to add/remove from so TopLink only provides support for collections.

  • Variable size array in a FlowPane

    If i have an array of variable size (for example a array of cards).
    How can i build something to show the elements(in a FlowPane for example) and each of them having its own controller (fxml + controller for each card), so the container (flow pane) of the elements (cards) can have it's elements swaped, removed or added new ones?
    Controller:
    public class HandController extends FlowPane implements Initializable{
        @Override public void initialize(URL arg0, ResourceBundle arg1){
        public void setHand(ArrayList<Cards> Hand){
            //this would work if the hand were static
            for(int i = 0; i < Hand.size(); ++i){
                FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("CardView.fxml"));
                CardController controller = new CardController();
                fxmlLoader.setController(controller);
                fxmlLoader.setRoot(controller);
                Parent card = (Parent)fxmlLoader.load();
                fxmlLoader.setRoot(card);
                this.getChildren().add(card);
                controller.setCard(Hand.get(i));
    }Fxml:
    <fx:root type="FlowPane" xmlns:fx="http://javafx.com/fxml"
             stylesheets="view/Style.css">
        <children>
            <!--should i put something here?-->
        </children>
    </fx:root>

    Well, I was bored...
    This "game" has a hand of up to five cards. You can deal from a deck to the hand, and then play (or discard) a card by double-clicking on it.
    The model comprises a Card class, a Deck class, and a GameModel class. The last one tracks the hand and deck and the relationship between them. Card and Deck were written from my memory of reading an example of using Enums by Josh Bloch.
    Card.java
    package cardgame;
    public class Card {
         public enum Rank {
              Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King
         public enum Suit {
              Clubs, Diamonds, Hearts, Spades
         private final Rank rank;
         private final Suit suit;
         public Card(Rank rank, Suit suit) {
              this.rank = rank;
              this.suit = suit;
         public Rank getRank() {
              return rank;
         public Suit getSuit() {
              return suit;
         @Override
         public String toString() {
              return String.format("%s of %s", rank, suit);
         @Override
         public int hashCode() {
              final int prime = 31;
              int result = 1;
              result = prime * result + ((rank == null) ? 0 : rank.hashCode());
              result = prime * result + ((suit == null) ? 0 : suit.hashCode());
              return result;
         @Override
         public boolean equals(Object obj) {
              if (this == obj)
                   return true;
              if (obj == null)
                   return false;
              if (getClass() != obj.getClass())
                   return false;
              Card other = (Card) obj;
              if (rank != other.rank)
                   return false;
              if (suit != other.suit)
                   return false;
              return true;
    }Deck.java
    package cardgame;
    import java.util.ArrayList;
    import java.util.LinkedList;
    import java.util.List;
    import java.util.Random;
    import cardgame.Card.Rank;
    import cardgame.Card.Suit;
    public class Deck {
         private final List<Card> cards;
         private Deck() {
              cards = new LinkedList<Card>();
              for (Suit suit : Suit.values())
                   for (Rank rank : Rank.values())
                        cards.add(new Card(rank, suit));
         public static Deck newDeck() {
              return new Deck();
         public static Deck shuffledDeck() {
              return newDeck().shuffle();
         public Deck shuffle() {
              final List<Card> copy = new ArrayList<Card>(cards.size());
              Random rng = new Random();
              while (cards.size() > 0) {
                   int index = rng.nextInt(cards.size());
                   copy.add(cards.remove(index));
              cards.clear();
              cards.addAll(copy);
              return this;
         public Card deal() {
              return cards.remove(0);
         public int size() {
              return cards.size();
    }GameModel.java
    package cardgame;
    import javafx.beans.binding.BooleanBinding;
    import javafx.beans.property.BooleanProperty;
    import javafx.beans.property.ReadOnlyBooleanProperty;
    import javafx.beans.property.SimpleBooleanProperty;
    import javafx.collections.FXCollections;
    import javafx.collections.ObservableList;
    public class GameModel {
         private ObservableList<Card> hand;
         private Deck deck;
         private BooleanProperty canDeal;
         public GameModel() {
              this.hand = FXCollections.observableArrayList();
              this.deck = Deck.newDeck().shuffle();
              this.canDeal = new SimpleBooleanProperty(this, "canDeal");
              canDeal.bind(new BooleanBinding() {
                        super.bind(hand);
                   @Override
                   protected boolean computeValue() {
                        return deck.size() > 0 && hand.size() < 5;
         public ObservableList<Card> getHand() {
              return hand;
         public ReadOnlyBooleanProperty canDealProperty() {
              return canDeal;
         public boolean canDeal() {
              return canDeal.get();
         public void deal() throws IllegalStateException {
              if (deck.size() <= 0) {
                   throw new IllegalStateException("No cards left to deal");
              if (hand.size() >= 5) {
                   throw new IllegalStateException("Hand is full");
              hand.add(deck.deal());
         public void playCard(Card card) throws IllegalStateException {
              if (hand.contains(card)) {
                   hand.remove(card);
              } else {
                   throw new IllegalStateException("Hand does not contain " + card);
    }The CardController is the controller for a CardView. It takes a reference to a Card and its initialize method initializes the view to display it (the view is just a simple label).
    CardController.java
    package cardgame;
    import javafx.fxml.FXML;
    import javafx.scene.control.Label;
    public class CardController {
         private final Card card;
         @FXML
         private Label label;
         public CardController(Card card) {
              this.card = card;
         public void initialize() {
              label.setText(String.format("%s%nof%n%s", card.getRank(),
                        card.getSuit()));
    }The HandController is the controller for the display of the hand. This is where most of the action happens. The trick here is that it requires a reference to a GameModel, which needs to be injected from somewhere, so we need a setModel(...) method, or something similar. I didn't want to assume the order of events: i.e. whether the model is injected before or after the initialize() method is invoked. To keep this flexibility, I used an ObjectProperty to wrap the model, and listen for changes to it. When the model is updated, I register a listener with the hand (exposed by the model). This listener in turn rebuilds the views of the cards when the hand changes. There's also a "deal" button, whose disabled state is managed by binding to a property in the model (using a neat trick from the Bindings class to allow the model value to be dynamic).
    HandController.java
    package cardgame;
    import java.io.IOException;
    import javafx.beans.binding.Bindings;
    import javafx.beans.property.ObjectProperty;
    import javafx.beans.property.SimpleObjectProperty;
    import javafx.beans.value.ChangeListener;
    import javafx.beans.value.ObservableValue;
    import javafx.collections.ListChangeListener;
    import javafx.event.EventHandler;
    import javafx.fxml.FXML;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Node;
    import javafx.scene.control.Button;
    import javafx.scene.input.MouseEvent;
    import javafx.scene.layout.Pane;
    public class HandController {
         private ObjectProperty<GameModel> model;
         @FXML
         private Pane container;
         @FXML
         private Button dealButton;
         public HandController() {
              this.model = new SimpleObjectProperty<GameModel>(this, "model", null);
              final ListChangeListener<Card> handListener = new ListChangeListener<Card>() {
                   @Override
                   public void onChanged(Change<? extends Card> change) {
                        container.getChildren().clear();
                        try {
                             for (Card card : model.get().getHand()) {
                                  container.getChildren().add(loadCardView(card));
                        } catch (IOException e) {
                             e.printStackTrace();
              model.addListener(new ChangeListener<GameModel>() {
                   @Override
                   public void changed(
                             ObservableValue<? extends GameModel> observable,
                             GameModel oldValue, GameModel newValue) {
                        if (oldValue != null) {
                             oldValue.getHand().removeListener(handListener);
                        if (newValue != null) {
                             newValue.getHand().addListener(handListener);
         public void setModel(GameModel model) {
              this.model.set(model);
         public void initialize() {
              dealButton.disableProperty().bind(
                        Bindings.selectBoolean(model, "canDeal").not());
         private Node loadCardView(final Card card) throws IOException {
              FXMLLoader loader = new FXMLLoader(getClass().getResource(
                        "CardView.fxml"));
              CardController controller = new CardController(card);
              loader.setController(controller);
              Node cardView = (Node) loader.load();
              cardView.setOnMouseClicked(new EventHandler<MouseEvent>() {
                   @Override
                   public void handle(MouseEvent event) {
                        if (event.getClickCount() == 2) {
                             model.get().playCard(card);
              return cardView;
         public void dealCard() {
              model.get().deal();
    }Here are the FXML files:
    CardView.fxml
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.layout.StackPane?>
    <?import javafx.scene.control.Label?>
    <?import java.lang.String?>
    <StackPane xmlns:fx="http://javafx.com/fxml" prefHeight="150" prefWidth="80" minWidth="80" maxWidth="80" minHeight="150" maxHeight="150">
         <Label fx:id="label" >
         </Label>
         <styleClass>
              <String fx:value="card"/>
         </styleClass>
    </StackPane>Hand.fxml
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.layout.FlowPane?>
    <?import javafx.scene.layout.BorderPane?>
    <?import javafx.scene.control.Button?>
    <?import javafx.scene.control.ScrollPane?>
    <?import java.lang.String?>
    <BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="cardgame.HandController" >
         <center>
              <FlowPane hgap="5" vgap="10" fx:id="container">
              </FlowPane>
         </center>
         <bottom>
              <Button text="Deal" onAction="#dealCard" fx:id="dealButton"/>
         </bottom>
    </BorderPane>The overall application is managed by a Game.fxml:
    <?xml version="1.0" encoding="UTF-8"?>
    <?import javafx.scene.layout.BorderPane?>
    <BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="cardgame.GameController">
         <center>
              <fx:include source="Hand.fxml" fx:id="hand" />
         </center>
    </BorderPane>with a GameController:
    package cardgame;
    import javafx.fxml.FXML;
    public class GameController {
         @FXML private HandController handController ;
         private GameModel model ;
         public GameController() {
              model = new GameModel();
         public void initialize() {
              handController.setModel(model);
    }Game.java is the main class:
    package cardgame;
    import java.io.IOException;
    import javafx.application.Application;
    import javafx.fxml.FXMLLoader;
    import javafx.scene.Parent;
    import javafx.scene.Scene;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    public class Game extends Application {
         @Override
         public void start(Stage primaryStage) throws IOException {
              Scene scene = new Scene(FXMLLoader.<Parent>load(getClass().getResource("Game.fxml")), 600, 400, Color.DARKGREEN);
              scene.getStylesheets().add(getClass().getResource("style.css").toExternalForm());
              primaryStage.setScene(scene);
              primaryStage.show();
         public static void main(String[] args) {
              launch(args);
    }and then a style sheet
    style.css:
    @CHARSET "US-ASCII";
    .card {
         -fx-background-color: white ;
         -fx-border-color: black ;
         -fx-border-radius: 5 ;
         -fx-border-style: solid ;
         -fx-padding: 5 ;
    .card .label {
         -fx-text-alignment: center ;
    }

  • Storage location selection for variable size item

    Hi All
    There is a BOM of finished good Material "XYZ" and there is a component "A" in the BOM. This Component A is a variable size item, its a metallic bar of length 4 meters.  In BOM XYZ, only 1.5 meters is consumed.
    Now when a production order is made for XYZ and the confirmation is done with movement type 261. All the materials are backflushed along with component A . The client's requirement is to transfer the remaining length of component A (i.e. 4 - 1.5 = 2.5 meters ) to a different storage location at the time of confirmation.
    Please let me know how is it possible.
    Thanks in Advance
    Rohit

    FULL STEPS:
    1.first do mb1b 311 mvmt transfer posting  for the components from raw-stor location to prod stor location. you can do for A
    2.  do GI for the components. for A for that final product . consume 1.5 so. the remaining component will be (3 ) there in the stor. location as per sap. (check in mmbe)
    3. then do mb1b 311   transfer posting for the A component to raw-stor location. from the prod stor location.
    or rever the  transfer posting mb1b 312.

  • Need suggestion for USB Bluetooth Adapter for HP Z230 Workstation

    I've just purchased an HP Z230 Workstation, with an I7 processor.  I need to equip it with Bluetooth capability so that I can connect the computer to an old Palm Tungsten T2. 
    There are gobs of USB 4.0 Bluetooth adapters / dongles on the market, but reading buyer's comments, they all seem to have some type of problem with compatibility or installation issues on something.
    Does anyone have a suggestion for a USB Bluetooth adapter that has worked well with the Z230?
    Thanks in advance for any help.
    Terry
    This question was solved.
    View Solution.

    I suggest joining the Enterprise Buisness forum and posting your query there.
    Your  HP Z230 Workstation is a business class HP product and not than a consumer class device. This is the HP Consumer support forum.
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • Need suggestion for new laptop

    Hi, everyone I'm needing suggestions. I had a touchsmart tx2z however after nearly 4 years it has bit the dust couldn't be saved after its last crash computer would turn on but screen would stay black and ome of the keys like the caps lock would flash. Computer guys say my motherboard has gone bad.  I'm looking for another computer now but would like one that is similar to the hp touchsmart but does not cost a lot of money.  

    Here is the current line-up of HP Touchscreen Laptops. Prices start at about $650 and go up from there. $650 sounds OK to my for a touchscreen laptop, but price is a subjective item. If these are too rich for you, you could always look at regular laptops.
    Please send KUDOs
    Frank
    {------------ Please click the "White Kudos" Thumbs Up to say THANKS for helping.
    Please click the "Accept As Solution" on my post, if my assistance has solved your issue. ------------V
    This is a user supported forum. I am a volunteer and I don't work for HP.
    HP 15t-j100 (on loan from HP)
    HP 13 Split x2 (on loan from HP)
    HP Slate8 Pro (on loan from HP)
    HP a1632x - Windows 7, 4GB RAM, AMD Radeon HD 6450
    HP p6130y - Windows 7, 8GB RAM, AMD Radeon HD 6450
    HP p6320y - Windows 7, 8GB RAM, NVIDIA GT 240
    HP p7-1026 - Windows 7, 6GB RAM, AMD Radeon HD 6450
    HP p6787c - Windows 7, 8GB RAM, NVIDIA GT 240

  • Need suggestion for choosing Java development enviroment

    Hi Evereyone,
    I am new to Java Desktop Application.I need help on choosing proper Java technologies and development tool.
    We have an existing CLIENT/SERVER based distributed control system, which was developed in C++(Server side) and VB(Client GUI).Now we are think of migrating the system to Java platform.
    Here is the outline:
    We want to create web based application that will run on windows and linux (linux on embedded PC).
    The application should be able to support 10 � 100 users at once accessing/editing database.
    We will also need to create a communication server that will run on web server P.C. that will communicate tcpip to field panels/log to db, as well as allow web screens to send/receive commands with field panels etc.
    Could any one give me some suggestion about it?
    I am thinking of Using J2SE 5.0, including RMI, JDBC and Swing for GUI. As for field panels, may choose J2ME.
    Thank you very much in advance.

    Thanks, zadok .
    Actually, I don't have the system requirements neither. All I know is the following outline:
    "We want to create web based application that will run on windows and linux (linux on embedded PC).
    The application should be able to support 10 � 100 users at once accessing/editing database.
    We will also need to create a communication server that will run on web server P.C. that will communicate tcpip to field panels/log to db, as well as allow web screens to send/receive commands with field panels etc."
    It is a interview question, which need me to do research and give some suggestions. What I want to know is to figure out what kind of Java technology is necessary for developing this system because I want to make sure I head to right direction.
    I know somehow it is hard to give suggestion based on this limited information.
    One more thing I was confusing is the server-side architecture.
    I need suggestion about sever side architecture:
    a. write a dedicated server-side program, which act
    as communication server to monitor and control field
    panel, also act as server-side applicaiton by using
    RMI to communicate with Client-side communication.
    b. choose a general web server architecture. Put
    everything in server side in Web Server, for example
    Tomcat AS container, implementing the Communication
    server as Web Service and the request from
    Client-side go to Web Server first, then dispatch to
    a proper web service.Why did you not include this information in the original question!
    Why don't you just use Tomcat?
    For your answer, "Why don't you just use Tomcat?", does it mean Tomcat without Web Service will be enough for this system development? Could you give me some detail about it?
    Thank you very much, zadok.

  • I need suggestions for an online trading application

    Hi,
    I am going to develop an online trading application. I have decided to use JAVA EE 5 and I have read "The Java(tm) EE 5 Tutorial". Because I am a (C++) programmer and new to Java, I need suggestions to start development.
    Here is summary of the system in my mind. There will be
    a database to store user's information and operations,
    a web client for creating and managing user accounts,
    a desktop application and web client for users for online trading and
    an application client for brokers for risk management.
    Here is a sample scenario for flow,
    - User wants to create an account
    - Company creates an account for user
    - user gets the prices and trades via application client (web or desktop)
    - system informs dealers and broker via their client platform
    - broker perform necessary operations.
    Java EE 5 Application model fits the system I am trying to develop but I feel I still need some guidance and there are a few things I couldn't figured out yet. For these reasons I want to develop a prove of concept system and this is the system in my mind.
    - A simple database
    user (user_id, user_login, user_password, user_name)
    stock (stok_id, stok_name)
    operation (op_id, user_id, stok_id, op_type, op_amount, op_value)
    - A price server
    will generate random prices and push new values to registered clients
    - A web client to create new users (for admin)
    - A web client to display operations of users (for user)
    - A desktop application and web client for operation entries (for users)
    displays prices coming from price servers, sends users trade requests
    - A desktop application client for informing admin about trades (for admin)
    when a user buys or sells something, this client notified (user buy/sell something)
    What do you offer for this sample system?
    Which is the best IDE?
    Which Application Server should I use (scalability and speed is critical)?
    Which Java EE APIs should I use?
    JSP or JSF?
    Will I need hibernate?
    And so on.. I need some points to start and go.
    Thanks for any help.
    Ahmet

    It wouldn't be an arbitrary track. However, maybe you could make an arbitrary track by dividing the track into segments. Each segment is either a straight line or an arc. These are easy to model the cars' behavior on, because you'll have a straightforward way to determine the direction the car should be facing, and the range to the left and right where the car can stray and still be on the track.

  • Need suggestions for concurrent reads while deleting all entities

    Hello,
    we need some suggestions for the following use case, as we cannot seem to find the correct transaction locking combination to meet our needs.
    We are using BDB JE 4.1.10, and the entityStore is transactional. In a nutshell, BDB JE is used as a Cache for specific data that is pulled and updated regularly from a source Oracle DB. The application that holds BDB is a realtimel app, and response time is critical.
    In order to avoid having to merge (Insert/update/delete) entities for some of the tables that are very static and small (a few hundred records that might change every day or so), we are trying to simply delete all records (with an EntityCursor loop, since there is no 'deleteAll' that we could find) and reinsert all data every 5 minutes, and then committing when the whole process is complete. This should always be very quick, but we are not immune to timeouts from the source Oracle DB, so the transaction can be long.
    Ideally, while the delete/insert is happening, we want any concurrent read operations to return the old data (before the delete). We have made a test that locks the updater thread between the 'delete all' and 'update all' methods, so that the delete cursor is closed, but the Tx is not yet commited. We have tried the following for our reader thread:
    1- If we get() a deleted entity with a LockMode.READ_UNCOMMITTED, we get a null entity back.
    2- If we get() a deleted entity with LockMode.READ_COMMITTED, we get a LockTimeoutException.
    We have also considered simply using truncate on the EntityStore, but this requires closing and reopening the DB, so this would not work for our need to always return a value, instantly.
    Any ideas, suggestions on how we could do this in a simple manner?
    Thanks,
    Max

    Hello Max,
    I understand the issue you're describing.
    I think the best performing solution by far is to load the new data into new databases while servicing reads from the old databases. When the load is complete, reads can be diverted to the new databases, and the old databases can then be removed.
    Unfortunately, this is easier to do with the base API than with the DPL, because the DPL is managing the underlying (base API level) databases for you.
    However, even using the DPL, this approach could be very straightforward if you happen to be keeping this data set (the one that needs to be reloaded) in a separate EntityStore, or you can change your application to do so. If so, you can create a new (empty) EntityStore with a different name and use this store for loading the new data. When the load is complete, divert reads to the new EntityStore object and remove all databases for the old EntityStore.
    If this is impractical, please explain, and I'll try to suggest a different solution. If you cannot use a separate EntityStore for this particular data set, then the solution may be more complex.
    --mark                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for

  • ICloud for multiple devices with different IDs

    I presently have a MacbookPro (10.7.2), iPhone (5.0.1), and an iPad (5.0.1) all on iCloud, linked by my former MobileMe me.com account, that is now my new iCloud ID. No problems with these three. What I would like to do (I think, read on...), however

  • Could not find Model while pointing to a custom Function Group

    Hello , I am on EP7.0 ERP05 NW04s and trying to modify ESS Address application  to point to a custom function group rather than the standard one . When I tried to do that by changing the mapping for the ReadInfotype I got certain compilation errors ,

  • Is the new macbook air fast enough to play 100 fps gopro video fluidly?

    Hello, I'm interested in the new macbook air 13. I often use a gopro hero 3 black edition, filming with 100 fps in 960p for slow motion. Is the new macbook air able to play these video fluidly by just pressing the space button in the finder menu. I k

  • Vista logs me off and stops music.. (home enterainment)

    I have my PC connected to my HDTV and Home Theater setup, I use iTunes for playing music through my setup. After a while Vista logs off my account and stops the music from playing. It doesn't do this if I use Windows Media Player(I rather not ) and i

  • Error loading Java Stored Procedure

    When I attempt to deploy a java stored procedure using JDeveloper I get the following error: "ORA-29545: badly formed class: User has attempted to load a class (TestingJava.Testerama) into a restricted package. Permission can be granted using dbms_ja