问:
Add local variable to JShell evaluation context
I'm using jdk.jshell.JShell to evaluate Java code programmatically and I'd like to add a local variable to the active evaluation context, so the value is useable in the shell.

I'm instantiating the JShell with a DirectExecutionControl, so it runs on the same JVM as the main code. I've spent quite a lot of time stepping through the source code of the JDK trying to see where I could plug myself, but it's quite opaque; simply getting an Object result out of eval(...) instead of a String required a number of hacks (Oracle, why?).

The answer here seems to suggest that this is not possible, without justification, but I'm too deep into this to accept that.

Ideas I have thought about:

```<code>- creating a class dynamically, with a field corresponding to the variable I want to add, and `import static`ing that class into the JShell (but I don't know how to dynamically add an import either)
- trying to find one of the internal auto-generated classes JShell is using to store the variables, and replacing them using arcane reflection magic
</code>```

Body:
I'm using jdk.jshell.JShell to evaluate Java code programmatically and I'd like to add a local variable to the active evaluation context, so the value is useable in the shell.

I'm instantiating the JShell with a DirectExecutionControl, so it runs on the same JVM as the main code. I've spent quite a lot of time stepping through the source code of the JDK trying to see where I could plug myself, but it's quite opaque; simply getting an Object result out of eval(...) instead of a String required a number of hacks (Oracle, why?).

The answer here seems to suggest that this is not possible, without justification, but I'm too deep into this to accept that.

Ideas I have thought about:

