database | Blazegraph High Performance Graph Database | Data Manipulation library

 by   blazegraph Java Version: BLAZEGRAPH_2_1_6_RC License: GPL-2.0

kandi X-RAY | database Summary

database is a Java library typically used in Utilities, Data Manipulation applications. database has no bugs, it has no vulnerabilities, it has build file available, it has a Strong Copyleft License and it has high support. You can download it from GitHub, Maven.
Blazegraph DB is a ultra high-performance graph database supporting Blueprints and RDF/SPARQL APIs. It supports up to 50 Billion edges on a single machine. It is in production use for Fortune 500 customers such as EMC, Autodesk, and many others. It is supporting key Precision Medicine applications and has wide-spread usage for life science applications. It is used extensively to support Cyber anaytics in commercial and government applications. It powers the Wikimedia Foundation's Wikidata Query Service. Please see the release notes in releases for version changes. Sign up to get the latest news on Blazegraph. Please also visit us at our: website, wiki, and blog. Find an issue? Need help? See JIRA. Reporting a security issue: Security Reporting.
    Support
      Quality
        Security
          License
            Reuse
            Support
              Quality
                Security
                  License
                    Reuse

                      kandi-support Support

                        summary
                        database has a highly active ecosystem.
                        summary
                        It has 589 star(s) with 123 fork(s). There are 62 watchers for this library.
                        summary
                        It had no major release in the last 12 months.
                        summary
                        There are 95 open issues and 42 have been closed. On average issues are closed in 29 days. There are 33 open pull requests and 0 closed requests.
                        summary
                        It has a positive sentiment in the developer community.
                        summary
                        The latest version of database is BLAZEGRAPH_2_1_6_RC
                        database Support
                          Best in #Data Manipulation
                            Average in #Data Manipulation
                            database Support
                              Best in #Data Manipulation
                                Average in #Data Manipulation

                                  kandi-Quality Quality

                                    summary
                                    database has no bugs reported.
                                    database Quality
                                      Best in #Data Manipulation
                                        Average in #Data Manipulation
                                        database Quality
                                          Best in #Data Manipulation
                                            Average in #Data Manipulation

                                              kandi-Security Security

                                                summary
                                                database has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
                                                database Security
                                                  Best in #Data Manipulation
                                                    Average in #Data Manipulation
                                                    database Security
                                                      Best in #Data Manipulation
                                                        Average in #Data Manipulation

                                                          kandi-License License

                                                            summary
                                                            database is licensed under the GPL-2.0 License. This license is Strong Copyleft.
                                                            summary
                                                            Strong Copyleft licenses enforce sharing, and you can use them when creating open source projects.
                                                            database License
                                                              Best in #Data Manipulation
                                                                Average in #Data Manipulation
                                                                database License
                                                                  Best in #Data Manipulation
                                                                    Average in #Data Manipulation

                                                                      kandi-Reuse Reuse

                                                                        summary
                                                                        database 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.
                                                                        database Reuse
                                                                          Best in #Data Manipulation
                                                                            Average in #Data Manipulation
                                                                            database Reuse
                                                                              Best in #Data Manipulation
                                                                                Average in #Data Manipulation
                                                                                  Top functions reviewed by kandi - BETA
                                                                                  kandi has reviewed database and discovered the below as its top functions. This is intended to give you an instant insight into database implemented functionality, and help decide if they suit your requirements.
                                                                                  • Moves forward bytes from the input stream
                                                                                    • Process a chunk of chunks .
                                                                                      • Converts a DELETE into a DELETE query .
                                                                                        • Choose moves to move .
                                                                                          • Get the XHTML table row row .
                                                                                            • Determine if a join should be performed .
                                                                                              • Perform the initialization process .
                                                                                                • Writes the index segment .
                                                                                                  • Generates the explanation of a query .
                                                                                                    • Removes all statements from the closure .
                                                                                                      Get all kandi verified functions for this library.
                                                                                                      Get all kandi verified functions for this library.

                                                                                                      database Key Features

                                                                                                      Blazegraph High Performance Graph Database

                                                                                                      database Examples and Code Snippets

                                                                                                      Connects to a MongoDB database .
                                                                                                      javadot imgLines of Code : 9dot imgLicense : Non-SPDX
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          public void connect(String dbName, String accountsCollectionName) { if (mongoClient != null) { mongoClient.close(); } mongoClient = new MongoClient(System.getProperty("mongo-host"), Integer.parseInt(System.getProperty("mongo-port"))); database = mongoClient.getDatabase(dbName); accountsCollection = database.getCollection(accountsCollectionName); }
                                                                                                      Connect to the default database .
                                                                                                      javadot imgLines of Code : 3dot imgLicense : Non-SPDX
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          public void connect() { connect(DEFAULT_DB, DEFAULT_TICKETS_COLLECTION, DEFAULT_COUNTERS_COLLECTION); }
                                                                                                      Gets the default MongoDB database .
                                                                                                      javadot imgLines of Code : 3dot imgLicense : Non-SPDX
                                                                                                      copy iconCopy
                                                                                                      
                                                                                                                                          public MongoDatabase getMongoDatabase() { return database; }
                                                                                                      Community Discussions

                                                                                                      Trending Discussions on database

                                                                                                      Javascript dynamically inserted later on: how to make it run?
                                                                                                      chevron right
                                                                                                      Unknown host CPU architecture: arm64 , Android NDK SiliconM1 Apple MacBook Pro
                                                                                                      chevron right
                                                                                                      psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
                                                                                                      chevron right
                                                                                                      AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
                                                                                                      chevron right
                                                                                                      ASP.NET Core 6 how to access Configuration during startup
                                                                                                      chevron right
                                                                                                      How to fix: "@angular/fire"' has no exported member 'AngularFireModule'.ts(2305) ionic, firebase, angular
                                                                                                      chevron right
                                                                                                      pymongo [SSL: CERTIFICATE_VERIFY_FAILED]: certificate has expired on Mongo Atlas
                                                                                                      chevron right
                                                                                                      java.lang.RuntimeException: android.database.sqlite.SQLiteException: no such table: media_store_extension (code 1): ,
                                                                                                      chevron right
                                                                                                      How to solve FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore problem?
                                                                                                      chevron right
                                                                                                      How do I get details of a veracode vulnerability report?
                                                                                                      chevron right

                                                                                                      QUESTION

                                                                                                      Javascript dynamically inserted later on: how to make it run?
                                                                                                      Asked 2022-Apr-17 at 14:12

                                                                                                      I have scripts In my React app that are inserted dynamically later on. The scripts don't load.

                                                                                                      In my database there is a field called content, which contains data that includes html and javascript. There are many records and each record can include multiple scripts in the content field. So it's not really an option to statically specify each of the script-urls in my React app. The field for a record could for example look like:

                                                                                                      Some text and html

                                                                                                      Some text. Etc…

                                                                                                      I call on this field in my React app using dangerouslySetInnerHTML:

                                                                                                      render() {
                                                                                                          return (
                                                                                                              
                                                                                                                  
                                                                                                                      
                                                                                                                      ... some other data
                                                                                                                  
                                                                                                              
                                                                                                          );
                                                                                                      }
                                                                                                      

                                                                                                      It correctly loads the data from the database and displays the html from that data. However, the Javascript does not get executed. I think the script doesn't work because it is dynamically inserted later on. How can I make these scripts work/run?

                                                                                                      This post suggest a solution for dynamically inserted scripts, but I don't think I can apply this solution because in my case the script/code is inserted from a database (so how to then use nodeScriptReplace on the code...?). Any suggestions how I might make my scripts work?

                                                                                                      Update in response to @lissettdm their answer:

                                                                                                      constructor(props) {
                                                                                                          this.ref = React.createRef();
                                                                                                      }
                                                                                                      
                                                                                                      componentDidUpdate(prevProps, prevState) {
                                                                                                          if (prevProps.postData !== this.props.postData) {
                                                                                                              this.setState({
                                                                                                                  loading: false,
                                                                                                                  post: this.props.postData.data,
                                                                                                                  //etc
                                                                                                              });
                                                                                                              setTimeout(() => parseElements());
                                                                                                      
                                                                                                              console.log(this.props.postData.data.content);
                                                                                                              // returns html string like: `
                                                                                                                      
                                                                                                                          
                                                                                                                          ... some other data
                                                                                                                      
                                                                                                                  
                                                                                                              );
                                                                                                          );
                                                                                                      }
                                                                                                      

                                                                                                      The this.ref.current.appendChild(node); line produces the error:

                                                                                                      TypeError: Cannot read properties of null (reading 'appendChild')

                                                                                                      ANSWER

                                                                                                      Answered 2022-Apr-14 at 19:05

                                                                                                      Rendering raw HTML without React recommended method is not a good practice. React recommends method dangerouslySetInnerHTML to render raw HTML.

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

                                                                                                      QUESTION

                                                                                                      Unknown host CPU architecture: arm64 , Android NDK SiliconM1 Apple MacBook Pro
                                                                                                      Asked 2022-Apr-04 at 18:41

                                                                                                      I've got a project that is working fine in windows os but when I switched my laptop and opened an existing project in MacBook Pro M1. I'm unable to run an existing android project in MacBook pro M1. first I was getting

                                                                                                      Execution failed for task ':app:kaptDevDebugKotlin'. > A failure occurred while executing org.jetbrains.kotlin.gradle.internal.KaptExecution > java.lang.reflect.InvocationTargetException (no error message)

                                                                                                      this error was due to the Room database I applied a fix that was adding below library before Room database and also changed my JDK location from file structure from JRE to JDK.

                                                                                                      kapt "org.xerial:sqlite-jdbc:3.34.0"

                                                                                                         //Room components
                                                                                                          kapt "org.xerial:sqlite-jdbc:3.34.0"
                                                                                                          implementation "androidx.room:room-ktx:$rootProject.roomVersion"
                                                                                                          kapt "androidx.room:room-compiler:$rootProject.roomVersion"
                                                                                                          androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion"
                                                                                                      

                                                                                                      after that now I'm getting an issue which is Unknown host CPU architecture: arm64

                                                                                                      there is an SDK in my project that is using this below line.

                                                                                                      android {
                                                                                                          externalNativeBuild {
                                                                                                              ndkBuild {
                                                                                                                 path 'Android.mk'
                                                                                                              }
                                                                                                          }
                                                                                                          ndkVersion '21.4.7075529'
                                                                                                      
                                                                                                      
                                                                                                      }
                                                                                                      

                                                                                                      App Gradle

                                                                                                       externalNativeBuild {
                                                                                                              cmake {
                                                                                                                  path "src/main/cpp/CMakeLists.txt"
                                                                                                                  version "3.18.1"
                                                                                                                  //version "3.10.2"
                                                                                                              }
                                                                                                          }
                                                                                                      

                                                                                                      [CXX1405] error when building with ndkBuild using /Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/Android.mk: Build command failed. Error while executing process /Users/mac/Library/Android/sdk/ndk/21.4.7075529/ndk-build with arguments {NDK_PROJECT_PATH=null APP_BUILD_SCRIPT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/Android.mk APP_ABI=arm64-v8a NDK_ALL_ABIS=arm64-v8a NDK_DEBUG=1 APP_PLATFORM=android-21 NDK_OUT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/build/intermediates/cxx/Debug/4k4s2lc6/obj NDK_LIBS_OUT=/Users/mac/Desktop/Consumer-Android/ime/dictionaries/jnidictionaryv2/build/intermediates/cxx/Debug/4k4s2lc6/lib APP_SHORT_COMMANDS=false LOCAL_SHORT_COMMANDS=false -B -n} ERROR: Unknown host CPU architecture: arm64

                                                                                                      which is causing this issue and whenever I comment on this line

                                                                                                      path 'Android.mk'

                                                                                                      it starts working fine, is there any way around which will help me run this project with this piece of code without getting this NDK issue?

                                                                                                      Update - It seems that Room got fixed in the latest updates, Therefore you may consider updating Room to latest version (2.3.0-alpha01 / 2.4.0-alpha03 or above)

                                                                                                      GitHub Issue Tracker

                                                                                                      ANSWER

                                                                                                      Answered 2022-Apr-04 at 18:41

                                                                                                      To solve this on a Apple Silicon M1 I found three options

                                                                                                      A

                                                                                                      Use NDK 24

                                                                                                      android {
                                                                                                          ndkVersion "24.0.8215888"
                                                                                                          ...
                                                                                                      }
                                                                                                      

                                                                                                      You can install it with

                                                                                                      echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install 'ndk;24.0.8215888'
                                                                                                      

                                                                                                      or

                                                                                                      echo "y" | sudo ${ANDROID_HOME}/sdk/cmdline-tools/latest/bin/sdkmanager --install 'ndk;24.0.8215888'
                                                                                                      

                                                                                                      Depending what where sdkmanager is located

                                                                                                      B

                                                                                                      Change your ndk-build to use Rosetta x86. Search for your installed ndk with

                                                                                                      find ~ -name ndk-build 2>/dev/null
                                                                                                      

                                                                                                      eg

                                                                                                      vi ~/Library/Android/sdk/ndk/22.1.7171670/ndk-build
                                                                                                      

                                                                                                      and change

                                                                                                      DIR="$(cd "$(dirname "$0")" && pwd)"
                                                                                                      $DIR/build/ndk-build "$@"
                                                                                                      

                                                                                                      to

                                                                                                      DIR="$(cd "$(dirname "$0")" && pwd)"
                                                                                                      arch -x86_64 /bin/bash $DIR/build/ndk-build "$@"
                                                                                                      

                                                                                                      C

                                                                                                      convert your ndk-build into a cmake build

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

                                                                                                      QUESTION

                                                                                                      psql: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
                                                                                                      Asked 2022-Apr-04 at 15:46

                                                                                                      Not really sure what caused this but most likely exiting the terminal while my rails server which was connected to PostgreSQL database was closed (not a good practice I know but lesson learned!)

                                                                                                      I've already tried the following:

                                                                                                      1. Rebooting my machine (using MBA M1 2020)
                                                                                                      2. Restarting PostgreSQL using homebrew brew services restart postgresql
                                                                                                      3. Re-installing PostgreSQL using Homebrew
                                                                                                      4. Updating PostgreSQL using Homebrew
                                                                                                      5. I also tried following this link but when I run cd Library/Application\ Support/Postgres terminal tells me Postgres folder doesn't exist, so I'm kind of lost already. Although I have a feeling that deleting postmaster.pid would really fix my issue. Any help would be appreciated!

                                                                                                      ANSWER

                                                                                                      Answered 2022-Jan-13 at 15:19
                                                                                                      Resetting PostgreSQL

                                                                                                      My original answer only included the troubleshooting steps below, and a workaround. I now decided to properly fix it via brute force by removing all clusters and reinstalling, since I didn't have any data there to keep. It was something along these lines, on my Ubuntu 21.04 system:

                                                                                                      sudo pg_dropcluster --stop 12 main
                                                                                                      sudo pg_dropcluster --stop 14 main
                                                                                                      sudo apt remove postgresql-14
                                                                                                      sudo apt purge postgresql*
                                                                                                      sudo apt install postgresql-14
                                                                                                      

                                                                                                      Now I have:

                                                                                                      $ pg_lsclusters
                                                                                                      Ver Cluster Port Status Owner    Data directory              Log file
                                                                                                      14  main    5432 online postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
                                                                                                      

                                                                                                      And sudo -u postgres psql works fine. The service was started automatically but it can be done manually with sudo systemctl start postgresql.

                                                                                                      Incidentally, I can recommend the PostgreSQL docker image, which eliminates the need to bother with a local installation.

                                                                                                      Troubleshooting

                                                                                                      Although I cannot provide an answer to your specific problem, I thought I'd share my troubleshooting steps, hoping that it might be of some help. It seems that you are on Mac, whereas I am running Ubuntu 21.04, so expect things to be different.

                                                                                                      This is a client connection problem, as noted by section 19.3.2 in the docs.

                                                                                                      The directory in my error message is different:

                                                                                                      $ sudo su postgres -c "psql"
                                                                                                      psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
                                                                                                              Is the server running locally and accepting connections on that socket?
                                                                                                      

                                                                                                      I checked what unix sockets I had in that directory:

                                                                                                      $ ls -lah /var/run/postgresql/
                                                                                                      total 8.0K
                                                                                                      drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
                                                                                                      drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
                                                                                                      drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
                                                                                                      drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
                                                                                                      -rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
                                                                                                      srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
                                                                                                      -rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
                                                                                                      

                                                                                                      Makes sense, there is a socket for 5433 not 5432. I confirmed this by running:

                                                                                                      $ pg_lsclusters
                                                                                                      Ver Cluster Port Status                Owner    Data directory              Log file
                                                                                                      12  main    5432 down,binaries_missing postgres /var/lib/postgresql/12/main /var/log/postgresql/postgresql-12-main.log
                                                                                                      14  main    5433 online                postgres /var/lib/postgresql/14/main /var/log/postgresql/postgresql-14-main.log
                                                                                                      

                                                                                                      This explains how it got into this mess on my system. The default port is 5432, but after I upgraded from version 12 to 14, the server was setup to listen to 5433, presumably because it considered 5432 as already taken. Two alternatives here, get the server to listen on 5432 which is the client's default, or get the client to use 5433.

                                                                                                      Let's try it by changing the client's parameters:

                                                                                                      $ sudo su postgres -c "psql --port=5433"
                                                                                                      psql (14.0 (Ubuntu 14.0-1.pgdg21.04+1))
                                                                                                      Type "help" for help.
                                                                                                      
                                                                                                      postgres=#
                                                                                                      

                                                                                                      It worked! Now, to make it permanent I'm supposed to put this setting on a psqlrc or ~/.psqlrc file. The thin documentation on this (under "Files") was not helpful to me as I was not sure on the syntax and my attempts did not change the client's default, so I moved on.

                                                                                                      To change the server I looked for the postgresql.conf mentioned in the documentation but could not find the file. I did however see /var/lib/postgresql/14/main/postgresql.auto.conf so I created it on the same directory with the content:

                                                                                                      port = 5432
                                                                                                      

                                                                                                      Restarted the server: sudo systemctl restart postgresql

                                                                                                      But the error persisted because, as the logs confirmed, the port did not change:

                                                                                                      $ tail /var/log/postgresql/postgresql-14-main.log
                                                                                                      ...
                                                                                                      2021-10-29 16:36:12.195 UTC [25236] LOG:  listening on IPv4 address "127.0.0.1", port 5433
                                                                                                      2021-10-29 16:36:12.198 UTC [25236] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5433"
                                                                                                      2021-10-29 16:36:12.204 UTC [25237] LOG:  database system was shut down at 2021-10-29 16:36:12 UTC
                                                                                                      2021-10-29 16:36:12.210 UTC [25236] LOG:  database system is ready to accept connections
                                                                                                      

                                                                                                      After other attempts did not succeed, I eventually decided to use a workaround: to redirect the client's requests on 5432 to 5433:

                                                                                                      ln -s /var/run/postgresql/.s.PGSQL.5433 /var/run/postgresql/.s.PGSQL.5432
                                                                                                      

                                                                                                      This is what I have now:

                                                                                                      $ ls -lah /var/run/postgresql/
                                                                                                      total 8.0K
                                                                                                      drwxrwsr-x  4 postgres postgres  160 Oct 29 16:40 .
                                                                                                      drwxr-xr-x 36 root     root     1.1K Oct 29 14:08 ..
                                                                                                      drwxr-s---  2 postgres postgres   40 Oct 29 14:33 12-main.pg_stat_tmp
                                                                                                      drwxr-s---  2 postgres postgres  120 Oct 29 16:59 14-main.pg_stat_tmp
                                                                                                      -rw-r--r--  1 postgres postgres    6 Oct 29 16:36 14-main.pid
                                                                                                      lrwxrwxrwx  1 postgres postgres   33 Oct 29 16:40 .s.PGSQL.5432 -> /var/run/postgresql/.s.PGSQL.5433
                                                                                                      srwxrwxrwx  1 postgres postgres    0 Oct 29 16:36 .s.PGSQL.5433
                                                                                                      -rw-------  1 postgres postgres   70 Oct 29 16:36 .s.PGSQL.5433.lock
                                                                                                      

                                                                                                      This means I can now just run psql without having to explicitly set the port to 5433. Now, this is a hack and I would not recommend it. But in my development system I am happy with it for now, because I don't have more time to spend on this. This is why I shared the steps and the links so that you can find a proper solution for your case.

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

                                                                                                      QUESTION

                                                                                                      AngularFireModule and AngularFireDatabaseModule not being found in @angular/fire
                                                                                                      Asked 2022-Apr-01 at 12:56

                                                                                                      I am trying to implement Firebase Realtime Database into a angular project and Im getting stuck at one of the very first steps. Importing AngularFireModule and AngularFireDatabaseModule. It gives me the following error:

                                                                                                      Module '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305)
                                                                                                      
                                                                                                      Module '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.
                                                                                                      

                                                                                                      And here is how I am importing them:

                                                                                                      import {AngularFireModule } from '@angular/fire';
                                                                                                      import {AngularFireDatabaseModule} from '@angular/fire/database'
                                                                                                      

                                                                                                      Am I missing something here? I have installed @angular/fire via the command

                                                                                                      npm i firebase @angular/fire
                                                                                                      

                                                                                                      and have also installed firebase tools. Here is a list of the Angular packages I currently have installed and their versions:

                                                                                                      Angular CLI: 12.2.2
                                                                                                      Node: 14.17.4
                                                                                                      Package Manager: npm 6.14.14
                                                                                                      OS: win32 x64
                                                                                                      
                                                                                                      Angular: 12.2.3
                                                                                                      ... animations, common, compiler, compiler-cli, core, forms
                                                                                                      ... platform-browser, platform-browser-dynamic, router
                                                                                                      
                                                                                                      Package                         Version
                                                                                                      ---------------------------------------------------------
                                                                                                      @angular-devkit/architect       0.1202.2
                                                                                                      @angular-devkit/build-angular   12.2.2
                                                                                                      @angular-devkit/core            12.2.2
                                                                                                      @angular-devkit/schematics      12.2.2
                                                                                                      @angular/cli                    12.2.2
                                                                                                      @angular/fire                   7.0.0
                                                                                                      @schematics/angular             12.2.2
                                                                                                      rxjs                            6.6.7
                                                                                                      typescript                      4.3.5
                                                                                                      

                                                                                                      I do apologise if this is all excessive information but I am completely stuck as to what the issue is. Any help would be GREATLY appreciated. Right now my suspicion is that its a compatibility issue or perhaps a feature that doesnt exist anymore on the latest versions but I really dont know.

                                                                                                      ANSWER

                                                                                                      Answered 2021-Aug-26 at 13:20

                                                                                                      AngularFire 7.0.0 was launched yesterday with a new API that has a lot of bundle size reduction benefits.

                                                                                                      Instead of top level classes like AngularFireDatabase, you can now import smaller independent functions.

                                                                                                      import { list } from '@angular/fire/database';
                                                                                                      

                                                                                                      The initialization process is a bit different too as it has a more flexible API for specifying configurations.

                                                                                                      @NgModule({
                                                                                                          imports: [
                                                                                                              provideFirebaseApp(() => initializeApp(config)),
                                                                                                              provideFirestore(() => {
                                                                                                                  const firestore = getFirestore();
                                                                                                                  connectEmulator(firestore, 'localhost', 8080);
                                                                                                                  enableIndexedDbPersistence(firestore);
                                                                                                                  return firestore;
                                                                                                              }),
                                                                                                              provideStorage(() => getStorage()),
                                                                                                          ],
                                                                                                      })
                                                                                                      

                                                                                                      If you want to proceed with the older API there's a compatibility layer.

                                                                                                      import { AngularFireModule} from '@angular/fire/compat'
                                                                                                      import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
                                                                                                      

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

                                                                                                      QUESTION

                                                                                                      ASP.NET Core 6 how to access Configuration during startup
                                                                                                      Asked 2022-Mar-08 at 11:45

                                                                                                      In earlier versions, we had Startup.cs class and we get configuration object as follows in the Startup file.

                                                                                                      public class Startup 
                                                                                                      {
                                                                                                          private readonly IHostEnvironment environment;
                                                                                                          private readonly IConfiguration config;
                                                                                                      
                                                                                                          public Startup(IConfiguration configuration, IHostEnvironment environment) 
                                                                                                          {
                                                                                                              this.config = configuration;
                                                                                                              this.environment = environment;
                                                                                                          }
                                                                                                      
                                                                                                          public void ConfigureServices(IServiceCollection services) 
                                                                                                          {
                                                                                                              // Add Services
                                                                                                          }
                                                                                                      
                                                                                                          public void Configure(IApplicationBuilder app, IWebHostEnvironment env) 
                                                                                                          {
                                                                                                              // Add Middlewares
                                                                                                          }
                                                                                                      
                                                                                                      }
                                                                                                      

                                                                                                      Now in .NET 6 (With Visual Studio 2022), we don't see the Startup.cs class. Looks like its days are numbered. So how do we get these objects like Configuration(IConfiguration) and Hosting Environment(IHostEnvironment)

                                                                                                      How do we get these objects, to say read the configuration from appsettings? Currently the Program.cs file looks like this.

                                                                                                      using Festify.Database;
                                                                                                      using Microsoft.EntityFrameworkCore;
                                                                                                      
                                                                                                      var builder = WebApplication.CreateBuilder(args);
                                                                                                      
                                                                                                      // Add services to the container.
                                                                                                      builder.Services.AddRazorPages();
                                                                                                      
                                                                                                      builder.Services.AddDbContext();
                                                                                                      
                                                                                                      
                                                                                                      ////////////////////////////////////////////////
                                                                                                      // The following is Giving me error as Configuration 
                                                                                                      // object is not avaible, I dont know how to inject this here.
                                                                                                      ////////////////////////////////////////////////
                                                                                                      
                                                                                                      
                                                                                                      builder.Services.AddDbContext(opt =>
                                                                                                              opt.UseSqlServer(
                                                                                                                  Configuration.GetConnectionString("Festify")));
                                                                                                      
                                                                                                      
                                                                                                      var app = builder.Build();
                                                                                                      
                                                                                                      // Configure the HTTP request pipeline.
                                                                                                      if (!app.Environment.IsDevelopment())
                                                                                                      {
                                                                                                          app.UseExceptionHandler("/Error");
                                                                                                          // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                                                                                                          app.UseHsts();
                                                                                                      }
                                                                                                      
                                                                                                      app.UseHttpsRedirection();
                                                                                                      app.UseStaticFiles();
                                                                                                      
                                                                                                      app.UseRouting();
                                                                                                      
                                                                                                      app.UseAuthorization();
                                                                                                      
                                                                                                      app.MapRazorPages();
                                                                                                      
                                                                                                      app.Run();
                                                                                                      

                                                                                                      I want to know how to read the configuration from appsettings.json ?

                                                                                                      ANSWER

                                                                                                      Answered 2021-Oct-26 at 12:26

                                                                                                      WebApplicationBuilder returned by WebApplication.CreateBuilder(args) exposes Configuration and Environment properties:

                                                                                                      var builder = WebApplication.CreateBuilder(args);
                                                                                                      
                                                                                                      // Add services to the container.
                                                                                                      ...
                                                                                                      ConfigurationManager configuration = builder.Configuration;
                                                                                                      IWebHostEnvironment environment = builder.Environment;
                                                                                                      

                                                                                                      WebApplication returned by WebApplicationBuilder.Build() also exposes Configuration and Environment:

                                                                                                      var app = builder.Build();
                                                                                                      IConfiguration configuration = app.Configuration;
                                                                                                      IWebHostEnvironment environment = app.Environment;
                                                                                                      

                                                                                                      Also check the migration guide and code samples.

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

                                                                                                      QUESTION

                                                                                                      How to fix: "@angular/fire"' has no exported member 'AngularFireModule'.ts(2305) ionic, firebase, angular
                                                                                                      Asked 2022-Feb-11 at 07:31

                                                                                                      I'm trying to connect my app with a firebase db, but I receive 4 error messages on app.module.ts:

                                                                                                      '"@angular/fire"' has no exported member 'AngularFireModule'.ts(2305),
                                                                                                      '"@angular/fire/storage"' has no exported member 'AngularFireStorageModule'.ts(2305)
                                                                                                      '"@angular/fire/database"' has no exported member 'AngularFireDatabaseModule'.ts(2305)
                                                                                                      '"@angular/fire/auth"' has no exported member 'AngularFireAuthModule'.ts(2305)
                                                                                                      

                                                                                                      here is my package.json file:

                                                                                                      {
                                                                                                        "name": "gescable",
                                                                                                        "version": "0.0.1",
                                                                                                        "author": "Ionic Framework",
                                                                                                        "homepage": "https://ionicframework.com/",
                                                                                                        "scripts": {
                                                                                                          "ng": "ng",
                                                                                                          "start": "ng serve",
                                                                                                          "build": "ng build",
                                                                                                          "test": "ng test",
                                                                                                          "lint": "ng lint",
                                                                                                          "e2e": "ng e2e"
                                                                                                        },
                                                                                                        "private": true,
                                                                                                        "dependencies": {
                                                                                                          "@angular-devkit/architect": "^0.1202.5",
                                                                                                          "@angular-devkit/architect-cli": "^0.1202.5",
                                                                                                          "@angular/common": "~12.1.1",
                                                                                                          "@angular/core": "~12.1.1",
                                                                                                          "@angular/fire": "^7.0.4",
                                                                                                          "@angular/forms": "~12.1.1",
                                                                                                          "@angular/platform-browser": "~12.1.1",
                                                                                                          "@angular/platform-browser-dynamic": "~12.1.1",
                                                                                                          "@angular/router": "~12.1.1",
                                                                                                          "@ionic/angular": "^5.5.2",
                                                                                                          "ajv": "^8.6.2",
                                                                                                          "angularfire2": "^5.4.2",
                                                                                                          "firebase": "^7.24.0",
                                                                                                          "rxfire": "^6.0.0",
                                                                                                          "rxjs": "~6.6.0",
                                                                                                          "tslib": "^2.2.0",
                                                                                                          "zone.js": "~0.11.4"
                                                                                                        },
                                                                                                        "devDependencies": {
                                                                                                          "@angular-devkit/build-angular": "~12.1.1",
                                                                                                          "@angular-eslint/builder": "~12.0.0",
                                                                                                          "@angular-eslint/eslint-plugin": "~12.0.0",
                                                                                                          "@angular-eslint/eslint-plugin-template": "~12.0.0",
                                                                                                          "@angular-eslint/template-parser": "~12.0.0",
                                                                                                          "@angular/cli": "~12.1.1",
                                                                                                          "@angular/compiler": "~12.1.1",
                                                                                                          "@angular/compiler-cli": "~12.1.1",
                                                                                                          "@angular/language-service": "~12.0.1",
                                                                                                          "@ionic/angular-toolkit": "^4.0.0",
                                                                                                          "@types/jasmine": "~3.6.0",
                                                                                                          "@types/jasminewd2": "~2.0.3",
                                                                                                          "@types/node": "^12.11.1",
                                                                                                          "@typescript-eslint/eslint-plugin": "4.16.1",
                                                                                                          "@typescript-eslint/parser": "4.16.1",
                                                                                                          "eslint": "^7.6.0",
                                                                                                          "eslint-plugin-import": "2.22.1",
                                                                                                          "eslint-plugin-jsdoc": "30.7.6",
                                                                                                          "eslint-plugin-prefer-arrow": "1.2.2",
                                                                                                          "jasmine-core": "~3.8.0",
                                                                                                          "jasmine-spec-reporter": "~5.0.0",
                                                                                                          "karma": "~6.3.2",
                                                                                                          "karma-chrome-launcher": "~3.1.0",
                                                                                                          "karma-coverage": "~2.0.3",
                                                                                                          "karma-coverage-istanbul-reporter": "~3.0.2",
                                                                                                          "karma-jasmine": "~4.0.0",
                                                                                                          "karma-jasmine-html-reporter": "^1.5.0",
                                                                                                          "protractor": "~7.0.0",
                                                                                                          "ts-node": "~8.3.0",
                                                                                                          "typescript": "~4.2.4",
                                                                                                          "@angular-devkit/architect": "^0.1200.0",
                                                                                                          "firebase-tools": "^9.0.0",
                                                                                                          "fuzzy": "^0.1.3",
                                                                                                          "inquirer": "^6.2.2",
                                                                                                          "inquirer-autocomplete-prompt": "^1.0.1",
                                                                                                          "open": "^7.0.3",
                                                                                                          "jsonc-parser": "^3.0.0"
                                                                                                        },
                                                                                                        "description": "An Ionic project"
                                                                                                      }
                                                                                                      

                                                                                                      And here is my app.module.ts:

                                                                                                      import { NgModule } from '@angular/core';
                                                                                                      import { BrowserModule } from '@angular/platform-browser';
                                                                                                      import { RouteReuseStrategy } from '@angular/router';
                                                                                                      import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
                                                                                                      import { AppRoutingModule } from './app-routing.module';
                                                                                                      import { AppComponent } from './app.component';
                                                                                                      import { ClientPageModule } from './client/client.module';
                                                                                                      import { environment } from '../environments/environment';
                                                                                                      import { AngularFireModule } from '@angular/fire';
                                                                                                      import { AngularFireAuthModule } from '@angular/fire/auth';
                                                                                                      import { AngularFireStorageModule } from '@angular/fire/storage';
                                                                                                      import { AngularFireDatabaseModule } from '@angular/fire/database';
                                                                                                      
                                                                                                      @NgModule({
                                                                                                        declarations: [AppComponent],
                                                                                                        entryComponents: [],
                                                                                                        imports: [
                                                                                                          BrowserModule,
                                                                                                          IonicModule.forRoot(),
                                                                                                          AppRoutingModule,
                                                                                                          ClientPageModule,
                                                                                                          AngularFireModule.initializeApp(environment.firebaseConfig),
                                                                                                          AngularFireAuthModule,
                                                                                                          AngularFireStorageModule,
                                                                                                          AngularFireDatabaseModule
                                                                                                        ],
                                                                                                        providers: [{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
                                                                                                        bootstrap: [AppComponent],
                                                                                                      })
                                                                                                      export class AppModule {}
                                                                                                      

                                                                                                      Here is my tsonfig.ts file

                                                                                                        "compileOnSave": false,
                                                                                                        "compilerOptions": {
                                                                                                          "baseUrl": "./",
                                                                                                          "outDir": "./dist/out-tsc",
                                                                                                          "sourceMap": true,
                                                                                                          "declaration": false,
                                                                                                          "downlevelIteration": true,
                                                                                                          "experimentalDecorators": true,
                                                                                                          "moduleResolution": "node",
                                                                                                          "importHelpers": true,
                                                                                                          "target": "es2015",
                                                                                                          "module": "es2020",
                                                                                                          "lib": ["es2018", "dom"]
                                                                                                        },
                                                                                                        "angularCompilerOptions": {
                                                                                                          "enableI18nLegacyMessageIdFormat": false,
                                                                                                          "strictInjectionParameters": true,
                                                                                                          "strictInputAccessModifiers": true,
                                                                                                          "strictTemplates": true,
                                                                                                          "skipLibCheck": true 
                                                                                                        }
                                                                                                      }
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2021-Sep-10 at 12:47

                                                                                                      You need to add "compat" like this

                                                                                                      import { AngularFireModule } from "@angular/fire/compat";
                                                                                                      import { AngularFireAuthModule } from "@angular/fire/compat/auth";
                                                                                                      import { AngularFireStorageModule } from '@angular/fire/compat/storage';
                                                                                                      import { AngularFirestoreModule } from '@angular/fire/compat/firestore';
                                                                                                      import { AngularFireDatabaseModule } from '@angular/fire/compat/database';
                                                                                                      

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

                                                                                                      QUESTION

                                                                                                      pymongo [SSL: CERTIFICATE_VERIFY_FAILED]: certificate has expired on Mongo Atlas
                                                                                                      Asked 2022-Jan-29 at 22:03

                                                                                                      I am using MongoDB(Mongo Atlas) in my Django app. All was working fine till yesterday. But today, when I ran the server, it is showing me the following error on console

                                                                                                      Exception in thread django-main-thread:
                                                                                                      Traceback (most recent call last):
                                                                                                        File "c:\users\admin\appdata\local\programs\python\python39\lib\threading.py", line 973, in _bootstrap_inner
                                                                                                          self.run()
                                                                                                        File "c:\users\admin\appdata\local\programs\python\python39\lib\threading.py", line 910, in run
                                                                                                          self._target(*self._args, **self._kwargs)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\utils\autoreload.py", line 64, in wrapper
                                                                                                          fn(*args, **kwargs)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\core\management\commands\runserver.py", line 121, in inner_run
                                                                                                          self.check_migrations()
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\core\management\base.py", line 486, in check_migrations
                                                                                                          executor = MigrationExecutor(connections[DEFAULT_DB_ALIAS])
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
                                                                                                          self.loader = MigrationLoader(self.connection)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\migrations\loader.py", line 53, in __init__
                                                                                                          self.build_graph()
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\migrations\loader.py", line 220, in build_graph
                                                                                                          self.applied_migrations = recorder.applied_migrations()
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\migrations\recorder.py", line 77, in applied_migrations
                                                                                                          if self.has_table():
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\migrations\recorder.py", line 56, in has_table
                                                                                                          tables = self.connection.introspection.table_names(cursor)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\backends\base\introspection.py", line 52, in table_names
                                                                                                          return get_names(cursor)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\django\db\backends\base\introspection.py", line 47, in get_names
                                                                                                          return sorted(ti.name for ti in self.get_table_list(cursor)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\djongo\introspection.py", line 47, in get_table_list
                                                                                                          for c in cursor.db_conn.list_collection_names()
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\database.py", line 880, in list_collection_names
                                                                                                          for result in self.list_collections(session=session, **kwargs)]
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\database.py", line 842, in list_collections
                                                                                                          return self.__client._retryable_read(
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\mongo_client.py", line 1514, in _retryable_read
                                                                                                          server = self._select_server(
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\mongo_client.py", line 1346, in _select_server
                                                                                                          server = topology.select_server(server_selector)
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\topology.py", line 244, in select_server
                                                                                                          return random.choice(self.select_servers(selector,
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\topology.py", line 202, in select_servers
                                                                                                          server_descriptions = self._select_servers_loop(
                                                                                                        File "C:\Users\Admin\AppData\Local\Programs\Python\Python39\Lib\site-packages\pymongo\topology.py", line 218, in _select_servers_loop
                                                                                                          raise ServerSelectionTimeoutError(
                                                                                                      pymongo.errors.ServerSelectionTimeoutError: cluster0-shard-00-02.mny7y.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129),cluster0-shard-00-01.mny7y.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129),cluster0-shard-00-00.mny7y.mongodb.net:27017: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1129), Timeout: 30s, Topology Description: , , ]>
                                                                                                      

                                                                                                      I am using djongo as the database engine

                                                                                                      DATABASES = {
                                                                                                          'default': {
                                                                                                                  'ENGINE': 'djongo',
                                                                                                                  'NAME': 'DbName',
                                                                                                                  'ENFORCE_SCHEMA': False,
                                                                                                                  'CLIENT': {
                                                                                                                      'host': 'mongodb+srv://username:password@cluster0.mny7y.mongodb.net/DbName?retryWrites=true&w=majority'
                                                                                                                  }  
                                                                                                          }
                                                                                                      }
                                                                                                      

                                                                                                      And following dependencies are being used in the app

                                                                                                      dj-database-url==0.5.0
                                                                                                      Django==3.2.5
                                                                                                      djangorestframework==3.12.4
                                                                                                      django-cors-headers==3.7.0
                                                                                                      gunicorn==20.1.0
                                                                                                      psycopg2==2.9.1
                                                                                                      pytz==2021.1
                                                                                                      whitenoise==5.3.0
                                                                                                      djongo==1.3.6
                                                                                                      dnspython==2.1.0
                                                                                                      

                                                                                                      What should be done in order to resolve this error?

                                                                                                      ANSWER

                                                                                                      Answered 2021-Oct-03 at 05:57

                                                                                                      This is because of a root CA Let’s Encrypt uses (and Mongo Atals uses Let's Encrypt) has expired on 2020-09-30 - namely the "IdentTrust DST Root CA X3" one.

                                                                                                      The fix is to manually install in the Windows certificate store the "ISRG Root X1" and "ISRG Root X2" root certificates, and the "Let’s Encrypt R3" intermediate one - link to their official site - https://letsencrypt.org/certificates/

                                                                                                      Copy from the comments: download the .der field from the 1st category, download, double click and follow the wizard to install it.

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

                                                                                                      QUESTION

                                                                                                      java.lang.RuntimeException: android.database.sqlite.SQLiteException: no such table: media_store_extension (code 1): ,
                                                                                                      Asked 2022-Jan-18 at 08:15

                                                                                                      i'm having a problem to publish my app on the play store after october 2021, the error says that the table media_store_extension doesn't exist. The thing is: i don't use SQLITE on the project, so i have no idea what may be causing this exception.

                                                                                                      The target sdk is 30, and de minimun is 26

                                                                                                      The full error:

                                                                                                      FATAL EXCEPTION: latency_sensitive_executor-thread-1
                                                                                                      Process: com.google.android.apps.photos, PID: 29478
                                                                                                      java.lang.RuntimeException: android.database.sqlite.SQLiteException: no such table: media_store_extension (code 1): , while compiling: SELECT id FROM media_store_extension ORDER BY id DESC LIMIT 100 OFFSET 0
                                                                                                          at nqo.a(PG:3)
                                                                                                          at aleu.run(PG:6)
                                                                                                          at krv.a(PG:17)
                                                                                                          at krw.run(Unknown Source:6)
                                                                                                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
                                                                                                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
                                                                                                          at java.lang.Thread.run(Thread.java:764)
                                                                                                          at ksa.run(PG:5)
                                                                                                      Caused by: android.database.sqlite.SQLiteException: no such table: media_store_extension (code 1): , while compiling: SELECT id FROM media_store_extension ORDER BY id DESC LIMIT 100 OFFSET 0
                                                                                                          at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                                                          at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:890)
                                                                                                          at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:501)
                                                                                                          at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                                                          at android.database.sqlite.SQLiteProgram.(SQLiteProgram.java:58)
                                                                                                          at android.database.sqlite.SQLiteQuery.(SQLiteQuery.java:37)
                                                                                                          at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
                                                                                                          at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1392)
                                                                                                          at android.database.sqlite.SQLiteDatabase.queryWithFactory(SQLiteDatabase.java:1239)
                                                                                                          at android.database.sqlite.SQLiteDatabase.query(SQLiteDatabase.java:1110)
                                                                                                          at agcm.a(PG:8)
                                                                                                          at nnw.run(PG:17)
                                                                                                          at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
                                                                                                          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
                                                                                                          ... 4 more
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2021-Nov-18 at 11:41

                                                                                                      This error is reported not only from Flutter developers, but also from Unity (https://forum.unity.com/threads/getting-an-odd-error-in-internal-android-build-after-updating-iap.1104352/ and https://forum.unity.com/threads/error-when-submitting-app-to-google-play.1098139/) and in my case - for a native android app.

                                                                                                      We first got this error 6 months ago and applied the fix that was suggested by the unity guys:

                                                                                                      aaptOptions {
                                                                                                          noCompress 'db'
                                                                                                          ...
                                                                                                      }
                                                                                                      

                                                                                                      However, yesterday we received the same error again, so the "fix" did not work for us.

                                                                                                      The error occurs:

                                                                                                      1. (so far) only during internal testing
                                                                                                      2. only on Xiaomi Redmi 6A.
                                                                                                      3. from time to time(it is not reproduced each time)
                                                                                                      4. always in process com.google.android.apps.photos

                                                                                                      The most reasonable explanation that I have seen so far is that the exception occurs when the testing bot attempts to take a screenshot.

                                                                                                      This explains why the process is Google Photos', why the error is not reproduced each time and why it is "fixed" by just resubmitting a new build.

                                                                                                      This also means that just ignoring the error should be OK.

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

                                                                                                      QUESTION

                                                                                                      How to solve FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore problem?
                                                                                                      Asked 2022-Jan-11 at 15:08

                                                                                                      I am trying to set up Firebase with next.js. I am getting this error in the console.

                                                                                                      FirebaseError: Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore

                                                                                                      This is one of my custom hook

                                                                                                      import { onAuthStateChanged, User } from '@firebase/auth'
                                                                                                      import { doc, onSnapshot, Unsubscribe } from 'firebase/firestore'
                                                                                                      import { useEffect, useState } from 'react'
                                                                                                      import { auth, fireStore } from './firebase'
                                                                                                      
                                                                                                      export const useUserData = () => {
                                                                                                        const [username, setUsername] = useState(null)
                                                                                                      
                                                                                                        const [currentUser, setCurrentUser] = useState(null)
                                                                                                      
                                                                                                        useEffect(() => {
                                                                                                          let unsubscribe: void | Unsubscribe
                                                                                                      
                                                                                                          onAuthStateChanged(auth, (user) => {
                                                                                                            if (user) {
                                                                                                              setCurrentUser(user)
                                                                                                              // The Problem is inside this try blog
                                                                                                              try {
                                                                                                                // the onsnapshot function is causing the problem
                                                                                                                console.log('firestore: ', fireStore)
                                                                                                                unsubscribe = onSnapshot(doc(fireStore, 'users', user.uid), (doc) => {
                                                                                                                  setUsername(doc.data()?.username)
                                                                                                                })
                                                                                                              } catch (e) {
                                                                                                                console.log(e.message)
                                                                                                              }
                                                                                                            } else {
                                                                                                              setCurrentUser(null)
                                                                                                              setUsername(null)
                                                                                                            }
                                                                                                          })
                                                                                                      
                                                                                                          return unsubscribe
                                                                                                        }, [currentUser])
                                                                                                      
                                                                                                        return { currentUser, username }
                                                                                                      }
                                                                                                      

                                                                                                      I also have this firebase.ts file where I initialized my firebase app

                                                                                                      import { FirebaseApp, getApps, initializeApp } from 'firebase/app'
                                                                                                      import { getAuth } from 'firebase/auth'
                                                                                                      import { getFirestore } from 'firebase/firestore/lite'
                                                                                                      import { getStorage } from 'firebase/storage'
                                                                                                      
                                                                                                      const firebaseConfig = {
                                                                                                        apiKey: 'some-api',
                                                                                                        authDomain: 'some-auth-domain',
                                                                                                        projectId: 'some-project-id',
                                                                                                        storageBucket: 'some-storage-bucket',
                                                                                                        messagingSenderId: 'some-id',
                                                                                                        appId: 'some-app-id',
                                                                                                        measurementId: 'some-measurement-id',
                                                                                                      }
                                                                                                      
                                                                                                      let firebaseApp: FirebaseApp
                                                                                                      
                                                                                                      if (!getApps.length) {
                                                                                                        firebaseApp = initializeApp(firebaseConfig)
                                                                                                      }
                                                                                                      
                                                                                                      const fireStore = getFirestore(firebaseApp)
                                                                                                      const auth = getAuth(firebaseApp)
                                                                                                      const storage = getStorage(firebaseApp)
                                                                                                      
                                                                                                      export { fireStore, auth, storage }
                                                                                                      

                                                                                                      I don't know whether the problem is in the project initialization. I am pretty sure the error is generated from my custom hook file. I also found out that there must be something wrong with onSnapshot function. Am I passing the docRef wrong or something? What am I doing wrong here?

                                                                                                      The console.log(firestore) log:

                                                                                                      
                                                                                                          type: "firestore-lite"
                                                                                                          _app: FirebaseAppImpl
                                                                                                          _automaticDataCollectionEnabled: false
                                                                                                          _config: {name: "[DEFAULT]", automaticDataCollectionEnabled: false}
                                                                                                          _container: ComponentContainer {name: "[DEFAULT]", providers: Map(15)}
                                                                                                          _isDeleted: false
                                                                                                          _name: "[DEFAULT]"
                                                                                                          _options:
                                                                                                          apiKey: 'some-api'
                                                                                                          authDomain: 'some-auth-domain'
                                                                                                          projectId: 'some-project-id'
                                                                                                          storageBucket: 'some-storage-bucket'
                                                                                                          messagingSenderId: 'some-id'
                                                                                                          appId: 'some-app-id'
                                                                                                          measurementId: 'some-measurement-id'
                                                                                                          [[Prototype]]: Object
                                                                                                          automaticDataCollectionEnabled: (...)
                                                                                                          config: (...)
                                                                                                          container: (...)
                                                                                                          isDeleted: (...)
                                                                                                          name: (...)
                                                                                                          options: (...)
                                                                                                          [[Prototype]]: Object
                                                                                                          _credentials: Q {auth: AuthInterop}
                                                                                                          _databaseId: H {projectId: "next-firebase-fireship", database: "(default)"}
                                                                                                          _persistenceKey: "(lite)"
                                                                                                          _settings: ee {host: "firestore.googleapis.com", ssl: true, credentials: undefined, ignoreUndefinedProperties: false, cacheSizeBytes: 41943040, …}
                                                                                                          _settingsFrozen: false
                                                                                                          app: (...)
                                                                                                          _initialized: (...)
                                                                                                          _terminated: (...)
                                                                                                      
                                                                                                      

                                                                                                      ANSWER

                                                                                                      Answered 2022-Jan-07 at 19:07

                                                                                                      Using getFirestore from lite library will not work with onSnapshot. You are importing getFirestore from lite version:

                                                                                                      import { getFirestore } from 'firebase/firestore/lite'
                                                                                                      

                                                                                                      Change the import to:

                                                                                                      import { getFirestore } from 'firebase/firestore'
                                                                                                      

                                                                                                      From the documentation,

                                                                                                      The onSnapshot method and DocumentChange, SnapshotListenerOptions, SnapshotMetadata, SnapshotOptions and Unsubscribe objects are not included in lite version.

                                                                                                      Another reason for this error to show up could be passing invalid first argument to collection() or doc() functions. They both take a Firestore instance as first argument.

                                                                                                      // Ensure that "db" is defined and initialized
                                                                                                      const db = getFirestore();
                                                                                                      // console.log(db);
                                                                                                      
                                                                                                      const colRef = collection(db, "collection_name");
                                                                                                      

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

                                                                                                      QUESTION

                                                                                                      How do I get details of a veracode vulnerability report?
                                                                                                      Asked 2022-Jan-07 at 21:46

                                                                                                      How do I get details of a veracode vulnerability report?

                                                                                                      I'm a maintainer of a popular JS library, Ramda, and we've recently received a report that the library is subject to a prototype pollution vulnerability. This has been tracked back to a veracode report that says:

                                                                                                      ramda is vulnerable to prototype pollution. An attacker can inject properties into existing construct prototypes via the _curry2 function and modify attributes such as __proto__, constructor, and prototype.

                                                                                                      I understand what they're talking about for Prototype Pollution. A good explanation is at snyk's writeup for lodash.merge. Ramda's design is different, and the obvious analogous Ramda code is not subject to this sort of vulnerability. That does not mean that no part of Ramda is subject to it. But the report contains no details, no code snippet, and no means to challenge their findings.

                                                                                                      The details of their description are clearly wrong. _curry2 could not possibly be subject to this problem. But as that function is used as a wrapper to many other functions, it's possible that there is a real vulnerability hidden by the reporter's misunderstanding.

                                                                                                      Is there a way to get details of this error report? A snippet of code that demonstrates the problem? Anything? I have filled out their contact form. An answer may still be coming, as it was only 24 hours ago, but I'm not holding my breath -- it seems to be mostly a sales form. All the searching I've done leads to information about how to use their security tool and pretty much nothing about how their custom reports are created. And I can't find this in CVE databases.

                                                                                                      ANSWER

                                                                                                      Answered 2022-Jan-07 at 21:46

                                                                                                      Ok, so to answer my own question, here's how to get the details on a Veracode vulnerability report in less than four weeks and in only fifty-five easy steps.

                                                                                                      Pre-work Day 1
                                                                                                      • Receive a comment on the issue that says that the user has received

                                                                                                        a VULN ticket to fix this Prototype Pollution vulnerability found in ramda.

                                                                                                      • Carry on a discussion regarding this comment to learn that there is a report that claims that

                                                                                                        ramda is vulnerable to prototype pollution. An attacker can inject properties into existing construct prototypes via the _curry2 function and modify attributes such as __proto__, constructor, and prototype.

                                                                                                        and eventually learn that this is due to a report from the software security company Veracode.

                                                                                                      Days 2 & 3
                                                                                                      • Examine that report to find that it has no details, no explanation of how to trigger the vulnerability, and no suggested fix.

                                                                                                      • Examine the report and other parts of the Veracode site to find there is no public mechanism to challenge such a report.

                                                                                                      Day 4
                                                                                                      • Report back to the library's issue that the report must be wrong, as the function mentioned could not possibly generate the behavior described.

                                                                                                      • Post an actual example of the vulnerability under discussion and a parallel snippet from the library to demonstrate that it doesn't share the problem.

                                                                                                      • Find Veracode's online support form, and submit a request for help. Keep your expectations low, as this is probably for the sales department.

                                                                                                      • Post a StackOverflow Question2 asking how to find details of a Veracode vulnerability report, using enough details that if the community has the knowledge, it should be easy to answer.

                                                                                                      Days 5 & 6
                                                                                                      • Try to enjoy your Friday and Saturday. Don't obsessively check your email to see if Veracode has responded. Don't visit the StackOverflow question every hour to see if anyone has posted a solution. Really, don't do these things; they don't help.
                                                                                                      Day 7
                                                                                                      • Add a 250-reputation point bounty to the StackOverflow question, trying to get additional attention from the smart people who must have dealt with this before.
                                                                                                      Day 8
                                                                                                      • Find direct email support addresses on the Veracode site, and send an email asking for details of the supposed vulnerability, a snippet that demonstrates the issue, and procedures to challenge their findings.
                                                                                                      Day 9
                                                                                                      • Receive a response from a Veracode Support email addressthat says, in part,

                                                                                                        Are you saying our vuln db is not correct per your github source? If so, I can send it to our research team to ensure it looks good and if not, to update it.

                                                                                                        As for snips of code, we do not provide that.

                                                                                                      • Reply, explaining that you find the report missing the details necessary to challenge it, but that yes, you expect it is incorrect.

                                                                                                      • Receive a response that this has been "shot up the chain" and that you will be hearing from them soon.

                                                                                                      Days 10 - 11
                                                                                                      • Again, don't obsessively check your email or the StackOverflow question. But if you do happen to glance at StackOverflow, notice that while there are still no answers to it, there are enough upvotes to cover over half the cost of the bounty. Clearly you're not alone in wanting to know how to do this.
                                                                                                      Day 12
                                                                                                      • Receive an email from Veracode:

                                                                                                        Thank you for your interest in Application Security and Veracode.

                                                                                                        Do you have time next week to connect?

                                                                                                        Also, to make sure you are aligned with the right rep, where is your company headquartered?

                                                                                                      • Respond that you're not a potential customer and explain again what you're looking for.

                                                                                                      • Add a comment to the StackOverflow to explain where the process has gotten to and expressing your frustration.

                                                                                                      Days 13 - 14
                                                                                                      • Watch another weekend go by without any way to address this concern.

                                                                                                      • Get involved in a somewhat interesting discussion about prototype pollution in the comments to the StackOverflow post.

                                                                                                      Day 15
                                                                                                      • Receive an actually helpful email from Veracode, sent by someone new, whose signature says he's a sales manager. The email will look like this:

                                                                                                        Hi Scott, I asked my team to help out with your question, here was their response:

                                                                                                        We have based this artifact from the information available in https://github.com/ramda/ramda/pull/3192. In the Pull Request, there is a POC (https://jsfiddle.net/3pomzw5g/2/) clearly demonstrating the prototype pollution vulnerability in the mapObjIndexed function. In the demo, the user object is modified via the __proto__​ property and is
                                                                                                        considered a violation to the Integrity of the CIA triad. This has been reflected in our CVSS scoring for this vulnerability in our vuln db.

                                                                                                        There is also an unmerged fix for the vulnerability which has also been
                                                                                                        included in our artifact (https://github.com/ramda/ramda/pull/3192/commits/774f767a10f37d1f844168cb7e6412ea6660112d )

                                                                                                        Please let me know if there is a dispute against the POC, and we can look further into this.

                                                                                                      • Try to avoid banging your head against the wall for too long when you realize that the issue you thought might have been raised by someone who'd seen the Veracode report was instead the source of that report.

                                                                                                      • Respond to this helpful person that yes you will have a dispute for this, and ask if you can be put directly in touch with the relevant Veracode people so there doesn't have to be a middleman.

                                                                                                      • Receive an email from this helpful person -- who needs a name, let's call him "Kevin" -- receive an email from Kevin adding to the email chain the research team. (I told you he was helpful!)

                                                                                                      • Respond to Kevin and the team with a brief note that you will spend some time to write up a response and get back to them soon.

                                                                                                      • Look again at the Veracode Report and note that the description has been changed to

                                                                                                        ramda is vulnerable to prototype pollution. An attacker is able to inject and modify attributes of an object through the mapObjIndexed function via the proto property.

                                                                                                        but note also that it still contains no details, no snippets, no dispute process.

                                                                                                      • Receive a bounced-email notification because that research team's email is for internal Veracode use only.

                                                                                                      • Laugh because the only other option is to cry.

                                                                                                      • Tell Kevin what happened and make sure he's willing to remain as an intermediary. Again he's helpful and will agree right away.

                                                                                                      • Spend several hours writing up a detailed response, explaining what prototype pollution is and how the examples do not display this behavior. Post it ahead of time on the issue. (Remember the issue? This is a story about the issue.3) Ask those reading for suggestions before you send the email... mostly as a way to ensure you're not sending this in anger.

                                                                                                      • Go ahead and email it right away anyway; if you said something too angry you probably don't want to be talked out of it now, anyhow.

                                                                                                      • Note that the nonrefundable StackOverflow bounty has expired without a single answer being offered.

                                                                                                      Days 16 - 21
                                                                                                      • Twiddle your thumbs for a week, but meanwhile...

                                                                                                      • Receive a marketing email from Veracode, who has never sent you one before.

                                                                                                      • Note that Veracode has again updated the description to say

                                                                                                        ramda allows object prototype manipulation. An attacker is able to inject and modify attributes of an object through the mapObjIndexed function via the proto property. However, due to ramda's design where object immutability is the default, the impact of this vulnerability is limited to the scope of the object instead of the underlying object prototype. Nonetheless, the possibility of object prototype manipulation as demonstrated in the proof-of-concept under References can potentially cause unexpected behaviors in the application. There are currently no known exploits.

                                                                                                        If that's not clear, a translation would be, "Hey, we reported this, and we don't want to back down, so we're going to say that even though the behavior we noted didn't actually happen, the behavior that's there is still, umm, err, somehow wrong."

                                                                                                      • Note that a fan of the library whose employer has a Veracode account has been able to glean more information from their reports. It turns out that their details are restricted to logged-in users, leaving it entirely unclear how they thing such vulnerabilities should be fixed.

                                                                                                      Day 22
                                                                                                      • Send a follow-up email to Kevin4 saying

                                                                                                        I'm wondering if there is any response to this.

                                                                                                        I see that the vulnerability report has been updated but not removed.
                                                                                                        I still dispute the altered version of it. If this behavior is a true vulnerability, could you point me to the equivalent report on JavaScript's Object.assign, which, as demonstrated earlier, has the exact same issue as the function in question.

                                                                                                        My immediate goal is to see this report retracted. But I also want to point out the pain involved in this process, pain that I think Veracode could fix:

                                                                                                        I am not a customer, but your customers are coming to me as Ramda's maintainer to fix a problem you've reported. That report really should have enough information in it to allow me to confirm the vulnerability reported. I've learned that such information is available to a logged- in customer. That doesn't help me or others in my position to find the information. Resorting to email and filtering it through your sales department, is a pretty horrible process. Could you alter your public reports to contain or point to a proof of concept of the vulnerability?
                                                                                                        And could you further offer in the report some hint at a dispute process?

                                                                                                      Day 23
                                                                                                      • Receive an email from the still-helpful Kevin, which says

                                                                                                        Thanks for the follow up [ ... ], I will continue to manage the communication with my team, at this time they are looking into the matter and it has been raised up to the highest levels.

                                                                                                        Please reach back out to me if you don’t have a response within 72 hrs.

                                                                                                        Thank you for your patience as we investigate the issue, this is a new process for me as well.

                                                                                                      • Laugh out loud at the notion that he thinks you're being patient.

                                                                                                      • Respond, apologizing to Kevin that he's caught in the middle, and read his good-natured reply.

                                                                                                      Day 25
                                                                                                      • Hear back from Kevin that your main objective has been met:

                                                                                                        Hi Scott, I wanted to provide an update, my engineering team got back
                                                                                                        to me with the following:

                                                                                                        “updating our DB to remove the report is the final outcome”

                                                                                                        I have also asked for them to let me know about your question regarding the ability to contend findings and will relay that back once feedback is received.

                                                                                                        Otherwise, I hope this satisfies your request and please let me know if any further action is needed from us at this time.

                                                                                                      • Respond gratefully to Kevin and note that you would still like to hear about how they're changing their processes.

                                                                                                      • Reply to your own email to apologize to Kevin for all the misspelling that happened when you try to type anything more than a short text on your mobile device.

                                                                                                      • Check with that helpful Ramda user with Veracode log-in abilities whether the site seems to be updated properly.

                                                                                                      • Reach out to that same user on Twitter when he hasn't responded in five minutes. It's not that you're anxious and want to put this behind you. Really it's not. You're not that kind of person.

                                                                                                      • Read that user's detailed response explaining that all is well.

                                                                                                      • Receive a follow-up from the Veracode Support email address telling you that

                                                                                                        After much consideration we have decided to update our db to remove this report.

                                                                                                        and that they're closing the issue.

                                                                                                      • Laugh about the fact that they are sending this after what seem likely the close of business for the week (7:00 PM your time on a Friday.)

                                                                                                      • Respond politely to say that you're grateful for the result, but that you would still like to see their dispute process modernized.

                                                                                                      Day 27
                                                                                                      • Write a 2257-word answer5 to your own Stack Overflow question explaining in great detail the process you went through to resolve this issue.

                                                                                                      And that's all it takes. So the next time you run into this, you can solve it too!




                                                                                                      Update

                                                                                                      (because you knew it couldn't be that easy!)

                                                                                                      Day 61
                                                                                                      • Receive an email from a new Veracode account executive which says

                                                                                                        Thanks for your interest! Introducing myself as your point of contact at Veracode.

                                                                                                        I'd welcome the chance to answer any questions you may have around Veracode's services and approach to the space.

                                                                                                        Do you have a few minutes free to touch base? Please let me know a convenient time for you and I'll follow up accordingly.

                                                                                                      • Politely respond to that email suggesting a talk with Kevin and including a link to this list of steps.


                                                                                                      1 This is standard behavior with Ramda issues, but it might be the main reason Veracode chose to report this.

                                                                                                      2 Be careful not to get into an infinite loop. This recursion does not have a base case.

                                                                                                      3 Hey, this was taking place around Thanksgiving. There had to be an Alice's Restaurant reference!

                                                                                                      4 If you haven't yet found a Kevin, now would be a good time to insist that Veracode supply you with one.

                                                                                                      5 Including footnotes.

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

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

                                                                                                      Vulnerabilities

                                                                                                      No vulnerabilities reported

                                                                                                      Install database

                                                                                                      Up and running with Blazegraph in under 30 seconds: Quick Start.

                                                                                                      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 Data Manipulation Libraries

                                                                                                      Try Top Libraries by blazegraph

                                                                                                      blazegraph-samples

                                                                                                      by blazegraphJava

                                                                                                      tinkerpop3

                                                                                                      by blazegraphJava

                                                                                                      blazegraph-python

                                                                                                      by blazegraphPython

                                                                                                      blazegraph-dotnetrdf

                                                                                                      by blazegraphC#

                                                                                                      blazegraph.github.io

                                                                                                      by blazegraphHTML

                                                                                                      Compare Data Manipulation Libraries with Highest Support

                                                                                                      numpy

                                                                                                      by numpy

                                                                                                      hapi-fhir

                                                                                                      by jamesagnew

                                                                                                      nbconvert

                                                                                                      by jupyter

                                                                                                      protege

                                                                                                      by protegeproject

                                                                                                      database

                                                                                                      by blazegraph

                                                                                                      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