Sunday, May 29, 2022

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow

Recent Questions - Stack Overflow


Will Laravel queue worker exit mid execution with --max-time?

Posted: 29 May 2022 09:04 AM PDT

In Laravel documentation, it states that --max-time will instruct the worker to process jobs for the given number of seconds and then exit. I suppose this timer starts when the queue worker is active right? In that case, if my max-time is 600 seconds, at 600 seconds mark, if there's still a job being processed, will the worker still immediately quit or it will wait for the job to finish before quitting?

How do you apply a button style to all buttons in an Android app?

Posted: 29 May 2022 09:04 AM PDT

I've created a brand new app using the basic activity. I want to change the colour of all buttons (from the default primary colour of purple to a custom non-primary colour of green). Here's my themes.xml:

<resources xmlns:tools="http://schemas.android.com/tools">      <!-- Base application theme. -->      <style name="Theme.MyApplication" parent="Theme.MaterialComponents.DayNight.DarkActionBar">          <!-- Primary brand color. -->          <item name="colorPrimary">@color/purple_500</item>          <item name="colorPrimaryVariant">@color/purple_700</item>          <item name="colorOnPrimary">@color/white</item>          <!-- Secondary brand color. -->          <item name="colorSecondary">@color/teal_200</item>          <item name="colorSecondaryVariant">@color/teal_700</item>          <item name="colorOnSecondary">@color/black</item>          <!-- Status bar color. -->          <item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>          <item name="buttonStyle">@style/ButtonColour</item>            <!-- Customize your theme here. -->      </style>        <style name="Theme.MyApplication.NoActionBar">          <item name="windowActionBar">false</item>          <item name="windowNoTitle">true</item>      </style>      <style name="ButtonColour" parent="Widget.MaterialComponents.Button">          <item name="backgroundTint">#689f38</item>          <item name="rippleColor">#c5e1a5</item>      </style>      <style name="Theme.MyApplication.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />        <style name="Theme.MyApplication.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />  </resources>  

where I apply the ButtonColour style, as defined in the android dev docs here: https://developer.android.com/guide/topics/ui/look-and-feel/themes#Widgets When the app is ran with that custom style to change the buttons to green, the buttons are still the default primary colour.

I've read other questions (1, 2, and 3) but none of their solutions helps either. Does anyone have any guidance on how this can properly be done?

Bundling and distributing json file within extension to then read it

Posted: 29 May 2022 09:03 AM PDT

I'm looking to add omnibox suggestions using flexsearch index which may be exported as files. I saw api for downloading a file, but I'd rather not have to host the index (also I dont want the hustle of copying data to non-user reachable environment). Is there some manifest field to require that json be included in extension bundle and api for reading it?

How to store the output of commander in github.com/google/subcommands library?

Posted: 29 May 2022 09:03 AM PDT

library: https://pkg.go.dev/github.com/google/subcommands tutorial: https://osinet.fr/go/en/articles/cli-google-subcommands/

tldr; I'm trying to make a golang CLI that accepts 3 subcommands, each of which have their own parameters, and then save the output of each run to a config file that I can parse later in the code.

I cannot figure out how to store the output of the subcommands library to another config to use later in my code. Here is an example of the code:

package main    import (      "context"      "github.q-internal.tech/qadium/query/cmd"      "os"  )  type Config struct {     person Person  }    type Person struct {     Name string     Age int  }    func main() {      ctx := context.Background()      sts := cmd.Execute(ctx)      os.Exit(int(sts))  }  

in cmd/root.go:

package cmd    import (      "context"      "flag"      "github.com/google/subcommands"  )    func Execute(ctx context.Context) subcommands.ExitStatus {      commander := subcommands.DefaultCommander        for _, command := range [...]struct {          group string          subcommands.Command      }{          {"help", commander.CommandsCommand()},          {"help", commander.HelpCommand()},          {"help", commander.FlagsCommand()},          {"test", &person{}},      } {          commander.Register(command.Command, command.group)      }      flag.Parse()      return commander.Execute(ctx)  }  

in cmd/test.go