- creating a class dynamically, with a field corresponding to the variable I want to add, and `import static`ing that class into the JShell (but I don't know how to dynamically add an import either)
- trying to find one of the internal auto-generated classes JShell is using to store the variables, and replacing them using arcane reflection magic


来源: stackexchange

问:
Elastic RUM for iframe sites
I work for a business that has a somewhat old and outdated website with iframes in iframes. We are looking at establishing monitoring for that site, such that we know which pages have a long load time. For that we are trying to set up an Elastic RUM agent. The problem we are facing, is that a child iframe doesn’t inherit the transaction ID from the parent containing page. I have tried following the distributed tracing guide here: https://www.elastic.co/guide/en/apm/agent/nodejs/current/distributed-tracing.html but the ${transaction} variable is not set. The pages we server are JSP, so possibly we could set an elastic agent up in the Java process. Any suggestions on how to progress?</p>

ContentLicense: CC BY-SA 4.0

Title: Elastic RUM for iframe sites


问:
Creating a new .NET CORE web project based on an old ASP .NET Web Forms
We have an old ASP .NET Web Forms project (2015) which has been expanded over the years.
Generally it still works the way it should, but the more functionalities we add to it, the more bugs and problems seem to appear. A huge issue is also that a lot of code is just clustered in big files (10'000+ lines of code), though I'm not sure if that causes any performance issues.

Now we're slowly trying to fix the old project while simultaneously working on recreating the project with a newer technology, as well as fixing all the issues from the old code (huge files, cluttered code, useless code that needs to be deleted, etc.).
The only issue is, we can't really figure out what type of framework we want to use.

A couple pointers and info about the project:

It's an online learning platform, where students can read through a multitude of information regarding specific jobs groups (hair, health, cosmetics, building, etc.) and also use mock exams to test themselves.

Teachers can create exams with a plethora of different types of tasks (text, multiple choice, etc.) and assign them to the students. Basically the same as a normal exam, just online.

There also exists classrooms for data sharing, shops for specific access or data (like ebooks) and in some cases also blogs.

Each user (student, teacher, admins, etc.) has their own login, which also includes a admin backend for the teachers and admins. In there, they can create tasks, exams, texts to read, etc.

The biggest issue we are facing is that we don't really know which framework would be best suited for this kind of website.
As mentioned above, there can be exams where 10-20 students partake in and the status of the tasks/exam of the students get shared live with the teachers. Normally that wouldn't be much of an issue if it's handled properly, but it still takes a big toll on performance. In one platform there can also be 50+ students which take the exam at the same time, though there it won't update live for the teacher.

We have looked into .NET Core MVC with Razor pages as well as Blazor (server side) to see the cons and pros, but we didn't manage to find a specific solution to our problem.
In general we want to make sure that the performance of our website doesn't get impacted by having multiple people online at the same time.

Which framework is best suited for this kind of web project?


问:
Why does Xcode include two architectures
Xcode contains 2 architectures.The Xcode App is too big.
$ file /Applications/Xcode.app/Contents/MacOS/Xcode  /Applications/Xcode.app/Contents/MacOS/Xcode: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64:Mach-O 64-bit executable arm64] /Applications/Xcode.app/Contents/MacOS/Xcode (for architecture x86_64): Mach-O 64-bit executable x86_64 /Applications/Xcode.app/Contents/MacOS/Xcode (for architecture arm64):  Mach-O 64-bit executable arm64

arm64 seems useless, how do I delete it


问:
Function to_timestamp and BC in time
I try convert string value of time to timestamp

```<code>declare _query timestamp;
_query := to_timestamp('12:12:12', 'hh24:mi:ss');
</code>```

And when I try output value of _query they returns

0001-01-01 12:12:12.000000 BC

Why they add the first year of BC ?

Title: Function to_timestamp and BC in time

Body:
I try convert string value of time to timestamp

declare _query timestamp;
_query := to_timestamp('12:12:12', 'hh24:mi:ss');

And when I try output value of _query they returns

0001-01-01 12:12:12.000000 BC

Why they add the first year of BC ?


问:
Vocab for LSA Topic Modelling returning letters rather than words
I am trying to topic model a list of descriptions using LSA. When I tokenize and then create a vocab from the descriptions, the vocab returns letters rather than words.

```<code>my_stopwords = nltk.corpus.stopwords.words('english')
word_rooter = nltk.stem.snowball.PorterStemmer(ignore_stopwords=False).stem
my_punctuation = '!"$%&\'()*+,-./:;<=>?[\\]^_`{|}~•@'
custom_stopwords = ['author', 'book', 'books', 'story', 'stories', 'novel', 'series', 'collection', 'edition', 'volume', 'readers', 'reader', 'reprint', 'writer', 'writing']

final_stopword_list = custom_stopwords + my_stopwords

# cleaning master function
def clean_tokens(tokens):
    tokens = (tokens).lower() # lower case
    tokens = re.sub('['+my_punctuation + ']+', ' ', tokens) # strip punctuation
    tokens = re.sub('([0-9]+)', '', tokens) # remove numbers
    token_list = [word for word in tokens.split(' ') if word not in final_stopword_list] # remove stopwords
    tokens = ' '.join(token_list)
    return tokens
</code>```

This is my tokenizer

```<code>count_vectoriser = CountVectorizer(tokenizer=clean_tokens)
bag_of_words = count_vectoriser.fit_transform(df.Description)
vocab = count_vectoriser.get_feature_names_out()
print(vocab[:10])
</code>```

And my vocab, which returns

```<code>[' ' '#' '\\' 'a' 'b' 'c' 'd' 'e' 'f' 'g']
</code>```

When I want it to give me words

I am tokenizing from a pandas dataframe so I don't know if that is altering the way I am tokenizing.

Body:
I am trying to topic model a list of descriptions using LSA. When I tokenize and then create a vocab from the descriptions, the vocab returns letters rather than words.

my_stopwords = nltk.corpus.stopwords.words('english')
word_rooter = nltk.stem.snowball.PorterStemmer(ignore_stopwords=False).stem
my_punctuation = '!"$%&\'()*+,-./:;<=>?[\\]^_`{|}~•@'
custom_stopwords = ['author', 'book', 'books', 'story', 'stories', 'novel', 'series', 'collection', 'edition', 'volume', 'readers', 'reader', 'reprint', 'writer', 'writing']

final_stopword_list = custom_stopwords + my_stopwords

# cleaning master function
def clean_tokens(tokens):
    tokens = (tokens).lower() # lower case
    tokens = re.sub('['+my_punctuation + ']+', ' ', tokens) # strip punctuation
    tokens = re.sub('([0-9]+)', '', tokens) # remove numbers
    token_list = [word for word in tokens.split(' ') if word not in final_stopword_list] # remove stopwords
    tokens = ' '.join(token_list)
    return tokens

This is my tokenizer

count_vectoriser = CountVectorizer(tokenizer=clean_tokens)
bag_of_words = count_vectoriser.fit_transform(df.Description)
vocab = count_vectoriser.get_feature_names_out()
print(vocab[:10])

And my vocab, which returns

[' ' '#' '\\' 'a' 'b' 'c' 'd' 'e' 'f' 'g']

When I want it to give me words

I am tokenizing from a pandas dataframe so I don't know if that is altering the way I am tokenizing.


问:
Intellij with run target as Docker randomizing ports
I am using intellij using the Run Targets configuration for deploying my build inside a docker container. The run target is based on a docker-compose file I provided.
My application is running on port 8080. The problem is that on each run, Intellij is assigning a random port from the host to the application port 8080.

I dont want Intellij to randomize port on each run. I explicitly mentioned in my docker-compose file to map 8080:8080. But still Intellij overrides it and assigns a random port. I also tried to run the application on different port but still no use.

Any one could help?


问:
Prevent duplicate key error with orphanRemoval set to true when saving entities
I've got the following tables/entities:

```<code>User (id, ...)
Ressource(id, ...)
UserAccess(id, user_id, ressource_id)
</code>```

The connection between User and UserAccess is as follows:

```<code>@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
private List<UserAccessEntity> userAccesses = new ArrayList<>();
</code>```

Let's suppose there are already the following entries in the tables:

User:

```<code>| id |

| 1 |
</code>```

UserAccess

```<code>| id | user_id | ressource_id |

| 1  | 1 | 1 |
</code>```

What I do in my workflow is retrieving the User entities from the database, setting user accesses anew (they might change completely or some might be added or removed) and then saving the User entities.

In my test I retrieve  the User(id = 1) Entity and set UserAccesses exactly the same value as it is in the database.

It used to work but after I introduced a constraint on unique combination of user_id ressource_id in the UserAccess table, I get "duplicate key violates unique constraint"

Is there a way of not getting this error without deleting/merging the userAccesses first?

Body:
I've got the following tables/entities:

User (id, ...)
Ressource(id, ...)
UserAccess(id, user_id, ressource_id)

The connection between User and UserAccess is as follows:

@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
private List<UserAccessEntity> userAccesses = new ArrayList<>();

Let's suppose there are already the following entries in the tables:

User:

| id |

| 1 |

UserAccess

| id | user_id | ressource_id |

| 1  | 1 | 1 |

What I do in my workflow is retrieving the User entities from the database, setting user accesses anew (they might change completely or some might be added or removed) and then saving the User entities.

In my test I retrieve  the User(id = 1) Entity and set UserAccesses exactly the same value as it is in the database.

It used to work but after I introduced a constraint on unique combination of user_id ressource_id in the UserAccess table, I get "duplicate key violates unique constraint"

Is there a way of not getting this error without deleting/merging the userAccesses first?


问:
socketio c++ : how to you pass ssl certificate
I am trying the socketIO C++ client ; but i dont know how to use certificates .
The SocketIO server needs valid certificate to answer
Has someone managed to do it ?
There is no documentation at all ...
Thanks</p>


问:
erl -make using header file
I want to know how to compile erlang file using erl -make depending on hrl header files. This is convenient to compile a batch of files.

I already have known how to compile one file using erlc -I some_directory some_file.erl.

Also ,I know how to compile one file under the shell by c(some_file, [{i, "../include"}]).

Title: erl -make using header file


问:
Loading order of PHP functions and classes. Both need to be loaded before the other
I have a little problem with including php functions and classes.
They are sort of depending on each other to be loaded first, so I suppose I'm doing something wrong.

Here's a scenario:

I have an ordinary php function that I would like to do a database request.

But the database class, and stuff, are included after the functions. Meaning that the database instance is not yet loaded when the function is executet. Resulting in this error:

```<code>Fatal error: Uncaught Error: Call to a member function query() on null in
</code>```

If I move the database scripts etc. to before functions are loaded, some functions are not available the for database-script to be added.

Anyone had this issue, and know of a solution to handle this sort of challenge?

Just FYI: I have a script that scans the function-folder for .func-files, and includes them in a foreach-loop.
Same goes for .class-files with an autoloader-function.

I could possibly add the functions that requires database to be loaded before after.

But that would require a manual approach to each of these situations.

Body:
I have a little problem with including php functions and classes.
They are sort of depending on each other to be loaded first, so I suppose I'm doing something wrong.

Here's a scenario:

I have an ordinary php function that I would like to do a database request.

But the database class, and stuff, are included after the functions. Meaning that the database instance is not yet loaded when the function is executet. Resulting in this error:

Fatal error: Uncaught Error: Call to a member function query() on null in

If I move the database scripts etc. to before functions are loaded, some functions are not available the for database-script to be added.

Anyone had this issue, and know of a solution to handle this sort of challenge?

Just FYI: I have a script that scans the function-folder for .func-files, and includes them in a foreach-loop.
Same goes for .class-files with an autoloader-function.

I could possibly add the functions that requires database to be loaded before after.

But that would require a manual approach to each of these situations.


问:
Why am I getting IntegrityError in my update view?
I have Personnel model which means in English Employee. I have done with the add view and now I'm in the step of making an edit for employee.
But whenven I am trying to save the modifications, I am getting the IntegrityError. And the details are bellow eventhough it is Frensh.

```<code>ERREUR:  la valeur d'une clé dupliquée rompt la contrainte unique « hr_personnel_id_Personnel_key »
DETAIL:  La clé « ("id_Personnel")=(COM-035-0118) » existe déjà.
</code>```

Here is my Personnel model

```<code>class Personnel(models.Model):
    GENDER_IN_CHOICE = (
        ('M', 'Masculin.'),
        ('F', 'Feminin.')
    )

    DIPLOME_IN_CHOICE = (
        ('DEUG', 'DEUG'),
        ('LICENCE', 'LICENCE'),
        ('MAITRISE', 'MAITRISE'),
        ('MASTER', 'MASTER'),
        ('DOCTORAT', 'DOCTORAT'),
        ('AUTRE', 'AUTRE'),
    )
    service = models.ForeignKey(Services, on_delete=models.CASCADE, null=True)
    id_Personnel = models.CharField(max_length=50, db_index=True, unique=True)
    photo = models.ImageField(upload_to='personnel/%Y/%m/%d', blank=True, null=True)
    prenom = models.CharField(max_length=100, null=False, blank=False)
    nom = models.CharField(max_length=100, null=False, blank=False)
    sexe = models.CharField(max_length=6, choices=GENDER_IN_CHOICE)
    date_de_naissance= models.DateField(blank=False, null=False, help_text="AAAA-MM-JJ")
    CIN = models.CharField(max_length=60, unique=True)
    telephone = models.CharField(max_length=17, unique=True)
    email = models.CharField(max_length=50)
    adresse_actuelle = models.CharField(max_length=500)
    adresse_permanente = models.CharField(max_length=500)
    diplome_obtenu = models.CharField(max_length=50, choices=DIPLOME_IN_CHOICE)
    qualification = models.CharField(max_length=200, null=True)
    grade = models.ForeignKey(Grades, on_delete=models.CASCADE, null=True)
    date_de_recrutement = models.DateField()
    create_date = models.DateTimeField(auto_now_add=True)
    updateDate = models.DateTimeField(auto_now=True)

    history = HistoricalRecords()

    def __str__(self):
        return self.id_Personnel+' '+self.prenom + ' ' + self.nom
</code>```

Here is my edit_employee views

```<code>def Edit_Employee(request, id):
    emp_name=get_object_or_404(Personnel,id=id)
    listEmp=Personnel.objects.all()
    listeGrade=Grades.objects.all()
    listeService=Services.objects.all()
    form = EmployeeAddForm(request.POST or None,request.FILES)
    if request.method == "POST":
        Personnel.objects.update(
            id_Personnel=request.POST["id_Personnel"],
            photo = request.FILES["photo"],
            prenom = request.POST["prenom"],
            nom = request.POST["nom"],
            sexe= request.POST["sexe"],
            date_de_naissance= request.POST["date_de_naissance"],
            CIN = request.POST['CIN'],
            telephone =request.POST["telephone"],
            email = request.POST["email"],
            adresse_actuelle = request.POST["adresse_actuelle"],
            adresse_permanente = request.POST["adresse_permanente"],
            diplome_obtenu = request.POST["diplome_obtenu"],
            qualification = request.POST["qualification"],
            grade = Grades.objects.get(id=request.POST["grade"]),
            date_de_recrutement = request.POST["date_de_recrutement"],
            service = Services.objects.get(id=request.POST["service"]),

                )
    return render(request,'employees/form-horizontal.html',
            {
                "emp_name": emp_name,
                "listEmp":listEmp,
                "listeService":listeService,
                "listeGrade":listeGrade,
            }
        )
</code>```

Here is my edit_personnel template

```<code><!-- Page Wrapper -->
    <div class="page-wrapper">
        <div class="content container-fluid">

            <!-- Page Header -->
            <div class="page-header">
                <div class="row">
                    <div class="col">
                        <h3 class="page-title">Employé</h3>
                        <ul class="breadcrumb">
                            <li class="breadcrumb-item"><a href="admin-dashboard.html">Modification</a></li>
                            <li class="breadcrumb-item active">Employé</li>
                        </ul>
                    </div>
                </div>
            </div>
            <!-- /Page Header -->
            <div class="row">
                <div class="col-md-12">
                    <div class="card mb-0">
                        <!-- <div class="card-header">
                            <h4 class="card-title mb-0">Modification des employés</h4>
                        </div> -->
                        <div class="card-body">
                            <form action="" method="post" enctype="multipart/form-data">
                                {% csrf_token %}
                                <div class="row">
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">ID employé <span class="text-danger">*</span></label>
                                            <input class="form-control" type="text" name="id_Personnel" value="{{ emp_name.id_Personnel }}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Prénom <span class="text-danger">*</span></label>
                                            <input class="form-control" type="text", name="prenom" value="{{emp_name.prenom}}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Nom</label>
                                            <input class="form-control" type="text" name="nom" value="{{emp_name.nom}}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Date de naissance<span class="text-danger">*</span></label>
                                            <div class="cal-icon"><input class="form-control" type="text" name="date_de_naissance" value="{{emp_name.date_de_naissance}}"></div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>Sexe <span class="text-danger">*</span></label>
                                            <select class="select" name="sexe" >
                                                <option >Selectionner le sexe</option>

                                                <option value="M" {% ifequal emp_name.sexe M %} selected="selected"{% endifequal %}>Masculin</option>
                                                <option value="F" {% ifequal emp_name.sexe F %} selected="selected"{% endifequal %}>Féminin</option>

                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">CIN <span class="text-danger">*</span></label>
                                            <input class="form-control" type="text" name="CIN" value="{{ emp_name.CIN }}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Photo</label>
                                            <input class="form-control" type="file" name="photo" value="{{ emp_name.photo }}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Téléphone <span class="text-danger">*</span></label>
                                            <input class="form-control" type="text" name="telephone" value="{{ emp_name.telephone }}">
                                        </div>
                                    </div>

                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Email</label>
                                            <input class="form-control" type="email" name="email" value="{{emp_name.email}}">
                                        </div>
                                    </div>

                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Adresse actuelle<span class="text-danger">*</span></label>
                                            <input class="form-control" type="text" name="adresse_actuelle" value="{{ emp_name.adresse_actuelle }}">
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Adresse permanente<span class="text-danger">*</span></label>
                                            <input type="text" class="form-control" name="adresse_permanente" value="{{ emp_name.adresse_permanente }}">
                                        </div>
                                    </div>

                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Date d'embauche<span class="text-danger">*</span></label>
                                            <!-- <div class="cal-icon"> -->
                                            <input class="form-control" type="text" name="date_de_recrutement" value="{{ emp_name.date_de_recrutement }}">
                                            <!-- </div> -->
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>Service <span class="text-danger">*</span></label>
                                            <select class="select" name="service">
                                                <option value="">Selectionner un service</option>
                                                {% for service in listeService %}
                                                    <option value="{{ emp_name.service.id }}">{{ service.Service }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>Diplôme obtenu <span class="text-danger">*</span></label>
                                            <select class="select" name="diplome_obtenu">
                                                <option>Selectionner un diplôme</option>
                                                <option value="DEUG" {% ifequal emp_name.diplome_obtenu DEUG %} selected="selected"{% endifequal %}>DEUG</option>
                                                <option value="LICENCE">LICENCE</option>
                                                <option value="MAITRISE">MAITRISE</option>
                                                <option value="MASTER">MASTER</option>
                                                <option value="DOCTORAT">DOCTORAT</option>
                                                <option value="AUTRE">AUTRE</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="col-sm-6">
                                        <div class="form-group">
                                            <label class="col-form-label">Qualification </label>
                                            <input class="form-control" type="text" name="qualification" value="{{ emp_name.qualification}}">
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label>Grade</label>
                                            <select class="select" name="grade">
                                                <option value="">Selectionner une grade</option>
                                                {% for grade in listeGrade %}
                                                    <option value="{{ grade.id }}">{{ grade.niveau_grade }}</option>
                                                {% endfor %}
                                            </select>
                                        </div>
                                    </div>
                                </div>
                                <div class="submit-section">
                                    <button class="btn btn-primary submit-btn">Enregistrer les modifications</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
    <!-- /Main Wrapper -->

</div>
<!-- /Main Wrapper -->
</code>```

Please, how to solve this issue?
Thanks

Body:
I have Personnel model which means in English Employee. I have done with the add view and now I'm in the step of making an edit for employee.
But whenven I am trying to save the modifications, I am getting the IntegrityError. And the details are bellow eventhough it is Frensh.

ERREUR:  la valeur d'une clé dupliquée rompt la contrainte unique « hr_personnel_id_Personnel_key »
DETAIL:  La clé « ("id_Personnel")=(COM-035-0118) » existe déjà.

Here is my Personnel model

class Personnel(models.Model):
    GENDER_IN_CHOICE = (
        ('M', 'Masculin.'),
        ('F', 'Feminin.')
    )

    DIPLOME_IN_CHOICE = (
        ('DEUG', 'DEUG'),
        ('LICENCE', 'LICENCE'),
        ('MAITRISE', 'MAITRISE'),
        ('MASTER', 'MASTER'),
        ('DOCTORAT', 'DOCTORAT'),
        ('AUTRE', 'AUTRE'),
    )
    service = models.ForeignKey(Services, on_delete=models.CASCADE, null=True)
    id_Personnel = models.CharField(max_length=50, db_index=True, unique=True)
    photo = models.ImageField(upload_to='personnel/%Y/%m/%d', blank=True, null=True)
    prenom = models.CharField(max_length=100, null=False, blank=False)
    nom = models.CharField(max_length=100, null=False, blank=False)
    sexe = models.CharField(max_length=6, choices=GENDER_IN_CHOICE)
    date_de_naissance= models.DateField(blank=False, null=False, help_text="AAAA-MM-JJ")
    CIN = models.CharField(max_length=60, unique=True)
    telephone = models.CharField(max_length=17, unique=True)
    email = models.CharField(max_length=50)
    adresse_actuelle = models.CharField(max_length=500)
    adresse_permanente = models.CharField(max_length=500)
    diplome_obtenu = models.CharField(max_length=50, choices=DIPLOME_IN_CHOICE)
    qualification = models.CharField(max_length=200, null=True)
    grade = models.ForeignKey(Grades, on_delete=models.CASCADE, null=True)
    date_de_recrutement = models.DateField()
    create_date = models.DateTimeField(auto_now_add=True)
    updateDate = models.DateTimeField(auto_now=True)

    history = HistoricalRecords()

    def __str__(self):
        return self.id_Personnel+' '+self.prenom + ' ' + self.nom

Here is my edit_employee views

def Edit_Employee(request, id):
    emp_name=get_object_or_404(Personnel,id=id)
    listEmp=Personnel.objects.all()
    listeGrade=Grades.objects.all()
    listeService=Services.objects.all()
    form = EmployeeAddForm(request.POST or None,request.FILES)
    if request.method == "POST":
        Personnel.objects.update(
            id_Personnel=request.POST["id_Personnel"],
            photo = request.FILES["photo"],
            prenom = request.POST["prenom"],
            nom = request.POST["nom"],
            sexe= request.POST["sexe"],
            date_de_naissance= request.POST["date_de_naissance"],
            CIN = request.POST['CIN'],
            telephone =request.POST["telephone"],
            email = request.POST["email"],
            adresse_actuelle = request.POST["adresse_actuelle"],
            adresse_permanente = request.POST["adresse_permanente"],
            diplome_obtenu = request.POST["diplome_obtenu"],
            qualification = request.POST["qualification"],
            grade = Grades.objects.get(id=request.POST["grade"]),
            date_de_recrutement = request.POST["date_de_recrutement"],
            service = Services.objects.get(id=request.POST["service"]),

                )
    return render(request,'employees/form-horizontal.html',
            {
                "emp_name": emp_name,
                "listEmp":listEmp,
                "listeService":listeService,
                "listeGrade":listeGrade,
            }
        )

Here is my edit_personnel template

Employé

Modification

Employé

                            <form action="" method="post" enctype="multipart/form-data">
                                {% csrf_token %}

                                            ID employé *
                                            <input class="form-control" type="text" name="id_Personnel" value="{{ emp_name.id_Personnel }}">

                                            Prénom *
                                            <input class="form-control" type="text", name="prenom" value="{{emp_name.prenom}}">

                                            Nom
                                            <input class="form-control" type="text" name="nom" value="{{emp_name.nom}}">

                                            Date de naissance*

<input class="form-control" type="text" name="date_de_naissance" value="{{emp_name.date_de_naissance}}">

                                            Sexe *
                                            <select class="select" name="sexe" >
                                                <option >Selectionner le sexe</option>

                                                <option value="M" {% ifequal emp_name.sexe M %} selected="selected"{% endifequal %}>Masculin</option>
                                                <option value="F" {% ifequal emp_name.sexe F %} selected="selected"{% endifequal %}>Féminin</option>

                                            </select>

                                            CIN *
                                            <input class="form-control" type="text" name="CIN" value="{{ emp_name.CIN }}">

                                            Photo
                                            <input class="form-control" type="file" name="photo" value="{{ emp_name.photo }}">

                                            Téléphone *
                                            <input class="form-control" type="text" name="telephone" value="{{ emp_name.telephone }}">

                                            Email
                                            <input class="form-control" type="email" name="email" value="{{emp_name.email}}">

                                            Adresse actuelle*
                                            <input class="form-control" type="text" name="adresse_actuelle" value="{{ emp_name.adresse_actuelle }}">

                                            Adresse permanente*
                                            <input type="text" class="form-control" name="adresse_permanente" value="{{ emp_name.adresse_permanente }}">

                                            Date d'embauche*

                                            <input class="form-control" type="text" name="date_de_recrutement" value="{{ emp_name.date_de_recrutement }}">

                                            Service *
                                            <select class="select" name="service">
                                                <option value="">Selectionner un service</option>
                                                {% for service in listeService %}
                                                    <option value="{{ emp_name.service.id }}">{{ service.Service }}</option>
                                                {% endfor %}
                                            </select>

                                            Diplôme obtenu *
                                            <select class="select" name="diplome_obtenu">
                                                <option>Selectionner un diplôme</option>
                                                <option value="DEUG" {% ifequal emp_name.diplome_obtenu DEUG %} selected="selected"{% endifequal %}>DEUG</option>
                                                <option value="LICENCE">LICENCE</option>
                                                <option value="MAITRISE">MAITRISE</option>
                                                <option value="MASTER">MASTER</option>
                                                <option value="DOCTORAT">DOCTORAT</option>
                                                <option value="AUTRE">AUTRE</option>
                                            </select>

                                            Qualification
                                            <input class="form-control" type="text" name="qualification" value="{{ emp_name.qualification}}">

                                            Grade
                                            <select class="select" name="grade">
                                                <option value="">Selectionner une grade</option>
                                                {% for grade in listeGrade %}
                                                    <option value="{{ grade.id }}">{{ grade.niveau_grade }}</option>
                                                {% endfor %}
                                            </select>

                                    <button class="btn btn-primary submit-btn">Enregistrer les modifications</button>

                            </form>

Please, how to solve this issue?
Thanks


问:
FirebaseError: Firebase: Need to provide options, when not being deployed to hosting via source. (app/no-options). after correct initialize order
I have tried to solve this error with this answer, but with no success:

How can I provide options when not being deployed to hosting via source?

Like in the answer, I first initializeApp and then used getAuth function, but still the same error. Do I miss something?

in my bot.js (I censored config data)

```<code>require('dotenv').config()

const Discord = require('discord.js')
const Commando = require('discord.js-commando')
const { MessageAttachment } = require('discord.js')
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
const firebase = require('firebase/compat/app')
const database = require('firebase/compat/database')
const { getAuth } = require('firebase/auth')

// Import the functions you need from the SDKs you need
const {initializeApp} = require('firebase/compat/app')

const { getDatabase, onValue, ref } = require('firebase/database')
const db = getDatabase()

const { debug } = require('console')
const { get } = require('https')
const querystring = require('querystring')

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
    apiKey: "placeholder",
    authDomain: "placeholder-placeholder.firebaseapp.com",
    databaseURL: "https://placeholder-default-rtdb.europe-west1.firebasedatabase.app",
    projectId: "placeholder-placeholder",
    storageBucket: "placeholder.appspot.com",
    messagingSenderId: "placeholder",
    appId: "placeholder",
    measurementId: "placeholder"
  };

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app)
const https = require('https')

const dbref = ref(db)

module.exports = class ImageCommand extends Commando.Command {
    constructor(client) {
        super(client, {
            name: 'image',
            group: 'misc',
            memberName: 'image',
            description: 'Sends an image',
        })
    }
}

client.on('ready', () => {
    console.log('Our bot is ready to go!!!')
})

client.on("message", msg => {
    if(msg.content === 'keyword'){

        try{

            const infographicImageRef = ref(db, 'infographics/' + msg.content + '/keyword')
            var imageUrl = null

            onValue(infographicImageRef, (snapshot) => {
                const data = snapshot.val()
                imageUrl = data
            })

           msg.channel.send(imageUrl)

            console.log('here2');

        }
        catch(err){
            console.log(err)
        }

    }

})

client.login(process.env.BOT_TOKEN)
</code>```

Body:
I have tried to solve this error with this answer, but with no success:

How can I provide options when not being deployed to hosting via source?

Like in the answer, I first initializeApp and then used getAuth function, but still the same error. Do I miss something?

in my bot.js (I censored config data)

require('dotenv').config()

const Discord = require('discord.js')
const Commando = require('discord.js-commando')
const { MessageAttachment } = require('discord.js')
const client = new Discord.Client({intents: ["GUILDS", "GUILD_MESSAGES"]})
const firebase = require('firebase/compat/app')
const database = require('firebase/compat/database')
const { getAuth } = require('firebase/auth')

// Import the functions you need from the SDKs you need
const {initializeApp} = require('firebase/compat/app')

const { getDatabase, onValue, ref } = require('firebase/database')
const db = getDatabase()

const { debug } = require('console')
const { get } = require('https')
const querystring = require('querystring')

// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
    apiKey: "placeholder",
    authDomain: "placeholder-placeholder.firebaseapp.com",
    databaseURL: "https://placeholder-default-rtdb.europe-west1.firebasedatabase.app",
    projectId: "placeholder-placeholder",
    storageBucket: "placeholder.appspot.com",
    messagingSenderId: "placeholder",
    appId: "placeholder",
    measurementId: "placeholder"
  };

