Array dependence pragmas - achieving II=1.

Hello everyone,
I'm after some help with Vivado HLS loop dependencies. I've got a function that's building low-resolution histograms of images. The pseudocode looks like this:
// Image is uint8, but actually the range is guaranteed to be 0 - 191.
void createHistogram(uint8 image[640*480]) {
static int histogram[12];
#pragma HLS ARRAY_PARTITION variable=histogram complete dim=1
for (int i = 0; i < 640*480; i++) {
uint8 value = image[i];
int histogramMainBin = value/16;
int remainder = value - histogramMainBin*16;
int histogramSecondaryBin;
if (remainder >= 6) {
if (histogramMainBin < 11) {
histogramSecondaryBin = histogramMainBin + 1;
} else {
histogramSecondaryBin = 0;
} else {
if (histogramSecondaryBin > 0) {
histogramSecondaryBin = histogramMainBin-1;
} else {
histogramSecondaryBin = 11;
assert(histogramMainBin != histogramSecondaryBin);
int addMain = value * 3 / 4; // Smooth it out between the bins. The bin that this value falls into gets 3/4 of the value, and the next closest gets 1/4.
int addSecondary = value - addMain;
histogram[histogramMainBin] += addMain;
histogram[histogramSecondaryBin] += addSecondary;
// Do something with the histogram.
(it's just pseudocode; in the real thing is quite a lot more complex and also an enourmous mess because of the things I've been testing to make this work).
The HLS tool says:
@W [SCHED-68] Unable to enforce a carried dependency constraint (II = 1, distance = 1)
between 'store' operation (test_cpp/testcode.cpp:620) of variable 'tmp_45' on static variable 'histogram_V_0' and 'load' operation ('histogram_V_0_load_1') on static variable 'histogram_V_0'.
I'm currently getting II=2 because of this loop dependency on 'histogram'. I'd like to get II=1. In the past I've had this problem because the histogram has been in block RAM, and the FPGA can't manage a one-cycle read-modify-write update on that. However, in this case I've got the histogram fully partitioned to individual registers, and you can definitely do a single-cycle register update.
The problem appears to be that HLS is not recognising that histogramMainBin and histogramSecondaryBin cannot ever be equal. This leaves the possibility that in one loop iteration it'll have to read a histogram location, add a value, write to the same location (for the histogramMainBin update), read the same location (for histogramSecondaryBin), add a value, and write to the same location. Since each update is one cycle, it's allocating two cycles for the updates (that's what I'm seeing in the performance analysis output). If I remove the histogramSecondaryBin update (so it only writes to one location on each cycle) then it works fine at II=1. I've tried putting in a pragma to tell it that the same location never gets accessed twice in one iteration ("#pragma HLS DEPENDENCE variable=changes0 intra false") but that hasn't helped.
The only other option I can think of is a giant switch statement:
switch (histogramMainBin) {
case 0: histogram[0] += addMain;
if (remainder >= 6) {
histogram[1] += addSecondary;
} else {
histogram[11] += addSecondary;
break;
case 1: histogram[1] += addMain;
if (remainder >= 6) {
histogram[2] += addSecondary;
} else {
histogram[0] += addSecondary;
break;
That works fine (synthesis at II=1 with no dependence pragmas needed), but it's a horribly messy approach and makes the code much harder to modify (eg. if I decided I actually want 24 histogram bins, I have to rewrite the whole thing with twice as much code, whereas with the original approach it's just a matter of changing a few values).
It seems likely that there's a pragma somewhere that I've missed, but I can't find anything suitable in ug902.
Any ideas would be much appreciated.
Thanks

If anyone's interested, I've found a workaround:
void updateHistogram(int histogram[12], int addMain, int addSecondary, int histogramMainBin, int secondaryBinSelect) {
#pragma HLS FUNCTION_INSTANTIATE variable=histMainBin
histogram[histogramMainBin] += addMain;
if (secondaryBinSelect) {
if (histogramMainBin >= 11) {
histogram[0] += addSecondary;
} else {
histogram[histMainBin+1] += addSecondary;
} else {
if (histogramMainBin == 0) {
histogram[11] += addSecondary;
} else {
histogram[histMainBin-1] += addSecondary;
Moving the histogram update to a separate function means that I can use the FUNCTION_INSTANTIATE pragma and force HLS to evaluate what the function does for each value of histogramMainBin. Presumably once it does this, it realises that actually it's never going to hit the same bin twice in one cycle, so it schedules with II=1. This approach is slightly more expensive than the huge switch statement (probably because it's also building hardware just in case histogramMainBin is greater than 11) but it results in much nicer code.

Similar Messages

  • DSM mismatch

    I have a 2012 R2 cluster that was just rebuilt from a 2012 cluster. The storage is a Dell MD3200 SAN storage array. To set up access properly to the array multi-pathing has to be setup. MPIO was installed by adding that feature and then Dell's MDSM (modular
    disk storage manager).
    In running the cluster validation I am now getting errors saying that the versions of DSM named Microsoft do not match between the two nodes.
    It shows on each node there is a Microsoft DSM and a DSM from the hardware vendor (Dell). The versions of each company's DSM do agree between nodes but the versions between Microsoft and Dell are different of course.
    I thought MPIO was needed so the array looked like one disk and that the MDSM was needed to do any management of the array.  But now I believe that both DSM's are not needed so now I'm wondering which to get rid of. It seems like I should have the vendor
    DSM installed rather than MS. I just don't want to mess up anything by uninstalling MPIO.
    Since I have both DSMs on there, will there be any problems caused by uninstalling MPIO and leaving the Dell DSM?
    Jonathan

    Hi Jonathan,
    It’s generally recommended to use the DSM provided by the hardware storage array partner to achieve optimal performance since the storage array partner can make more advanced
    path decisions in their DSM specific to their array.
    When you use the third party DSM you should refer to your storage array partner for guidance on which DSM to use with a given storage array as well as the optimal configuration.
    If that DSM does not have its own setup package, you can install compliant non-Microsoft DSMs by browsing for the DSM’s .inf file, and then clicking Install. You can also
    uninstall a non-Microsoft DSM by clicking Uninstall.
    Understanding MPIO Features and Components
    http://technet.microsoft.com/zh-cn/library/ee619734(v=ws.10).aspx
    Installing and Configuring MPIO
    http://technet.microsoft.com/en-us/library/ee619752(WS.10).aspx
    More information:
    Referencing MPCLAIM Examples
    http://technet.microsoft.com/en-us/library/ee619743(WS.10).aspx
    I’m glad to be of help to you!
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How to achieve Multi Dimensional array in Oracle

    Hi,
    Pls give me a solution to achieve the Multi dimensional Array concept in Oracle.
    I've used Nested table concept in which I did not find any Equivalent for the array structure in COBOL given below
    01 customer_record.
    &nbsp&nbsp&nbsp03 telephone_number occurs 3 times.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 country_code pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 area_code pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp05 local_number occurs 2 times.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp08 prefix pic 999.
    &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp08 subscriber_number pic 999.
    Thanks in Advance
    Regds,
    Arkumar

    What about VARRAYs and user defined objects?

  • Achieve RAID 0+1 on 6130 Array

    Documentation for the 6130 indicates support for RAID 0,1,3,5 & 0+1. However when creating a new storage profile in the console, the options listed are only 0,1,3 & 5. In order to achieve 0+1 should I create 2 Raid 0 pools and then mirror in VxVM? Am I missing something?
    Using:
    Java Web Console Version 2.2.4
    SUNWstadm 2.4.50.009, SUNWstade 2.4.55.005 on Solaris 9
    Array Support Library for VERITAS Volume Manager
    VxVM 4.0
    Thanks for your help!

    Spoke w/ tech support today. Turns out the RAID1 configuration on the 6130 is actually RAID 1+0. RAID 0+1 is not supported natively, and would require a software solution such as VxVM.

  • Returning array of values from a PL/SQL stored procedure

    I try to run the following example, always happen errors: Run-time error'91' Object variable or With block variable not set.(in line: Set myRS.Source = myCmd1 and Set myRS.Source = myCmd2) Who can tell me where is wrong? I check variable, all set.
    Option Explicit
    Dim myCnn As ADODB.Connection
    Dim myCmd1 As ADODB.Command
    Dim myCmd2 As ADODB.Command
    Dim myRS As ADODB.Recordset
    Dim myConnStr As String
    Dim mySQL As String
    Dim inputssn As Long
    Private Sub cmdGetEveryone_Click()
      Dim myLine As String
      Set myRS.Source = myCmd1
      myRS.Open
      myLine = ""
      While Not myRS.EOF
          myLine = myLine & myRS.AbsolutePosition & " " & _
                   myRS(0) & ", " & myRS(1) & ", " & myRS(2) & vbCrLf
          myRS.MoveNext
      Wend
      MsgBox myLine
      myRS.Close
    End Sub
    Private Sub cmdGetOne_Click()
      Set myRS.Source = myCmd2
      inputssn = InputBox("Enter the SSN you wish to retrieve:")
      myCmd2(0) = inputssn
      myRS.Open
      If myRS.RecordCount = 0 Then
         MsgBox "No data found"
      Else
         MsgBox "Person data: " & myRS(0) & ", " & myRS(1) & ", " & myRS(2)
      End If
      myRS.Close
    End Sub
    Private Sub Form_Load()
      'Using an "On-the-fly" nameless ODBC connection
      'Replace <User ID>, <Password>, and <Server> with the
      'appropriate parameters.
      '  myConnStr = "UID=*****;PWD=*****;driver=" _
      '         & "{Microsoft ODBC for Oracle};SERVER=dseOracle;"
      ' myConnStr = "UID=CSUPerson;pwd=euclid;driver={Microsoft ODBC for Oracle};SERVER=company;"
      'you may also use a named connection DSN such as "myOracleODBC" as follows
      myConnStr = "user id=csuperson;password=euclid;DSN=myOracleODBC;"
      Set myCnn = New ADODB.Connection
      With myCnn
          .ConnectionString = myConnStr
          .CursorLocation = adUseClient
          .Open
      End With
      'the entry RESULTSET 99 indicates the arguments (ssn, fname, lname)
      'are arrays of up to 99 cells each.
      'The binding vars (ssn, fname, lname) should be retrieved in VB using a recordSet
      mySQL = "{call packperson.allperson({RESULTSET 99, ssn, fname, lname})}"
      Set myCmd1 = New ADODB.Command
      With myCmd1
          Set .ActiveConnection = myCnn
          .CommandText = mySQL
          .CommandType = adCmdText
      End With
      mySQL = "{call packperson.oneperson(?,{RESULTSET 2, ssn, fname, " _
             & "lname})}"
      Set myCmd2 = New ADODB.Command
      With myCmd2
          Set .ActiveConnection = myCnn
          .CommandText = mySQL
          .CommandType = adCmdText
          .Parameters.Append .CreateParameter(, adInteger, adParamInput)
      End With
      Set myRS = New ADODB.Recordset
      With myRS
          .CursorType = adOpenStatic
          .LockType = adLockReadOnly
      End With
    End Sub
    Private Sub Form_Unload(Cancel As Integer)
      myCnn.Close
      Set myCnn = Nothing
      Set myCmd1 = Nothing
      Set myCmd2 = Nothing
      Set myRS = Nothing
    End Sub
    Package:
    PACKAGE packperson AS
    TYPE tssn is TABLE of NUMBER(10)
    INDEX BY BINARY_INTEGER;
    TYPE tfname is TABLE of VARCHAR2(15)
    INDEX BY BINARY_INTEGER;
    TYPE tlname is TABLE of VARCHAR2(20)
    INDEX BY BINARY_INTEGER;
    PROCEDURE allperson
    (ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname);
    PROCEDURE oneperson
    (onessn IN NUMBER,
    ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname);
    END packperson;
    BODY:
    PACKAGE BODY packperson
    AS
    PROCEDURE allperson
    (ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname)
    IS
    CURSOR person_cur IS
    SELECT ssn, fname, lname
    FROM employee;
    percount NUMBER DEFAULT 1;
    BEGIN
    FOR singleperson IN person_cur
    LOOP
    ssn(percount) := singleperson.ssn;
    fname(percount) := singleperson.fname;
    lname(percount) := singleperson.lname;
    percount := percount + 1;
    END LOOP;
    END;
    PROCEDURE oneperson
    (onessn IN NUMBER,
    ssn OUT tssn,
    fname OUT tfname,
    lname OUT tlname)
    IS
    CURSOR person_cur IS
    SELECT ssn, fname, lname
    FROM employee
    WHERE ssn = onessn;
    percount NUMBER DEFAULT 1;
    BEGIN
    FOR singleperson IN person_cur
    LOOP
    ssn(percount) := singleperson.ssn;
    fname(percount) := singleperson.fname;
    lname(percount) := singleperson.lname;
    percount := percount + 1;
    END LOOP;
    END;
    END;DB table:
    CREATE TABLE EMPLOYEE
    (FNAME VARCHAR2(15) NOT NULL,
    MINIT    CHAR,
    LNAME VARCHAR2(15) NOT NULL,
    SSN VARCHAR2(9) NOT NULL,
    BDATE DATE,
    ADDRESS VARCHAR2(30),
    SEX CHAR,
    SALARY NUMBER(10,2),
    SUPERSSN VARCHAR2(9),
    DNO NUMBER NOT NULL,
    PRIMARY KEY(SSN));
    DESC EMPLOYEE;
    INSERT INTO EMPLOYEE VALUES
    ('John','B', 'Smith', '123456789','09-JAN-65',
      '731 fONDREN, hOUSTON, TX', 'M', 30000, '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Frankin','T', 'Wong', '333445555','08-DEC-55',
      '683 Voss, Houston,Tx', 'M', 40000, '888665555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Alicia','J', 'Zelaya', '999887777','19-JUL-68',
      '3321Castle, Spring, TX', 'F',25000 , '987654321',4);
    INSERT INTO EMPLOYEE VALUES
    ('Jennifer','S', 'Wallace', '987654321','20-JUN-41',
      '291 Berry, Bellaire, TX', 'F',43000 , '888665555',4);
    INSERT INTO EMPLOYEE VALUES
    ('Ramesh','K', 'Narayan', '666884444','15-SEP-62',
      '975 Fire Oak, Humble, TX', 'F',38000 , '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Joyce','A', 'English', '453453453','31-JUL-72',
      '5631 Rice,Houston,TX', 'F',25000 , '333445555',5);
    INSERT INTO EMPLOYEE VALUES
    ('Ahmad','V', 'Jabbar', '987987987','29-MAR-69',
      '980 Dallas,Houston, TX', 'M',25000 , '987654321',4);
    INSERT INTO EMPLOYEE VALUES
    ('James','E', 'Borg', '888665555','10-NOV-37',
      '450 Stone, Houston, TX', 'M',55000 , null,1);All help I will appreciat it.

    I can't comment on the problem returning PL/SQL arrays, but I will suggest that a more appropriate method of achieving your goal is to call a procedure which returns a REF CURSOR.
    See the examples here:
    http://asktom.oracle.com/~tkyte/ResultSets/index.html

  • Converting ASCII text (byte array ending in null) to a String

    Hi all,
    I am trying to convert a null terminated ascii string stored in a byte array to a java String. When I pass the byte array to the String constructor it
    does not detect/interpret the null as a terminator for the ascii string. Is this something I have to manually program in? ie Check for where the null is and then
    pass that subarray of everything before the null to the String constructor?
    example of problem
    //               A   B  C   D   null   F   (note F is junk in the array, and should be ignored since it is after null)
    byte[] asciiArray = { 65, 66, 67, 68, 0,  70 };
    System.out.println(new String(asciiArray, "UTF-8"));
    //this prints ABCD"sqare icon"F

    Why do you expect the null character to terminate the string? If you come from a C or C++ background, you need to understand that java.lang.String is not just a mere character array. It's a full-fledged Java object that knows its length without having any need for null terminator. So Ascii 0 is just another character for String object. To achieve what you want to do, you have to manually loop through the byte array and stop when you encounter a null character.

  • How can I get all the values of a String array profile property using javascript?

    I am trying to build functionality into our site that records all products added to the basket against a user's profile.
    I have so far been able to store the product codes against the profile as a property using Ajax:
           var dataString = ":formid=addProduct&:formstart=/apps/thread/templates/page_product/jcr:content/par/produc t/formstart&:redirect=/content/thread/en/user/cart.html&productId=151515:profile="+profile ;
                         $.ajax({ 
                type: "POST", 
                url: "/content/women/evening/dresses/l-k-bennett-davinadress.html", 
                data: dataString, 
                success: function(data) { 
    In this example I have hardcoded a product ID of 151515.
    In order to save the property as a multi string field you simply replace &productId=151515 with &productId=151515&productId=131313&productId=141414 or as many extra values as you want to build into that string. This stores a productId property against a user profile.
    The issue comes from calling that data back. Using var value = CQ_Analytics.ProfileDataMgr.getProperty("productId") I can get the first value of this array (or the single value if only one is stored).
    However there does not seem to be a way to get any of the other stored values in the array using getProperty. Does anyone know how I can achieve this?

    Hi,
    Don't think that's possible. Even if it were, you wouldn't be able to use/display BOOLEAN type in SQL.
    If you just aim to see what they are, you could do something like this
    select text
      from all_source
    where owner = 'SYS'
       and name = 'DBMS_DB_VERSION'
       and type = 'PACKAGE';Or even
    select dbms_metadata.get_ddl('PACKAGE', 'DBMS_DB_VERSION', 'SYS') from dual;My version is:
    SQL> select * from v$version where rownum = 1;
    BANNER                                                         
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    1 row selectedIn 11g you also have [PL/SCOPE|http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10471/adfns_plscope.htm#ADFNS02203] which might help you even more.
    Regards
    Peter

  • Associative array comparison and INSERT upon IF condition

    Hi Guys,
    I have written this pl sql code to identify non existing sellers and insert their sales channel information into the dimension table (dimensional table update).
    Somehow,......nothing is inserted and this script runs for 12 hours+ without any result. the sql autotrace shows no result and the explain plan (button on sql developer throws upon clicking "missing keyword". I have no
    information what is going on/wrong. Does anyone spot an error?
    UNDEFINE DimSales;
    UNDEFINE FactTable;
    DEFINE DimSales = 'testsales';
    DEFINE FactTable = 'testfact';
    DECLARE
    v_SellerNo VarChar(9);
    v_error_code T_ERRORS.v_error_code%TYPE;
    v_error_message T_ERRORS.v_error_message%TYPE;
    TYPE assoc_array_str_type1 IS TABLE OF VARCHAR2(32) INDEX BY PLS_INTEGER;
         v1 assoc_array_str_type1;
    TYPE assoc_array_str_type2 IS TABLE OF VARCHAR2(32) INDEX BY PLS_INTEGER;
         v2 assoc_array_str_type2;
    BEGIN
    --Collect all distinct SellerNo into associative array (hash table)
    select distinct SellerNo bulk collect into v1 from &FactTable;
    select distinct seller_id bulk collect into v2 from &DimSales;
    v_SellerNo := v1.first;
    loop
    exit when v1 is null;
    --1 Check if v_SellerNo already exists in DIM_Sales (if NOT/FALSE, its a new seller and we can insert all records for that seller
    if (v2.exists(v_SellerNo)=false) THEN
    INSERT INTO &DimSales (K_Sales,REG,BVL,DS, VS,RS,GS,VK)
    (SELECT DISTINCT trim(leading '0' from RS||GS) ,REG BVL,DS,VS,RS,GS,VK from &FactTable where SellerNo =v_SellerNo);
    --ELSE
    end if;
    v_SellerNo := v1.next(v_SellerNo);
    end loop;
    EXCEPTION
    WHEN OTHERS THEN
    ROLLBACK;
    --v_error_code := SQLCODE
    --v_error_message := SQLERRM
    --INSERT INTO t_errors VALUES ( v_error_code, v_error_message);
    END;
    ---------------------------------------------------------------

    Distinct clause requires a sort. Sorts can be very expensive.
    Bulk collects that are not constrained in fetch size, can potentially fetch millions of rows - requiring that data to be wholly read into server memory. I have seen how this can degrade performance so badly that the kernel reboots the server.
    Using PL/SQL loops to process and insert/update/delete data is often problematic due to its row-by-row approach - also called slow-by-slow approach. It is far more scalable letting SQL do the "loop" processing, by using joins, sub-selects and so on.
    Where the conditional processing is too complex for SQL to handle, then PL/SQL is obviously an alternative to use. Ideally one should process data sets as oppose to rows in PL//SQL. Reduce context switching by using bulk fetches and bulk binds.
    But PL/SQL cannot execute in parallel as the SQL it fires off can. If after all the optimisation, the PL/SQL process still needs to hit a million rows to process, it will be slow irrespective of how optimal that PL/SQL approach and design - simply because of the number of rows and the processing overheads per row.
    In that case, the PL/SQL code itself need to be parallelised. There are a number of ways to approach this problem - the typical one is to create unique and distinct ranges of rows to process, spawn multiple P/SQL processes, and provide each with a unique range of rows to process. In parallel.
    So you need to look close at what you are trying to achieve, what the workloads are, and how to effectively decrease the workloads and increase the processing time of a workload.
    For example - finding distinct column values. You can pay for that workload when wanting that distinct list. And each time afterward repeat that workload when wanting that distinct list. Or you can pay for that workload up-front with the DML that creates/updates those values - and use (for example) a materialised view to maintain a ready to use distinct list of values.
    Same workload in essence - but paying once for it and up-front as oppose to each time you execute your code that needs to dynamically build that distinct list.
    Kent Crotty did tests and showed stunning performance improvements with bulk collect and forall, up to 30x faster:Bulk processing is not a magical silver bullet. It is a tool. And when correctly use, the tool does exactly what it was designed to do.
    The problem is using a hammer to drive in screws - instead of a screwdriver. There's nothing "stunning" about using a screwdriver. It is all about using the correct tool.
    If the goal of the swap daemon is to free up "idle" chunks of memory, and try to use that memory for things like file cache instead, what does that have to do with bulk processing?The swap daemon reads virtual memory pages from swap space into memory, and writes virtual pages from memory to swap space.
    What does it have to do with bulk processing? A bulk fetch reads data from the SGA (buffer cache) into the PGA (private process memory space). The larget the fetch, the more memory is required. If for example 50% of server memory is required for a bulk collection that is 2GB in size, then that will force in-use pages from memory to swap space.. only to be swapped back again as it is needed, thereby forcing other in-use pages to swap. The swap daemon will consume almost all the CPU time swapping hot pages continually in and out of memory.

  • How can I display all results of a array element in a TS2.0 NumericArrayMeasurement in a single report line?

    TestStand2.0 generates for each result property ( data, limits, status...) of each array element in a NumericArrayTest an extra line in the test report.
    How can I change this to display all result properties of one array element in a single line?
    How can I reduce the spaces between the property name and its value in the report?
    How can I delete the message: "Measurement[x]" and display only the Measurement Alias (named in the Edit Limits menu)?
    This means I like to change my report from:
    Measurement[0] (ADC1):
    Data: 5000
    Status: Passed
    Measurement[1] (AD
    C2):
    To:
    ADC1: Data: 5000 Status: Passed
    ADC2: ...

    Hi,
    What you can do, is use the Override Callbacks for Modify the Report that is Generated.
    Also you can also change the report sequence 'reportgen_txt.seq' to achieve the desired affect. If you go for modifying the report sequence then copy this to the User folder and then make your changes.
    In the Resources Library you can find simple examples were the report has been modified by either using the Override Callbacks or by modifying the actual sequence.
    One other item in the Report Options you will have to set the 'Select a Report Generator for Producing the Report Body' control to use the Sequence instead of the DLL.
    Hope this helps
    Ray Farmer
    Regards
    Ray Farmer

  • How to pass and receive an array from a form.

    For example, now i want to input my students achievement of an exam.
    I should input tow fields of data of every student: studentID,achievement.
    And i want to post a few of records each time (eg 10 records).
    So i should use an array data[10][2] to store 10 records each.
    But i don't know how to write it in HTML form. should i use the same name in all the ten <input> fields? or should i do as below:
    <form method = "post" ....>
    <input type = "text" name = "studentID[0][0]"></input>
    <input type = "text" name = "achievement[0][1]"></input>
    <input type = "text" name = "studentID[9][0]"></input>
    <input type = "text" name = "achievement[9][1]"></input>
    </form>
    And how can i receive this array using JSP or JSTL or Servlet?
    Can u give me an simple example?

    I think this will be usefull to you. If ok convert it for 2 dimensional array in the loop
    <form>
    <%
            for(int i=1;i<=10;i++)
    %>
            <input type="text" name="student[<%=i%>]"/>
    <%
    %>
    </form>

  • How can i put the values of the position of a pixel in an array ?

    Hello. I wanted to know if someone can help me with my problem. In fact i have to make an image treatment. For this i put my immage in an array and i work in this array thanks to two For loops. I wanted to know which pixel is white and which one is grey so i made a software and this works very well but know i would like to put the value of X and Y of each white pixel. unfortunately i don t know how to use Labview very well. So i tought about a system based on a conditional loop who put the value of X and Y in two 1D arrays. But i am not able to achieve it. This is what i tried but i don t know how to achieve it. If you guy or girls have solutions to my problem or an other way to do it go on ^^.
    Thanks every one.
    Attachments:
    Untitled.png ‏15 KB

    I am sure you can adapt one of the two solutions shown here.
    LabVIEW Champion . Do more with less code and in less time .

  • How to save data in a 4D array and make partial plots in real time?

    Hi, this is a little complex, so bear with me...
    I have a test system that tests a number of parts at the same time. The
    experiment I do consists of measuring a number of properties of the
    parts at various temperatures and voltages. I want to save all the
    measured data in a 4-dimensional array. The indices represent,
    respectively, temperature, voltage, part, property.
    The way the experiment is done, I first do a loop in temperature, then
    in voltage, then switch the part. At this point, I measure all the
    properties for that condition and part and want to add them as a 1D
    array to the 4D array.
    At the same time, I want to make a multiple plot (on an XY graph) of
    one selected property and part (using two pull-down selectors near the
    XY graph) vs. voltage. (The reason I need to use an XY graph and not a
    waveform graph, which would be easier, is that I do not have
    equidistant steps in voltage, although all the voltage values I step
    through are the same for all cases). The multiple plots are the data
    sets at different temperatures. I would like to draw connection lines
    between the points as a guide to the eye.
    I also want the plot to be updated in the innermost for loop in real
    time as the data are measured. I have a VI working using nested loops
    as described above and passing the 4D array through shift registers,
    starting with an array of the right dimensions initialized by zeroes. I
    know in advance how many times all the loops have to be executed, and I
    use the ReplaceArraySubset function to add the measured properties each
    time. I then use IndexArray with the part and property index terminals
    wired to extract the 2D array containing the data I want to plot. After
    some transformation to combine these data with an array of the voltage
    values in the form required to pass to the XYGraph control, I get my
    plot.
    The problem is: During program execution, when only partial data is
    available, all the zero elements in the array do not allow the graph to
    autoscale properly, and the lines between the points make little sense
    when they jump to zero.
    Here is how I think the problem could be solved:
    1. Start with an empty array and have the array grow gradually as the
    elements are measured. I tried to implement this using Insert Into
    Array. Unfortunately, this VI is not as flexible as the Replace Array
    Subset, and does not allow me to add a 1D array to a 4D array. One
    other option would be to use the Build Array, but I could not figure
    out if this is usable in this case.
    2. The second option would be to extract only the already measured data
    points from the 4D array and pass them to the graph
    3. Keep track of the min. and max. values (only when they are different
    from zero) and manually reset the graph Y axis scale each time.
    Option 3 is doable, but more work for me.....
    Option 2: I first tried to use Array Subset, but this always returns an
    array of the same dimensionality of the input array. It seems to be
    very difficult, but maybe not impossible, to make this work by using
    Index Array first followed by Array Subset. Option 3 seems easier.
    Ideally, I would like option 1, but I cannot figure out how to achieve
    this.
    Your help is appreciated, thanks in advance!
    germ Remove "nospam" to reply

    In article <[email protected]>,
    chutla wrote:
    > Greetings!
    >
    > You can use any of the 3D display vi's to show your "main" 3d
    > data, and then use color to represent your fourth dimension. This can
    > be accessed via the property node. You will have to set thresholds
    > for each color you use, which is quite simple using the comparison
    > functions. As far as the data is concerned, the fourth dimension will
    > be just another vector (column) in your data file.
    chutla, thanks for your post, but I don't want a 3D display of the
    data....
    > Also, check out
    > the BUFFER examples for how to separate out "running" data in real
    > time.
    Not clear to me what you mean, but will c
    heck the BUFFER examples.
    > As far as autoscaling is concerned, you might have to disable
    > it, or alternatively, you could force a couple of "dummy" points into
    > your data which represent the absolute min/max you should encounter.
    > Autoscaling should generally be regarded as a default mode, just to
    > get things rolling, it should not be relied on too heavily for serious
    > data acquisition. It's better to use well-conditioned data, or some
    > other means, such as a logarithmic scale, to allow access to all your
    > possible data points.
    I love autoscaling, that's the way it should be.
    germ Remove "nospam" to reply

  • How to change a specific element in array

    hi 
    i have an 1d intialized array
    i want to take the existed array and for example add +1 for the 5th element
    how can it be done?
    thanks
    Solved!
    Go to Solution.

    In a typical application you would want to repeat that operation to form a simple histogram. This is most easily achieved by keeping the array in a shift register and repeating the operation in a FOR loop until all data is processed.
    My very simple example from a few years ago can be found here. In this case we are counting the number of occurences of small integers in a 1D array. Modify as needed.
    LabVIEW Champion . Do more with less code and in less time .

  • Returning an array type from a local method in Web Dynpro Java application

    Hi,
    In my project, we have a requirement to display 18 rolling months along with the year, starting from current month.
    How I am going to approach is that I will get the system date and get the current month and send the month and year value to a local method which will return 18 rolling months along with the year.
    But, when I tried to create a new method there is no option to return an array type. It was greyed out.
    So, we can not return an array type from a method from Web Dynpro for Java application?
    If so, what is the alternative and how am I going to achieve it?
    I will appreciate your help!
    Regards
    Ram

    HI
    You can create new methods in
      //@@begin others
      private ArrayList MyMethod(){
           // ** Put your code here
           return new ArrayList();
      //@@end
    Other option are create a context node with cardinality 0...n with one or more attributes, and in your method create the needed registers into this node. To read this values, you only need to read your context node.
    Best regards
    Edited by: Xavier Aranda on Dec 2, 2010 9:41 AM

  • Array or Table of Records or...what is best for my scenario?

    I have been given task to trap last 5 action taken on a form application by user. This would be used where user gets a FRM or ORA error, dump last 5 steps to a table in the database along with error. Trapping FRM or ORA error is easy; I am wondering what & how should I note last 5 steps ( like, what page, what block & what form the user was clicking/entering data etc) when error occurred. I am planning to use when-mouse-click or some other triggers to capture the data; but at every action if I try inserting one record & deleting one record from the database table ( last one knocked out), there is going to be a lot of I/O & that table is going to be too hot. I am trying to avoid that unwanted I/O & keep those 5 steps info somewhere in forms till user gets a error. And, when he/she gets error, he/she can dump those 5 steps info along with error messages/number in a error table.
    My question is: what do I use? Array or Table of records..or something else. I have never used any of these & thought to discuss this before going deep into implementation.
    Any suggestion would be appreciated.
    Thanks.

    You could use a table of records or a record group. They both achieve similar results but with very different syntax. I am not sure if there is any difference in performance.
    Record groups are good for certain things like lists populated from the database because built-ins are provided for manipulating them. If you are going to do the manipulation programatically, I personally find the syntax for tables of records less cumbersome than record groups. Learning the syntax for tables of records is also likely to be more universally useful to you as they have various uses such as passing data between procedures.
    In your situation the table of records needs to exist throughout the forms session rather than just during the execution of a single pl/sql block. The way to do that is create a program unit which is a package header without a body. Declare the table in there and it can be used throughout the form.
    However, if you only ever want to keep 5 records, it would probably be easier just to have 5 ordinary items in a control block on the null canvas (or global variables). When you want to record your new action just do:
    :item5 := :item4;
    :item4 := :item3;
    :item3 := :item2;
    :item2 := :item1;
    :item1 := :new_stuff;
    You could even construct the above in a loop using
    copy(name_in('item'||i),'item'i+i)
    but with only 5 items to manipulate, is it worth the bother ?
    Whatever method you decide to use, you are not going to get anything simpler than 5 little assignment statements.

Maybe you are looking for

  • Burning a dvd

    I copied a VHS tape onto a DVD+R disc. Now I want to make an additional copy of the DVD disc I made from the vhs tape. Can someone please tell me if I use Imovie or Idvd to produce it? Thanks(I'm very new at this)

  • Custom fields added on PO header and PO item in ME21n

    hi everybody I have added 2 fields on PO header and PO item level in ME21N screen, everything is working fine but the issue is that if the Customer Data tab page is not opened at the Header Level, the additional fields in Customer Data tab page at It

  • IAS/BC4J using iCache

    Hi, I have installed iAS Enterprise Edition on solaris and am trying to change the sample Bc4J application to use iCache (which is installed and working). What I did was: add $ORACLE_HOME/jdbc/lib to LD_LIBRARY_PATH in jserv.propertes add an entry in

  • Mac Book Air--- HELP ME!!

    I was using the superdrive playing a DVD and pause the DVD for around 20 minutes maybe. I go back to the player hit play and the computer just froze. I could move the mouse but everything else was unresponsive. I let the computer sit for while and th

  • Deinterlacing In FCE OK - What About iDVD?

    In another thread I printed the results of 2 test slideshows - one made in FCE and the other in iDVD. They were both burned on the same DVD using Best Quality. I couldn't see any quality differences other than the FCE slideshow exhibited more interla