instruction stringlengths 0 30k ⌀ |
|---|
Thanks to Remy Lebeau's hint, I managed to get it working:
```c++
#include <iostream>
#include <sstream>
class FailBuffer : public std::streambuf {
public:
FailBuffer(std::streambuf *original_buf, std::streamsize n)
: original_buf(original_buf), chars_left(n) {}
std::istream *parent;
char ch; /... |
For testing if the result of itest is true you can use the `if` command. To leave a macro use the `exit`command:
setenv macro 'if itest $filesize > 2048; then exit; else echo bingo; fi; echo continuing'
setenv filesize 10000
run macro
Man-pages for 'if' and 'itest' have been added to https://docs.u-... |
I have a data frame - each individual has multiple visits. I want to filter out patients who had disease 2 after disease 1. Sometimes a patient can have disease 3 between 1 and 2, and they should be included too. In this case, I would pick out ID 2 & 4 & 6.
ID <- c(1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 6)... |
I am currently working on implementing a JavaScript code that aims to read and parse .npz files generated from Python's numpy, specified by a JSON file. These .npz files contain arrays of floating values. However, I am encountering errors while running the script. What is causing the issues in my implementation? How to... |
this is actually normal, as the fetchMode is ignored on requests to fetch multiple entities.
I haven't been able to find a reference to this in the new documentation, but this [old documentation](https://docs.jboss.org/hibernate/stable/core.old/reference/en/html/performance.html) states that :
> The fetch strate... |
I have an issue with IBM DB2 console. After updating expired certs (using [this](https://www.ibm.com/docs/en/ias?topic=certificates-console-certificate) instruction) it just stopped work. It happened just right after I uploaded the new cert using web console web interface.
```bash
$ openssl s_client -showcerts -con... |
I'm making an inventory script, and I change the tags of prefabs to check if my inventory already has them stored, but when I exit the game the tags stay as stored, which is a problem because then it doesnt add or instantiate the prefab, here's the code if it helps
```
public void AddObjInv(GameObject InvObj, int... |
how do I change an objects tag when the game closes |
|c#|unity-game-engine| |
The issue with answers that suggest using `rejectUnauthorized: false` is that this makes the request unsecure.
I'd suggest you get the PEM base64'd certificate from the server/site you're trying to reach and include it through an agent when making your request:
const { Agent } = require('undici');
cons... |
Each time I run this code, I get a different result:
```
set.seed(42)
lda_seq <- textmodel_lda(dfmt, k = 5, gamma = 0.5,
batch_size = 0.01, auto_iter = TRUE,
verbose = FALSE)
terms(lda_seq)
```
The package is from seededlda based on quanteda.
How can I get reproducible results?
I tried dif... |
set.seed() in quanteda's lda function |
|lda|quanteda| |
null |
Your `apiUrl` response must have the HTTP response header `Content-Length`. If it doesn't, there is nothing to compute.
Maybe the event handler should be bound to `xhr`:
```javascript
xhr.addEventListener("progress", function(e) {
``` |
I restructured my project and experience problems when it comes to the link of my .css-file
- I am using xampp/Apache
- The .htaccess file is in ".../htdocs/project" including "RewriteCond %{DOCUMENT_ROOT}/public/$1 -f"
- My Head partial is in ".../htdocs/project/views/partials/head.part.view.php" and includes the... |
null |
As far as I see, you want to do scraping from an html page, so it wont work like file manager. You need to use Beautifulsoap or Lxml libraries of Python. Following code written by using lxml library which should do what you want... It will save pdfs to the folder where the code is executed.
import requests
... |
|python|pandas|dataframe| |
I have a tmux session that has lot of windows and panes (for monitoring some tests) and once in a while when server is rebooted all of it is gone. I would like make it easy to recreate the whole tmux session by running a command in each of the split panes in specific windows (i.e. window X, pane Y run ssh and so on). I... |
Running commands in tmux windows when windows/panes are created |
|tmux| |
This happens because you are passing a scalar argument to a pmapped function. For example:
```python
import jax
func = lambda x: x ** 2
pfunc = jax.pmap(func)
pfunc(1.0)
# ValueError: pmap was requested to map its argument along axis 0, which implies
# that its rank should be at least 1, but is only 0 (its sha... |
null |
|python|python-3.x|macos|jupyter-notebook| |
Buildozer not installing Android SDK |
In my case, I had several VS Code instances opened, so I had to close all the opened instances in order to apply the changes |
Here's the PostMessage approach (uses Messages) for the record :)
procedure TMyEdit.KeyUp(var Key: Word; Shift: TShiftState);
begin
inherited;
if FocusNextOnEnter then
if Key = VK_RETURN then begin
PostMessage(GetParentForm(Self).Handle, wm_NextDlgCtl, Ord((ssShift in Shift... |
|java|android| |
You can use Elliptic curve key pair. You should use Bip32 Seed with **FixedSecureRandom** to make key pair
fun generateKeyPair(seed: ByteArray): KeyPair {
Security.insertProviderAt(BouncyCastleProvider(), 1)
var ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1")
v... |
My webpack.config for a federated module, has multiple entries.
```js
entry: {
"@namespace": "path/to/public_path_util.js",
"namespace-worker-chunk-name1": "path/to/worker_public_path_util.js",
"namespace-worker-chunk-name2": "path/to/worker_public_path_util.js",
"namespace-worker-chunk-name3": "pat... |
Webpack Federated module's Production build fails with "Self-reference dependency has unused export name" when importing lodash |
|webpack|webpack-5| |
null |
I am working with python selenium.Gologin provide me multiple browses with different proxy.
I want that i can automate multiple browser same time.i used multiprocessing but it open multiple browser but only one of them Work fine and other browser Doesn't work.i want That it will automate my all browser in same time.
... |
Python selenium automation browser |
|python|selenium-webdriver|automation|gologin| |
I checked the docs:
> Snapshotting is effectively **“recording after the fact”**. Rather than starting recording at a specific point, snapshotting allows you to convert requests already received by WireMock into stub mappings.
If I'm reading it right, this should pass:
```java
package com.example.gatewaydemo.mi... |
Issues with my Javascript code to parse files |
|javascript|python|node.js|arrays|numpy| |
null |
mouse coordinates in image go below 0 and above width |
I have a component that looks like this
import { useState, useEffect, useMemo } from 'react'
import Input from '~/components/Input'
import Fuse from 'fuse.js'
interface Props {
data: any[]
keys: string[]
onUpdate: (data: any[]) => void
placeholder: string
}
... |
Array received as prop from parent used as a dependency of useMemo triggers infinite re-rendering |
|javascript|reactjs|next.js|memoization| |
Since Flutter 3.16.4 the Gradle setup has changed by default on all new apps, resulting in breaking the flutter-fire CLI automatic configuration.
You must configure the Android gradle yourself.
Here's what worked for me.
./android/settings.gradle
```groovy
plugins {
id "dev.flutter.flutter-plugin-loader... |
null |
According to [microsoft/TypeScript#54630](https://github.com/microsoft/TypeScript/issues/54630), specifically [this comment by the TS team dev lead](https://github.com/microsoft/TypeScript/issues/54630#issuecomment-1589486333):
> There are no specific guarantees on what happens when there is an error type in your pr... |
npm ERR! code ECONNRESET
npm ERR! syscall read
npm ERR! errno -4077
npm ERR! network read ECONNRESET
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy,... |
npm install has failed i got "ECONNRESET" error |
|reactjs|npm|npm-install| |
null |
You don't need an array, you can calculate a *running average*.
Here's an example:
int main()
{
double sum = 0.0;
double number = 0.0;
double quantity = 0.0;
std::cout << "Enter number (floating point ok): ";
while (std::cin >> number)
{
... |
I have a script so that when I touch a cube it takes away its HP
```
local HP = cube.Healthbar
local function Healtbar() do
HP.Value = HP.Value - 5
end
cube.Touched:Connect(Healthbar)
```
But HP is taken away too quickly, literally every frame when I encounter the cube, and I would like to have a sm... |
Calling an event with a delay in Roblox Studio. How to do? |
|lua|game-development|roblox|roblox-studio| |
null |
loginservice.ts
```
import { HttpClient } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable({
providedIn: 'root'
})
export class LoginService {
constructor() { }
http = inject(HttpClient)
onLoginAuthentication(obj... |
css.file in sub folder is not linked correctly |
|php|html|css| |
null |
If this is really something line based (where a true XML parser isn't necessarily the best solution), [`mmap`](https://docs.python.org/3/library/mmap.html) can help here.
`mmap` the file, then call `.rfind('\n')` on the resulting object (possibly with adjustments to handle the file ending with a newline when you rea... |
I am using officeGen to generate word documents.
`generateDocumentService.js`:
var generateReportFromTableData = function (tableData) {
console.log('tableData: ', tableData);
var docx = officegen({
type: 'docx',
orientation: 'portrait',
pageMargins: {
top... |
For my university assignment, I have to produce a csv file with all the distances of the airports of the world... the problem is that my csv file weight 151Mb. I want to reduce it as much as i can: This is my csv:
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/HwMVe.png
and this is ... |
I need a customized xml for orders, like this:
```
<?xml version="1.0" encoding="UTF-8"?>
<ns1:root xmlns:ns1="https://web.one.com">
<ns1:Orders>
<!-- BEGIN LOOP -->
<ns1:Order ns1:ownCode="{Order ID}">
<ns1:Customer>000000</ns1:Customer>
<ns1:Date>[date("Y-m-d")]</ns1:Date>
<ns1:ServiceDate>{C... |
How to write a clickable path that points to a multiline range? |
|visual-studio-code|path|range|clickable| |
null |
You can use `(input)` instead of `(change)`. `(input)` event fires everytime you enter a character. `(change)` when you lose focus on the input. Or you can do the following:
Use `ChangeDetectorRef` to detect the changes in your component:
constructor(
private formBuilder: FormBuilder,
private cd... |
**this is the code that I made using javascript, express and jwt for authentication to learn restful api but I am constrained when checking in postman for endpoint /tasks, an error always appears
"error: invalid token"
even though I have entered the jwt token that matches what I got from the endpoint login**
in... |
why when I check endpoint /tasks, an error always appears "error : invalid token" even though I have entered the appropriate token that I got |
|javascript|node.js|express|rest|postman| |
null |
I want to design a program that can output a clickable path to terminal, but I can't find a way to represent a clickable path with a range.
Is there anyone who knows the answer?
```text
Version: 1.87.2 (Universal)
Commit: 863d2581ecda6849923a2118d93a088b0745d9d6
Date: 2024-03-08T15:21:31.043Z
Electron: 27.3.2... |
I'm a newbie to html, I'm trying to put some orange text into a white box with an orange border. I've got:
<!-- begin snippet: js hide: false console: true babel: false -->
<!-- language: lang-html -->
<div style="
top: 20px;
left: 110px;
position: absolute;
z-in... |
I have a hosted zone for my apex domain `yzpaul.com`. I requested a certificate through AWS Certificate Manager for `yzpaul.com` and `www.yzpaul.com`. The `yzpaul.com` was approved almost instantly. I confirmed both CNAME records showed in the hosted zone. 24 hours later `www.yzpaul.com` still says pending. What am I m... |
|python|web-scraping|playwright|playwright-python| |
Snowflake has a policy of not promising dates. So for any question "when is the ____ feature currently in private preview going into public preview?" - the answer is "we don't know, but hopefully soon".
The best place to monitor to check what comes into public preview is: https://docs.snowflake.com/en/release-notes/... |
From what I can tell it has to do with your javascript in `room.html`, after some experimenting myself, I believe you can get rid of this `daphne_port` constant.
```javascript
const url = ws_scheme + '://' + window.location.host + '/ws/chat/' + roomName + '/';
```
Only after removing it, I got everything to wor... |
{"Voters":[{"Id":830680,"DisplayName":"Clive"},{"Id":10952503,"DisplayName":"Elikill58"},{"Id":22180364,"DisplayName":"Jan"}]} |
{"Voters":[{"Id":5043481,"DisplayName":"zforgo"},{"Id":721855,"DisplayName":"aled"},{"Id":22180364,"DisplayName":"Jan"}],"SiteSpecificCloseReasonIds":[13]} |
See example. Recursive assembling expression formula from expression_tree table.
```
with -- recursive -- for PostgreSql
cte as(
select expression_id,oid
,concat(
case when lv in('*','+','-','/') then concat('{',lid,'}')
else cast(lv as varchar) end
,ov
,case when rv in('*','+','... |
|ios|swift|swiftui|charts|swiftui-charts| |
I'm trying to scrape simplify for it to login into my account and keep sending me matches it finds to my slack/telegram bots later on. I'm finding a problem with entering the sign in after I input my email and password and I'm confused as I've tried everything I can think of
I tried using `page.keyboard.down("Enter... |
{"Voters":[{"Id":1427878,"DisplayName":"CBroe"},{"Id":10952503,"DisplayName":"Elikill58"},{"Id":22180364,"DisplayName":"Jan"}]} |
In order to utilize this approach to using a filter with parameters set by a attribute and filter you need to ensure you utilize the Arguments parameter as follows:
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using APP.Okta;
using System.Security.Claims;
using Syst... |
Why are overflowing flex items shown in purple stripes? |
|css|flexbox|chrome-debugging| |
**encountering error while executing below query,can someone help with this?**
```
MERGE INTO {processed_db}.{processed_table} target
USING (
SELECT *
FROM (SELECT row_number() OVER (PARTITION BY {key}
ORDER BY COALESCE(transact_id,'0') DESC) AS row_version_number,
*
FROM (
SELECT op, {",".join(columns)}... |
You can first change `as.factor()` to `factor()` and then add the `levels` and `labels` attributes:
````lang-r
library(ggplot2)
Rurality<- c(1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,... |
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/TQHDb.png
I am working on the problem above. So far, I have that since M_1 is rank one, the entire product is rank one, so there is one zero eigenvalue. Therefore, we may take the trace of the resulting product to get the value of the othe... |
I am currently working on implementing a JavaScript code that aims to read and parse .npz files generated from Python's numpy, specified by a JSON file. These .npz files contain arrays of floating values (a ML model weights and biases as arrays). However, I am encountering errors while running the script. What is causi... |
WP All Export Custom XML order lines loop error |
|wpallimport| |
null |
I'm trying to mass-delete a bunch of items from my spotify streaming data by specific artists (mostly just trying to remove a bunch of audiobooks). The data is in the form of a bunch of JSONs formatted like this:
```
{
"ts": "2017-05-04T13:26:03Z",
"username": [redacted],
"platform": "Android OS 5.1.... |
Python - Remove elevents from JSON containing a certain value |
|python|arrays|json|spotify| |
null |
For the algebraic part you can use the [numexpr][1] library can take of that. For example the following snippet will work:
import numpy as np
import numexpr as ne
a = np.random.rand(10)
b = np.random.rand(10)
c = np.random.rand(10)
d = np.random.rand(10)
ne.evaluate("a * 3 + 1.2... |