// Initialize Firebase
const app = initializeApp(firebaseConfig);
const auth = getAuth(app)
const https = require('https')

const dbref = ref(db)

module.exports = class ImageCommand extends Commando.Command {
    constructor(client) {
        super(client, {
            name: 'image',
            group: 'misc',
            memberName: 'image',
            description: 'Sends an image',
        })
    }
}

client.on('ready', () => {
    console.log('Our bot is ready to go!!!')
})

client.on("message", msg => {
    if(msg.content === 'keyword'){

        try{

            const infographicImageRef = ref(db, 'infographics/' + msg.content + '/keyword')
            var imageUrl = null

            onValue(infographicImageRef, (snapshot) => {
                const data = snapshot.val()
                imageUrl = data
            })

           msg.channel.send(imageUrl)

            console.log('here2');

        }
        catch(err){
            console.log(err)
        }

    }

})

client.login(process.env.BOT_TOKEN)


问:
Cordova plugin to scan ibeacons with bluetooth permission but not with location permission
cordova-plugin-ibeacon works fine with Location but I'm looking for plugin that works with BLUETOOTH and not dependent on Location for Android 12+ and IOS 13+ devices

With Android 12 and IOS 13 feature that apps no longer need location permissions to scan bluetooth devices,

Is there any cordova plugin that can detect beacons with only bluetooth permissions and doesn't require location permission?


