Hash table reallocation (rehashing)

Hello!
I use embedded Berkeley DB to store millions of small items (key ~ 16 byte, value ~ 16 byte). The exact number of items couldn't be known at the time of hash table allocation, so i push to set_h_nelem amount about 100 millions. After some period of time hash table becomes full and i need to rebuild (reallocate) it to avoid lacks in performance.
Does anyone know how to initiate manual hash table reallocation (to expand it) (C/C++ API is prefered)?

Hi,
Just go thro' this.
1. Types of internal tables
1.1 STANDARD table
Key access to a standard table uses a linear search. This means that the time required for a search is in linear relation to the number of table entries.
You should use index operations to access standard tables.
1.2 SORTED table
Defines the table as one that is always saved correctly sorted.
Key access to a sorted table uses a binary key. If the key is not unique, the system takes the entry with the lowest index. The runtime required for key access is logarithmically related to the number of table entries.
1.3 HASHED table
Defines the table as one that is managed with an internal hash procedure
You can only access a hashed table using the generic key operations or other generic operations ( SORT, LOOP, and so on). Explicit or implicit index operations (such as LOOP ... FROM oe INSERT itab within a LOOP) are not allowed.
1.4 INDEX table
A table that can be accessed using an index.
Index table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type INDEX.
Standard tables and sorted tables are index tables.
1.5 ANY table
Any table is only used to specify the type of generic parameters in a FORM or FUNCTION. That means that you can't create a table of type ANY.
Standard, sorted and hashed  tables belongs to ANY tables.

