The table of hash of the dates

Hello.  I have a table of hash on the dates and phone numbers (string/integer).  I need a loop through the hashtable and get the sum of the values for all the keys that fall between 2 dates.  Not sure how I'm going to address the issue.  What is an effective way?  I think something like what follows however not sure it's the right approach...

Keys enumeration = theHashTable.keys ();

Elements of the enumeration = theHashTable.elements ();

Key of type string;

Integer value;

{while (Keys.hasMoreElements ())}

key = (String) keys.nextElement ();

value = (Integer) elements.nextElement ();

somewhere / somehow thrown string date as long to compare/verify if this key is between a range of dates and, if so summarize values

}

Any suggestions on an efficient way to achieve this?

For me, this is not a very large number and thus probably justifies no complications.

I would design your data structure to optimize the use of the most active and then do all the rest by brute force.

So if your use is going to be mainly the extraction of values between two dates, and then use a sorted vector, sorting manually if you think that it's easier and do a search sequential or same binary to find the values associated with a date specific.  If you're always looking for dates, then stick with the hash table and then enumerate over it to the value of a total range.

Tags: BlackBerry Developers

Similar Questions

  • How can I publish the data to the hash table using regulator netui?

    Could someone help me on how to display the data of the hash to netui in the controller.

    There are altogether 18 survey questions (each question will have a list of surveyquestionanwer)
    but I see only 14 issues of the investigation during the validation in the controller and also I see all the answers of the survey instead of the one that is selected on the jsp.

    Here is my sample code.
    setQuestionSurveyAnswers(Set<Entry<String, Collection<SurveyQuestionAnswer>>> surveyAnswers)
    
    Map<String, Collection<SurveyAnswer>> surveyQuestionAnswerList = new HashMap<String, Collection<SurveyAnswer>>();
    
    surveyQuestionAnswerList contains <questionId, List<SurveyQuestionAnswer>>
    
    ---------------------------------------------------------------------------------------------------------------
    <netui-data:repeater dataSource="pageFlow.surveyForm.surveyAnswers">
    <netui-data:repeaterItem>
       <netui:span value="${container.item.key}" />
         <netui:radioButtonGroup dataSource="container.item.key" orientation="horizontal"> // is anything wrong here?
              <netui-data:repeater dataSource="container.item.value">
                   <netui-data:repeaterItem>
                        <netui:radioButtonOption value="${container.item.answerText}">
                             <netui:label value="${container.item.answerText}" />
                        </netui:radioButtonOption>
                   </netui-data:repeaterItem>
              </netui-data:repeater>
         </netui:radioButtonGroup>
    </netui-data:repeaterItem>
    </netui-data:repeater>
    ---------------------------------------------------------------------------------------------------------------
    data structure:
    ---------------------------------------------------------------------------------------------------------------
    questionId  answerId    answerText      surveyQuestionLabel
    ---------------------------------------------------------------------------------------------------------------
    1              1           Yes          Do you want to take the survey?  <SurveyQuestionAnswer>
    1              2           No           Do you want to take the survey?     <SurveyQuestionAnswer>
    2              1           Beginner     Your expertese Level?    <SurveyQuestionAnswer>
    2              2           Expert       Your expertese Level?    <SurveyQuestionAnswer>
    Appreciate your help.
    Thank you

    Hello
    It won't work, you bind the data of the hashmaps key, which does not work (you have a vo as the key)
    I believe that your structure should be something like

    [QuestionAnswer] where QuestionAnswer has the label of the Question as well as a map of string, the string (AnswerId v/s AnswerText) (this may be an implicit method that traverses all objects and creates a map of AnswerId, AnswerText) and a single field of selectedAnswer.

    Your outer loop will make a loop on QuestionAnswer and print the label of the Question and the inner loop will be the RadioButtonGroup, the data source must be the field of selectedAnswer (because you want to fill only) and the optionsDataSource is the AnswerId card, AnswerText

    concerning
    Deepak

  • Select the data in a table and update in another table

    Dear experts,

    create the table TB_ENCRYPT

    (

    Identification number,

    Varchar2 (200) KEY

    );

    INSERT INTO TB_ENCRYPT VALUES(1,'HJUVHDUIFBSDGVU');

    SELECT * FROM TB_ENCRYPT;

    1 HJUVHDUIFBSDGVU

    create TABLE users)

    username, NUMBER of

    password VARCHAR2 (200)

    );

    Insert users

    values (1, 123 # "")

    Insert users

    values (2, 456 #')

    Select * from users;

    1 123 #.

    # 2 456

    I want to select the data KEY for table TB_ENCRYPT column and update in the column of tables for the respective key user password

    TB_ENCRYPT table contains only a single key value. Comparing this key, I want to update the old value of the key to the new value.

    For encryption and decryption I followed the java class method.no is worried about that.

    create or replace

    PACKAGE PCK_ENC AUTHID CURRENT_USER AS

    FUNCTION DECRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.decrypt (java.lang.String, java.lang.String) return java.lang.String ';

    FUNCTION ENCRYPT (VARCHAR arg0, arg1 VARCHAR) AS VARCHAR BACK LANGUAGE JAVA NAME 'Encrclass.encrypt (java.lang.String, java.lang.String) return java.lang.String ';

    END;

    SELECT PCK_ENC. ENCRYPT('1234','HJUVHDUIFBSDGVU') FROM DUAL;

    HERE,

    1234 - is the password of the users table column data

    HJUVHDUIFBSDGVU - represents the key of table TB_ENCRYPT column data.

    Comparing this key, I want to update the old value of the key to the new value.

    I tried with this method

    declare

    cursor c1 is

    Select the key

    of TB_ENCRYPT

    where id = 1

    update the id;

    Start

    for c1_rec looping c1

    update users

    password is PCK_ENC. Encrypt (Password, Key)

    the location being c1;

    commit;

    end loop;

    end;

    /

    Help, please

    You can use the MERGE statement.

    merge into users
    using tb_encrypt
       on (id = userid)
      when matched then
          update set password = PCK_ENC.ENCRYPT(password,key);
    

    And why you encrypt your password. This isn't a good idea. Just password hash.

  • Move the data from the partitions again tablespace - direct table filled by ETL

    Hello

    We have a large composite table date-range/hash partitioned table (using time partitioning 11.2.0.3 range)

    1 partition for each month and each such partition 4 under separate partitions.

    We want to move some data from most significant storage but also direct table and inserted in all the days as part of the data warehouse and large table want to ensure

    operations below result in errors in the data loading procedure

    Suppose also should not take long to run lines 40 million or more each month.

    Select *.

    Of user_tab_partitions

    Where table_name = 'CUSTOMER_TRANSACTION '.

    And nom_partition like 'SYS % '.

    1. (1) Alter table retailer_transaction and rename partition < nom_partition > CUST_PART_ < YYYYMM >

    1. (2) tablespace create dedicated for the month of the affected partition

    1. ((3) alter table retailer_transaction move tablespace subpartition < sys... > < partition_tablespace > created in 2) above

    ALTER table retailer_transaction change the default attributes for the partition < CUST_PART < YYYYMM > < tablespace in 2 above > tablespace)

    4 global index which would eventually rebuild afterwards due to the transition if movement makes no valid.

    Several local bitmap indexes that belong to partitions.

    Thoughts?

    Thank you

    I agree in a good store of data, everything should be according to the best practices ETL or guideline. I guess it is a FACT table, because it's big enough. A method that I can share (followed in the real world big DW) is "ELP" IE Partition Exchange loading. You can find the basic architecture of the Internet.

    The basic architecture is as

    The source (in your case partitioned) Table--> (unpartitioned) intermediate Table--> Table possible target (partitioned)--> the cleaning activities (and overtime).

    You can use any ETL tool for this (I won't mention any other reasons).

    Later, you can delete the original table and use that new table as your FACT table, your application will be available all the time. There are drawbacks as most uses of double-spaced, other than normal ETL these work will take certain amount of resources so that other ALS etc. In addition, if you load a few current days during these activities you plan / program accordingly.

    Your demo is also fine, but regular ETL may fail because you rename the partitions (some uses of ETL tool partition name, in case you ever ELP) also unusable global indexes can cause failure (you have local too?).

  • retrieve the information of partition table with lack of offline data file

    I just restored a backup of a database. When I unzipped data files, I discovered that a single data file was so damaged in the starting order of the database, I had to put the offline data file. The tablespace which reports the data file holds the information of partition of a table. Since I have no archives from when the data file has been created, I know it is not possible to recover the data file, I have to recover as many lines as possible other files in the tablespace data but when export or create the table as what to choose in the affected partition get ORA-00376 : cannot read file 1624 at the moment.

    is there a way to tell oracle to ignore the data offline file and export the remaining data file information?

    Just to clarify my situation a little more;
    iI have a table called PPGA_ACTABOPRE that is partitioned by HASH and has 20 partitions, each partition in a different tablespace and tablespace each have about 8 files of data. A data file in the partition 9 is missing and I want is to get the information from the files of the remaining data, but whenever I issue a select statement or an exp or anything I get ORA-00376.

    I try to set the flag to ignore blocks corrupt with run DBMS_REPAIR. SKIP_CORRUPT_BLOCKS ('PPGA', 'PPGA_ACTABOPRE'); and then select the info but it did not work.

    Any suggestion would be appreciated;
    Thanks in advance

    For the actabopre_p08 partition, some files are available, and we're not. You can access data at the segment level, because some extensions are missing.

    You would need to access the data by rowid. You could loop through dba_extents and use dbms_rowid.create to generate a list of ROWID that may exist in the available data files.

    This may help: -.

    http://kerryosborne.Oracle-guy.com/2009/02/saving-rows-from-corrupt-blocks/
    http://kerryosborne.Oracle-guy.com/scripts/save_u.SQL

    Published by: Robert Geier on March 12, 2010 15:33

  • Read xls file and display the data in the table.

    Hello

    Try to read the data from an xls or csv file and fill the same data in the table. If I need to use the table to store the data from the file and display, hoping that someone could help.

    Thank you

    Hari

    Hi hari,.

    One thing that is very important when you use the Excel activeX interface (in case you need it) is good termination of worksheet/workbook/lettering handles.

    You need these handles to specify what cell in which file you are trying to access.

    If you are unable to throw each handle you have, then you will be left with ghost Excel process in your task manager, devours your system's memory.

    Thus, when debugging of your application, open the Task Manager and the watch as Excel treats created/destroyed and make sure that you end up with zero Excel process running when your application is closed.

    Also consider the case of fault for your program. Check that your exit routes did not omit any termination of handle.

  • I'm reading the data (speed rate and flow) of a table and it plot in a graph.

    I'm reading the data (speed rate and flow) of a table and it plot in a graph. I need to draw two values of l/min (speed) to the same speed. How can I do using a loop for?

    There is no need actually to use a loop FOR this. And using a graphic waveform isn't the type of field for this, for a waveform you a (Start), the dT T0 (greatness not) and table D (Data), this isn't what you want unless you know precisely the measure will take place according to an orderly disposal, you'd want a xy chart so that you can trace the measures where they occur in the axes X and Y of preference.

  • Table for the data to HAVE it

    Please add the table to my VI.

    Please see the attachment.

    A probe inside the loop shows a lot of activities.  Are you preventing the VI with the command menu to cancel the execution? If so, you will never see data outside the While loop. Data will only forward your While loop when you stop the loop by program.

    Your STOP button is hidden behind the chart. It out behind the loop and use it to stop the loop. Then you will see the table becomes populated.

    Your spreadsheet column headings indicates that you want to save the square and square root average of each sample. If this is the case, then these values must be calculated at the time of acquisition before the release of the data in the spreadsheet file.

    JohnCS

  • How to transfer data from the data in table 2D only once file?

    Attached file will write same data in table 4 times 2D file. Output must be in a table 2D.

    Someone will provide a solution or a reason to explain why the data are been ouputted 3 more times? Thank you

    I already told you a better and more effective method. The function of reading worksheet is on the exact same range as your text file and does everything for you. If you insist for some reason strange kernel to reinvent the wheel and write your own code, take the correct path. The use of 4 separate spreadsheet String to Array is the cause of your problem and I already said too much. Don't you think that get you 4 times the data is in correlation with the fact you are using 4 times the functions necessary at all? It is simply not true. Look at the diagram-writing block on a spreadsheet file.

  • How to save the data in table 1 d to Excel in continuous

    Mr President.

    How to save the data in table 1 d to Excel at all times, so that all the data of the first scan must be placed first thought and all the data from the second analysis must be placed on the second Board and continue on the street...

    Sy@m...

    Hi Sy@m

    Here is a vi that might give you a few ideas to try:

  • concatenate the data in 2 tables in a third table as well as in CONCATENATE strings

    Hello. as the title says, I wish to only concatenate the data in 2 tables in a similar third table that concatenate strings don't. All tables should be 1 d. For example, suppose that there is 1 table with the following: 1. 2; 3; 4 and table 2 with:; b; c; d. I would like a table 3 either 1 a, 2 b, 3 c, 4 d. Now this could be done easily with above mentioned concatenate strings, then table construction. but table 1 and 2 have something like 150 items. Rather painful. Any ideas?

    Hold arrays of two strings in a loop for example, concatentate the strings inside the loop and run the result réécrirait array3.

    Autoindexing manages table manipulations.

    MIke...

  • reorganization of the data in the table

    This has probably been asked and answered before, but I can't seem to find it anywhere.

    I'm saving a bunch of data in a file of lvm in the form of a 1 d table. When I open the worksheet the data appears in this format

    0 2.525174
    1 0.390727
    2 4.00143
    3 0.020132
    0 2.525174
    1 0.390727
    2 4.00143
    3 0.020132
    0 2.525174
    1 0.390727
    2 4.00143
    3 0.020132
    0 2.525174
    1 0.390727
    2 4.00143
    3

    0.020132

    0-3 is my four analog channels. I want the data to look like this when I open the file in excel:

    0 2.525174 2.525174 2.525174 2.525174
    1 0.390727 0.390727 0.390727 0.390727
    2 4.00143 4.00143 4.00143 4.00143
    3 0.020132 0.020132 0.020132 0.020132

    This way I can easily see which data points belong to which channel.

    Otherwise, it would be even better:

    0 1 2 3
    2.525174 0.390727 4.00143 0.020132
    2.525174 0.390727 4.00143 0.020132
    2.525174 0.390727 4.00143 0.020132
    2.525174 0.390727 4.00143 0.020132

    I'm pretty new to LV and can't seem to find a way to re - format the data before moving my "write.vi".

    Just in case this is helpful somehow, I enclose my vi.

    Thanks in advance!

    EDIT: accidentally attached the wrong file. This is the one.

    Hello.

    You can use the Decimate array with 4 outputs function to automatically create a single table for each channel, you can then use build array to merge all channels as an array of unique 2D (which would look like the second picture you posted). Finally, you can convert the table to format as in your third example. I hope that helps!

    Best regards.

  • FFT of the data in a table

    I would like to perform an FFT on a digital signal periodic sampling.  For the moment, my signal is stored as an array of 16-bit integers (0-65534) item 8192.

    I tried to connect this table directly at the entrance of the fft.vi X, but the data that comes out of the FFT {X} seem little logic (table length 8192 with spikes, the beginning and the end of it).

    Any advice would be much appreciated.

    Okay, that's better

    The reason why you don't see the desired result of FFT is easy:

    (a) you have a shift of 8000 to your signal. He is peaking at 0.

    (b) your signal includes approximately 2.6 times. Given that the FFT concatenates virtually your signal from - inf to + inf in the time domain, your signal a 'jump' inside that create spikes in your field of frequency 'somewhere '. To prevent this, you can either use windowing or cut the signal of your time domain to contain a whole number of periods (which would then along 6400 samples).

    hope this helps,

    Norbert

  • the data in table view

    I have an array of clusters.  Each element of the cluster contains a lot of data elements for a sample.  The index of the table indicates what number of the sample.

    The size of the array will not be determined until the time of execution because the user will determine how many samples they test.  I don't know how I could continue on the display of this information.  What I'd like to see is a screen that shows all the data for a single group (single element of the array), with a drop-down list box or something that can select a different sample, which could bring him to then fill all the fields with the data of some selected sample.

    I have 36 pieces of data to display for each sample in order to have all the data of all the samples displayed both to immediately get quickly... especially with the size of the typical sample of 6, which would translate into 216 boxes on the FP.

    You certainly don't have a drop-down list box. Everything you need is a digital control wired to the Index Array function. Take the item that comes out and he wire a Unbundle/Unbundle by name. Create a flag for each item in the cluster.

  • Save the data in another table

    Hello, I would like someone to help me with a problem I have in my program.
    What makes the program is, for each iteration, take the data in 'table iter' and recorded in "table of output." But in the second iteration instead of storing the results of the first iteration offer me '1' in the first five lines.

    How can I solve this problem?

    Thank you, Jaime

    Hi pescajaime,

    Please make the change mentioned in the attachments.

    Thank you and best regards,

    srikrishnaNF

Maybe you are looking for

  • Satellite A30: 80 GB HDD is recognized as 40 GB

    My Satellite A30 2.5 G Cel. 1 GB mem recognizes a 80 GB of a 40 GB HARD disk.The HARD drive I am trying we is a Samsung MP0804H. Someone knows how to set the LBA for this laptop?

  • Ntbackup freezes

    Ntbackup is working properly until recently (after installing .NET upgrades).  now, it freezes in the Preparing to backup using snapshot. It is on a stand-alone computer using xp pro sp3 running all upgrades.  the shadow copy service is set to automa

  • Change the colors in Windows Vista

    I am visually impaired and a bit as the initiator of this thread, I use a black background, not only because I love him, but because I have to in order to use Windows 7. Because I need 'High contrast' to affect all areas of Windows, I use the theme "

  • Text no autosize in PDF form

    HelloI use Acrobat Reader for Macintosh to fill out a PDF form for a University assignment. On previous assignments, I was able to type in a form field, and the text would be autoshrink to account for the size of the field that I completed my answers

  • Adobe addins not install or remove

    Try to install TKAactions V4 and remove Greg Benz through adobe addons website. The add ons show that they are installed or removed, but there is no mention in the activity stream and the items do not appear in the extensions list.