问:
npm WARN EBADENGINE (Node version 18.12.1) on Ubuntu 22.04
I am on Ubuntu 22.04 and trying to install angular/cli globally. I am getting this warning:

```<code>npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'pacote@15.0.6',
npm WARN EBADENGINE   required: { node: '^14.17.0 || ^16.13.0 || >=18.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }
npm WARN EBADENGINE }
</code>```

I found multiple questions on stackoverflow regarding this problem. The answers all point at using a stable version of node. I have node version 18.12.1 which currently is the latest stable version and npm version 8.19.2 that comes with it.

Now I know that people will be asking in the comments if I have node version 18.12.1 installed, so here it is:

```<code>jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ npm -v
8.19.2
jan@ubuntu-22-04:~$
</code>```

But then the warning seems to suggest that I have node version 12.22.9 and npm version 8.10.0.

```<code>npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }
</code>```

So what is going on??? Is my understanding of the warning incorrect? Is there a Ubuntu-problem that I don´t understand? Can anybody please help me out?

EDIT:
It looks like I have two different versions of node. Look at this:

```<code>jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ sudo node -v
v12.22.9
</code>```

Using sudo gives me version 12.22.9 as the warning states. I still don´t know how to solve it. Can anybody help?

Body:
I am on Ubuntu 22.04 and trying to install angular/cli globally. I am getting this warning:

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'pacote@15.0.6',
npm WARN EBADENGINE   required: { node: '^14.17.0 || ^16.13.0 || >=18.0.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }
npm WARN EBADENGINE }

I found multiple questions on stackoverflow regarding this problem. The answers all point at using a stable version of node. I have node version 18.12.1 which currently is the latest stable version and npm version 8.19.2 that comes with it.

Now I know that people will be asking in the comments if I have node version 18.12.1 installed, so here it is:

jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ npm -v
8.19.2
jan@ubuntu-22-04:~$

But then the warning seems to suggest that I have node version 12.22.9 and npm version 8.10.0.

npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.10.0' }

So what is going on??? Is my understanding of the warning incorrect? Is there a Ubuntu-problem that I don´t understand? Can anybody please help me out?

EDIT:
It looks like I have two different versions of node. Look at this:

jan@ubuntu-22-04:~$ node -v
v18.12.1
jan@ubuntu-22-04:~$ sudo node -v
v12.22.9

Using sudo gives me version 12.22.9 as the warning states. I still don´t know how to solve it. Can anybody help?


问:
whereBetween with Laravel one to Many relationship - Laravel Eloquent
I have a table structure where 1 project has X no of properties, properties has price column. I am right now finding average property price of each project and displaying it

```<code>properties
id |project_id | price
-----------------------
1  | 1          | 100
2  | 1          | 200

$projects = Project::query()
                ->with(['country', 'properties'])
                ->withCount(['properties'])
                ->withAvg('properties', 'price')
                ->search($this->search)
                ->whereProject($this->filters['project'] ?? null)
                ->paginate($this->paginate);
</code>```

Now I have a filter where I need to find on averageprice column using Between operator.

I am using this query but it brings out records from normal prices I want to use to and from on averageprice column

```<code>$projects = Project::query()->with(['country', 'properties' => function ($q) use ($filters) {
                $q->whereBetween('properties_avg_price', [$filters['minPrice'], $filters['maxPrice']]);
            }])
                ->withCount(['properties'])
                ->withAvg('properties', 'price')
                ->search($this->search)
                ->whereProject($this->filters['project'] ?? null)
                ->paginate($this->paginate);
</code>```

Any Help will be appreciated.

Body:
I have a table structure where 1 project has X no of properties, properties has price column. I am right now finding average property price of each project and displaying it

properties
id |project_id | price
-----------------------
1  | 1          | 100
2  | 1          | 200

$projects = Project::query()
                ->with(['country', 'properties'])
                ->withCount(['properties'])
                ->withAvg('properties', 'price')
                ->search($this->search)
                ->whereProject($this->filters['project'] ?? null)
                ->paginate($this->paginate);

Now I have a filter where I need to find on averageprice column using Between operator.

I am using this query but it brings out records from normal prices I want to use to and from on averageprice column

$projects = Project::query()->with(['country', 'properties' => function ($q) use ($filters) {
                $q->whereBetween('properties_avg_price', [$filters['minPrice'], $filters['maxPrice']]);
            }])
                ->withCount(['properties'])
                ->withAvg('properties', 'price')
                ->search($this->search)
                ->whereProject($this->filters['project'] ?? null)
                ->paginate($this->paginate);

Any Help will be appreciated.


问:
Error in creating function with data table syntax using multiple columns in as arguments for "by"
I am having trouble with using two columns as arguments for the data table argument "by" in a function.

