on-internet

JSDoc: How to specify the type of an implicit global variable for a JS code snippet?

I have a JavaScript file that is being run with eval() by a VSCode extension. When the script is evaluated, its context already includes the global variable vscode (the VSCode API) which I am using from my script. All of that works fine. What I want to know: Is there a way to use JSDoc annotations / TypeScript type definition files to tell VSCode that the vscode variable exists in the context? I have tried this (I'm not sure if it makes any sense) and it didn't help: // @ts-check /// <reference path="node_modules/@types/vscode/index.d.ts" /> What does work is if I write: const vscode = require

Join the discussion →

ffmpeg Flip video horizontally

anyone know can I make the video flip horizontal using batch file? here my batch file code that I have tried : @echo off ffmpeg -i "1.mp4" -vf hflip -i audio1.mp3 -map 0:v -map 1:a -c:v copy -shortest "C:\Users\Admin\Desktop\Replaced Mp3\1.mp4" pause

Join the discussion →

How can I make a discontinuous axis in R with ggplot2?

I have a dataframe (dat) with two columns 1) Month and 2) Value. I would like to highlight that the x-axis is not continuous in my boxplot by interrupting the x-axis with two angled lines on the x-axis that are empty between the angled lines. Example Data and Boxplot library(ggplot2) set.seed(321) dat <- data.frame(matrix(ncol = 2, nrow = 18)) x <- c("Month", "Value") colnames(dat) <- x dat$Month <- rep(c(1,2,3,10,11,12),3) dat$Value <- rnorm(18,20,2) ggplot(data = dat, aes(x = factor(Month), y = Value)) + geom_boxplot() + labs(x = "Month") + theme_bw() + theme(panel.grid = element_blank(), te

Join the discussion →

Notification.requestPermission() não funciona no navegador Firefox

Tenho o seguinte código Java Script em meu sistema <script> function showNotification(mensagem){ const notification = new Notification('Teste Notificação',{ body: mensagem, icon: 'https://i.pinimg.com/originals/20/79/03/2079033abc8314be554f9d24f562a199.jpg' }) } console.log(Notification.permission) if(Notification.permission==='granted'){ showNotification('Você possui notificações não lidas.'); }else if(Notification.permission!=="denied"){ Notification.requestPermission().then(permission=>{ if(permission ==='granted'){ showNotification('Você possui notificações não lidas.'); } }) } </script> N

Join the discussion →

How to hide elements when Hamburger menu is clicked

I'm having problems with my mobile responsive navbar. It works perfectly on desktop but on mobile, it is showing like this So I tried removing the code that play video in the background and it worked! This is my navbar code, var navList = document.getElementById("nav-lists"); var body = body; function Show() { navList.classList.add("_Menus-show"); } function Hide() { navList.classList.remove("_Menus-show"); } <style>*, *::before, *::after { box-sizing: border-box; -webkit-box-sizing: border-box; } .container { height: 60px; background-color: #333333; display: -webkit-box; display: -ms-flexbox;

Join the discussion →

How can I perform principal component analysis (PCA) on a large feature set?

I am using logistic regression to train a dataset with 20,000 features and am also using PCA for dimensionality reduction. The snippet below is directly from the documentation here: https://spark.apache.org/docs/latest/mllib-dimensionality-reduction.html#principal-component-analysis-pca However, I am (understandably) getting Java Heap Space errors (both locally and when running on a GCP cluster). How can I use PCA for such a large feature set, or, what would be a better approach for dimensionality reduction? import org.apache.spark.mllib.feature.PCA import org.apache.spark.mllib.linalg.Vectors

Join the discussion →

Wallet Connect: No RPC Url available for chainId: 137

I am trying to create a WalletConnect provider. I am using the @walletconnect/web3-provider package along with Web3Modal for UI. I am instantiating the WalletConnectProvider using my Infura client ID let web3Modal = new Web3Modal({ network: "matic", cacheProvider: true, providerOptions: { walletconnect: { package: WalletConnectProvider, options: { infuraId: "c22c90a767684c5fbd7257da57802b35" , }, }, }, }); web3Modal.clearCachedProvider(); await web3Modal.connect(); When I run my app and connect my wallet, I get the following error: Error: No RPC Url available for chainId: 137 I am trying to co

Join the discussion →

Is Python's asyncio `loop.create_task(...)` threadsafe?

I have matplotlib running on the main thread with a live plot of data coming in from an external source. To handle the incoming data I have a simple UDP listener listening for packages using asyncio with the event loop running on a seperate thread. I now want to add more sources and I'd like to run their listeners on the same loop/thread as the first one. To do this I'm just passing the loop object to the classes implementing the listeners and their constructor adds a task to the loop that will initialize and run the listener. However since these classes are initialized in the main thread I'm

Join the discussion →

Create list item from input value

I'm working on a to-do list project and I got a problem, I want that when I click on the submit button the input value becomes a list item but it doesn't work. Here's the code: let btn = document.getElementById('btn') let txt = document.getElementById('txt') btn.addEventListener('click', function(){ let list = document.createElement('li') list.innerHTML = txt.value }) <h1 id="title">To do list</h1> <div class="main"> <input type="text" alt="type text here" id="txt"> <button type="submit" id="btn">Submit</button> </div>

Join the discussion →

Receiving error - "org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected" inJMeter

I am using JMeter 5.4.1, where I am using a HTTP request for Post API call. I am getting the error - "org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected". Keep-Alive is checked. Timeouts are also set to 60 Seconds. I am getting this error after almost 30-45 Minutes when thread is started. I am using single thread. What is the solution to get raid of this? org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected at org.apache.http.impl.io.ChunkedInputStream.getChunkSize(ChunkedInputStre

Join the discussion →

How to control the behaviour of lintr in Visual Studio Code?

Switching from Rstudio to VS Code. Biggest problem right now: the linters are constantly bothering me! Take the snippet as an example: object_name_linter is trying to make me name my variable as group_markers instead of group.markers. However, in the R community, it's rather common to see . within variable names. I couldn't figure out a good way to turn off this linter.

Join the discussion →

Filtering on a condition using the column names and not numbers

I am trying to filter a text file with columns based on two conditions. Due to the size of the file, I cannot use the column numbers (as there are thousands and are unnumbered) but need to use the column names. I have searched and tried to come up with multiple ways to do this but nothing is returned to the command line. Here are a few things I have tried: awk '($colname1==2 && $colname2==1) { count++ } END { print count }' file.txt to filter out the columns based on their conditions and head -1 file.txt | tr '\t' | cat -n | grep "COLNAME to try and return the possible column number related to

Join the discussion →

Sports tournament schedule with changing pairs

Lets imagine there are 8 players attending to beach volley event. Matches are played 2 vs 2. As organiser i want to generate schedule for players with the following rules: each player plays together with everyone (7 matches for each player) each player plays twice against each player So the schedule would start for example: round 1 player1 + player2 vs player3 + player4 player5 + player6 vs player7 + player8 round2 player1 + player3 vs player2 + player5 player4 + player7 vs player6 + player8 round3 player1 + player4 vs player2 + player3 player5 + player8 vs player6 + player7 etc With the examp

Join the discussion →

_batch_encode_plus() got an unexpected keyword argument 'return_attention_masks'

I am studying RoBERTA model to detect emotions in tweets. On Google colab. Following this Noteboook file from Kaggle - https://www.kaggle.com/ishivinal/tweet-emotions-analysis-using-lstm-glove-roberta?scriptVersionId=38608295 Code snippet: def regular_encode(texts, tokenizer, maxlen=512): enc_di = tokenizer.batch_encode_plus( texts, return_attention_masks=True, return_token_type_ids=False, pad_to_max_length=True, #padding=True, max_length=maxlen ) return np.array(enc_di['input_ids']) def build_model(transformer, max_len=160): input_word_ids = Input(shape=(max_len,), dtype=tf.int32, name="input

Join the discussion →

Cannot use import statement outside a module in node.js

I was working on the project on model.js file, then after that I need to import model.js file to Shareplace.js file. But after that the problem occurs into the console browser "Cannot use import statement outside a module". This is my Shareplace.js file code: import {modal} from '../src/UI/modal'; class PlaceFinder { constructor() { const AddressForm = document.querySelector('form'); const locateUserButton = document.getElementById('locate-btn'); locateUserButton.addEventListener('click',this.locateUserHandler); AddressForm.addEventListener('submit',this.findAddressHandler); } locateUserHandle

Join the discussion →

Failed to establish a new connection: [Errno 11001] getaddrinfo failed' in Python 3.9

This script is used to send data to a 3rd party. It seems to run fine when connected to any network other than my work network. When connected to my work network, it will run for a few minutes, PUT/POSTing as it should, and then suddenly the following error will appear: Traceback (most recent call last): File "C:\Users\user\AppData\Local\RPackages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\urllib3\connection.py", line 169, in _new_conn conn = connection.create_connection( File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation

Join the discussion →

How to use session variables in ASP.NET Core 3.1 MVC using C#

I'm having trouble with session objects. To set and get inside the same controller will work fine, my trouble is to use the info saved in the session in another controller, it doesn't work for me, every time I get a null value. I used to code PHP, I just needed to start session and get the values. No idea how to do it in ASP.NET Core 3.1 MVC. using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using partner2.Data; using partner2.Helpers; using partner2.Models; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace partner2.Contro

Join the discussion →

Deprecated APIs should be marked accordingly in the Swagger UI

Feature Request Today it is possible to version APIs and most things around that work perfectly fine with Swagger. What I am really missing here is the possibility to make it transparent for any Swagger UI users that an API version has been marked as deprecated. API deprecation in aspnetcore is described here. My expectation would be to have an icon or a tag which says "OBSOLETE" or "DEPRECATED" next to the API group name. On a side note: The Swashbuckle Swagger ASPNET.Core github project issue tracker advised to open feature requests on SO. Edit: The whole Controller is marked as deprecated u

Join the discussion →

Understanding an issue reported by valgrind

I consistently get this trace shown by valgrind. This is an aarch64 system. I want to know if there is anything I can do within my limits to fix this problem, as explained below - Invalid read of size 8 is at lh_delete by ERR_remove_thread_state (in libcrypto) by soap_free (in gsoap) ? There is no relation as far as I know between these two. Invalid read by a function in libcrypto, attempts to read 8 bytes that has been freed again by libcrypto. Block itself was also allocated by libcrypto. I have been reading about issues with the version of libcrypto I have. https://curl.se/mail/lib-2016-08/

Join the discussion →

Why SystemButtonFace is not received as a color in linux but does in windows when using tkinter?

I was making an interface in windows using tkinter, and all my buttons had the color as "SystemButtonFace", then I moved to a linux computer and it throws an error, the color doesn't exist, and I changed it to white, but then I wondered if there was another way to do this, I made some research and apparently this is like a system value and Windows should return a hex code for the color but in Linux this value doesn't exist. Is there a way I can maybe add this value to the system? or should I just change the color values to another that can be used in both systems? The button: b1 = Button(root,

Join the discussion →

How to call function after page fully loaded in Angular?

I am trying to invoke a function on particular route after page loaded fully, like if user logged in and come to main page route first, and it loaded successfully a function will invoke/call by itself. constructor( private router: Router) { this.router.events.subscribe((event: Event) => { if (event instanceof NavigationEnd) { console.log(router.url); //function writes here } }); } I am calling this function on main.ts but when user trying to logged in this function invokes why ?

Join the discussion →

Please enter the correct Email and password for a staff account. Note that both fields may be case-sensitive

I complete makemigrations and migrate then create a superuser. After this http://127.0.0.1:8000/admin i try to log in then show this error Please enter the correct Email and password for a staff account. Note that both fields may be case-sensitive seetings.py AUTH_USER_MODEL = 'user.CustomUser' **models.py** from django.db import models from django.contrib.auth.models import AbstractUser,BaseUserManager class CustomUserManager(BaseUserManager): """ Creates and saves a User with the given email, date of birth and password. """ def create_user(self, email, password=None): if not email: raise Val

Join the discussion →

Bullmq get a job with a specific ID from a queue

I am trying to create a results queue on BullMQ where all workers can send results adding jobs with special crafted jobIDs. The idea is that all results arrive with a specific jobID generated so that I known exactly which process the result is for. I've tried with getNextJob as described in the documentation, with no luck. The solution I found is using the queuEvents: each process registers a listener on the waiting state of the results queue and, when the job with the id It needs arrives, the process gets the job with a getJob, reads the result data and tries to move the job to completed. It

Join the discussion →

Upload image to MinIO

I want to upload image with format .png to MinIo. But I have problem with error not find directory Error: open /sensors/download (1).png: no such file or directory I have created a directory file with sensor name inside minio bucket named ems_service. Like this code I wrote to upload an image file using Go with Minio ctx := context.Background() endpoint := config.MINIO_ENDPOINT accessKeyID := config.MINIO_ID secretAccessKey := config.MINIO_KEY useSSL := true contentType := "image/png" location := "us-east-1" utilities.Info.Printf("secret access key: %+v", secretAccessKey) utilities.Info.Printf

Join the discussion →

Module build failed using css-loader while trying to import main.css file

I am trying to use node and vue js in the wordpress plugin.I am struck in the css file import.I am trying add css file into the package.json file. importing css file using css-loader. But i am getting the following error. Also can anyone explain how to post-css in this case. package.json { "name": "plugin_toolkit", "version": "1.0.0", "description": "Simple WordPress plugin that uses Webpack.", "main": "index.js", "babel": { "presets": [ "@babel/preset-env" ] }, "scripts": { "dev": "webpack --mode=development --watch --config webpack-config.js", "build": "webpack --mode=production --config web

Join the discussion →

OL Office 365 (Win 10) email circle and border issue

<!--[if mso]> <v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="http://www.EXAMPLE.com/" style="text-align: center;font-size: 14px;height: 143px;width: 143px;" arcsize="50%" strokecolor="#fbe2a6" strokesize="4px" stroke="f" fillcolor="#f7c54d"> <w:anchorlock/> <center style="color:#ffffff;font-family:sans-serif;font-size:13px;"> <div class="yellow-circle"> <div class="number" style="color: #fff;font-weight: 700;font-size: 24px;line-height: 1;padding-bottom: 2px;">#1</div> <div class="round-title" style="font-size: 11px;font-weight: 700;c

Join the discussion →
Older stories