package cmd    import (      "context"      "flag"      "fmt"      "github.com/google/subcommands"  )    type person struct {      name string      age  int  }    func (*person) Name() string      { return "qdt" }  func (*person) Synopsis() string  { return "qdt query targets from qdt_table" }  func (cmd *person) Usage() string { return fmt.Sprintf("%s table '<table_name>'", cmd.Name()) }    func (cmd *person) SetFlags(fs *flag.FlagSet) {      fs.StringVar(&cmd.name, "name", "", "enter your name")      fs.IntVar(&cmd.age, "age", 0, "enter your age")  }    func (cmd *person) Execute(_ context.Context, fs *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {      return subcommands.ExitSuccess  }  

If set a breakpoint in func (cmd *person) Execute() in cmd/test.go, I can see that the pointer to *person contains the values I've passed to each of the arguments. Setting breakpoints in cmd/root.go at the return statement return commander.Execute(ctx), I can see that there is a commands slice of the type []*subcommands.CommandGroup. In the documentation, this type says:

A CommandGroup represents a set of commands about a common topic.

In this slice, I can see the commands my program defines, but I do not see the values that I passed to those commands. I'd like to understand how to save those values passed to a config that I can use later on in my code in a function like ReadConfig() that I can use to determine how the code will behave later on. Anyone have a good understanding of how this library works so that they can help me?

Can't configure CORS in .NET CORE 5 WEB API app for Telerik Reporting

Posted: 29 May 2022 09:03 AM PDT

I followed the walk-through here to implement a .NET CORE 5 WEB API for Telerik reporting. In the WEB API project I enabled CORS with any origin then later with my specific localhost.

corsBuilder

enter image description here

I run the service and in a browser I can navigate to https://localhost:44398/api/rports/version and see the version number, so the service is running.

When I run the front end with the report viewer it hits the report version endpoint but I get a CORS error. I have tried many different configurations but am confident that the one I currently have in place is correct as seen in the f12 of the request:

enter image description here

As this shows I am hitting the correct endpoint for the report server, the access-control-allow-origins is set to localhost 1202, and the origin is localhost 1202.

I do not know what else to change to get this simple query to work (and it works from a local browser).

How to toggle with map function

Posted: 29 May 2022 09:04 AM PDT

I want to use toggle with map function.

I've tried many things, but I returned to the first code. I know what's the problem(I use the map function, but I use only one toggle variable), but I don't know how to fix it.

This is my code.

 const [toggle, setToggle] = useState(true);   const toggleFunction = () => {      setToggle(!toggle);    };  
{wholeData.map((image)=>{     return(        <TouchableOpacity           key={image.ROWNUM}           onPress={() => navigation.navigate("DetailStore", {              contents: image,              data: wholeData           })}          >    .  .  .    <TouchableOpacity onPress={() => toggleFunction()}>     {toggle ? (        <View style={{marginRight: 11}}>           <AntDesign name="hearto" size={24} color="#C7382A" />              </View>                 ) : (              <View style={{marginRight:11}}>           <AntDesign name="heart" size={24} color="#C7382A" />        </View>     )}  </TouchableOpacity>  

Use a function to generate reactive values in a reactiveValues object in Shiny

Posted: 29 May 2022 09:03 AM PDT

I have numerous reactive elements to create in a {Shiny} reactiveValues object, all reqiring almost identical filtering code. But I cannot work out how to do this efficiently, i.e. without writing the filtering code directly for each element. In the sample code below, a radio button controls filtering of some data into 2 groups, A and B. The difference between the good and bad outputs is that the bad one uses a function to define its value, whereas the good one has it specified directly as a reactive object.

When using the function to create the value for the bad one, it seems to be stuck at the intial value, as when changing the data by selecting a different group it does not change. The good one does correctly filter the data however. So how could we create many elements with the same code in the reactiveValues object?

library(shiny)    ui <- fluidPage(    radioButtons(      "group", "",      list(A = "A", B = "B"), list("A"),      inline = TRUE    ),    actionButton("go", "Go"),    textOutput("filtered_data_bad"),    textOutput("filtered_data_good")  )    server <- function(input, output) {      data <- tibble(      group = rep(c("A", "B"), c(5, 10))    )      group_saved <- reactiveVal(value = c("A"))      observeEvent(      input$go,      group_saved(input$group),      ignoreInit = TRUE,      ignoreNULL = FALSE    )      filter_data <- function (.data, .group) {      reactive(        .data[.data$group %in% .group,]      )    }      format_text <- function (.data, .group) {      req(nrow(.data) > 0)      paste(        "Selected:",        nrow(.data),        "total"      )    }      rv <- reactiveValues(      bad  = filter_data(data, group_saved()),      good = reactive(        data[data$group %in% group_saved(),]      )    )      output$filtered_data_bad <- renderText({      format_text(rv$bad(), group_saved())    })      output$filtered_data_good <- renderText({      format_text(rv$good(), group_saved())    })  }    shinyApp(ui, server)  

The code above is as simple as I could get it while showing the issue. I am working with the requirement to be able to select many different groups simultaneously from a common pool of choices (geographical regions in fact), for which the reactiveValues will hold one set of choices per group. Each group has it's own reactiveVal object (saved_regions_A, saved_regions_B, ...) that serves as the filter.

regions_saved_A <- reactiveVal(value = regions)  regions_saved_B <- reactiveVal(value = NULL)  regions_saved_C <- reactiveVal(value = NULL)  ...    filter_data <- function (.data, .regions) {    reactive(.data %>% filter(region %in% .regions))  }    filtered_data <- reactiveValues(    A = filter_data(data, regions_saved_A()),    B = filter_data(data, regions_saved_B()),    C = filter_data(data, regions_saved_C()),    ...  )  

I have tried removing the reactive call from the function and calling it with the function call for each value (it seems to be needed as I am relying on a reactiveVal for the saved choices). None of the below work:

filter_data <- function (.data, .regions) {    .data %>% filter(region %in% .regions)  }    filtered_data <- reactiveValues(    A = reactive(filter_data(data, regions_saved_A())),    B = filter_data(data, regions_saved_A()),    ...  )  

How do I get the value of MONGODB_URI in a kubernetes deploy?

Posted: 29 May 2022 09:03 AM PDT

I have a working mongoDB deployment on minikube and I have managed to create a database , collection as well as a user (same as the user referenced in yaml) to do backups on that database.

In the yaml file for my backup cron job I need to specify a MONGODB_URI parameter and quite frankly I am at a loss as to the exact convention for getting this (where exactly do you get the value).

As a check I have done a kubectl exec -it <pod_name> so that I can check if I am going to put the correct URI beforehand. After running kubectl exec -it <pod_name> at the prompt that follows I tried the following :

1.

mongosh mongodb://aaa:abc123@mongodb-service.default.svc.cluster.local:27017/plaformdb/?directConnection=true  

Not working I get error :

Current Mongosh Log ID: 62938b50880f139dad4b19c4  Connecting to:          mongodb://mongodb-service.default.svc.cluster.local:27017/platformdb/?directConnection=true&appName=mongosh+1.4.2  MongoServerSelectionError: Server selection timed out after 30000 ms  
mongosh mongodb://aaa:abc123@mongodb-service.svc.cluster.local:27017/platformdb?directConnection=true  

Not working also I get error:

MongoNetworkError: getaddrinfo ENOTFOUND mongodb-service.svc.cluster.local  
mongosh mongodb://aaa:abc123@mongodb-deployment-757ffdfdr5-thuiy.mongodb-service.default.svc.cluster.local:27017/platformdb  

Not working I get an error :

Current Mongosh Log ID: 62938c93829ft678h88990  Connecting to:          mongodb://mongodb-deployment-757ccdd6y8-thhhh.mongodb-service.default.svc.cluster.local:27017/platformdb?directConnection=true&appName=mongosh+1.4.2  MongoNetworkError: getaddrinfo ENOTFOUND mongodb-deployment-757ffdd5f5-tpzll.mongodb-service.default.svc.cluster.local  

This however is the recommended way according to the :docs

Expected:

I should be able to log in to the database once I run that command.

This is how my deployment is defined :

apiVersion: apps/v1  kind: Deployment  metadata:    name: mongodb-deployment    labels:      app: mongodb  spec:    replicas: 1    selector:      matchLabels:        app: mongodb    template:      metadata:        labels:          app: mongodb      spec:        containers:        - name: mongodb          image: mongo          imagePullPolicy: "IfNotPresent"          ports:            - containerPort: 27017          env:              - name: MONGO_INITDB_ROOT_USERNAME                valueFrom:                  secretKeyRef:                    name: mongodb-secret-amended                    key: mongo-root-username              - name: MONGO_INITDB_ROOT_PASSWORD                valueFrom:                  secretKeyRef:                    name: mongodb-secret-amended                    key: mongo-root-password          volumeMounts:               - mountPath: /data/db                name: mongodb-vol        volumes:        - name: mongodb-vol          persistentVolumeClaim:            claimName: mongodb-claim  ---  apiVersion: v1  kind: Service  metadata:    name: mongodb-service  spec:    selector:      app: mongodb    ports:      - protocol: TCP        port: 27017        targetPort: 27017   

And I need to specify MONGODB_URI in this cron job :

---  apiVersion: batch/v1beta1  kind: CronJob  metadata:    name: mongodump-backup  spec:    schedule: "0 */6 * * *" #Cron job every 6 hours    startingDeadlineSeconds: 60    concurrencyPolicy: Forbid    successfulJobsHistoryLimit: 3    failedJobsHistoryLimit: 2    jobTemplate:      spec:        template:          spec:            containers:              - name: mongodump-backup                image: golide/backupsdemo                imagePullPolicy: "IfNotPresent"                env:                  - name: DB_NAME                    value: "microfunctions"                  - name:  MONGODB_URI                    value: mongodb://aaa:abc123@host-mongodb:27017/dbname                volumeMounts:                  - mountPath: "/mongodump"                    name: mongodump-volume                command: ['sh', '-c',"./dump.sh"]            restartPolicy: OnFailure            volumes:              - name: mongodump-volume                persistentVolumeClaim:                  claimName: mongodb-backup  

What am I missing?

Why does the Mean shift clustering algorithm return only one cluster? in python

Posted: 29 May 2022 09:02 AM PDT

I am trying to apply the mean shift algorithm on my data set but results seems like if i have only one cluster, I don't know how to improve the code to get more clusters:

the data that i have contains (40 row and 50 column I need to study all the 50 columns once)

from sklearn.cluster import estimate_bandwidth  from sklearn.cluster import MeanShift  bandwidth = estimate_bandwidth(df2, quantile=0.3                                 , n_samples=None)  ms = MeanShift(bandwidth=bandwidth)  ms.fit(df2)  

the results of bandwidth

 MeanShift(bandwidth=12.85041841602)     labels = ms.labels_   labels   array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])  

The problem is when I apply on the data kmeans or agglomerative clustering it gives me results, 3 clusters, but here I dont know what should I change.

Is it possible to find out the timestamp corresponding to max_value in the Apache IoTDB?

Posted: 29 May 2022 09:02 AM PDT

I want to find out the timestamp corresponding to max_value in the Apache IoTDB. The current situation I can only first check the maximum value, and then this value to find the time and limit 1. enter image description hereI don't know how to do it.If someone knows it, please let me know. Apache IoTDB version: 0.13

Is the empty Flutter iOS app size really > 10MB?

Posted: 29 May 2022 09:02 AM PDT

I created an empty Flutter project, removed uses-material-design: true and then tested the app size. To test the app size, I archived it in Xcode, and used ad hoc distribution with app thinning to get an "App Thinning Size Report.txt" The resulting app size is between 13.5MB and 21MB depending on the device.

(I was hoping to use Flutter but also wanted to be able to make an iOS App Clip and Android Instant App, but it seems infeasible given that an empty app already goes over the size restriction.)

How to use the sdp offer received when joining as a subscriber ? (janus multistream android videoroom)

Posted: 29 May 2022 09:03 AM PDT

he||o, i am building a android videoroom app using janus multistream (videoroom plugin). Actually i am able to send video from android and receive from the demo website (i have set the local and remote description to the android local peerconnection object).

Now i try to send from the website and receive from android, when i join as a subscriber specifying streams to subscribe to i receive a response (videoroom=attached) with a sdp offer. I tried to create a remote peerconnection and set this sdp as local description, but i get this error :

2 publishers in room :

onSetFailure : Failed to set local offer sdp: Failed to apply the description for m= section with mid='0': Fingerprint provided but no identity available.  

1 publisher in room :

onSetFailure : Failed to set local offer sdp: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity. Expected: sha-256 3B:82:4C:05:73:A3:ED:77:ED:EE:AC:9F:D8:F7:D8:56:E6:DC:B2:EE:A1:E5:8F:DB:ED:A7:14:42:D4:0E:BF:21 Got: sha-256 55:CE:70:42:78:BC:8F:4C:2D:54:5D:EF:78:DE:D7:62:77:08:18:B8:A1:3D:44:47:96:A5:98:38:0D:15:63:E0  

How should I use this sdp ? Please help me

code problem code not run and i can't solve the problem

Posted: 29 May 2022 09:03 AM PDT

Git commit but keep current index and working tree?

Posted: 29 May 2022 09:02 AM PDT

Often I'm in the following situation: I'm in the middle of a complicated maneuver and I want to try out two or more ways of proceeding from here. So I might add-and-commit and now I can try out my various strategies from this point, on one or more branches.

But here's the problem: I don't want to lose track of what I've changed so far on this branch with respect to HEAD. Why? Well, in the IDE where I'm coding, there are really helpful "change bars" in the margin of the code editor that mark all the staged and unstaged changes. I don't want to lose those change bars. And what they are responding to, in effect, is the diff between the working tree and HEAD.

So you see, I'd like to save all my work so as to have a stable point to return to later, if needed, but I don't want this to affect the state of HEAD, the index, and the working tree. I want, in effect, to make a commit that is "just a copy", without altering anything else about the universe.

Here's a diagram. I've got this:

A -- B -- C -- (mybranch) [and I've edited files X, Y, and Z with respect to C]  

I want this:

             D? something that preserves the state of files X, Y, and Z              /  A -- B -- C  -- (mybranch) [and X, Y, and Z are still _modified_ with respect to C]  

Basically what I'm trying to do is copy the state of things into a commit, without effectively checking out that commit. Is there a command that does this?

What I've found so far is this sort of thing:

git switch -c temp  git commit -m 'hold my place just in case'  git switch -  git restore --source temp --worktree --staged -- .  

But I don't honestly like it; it feels risky, somehow. What I'd prefer, I think, is some form of git stash push that doesn't alter the state of the index and working tree.

Numbers aren't showing up right

Posted: 29 May 2022 09:03 AM PDT

Hello there! I'm kind of confused , I literally tried every possible sollution i could think of. Yet the program isn't functioning right ! The purpose of this program is to seperate the odd numbers and the pair numbers from one single array and put each one of them on an array! When i execute , and after putting some simple numbers , another random big numbers appear in each array! why is that and how can i fix this ?

void Pairs_impairs(int* n,int T[], int P[], int Imp[]){  int i,j=0;  for (i=0;i<*n;i++){      if(T[i]%2==0){          P[j]=T[i];          j++;}      else{          Imp[j]=T[i];          j++;  }}  *n=j;  }  int main(){  int t[100],p[100],imp[100];  int n;  puts("saisir n :");  scanf("%d",&n);  puts("saisir le tableau : ");  int i;  for(i=0;i<n;i++){      scanf("%d",&t[i]);  }  for(i=0;i<n;i++){      printf("%d ",t[i]);  }  Pairs_impairs(&n,t,p,imp);  printf("\nLes pairs : ");  for(i=0;i<n;i++){      printf("%d ",p[i]);  }  printf("\nLes impairs : ");  for(i=0;i<n;i++){      printf("%d ",imp[i]);  }  return 0;  

}

c++ shared pointer as key to map causes crash

Posted: 29 May 2022 09:04 AM PDT

So I'm working on a project for University in CPP, the idea is to utilize STL and smart pointers as much as possible(in an efficient matter of course).

I have created a map which contains a shared pointer to object of type Movie, and a vector of doubles. I have added a Comparison Class so the map compares the objects themselves and not pointers. When I initialize the map all is good, values are stored properly and I'm able to print them out. but when trying to access from a different function I get a EXC_BAD_ACCESS. while debugging I can still see the information exists so from my understanding its not that the pointers all went out of scope and the memory is freed.

Im adding the add and get functions,

typedef std::shared_ptr<Movie> sp_movie;    RecommenderSystem::get_movie (const std::string &name, int year) const  {    const auto movie (std::make_shared<Movie> (name, year));    const auto it=_database.find (movie);    return it->first;  }      sp_movie RecommenderSystem::add_movie (const std::string &name, int year,                                FeaturesVec &features)  {    auto movie = std::make_shared<Movie> (name, year);    _database.insert (std::make_pair (movie, features));    return movie;  }  

The exception gets thrown from _database.find call. This is the constructor and comparator:

struct DatabaseComp {      bool operator() (const sp_movie &m1, const sp_movie &m2) const      { return *m1 < *m2; }  };  /**   * Key : sp_movie, Value : FeaturesVec(Just a fancy name for double vector)   */  typedef std::map<sp_movie, FeaturesVec, DatabaseComp> MovieDatabase;    class RecommenderSystem {   private:    MovieDatabase _database = MovieDatabase (DatabaseComp ());   public:    /**     * Constructor     */    explicit RecommenderSystem () = default;  

Any ideas about what could be causing this?

EDITS The comparison operator for the Movie class itself :

bool operator< (const Movie &lhs) const    {      return this->_movie_year < lhs._movie_year             || (this->_movie_year == lhs._movie_year                 && this->_movie_name == lhs._movie_name);    }  

How to write a program that simulates the rolling of two dice 10,000 times

Posted: 29 May 2022 09:03 AM PDT

The program should simulate rolling two dice about 10,000 times and compute and print out the percentage of rolls that come out to be 2, 3, 4, . . . , 12. I have tried the code below but it is not working!

from random import randint  l = [2,3,4,5,6,7,8,9,10,11,12]  p = []  count = 0    for i in range(10000):       a  = randint(1,6)       b  = randint(1,6)       for j in l:           if a+b == j:           count+=1           percent = (count/10000)*100           p.append(percent)  print(p)  

.push() is not working outside of the for loop

Posted: 29 May 2022 09:03 AM PDT

I have already handled a response from an API call. I then export the data into a function that i'm using a for loop inside. The const diomerda is passed to the ejs file where i am outputting the array data from the API. However the data in the array is over 5000 entries, so i want to run a for loop to populate the ejs file with the entire array. But when I use loop.push it does not populate the const loop. console.log(loop) just reads [].

Once the const loop = [] is populated with the array i was then going to pass the data into the const diomerda = [json.entries[loop].character.name]

I'f anyone has any other ideas on how to acheive what i'm trying to do then please feel free to send away. Thanks in advance.

    .then(response => response.json())      .then(json => ejsoutput(json))  }    function ejsoutput(json) {      const loop = []      console.log(loop)      const diomerda = [json.entries[0].character.name, json.entries[1].character.name, json.entries[2].character.name]      for (var i = 0; i < json.entries.length; i++) {          loop.push(i)      }      res.render('index', {          leaderboard: diomerda      })  }  });  

No suitable driver found for jdbc - launching the program with 'cmd', but when run in NetBeans everything works

Posted: 29 May 2022 09:03 AM PDT

In my Java application, I am using JDBC to work with the database. And in order for everything to work, I placed mysql-connector-java-5.1.36.jar next to the classes (they are in my default package), and everything works fine.
But when I run the application via cmd on my PC, I get an error:

java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/socket
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
at Reg.reg(Reg.java:24)
at API$ClientHandler.run(API.java:63)
at java.base/java.lang.Thread.run(Thread.java:833)
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost/socket
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:708)
at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:230)
at Reg.reg(Reg.java:34)
at API$ClientHandler.run(API.java:63)
at java.base/java.lang.Thread.run(Thread.java:833)