The code below creates value-weighted portfolios according to different categories (e.g., state); where DT is a stacked dataframe containing stock prices for firms in the United States.

Here is my current code...

```<code>vw_testfunction <- function(bycol1, bycol2){

  vwret_df <- DT[,list(vw_ret = lapply(.SD,
                                       function(x) sum(x*mcap/sum(mcap,na.rm = TRUE),na.rm = TRUE))),
                 by = list(bycol1, bycol2), # adjust this line to manage grouping
                 .SDcols = "ret"]
  return(vwret_df)
}

test <- vw_testfunction("state", "datadate")
</code>```

...where I get this error:

Error in `[.data.table`(DT, , list(vw_ret = lapply(.SD, function(x) sum(x * :
The items in the 'by' or 'keyby' list are length(s) (1,1). Each must be length 527561; the same length as there are rows in x (after subsetting if i is provided).
```

I have tried the solution here, but using the arguments inside list() is causing the error.

Any advice is greatly appreciated.

Body:
I am having trouble with using two columns as arguments for the data table argument "by" in a function.

The code below creates value-weighted portfolios according to different categories (e.g., state); where DT is a stacked dataframe containing stock prices for firms in the United States.

Here is my current code...

vw_testfunction <- function(bycol1, bycol2){

  vwret_df <- DT[,list(vw_ret = lapply(.SD,
                                       function(x) sum(x*mcap/sum(mcap,na.rm = TRUE),na.rm = TRUE))),
                 by = list(bycol1, bycol2), # adjust this line to manage grouping
                 .SDcols = "ret"]
  return(vwret_df)
}

test <- vw_testfunction("state", "datadate")

...where I get this error:

Error in `[.data.table`(DT, , list(vw_ret = lapply(.SD, function(x) sum(x * :
The items in the 'by' or 'keyby' list are length(s) (1,1). Each must be length 527561; the same length as there are rows in x (after subsetting if i is provided).

I have tried the solution here, but using the arguments inside list() is causing the error.

Any advice is greatly appreciated.


问:
Direct installation on VPS running Debian 11
I've installed Directus on my VPS which is running debian 11. The installation was successful, however, when on Login page, I cannot login.

I get "server error encountered"

Has anyone had this problem or can shed a light on how this can be fixed.

the stack:

Debian 11
nginx
maria db
Node

thanks in advance


问:
I am trying to get user Facebook profile picture inside a drawer in flutter but it get into infinite loop here is the code . Flutter
```<code>final facebookUserData =FacebookAuth.instance.getUserData().then((facebookUserData) async {
     String profilePicture = facebookUserData['picture']['data']['url'];
   textProvider.facebookProfilePhoto(profilePicture);

});
</code>```

I am using Provider to change the value to a new one that comes from the User data.

Body:
final facebookUserData =FacebookAuth.instance.getUserData().then((facebookUserData) async {
     String profilePicture = facebookUserData['picture']['data']['url'];
   textProvider.facebookProfilePhoto(profilePicture);

});

I am using Provider to change the value to a new one that comes from the User data.


问:
Cannot find module or its corresponding type declarations dockerized react typescript applicaiton error. no node_modules in host
In dockerized react-typescript application the node_modules are installed in container and container is running fine but , in development its throwing errors saying modules not found ts errors. it seems ts compiler cant find react node_module.

I assume the application don't throw any error in absence of modules as am running in dockerized container.


问:
Command PhaseScriptExecution failed with a nonzero exit code XCODE react-native project
```<code>/Library/Ruby/Site/2.6.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.6.0/rubygems.rb:284:in `activate_bin_path'
    from /usr/local/bin/bundle:25:in `<main>'
    from /usr/local/bin/ruby_executable_hooks:22:in `eval'
    from /usr/local/bin/ruby_executable_hooks:22:in `<main>'
Command PhaseScriptExecution failed with a nonzero exit code
</code>```

After this error ios build failed.

I expect to successfully build my ios app

Body:
/Library/Ruby/Site/2.6.0/rubygems.rb:265:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
    from /Library/Ruby/Site/2.6.0/rubygems.rb:284:in `activate_bin_path'
    from /usr/local/bin/bundle:25:in `'
    from /usr/local/bin/ruby_executable_hooks:22:in `eval'
    from /usr/local/bin/ruby_executable_hooks:22:in `'
Command PhaseScriptExecution failed with a nonzero exit code

After this error ios build failed.

I expect to successfully build my ios app


问:
First Substrate Chain
When i run this command according to the documentation.

```<code>**cargo build**
</code>```

I recived this error.
enter image description here

I didn`t find any solution for this.

This is the tutorial link.
https://learn.figment.io/tutorials/create-your-first-substrate-chain

Title: First Substrate Chain

Body:
When i run this command according to the documentation.

**cargo build**

I recived this error.
enter image description here

I didn`t find any solution for this.

This is the tutorial link.
https://learn.figment.io/tutorials/create-your-first-substrate-chain


问:
EF core 7 is not allowing to map multiple properties of an entity with single database column whereas it was working in earlier EF Core versions
Earlier I had mapped multiple properties with single db column as below and it was working. Now after upgrading to EF Core 7, it's showing error: both properties mapped to column 'variableName' in 'ApplicationVariables', but the properties are contained within the same hierarchy. All properties on an entity type must be mapped to unique different columns.'"

Is there any work around for this in EF Core 7?

```<code>modelBuilder.Entity<ApplicationVariable>(entity =>
{
    entity.Property(e => e.Id).ValueGeneratedOnAddOrUpdate();
    entity.Property(e => e.Id)
        .HasColumnName("variableName")
        .IsRequired()
        .HasMaxLength(150)
        .IsUnicode(false);

    entity.Property(e => e.VariableName)
        .HasColumnName("variableName")
        .IsRequired()
        .HasMaxLength(150)
        .IsUnicode(false);
});

</code>```

Body:
Earlier I had mapped multiple properties with single db column as below and it was working. Now after upgrading to EF Core 7, it's showing error: both properties mapped to column 'variableName' in 'ApplicationVariables', but the properties are contained within the same hierarchy. All properties on an entity type must be mapped to unique different columns.'"

Is there any work around for this in EF Core 7?

modelBuilder.Entity<ApplicationVariable>(entity =>
{
    entity.Property(e => e.Id).ValueGeneratedOnAddOrUpdate();
    entity.Property(e => e.Id)
        .HasColumnName("variableName")
        .IsRequired()
        .HasMaxLength(150)
        .IsUnicode(false);

    entity.Property(e => e.VariableName)
        .HasColumnName("variableName")
        .IsRequired()
        .HasMaxLength(150)
        .IsUnicode(false);
});


问:
how can i apply the sigma rules in the elk stack
Where can i apply sigma rules and how?
is it in elastic security detection engine or it could be only integrate with Elastalert ?

my goal is to deploy a SIEM architecture based on elk stack that's why i want to add sigma rules to detecte malicious events


问:
Spring Batch RepositoryItemReader With Native Query Not Working
I just want to execute a native query method in spring data jpa which has no parameters.

Issue 1 : With No Parameters for native query method

```<code>@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee",nativeQuery = true)
    List<Employee> getEmp();

</code>```

Repository Item reader :

```<code>@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        return b;
    }
</code>```

If i use above code i'm getting sort should not be null error.

Issue 2-- with pageable as native query parameter

```<code>@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee",nativeQuery = true)
    List<Employee> getEmp(Pageable p);
}
</code>```
```<code>@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        Map<String, Direction> map = new HashMap<>();
        map.put("id", Direction.ASC);
        b.setSort(map);
        return b;
    }
</code>```

Issue 3 -- Native Query with parameters

```<code>@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee where id=:id",countQuery = "select count(*) FROM public.employee  where id=:id",nativeQuery = true)
    List<Employee> getEmp(Integer id,Pageable p);
}
</code>```
```<code>@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        List<Object> t = new ArrayList<>();
        t.add(1);
        b.setArguments(t);
        Map<String, Direction> map = new HashMap<>();
        map.put("id", Direction.ASC);
        b.setSort(map);
        return b;
    }
