compileflow | 🎨 core business process engine of Alibaba Halo platform | BPM library

 by   alibaba Java Version: v1.2.0 License: Apache-2.0

kandi X-RAY | compileflow Summary

compileflow is a Java library typically used in Automation, BPM applications. compileflow has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.
Compileflow is a very lightweight, high-performance, integrable and extensible process engine. The Compileflow process engine is an important part of Taobao Business Process Management(TBBPM), which is dedicated to optimizating operations at Alibaba’s Taobao Marketplace. Specifically, Compileflow is designed to focus on pure memory execution and stateless process engines by converting process files to generate, compile and execute java code. Currently, compileflow powers multiple core systems such as Alibaba's e-commerce stores and transactions. Compileflow allows developers to design their own business processes through the process editor, which will visualize complex business logic, and build a bridge between designers and development engineers.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        compileflow has a medium active ecosystem.
                        summary
                        It has 1374 star(s) with 216 fork(s). There are 42 watchers for this library.
                        summary
                        There were 1 major release(s) in the last 12 months.
                        summary
                        There are 18 open issues and 27 have been closed. On average issues are closed in 70 days. There are 8 open pull requests and 0 closed requests.
                        summary
                        It has a neutral sentiment in the developer community.
                        summary
                        The latest version of compileflow is v1.2.0
                        compileflow Support
                          Best in #BPM
                            Average in #BPM
                            compileflow Support
                              Best in #BPM
                                Average in #BPM

                                  kandi-Quality Quality

                                    summary
                                    compileflow has 0 bugs and 0 code smells.
                                    compileflow Quality
                                      Best in #BPM
                                        Average in #BPM
                                        compileflow Quality
                                          Best in #BPM
                                            Average in #BPM

                                              kandi-Security Security

                                                summary
                                                compileflow has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                summary
                                                compileflow code analysis shows 0 unresolved vulnerabilities.
                                                summary
                                                There are 0 security hotspots that need review.
                                                compileflow Security
                                                  Best in #BPM
                                                    Average in #BPM
                                                    compileflow Security
                                                      Best in #BPM
                                                        Average in #BPM

                                                          kandi-License License

                                                            summary
                                                            compileflow is licensed under the Apache-2.0 License. This license is Permissive.
                                                            summary
                                                            Permissive licenses have the least restrictions, and you can use them in most projects.
                                                            compileflow License
                                                              Best in #BPM
                                                                Average in #BPM
                                                                compileflow License
                                                                  Best in #BPM
                                                                    Average in #BPM

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        compileflow releases are available to install and integrate.
                                                                        summary
                                                                        Deployable package is available in Maven.
                                                                        summary
                                                                        Build file is available. You can build the component from source.
                                                                        summary
                                                                        Installation instructions, examples and code snippets are available.
                                                                        summary
                                                                        compileflow saves you 7374 person hours of effort in developing the same functionality from scratch.
                                                                        summary
                                                                        It has 15236 lines of code, 1408 functions and 433 files.
                                                                        summary
                                                                        It has low code complexity. Code complexity directly impacts maintainability of the code.
                                                                        compileflow Reuse
                                                                          Best in #BPM
                                                                            Average in #BPM
                                                                            compileflow Reuse
                                                                              Best in #BPM
                                                                                Average in #BPM
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi has reviewed compileflow and discovered the below as its top functions. This is intended to give you an instant insight into compileflow implemented functionality, and help decide if they suit your requirements.
                                                                                  • Generate the code for the flow node
                                                                                    • Returns the Java object type corresponding to the given type
                                                                                    • Generate code for flow node
                                                                                  • Compile the given Java source
                                                                                    • Gets the error message
                                                                                  • Entry point for the download
                                                                                    • Downloads a file from an URL
                                                                                  • Returns a string representation of the data type
                                                                                  • Convert a type to a simple data type
                                                                                  • Get the simple data type for the passed class
                                                                                  • Returns the simple data type for the given type
                                                                                  • Get data type by simple type
                                                                                  • Parses the subbpm node
                                                                                  • ParseBpmNode
                                                                                  • Get the DataType definition for the given type
                                                                                  • Writes Bpm XML element
                                                                                  • Parse the loop node
                                                                                  • Check if the type is simple data type
                                                                                  • Generate the codeTargetSupport
                                                                                  • Build plugin config from properties
                                                                                  • Returns true if the type is full class name
                                                                                  • Generate the code for the loop
                                                                                  • Sets a prepared prepare statement parameter
                                                                                  • Parses the xml source
                                                                                  • Generate code for loop condition
                                                                                  • Generate the code target
                                                                                  Get all kandi verified functions for this library.
                                                                                  Get all kandi verified functions for this library.

                                                                                  compileflow Key Features

                                                                                  1.High performance: It is simple and efficient for compiling and executing java code, which is generated by converting process files. 2.Diverse application scenarios: Widely used across Alibaba's mid-platform solutions; supports multiple business scenarios such as shopping guides, transactions. 3.Integrable: Lightweight and concise design makes it extremely easy to integrate into various solutions and business scenarios. 4.Complete plugin support: Compileflow is currently supported by IntelliJ IDEA and Eclipse plugins. Java code can be dynamically generated and previewed in real-time during the process design. What you see is what you get. 5.Process design drawing:Supports exporting to SVG file and unit test code.

                                                                                  compileflow Examples and Code Snippets

                                                                                  No Code Snippets are available at this moment for compileflow.
                                                                                  Community Discussions

                                                                                  Trending Discussions on BPM

                                                                                  Camunda embedded with H2: Cockpit Login fails
                                                                                  chevron right
                                                                                  Plot line from dataframe
                                                                                  chevron right
                                                                                  Camunda Application not starting up on docker container
                                                                                  chevron right
                                                                                  Renaming some part of columns of dataframe with values from another dataframe
                                                                                  chevron right
                                                                                  How to separate Camunda tables to a different schema?
                                                                                  chevron right
                                                                                  How to convert json MySQL data into rows and column
                                                                                  chevron right
                                                                                  Using pyaudio to build a Metronome; wrong timing
                                                                                  chevron right
                                                                                  Why am I getting "Error processing transaction request: intrinsic gas too low" error when trying to add tUSDT to a particular account?
                                                                                  chevron right
                                                                                  getting a KeyNotFoundException on a key that appears to exist in a dictionary
                                                                                  chevron right
                                                                                  Webaudio timing performance
                                                                                  chevron right

                                                                                  QUESTION

                                                                                  Camunda embedded with H2: Cockpit Login fails
                                                                                  Asked 2022-Mar-09 at 08:50

                                                                                  I'm currently wokring on a product with the following conditions:

                                                                                  • Spring-Boot (2.6) with Camunda embedded (7.16)
                                                                                  • Connection to Camunda configured to use H2 (2.1.210) embedded with the following is configured in application.yml:
                                                                                  app:
                                                                                    datasource-camunda:
                                                                                      jdbcUrl: jdbc:h2:./h2/test;MODE=LEGACY
                                                                                  camunda:
                                                                                    bpm:
                                                                                      database:
                                                                                        schema-update: true
                                                                                      auto-deployment-enabled: true
                                                                                  

                                                                                  and as Java-Configuration:

                                                                                  @Bean("camundaBpmDataSource")
                                                                                  @ConfigurationProperties
                                                                                  public DataSource camundaDataSource() {
                                                                                    return DataSourceBuilder.create().build();
                                                                                  }
                                                                                  
                                                                                  @Bean
                                                                                  public PlatformTransactionManager camundaBpmTransactionManager(DataSource datasource) {
                                                                                    return new DataSourceTransactionManager(datasource)
                                                                                  }
                                                                                  

                                                                                  The camunda engine is not configured explicitly since I used the appropriate starter and let Spring auto configured it. As a result the resulting setup should look very similar to the embedded camunda h2 configuration showed here: https://docs.camunda.org/get-started/spring/embedded-process-engine/

                                                                                  The application runs good with this setup. No problems with the application at all, but I faced an issue while logging in to the camunda cockpit. Login succeeds but then I see an error in the login mask saying:

                                                                                  Login Failed

                                                                                  An exception occured in the persistence layer. Please check the server logs for a detailed message and the entire exception stack trace

                                                                                  
                                                                                  
                                                                                  Caused by: org.h2.jdbc.JdbcSQLNonTransientException: Unbekannter Datentyp: "?2"
                                                                                  
                                                                                  Unknown data type: "?2"; SQL statement:
                                                                                  
                                                                                  SELECT
                                                                                  
                                                                                      CASE
                                                                                  
                                                                                   
                                                                                  
                                                                                       
                                                                                  
                                                                                         
                                                                                  
                                                                                          WHEN
                                                                                  
                                                                                            
                                                                                  
                                                                                             
                                                                                  
                                                                                            EXISTS
                                                                                  
                                                                                            
                                                                                  
                                                                                              (SELECT
                                                                                  
                                                                                                      A.RESOURCE_ID_
                                                                                  
                                                                                               FROM
                                                                                  
                                                                                                      ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                               WHERE
                                                                                  
                                                                                                      A.TYPE_ = 1
                                                                                  
                                                                                               AND
                                                                                  
                                                                                                      A.USER_ID_ = ?
                                                                                  
                                                                                               AND
                                                                                  
                                                                                                      BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                               AND
                                                                                  
                                                                                                      A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                               AND
                                                                                  
                                                                                                      A.RESOURCE_ID_ =  ? )
                                                                                  
                                                                                          THEN 1
                                                                                  
                                                                                        
                                                                                  
                                                                                   
                                                                                  
                                                                                       
                                                                                  
                                                                                         
                                                                                  
                                                                                   
                                                                                  
                                                                                       
                                                                                  
                                                                                        WHEN
                                                                                  
                                                                                          EXISTS
                                                                                  
                                                                                            (SELECT
                                                                                  
                                                                                                    ID_
                                                                                  
                                                                                             FROM
                                                                                  
                                                                                                    ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                             WHERE
                                                                                  
                                                                                                    A.TYPE_ = 1
                                                                                  
                                                                                             AND
                                                                                  
                                                                                                    A.USER_ID_ = ?
                                                                                  
                                                                                             AND
                                                                                  
                                                                                                    BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                             AND
                                                                                  
                                                                                                    A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                             AND
                                                                                  
                                                                                                    A.RESOURCE_ID_ = '*')
                                                                                  
                                                                                          THEN 1
                                                                                  
                                                                                   
                                                                                  
                                                                                       
                                                                                  
                                                                                         
                                                                                  
                                                                                   
                                                                                  
                                                                                        ELSE
                                                                                  
                                                                                            (
                                                                                  
                                                                                            SELECT
                                                                                  
                                                                                              CASE
                                                                                  
                                                                                                
                                                                                  
                                                                                   
                                                                                  
                                                                                                 
                                                                                  
                                                                                                   
                                                                                  
                                                                                                    WHEN
                                                                                  
                                                                                                      
                                                                                  
                                                                                                       
                                                                                  
                                                                                                      EXISTS
                                                                                  
                                                                                                      
                                                                                  
                                                                                                        (SELECT
                                                                                  
                                                                                                                A.RESOURCE_ID_
                                                                                  
                                                                                                         FROM
                                                                                  
                                                                                                                ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                                         WHERE
                                                                                  
                                                                                                                A.TYPE_ = 1
                                                                                  
                                                                                                         AND
                                                                                  
                                                                                                                A.GROUP_ID_ IN  (  ? )
                                                                                  
                                                                                                         AND
                                                                                  
                                                                                                                BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                                         AND
                                                                                  
                                                                                                                A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                                         AND
                                                                                  
                                                                                                                A.RESOURCE_ID_ =  ? )
                                                                                  
                                                                                                    THEN 1
                                                                                  
                                                                                                  
                                                                                  
                                                                                   
                                                                                  
                                                                                                 
                                                                                  
                                                                                                   
                                                                                  
                                                                                   
                                                                                  
                                                                                                 
                                                                                  
                                                                                                  WHEN
                                                                                  
                                                                                                    EXISTS
                                                                                  
                                                                                                      (SELECT
                                                                                  
                                                                                                              ID_
                                                                                  
                                                                                                       FROM
                                                                                  
                                                                                                              ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                                       WHERE
                                                                                  
                                                                                                              A.TYPE_ = 1
                                                                                  
                                                                                                       AND
                                                                                  
                                                                                                              A.GROUP_ID_ IN  (  ? )
                                                                                  
                                                                                                       AND
                                                                                  
                                                                                                              BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                                       AND
                                                                                  
                                                                                                              A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                                       AND
                                                                                  
                                                                                                              A.RESOURCE_ID_ = '*')
                                                                                  
                                                                                                    THEN 1
                                                                                  
                                                                                   
                                                                                  
                                                                                                 
                                                                                  
                                                                                                   
                                                                                  
                                                                                   
                                                                                  
                                                                                                  ELSE (
                                                                                  
                                                                                                        SELECT
                                                                                  
                                                                                                          CASE
                                                                                  
                                                                                                
                                                                                  
                                                                                                            
                                                                                  
                                                                                                             
                                                                                  
                                                                                                              WHEN
                                                                                  
                                                                                                                
                                                                                  
                                                                                                                 
                                                                                  
                                                                                                                EXISTS
                                                                                  
                                                                                                                
                                                                                  
                                                                                                                  (SELECT
                                                                                  
                                                                                                                          A.RESOURCE_ID_
                                                                                  
                                                                                                                   FROM
                                                                                  
                                                                                                                          ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                                                   WHERE
                                                                                  
                                                                                                                          A.TYPE_ = 0
                                                                                  
                                                                                                                   AND
                                                                                  
                                                                                                                          A.USER_ID_ = '*'
                                                                                  
                                                                                                                   AND
                                                                                  
                                                                                                                          BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                                                   AND
                                                                                  
                                                                                                                          A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                                                   AND
                                                                                  
                                                                                                                          A.RESOURCE_ID_ =  ? )
                                                                                  
                                                                                                              THEN 1
                                                                                  
                                                                                                            
                                                                                  
                                                                                   
                                                                                  
                                                                                                           
                                                                                  
                                                                                                             
                                                                                  
                                                                                   
                                                                                  
                                                                                                           
                                                                                  
                                                                                                            WHEN
                                                                                  
                                                                                                              EXISTS
                                                                                  
                                                                                                                (SELECT
                                                                                  
                                                                                                                        ID_
                                                                                  
                                                                                                                 FROM
                                                                                  
                                                                                                                        ACT_RU_AUTHORIZATION A
                                                                                  
                                                                                                                 WHERE
                                                                                  
                                                                                                                        A.TYPE_ = 0
                                                                                  
                                                                                                                 AND
                                                                                  
                                                                                                                        A.USER_ID_ = '*'
                                                                                  
                                                                                                                 AND
                                                                                  
                                                                                                                        BITAND(A.PERMS_,?) = ?
                                                                                  
                                                                                                                 AND
                                                                                  
                                                                                                                        A.RESOURCE_TYPE_ = ?
                                                                                  
                                                                                                                 AND
                                                                                  
                                                                                                                        A.RESOURCE_ID_ = '*')
                                                                                  
                                                                                                              THEN 1
                                                                                  
                                                                                   
                                                                                  
                                                                                                            
                                                                                  
                                                                                                             
                                                                                  
                                                                                   
                                                                                  
                                                                                                           
                                                                                  
                                                                                                            ELSE
                                                                                  
                                                                                                            
                                                                                  
                                                                                                             
                                                                                  
                                                                                                              null
                                                                                  
                                                                                                            
                                                                                  
                                                                                   
                                                                                  
                                                                                                
                                                                                  
                                                                                                          END
                                                                                  
                                                                                                  )
                                                                                  
                                                                                                
                                                                                  
                                                                                              END
                                                                                  
                                                                                        )
                                                                                  
                                                                                      END [50004-210]
                                                                                  
                                                                                              at org.h2.message.DbException.getJdbcSQLException(DbException.java:573) ~[h2-2.1.210.jar:2.1.210]
                                                                                  
                                                                                              at org.h2.message.DbException.getJdbcSQLException(DbException.java:496) ~[h2-2.1.210.jar:2.1.210]
                                                                                  
                                                                                              at org.h2.message.DbException.get(DbException.java:227) ~[h2-2.1.210.jar:2.1.210]
                                                                                  

                                                                                  I already took a look into the database and saw all tables where created sucesfully, so does anybody faced a similar issue?

                                                                                  ANSWER

                                                                                  Answered 2022-Mar-09 at 08:50

                                                                                  Remove the "MODE=LEGACY" from the url. Here is a working example:

                                                                                  https://github.com/rob2universe/vanilla-camunda-template/blob/4625376bf3a5eed9cd1f2853cdf07fe5eca46685/src/main/resources/application.yaml#L17

                                                                                  Also ensure you use a supported H2 version. That is 1.4.x fro 7.16.x: https://docs.camunda.org/manual/7.16/introduction/supported-environments/

                                                                                  The BOM will inclcude H2 1.4.200.

                                                                                  Source https://stackoverflow.com/questions/71391717

                                                                                  QUESTION

                                                                                  Plot line from dataframe
                                                                                  Asked 2022-Mar-04 at 17:04

                                                                                  I have the following dataframe [1] which contains information relating to music listening. I would like to print a line graph like the following 2 (I got it by putting the data manually) in which the slotID and the average bpm are related, without writing the values by hand . Each segment must be one unit long and must match the average bpm.

                                                                                  [1]

                                                                                          slotID  NUn  NTot     MeanBPM
                                                                                  2        2       3       13  107.987769
                                                                                  9       11       3       30  133.772100
                                                                                  10      12       3       40  122.354025
                                                                                  13      15       4       44  123.221659
                                                                                  14      16       4       30  129.083900
                                                                                  15      17       9       66  123.274409
                                                                                  16      18       4       25  131.323480
                                                                                  18      20       5       40  124.782625
                                                                                  19      21       6       30  127.664467
                                                                                  20      22       6       19  120.483579
                                                                                  

                                                                                  The code I used to obtain the plot is the following:

                                                                                  import numpy as np
                                                                                  import pylab as pl
                                                                                  from matplotlib import collections  as mc
                                                                                  
                                                                                  lines = [ [(2, 107), (3,107)], [(11,133),(12,133)], [(12,122),(13,122)], ]
                                                                                  c = np.array([(1, 0, 0, 1), (0, 1, 0, 1), (0, 0, 1, 1)])
                                                                                  
                                                                                  lc = mc.LineCollection(lines, colors=c, linewidths=2)
                                                                                  fig, ax = pl.subplots()
                                                                                  ax.add_collection(lc)
                                                                                  ax.autoscale()
                                                                                  ax.margins(0.1)
                                                                                  

                                                                                  To obtain data:

                                                                                  import numpy as np
                                                                                  import pandas as pd
                                                                                  
                                                                                  
                                                                                  
                                                                                  dfLunedi = pd.read_csv( "5.sab.csv", encoding = "ISO-8859-1", sep = ';')
                                                                                  
                                                                                  dfSlotMean = dfLunedi.groupby('slotID', as_index=False).agg( NSabUn=('date', 'nunique'),NSabTot = ('date', 'count'), MeanBPM=('tempo', 'mean') )
                                                                                  
                                                                                  
                                                                                  
                                                                                  df = pd.DataFrame(dfSlotMean)
                                                                                  df.to_csv('sil.csv', sep = ';', index=False)
                                                                                  
                                                                                  df.drop(df[df.NSabUn < 3].index, inplace=True)
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2022-Mar-04 at 17:04

                                                                                  You can loop through the rows and plot each segment like this:

                                                                                  for _, r in df.iterrows():
                                                                                      plt.plot([r['slotID'], r['slotID']+1], [r['MeanBPM']]*2)
                                                                                  

                                                                                  Output:

                                                                                  Source https://stackoverflow.com/questions/71354696

                                                                                  QUESTION

                                                                                  Camunda Application not starting up on docker container
                                                                                  Asked 2022-Feb-27 at 06:01

                                                                                  I have a simple cammunda spring boot application. which I want to run in a docker container

                                                                                  I am able to run it locally from IntelliJ but when I try to run it inside a docker it fails with below error message:

                                                                                  08043 Exception while performing 'Deployment of Process Application camundaApplication' => 'Deployment of process archive 'ct-camunda': The deployment contains definitions with the same key 'ct-camunda' (id attribute), this is not allowed

                                                                                  docker-compose.yml

                                                                                  version: '2'
                                                                                  
                                                                                  services:
                                                                                    myaap:
                                                                                      build: .
                                                                                      ports:
                                                                                        - "8080:8080"
                                                                                  

                                                                                  processes.yml

                                                                                  
                                                                                  
                                                                                      
                                                                                          org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration
                                                                                      
                                                                                  
                                                                                      
                                                                                          default
                                                                                          ct-camunda.bpmn
                                                                                          
                                                                                              false
                                                                                              true
                                                                                          
                                                                                      
                                                                                  
                                                                                  
                                                                                  

                                                                                  Dockerfile

                                                                                  FROM openjdk:11
                                                                                  ARG JAR_FILE=target/camunda-0.0.1-SNAPSHOT-exec.jar
                                                                                  COPY ${JAR_FILE} app.jar
                                                                                  ENTRYPOINT ["java","-jar","/app.jar"]
                                                                                  

                                                                                  Main class CamundaApplication.java

                                                                                  @SpringBootApplication
                                                                                  @EnableProcessApplication
                                                                                  public class CamundaApplication {
                                                                                  
                                                                                      public static void main(String[] args) {
                                                                                          SpringApplication.run(CamundaApplication.class, args);
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  Error logs:

                                                                                  2022-02-25 03:21:24.724  INFO 1 --- [           main] org.camunda.bpm.container                : ENGINE-08023 Deployment summary for process archive 'ct-camunda': 
                                                                                  
                                                                                  
                                                                                          ct-camunda.bpmn
                                                                                  
                                                                                          BOOT-INF/classes/ct-camunda.bpmn
                                                                                  
                                                                                  
                                                                                  2022-02-25 03:21:25.067 ERROR 1 --- [           main] org.camunda.bpm.engine.context           : ENGINE-16004 Exception while closing command context: The deployment contains definitions with the same key 'ct-camunda' (id attribute), this is not allowed
                                                                                  
                                                                                  
                                                                                  org.camunda.bpm.engine.ProcessEngineException: The deployment contains definitions with the same key 'ct-camunda' (id attribute), this is not allowed
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.ensureNoDuplicateDefinitionKeys(AbstractDefinitionDeployer.java:192) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.AbstractDefinitionDeployer.deploy(AbstractDefinitionDeployer.java:65) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$1.call(CacheDeployer.java:54) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer$1.call(CacheDeployer.java:51) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:559) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:547) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.persistence.deploy.cache.CacheDeployer.deploy(CacheDeployer.java:51) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache.deploy(DeploymentCache.java:71) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.persistence.entity.DeploymentManager.insertDeployment(DeploymentManager.java:64) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.cmd.DeployCmd.deploy(DeployCmd.java:254) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.cmd.DeployCmd.lambda$doExecute$0(DeployCmd.java:155) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:559) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandContext.runWithoutAuthorization(CommandContext.java:547) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.cmd.DeployCmd.doExecute(DeployCmd.java:141) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:101) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:81) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:28) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:110) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:72) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:70) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:70) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.CommandCounterInterceptor.execute(CommandCounterInterceptor.java:35) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:33) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.RepositoryServiceImpl.deployWithResult(RepositoryServiceImpl.java:104) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deployWithResult(DeploymentBuilderImpl.java:270) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:266) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.impl.repository.ProcessApplicationDeploymentBuilderImpl.deploy(ProcessApplicationDeploymentBuilderImpl.java:63) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep.performOperationStep(DeployProcessArchiveStep.java:146) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:120) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.container.impl.jmx.MBeanServiceContainer.executeDeploymentOperation(MBeanServiceContainer.java:160) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.container.impl.spi.DeploymentOperation$DeploymentOperationBuilder.execute(DeploymentOperation.java:216) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl.deployProcessApplication(RuntimeContainerDelegateImpl.java:102) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.application.AbstractProcessApplication.deploy(AbstractProcessApplication.java:71) ~[camunda-engine-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.start(SpringProcessApplication.java:110) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.afterPropertiesSet(SpringProcessApplication.java:119) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication.afterPropertiesSet(SpringBootProcessApplication.java:102) ~[camunda-bpm-spring-boot-starter-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:96) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:52) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication$$EnhancerBySpringCGLIB$$595e572.onApplicationEvent() ~[camunda-bpm-spring-boot-starter-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  
                                                                                  at com.nk.ct.camunda.CamundaApplication.main(CamundaApplication.java:12) ~[classes!/:0.0.1-SNAPSHOT]
                                                                                  
                                                                                  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
                                                                                  
                                                                                  at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
                                                                                  
                                                                                  at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
                                                                                  
                                                                                  at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
                                                                                  
                                                                                  at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) ~[app.jar:0.0.1-SNAPSHOT]
                                                                                  
                                                                                  at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) ~[app.jar:0.0.1-SNAPSHOT]
                                                                                  
                                                                                  at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) ~[app.jar:0.0.1-SNAPSHOT]
                                                                                  
                                                                                  at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) ~[app.jar:0.0.1-SNAPSHOT]
                                                                                  
                                                                                  
                                                                                  2022-02-25 03:21:25.090  INFO 1 --- [           main] org.camunda.bpm.engine.jobexecutor       : ENGINE-14015 Shutting down the JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor]
                                                                                  
                                                                                  2022-02-25 03:21:25.091  INFO 1 --- [ultJobExecutor]] org.camunda.bpm.engine.jobexecutor       : ENGINE-14020 JobExecutor[org.camunda.bpm.engine.impl.jobexecutor.DefaultJobExecutor] stopped job acquisition
                                                                                  
                                                                                  2022-02-25 03:21:25.111  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'decision.engine' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.decision.engine.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.126  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'decision.history' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.decision.history.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.138  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'case.engine' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.case.engine.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.185  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'engine' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.engine.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.191  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'case.history' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.case.history.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.224  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'history' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.history.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.233  INFO 1 --- [           main] org.camunda.bpm.engine.persistence       : ENGINE-03016 Performing database operation 'drop' on component 'identity' with resource 'org/camunda/bpm/engine/db/drop/activiti.h2.drop.identity.sql'
                                                                                  
                                                                                  2022-02-25 03:21:25.236  INFO 1 --- [           main] org.camunda.bpm.engine                   : ENGINE-00007 Process Engine my-engine closed
                                                                                  
                                                                                  2022-02-25 03:21:25.250  INFO 1 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
                                                                                  
                                                                                  2022-02-25 03:21:25.265  INFO 1 --- [           main] ConditionEvaluationReportLoggingListener : 
                                                                                  
                                                                                  
                                                                                  Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
                                                                                  
                                                                                  2022-02-25 03:21:25.303 ERROR 1 --- [           main] o.s.boot.SpringApplication               : Application run failed
                                                                                  
                                                                                  
                                                                                  java.lang.RuntimeException: org.camunda.bpm.engine.ProcessEngineException: ENGINE-08043 Exception while performing 'Deployment of Process Application camundaApplication' => 'Deployment of process archive 'ct-camunda': The deployment contains definitions with the same key 'ct-camunda' (id attribute), this is not allowed
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:105) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.engine.spring.application.SpringProcessApplication.onApplicationEvent(SpringProcessApplication.java:52) ~[camunda-engine-spring-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.camunda.bpm.spring.boot.starter.SpringBootProcessApplication$$EnhancerBySpringCGLIB$$595e572.onApplicationEvent() ~[camunda-bpm-spring-boot-starter-7.16.0.jar!/:7.16.0]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.9.jar!/:5.3.9]
                                                                                  
                                                                                  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.4.jar!/:2.5.4]
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-25 at 11:07

                                                                                  I don't think this is Docker related. Maybe your build process copies files?

                                                                                  "The deployment contains definitions with the same key 'ct-camunda' (id attribute), this is not allowed" Check if you have packaged multiple .bpmn files into your deployment. Maybe you accidentally copied the model file in an additional classpath location. You seem to have two deployments with the same id. (This is not about the filename, but the technical id used inside the XML)

                                                                                  If you are using auto deployment in Spring Boot, you do not have to declare anything in the processes.xml. Use this only in combination with @EnableProcessApplication (or do not use both)

                                                                                  Source https://stackoverflow.com/questions/71260766

                                                                                  QUESTION

                                                                                  Renaming some part of columns of dataframe with values from another dataframe
                                                                                  Asked 2022-Feb-26 at 12:08

                                                                                  I want to change the column names from another DataFrame.

                                                                                  There are some similar questions in stackoverflow, but I need advanced version of it.

                                                                                  data1 = {
                                                                                    "ABC-123_afd": [420, 380, 390],
                                                                                    "LFK-402_ote": [50, 40, 45],
                                                                                    "BPM-299_qbm": [50, 40, 45],
                                                                                  }
                                                                                  
                                                                                  data2 = {
                                                                                    "ID": ['ABC-123', 'LFK-402', 'BPM-299'],
                                                                                    "NewID": ['IQU', 'EUW', 'NMS']
                                                                                  }
                                                                                  
                                                                                  data1_df=pd.DataFrame(data1)
                                                                                  #   ABC-123_afd  LFK-402_ote  BPM-299_qbm
                                                                                  #0          420           50           50
                                                                                  #1          380           40           40
                                                                                  #2          390           45           45
                                                                                  
                                                                                  data2_df=pd.DataFrame(data2)
                                                                                  #        ID NewID
                                                                                  #0  ABC-123   IQU
                                                                                  #1  LFK-402   EUW
                                                                                  #2  BPM-299   NMS
                                                                                  

                                                                                  I want to make the final result as below:

                                                                                  data_final_df
                                                                                  #   IQU_afd  EUW_ote  NMS_qbm
                                                                                  #0      420       50       50
                                                                                  #1      380       40       40
                                                                                  #2      390       45       45
                                                                                  

                                                                                  I tried the code in Renaming columns of dataframe with values from another dataframe.

                                                                                  It ran without error, but there were no changes. I think column names in data 1 are not perfectly matched to the value in the data2 value.

                                                                                  How can I change some part of the column name from another pandas DataFrame?

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-26 at 12:02

                                                                                  We could create a mapping from "ID" to "NewID" and use it to modify column names:

                                                                                  mapping = dict(zip(data2['ID'], data2['NewID']))
                                                                                  data1_df.columns = [mapping[x] + '_' + y for x, y in data1_df.columns.str.split('_')]
                                                                                  print(data1_df)
                                                                                  

                                                                                  or

                                                                                  s = data1_df.columns.str.split('_')
                                                                                  data1_df.columns = s.str[0].map(mapping) + '_' + s.str[1]
                                                                                  

                                                                                  or use the DataFrame data2_df:

                                                                                  s = data1_df.columns.str.split('_')
                                                                                  data1_df.columns = s.str[0].map(data2_df.set_index('ID')['NewID']) + '_' + s.str[1]
                                                                                  

                                                                                  Output:

                                                                                     IQU_afd  EUW_ote  NMS_qbm
                                                                                  0      420       50       50
                                                                                  1      380       40       40
                                                                                  2      390       45       45
                                                                                  

                                                                                  Source https://stackoverflow.com/questions/71276311

                                                                                  QUESTION

                                                                                  How to separate Camunda tables to a different schema?
                                                                                  Asked 2022-Feb-24 at 05:56

                                                                                  I want to separate Camunda tables to a different schema called camunda but even if I gave the schema-name and table-prefix, it still put all the tables under the public schema.

                                                                                  Here's my application.yml;

                                                                                  spring:
                                                                                    datasource:
                                                                                      hikari:
                                                                                        pool-name: CAMUNDA-HIKARI-POOL
                                                                                        idle-timeout: 3000
                                                                                        maximum-pool-size: 10
                                                                                        minimum-idle: 30
                                                                                        username: ${X_DB_USER:xxxx}
                                                                                        password: ${X_DB_PASSWORD:yyyy}
                                                                                        connection-timeout: 2000
                                                                                        connection-test-query: select 1
                                                                                        transaction-isolation: TRANSACTION_READ_COMMITTED
                                                                                      driver-class-name: org.postgresql.Driver
                                                                                      url: jdbc:postgresql://${X_DB_URL:localhost:5433/x-table?autoReconnect=true}
                                                                                    jpa:
                                                                                      show-sql: false
                                                                                      properties:
                                                                                        hibernate:
                                                                                          dialect: org.hibernate.dialect.PostgreSQLDialect
                                                                                      hibernate:
                                                                                        ddl-auto: update
                                                                                      open-in-view: false
                                                                                      database-platform: org.hibernate.dialect.PostgreSQLDialect
                                                                                  camunda.bpm:
                                                                                    admin-user:
                                                                                      id: xxxx
                                                                                      password: yyyy
                                                                                    metrics:
                                                                                      db-reporter-activate: false
                                                                                    history-level: full
                                                                                    database:
                                                                                      schema-update: create-drop
                                                                                      schema-name: camunda
                                                                                      table-prefix: camunda.
                                                                                  

                                                                                  What should I do more to let Camunda tables be under the camunda schema?

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-24 at 05:56

                                                                                  Here is a working example for two instance which are using separate database schemas (cam1 and cam2) and not the public schema: https://github.com/rob2universe/two-camunda-instances

                                                                                  Source https://stackoverflow.com/questions/71219044

                                                                                  QUESTION

                                                                                  How to convert json MySQL data into rows and column
                                                                                  Asked 2022-Feb-23 at 09:26

                                                                                  I have mysql table like this which contain id and json type column:

                                                                                  id value 1 {"sys": "20", "dia": "110"} 2 {"bpm": "200"} 3 {"bpm": "123", "sys": "1", "dia": ""}

                                                                                  Now, I want to have a MySQL query to which data should be as below in which id, val1 will contain keys of the json data and val2 will contain values of respective keys :

                                                                                  id val1 val2 1 sys 20 1 dia 110 2 bpm 200 3 bpm 123 3 sys 1 3 dia

                                                                                  Note : I am using MySQL 5.7 version and the keys inside the JSON object are not fixed. It can be any number.

                                                                                  I want to know how I can achieve this using MySQL query

                                                                                  Thanks in Advance!!!

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-18 at 12:01
                                                                                  CREATE TABLE test (id INT, value JSON);
                                                                                  INSERT INTO test VALUES
                                                                                  (1,   '{"sys": "20", "dia": "110"}'),
                                                                                  (2,   '{"bpm": "200"}'),
                                                                                  (3,   '{"bpm": "123", "sys": "1", "dia": ""}');
                                                                                  SELECT id, CAST(value AS CHAR) value FROM test;
                                                                                  
                                                                                  id value 1 {"dia": "110", "sys": "20"} 2 {"bpm": "200"} 3 {"bpm": "123", "dia": "", "sys": "1"}
                                                                                  CREATE PROCEDURE parse_json ()
                                                                                  BEGIN
                                                                                  DECLARE counter INT DEFAULT 0;
                                                                                  CREATE TEMPORARY TABLE tmp1 (id INT, all_keys JSON)
                                                                                  SELECT id, JSON_KEYS(value) all_keys
                                                                                  FROM test;
                                                                                  CREATE TEMPORARY TABLE tmp2 (id INT, one_key VARCHAR(255)) ENGINE = Memory;
                                                                                  REPEAT
                                                                                      INSERT INTO tmp2
                                                                                      SELECT id, JSON_EXTRACT(all_keys, CONCAT('$[',counter,']')) one_key
                                                                                      FROM tmp1
                                                                                      HAVING one_key IS NOT NULL;
                                                                                      SET counter := counter + 1;
                                                                                  UNTIL NOT ROW_COUNT() END REPEAT;
                                                                                  SELECT id, 
                                                                                         CAST(JSON_UNQUOTE(tmp2.one_key) AS CHAR) val1, 
                                                                                         CAST(JSON_UNQUOTE(JSON_EXTRACT(test.value, CONCAT('$.', tmp2.one_key))) AS CHAR) val2
                                                                                  FROM test
                                                                                  JOIN tmp2 USING (id)
                                                                                  ORDER BY 1,2;
                                                                                  DROP TEMPORARY TABLE tmp1;
                                                                                  DROP TEMPORARY TABLE tmp2;
                                                                                  END
                                                                                  
                                                                                  CALL parse_json
                                                                                  
                                                                                  id val1 val2 1 dia 110 1 sys 20 2 bpm 200 3 bpm 123 3 dia 3 sys 1

                                                                                  db<>fiddle here

                                                                                  If the datatype of the column with JSON values is VARCHAR/TEXT then the data should NOT contain duplicated keys in JSON values.

                                                                                  Source https://stackoverflow.com/questions/71172290

                                                                                  QUESTION

                                                                                  Using pyaudio to build a Metronome; wrong timing
                                                                                  Asked 2022-Feb-08 at 18:29

                                                                                  So I wanted to build a metronome and decided to use pyaudio. I know there are other ways but I want to make something else later with that.

                                                                                  Thats my Code so far:

                                                                                  
                                                                                  CHUNK = 1024
                                                                                  FORMAT = pyaudio.paInt16
                                                                                  CHANNELS = 2
                                                                                  RATE = 44100
                                                                                  def play_audio(filename):
                                                                                      wf=wave.open(filename,"rb")
                                                                                      p=pyaudio.PyAudio()
                                                                                      stream_play=p.open(format=p.get_format_from_width(wf.getsampwidth()),
                                                                                                  channels=wf.getnchannels(),
                                                                                                  rate=wf.getframerate(),
                                                                                                  output=True)
                                                                                      data = wf.readframes(CHUNK)
                                                                                      while True:
                                                                                          if data != '':
                                                                                              stream_play.write(data)
                                                                                              data = wf.readframes(CHUNK)
                                                                                          if data == b"":
                                                                                              break
                                                                                      stream_play.stop_stream()
                                                                                      stream_play.close()
                                                                                      p.terminate()
                                                                                  
                                                                                  def metronom(bpm):
                                                                                      while True: 
                                                                                          play_callback(beep)
                                                                                          time.sleep(60/bpm)
                                                                                  
                                                                                  beep="beep-07a.wav"
                                                                                  
                                                                                  
                                                                                  
                                                                                  

                                                                                  I thought it worked out, but unfortunately the timing is completely off. I also tried it with a callback function, but had the same wrong timing.

                                                                                  THE SOLUTION NOW LOOKS LIKE THIS

                                                                                  def metronom(bpm):
                                                                                      while True: 
                                                                                          startTime = time.time()
                                                                                          play_callback(beep)
                                                                                          endTime=time.time()-startTime
                                                                                          time.sleep(60/bpm-endTime)
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2022-Feb-08 at 18:16

                                                                                  You want the play_audio function to be called every 60/bpm seconds, but the function call itself takes time: you need to read the file, open the stream, play the file (who knows how long it is) and close the stream. So that adds to the time from one click to the next.

                                                                                  To fix this problem, you could try subtracting the time it takes to run the play_audio function from the time you sleep. You could also experiment with running play_audio on a separate thread.

                                                                                  Source https://stackoverflow.com/questions/71038624

                                                                                  QUESTION

                                                                                  Why am I getting "Error processing transaction request: intrinsic gas too low" error when trying to add tUSDT to a particular account?
                                                                                  Asked 2022-Jan-04 at 18:26

                                                                                  I am trying to send test USDT to a particular account in Java using the following code:

                                                                                  final Web3j web3 = createWeb3If(ethNetworkUrl);
                                                                                  final Credentials credentials = Credentials.create(privateKey);
                                                                                  final ERC20 usdtContract = ERC20.load(usdtContractAddress, web3, credentials, new TestGasProvider());
                                                                                  
                                                                                  usdtContract.transfer(exchangeAddress, BigInteger.valueOf(10)).send();
                                                                                  

                                                                                  The last statement results in the following exception:

                                                                                  java.lang.RuntimeException: Error processing transaction request: intrinsic gas too low
                                                                                      at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:176)
                                                                                      at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:81)
                                                                                      at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:128)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:367)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:350)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:344)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:339)
                                                                                      at org.web3j.tx.Contract.lambda$executeRemoteCallTransaction$3(Contract.java:410)
                                                                                      at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
                                                                                      at com.dpisarenko.minimalcryptoexchange.delegates.TransferUsdtToExchangeAccount.execute(TransferUsdtToExchangeAccount.java:57)
                                                                                  

                                                                                  TestGasProvider is defined as:

                                                                                  public class TestGasProvider extends StaticGasProvider {
                                                                                      public static final BigInteger GAS_PRICE = BigInteger.valueOf(10L);
                                                                                      public static final BigInteger GAS_LIMIT = BigInteger.valueOf(1L);
                                                                                  
                                                                                      public TestGasProvider() {
                                                                                          super(GAS_PRICE, GAS_LIMIT);
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  usdtContract was deployed using this script, which calls deploy.js:

                                                                                  async function main() {
                                                                                    const USDT = await ethers.getContractFactory("USDT");
                                                                                    const usdt = await USDT.deploy(1000000000000000);
                                                                                  
                                                                                    console.log("USDT contract deployed to:", usdt.address);
                                                                                  }
                                                                                  
                                                                                  main()
                                                                                    .then(() => process.exit(0))
                                                                                    .catch((error) => {
                                                                                      console.error(error);
                                                                                      process.exit(1);
                                                                                    });
                                                                                  

                                                                                  This contract is running on a local testnet set up as described here.

                                                                                  What do I need to change in any of these components (testnet, contract, deploy scripts, Java code) in order to send any amount of USDT to a particular address (without any errors)?

                                                                                  Update 1: If I change TestGasProvider to

                                                                                  public class TestGasProvider extends StaticGasProvider {
                                                                                      public static final BigInteger GAS_PRICE = BigInteger.valueOf(1L);
                                                                                      public static final BigInteger GAS_LIMIT = BigInteger.valueOf(1000000000L);
                                                                                  
                                                                                      public TestGasProvider() {
                                                                                          super(GAS_PRICE, GAS_LIMIT);
                                                                                      }
                                                                                  }
                                                                                  
                                                                                  

                                                                                  I get another error:

                                                                                  java.lang.RuntimeException: Error processing transaction request: exceeds block gas limit
                                                                                      at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:176)
                                                                                      at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:81)
                                                                                      at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:128)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:367)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:350)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:344)
                                                                                      at org.web3j.tx.Contract.executeTransaction(Contract.java:339)
                                                                                      at org.web3j.tx.Contract.lambda$executeRemoteCallTransaction$3(Contract.java:410)
                                                                                      at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:42)
                                                                                      at com.dpisarenko.minimalcryptoexchange.delegates.TransferUsdtToExchangeAccount.execute(TransferUsdtToExchangeAccount.java:57)
                                                                                  
                                                                                  
                                                                                  Terms for the bounty

                                                                                  I will award the bounty to a person who submits a set of code changes to the branch i16 of the minimal-crypto-exchange project which pass the following test:

                                                                                  Step 1

                                                                                  Set up the environment as described here.

                                                                                  Step 2

                                                                                  Set a breakpoint on line usdtContract.transfer(exchangeAddress, BigInteger.valueOf(10)).send(); in TransferUsdtToExchangeAccount class:

                                                                                  Step 3

                                                                                  Start the process engine application in debug mode. Its Java main method is located here.

                                                                                  Wait until you see the message starting to acquire jobs in the console output:

                                                                                  11:59:16.031 [JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor]] INFO  org.camunda.bpm.engine.jobexecutor - ENGINE-14018 JobExecutor[org.camunda.bpm.engine.spring.components.jobexecutor.SpringJobExecutor] starting to acquire jobs
                                                                                  
                                                                                  Step 4

                                                                                  Login with the credentials demo/demo at http://localhost:8080.

                                                                                  After login you should see a page like this:

                                                                                  Step 5

                                                                                  Click on the tasklist link. You should see a page that looks like this:

                                                                                  Press the "Start process" link. Following screen will appear:

                                                                                  Click on Send USDT to the exchange account process link. Following dialog box will appear:

                                                                                  Enter an arbitrary value into the "business key" field and press the "Start" button.

                                                                                  Step 6

                                                                                  After a couple of seconds, the breakpoint from step 2 will activate.

                                                                                  The conditions for granting the bounty are satisfied, if usdtContract.transfer(exchangeAddress, BigInteger.valueOf(10)).send(); is executed without errors.

                                                                                  Notes
                                                                                  1. You are allowed to modify the amount in usdtContract.transfer(exchangeAddress, BigInteger.valueOf(10)).send(); from 10 to something else.
                                                                                  2. You can also modify the parameters of the Ethereum testnet specified in docker-compose.yml and genesis.json, as well as those of the USDT smart contract which is deployed using this script.
                                                                                  3. Your solution must work in this controlled environment (i. e. no faucets must be used).
                                                                                  Update 2 (2021-12-31)

                                                                                  I made following changes:

                                                                                  1. The set-up tutorial now contains step 7 in which ETH is added to the exchange account.
                                                                                  2. Now a new version of the ETH testnet is being used, major changes being that log output is more verbose and the gas price is set to 1 (see --miner.gasprice 1 in entrypoint.sh).
                                                                                  3. Modified the code in TransferUsdtToExchangeAccount so that now USDT is transferred not from the exchange account (which has zero balance), but from the buffer account.

                                                                                  Now I am receiving the error

                                                                                  org.web3j.protocol.exceptions.TransactionException: Transaction 0x4bce379a2673c4564b2eb6080607b00d1a8ac232fbddf903f353f4eeda566cae
                                                                                  has failed with status: 0x0. Gas used: 32767. 
                                                                                  Revert reason: 'ERC20: transfer amount exceeds allowance'.
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2022-Jan-04 at 18:26

                                                                                  My skills with Ethereum are still not sharp enough to give you a proper answer, but I hope you get some guidance.

                                                                                  The error states that you are trying to transfer by a party A certain quantity in the name of another party B, to a third one C, but the amount you are trying to transfer, using transferFrom, is greater than the one party B approved party A to send.

                                                                                  You can check the actual allowance between to parties using the method with the same name of your contract.

                                                                                  Please, consider review this integration test from the web3j library in Github. It is different than yours but I think it could be helpful.

                                                                                  Especially, it states that the actual transferFrom operation should be performed by the beneficiary of the allowance. Please, see the relevant code:

                                                                                  final String aliceAddress = ALICE.getAddress();
                                                                                  final String bobAddress = BOB.getAddress();
                                                                                  ContractGasProvider contractGasProvider = new DefaultGasProvider();
                                                                                  HumanStandardToken contract =
                                                                                          HumanStandardToken.deploy(
                                                                                                          web3j,
                                                                                                          ALICE,
                                                                                                          contractGasProvider,
                                                                                                          aliceQty,
                                                                                                          "web3j tokens",
                                                                                                          BigInteger.valueOf(18),
                                                                                                          "w3j$")
                                                                                                  .send();
                                                                                  
                                                                                  //...
                                                                                  
                                                                                  // set an allowance
                                                                                  assertEquals(contract.allowance(aliceAddress, bobAddress).send(), (BigInteger.ZERO));
                                                                                  
                                                                                  transferQuantity = BigInteger.valueOf(50);
                                                                                  TransactionReceipt approveReceipt =
                                                                                          contract.approve(BOB.getAddress(), transferQuantity).send();
                                                                                  
                                                                                  HumanStandardToken.ApprovalEventResponse approvalEventValues =
                                                                                          contract.getApprovalEvents(approveReceipt).get(0);
                                                                                  
                                                                                  assertEquals(approvalEventValues._owner, (aliceAddress));
                                                                                  assertEquals(approvalEventValues._spender, (bobAddress));
                                                                                  assertEquals(approvalEventValues._value, (transferQuantity));
                                                                                  
                                                                                  assertEquals(contract.allowance(aliceAddress, bobAddress).send(), (transferQuantity));
                                                                                  
                                                                                  // perform a transfer as Bob
                                                                                  transferQuantity = BigInteger.valueOf(25);
                                                                                  
                                                                                  // Bob requires his own contract instance
                                                                                  HumanStandardToken bobsContract =
                                                                                          HumanStandardToken.load(
                                                                                                  contract.getContractAddress(), web3j, BOB, STATIC_GAS_PROVIDER);
                                                                                  
                                                                                  TransactionReceipt bobTransferReceipt =
                                                                                          bobsContract.transferFrom(aliceAddress, bobAddress, transferQuantity).send();
                                                                                  
                                                                                  HumanStandardToken.TransferEventResponse bobTransferEventValues =
                                                                                          contract.getTransferEvents(bobTransferReceipt).get(0);
                                                                                  assertEquals(bobTransferEventValues._from, (aliceAddress));
                                                                                  assertEquals(bobTransferEventValues._to, (bobAddress));
                                                                                  assertEquals(bobTransferEventValues._value, (transferQuantity));
                                                                                  
                                                                                  //...
                                                                                  

                                                                                  This fact is also indicated in this OpenZeppelin forum post.

                                                                                  Source https://stackoverflow.com/questions/70483315

                                                                                  QUESTION

                                                                                  getting a KeyNotFoundException on a key that appears to exist in a dictionary
                                                                                  Asked 2021-Dec-25 at 22:29

                                                                                  full error:

                                                                                  KeyNotFoundException: The given key was not present in the dictionary.
                                                                                  System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <695d1cc93cca45069c528c15c9fdd749>:0)
                                                                                  TonePlayer+d__6.MoveNext () (at Assets/TonePlayer.cs:43)
                                                                                  UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at <0ee480759f3d481d82ada245dc74f9fd>:0)
                                                                                  UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
                                                                                  TonePlayer:Awake() (at Assets/TonePlayer.cs:14)
                                                                                  

                                                                                  when i check the value of the timing array (TonePlayer) and compare it to the value of the timings array (SongManager) their values appear to be the same, but are not recognized as the same value I have tried printing the array's contents and the contents were identical.

                                                                                  both arrays are of the same type (string) and each element is a float converted to a string with 3 decimal places

                                                                                  the .unf file is just a midi converted to json, here are its contents:

                                                                                  {
                                                                                    "header": {
                                                                                      "PPQ": 480,
                                                                                      "timeSignature": [
                                                                                        4,
                                                                                        4
                                                                                      ],
                                                                                      "bpm": 120,
                                                                                      "name": "Piano"
                                                                                    },
                                                                                    "tempo": [
                                                                                      {
                                                                                        "absoluteTime": 0,
                                                                                        "seconds": 0,
                                                                                        "bpm": 120
                                                                                      }
                                                                                    ],
                                                                                    "timeSignature": [
                                                                                      {
                                                                                        "absoluteTime": 0,
                                                                                        "seconds": 0,
                                                                                        "numerator": 4,
                                                                                        "denominator": 2,
                                                                                        "click": 24,
                                                                                        "notesQ": 8
                                                                                      }
                                                                                    ],
                                                                                    "startTime": 0,
                                                                                    "duration": 9.223958333333334,
                                                                                    "tracks": [
                                                                                      {
                                                                                        "startTime": 0,
                                                                                        "duration": 9.223958333333334,
                                                                                        "length": 26,
                                                                                        "notes": [
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 0,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333333
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 0.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333333
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 0.5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333333
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 0.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333333
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 1,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 1.2499999999999998,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.47395833333333326
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 1.9999999999999998,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333344
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 2.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "F5",
                                                                                            "midi": 77,
                                                                                            "time": 2.5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.4739583333333335
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 3,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.4739583333333335
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 3.5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 3.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 4,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 4.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 4.5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 4.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 5.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.47395833333333304
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 6.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 7,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 7.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 7.5,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 7.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "C5",
                                                                                            "midi": 72,
                                                                                            "time": 8,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.23645833333333321
                                                                                          },
                                                                                          {
                                                                                            "name": "D5",
                                                                                            "midi": 74,
                                                                                            "time": 8.25,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.4739583333333339
                                                                                          },
                                                                                          {
                                                                                            "name": "E5",
                                                                                            "midi": 76,
                                                                                            "time": 8.75,
                                                                                            "velocity": 0.6299212598425197,
                                                                                            "duration": 0.4739583333333339
                                                                                          }
                                                                                        ],
                                                                                        "controlChanges": {
                                                                                          "7": [
                                                                                            {
                                                                                              "number": 7,
                                                                                              "time": 0,
                                                                                              "value": 0.7874015748031497
                                                                                            }
                                                                                          ],
                                                                                          "10": [
                                                                                            {
                                                                                              "number": 10,
                                                                                              "time": 0,
                                                                                              "value": 0.5039370078740157
                                                                                            }
                                                                                          ],
                                                                                          "91": [
                                                                                            {
                                                                                              "number": 91,
                                                                                              "time": 0,
                                                                                              "value": 0
                                                                                            }
                                                                                          ],
                                                                                          "93": [
                                                                                            {
                                                                                              "number": 93,
                                                                                              "time": 0,
                                                                                              "value": 0
                                                                                            }
                                                                                          ],
                                                                                          "121": [
                                                                                            {
                                                                                              "number": 121,
                                                                                              "time": 0,
                                                                                              "value": 0
                                                                                            }
                                                                                          ]
                                                                                        },
                                                                                        "id": 0,
                                                                                        "name": "Piano",
                                                                                        "instrumentNumber": 0,
                                                                                        "instrument": "acoustic grand piano",
                                                                                        "instrumentFamily": "piano",
                                                                                        "channelNumber": 0,
                                                                                        "isPercussion": false
                                                                                      },
                                                                                      {
                                                                                        "startTime": 0,
                                                                                        "duration": 0,
                                                                                        "length": 0,
                                                                                        "notes": [],
                                                                                        "controlChanges": {},
                                                                                        "id": 1,
                                                                                        "name": "Piano"
                                                                                      }
                                                                                    ]
                                                                                  }
                                                                                  

                                                                                  output (first loop): timings (SongManager): 0,000, 0,236 timing (TonePlayer): 0,000, 0,236

                                                                                  TonePlayer.cs:

                                                                                  using System.Collections;
                                                                                  using System.Collections.Generic;
                                                                                  using UnityEngine;
                                                                                  
                                                                                  public class TonePlayer : MonoBehaviour
                                                                                  {
                                                                                      private KeyCode[] keys;
                                                                                      public float minAlpha = 80f;
                                                                                      public float reduceAlphaStep = 1f;
                                                                                      public ToneManager mgr;
                                                                                      public SongManager smgr;
                                                                                      private void Awake()
                                                                                      {
                                                                                          StartCoroutine(lightUp());
                                                                                          keys = new KeyCode[4] { KeyCode.A, KeyCode.S, KeyCode.D, KeyCode.F };
                                                                                      }
                                                                                      IEnumerator lightUp()
                                                                                      {
                                                                                      
                                                                                          Dictionary notes = smgr.LoadSong("Assets/test.unf");
                                                                                          Dictionary notes_enc = new Dictionary();
                                                                                          notes_enc[0] = "C";
                                                                                          notes_enc[1] = "D";
                                                                                          notes_enc[2] = "E";
                                                                                          notes_enc[3] = "F";
                                                                                          for (int i = 0; i < notes.Count; i++)
                                                                                          {
                                                                                              string[][] keys=new string[notes.Count][];
                                                                                              keys[0]= new string[notes.Count];
                                                                                              keys[1] = new string[2];
                                                                                              notes.Keys.CopyTo(keys, 0);
                                                                                              string time = keys[i][0];
                                                                                              string duration = keys[i][1];
                                                                                              string[] timing = { time, duration };
                                                                                              mgr.source.PlayOneShot(mgr.tones[notes[timing]]);
                                                                                              print(notes_enc[notes[timing]]);
                                                                                              print(duration);
                                                                                              yield return new WaitForSeconds(float.Parse(duration));
                                                                                          }
                                                                                          yield return null;
                                                                                      }
                                                                                      void Update()
                                                                                      {
                                                                                          for (int i = 0; i < 4; i++)
                                                                                          {
                                                                                              if (Input.GetKeyDown(keys[i]))
                                                                                              {
                                                                                                  mgr.source.PlayOneShot(mgr.tones[i]);
                                                                                                  var temp = mgr.lights[i].color;
                                                                                                  temp.a = 1;
                                                                                                  //print("set");
                                                                                                  mgr.lights[i].color = temp;
                                                                                              }
                                                                                              float alpha = mgr.lights[i].color.a;
                                                                                  
                                                                                              if (alpha > (minAlpha / 255f))
                                                                                              {
                                                                                                  alpha -= (reduceAlphaStep / 255f);
                                                                                                  var temp = mgr.lights[i].color;
                                                                                                  temp.a = alpha;
                                                                                                  mgr.lights[i].color = temp;
                                                                                                  //print(alpha);
                                                                                              }
                                                                                          }
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  SongManager.cs:

                                                                                  using System.Collections;
                                                                                  using System.Collections.Generic;
                                                                                  using Newtonsoft.Json.Linq;
                                                                                  using System.IO;
                                                                                  using System;
                                                                                  using UnityEngine;
                                                                                  
                                                                                  public class SongManager : MonoBehaviour
                                                                                  {
                                                                                      public string[] first;
                                                                                      private void Awake()
                                                                                      {
                                                                                          LoadSong("Assets/test.unf");
                                                                                      }
                                                                                      public Dictionary LoadSong(string unf_json)
                                                                                      {
                                                                                          Dictionary ret = new Dictionary();
                                                                                          string json = File.ReadAllText(unf_json);
                                                                                          var root = JObject.Parse(json);
                                                                                          var tracks = root.GetValue("tracks")[0]["notes"];
                                                                                          Dictionary notes_enc = new Dictionary();
                                                                                          notes_enc["C"] = 0;
                                                                                          notes_enc["D"] = 1;
                                                                                          notes_enc["E"] = 2;
                                                                                          notes_enc["F"] = 3;
                                                                                          int z = 0;
                                                                                          foreach (var track in tracks)
                                                                                          {
                                                                                              z++;
                                                                                              float time = ((float)track["time"]);
                                                                                              float duration = ((float)track["duration"]);
                                                                                              string[] timings = { time.ToString("0.000"), duration.ToString("0.000") };
                                                                                              string name = ((string)track["name"])[0].ToString();
                                                                                  
                                                                                  
                                                                                  
                                                                                              //Debug.Log(string.Format("duration: {0}, note: {1}({2})", duration, name, notes_enc[name]));
                                                                                              ret[timings] = notes_enc[name];
                                                                                          }
                                                                                          return ret;
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  ToneManager.cs:

                                                                                  using System.Collections;
                                                                                  using System.Collections.Generic;
                                                                                  using System;
                                                                                  using UnityEngine;
                                                                                  
                                                                                  public class ToneManager : MonoBehaviour
                                                                                  {
                                                                                      public AudioSource source;
                                                                                      public AudioClip[] tones;
                                                                                  
                                                                                      [HideInInspector]
                                                                                      public SpriteRenderer[] lights;
                                                                                      public Transform parent;
                                                                                      public TonePlayer player;
                                                                                      private void Start()
                                                                                      {
                                                                                          lights = GetSpriteRenderers(GetChildren(parent));
                                                                                          /*for (int i = 0; i < 4; i++)
                                                                                          {
                                                                                              lights[i].color = SetAlpha(lights[i].color, player.minAlpha);
                                                                                          }
                                                                                          */
                                                                                      }
                                                                                      public Transform[] GetChildren(Transform parent)
                                                                                      {
                                                                                          List children = new List();
                                                                                          for (int i = 0; i < parent.childCount; i++)
                                                                                          {
                                                                                              children.Add(parent.GetChild(i));
                                                                                          }
                                                                                          return children.ToArray();
                                                                                      }
                                                                                      public SpriteRenderer[] GetSpriteRenderers(Transform[] children)
                                                                                      {
                                                                                          SpriteRenderer[] spriteRenderers = new SpriteRenderer[children.Length];
                                                                                          for (int i = 0; i < children.Length; i++)
                                                                                          {
                                                                                              spriteRenderers[i] = children[i].GetComponent();
                                                                                          }
                                                                                          return spriteRenderers;
                                                                                      }
                                                                                  }
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Dec-25 at 14:11

                                                                                  From what I can see, in your SongManager you are creating Dictionary ret, but not adding any values to. Instead, you are trying to directly assign values: ret[timings] = notes_enc[name];. Dictionary is not an array, you should use Add() method, like this: ret.Add(timings, notes_enc[name]);

                                                                                  Source https://stackoverflow.com/questions/70480242

                                                                                  QUESTION

                                                                                  Webaudio timing performance
                                                                                  Asked 2021-Nov-02 at 12:49

                                                                                  The file below uses ToneJS to play a steam of steady 8th notes. According to the log of the timing, those 8th notes are precisely 0.25 seconds apart.

                                                                                  However, they don't sound even. The time intervals between the notes are distinctly irregular.

                                                                                  Why is it so? Is there anything that can be done about it? Or is this a performance limitation of Javascript/webaudio-api? I have tested it in Chrome, Firefox, and Safari, all to the same result.

                                                                                  Thanks for any information or suggestions about this!

                                                                                  
                                                                                  
                                                                                  
                                                                                  Tone Timing Tester
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  Start
                                                                                  Stop
                                                                                  
                                                                                      
                                                                                      Enter BPM
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  
                                                                                  

                                                                                  ANSWER

                                                                                  Answered 2021-Nov-02 at 12:49

                                                                                  For a scheduled triggerAttackRelease, you should pass the time value as the third argument.

                                                                                  Tone.Transport.scheduleRepeat(function(time){
                                                                                      console.log('time', time);
                                                                                      synth.triggerAttackRelease('C4', '8n', time);
                                                                                  }, "8n");
                                                                                  

                                                                                  Here's a codepen that contains the working code.

                                                                                  Source https://stackoverflow.com/questions/69804550

                                                                                  Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                                                                                  Vulnerabilities

                                                                                  No vulnerabilities reported

                                                                                  Install compileflow

                                                                                  Plugin download address: https://github.com/alibaba/compileflow-idea-designer.

                                                                                  Support

                                                                                  For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
                                                                                  Find more information at:
                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit

                                                                                  Share this Page

                                                                                  share link

                                                                                  Explore Related Topics

                                                                                  Consider Popular BPM Libraries

                                                                                  Try Top Libraries by alibaba

                                                                                  arthas

                                                                                  by alibabaJava

                                                                                  p3c

                                                                                  by alibabaKotlin

                                                                                  easyexcel

                                                                                  by alibabaJava

                                                                                  druid

                                                                                  by alibabaJava

                                                                                  nacos

                                                                                  by alibabaJava

                                                                                  Compare BPM Libraries with Highest Support

                                                                                  airflow

                                                                                  by apache

                                                                                  dagster

                                                                                  by dagster-io

                                                                                  azkaban

                                                                                  by azkaban

                                                                                  conductor

                                                                                  by Netflix

                                                                                  prefect

                                                                                  by PrefectHQ

                                                                                  Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
                                                                                  Find more libraries
                                                                                  Explore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits​
                                                                                  Save this library and start creating your kit