Auto increment array index

Hi,
I have a small problem which i am trouble trying to figure out. Well i have 2 arrays with equal number of elements in each array. What i intend to do is to take the first element from each array and use them in a mathematical expression. Then i would like to increment the indexes of both arrays programmatically and then access the next elements from each array. This procedure is to continue till the end of the array(s). How can i do this. I have tried a couple of things but just dont seem to be able to get around the problem. Help!!!
I have attached the sample code below. I am using version LabVIEW version 8.5.1.
Thank you,
Arun
Attachments:
Sample code 1.vi ‏11 KB

Feed both arrays into a for loop.  Have the tunnels set for auto-indexing.  Do the math.  Have the tunnel going out the right hand side be set for autoindexing.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Similar Messages

  • Auto increment trigger

    I have a table with an index and two other columns. The first column is called index.
    What I would like to do is to auto increment the index column on every insertion. I have read some of the documentation and can't make sense of what I am trying to do. Please point me to an example.
    WBR

    I tried these 3 statements to create a auto update column:
    CREATE TABLE TIME_TABLE (
    RECORD_NUM INTEGER NOT NULL,
    DATE_FIELD DATE,
    DESCRIPTION VARCHAR(1000));
    CREATE SEQUENCE TIME_SEQ START WITH 1 INCREMENT BY 1;
    CREATE OR REPLACE
    TRIGGER TIME_TRIGGER BEFORE INSERT ON TIME_TABLE
    FOR EACH ROW
    BEGIN
    SELECT TIME_SEQ.NEXTVAL INTO :NEW.RECORD_NUM FROM DUAL;
    END
    When I execute an insert statement I get the following error:
    An error was encountered performing the requested operation:
    ORA-04098: the trigger ‘TIME.TIME_TRIGGER’ is invalid and failed re-validation.
    So my question is what is wrong with the three statements. I would appreciate some help.

  • Auto increment the unique index node

    Hello,
    I dont know if this has already been discussed before - searching the forums did not return anything interesting.
    Sometimes you need to have some relational-like functionalities that you would normally have in a hybrid relational/xml DB, where you could have some flexibility in establishing integrity conditions. To illustrate what I mean, consider the following document:
    <?xml version="1.0"?>
    <document>
    <id>12345876988</id>
    <year>2007</year>
    <name> Ana </name>
    <email> [email protected] </email>
    </document>
    So lets suppose I need to store millions of documents like that - but I'd like them to have a unique ID and that this ID would be generated in an auto-increment fashion. I can do this by counting all docs in the container and then incrementing by one, everytime I insert. Then I'd set the ID index to be unique, in case there's any accidental repetition. But I believe this is not the best solution - is there an alternative to this?
    Also, maybe I'd like to express that not only ID should be unique, but the combination of ID and YEAR should be unique. Is it possible to express this in BDB XML? Again, this would be easy in a relational DB, I would just use ID and YEAR as fields and index them in combination.
    Thanks in advance.

    Hi,
    You can use a Berkeley DB Sequence to assign a unique number. Here is a pointer to the documentation for C++ for example:
    http://www.oracle.com/technology/documentation/berkeley-db/db/api_cxx/seq_list.html
    You can add the sequence database to the same environment you are using for Berkeley DB XML. That will allow the updates to particpate in the same transaction which can be committed or aborted.
    Also, maybe I'd like to express that not only ID should be unique, but the >combination of ID and YEAR should be unique. Is it possible to express this in >BDB XML?For this, a common technique is to use Berkeley DB XML metadata. You can create a metadata attribute which represents the concatenation of ID and YEAR.
    The metadata is stored with the document, but not as part of the document
    content.
    You can also create a unique index on that metadata attribute to enforce uniqueness.
    Ron

  • Tons of ieq/add/or instructions for array indexing in pixel shader loop (D3D 11.0, PS model 5.0)

    First of all, I have to apologize for the long code samples, but their content is not so important, I just wanted to give as much info as I can. Besides they are really simple and I tried to comment as much as possible.
    I'm working on a pixel shader doing deferred lighting of the frame (Direct3D feature level 11.0, PS
    model 5.0, IDE - Visual Studio 2013, OS - Windows 8.1 x64). I noticed some huge FPS drops when I add light sources to the scene, and the more sources I add, the bigger performance impact is. After many hours
    of trying to find the problem, experimenting and checking compiled pixel shader ASM's, I found out that at some moment after I comment / uncomment some lines (or event line) my output ASM changes dramatically. I won't put here all the code, of course, but
    here's simplified part of the point lighting in HLSL, so you could imagine the structure of the lighting algorithm:
    // Total amount of color that pixel receives from all the point light sources.
    float3 totalPointLightColor = { 0.0f, 0.0f, 0.0f };
    // Loop through the active light sources.
    [loop] for (uint i = 0; i < g_scene.pointLightCount; i++)
    // xyz - vector from light source to pixel.
    // w - the length of that vector.
    float4 fromLightToPixel;
    fromLightToPixel.xyz = worldPos - g_pointLights[i].position.xyz;
    fromLightToPixel.w = length(fromLightToPixel.xyz);
    // Check max light distance here (skip pixel if it is too far).
    if (fromLightToPixel.w > g_pointLights[i].farZ)
    continue;
    // Normalize direction vector.
    fromLightToPixel.xyz = normalize(fromLightToPixel.xyz);
    // Angle between the pixel normal and light direction.
    float lightIntensity = saturate(dot(normal, -fromLightToPixel.xyz));
    // Check that light comes not from behind of the pixel surface.
    if (lightIntensity <= 0.0f)
    continue;
    // If light casts shadows, process shadow map and get amount of light the pixel receives.
    // THIS LINE IS MENTIONED IN MY QUESTION BELOW.
    if (g_pointLights[i].shadowMapIndex >= 0)
    // Here was shadow map check, but I removed it and nothing really changed - the problem remained even with no code here.
    // Calculate the amount of light at the pixel from distance and angle and modify intensity.
    lightIntensity *= g_pointLights[i].brightness / (fromLightToPixel.w * fromLightToPixel.w);
    // Add this light's color to the total amount of light the pixel receives from point lights.
    totalPointLightColor += lightIntensity * g_pointLights[i].color.rgb;
    I compile shaders with D3DCompileFromFile() method, using the following flags:
    shaderFlags = D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_DEBUG
    | D3DCOMPILE_SKIP_OPTIMIZATION | D3DCOMPILE_PREFER_FLOW_CONTROL;
    I tried to compile in release config with the following flags:
    shaderFlags = D3DCOMPILE_ENABLE_STRICTNESS | D3DCOMPILE_OPTIMIZATION_LEVEL3;
    But nothing seriously changes - only a couple less ASM instructions here and there, the main problem still remained. I should add that I have zero to none knowledge of ASM, and understand what's happening mostly thanks to comments Visual Studio / FXC generates
    in debug compilation mode.
    So, when I compile my whole deferred shader (including the part above), I get
    414 instructions in ASM, and performance is fine. If I uncomment only 1 line with CAPSED comment in the section above (which actually does nothing, as you can see), I get
    476 instructions, and I get huge FPS hiccups. When I check output ASM code, I can clearly see, that the line I uncommented produces no code in ASM at all, but somehow it makes many parts of compiled shader to change.
    For example, the loop above with commented line looks like the following in ASM:
    # Loop starts.
    loop
    # Loop index check and increment, as I can understand.
    uge r6.w, r5.w, cb0[1].x
    breakc_nz r6.w
    imul null, r6.w, r5.w, l(3)
    # Calculate <fromLightToPixel>.
    # cb6 - constant buffer that stores point lights.
    # Array access is done simply via [] operator.
    add r10.xyz, r3.xyzx, -cb6[r6.w + 1].xyzx
    dp3 r7.w, r10.xyzx, r10.xyzx
    sqrt r8.w, r7.w
    # Distance check.
    lt r8.w, cb6[r6.w + 1].w, r8.w
    if_nz r8.w
    iadd r8.w, r5.w, l(1)
    mov r5.w, r8.w
    continue
    endif
    # Normalization.
    rsq r8.w, r7.w
    mul r10.xyz, r8.wwww, r10.xyzx
    # Calculate <lightIntensity>.
    dp3_sat r8.w, r1.xywx, -r10.xyzx
    # Check <lightIntensity>.
    ge r9.w, l(0.000000), r8.w
    if_nz r9.w
    iadd r9.w, r5.w, l(1) // r9.w <- i
    mov r5.w, r9.w // r5.w <- i
    continue
    endif
    # Update <lightIntensity>. Note [] operator.
    div r7.w, cb6[r6.w + 0].w, r7.w
    mul r7.w, r7.w, r8.w
    # etc.
    endloop
    When I
    uncomment that 1 line, the ASM is growing heavily (by 62 instructions!), and this is how it starts to look like:
    # Loop starts.
    loop
    # Loop index check, but no <imul> instruction, why?
    uge r6.w, r5.w, cb0[1].x
    breakc_nz r6.w
    # Here comes some new code...
    # Indices are obviously related to the size of the point lights' constant buffer (16 elements).
    ieq r10.xyzw, r5.wwww, l(0, 1, 2, 3)
    ieq r11.xyzw, r5.wwww, l(4, 5, 6, 7)
    ieq r12.xyzw, r5.wwww, l(8, 9, 10, 11)
    ieq r13.xyzw, r5.wwww, l(12, 13, 14, 15)
    # And this part is also new...
    and r14.xyzw, r10.xxxx, cb6[1].xyzw
    and r15.xyzw, r10.yyyy, cb6[4].xyzw
    or r14.xyzw, r14.xyzw, r15.xyzw
    and r15.xyzw, r10.zzzz, cb6[7].xyzw
    or r14.xyzw, r14.xyzw, r15.xyzw
    # 26 more lines of such and/or pairs.
    # Calculate <fromLightToPixel> - finally! Why so much code instead of simple [] operator?
    add r14.xyz, r3.xyzx, -r14.xyzx
    dp3 r6.w, r14.xyzx, r14.xyzx
    sqrt r7.w, r6.w
    # Distance check.
    lt r7.w, r14.w, r7.w
    if_nz r7.w
    iadd r7.w, r5.w, l(1)
    mov r5.w, r7.w
    continue
    endif
    # Normalization.
    rsq r7.w, r6.w
    mul r14.xyz, r7.wwww, r14.xyzx
    # Calculate <lightIntensity>.
    dp3_sat r7.w, r1.xywx, -r14.xyzx
    # Check <lightIntensity>.
    ge r8.w, l(0.000000), r7.w
    if_nz r8.w
    iadd r8.w, r5.w, l(1)
    mov r5.w, r8.w
    continue
    endif
    # Here we go again - more code!
    and r15.xyzw, r10.xxxx, cb6[0].wxyz
    and r16.xyzw, r10.yyyy, cb6[3].wxyz
    or r15.xyzw, r15.xyzw, r16.xyzw
    and r16.xyzw, r10.zzzz, cb6[6].wxyz
    or r15.xyzw, r15.xyzw, r16.xyzw
    # 26 more lines of such and/or pairs.
    # Update <lightIntensity> - finally! Why no [] operator here, but tons of those instructions?
    div r6.w, r10.x, r6.w
    mul r6.w, r6.w, r7.w
    # etc.
    endloop
    I tried to save current array element to temp variable at the beginning of the loop, but it makes no difference - only several more instructions are added to copy the data.
    I just can't understand, why in the first case loop is translated into such small and logic code where array access is done via single
    [] operator, but in the second one it expands to such enormous bunch of instructions? And I change only 1 line of code, nothing more (and that line does nothing actually - it even has no ASM representation)! But every array access seems to
    be affected with this change.
    Can someone please explain that to me? Is there some sort of tricks with array indexing or loops in HLSL? I tried to find something about it on the Internet to no avail. Seems like I miss something very simple and obvious, but I don't get it. Sadly I
    work mostly alone by now and know nobody familiar with ASM / HLSL / Direct3D. Answering this question on another popular developer resource brought no result.
    Big thanks in advance for any tips or explanations!

    The latest version may help with this. 11.9.900.170 is now a step back.
    12.0.0.38  is here: http://get.adobe.com/flashplayer/
    or download the FULL installer here: Flash Player 12 (Mac OS X)

  • Trying to create cmp correctly(auto-increment);error while running

    I am using the latest versions of Jboss(4.0.5.GA) and Lomboz(R-3.2-200610201336) along with SQL Server 2005 and Microsoft's SQL Server 2005 JDBC driver.
    Lomboz used xdoclet to create the java files based on the SQL table but it did not put anything in the DoctorBean.java file telling it that the primary key was auto-incremented.
    Using the JSP files, I can retreive data out of the database fine so I know the connection and drivers are set up properly.
    Here is the error:
    09:16:46,815 WARN  [ServiceController] Problem starting service jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
    java.lang.StringIndexOutOfBoundsException: String index out of range: 0
        at java.lang.String.charAt(Unknown Source)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClassLocally(RepositoryClassLoader.java:197)
        at org.jboss.mx.loading.UnifiedLoaderRepository3.loadClassFromClassLoader(UnifiedLoaderRepository3.java:277)
        at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:284)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
        at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
        at org.jboss.mx.loading.LoaderRepositoryClassLoader.loadClass(LoaderRepositoryClassLoader.java:90)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.util.loading.DelegatingClassLoader.loadClass(DelegatingClassLoader.java:89)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityCommandMetaData.<init>(JDBCEntityCommandMetaData.java:73)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCEntityMetaData.<init>(JDBCEntityMetaData.java:952)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCApplicationMetaData.<init>(JDBCApplicationMetaData.java:378)
        at org.jboss.ejb.plugins.cmp.jdbc.metadata.JDBCXmlFileLoader.load(JDBCXmlFileLoader.java:89)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.loadJDBCEntityMetaData(JDBCStoreManager.java:736)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.initStoreManager(JDBCStoreManager.java:424)
        at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.start(JDBCStoreManager.java:368)
        at org.jboss.ejb.plugins.CMPPersistenceManager.start(CMPPersistenceManager.java:172)
        at org.jboss.ejb.EjbModule.startService(EjbModule.java:414)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:417)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy25.start(Unknown Source)
        at org.jboss.ejb.EJBDeployer.start(EJBDeployer.java:662)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
        at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
        at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
        at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
        at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy26.start(Unknown Source)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy8.deploy(Unknown Source)
        at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
        at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
        at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
        at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
        at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
        at $Proxy0.start(Unknown Source)
        at org.jboss.system.ServiceController.start(ServiceController.java:417)
        at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy4.start(Unknown Source)
        at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
        at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
        at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
        at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
        at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
        at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
        at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
        at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
        at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
        at $Proxy5.deploy(Unknown Source)
        at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
        at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
        at org.jboss.Main.boot(Main.java:200)
        at org.jboss.Main$1.run(Main.java:490)
        at java.lang.Thread.run(Unknown Source)
    09:16:46,862 INFO  [EJBDeployer] Deployed: file:/C:/java/jboss-4.0.5.GA/server/default/deploy/MedicalEJB.jar
    09:16:46,987 INFO  [TomcatDeployer] deploy, ctxPath=/MedicalWeb, warUrl=.../tmp/deploy/tmp63256MedicalWeb-exp.war/
    09:16:47,315 INFO  [TomcatDeployer] deploy, ctxPath=/jmx-console, warUrl=.../deploy/jmx-console.war/
    09:16:47,503 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
    --- MBeans waiting for other MBeans ---
    ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
      State: FAILED
      Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 0
    --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
    ObjectName: jboss.j2ee:service=EjbModule,module=MedicalEJB.jar
      State: FAILED
      Reason: java.lang.StringIndexOutOfBoundsException: String index out of range: 01Simple Doctor table:
    CREATE TABLE [dbo].[Doctors](
        [DoctorId] [int] IDENTITY(1,1) NOT NULL,
        [firstName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [lastName] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    CONSTRAINT [PK_Doctors] PRIMARY KEY CLUSTERED
        [DoctorId] ASC
    )WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]Most of DoctorBean.java was createded automatically with xdoclet, I created these items manually but with no success:
    * @jboss.entity-command
    * name="mssql-get-generated-keys"
    * @jboss.unknown-pk
    * class="java.lang.Integer"
    * column-name="doctorid"
    * field-name="doctorid"
    * jdbc-type="INTEGER"
    * sql-type="int"
    * auto-increment="true"DoctorBean.java:
    package com.bdintegrations.MedicalApp.EJB;
    import java.rmi.RemoteException;
    import javax.ejb.EJBException;
    import javax.ejb.EntityContext;
    import javax.ejb.RemoveException;
    * <!-- begin-xdoclet-definition -->
    * @ejb.bean name="Doctor"
    *    jndi-name="Doctor"
    *    type="CMP"
    *  primkey-field="doctorid"
    *  schema="DoctorSCHEMA"
    *  cmp-version="2.x"
    *  @ejb.persistence
    *   table-name="dbo.Doctors"
    * @ejb.finder
    *    query="SELECT OBJECT(a) FROM DoctorSCHEMA as a" 
    *    signature="java.util.Collection findAll()" 
    * @ejb.pk
    *  class="java.lang.Object"
    *  generate="false"
    * @jboss.entity-command
    * name="mssql-get-generated-keys"
    * @jboss.unknown-pk
    * class="java.lang.Integer"
    * column-name="doctorid"
    * field-name="doctorid"
    * jdbc-type="INTEGER"
    * sql-type="int"
    * auto-increment="true"
    * @jboss.persistence
    * datasource="java:/MSSQLDS"
    * datasource-mapping="MS SQLSERVER2005"
    * table-name="dbo.Doctors"
    * create-table="false" remove-table="false"
    * alter-table="false"
    * <!-- end-xdoclet-definition -->
    * @generated
    public abstract class DoctorBean implements javax.ejb.EntityBean {
         * <!-- begin-user-doc -->
         * The  ejbCreate method.
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.create-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public java.lang.Object ejbCreate(String firstName, String lastName) throws javax.ejb.CreateException {
            setFirstname(firstName);
            setLastname(lastName);
            return null;
            // end-user-code
         * <!-- begin-user-doc -->
         * The container invokes this method immediately after it calls ejbCreate.
         * <!-- end-user-doc -->
         * @generated
        public void ejbPostCreate() throws javax.ejb.CreateException {
            // begin-user-code
            // end-user-code
         * <!-- begin-user-doc -->
         * CMP Field doctorid
         * Returns the doctorid
         * @return the doctorid
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="DoctorId"
         *     jdbc-type="INTEGER"
         *     sql-type="int identity"
         *     read-only="false"
         * @ejb.pk-field
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.Integer getDoctorid();
         * <!-- begin-user-doc -->
         * Sets the doctorid
         * @param java.lang.Integer the new doctorid value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setDoctorid(java.lang.Integer doctorid);
         * <!-- begin-user-doc -->
         * CMP Field firstname
         * Returns the firstname
         * @return the firstname
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="firstName"
         *     jdbc-type="VARCHAR"
         *     sql-type="varchar"
         *     read-only="false"
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.String getFirstname();
         * <!-- begin-user-doc -->
         * Sets the firstname
         * @param java.lang.String the new firstname value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setFirstname(java.lang.String firstname);
         * <!-- begin-user-doc -->
         * CMP Field lastname
         * Returns the lastname
         * @return the lastname
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.persistent-field
         * @ejb.persistence
         *    column-name="lastName"
         *     jdbc-type="VARCHAR"
         *     sql-type="varchar"
         *     read-only="false"
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract java.lang.String getLastname();
         * <!-- begin-user-doc -->
         * Sets the lastname
         * @param java.lang.String the new lastname value
         * <!-- end-user-doc -->
         * <!-- begin-xdoclet-definition -->
         * @ejb.interface-method
         * <!-- end-xdoclet-definition -->
         * @generated
        public abstract void setLastname(java.lang.String lastname);
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbActivate()
        public void ejbActivate() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbLoad()
        public void ejbLoad() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbPassivate()
        public void ejbPassivate() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbRemove()
        public void ejbRemove() throws RemoveException, EJBException,
                RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#ejbStore()
        public void ejbStore() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#setEntityContext(javax.ejb.EntityContext)
        public void setEntityContext(EntityContext arg0) throws EJBException,
                RemoteException {
            // TODO Auto-generated method stub
        /* (non-Javadoc)
         * @see javax.ejb.EntityBean#unsetEntityContext()
        public void unsetEntityContext() throws EJBException, RemoteException {
            // TODO Auto-generated method stub
        public DoctorBean() {
            // TODO Auto-generated constructor stub
    }JSP client page snippet:
    <%
    DoctorHome home = DoctorUtil.getHome();
    Doctor doctor = home.create("Jon","Smith");
    %>
    <%=doctor.getDoctorid() %>thanks

    Nevermind.. no one bothered to inform the developer that the path to the collection AND the path to the directory that the collection is for are different on this other server.
    Fixed.

  • How to get auto-increment value after insert on ACCESS db?

    When you insert a new record to a table with an auto-incrementing key, how do you find the value for the row you just inserted? This works differently with different databases. I know how it's done on ORACLE and mySql.
    How does it work with ACCESS through ODBC? How about MSSQL?

    I have discovered there's a LAST aggregate function which when I've tested it gets the just inserted auto-increment, but I'm not sure if it's reliable. You have to do:
    SELECT LAST(index-field) FROM table
    That ought to be faster than MAX, which I've noticed some people use. Persumable LAST will get the value from the last row in the table's natural order.
    In fact an auto-increment field has no business filling in missing slots since the main point is a a foreign key in other tables and a foreign key pointing to a deleted table row ought to be invalidated, not point to some unrelated successor record.
    I could use a separate table as a source of counters, of course, though that's one more call. In either case I'm worried about thread safety. In Oracle there are special sequence objects for this purpose which are incremented and read atomically. I'm not sure if the access driver transaction handling works adequately.
    Perhaps the safest approach might be to use a separate sequencer table and Java sychronisation to serialise access to each row in the sequencer table (assuming all the access is from the same app).

  • Auto Increment in hibernate

    Hello every one,
    i have to write the code that used for diffrent databases like oracle,sql-server2000..
    the problem has generated at the auto increment field...
    the problem is as follows....
    1) Identity field in sql-server but not in oracle because for oracle it uses index
    i try like
    <id name="id" column="id">
    <generator class="increment"/>
    </id>
    it works fine for oracle but not for sql-server and ....
    <id name="id" column="id">
    <generator class="identity"/>
    </id>
    it works fine for sql-server but not for oracle because the id field is not null and it gives error that null field is not allowed ....
    is there any other solution....then please help me
    thanks
    pandev84

    hello frnd,
    thanx for reply..
    but how can i map these files in config file...
    pls help..
    thanx and regards,
    Pandev84If you can't be bothered to spell out these words, and historically you also can't be bothered to answer questions or read documentation (hint: the answer to your question can be found here http://hibernate.org) why should people help you?

  • How can I automatically increment an auto incremented column?

    Hello!
    I have a table with an auto incremented "id" field.
    It looks like this:
    id (PK, auto_increment) name address phone
    I would like to make an insertion like:
    INSERT INTO Person (name, address, phone) VALUES (?,?,?)
    ...but it says that all fields have to be used.
    I get
    java.sql.SQLException: Field 'id' doesn't have a default value
    How can I bypass this?
    I have looked at [this example|http://blog.taragana.com/index.php/archive/java-how-to-get-auto-increment-values-after-sql-insert/] , but it didn´t work for me, it still says the "id" column has not a default value:

    Sorry, it is a MySQL database.
    The table consists of 4 columns:
    id (PK, auto_increment)
    name (Varchar)
    address (Varchar)
    phone (Varchar)
    If I use PHPMyAdmin to insert a new row, then this query works:
    INSERT INTO `mydb`.`person` (
    `id` ,
    `name` ,
    `address` ,
    `phone`
    VALUES (
    NULL , 'Test', 'Roxxor', 'Europe', '12345'
    );{code}I tested to use the method setNull() on the first column in the preparedStatement but it didn&acute;t work.
    Do you need more info from me to be able to help me?
    I have tried this (but got the error that the "Field 'id' doesn't have a default value"):
    [code]con.setAutoCommit(true);
                String query = "INSERT INTO person(id, name, address, phone) VALUES (?, ?, ?, ?)";
                PreparedStatement stmt = con.prepareStatement(query);
                stmt.setNull(1, java.sql.Types.NULL);
                stmt.setString(2, name); 
                stmt.setString(3, address);     
                stmt.setString(4, phone); 
                stmt.executeUpdate(); 
                stmt.close();[/code]                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Gets the new id of auto-increment field by jdbc

    There is a auto-increment index field of a table. I would like to add a row in that table by jdbc. The process is success and the index will increase automatically. However i would like to get the newly added index number. How can i do this? Thanks a lot.

    This is off of Microsoft's T-SQL site http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_tsqlcon_6lyk.asp
    @@IDENTITY and SCOPE_IDENTITY will return the last identity value generated in any table in the current session. However, SCOPE_IDENTITY returns the value only within the current scope; @@IDENTITY is not limited to a specific scope.
    IDENT_CURRENT is not limited by scope and session; it is limited to a specified table. IDENT_CURRENT returns the identity value generated for a specific table in any session and any scope. For more information, see IDENT_CURRENT.

  • Auto increment field in database issue

    Ok, I have read all about the issues with the auto increment field when trying to hook my form up to a ms access database.
    My problem is that the auto increment field is the one field I want in my form.
    Any suggestions how to create a new record with my form? its a simple database, date field, and PO number (the auto incremented field)
    Just trying to get a fresh PO number on my PO form each time its filled out....

    I have a vital form that clients fill out, which is passed to many people in the company along the workflow. The form is a Planner and we have in the following PDF, Word Doc..
    Well before, the Planner.pdf was originally created in Word, since most people have access to Word.. but evolved to a PDF form created from the Word Doc via Adobe LiveCycle Designer 8.0 w/ User Rights enabled so that the form could be filled out and saved using Adobe Reader.. which was a step better than Word.. being that it is free. But this needed to be easier and more to the point b/c some clients don't particularly like installing the latest version of Reader, even if you provide them the link. Nor do they like saving the form, filling the form, and attaching the form to send back.
    My goal is to have the client fill an HTML version of the form, submit and be done with it, but everyone in the workflow be able to easily receive the filled Planner as a PDF form.
    So some months ago I ran into this post Chris Trip, "Populate Livecycle PDF from mySQL database using PHP" #8, 22 Sep 2007 4:37 pm
    which uses the command line Win32 pdftk.exe to merge an FDF file into an existing PDF on the remote server, and serve this to whoever.
    My problem was with shared hosting and having the ability to use the Win32 pdftk.exe along with PHP which is predominantly used on Linux boxes. And we used a Linux box.
    so i created the following unorthodox method, which a client fills the HTML version of the Planner, all field values are INSERTED into a table in MySQL DB, I and all filled planners that have been filled by clients to date can be viewed from a repository page where an XML file is served up of the corresponding client, but someone would have to have Acrobat Professional, to import the form data from the XML file into a blank form.. altoughh this is simple for me.. I have the PHP file already created so that when a Planner is filled and client submits. >> the an email is sent to me with a table row from the repository of the client name, #, email, and a link to d-load the XML file,
    But I also have the PHP files created so that the Planner can be sent to by email to various people in the workflow with certain fileds ommitted they they do not need to see, but instead of the XML file beiong served up i need the filled PDF Planner to be served.
    I can do this locally with ease on a testing server, but I am currently trying to use another host that uses cross-platform compatibility so i can use PHP and the pdftk.exe to achieve this, as that is why I am having to serve up an XML file b/c we use a Linux server for our website, and cant execute the exe.
    Now that I am testing the other server (cross-platform host), just to use them to do the PDF handling (and it's only $5 per month) I am having problems with getting READ, WRITE, EXECUTE permissions..
    Si guess a good question to ask is can PHP do the same procedure as the pdftk.exe, and i can eleminate it.
    or how in the heck can i get this data from the DB into a blank PDF form, like i have described??
    here are some link to reference
    Populating a LiveCycle PDF with PHP and MySQL
    http://www.andrewheiss.com/Tutorials?page=LiveCycle_PDFs_and_MySQL
    HTML form that passed data into a PDF
    http://www.mactech.com/articles/mactech/Vol.20/20.11/FillOnlinePDFFormsUsingHTML/index.htm l
    and an example
    http://accesspdf.com/html_pdf_form/

  • Composite Primary Key or Auto Increment key ?

    Hi.. i have two ways for make something and don't know what's better ......
    Problem : 3 tables
    Client ----> ( 1,* ) Activity -----> (1,1) ActivityAccreditation
    A Client it can have one or more activities, and one Activity have one ActivityAccreditation. On Client the primary key is CLIENT_ID, the two ways for generate the keys on the other tables are :
    a ) On Activity the primary key is composed by CLIENT_ID and SEQUENCE_ACTIVITY ( a number than increment value by CLIENT_ID, example : CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 3 for three activities, and CLIENT_ID = 1122 could have SEQUENCE_ACTIVITY from 1 to 4 for four activities ), and ActivityAccreditation have CLIENT_ID and SEQUENCE_ACTIVITY and ACCREDITATION_TYPE ( a code ).
    b) On Activity the primary key is ACTIVITY_ID ( auto increment number ) with the CLIENT_ID like foreign key only. And on ActivityAccreditation have ACTIVITY_ACCREDITATION_ID like primary key and ACTIVITY_ID like foreign key.
    The situation is than the numer of rows could to grow very much in the time ( 3.000.000 rows on ActivityAccreditation in one year and the database to be supported each five years ) and we don't know what solution is better by performance......
    Tks.

    I prefer the surrogate key.
    I don't like composite keys as a rule because they tend to inject business logic into keys. Using surrogate keys eliminates this possibility.
    For performance reasons, this means that you might want to create additional indexes on those columns to facilitate fast access. But my prejudice is to stick with surrogate keys.
    I will admit that I'm not a DBA, so there are certain to be alternative views and arguments. We'll see if any of them pop up on this thread.

  • LINQ: Update a column with auto increment value

    Hi All,
    Greetings.
    I am very new to C# (though with lot of experience in VC++). Now a days, I am engaged in a C# project where I need to deal with ADO.NET DataTable and related classes. I am stuck up in a scenario as follows:
    I have a data table (of DataTable type) pre-populated with many rows (50000+), parsed from a log file. Now I need to add a column that will be holding index number for each records; eg. 1, 2, 3......
    I have tried to add the auto-incremented column dynamically, with seed = 0 and increment = 1, but it is not working.
    Is there any LINQ query that I can run to update the DataTable at once? Or foreach loop per DataRow is the only option here?
    I appreciate any quick suggestion on this.
    Thanks in advance.
    Sanjoy Jana.

    You should add the auto increment column to the DataTable before you pouplate it with the other data:
    //1. Create a datatable
    DataTable dt = new DataTable();
    //2. add the autoincrement column:
    DataColumn column = new DataColumn();
    column.DataType = System.Type.GetType("System.Int32");
    column.AutoIncrement = true;
    column.AutoIncrementStep = 1;
    column.AutoIncrementSeed = 1;
    //3. Fill the dataTable using an SqlDataAdapter or whatever
    dt.Columns.Add(new DataColumn("name"));
    dt.Rows.Add("1");
    dt.Rows.Add("2");
    dt.Rows.Add("3");
    dt.Rows.Add("4");
    Then you don't have to add the "auto incremented" values yourself in some kind of a loop (using for example LINQ or foreach).
    If you want to know how to poplulate the DataTable from a database query using an adapter, please refer to the following page:
    http://www.dotnetperls.com/sqldataadapter
    Hope that helps.
    Please remember to mark helpful posts as answer to close your threads and then start a new thread if you have a new question.

  • Auto increment option

    Is there any option for auto increment the values in the tables. for example if we are inserting 100 data's for first data i should specify 1 and for second data it should specify 2 and goes on.

    Hi,
    Use Sy-tabix in between loop and endloop.
    or sy-index = sy-index + 1.
    Check this Example.
    TABLES:MARA.
              Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    RANGES:S_MATNR FOR MARA-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
    INITIALIZATION.
      S_MATNR-LOW = '000000000000000001'.
      S_MATNR-HIGH = '0000000000001000'.
      S_MATNR-SIGN = 'E'.
      S_MATNR-OPTION = 'BT'.
      APPEND S_MATNR.
      CLEAR S_MATNR.
                Internal Table
      DATA:BEGIN OF ITAB OCCURS 0,
           MATNR LIKE MARA-MATNR,
           ERSDA LIKE MARA-ERSDA,
           ERNAM LIKE MARA-ERNAM,
           NTGEW LIKE MARA-NTGEW,
           END OF ITAB.
                Start of Selection
    START-OF-SELECTION.
      SELECT MATNR
             ERSDA
             ERNAM
             NTGEW FROM MARA INTO TABLE ITAB WHERE MATNR IN S_MATNR.
      LOOP AT ITAB.
        WRITE:/ SY-TABIX,ITAB-MATNR.
      ENDLOOP.

  • Does all RDBMS support auto-increment field?

    Hi,
    I am designing a java application in which I have to write some logic to auto-increment one database field. Can anyone tell me that all the databases support the auto-increment fields.
    Thanks in advance.
    Chris

    There seem to be two kinds of facility for this in databases. One kind has an auto-increment field. Unfortunately they aren't consistent about how you obtain the value just created after an insert (which you almost invariably require to know). Generally you use a select statement to pick up the value of some kind of last row index function, but the name and syntax varies.
    The other kind uses a separate object in the database called a SEQUENCE. You create this with a CREATE SEQUENCE statment, and generally you reference nextval(sequence_name) in the default attribute of the database field.
    To get the last allocated sequence number you use select currval(sequence_name)
    Again the syntax is a bit inconsistent. You should also probably use transaction isolation if someone else might be incrementing the same sequence.

  • Web Analysis report error : Array Index out of range :1

    while running from workspace , below error is being thrown after making few changes to the layout (e.g. moving Measures from Page to Row ) though Design for HTML setting applied.
    Array Index out of range :1
    These reports are running well in WA studio.
    Can any one advise on this please.

    Array index out of range: 1The only time you will get that error is when you are accessing an elements index that is not present in the actual indexes in that array

Maybe you are looking for