</code>```

Tried every possible way But Nothing is worked out. My Requirement is to call a native query method which has no parameters using repository item reader. Could you please Anyone help with this.

Tried every possible way But Nothing is worked out. My Requirement is to call a native query method which has no parameters using repository item reader. Could you please Anyone help with this.

Body:
I just want to execute a native query method in spring data jpa which has no parameters.

Issue 1 : With No Parameters for native query method

@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee",nativeQuery = true)
    List<Employee> getEmp();

Repository Item reader :

@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        return b;
    }

If i use above code i'm getting sort should not be null error.

Issue 2-- with pageable as native query parameter

@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee",nativeQuery = true)
    List<Employee> getEmp(Pageable p);
}

@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        Map<String, Direction> map = new HashMap<>();
        map.put("id", Direction.ASC);
        b.setSort(map);
        return b;
    }

Issue 3 -- Native Query with parameters

@Repository
public interface Repoclass extends JpaRepository<Employee, Integer>
{

    @Query(value = "SELECT id, name, town, datecheck\r\n"
            + " FROM public.employee where id=:id",countQuery = "select count(*) FROM public.employee  where id=:id",nativeQuery = true)
    List<Employee> getEmp(Integer id,Pageable p);
}

@Bean
    public RepositoryItemReader<Employee> readdb()
    {
        RepositoryItemReader b = new RepositoryItemReader<Employee>();
        b.setRepository(repoclass);
        b.setMethodName("getEmp");
        List<Object> t = new ArrayList<>();
        t.add(1);
        b.setArguments(t);
        Map<String, Direction> map = new HashMap<>();
        map.put("id", Direction.ASC);
        b.setSort(map);
        return b;
    }

Tried every possible way But Nothing is worked out. My Requirement is to call a native query method which has no parameters using repository item reader. Could you please Anyone help with this.

Tried every possible way But Nothing is worked out. My Requirement is to call a native query method which has no parameters using repository item reader. Could you please Anyone help with this.


问:
In the extension development of Visual Studio, is there an API similar to the effect of the Decoration API in the extension of VSCode?
I am developing a code completion extension. I have achieved the effect in the figure below in both VSCode and Jetbrains IDE, that is, the completion content is displayed in gray text behind the code. In VSCode, I can achieve it through the Decoration API. In Jetbrains, I can achieve it by rendering a piece of text behind the cursor through EditorCustomElementRenderer. I like this completion method very much. The well-known completion tool Copilot also uses this mode. I have checked a lot of documents, but I still can't find how to implement it in Visual Studio. I want to see how to implement this in Visual Studio, many thanks!

VSCode  JetBrains

I researched related documents and tools and found that in VS2019, similar effects cannot be achieved. But Copilot achieves something similar in VS2022. Wondering which API he used? It would be even better if there is such an API in VS2019.

If there is really no related API, I would like to know if there is an API that can render a piece of text near the cursor, which can be in the form of tooltips or something else, similar to the following effect.

tootips

What I hope is that I can control through code when to display this prompt near the cursor.

To summarize my problem is as follows

1. In VS2019, is there an API for rendering a piece of text behind the cursor, similar to Decortaion API in VSCode

2. If not in VS2019, is there any in VS2022?

3. If not, is there a similar API that can display a piece of text behind the cursor? Which can be in the form of tooltips or something else.


问:
How can i generate custom CIDetectorType?
I'm trying to find similarities in the images and align the images according to the position of the most similar object.

For example; I took 3 photos from different angles and there is always the same person's face in the photos. I choose one of the 3 photos as a reference. With CIDetector, I find the position of the faces in the photos and align them to the face in the reference photo. In this way, when I play the face-focused photos sequentially, I can create a focused boomerang effect.

My question is: As I find and align the faces in these 3 photos, can I align to objects such as cars, objects that I can specify apart from the default CIDetectorType values?

Actualy i am trying to make app like that app: https://imgur.com/qkiKZcY

```<code>func findFace(){

        guard let middle = UIImage(named: "middle.jpg") else {
            return
        }

        guard let left = UIImage(named: "left.jpg") else {
            return
        }

        guard let right = UIImage(named: "right.jpg") else {
            return
        }

        guard let middleCIImage = CIImage.init(image: middle) else {return}
        guard let leftCIImage = CIImage.init(image: left) else {return}
        guard let rightCIImage = CIImage.init(image: right) else {return}

        let detector = CIDetector.init(ofType: CIDetectorTypeFace, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])

        let middleFeatures = detector?.features(in: middleCIImage)
        let leftFeature = detector?.features(in: leftCIImage)
        let rightFeature = detector?.features(in: rightCIImage)
    }
</code>```

Body:
I'm trying to find similarities in the images and align the images according to the position of the most similar object.

For example; I took 3 photos from different angles and there is always the same person's face in the photos. I choose one of the 3 photos as a reference. With CIDetector, I find the position of the faces in the photos and align them to the face in the reference photo. In this way, when I play the face-focused photos sequentially, I can create a focused boomerang effect.

My question is: As I find and align the faces in these 3 photos, can I align to objects such as cars, objects that I can specify apart from the default CIDetectorType values?

Actualy i am trying to make app like that app: https://imgur.com/qkiKZcY

func findFace(){

        guard let middle = UIImage(named: "middle.jpg") else {
            return
        }

        guard let left = UIImage(named: "left.jpg") else {
            return
        }

        guard let right = UIImage(named: "right.jpg") else {
            return
        }

        guard let middleCIImage = CIImage.init(image: middle) else {return}
        guard let leftCIImage = CIImage.init(image: left) else {return}
        guard let rightCIImage = CIImage.init(image: right) else {return}

        let detector = CIDetector.init(ofType: CIDetectorTypeFace, context: nil, options: [CIDetectorAccuracy: CIDetectorAccuracyHigh])

        let middleFeatures = detector?.features(in: middleCIImage)
        let leftFeature = detector?.features(in: leftCIImage)
        let rightFeature = detector?.features(in: rightCIImage)
    }


问:
Flutter Package or Flutter Plugin
Hello Flutter/Dart Devs , I'm developing a flutter package . Nearly 80% of the functionality can be achieved in dart itself so that I've written those in dart . And now , for a specific authentication related feature , I need to consume platform-specific code for both android & iOS since the SDK for that feature is available only for android and iOS. So this lead me to a confusion to choose whether I've to create a Flutter Package Template / Flutter Plugin Template.

Most of the Flutter plugins code contains a dart interface containing only method channel calls and every implementation is platform-specific. I felt , for 30% of code my package turns into a plugin . So finally , should I create a Flutter Plugin Template and put all the dart code and platform specific code or what's the better way?

Title: Flutter Package or Flutter Plugin


问:
how to employ Android compose navigation with App Shortcuts
My current Android Application employs jetpack compose for UI and navigation.

the App has a simple Navgraph of five composable destinations with one being the start destinaton.

```<code>Screen One (START DESTINATION)
Screen Two
Screen Three
Screen Four
Screen Five
</code>```

there are no nested nav graphs and the user navigation works as expected.

the app employs a backdrop that contains five chips that allow the user to navigate to any of the five available screens.

I have implemented multiple back stacks (from the Now In Android App) and my navhost controller resembles this

```<code>data class PracticeUpdateNavigation(private val navHostController: NavHostController) : IPracticeUpdateNavigation {
    override fun onNavigateToScreenOne() = navHostController.navigateSingleTopTo(route = ScreenOneDestination.route)
    override fun onNavigateToScreenTwo() = navHostController.navigateSingleTopTo(route = ScreenTwoDestination.route)
    override fun onNavigateToScreenThree() = navHostController.navigateSingleTopTo(route = ScreenThreeDestination.route)
    override fun onNavigateToScreenFour() = navHostController.navigateSingleTopTo(route = ScreenFourDestination.route)
    override fun onNavigateToScreenFives() = navHostController.navigateSingleTopTo(route = ScreenFiveDestination.route)

fun NavHostController.navigateSingleTopTo(route: String) =
    this.navigate(route) {
        popUpTo(graph.findStartDestination().id) {
            saveState = true
        }
        launchSingleTop = true
        restoreState = true
    }
</code>```

I then implemented App short cuts and employed deeplinks to navigate to the shortcut screen.

this is where the issues started to occur.

when i select an app short cut, the app navigates to the desired target screen, and on back pressed the start destination screen is displayed. when i press back again the user exits the app.

the issue i have is when i select an app short cut and then instead of clicking back i select a new destination from the backdrop, all destinations selected work as expected apart from when i click on the start destination chip.

when i have entered the application via an App shortcut then select the start destination chip from the backdrop nothing happens.

when i have entered the application via an App shortcut then select any other destination apart from the start destination from the backdrop the navigation works as expected until i then select the start destination, something very odd happens, the user navigates to the original app shortcut selected destination and not the actual start destination screen.

where have i made my mistake(s) that deeplink app shortcut navigation doesnt work as expected?

Body:
My current Android Application employs jetpack compose for UI and navigation.

the App has a simple Navgraph of five composable destinations with one being the start destinaton.

Screen One (START DESTINATION)
Screen Two
Screen Three
Screen Four
Screen Five

there are no nested nav graphs and the user navigation works as expected.

the app employs a backdrop that contains five chips that allow the user to navigate to any of the five available screens.

I have implemented multiple back stacks (from the Now In Android App) and my navhost controller resembles this

data class PracticeUpdateNavigation(private val navHostController: NavHostController) : IPracticeUpdateNavigation {
    override fun onNavigateToScreenOne() = navHostController.navigateSingleTopTo(route = ScreenOneDestination.route)
    override fun onNavigateToScreenTwo() = navHostController.navigateSingleTopTo(route = ScreenTwoDestination.route)
    override fun onNavigateToScreenThree() = navHostController.navigateSingleTopTo(route = ScreenThreeDestination.route)
    override fun onNavigateToScreenFour() = navHostController.navigateSingleTopTo(route = ScreenFourDestination.route)
    override fun onNavigateToScreenFives() = navHostController.navigateSingleTopTo(route = ScreenFiveDestination.route)

fun NavHostController.navigateSingleTopTo(route: String) =
    this.navigate(route) {
        popUpTo(graph.findStartDestination().id) {
            saveState = true
        }
        launchSingleTop = true
        restoreState = true
    }

I then implemented App short cuts and employed deeplinks to navigate to the shortcut screen.

this is where the issues started to occur.

when i select an app short cut, the app navigates to the desired target screen, and on back pressed the start destination screen is displayed. when i press back again the user exits the app.

the issue i have is when i select an app short cut and then instead of clicking back i select a new destination from the backdrop, all destinations selected work as expected apart from when i click on the start destination chip.

when i have entered the application via an App shortcut then select the start destination chip from the backdrop nothing happens.

when i have entered the application via an App shortcut then select any other destination apart from the start destination from the backdrop the navigation works as expected until i then select the start destination, something very odd happens, the user navigates to the original app shortcut selected destination and not the actual start destination screen.

where have i made my mistake(s) that deeplink app shortcut navigation doesnt work as expected?


问:
how can i deploy scala on heroku
i am following this link to deploy scala into heroku.

but i got H14 error in heroku - "no web processes running"

i found in internet i must have dyno active heroku ps:scale web=1

but this service is not free. to be valid user, we must enter credit card on heroku.
that meant Heroku is not free anymore ?

so how can i deploy scala API on heroku for free ?

my Procfile : web: target/universal/stage/bin/conspille2

my sbt

did i put Procfile in the right folder. it said on Root.
it is ambigue in root like i did or in root of app ?

Title: how can i deploy scala on heroku


问:
How can I round a number to n significant digits using numpy?
I am trying to round numbers using NumPy, I have the following three numbers

```<code>0.01234
0.001234
0.0001234
</code>```

and I want to round to 3 digits in order to get

```<code>0.0123
0.00123
0.000123
</code>```

As you can see I round three digits after the last zero, that is the target, but with np.around I get the following results

```<code>0.012
0.001
0.
</code>```

How can I do this?

Body:
I am trying to round numbers using NumPy, I have the following three numbers

0.01234
0.001234
0.0001234

and I want to round to 3 digits in order to get

0.0123
0.00123
0.000123

As you can see I round three digits after the last zero, that is the target, but with np.around I get the following results

0.012
0.001
0.

How can I do this?


问:
Node JS - selenium , passing dynamically parameter in async function can't be read, execute script throws undefined?
Using node JS , i am trying to create method "POST" request with fetch/async function using selenium execute script method, i want to send parameters in that function dynamically, one param in url and one param in body , but it can't be read, i get that params are undefined.</p>
```<code> var orderID = 123
 var productID= 321

const transfer = async (orderID ,productID) => {
const res = await fetch(`https://mylink.com/transfer/${orderID}/create`, {
                                    method: 'POST',
                                    body: JSON.stringify({
                                        "recipient": {
                                            "firstName": "Eric",
                                            "lastName": "Jones",
                                            "email": "eric@gmail.com"
                                        },
                                        "note": "Transfering product",
                                        "products": [
                                            productID
                                        ]
                                    }),
                                    headers: {
                                        'Content-type': 'application/json'
                                    }
                                })
                                return res.json()
                            }

                            const test = await driverFirefox.executeScript(transfer);

</code>```

Body:
Using node JS , i am trying to create method "POST" request with fetch/async function using selenium execute script method, i want to send parameters in that function dynamically, one param in url and one param in body , but it can't be read, i get that params are undefined.

 var orderID = 123
 var productID= 321

const transfer = async (orderID ,productID) => {
const res = await fetch(`https://mylink.com/transfer/${orderID}/create`, {
                                    method: 'POST',
                                    body: JSON.stringify({
                                        "recipient": {
                                            "firstName": "Eric",
                                            "lastName": "Jones",
                                            "email": "eric@gmail.com"
                                        },
                                        "note": "Transfering product",
                                        "products": [
                                            productID
                                        ]
                                    }),
                                    headers: {
                                        'Content-type': 'application/json'
                                    }
                                })
                                return res.json()
                            }

                            const test = await driverFirefox.executeScript(transfer);