In this folder I run cmd:

enter image description here In cmd I write the following:

  1. javac API.java
  2. javac CLI.java
  3. java API

Next, I open another cmd window (to run another file):

  1. java CLI

And here I am working with databases and I get the error that I described above.

I also tried putting mysql-connector-java-5.1.36.jar in xampp/tomcat/lib but that didn't help either.
Why is this happening and how to fix it?

Data points in R plot of condition "0" not visible

Posted: 29 May 2022 09:02 AM PDT

I tried to draw a xy plot in R using spec_conditions as a color-code. Unfortunately, data points of spec_condition = 0 do not show or show only in transparent. This is my code so far:

plot(m.mx$V6, m.mx$m.pmtl83351, col=spec_conditions,         pch=16,         main = "pMTL 83351 + placORMi")    axis(1, at=m.mx$V6, labels=m.mx$V6, cex.axis=1, cex.lab=0.1)    legend("topleft",           legend = spec_conditions,           col=spec_conditions,           cex=0.8,           inset=0.01,           pch = c(rep(16,7)))  

show plot example here

How to column parallelize pandas dataframe to column compare?

Posted: 29 May 2022 09:03 AM PDT

result = []  for i,j in combination(df.columns, 2):     result.append( [i,j, compare_func(df[i], df[j])] )     

this code works well, But extremely slow. because it only use single core.

I tried DASK for parallelization, but DASK only support raw based parallelization. That is not what I want.

joblib is also slow. I guess, it copy dataframe many times for all cores.

please someone recommend me good way to use all cores.

How to print defined macros with pragma to get OS version?

Posted: 29 May 2022 09:03 AM PDT

Following these related questions (1,2,3), I'm trying to get OS information from the preprocessor as follows:

#include <boost/preprocessor/stringize.hpp>  #ifdef __MACH__  #pragma message ("MACH: " BOOST_PP_STRINGIZE(__MACH__) )  

No comments:

Post a Comment