Similar Messages

  • Hash table order

    I only need to put 7 key-values pairs in a hashtable. i've used the default initial capacity and load factors ie 11 and 0.75, but when debugging i find that the hash table calls rehash(), which changes the order in which i enter these key-value pairs. I've tried changing the initial capacity and load factors but still get a rehash at some point in time. I've also tried HashMap with the same result. Is there any other Map implementation that can guarantee results in the order in which i enter them without changing them somewhere along the line, cos i really need them in the order i enter them.
    Thanks guys for ur help in advance.

    I only need to put 7 key-values pairs in a
    hashtable. i've used the default initial capacity and
    load factors ie 11 and 0.75, but when debugging i
    find that the hash table calls rehash(), which
    changes the order in which i enter these key-value
    pairs. I've tried changing the initial capacity and
    load factors but still get a rehash at some point in
    time. I've also tried HashMap with the same result.
    Is there any other Map implementation that can
    guarantee results in the order in which i enter them
    without changing them somewhere along the line, cos i
    really need them in the order i enter them.
    Thanks guys for ur help in advance.would this do ?
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedHashMap.html

  • Displaying graphical representation of data in hash tables as bar chart?

    I want to be able to display results in my hash table as a bar chart i don't know how to do it could someone help me I've looked through tutorials couldn't find any information that actually helped.
    In my program it doesnt allow matching the capital and small letters
    so for instance if I already have Mike it allows for me to input mike in again so there are 2 Mikes.
    I also want to do a simple user interface the tutorial for it is not simple to understand could any one tell me how to create a simple user interface like putting a button into a place wher i want it to be.
    im not asking anyone to do it for me i just want people to show me how to do it
    thank you
    Edited by: Tek_Hedef on Dec 1, 2007 4:30 AM

    Thanks for the ideas pal but I did have a go at it but my bit of code is making it crash but i removed it now so here's what I have so far
    import java.io.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    class StudentDetails extends JFrame implements ActionListener
         private JTextField StudentNameTxt, StudentMarkTxt;
        private JButton DeleteStudentDetailsBtn, DisplayAllStudentsBtn, SearchStudentBtn, FailedStudentsBtn, PassedStudentsBtn, DistinctionStudentsBtn, AddStudentDetailsBtn, ExitBtn;
        private JPanel DisplayStudentDetailsPnl;
        private JLabel StudentNameLbl, StudentMarkLbl;
        private JTextArea DisplayResultsTxt;
        private Hashtable StudentDetailsTbl;
        private String StudentName, StudentMark;
        public static void main(String[] args)
            StudentDetails frame = new StudentDetails();
             frame.setSize(600,600);
            frame.createGUI();
            frame.setVisible(true);
        public void display(JPanel DisplayStudentDetailsPnl)
            Graphics paper = DisplayStudentDetailsPnl.getGraphics();
            paper.setColor(Color.white);
            paper.fillRect(0, 0, 500, 500);
            paper.setColor(new Color((int)(Math.random()*255),(int)(Math.random()*255),(int)(Math.random()*255) ));
        private void createGUI()
            setDefaultCloseOperation(EXIT_ON_CLOSE);
            Container window = getContentPane();
            window.setLayout(new FlowLayout());
            StudentDetailsTbl = new Hashtable();
            StudentNameLbl = new JLabel("Student Name");
            window.add(StudentNameLbl);
            StudentNameTxt = new JTextField(15);
            window.add(StudentNameTxt);
            StudentMarkLbl = new JLabel("Student Mark");
            window.add(StudentMarkLbl);
            StudentMarkTxt = new JTextField(3);
            window.add(StudentMarkTxt);
            AddStudentDetailsBtn = new JButton("Add Student and Mark");
            window.add(AddStudentDetailsBtn);
            AddStudentDetailsBtn.addActionListener(this);
            DeleteStudentDetailsBtn = new JButton("Delete Student");
            window.add(DeleteStudentDetailsBtn);
            DeleteStudentDetailsBtn.addActionListener(this);
            DisplayAllStudentsBtn = new JButton("Display all Students and Marks");
            window.add(DisplayAllStudentsBtn);
            DisplayAllStudentsBtn.addActionListener(this);
            SearchStudentBtn = new JButton("Search Student");
            window.add(SearchStudentBtn);
            SearchStudentBtn.addActionListener(this);
            FailedStudentsBtn = new JButton("Students which Failed");
            window.add(FailedStudentsBtn);
            FailedStudentsBtn.addActionListener(this);
            PassedStudentsBtn = new JButton("Students which Passed");
            window.add(PassedStudentsBtn);
            PassedStudentsBtn.addActionListener(this);
            DistinctionStudentsBtn = new JButton("Students with Distinction");
            window.add(DistinctionStudentsBtn);
            DistinctionStudentsBtn.addActionListener(this);
            ExitBtn = new JButton("Exit");
            window.add(ExitBtn);
            ExitBtn.addActionListener(this);
            DisplayResultsTxt = new JTextArea();
            DisplayResultsTxt.setPreferredSize(new Dimension(200, 200));
            DisplayResultsTxt.setBackground(Color.white);
            window.add(DisplayResultsTxt);
            DisplayResultsTxt.enable(false);
        public void actionPerformed (ActionEvent e)
             if (e.getSource()== AddStudentDetailsBtn)
                  StudentName = StudentNameTxt.getText();
                   StudentMark = StudentMarkTxt.getText();
                  DisplayResultsTxt.setText("");
                  StudentDetailsTbl.put(StudentName, StudentMark);
                Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                String[] keys = (String[]) StudentDetailsTbl.keySet().toArray(new String[0]);       
                Arrays.sort(keys); 
                    for (String key : keys)
                         DisplayResultsTxt.append(key + " : " + StudentDetailsTbl.get(key)+ "\n");
                    StudentNameTxt.setText("");
                    StudentMarkTxt.setText("");
             if (e.getSource() == DeleteStudentDetailsBtn )
             if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
                  DisplayResultsTxt.setText("");     
                  String txt = StudentNameTxt.getText();
                Enumeration enumStudentName = StudentDetailsTbl.keys()  ;                   
                    String currentelement = (String)enumStudentName.nextElement();
                     StudentDetailsTbl.remove(txt);
                     DisplayResultsTxt.append(txt + " has been deleted");  
            if (e.getSource() == SearchStudentBtn)
            if (StudentDetailsTbl.containsKey(StudentNameTxt.getText().trim()))
                 String txt = StudentNameTxt.getText();
                 String result;
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                   while (enumStudentName.hasMoreElements())
                        String currentelement = (String)enumStudentName.nextElement();
                    result = (StudentDetailsTbl.get(currentelement).toString());
                        if (txt.equals(currentelement))
                             DisplayResultsTxt.append(currentelement + " " + result);
                        else JOptionPane.showMessageDialog(null, "Student Name could not be identified");
            if (e.getSource() == DisplayAllStudentsBtn)
                  DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                DisplayResultsTxt.append(enumStudentName.nextElement()+ " " + enumStudentMark.nextElement()+ "\n");
            if (e.getSource() == PassedStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark >=40)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
            if (e.getSource() == FailedStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark <40)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
            if (e.getSource() == DistinctionStudentsBtn)
                 DisplayResultsTxt.setText("");
                 Enumeration enumStudentName = StudentDetailsTbl.keys();
                Enumeration enumStudentMark = StudentDetailsTbl.elements();
                while (enumStudentName.hasMoreElements())
                     int Mark = Integer.parseInt((String)enumStudentMark.nextElement());
                     String Name = (String)enumStudentName.nextElement();
                     if (Mark >=75)
                          DisplayResultsTxt.append(Name + " " + Mark + "\n");
    }

  • How about use partial key to loop at a hashed table?

    Such as I want to loop a Internal table of BSID according to BKPF.
    data itab_bsid type hashed table of BSID with unique key bukrs belnr gjahr buzid.
    Loop at itab_bsid where bukrs = wa_bkpf-bukrs
                              and    belnr  = wa_bkpf-belnr
                              and    gjahr  = wa_bkpf-gjahr.
    endloop.
    I know if you use all key to access this hashed table ,it is certainly quick, and my question is when i use partial key of this internal hashed table to loop it, how about its performance.
    Another question is in this case(BSID have many many record) , Sorted table and Hashed table , Which is better in performance.

    You can't cast b/w data reference which l_tax is and object reference which l_o_tax_code is.
    osref is a generic object type and you store a reference to some object in it, right? So the question is: what kind of object you store there? Please note - this must be an object reference , not data reference .
    i.e
    "here goes some class
    class zcl_spfli definition.
    endclass.
    class zcl_spfli implementation.
    endclass.
    "here is an OBJECT REFERENCE for it, (so I refer to a class) i.e persistent object to table SPFLI
    data oref_spfli type ref to zcl_spfli.
    "but here I have a DATA REFERENCE (so I refer to some data object) i.e DDIC structure SPFLI
    data dref_spfli type ref to spfli.
    So my OSREF can hold only oref_spfli but it not intended for dref_spfli . That's why you get this syntax error. Once you have stored reference to zcl_spfli in osref then you will be able to dereference it and access this object's attributes.
    data: osref type osref.
    create object osref_spfli.
    osref = osref_spfli.
    "now osref holds reference to object, you can deference it
    oref_spfli ?= osref.
    osref_spfli->some_attribute = ....
    OSREFTAB is just a table whose line is of type OSREF (so can hold multiple object references - one in each line).
    Regards
    Marcin

  • How to get values from Hash Table

    Hi all,
    I have a hash table "lovResults" craeted with following code -
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM);
    Hashtable lovResults = pageContext.getLovResultsFromSession(lovInputSourceId);
    values which I can see through SOP are - ******Value of lovResults is{roleid=1000, domainFV=CREATIVE, Role=Account Director}
    How can I get the domain value "domainFV=CREATIVE" from hash table in a variable because I have to set this vaue in another field.
    Please help me ASAP
    Thanks
    Amit

    Hi Amit ,
    Since you are successfully printing the values using sop's , please try this code
    Capture the value in controller .
    if(oapagecontext.getParameter("domainFV") != null)
    String formvalue= oapagecontext.getParameter("domainFV") // ensure hashtable id is correct
    Keerthi
    Edited by: keerthioaf on Nov 26, 2012 8:46 PM

  • How to use one hash table inside another hash table

    Hi everyone,
    Any example of hash table inside another hash table.
    Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
    Thanks,
    kanty.

    Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
    Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
    Edited by: sabre150 on Jul 2, 2010 10:11 PM
    Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain.

  • How do I use Get-ADUser to get just the Managers attribute? And then get rid of duplicates in my array/hash table?

    Hello,
          I am trying to just get the Managers of my users in Active Directory. I have gotten it down to the user and their manager, but I don't need the user. Here is my code so far:
    Get-ADUser-filter*-searchbase"OU=REDACTED,
    OU=Enterprise Users, DC=REDACTED, DC=REDACTED"-PropertiesManager|SelectName,@{N='Manager';E={(Get-ADUser$_.Manager).Name}}
    |export-csvc:\managers.csv-append 
    Also, I need to get rid of the duplicate values in my hash table. I tried playing around with -sort unique, but couldn't find a place it would work. Any help would be awesome.
    Thanks,
    Matt

    I would caution that, although it is not likely, managers can also be contact, group, or computer objects. If this is possible in your situation, use Get-ADObject in place of Get-ADUser inside the curly braces.
    Also, if you only want users that have a manager assigned, you can use -LDAPFilter "(manager=*)" in the first Get-ADUser.
    Finally, if you want all users that have been assigned the manager for at least one user, you can use:
    Get-ADUser
    -LDAPFilter "(directReports=*)" |
    Select @{N='Manager';E={ (Get-ADUser
    $_.sAMAccountName).Name }}
    -Unique | Sort Manager |
    Export-Csv .\managerList.csv -NoTypeInformation
    This works because when you assign the manager attribute of a user, this assigns the user to the directReports attribute of the manager. The directReports atttribute is multi-valued (an array in essence).
    Again, if managers can be groups or some other class of object (not likely), then use Get-ADObect throughout and identify by distinguishedName instead of sAMAccountName (since contacts don't have sAMAccountName).
    Richard Mueller - MVP Directory Services

  • Question on the use of hash tables

    I have created a extract program that extract data from the bkpf and the bseg tables. I am extracting a lot of data which is needed for the auditors and depending on the selection criteria (company code and date range), this extract takes quite awhile to run. I had heard from another developer working in a different project that hash tables are used when dealing with a lot of data. I am not that familiar with hash tables and was wondering if the hash table approach would help with the processing time of my process.
    thanks in advance for the help

    this is only part of the code but this is the part when the selects and the writing of the file are. let me know if I have to post the entire program.
    FORM f_get_data .
      SELECT * INTO TABLE wt_bkpf
        FROM  bkpf
        WHERE bukrs IN s_bukrs
        AND   belnr IN s_belnr
        AND   blart IN s_blart
        AND   bldat IN s_bldat
        AND   budat IN s_budat
        AND   bstat IN s_bstat.
      IF sy-dbcnt IS INITIAL.
        MESSAGE i208(00) WITH text-001.
        STOP.
      ENDIF.
      SORT wt_bkpf BY bukrs belnr gjahr.
      SELECT mandt bukrs belnr buzei buzid bschl koart shkzg dmbtr
             wrbtr pswbt sgtxt kostl saknr hkont dmbe2
        INTO TABLE wt_bseg
        FROM  bseg
        FOR ALL ENTRIES IN wt_bkpf
        WHERE bukrs EQ wt_bkpf-bukrs
        AND   belnr EQ wt_bkpf-belnr.
    ENDFORM.                    " f_get_data
    FORM f_split_data .
      DATA wlv_index LIKE sy-tabix.
      DESCRIBE TABLE wt_bkpf LINES wv_index.
      wlv_index     = 0.
      wv_item_index = 1.
      WHILE wlv_index LT wv_index.
        ADD 1 TO wlv_index.
        CLEAR wt_bkpf.
        READ TABLE wt_bkpf INDEX wlv_index.
        IF NOT sy-subrc IS INITIAL. EXIT. ENDIF.
        LOOP AT wt_bseg FROM wv_item_index
          WHERE bukrs EQ wt_bkpf-bukrs
          AND   belnr EQ wt_bkpf-belnr.
          wv_item_index = sy-tabix + 1.
          move wt_bkpf-bukrs to ws_bseg_hold-bukrs.
          move wt_bkpf-belnr to ws_bseg_hold-belnr.
          move wt_bkpf-gjahr to ws_bseg_hold-gjahr.
          move wt_bkpf-blart to ws_bseg_hold-blart.
          move wt_bkpf-bldat to ws_bseg_hold-bldat.
          move wt_bkpf-budat to ws_bseg_hold-budat.
          move wt_bkpf-monat to ws_bseg_hold-monat.
          move wt_bkpf-cpudt to ws_bseg_hold-cpudt.
          move wt_bkpf-cputm to ws_bseg_hold-cputm.
          move wt_bkpf-usnam to ws_bseg_hold-usnam.
          move wt_bkpf-tcode to ws_bseg_hold-tcode.
          move wt_bkpf-xblnr to ws_bseg_hold-xblnr.
          move wt_bkpf-bktxt to ws_bseg_hold-bktxt.
          move wt_bkpf-waers to ws_bseg_hold-waers.
          move wt_bkpf-bstat to ws_bseg_hold-bstat.
          move wt_bkpf-ausbk to ws_bseg_hold-ausbk.
          move wt_bseg-mandt to ws_bseg_hold-mandt.
          move wt_bseg-buzei to ws_bseg_hold-buzei.
          move wt_bseg-buzid to ws_bseg_hold-buzid.
          move wt_bseg-bschl to ws_bseg_hold-bschl.
          move wt_bseg-koart to ws_bseg_hold-koart.
          move wt_bseg-shkzg to ws_bseg_hold-shkzg.
          move wt_bseg-dmbtr to ws_bseg_hold-dmbtr.
          move wt_bseg-wrbtr to ws_bseg_hold-wrbtr.
          move wt_bseg-pswbt to ws_bseg_hold-pswbt.
          move wt_bseg-sgtxt to ws_bseg_hold-sgtxt.
          move wt_bseg-kostl to ws_bseg_hold-kostl.
          move wt_bseg-saknr to ws_bseg_hold-saknr.
          move wt_bseg-hkont to ws_bseg_hold-hkont.
          move wt_bseg-dmbe2 to ws_bseg_hold-dmbe2.
          APPEND ws_bseg_hold TO wt_bseg_output.
        ENDLOOP.
      ENDWHILE.
    ENDFORM.                    " f_split_data

  • Question about comparing an array of names to a hash table

    I'm still learning Powershell but feel like I have the basics now. I have a new project I'm working on and want some input as the best way to do this:
    The Problem:
    Let's say you have a list of several hundred video game titles and the dollar value of each in a text or two column CSV file.
    The example CSV file looks likes this:
    Game, Price
    Metroid, $15.00
    The Legend of Zelda!, $12.00
    Mike Tyson's Punch-Out!, $18.00
    Super Mario Bros., $16.00
    Kung Fu, $7.00
    You have another list of just the video game titles, this most likely is just a text file with each title listed on its own line.
    The example text file looks like this:
    Kung Fu
    Metroid
    Mike Tysons Punch-Out
    Legend of Zelda
    What I think would happen in the Script:
    Use import-csv and create a hash table that will contain a key = Title and the value = the price.
    Use import-csv and create an array for the title names.
    Foreach loop through each Game Title and match the value against the Hash Table, if there's a match found, put that into another array that will later add all prices of each item and give you a total sum.
    The challenge:
    So far when I try and do one line examples of comparing names against the hash table it seems to only work with exact name matches. In the above example I've purposely made the game titles slightly different because in the real world people just write things
    differently.
    With that said, I've tried using the following single line to match things up and it only seems to work if the values match exactly.
    $hash_table.ContainsKey("Game Title")
    Is there a regex I should use to change the input of the game titles before creating the hash table or doing the compare? Is there another matching operator that is better and matching with String values that have slightly different grammar. An example would
    be the game "The Legend of Zelda". Sometimes people just put "Legend of Zelda", that's close but not exact. I think using a regex to remove extra spaces and symbols would work, but what about for matching of words or letters??
    Any ideas would be very helpful and thanks!

    There's no pat answer for this.
    You can create an array from the hash table keys:
    $hashtable = @{"The Legend of Zelda" = 15.00}
    $titles = $hashtable.getenumerator() | select -ExpandProperty Name
    And then test that using a wildcard match:
    $titles -like "*Game Title*"
    and see if it returns just one match.  If it does then use that match to do your lookup in the hash table.  If it returns 0, or more than one match then you need to check the spelling or qualify the title search some more.
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • Hash Table Infrastructure ran out of memory Issue

    I am getting ORA-32690 : Hash Table Infrastructure ran out of memory error, while executing an Informatica mapping using Oracle Database ( Test Environment)
    The partition creation is as shown below.
    TABLESPACE MAIN_LARGE_DATA1
    PARTITION BY LIST (MKTCD)
    PARTITION AAM VALUES ('AAM')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION AHT VALUES ('AHT')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION GIM VALUES ('GIM')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION CNS VALUES ('CNS')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION AOBE VALUES ('AOBE')
    TABLESPACE MAIN_LARGE_DATA1,
    PARTITION DBM VALUES ('DBM')
    TABLESPACE MAIN_LARGE_DATA1
    Could you please provide me with a solution to this problem asap?

    SQL statement and execution plan? Is there a server-side trace file created for the session?
    From the brief description, it sounds like bug 6471770. See Metalink for details. The workaround for this particular bug is to either disable hash group-by, by setting +"_gby_hash_aggregation_enabled"+ to FALSE (using an ALTER SESSION statement . Or by using a NO_USE_HASH_AGGREGATION hint.
    Suggest you research this problem on Metalink (aka MyOracleSupport at https://support.oracle.com)

  • Hash tables in combination with data references to the line type.

    I'm having an issue with hash tables - in combination with reference variables.
    Consider the following:  (Which is part of a class)  -  it attempts to see if a particular id exists in a table; if not add it; if yes change it.   
      types: BEGIN OF TY_MEASUREMENT,
               perfid      TYPE zgz_perf_metric_id,
               rtime       TYPE zgz_perf_runtime,
               execount    TYPE zgz_perf_execount,
               last_start  TYPE timestampl,
             END OF TY_MEASUREMENT.
    METHOD START.
      DATA:  ls_measurement TYPE REF TO ty_measurement.
      READ TABLE gt_measurements WITH TABLE KEY perfid = i_perfid reference into ls_measurement.
      if sy-subrc <> 0.
        "Didn't find it.
        create data ls_measurement.
        ls_measurement->perfid = i_perfid.
        insert ls_measurement->* into gt_measurements.
      endif.
      GET TIME STAMP FIELD ls_measurements-last_start.
      ls_measurement->execount = ls_measurement->execount + 1.
    ENDMETHOD.
    I get compile errors on the insert statement - either "You cannot use explicit index operations on tables with types HASHED TABLE" or "ANY TABLE".      It is possible that.
    If I don't dereference the type then I get the error  LS_MEASUREMENT cannot be converted to the line type of GT_MEASUREMENTS.
    I'm not looking to solve this with a combination of references and work ares - want a reference solution.   
    Thanks!
    _Ryan
    Moderator message - Moved to the correct forum
    Edited by: Rob Burbank on Apr 22, 2010 4:43 PM

    I think it might work when you change it for
    insert ls_measurement->* into TABLE gt_measurements.
    For hashed table a new line here will be inserted according to given table key.
    Regards
    Marcin

  • WPF UI running in seperate runspace - able to set/get controls via synchronized hash table, but referencing the control via the hash table from within an event handler causes both runspaces to hang.

    I am trying to build a proof of concept where a WPF form is hosted in a seperate runspace and updates are handled from the primary shell/runspace. I have had some success thanks to a great article by Boe Prox, but I am having an issue I wanted to open up
    to see if anyone had a suggestion.
    My goals are as follows:
    1.) Set control properties from the primary runspace (Completed)
    2.) Get control properties from the primary runspace (Completed)
    3.) Respond to WPF form events in the UI runspace from the primary runspace (Kind of broken).
    I have the ability to read/write values to the form, but I am having difficulty with events. Specifically, I can fire and handle events, but the minute I try to reference the $SyncHash from within the event it appears to cause a blocking condition hanging both
    runspaces. As a result, I am unable to update the form based on an event being fired by a control.
    In the example below, the form is loaded and the following steps occur:
    1.) Update-Combobox is called and it populates the combobox with a list of service names and selects the first item.
    2.) update-textbox is called and sets the Text property of the textbox.
    3.) The Text value of the textbox is read by the function read-textbox and output using write-host.
    4.) An event handle is registered for the SelectionChanged event for the combobox to call the update-textbox function used earlier.
    5.) If you change the selection on the combobox, the shell and UI hangs as soon as $SyncHash is referenced. I suspect this is causing some sort of blocking condition from multiple threads trying to access the synchronized nature of the hash table, but I am
    unsure as to why / how to work around it. If you comment out the line "$SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})" within update-textbox the event handler will execute/complete.
    $UI_JobScript =
    try{
    Function New-Form ([XML]$XAML_Form){
    $XML_Node_Reader=(New-Object System.Xml.XmlNodeReader $XAML_Form)
    [Windows.Markup.XamlReader]::Load($XML_Node_Reader)
    try{
    Add-Type –AssemblyName PresentationFramework
    Add-Type –AssemblyName PresentationCore
    Add-Type –AssemblyName WindowsBase
    catch{
    Throw "Unable to load the requisite Windows Presentation Foundation assemblies. Please verify that the .NET Framework 3.5 Service Pack 1 or later is installed on this system."
    $Form = New-Form -XAML_Form $SyncHash.XAML_Form
    $SyncHash.Form = $Form
    $SyncHash.CMB_Services = $SyncHash.Form.FindName("CMB_Services")
    $SyncHash.TXT_Output = $SyncHash.Form.FindName("TXT_Output")
    $SyncHash.Form.ShowDialog() | Out-Null
    $SyncHash.Error = $Error
    catch{
    write-host $_.Exception.Message
    #End UI_JobScript
    #Begin Main
    add-type -AssemblyName WindowsBase
    [XML]$XAML_Form = @"
    <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Window.Resources>
    <DataTemplate x:Key="DTMPL_Name">
    <TextBlock Text="{Binding Path=Name}" />
    </DataTemplate>
    </Window.Resources>
    <DockPanel LastChildFill="True">
    <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
    <Label Name="LBL_Services" Content="Services:" />
    <ComboBox Name="CMB_Services" ItemTemplate="{StaticResource DTMPL_Name}"/>
    </StackPanel>
    <TextBox Name="TXT_Output"/>
    </DockPanel>
    </Window>
    $SyncHash = [hashtable]::Synchronized(@{})
    $SyncHash.Add("XAML_Form",$XAML_Form)
    $SyncHash.Add("InitialScript", $InitialScript)
    $Normal = [System.Windows.Threading.DispatcherPriority]::Normal
    $UI_Runspace =[RunspaceFactory]::CreateRunspace()
    $UI_Runspace.ApartmentState = [System.Threading.ApartmentState]::STA
    $UI_Runspace.ThreadOptions = [System.Management.Automation.Runspaces.PSThreadOptions]::ReuseThread
    $UI_Runspace.Open()
    $UI_Runspace.SessionStateProxy.SetVariable("SyncHash",$SyncHash)
    $UI_Pipeline = [PowerShell]::Create()
    $UI_Pipeline.Runspace=$UI_Runspace
    $UI_Pipeline.AddScript($UI_JobScript) | out-Null
    $Job = $UI_Pipeline.BeginInvoke()
    $SyncHash.ServiceList = get-service | select name, status | Sort-Object -Property Name
    Function Update-Combobox{
    write-host "`nBegin Update-Combobox [$(get-date)]"
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.ItemsSource = $SyncHash.ServiceList})
    $SyncHash.CMB_Services.Dispatcher.Invoke($Normal,[action]{$SyncHash.CMB_Services.SelectedIndex = 0})
    write-host "`End Update-Combobox [$(get-date)]"
    Function Update-Textbox([string]$Value){
    write-host "`nBegin Update-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke("Send",[action]{$SyncHash.TXT_Output.Text = $Value})
    write-host "End Update-Textbox [$(get-date)]"
    Function Read-Textbox(){
    write-host "`nBegin Read-Textbox [$(get-date)]"
    $SyncHash.TXT_Output.Dispatcher.Invoke($Normal,[action]{$Global:Return = $SyncHash.TXT_Output.Text})
    $Global:Return
    remove-variable -Name Return -scope Global
    write-host "End Read-Textbox [$(get-date)]"
    #Give the form some time to load in the other runspace
    $MaxWaitCycles = 5
    while (($SyncHash.Form.IsInitialized -eq $Null)-and ($MaxWaitCycles -gt 0)){
    Start-Sleep -Milliseconds 200
    $MaxWaitCycles--
    Update-ComboBox
    Update-Textbox -Value $("Initial Load: $(get-date)")
    Write-Host "Value Read From Textbox: $(Read-TextBox)"
    Register-ObjectEvent -InputObject $SyncHash.CMB_Services -EventName SelectionChanged -SourceIdentifier "CMB_Services.SelectionChanged" -action {Update-Textbox -Value $("From Selection Changed Event: $(get-date)")}

    Thanks again for the responses. This may not be possible, but I thought I would throw it out there. I appreciate your help in looking into this.
    To clarify the "Respond to control events in the main runspace"... I'm would like to have an event generated by a form object in the UI runspace (ex: combo box selectionchanged event) trigger a delegate within the main runspace and have that delegate in
    the main runspace update the form in the UI runspace.
    ex:
    1.) User changes selection on combo box generating form event
    2.) Event calls delegate (which I have gotten to work)
    3.) Delegate does some basic processing (works)
    4.) Delegate attempts to update form in UI runspace (hangs)
    As to the delegates / which runspace they are running in. I see the $synchash variable if I run get-var within a delegate, but I do not see the $Form variable so I am assuming that they are in the main runspace. Do you agree with that assumption?

  • Inserting records in the ABAP exit function (hashed table XTH_DATA)

    Hi all,
    I want to add records in the logic of an ABAP exit function. Due table XTH_DATA being a hashed table the normal insert or append is not possible.
    My logic MUST move the data to a temporary table (ITAB) where the logic is executed (modifying KYF values and creating new records.
    In order to quickly get to a result I have solved the problem in an awful way through hardcoding the structure of ITAB to be the same as XTH_DATA is in this specific case.
    I would like to know if someone has an exmaple of a nice way to dynamically create an ITAB with the structure of XTH_DATA?
    At the end it should be possible to do: XTH_DATA[] = itab[].
    Greetings,
    Martin

    Hi Martin,
    the only way I know is to solve this problem with sort of pointers, field symbols. Roughly spoken the idea is you lookup the structure of xth_data in table dd03l. you define an internal table of type any. you loop around your xth_data table and assign the value of each column of xth_table to your internal table. then you do your your adding. Hopefully then you can simply assign xth_data to your itab.
    regards,
    Jürgen

  • How  to Implement a Chained Hash Table with Linked Lists

    I'm making a migration from C/C++ to Java, and my task is to implement a Chained Hash Table with a Linked List. My problem is to put the strings(in this case names) hashed by the table using de Division Metod (H(k)= k mod N) in to a Linked list that is handling the colisions. My table has an interface implemented(public boolean insert(), public boolean findItem(), public void remove()). Any Help is needed. Thanks for everyone in advance.

    OK. you have your hash table. What you want it to do is keep key/value pairs in linked lists, so that when there is a collision, you add the key/value pair to the linked list rather than searching for free space on the table.
    This means that whenever you add an item, you hash it out, check to see if there is already a linked list and if not, create one and put it in that slot. Then in either case you add the key/value pair to the linked list if the key is not already on the linked list. If it is there you have to decide whether your requirements are to give an error or allow duplicate keys or just keep or modify one or the other (old/new).
    When you are searching for a key, you hash it out once again and check to see if there is a linked list at that slot. If there is one, look for the key and if it's there, return it and if not, or if there was no linked list at that slot, return an error.
    You aren't clear on whether you can simply use the provided linked-list implementations in the Java Collections or whether you have to cobble the linked list yourself. In any case, it's up to you.
    Is this what you're asking?
    Doug

  • How  Hash tables can be used  in PI mapping

    Hi Experts,
    I'm don't have any idea how we store the values in hash tables and how to implement them in mapping.
    In my scenario I have two fields matnum and quantity.if matnum is not null ,then we have to check whether the matnum exists in hash table and also check whether the hash table is empty or not.
    How we can do this in graphical message mapping? 
    how to store the variable matnum in a table?
    If global variables are used, how to implement in mapping.how we call the keys from hash table ?

    Divya,
    We have a similiar requirement for getting different values. Below param1 may you be matnum,param2 is quantity
    What you need to do is first declare global varaible(A), fill hash table as below(B) and retrieve(C) based on index. You can tweak code based on your requirement
    (A) Declare global variable(last icon in message mapping tool bar)
         String globlalString[] = new String[10];
    (B) Fill Hash Table
    import java.util.Hashtable;
    public void saveparam1(String[] param1,String[] param2,ResultList result,Container container){
    Hashtable htparam1 = new Hashtable();
    int Indx = 0;
    for (int i = 0 ;i < param1.length ; i++) {
      String strparam1 = param1<i>.trim();
      if (strparam1.length() > 0) {
        Object obj = htparam1.get(strparam1);
        if (obj == null){
          globlalString[Indx++] = strparam1 ;
          htparam1.put(strparam1,strparam1);
    if (Indx < globalString.length) {
      for (int i = 0;  i < param2.length ; i++) {
        String strparam2 = param2<i>.trim();
        if (strparam2.length() > 0) {
          Object obj = htparam1.get(strparam2);
          if (obj == null){
            globalString[Indx++] = strparam2 ;
            htparam1.put(strparam2,strparam2);
    result.addValue(globalString[0]); // for first value
    (C) for subsequent reading/accessing
    //pass constant whatever number is required to this function
    String retValue = "";
      int indx = Integer.parseInt(index);
      indx = indx - 1;
      if ((indx >= 0) && (indx < globalString.length)){
       retValue = globalString[indx];
    return retValue;
    Hope this helps!

Maybe you are looking for

  • HP Color LaserJet 4600 PCL6 Windows 7 - 64bit

    I can not find drivers for HP Color LaserJet 4600 PCL6. I'm running Windows 7 - 64bit. Why does this always have to be so difficult?

  • Problems with Flash in Win8.1/IE11

    I recently upgraded my Windows 8 laptop to Windows 8.1, and I am running the latest version of Internet Explorer (IE11) -- but everytime I try to load Flash content, it tell me Flash is not installed or needs updating. I know it is installed and it i

  • Ntp refuses to sync with error "Can't assign requested address"

    I'm attempting to use ntp to sync to several different time servers, including hte apple server and those in the ntp.org server pool. In all cases, I cannot sync correctly, with many system log and consol error messages of the form: ntpd[5123]: sendt

  • Repeating Calender

    I just downloaded ios 7 on my iPad, however the calendar is messed up, the current week just repeats itself over and over again.  Any suggestions?

  • DBA Tasks - Industry standard guidelines

    Hey : As a DBA what are the recommended tasks that we should be doing regularly? - Daily tasks - Weekly tasks - Sanitary checks frequency - Must have documented reports - What else?? I am looking at putting a system in place for the team. Any industr