问:
How to automate foreignkey selection in django?
Had to select quiz name for each questions in the list by clicking on eacone of them and change it from the quiz dropdown menu. Instead is there a way to select one specific quiz name for all quetions at once without clicking and opening each and every question form?Questions editing fields
This is the questions tab

I tried to change the foreignkey to Positive integer field but that didnt work . Please some one can solve this problem?


问:
Scraping online brochures
I need an advice how can i scrape online shop brochures, the site looks like this

Title: Scraping online brochures


问:
How to get Content-Type, boundary value from headers using javascript
```<code> "Content-Type": "multipart/form-data; boundary=------------------------748452847948609677635397",
</code>```

Is there any way to get only boundary value from headers?
I can't figure it out.

thank you for your help.

Body:
 "Content-Type": "multipart/form-data; boundary=------------------------748452847948609677635397",

Is there any way to get only boundary value from headers?
I can't figure it out.

thank you for your help.


问:
Memory in Mat becomes invalid throwing SIGSEGV when accessed, how to check for validity?
In multi-threaded program I init Mat using memory location from other object which lives in different thread:

```<code>GstMapInfo map;
gst_buffer_map(q_inference_buffers.back(), &map, GST_MAP_READ);
cv::Mat frame = (cv::Mat(cv::Size(width, height), CV_8UC3, (char*)map.data));
</code>```

Code is simplistic, map object lives in one thread, frame is passed for processing in other thread. Situation might happen where object that holds data will get destructed before frame is processed. So program gets SIGSEGV. There are a few ways I can fix this problem, simplest would be to copy memory which I want to avoid.

Is there a way to tell that data frame points to becomes invalid? Like perform a check before accessing it.

EDIT: Mutex is another way to fix it, but it is complex solution which will require flags and locking mutex, cumulative time for which adds up over hours of program work. Im considering it but firstly decided to ask if there are other options.

Body:
In multi-threaded program I init Mat using memory location from other object which lives in different thread:

GstMapInfo map;
gst_buffer_map(q_inference_buffers.back(), &map, GST_MAP_READ);
cv::Mat frame = (cv::Mat(cv::Size(width, height), CV_8UC3, (char*)map.data));

Code is simplistic, map object lives in one thread, frame is passed for processing in other thread. Situation might happen where object that holds data will get destructed before frame is processed. So program gets SIGSEGV. There are a few ways I can fix this problem, simplest would be to copy memory which I want to avoid.

Is there a way to tell that data frame points to becomes invalid? Like perform a check before accessing it.

EDIT: Mutex is another way to fix it, but it is complex solution which will require flags and locking mutex, cumulative time for which adds up over hours of program work. Im considering it but firstly decided to ask if there are other options.


问:
Is there a parallel calculation method for robust regression to make it more efficient?
I’m trying to apply Theil-Sen estimator built-in Scikitlearn based on median regression, which is a robust regression method.

Using this estimator is quite simple as shown below:

```<code>import numpy as np
import time
from sklearn.linear_model import LinearRegression, TheilSenRegressor

estimators = [('OLS', LinearRegression()),
              ('Theil-Sen', TheilSenRegressor())]

#x,y here are just some input data

for name, estimator in estimators:
        t0 = time.time()
        estimator.fit(x.reshape(-1, 1), y)
        elapsed_time = time.time() - t0

print(elapsed_time)

</code>```

The basic rules of the Theil-Sen estimator are as followed:

for a linear model, y = ax + b, where in Theil-Sen estimator b is described as
b = Median(yj-yi/xj-xi), i<j = 1, 2, 3, ... ,n, xi ≠ xj.

Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers

The estimation of the model is done by calculating the slopes and intercepts
of a population   of all possible combinations of the input sample points.

The final slope and intercept is defined as the spatial median of these
slopes and intercepts.

It seems good, however, the calculation speed is quite slow comparing with the least square regression. For example, when applying both methods onto a straight line regression with 251 points(n=251), the total calculation time spent by Theil-Sen estimator was 0.12s whereas the least square only took 0.00s, of course it was due to the number of display digits.

I found a way of calculation called parallel calculation but it confused me as involved with python packages called multiprocessing and threading. The following is my humble opinion:

If my initial input dataset is divided into several subsets ,for example 8, I could use the multiprocessing package to achieve the parallel processing with my MAC cpu(8-core) simultaneously, which means I save the calculation time by one eighth.

Am I right doing it that way? May I ask these are packages the best way to make the Theil-Sen estimator faster or there is a true parallel calculation package?

Body:
I’m trying to apply Theil-Sen estimator built-in Scikitlearn based on median regression, which is a robust regression method.

Using this estimator is quite simple as shown below:

import numpy as np
import time
from sklearn.linear_model import LinearRegression, TheilSenRegressor

estimators = [('OLS', LinearRegression()),
              ('Theil-Sen', TheilSenRegressor())]

#x,y here are just some input data

for name, estimator in estimators:
        t0 = time.time()
        estimator.fit(x.reshape(-1, 1), y)
        elapsed_time = time.time() - t0

print(elapsed_time)

The basic rules of the Theil-Sen estimator are as followed:

for a linear model, y = ax + b, where in Theil-Sen estimator b is described as
b = Median(yj-yi/xj-xi), i<j = 1, 2, 3, ... ,n, xi ≠ xj.

Compared to the OLS (ordinary least squares) estimator, the Theil-Sen
estimator is robust against outliers

The estimation of the model is done by calculating the slopes and intercepts
of a population   of all possible combinations of the input sample points.

The final slope and intercept is defined as the spatial median of these
slopes and intercepts.

It seems good, however, the calculation speed is quite slow comparing with the least square regression. For example, when applying both methods onto a straight line regression with 251 points(n=251), the total calculation time spent by Theil-Sen estimator was 0.12s whereas the least square only took 0.00s, of course it was due to the number of display digits.

I found a way of calculation called parallel calculation but it confused me as involved with python packages called multiprocessing and threading. The following is my humble opinion:

If my initial input dataset is divided into several subsets ,for example 8, I could use the multiprocessing package to achieve the parallel processing with my MAC cpu(8-core) simultaneously, which means I save the calculation time by one eighth.

Am I right doing it that way? May I ask these are packages the best way to make the Theil-Sen estimator faster or there is a true parallel calculation package?


问:
Determining which file triggered an error, in Octave
Here is an example of a recent error I got:

```<code>error: mx_el_eq: nonconformant arguments (op1 is 1x51, op2 is 1x53)
error: called from
    load at line 87 column 13
    collect at line 23 column 10
    run at line 78 column 7
    collector at line 47 column 1
    run at line 93 column 5
</code>```

My problem is that I have many (static) functions called 'load()', belonging to different classes, and they are of course all in different files. I could just go through them all and check line 87, but this occurs often enough that I wish Octave could tell me in which file, or which class, the error was triggered.

How can I set up Octave (7.1.0) to share this info?

Body:
Here is an example of a recent error I got:

error: mx_el_eq: nonconformant arguments (op1 is 1x51, op2 is 1x53)
error: called from
    load at line 87 column 13
    collect at line 23 column 10
    run at line 78 column 7
    collector at line 47 column 1
    run at line 93 column 5

My problem is that I have many (static) functions called 'load()', belonging to different classes, and they are of course all in different files. I could just go through them all and check line 87, but this occurs often enough that I wish Octave could tell me in which file, or which class, the error was triggered.

How can I set up Octave (7.1.0) to share this info?


问:
I got a problem with choose calendar in vue 3
I got a problem like this :
StartOn: "2022-12-08"
But I choose a calendar in primevue is : 2022-12-09
When I choose a date in calendar. It automatically goes back 1 day.

This is my code in vue:

<Calendar
                inputId="time24"
                v-model="this.collectionItems.StartOn"
                :showTime="false"
                :showSeconds="true"
                :date-format='yy-mm-dd'
              />
```
<p>This is my code in Laravel Backend</p>
<pre class="lang-php prettyprint-override"><code>public function create(Request $req)
    {
        try {
            $collection = new Collection();
            $collection->NameCollection = $req->input('NameCollection');
            $collection->Description = $req->input('Description');
            $collection->LogoImagePath = $req->input('LogoImagePath');
            $collection->WallPaperPath = $req->input('WallPaperPath');
            $collection->StartOn= Carbon::parse($req->StartOn)->format('Y-m-d');
            $collection->EndOn = $req->input('EndOn');
            $collection->CoverImagePath = $req->input('CoverImagePath');
            $collection->save();
            return $collection;
        } catch (Throwable $e) {
            return $e->getMessage();
        }
    }
</code>```

What is the problem ? How do I fix it ?
I want to result is when I choose 2022-12-09, I had a result is 2022-12-09

Body:
I got a problem like this :
StartOn: "2022-12-08"
But I choose a calendar in primevue is : 2022-12-09
When I choose a date in calendar. It automatically goes back 1 day.

This is my code in vue:

<Calendar
                inputId="time24"
                v-model="this.collectionItems.StartOn"
                :showTime="false"
                :showSeconds="true"
                :date-format='yy-mm-dd'
              />

This is my code in Laravel Backend

public function create(Request $req)
    {
        try {
            $collection = new Collection();
            $collection->NameCollection = $req->input('NameCollection');
            $collection->Description = $req->input('Description');
            $collection->LogoImagePath = $req->input('LogoImagePath');
            $collection->WallPaperPath = $req->input('WallPaperPath');
            $collection->StartOn= Carbon::parse($req->StartOn)->format('Y-m-d');
            $collection->EndOn = $req->input('EndOn');
            $collection->CoverImagePath = $req->input('CoverImagePath');
            $collection->save();
            return $collection;
        } catch (Throwable $e) {
            return $e->getMessage();
        }
    }

What is the problem ? How do I fix it ?
I want to result is when I choose 2022-12-09, I had a result is 2022-12-09


问:
How do I get extreme rays in PuLP?
I'm trying to implement Benders using pulp. I have trouble getting the extreme rays from an unbounded subproblem's dual. What's pulp's API to get extreme rays? (Like UnbdRay in Gurobi)

(Like UnbdRay in Gurobi)

Title: How do I get extreme rays in PuLP?


问:
sklearn.metrics.roc_auc_score : AxisError: axis 1 is out of bounds for array of dimension 1
I am running this piece of code on my computer (available on this link)

```<code>def fit_predict(clf, X_train, y_train, X_test, y_test):
    clf.fit(X_train, y_train)
    return sklearn.metrics.roc_auc_score(y_test, clf.predict_proba(X_test)[:, 1])

dataset = sklearn.datasets.load_breast_cancer()
clf = sklearn.ensemble.RandomForestClassifier(n_estimators=25, max_depth=6)
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(
pd.DataFrame(dataset.data), pd.DataFrame(dataset.target, columns=["target"]), test_size=0.33,
random_state=42)
print("initial metric", fit_predict(clf, X_train, y_train, X_test, y_test))

new_train1, new_target1 = OriginalGenerator().generate_data_pipe(X_train, y_train, X_test, )
print("OriginalGenerator metric", fit_predict(clf, new_train1, new_target1, X_test, y_test))

new_train1, new_target1 = GANGenerator().generate_data_pipe(X_train, y_train, X_test, )
print("GANGenerator metric", fit_predict(clf, new_train1, new_target1, X_test, y_test))
</code>```

However, when I tried to run it on my data set, I encountered an error in this line of code:

```<code>sklearn.metrics.roc_auc_score(y_test, clf.predict_proba(X_test)[:, 1], multi_class='ovr')

 AxisError: axis 1 is out of bounds for array of dimension 1
</code>```

y_test has shape (266, 1):

```<code>y_test
     Class
192      2
717      2
168      2
522      2
536      2
</code>```

X_test (shape (266, 21)) is a dataframe with multiple columns:

```<code>X_test
            shape         color      thickness     density      area ../
192            1            3             2            2           2
717            3            2             3            1           1
168            1            2             3            1           2
522            2            2             3            2           1
</code>```

And clf.predict_proba(X_test)[:, 1] has a length 266.

To be honest, I don't see the reason for this error, since all dimensions are aligned.
I tried this suggestion, but it didn't help me.

If someone know how to help me, that would be great! Thanks a lot, in advance!

Body:
I am running this piece of code on my computer (available on this link)

def fit_predict(clf, X_train, y_train, X_test, y_test):
    clf.fit(X_train, y_train)
    return sklearn.metrics.roc_auc_score(y_test, clf.predict_proba(X_test)[:, 1])

dataset = sklearn.datasets.load_breast_cancer()
clf = sklearn.ensemble.RandomForestClassifier(n_estimators=25, max_depth=6)
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(
pd.DataFrame(dataset.data), pd.DataFrame(dataset.target, columns=["target"]), test_size=0.33,
random_state=42)
print("initial metric", fit_predict(clf, X_train, y_train, X_test, y_test))

new_train1, new_target1 = OriginalGenerator().generate_data_pipe(X_train, y_train, X_test, )
print("OriginalGenerator metric", fit_predict(clf, new_train1, new_target1, X_test, y_test))

new_train1, new_target1 = GANGenerator().generate_data_pipe(X_train, y_train, X_test, )
print("GANGenerator metric", fit_predict(clf, new_train1, new_target1, X_test, y_test))

However, when I tried to run it on my data set, I encountered an error in this line of code:

sklearn.metrics.roc_auc_score(y_test, clf.predict_proba(X_test)[:, 1], multi_class='ovr')

 AxisError: axis 1 is out of bounds for array of dimension 1

y_test has shape (266, 1):

y_test
     Class
192      2
717      2
168      2
522      2
536      2

X_test (shape (266, 21)) is a dataframe with multiple columns:

X_test
            shape         color      thickness     density      area ../
192            1            3             2            2           2
717            3            2             3            1           1
168            1            2             3            1           2
522            2            2             3            2           1

And clf.predict_proba(X_test)[:, 1] has a length 266.

To be honest, I don't see the reason for this error, since all dimensions are aligned.
I tried this suggestion, but it didn't help me.

If someone know how to help me, that would be great! Thanks a lot, in advance!


问:
How can I draw a circular filled region in OpenGL?
I want to draw a circular filled region like this using OpenGL version 1.3:

How can I draw such a shape?


问:
Jenkins unexpectedly terminating connection to client
When running a longer Jenkins (2.361.4) job the connection to the client 'unexpectedly disconnects' after about an hour killing the job and the client. Any SSH connection I have is still OK but I have to reboot the client to let Jenkins restart the client instance.

FATAL: command execution failed
java.io.EOFException
at java.base/java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2911)
at java.base/java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:3406)
at java.base/java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:932)
at java.base/java.io.ObjectInputStream.(ObjectInputStream.java:375)
at hudson.remoting.ObjectInputStreamEx.(ObjectInputStreamEx.java:49)
at hudson.remoting.Command.readFrom(Command.java:142)
at hudson.remoting.Command.readFrom(Command.java:128)
at hudson.remoting.AbstractSynchronousByteArrayCommandTransport.read(AbstractSynchronousByteArrayCommandTransport.java:35)
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:61)
Caused: java.io.IOException: Unexpected termination of the channel
at hudson.remoting.SynchronousCommandTransport$ReaderThread.run(SynchronousCommandTransport.java:75)
Caused: java.io.IOException: Backing channel 'pi4node' is disconnected.

The node is on a 4GB Pi4 running 64 bit PiOSLite with Java JDK 11.0.8-zulu
This was working fine until recently, and still works fine on my other node that is a 1G 3B+ running Raspian Lite with the same JDK (Running Java client instead of server, as client isn't supported on 64bit)

I've tried installing various different versions of the JDK for the Pi4 (11.0.12, 11.0.16.1, 11.0.17, 17.0.5, 19.0.1) but it's still doing it.

I've tried everything in this related issue without success, how can I get jobs longer than a hour to run?