I have installed Anaconda on my new laptop and I can't use the library ipywidgets any more. Just an example snippet of the code which I ran for test purposes - import ipywidgets as widgets from IPython.display import display w = widgets.IntSlider() display(w) I got the following Javascript error : [Open Browser Console for more detailed log - Double click to close this message] Failed to load model class 'IntSliderModel' from module '@jupyter-widgets/controls' Error: Module @jupyter-widgets/controls, version ^1.5.0 is not registered, however, 2.0.0 is at f.loadClass (http://localhost:8889/lab/
I spent most of the day yesterday trying to get a GTest CMake project to work in VS2022. Everything builds and compiles but test explorer won't show any tests. Hitting Run All causes it to sit in an infinite loop not progressing. I've produced a minimal repro here https://github.com/GingerbreadFred/GoogleTestRepro/. The CMakeLists for the project is below cmake_minimum_required(VERSION 3.5) project(HelloWorldTest) set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) include(FetchContent) FetchContent_Declare( googletest URL https://github.com/google/googletest/archive/f8d7d77c0693631
Is there a way to convert HEIC images to png/jpg using node js? I'm currently on a nest js project and I tried multiple packages and none of them worked! I tried heic-convert, sharp, and heic2any The only thing that worked for me is installing imageMagick on the machine and thats not an option for me.
Context After installing bcrypt, I received several warnings about deprecated packages, but the first one is especially troubling: $ npm install bcrypt npm WARN deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful. npm WARN deprecated [email protected]: This package is no longer supported. npm WARN deprecated [email protected]: Rimraf versions prior to v4 are no longer supported npm WARN deprecated [email protected]: Glob versions pr
Consider this example: #!/usr/bin/env perl my $vec0; # set the first bit of vec0 to false vec($vec0, 0, 1) = 0; print "vec0 is " . length($vec0) . " bytes long\n"; if ($vec0) { # what print "vec0 is True!\n"; } A vec used in evaluation seems to (almost) always be True - this is because a vec is really a string, and so $vec0 is a string containing "\0" which is not False according to Perl: only strings "" and "0" are False. (aside: this is False, despite being non-zero: vec($vec0, 5, 1) = 1; vec($vec0, 4, 1) = 1; because 0x30 is the ASCII code for 0) Fine: what is the "correct" way to check for
I am writing a function that generates a random set of numbers. I can print the numbers as separate ints, but I am trying to put the numbers into an array and return the array so I can assign it to another empty array in another function so I can manipulate the array. I looked everywhere, but I couldn't find something that can satisfy my criteria. My function: void generateRandomNumbers(int lower, int upper){ int n = 5; int random[n]; int tempArr = random[n]; srand((unsigned) time(NULL)); for (int i = 0; i < n; i++){ random[i] = lower + (rand() % upper); cout << random[i] << " "; } } This func
I am trying to connect my Flutter web application to Firebase Storage to retrieve images stored by a Raspberry Pi webcam, but compilation fails with the following errors: ../../AppData/Local/Pub/Cache/hosted/pub.dev/firebase_core-1.24.0/lib/src/firebase_app.dart:18:25: Error: Member not found: 'FirebaseAppPlatform.verifyExtends'. FirebaseAppPlatform.verifyExtends(_delegate); ^^^^^^^^^^^^^ ../../AppData/Local/Pub/Cache/hosted/pub.dev/cloud_firestore_web-2.8.10/lib/src/utils/web_utils.dart:71:13: Error: Method not found: 'FallThroughError'. throw FallThroughError(); ^^^^^^^^^^^^^^^^ ../../AppDat
I'm looking for a GraphQL query builder library that is well maintained, with a nice DX and an active community around it (or backed by an active company). I need to generate queries dynamically based on a queryTree constructed by user's input. For example: I want to convert the follow operations [ { operation: 'container', args: {} }, { operation: 'from', args: { address: 'alpine:3.16.2' } } ] Into an actual GraphQL query like this: { container($address: String) { from (address: $address) } } Right now, I have a custom homemade solution but I'm looking for a better solution that is well maint
I'm using MaterialAutoCompleteTextView to display a dropdown list for selecting a theme. xml: <com.google.android.material.textfield.TextInputLayout android:id="@+id/chooseThemeContainer" style="@style/ChooseThemeInputLayout" android:layout_width="0dp" android:layout_height="wrap_content" android:layout_marginTop="8dp" android:layout_marginEnd="16dp" android:hint="@string/theme" android:textColorHint="@color/textLink" app:endIconTint="@color/textLink" app:layout_constraintEnd_toStartOf="@id/saveName" app:layout_constraintStart_toStartOf="@id/avatar" app:layout_constraintTop_toBottomOf="@id/ava
I have an issue with ultrasonic Sensor using my Raspberry Pi 2W. The input pin is always zero. I tried to change pins, but nothing changed. Here it is my sample code: import RPi.GPIO as gp import time import signal import sys def handler(signum, frame): print('\nPulizia gpio') time.sleep(0.5) gp.cleanup() sys.exit() inputPin = 12 # connect to echo via 1K resistor outputPin = 13 # connect to trig led = 7 gp.setmode(gp.BOARD) gp.setup(outputPin,gp.OUT) gp.setup(inputPin,gp.IN) gp.setup(led,gp.OUT) signal.signal(signal.SIGTSTP, handler) print(outputPin) print(inputPin) l = gp.output(led,True) o =
I'm trying to learn how to embed Python into a Rust application. For learning purposes, I want to create a Rust script/app that runs a forever loop. This loop sleeps for a set interval, and upon waking, it uses the Python requests library to fetch the current time from an internet time server. While this isn't a practical application, my goal is to understand how to call external Python libraries from Rust. My ultimate goal is to see if I can integrate a Python BACnet stack into a Rust application. My Setup main.rs use pyo3::prelude::*; use pyo3::types::IntoPyDict; use std::thread; use std::ti
I'm trying to learn Kotlin in Android Studio 2023.3.1 by working my way through the examples in Android Programming, The Big Nerd Ranch, 5th Edition. The CriminalIntent example contains the class CrimeDetailFragment.kt, shown below: package com.bignerdranch.android.criminalintent import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup import androidx.core.widget.doOnTextChanged import androidx.fragment.app.Fragment import com.bignerdranch.android.criminalintent.databinding.FragmentCrimeDetailBinding import java.util.UUID class CrimeDet
We are about to start a new major project in my department and we really would like to manage changes to our mongodb (e.g. creation of indixes, data migration, etc.) in an orderly way. I have looked into FlyWay and it seems to cover most of our needs in this area. However, I have not been able to setup FlyWay in combination with Quarkus and mongoDB, which both are set technologies since we have successfully used them together for several years now and have a lot of experience with that. What I really like about FlyWay is that we can define everything in JavaScript, using the full potential of
I am implementing Google login using Firebase for my web application. I've set up the OAuth consent screen in the Google Developer Console and added the following scopes: /auth/userinfo.email /auth/userinfo.profile openid In developer console, I can see that app is also verified. Please see screenshot Despite this, when users try to log in, they see the following error message: I have completed the initial setup as follows: Created a project in the Google Developer Console. Configured the OAuth consent screen with the necessary information. Added the three scopes mentioned above. Verified my d
I am unable to login to server using key authentication from my client Android app. I am able to login to server from my app using password authentication. I am able to login to server using key authentication from other clients on my network. protected String sshConnect() { String stdoutString = null; String alias = "KEYPAIRTEST"; KeyStore keyStore = KeyStore.getInstance("AndroidKeyStore"); keyStore.load(null); KeyStore.Entry entry = keyStore.getEntry(alias, null); PrivateKey privateKey = ((KeyStore.PrivateKeyEntry) entry).getPrivateKey(); PublicKey publicKey = keyStore.getCertificate(alias).
I am trying to generate arrays of varying length within a polars dataframe (i.e., a list column). For each cluster_id I would like to generate a series of 0s and 1s of length trials, which varies by cluster_id: import numpy as np import polars as pl from polars import col CLUSTERS = 200 MEAN_TRIALS = 20 MU = 0.5 SIGMA = 0.1 df_cluster = pl.DataFrame({'cluster_id': range(1, CLUSTERS+1)}) df_cluster = df_cluster.with_columns( mu = stats.truncnorm(a=0, b=1, loc=MU, scale=SIGMA).rvs(size=CLUSTERS), trials = np.random.poisson(lam=MEAN_TRIALS, size=CLUSTERS) ) I can use np.random.binomial() to gener
I am trying to add a custom row to order table in WooCommerce order page. But the code I have tried is not working. I tried using this woocommerce_admin_order_item_values() hook but it's not working. This is my code add_action('woocommerce_admin_order_item_values', 'replace_quantity_td_content', 99999, 3); function replace_quantity_td_content($product, $item, $item_id) { $quantity = $item->get_quantity(); $meta_data_array = $item->get_meta_data(); foreach ($meta_data_array as $meta) { $meta_value_array = $meta->value; if (isset($meta_value_array['tabNumber'])) { $tab_number = $meta_value_array
I'm trying to run a Mask R-CNN model with aerial imagery. To optimise this, I run everything with CUDA. But this creates a few errors. Here is my code: # Python import torch import torchvision from torchvision.models.detection import MaskRCNN import gc import torch.nn as nn from torchvision.models.detection.rpn import AnchorGenerator from torch.cuda.amp import GradScaler os.environ["CUDA_LAUNCH_BLOCKING"] = "1" gc.collect() torch.cuda.empty_cache() # Define the model resnet_net = torchvision.models.resnet18(weights=torchvision.models.ResNet18_Weights.DEFAULT) modules = list(resnet_net.children
I recently read on Real Python that using doctest is risky because it's based on exec() and therefore you are open to the execution of arbitrary code. The article states that you must be very aware of the contents of the test code in the docstrings. I'm a bit confused about this. Can't tests using unittest or pytest also have malicious code? What makes doctest more susceptible to security issues compared to other testing frameworks?
I have ran the C example provided in massif docs https://valgrind.org/docs/manual/ms-manual.html and it works as expected. However it shows??? for this simple c++ program. main.cc #include <string> int main() { std::string s{"hi i am a long string do not optimize me"}; } command line g++ -g -std=c++17 -o main main.cc valgrind --tool=massif ./main relevant massif output #----------- snapshot=3 #----------- time=2348873 mem_heap_B=72745 mem_heap_extra_B=23 mem_stacks_B=0 heap_tree=peak n2: 72745 (heap allocation functions) malloc/new/new[], --alloc-fns, etc. n1: 72704 0x4909A69: ??? (in /usr/lib
I'd like to add FAQPage json+ld to my website, but i found that the definition for this tag on google examples and schema.org documentation are different: https://developers.google.com/search/docs/appearance/structured-data/faqpage <script type="application/ld+json"> { "@context": "https://schema.org", "@type": "FAQPage", "mainEntity": [{ "@type": "Question", "name": "How to find an apprenticeship?", "acceptedAnswer": { "@type": "Answer", "text": "<p>We provide an official service to search through available apprenticeships. To get started, create an account here, specify the desired region, a
I am reaching out for technical assistance regarding our implementation of Google reCAPTCHA v3 Enterprise Edition. We have successfully created keys for our sites and are now looking to set up monitoring for daily API usage. We aim to track and monitor the daily request volumes to the reCAPTCHA service and set up alerts based on certain usage thresholds. Could you provide detailed information on how we can configure these aspects within our management console? Additionally, we would be interested in knowing if there is a specific dashboard or tool that allows us to manage these settings effici
I've tried to solve the LeetCode 70.Climbing Stairs. I know, it is same as fibonaci, but I've wanted to try a different solution for this. Here is the problem: You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? Example 1: Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1 step + 1 step 2 steps Example 2: Input: n = 3 Output: 3 Explanation: There are three ways to climb to the top. 1 step + 1 step + 1 step 1 step + 2 steps 2 steps + 1 step I used static becau
I have a PDF file containing tabular data spread across multiple pages. The first page of the PDF contains the column headers, while subsequent pages contain rows of data corresponding to those headers. When I use Python and tabula to extract the tables, I end up with a list of DataFrames, one for each page. My goal is to combine these DataFrames into a single DataFrame, treating the entire PDF as a single table. However, when I attempt to concatenate the DataFrames using pd.concat, I encounter issues where rows with NaN values are introduced, likely due to the differing column structures betw
Given a Vec<i32> I'd like to create a Vec<i32> containing all first i32s with a predicate returning true dropping all elements once the first element not satisfying the predicate is encountered. The simple filter implementation as fn first_predicate<F>(vec: Vec<i32>, f: F) -> Vec<i32> where F: FnMut(&i32) -> bool, { vec.into_iter().filter(f).collect() //return all elements satisfying the predicate, not the first group } as it returns all the elements satisfying the predicate. Is there a way to stop iteration once an element not satisfying the predicate is encountered?
If I have two different Vec<f64> of the same length, how can I "zip" them to get a Vec<[f64; 2]> instead of a Vec<(f64, f64)>? Here Is what I have so far: let vec1: Vec<f64> = vec![1.,2.,3.,4.,5.,6.]; let vec2: Vec<f64> = vec![6.,5.,4.,3.,2.,1.]; let zipped_vec: Vec<(&f64, &f64)> = vec1.iter().zip(vec2.iter()).collect::<Vec<_>>(); println!("{:?}", zipped_vec); // Output: [(1.0, 6.0), (2.0, 5.0), (3.0, 4.0), (4.0, 3.0), (5.0, 2.0), (6.0, 1.0)] // If all the data is in a single Vec<f64> I found a way to do it with "chunks_exact" let data = vec![1.,12.,2.,23.,3.,38.,4.,44.,5.,59.,6.,71.]; let gra
I have a function I call from R using Rcpp. I pass an argument, which is a const unsigned integer, to this function. The integer is used to scale a matrix consisting of random draws. MWE: Rcpp::cppFunction(' auto testfun(const arma::uword n = 10) { arma::dmat W = floor(arma::randu(35, 35, arma::distr_param(0, 2))); return W / n; } ', depends = "RcppArmadillo", plugins = "cpp17") This MWE makes my R crash. My actual code, on the other hand, works but returns garbage. What am I missing here? It appears that the auto declaration is causing the problems. I don't understand why.
Is there any way to get a tour of the White House (other than the POTUS inviting you), if your embassy does not organize any tours into the White House? Indian Embassy does not organize White House tours. I have heard you can accompany a US citizen if they are going, is that true ?
I am trying to fit a set of data in MATLAB with a custom function, which is no more than a Gaussian distribution with an additional x^d term. However, an error is encountered. Despite many efforts, I can't solve this problem. At the very beginning, I fit the following data, "data_x": 0 0.0500000000000000 0.100000000000000 0.150000000000000 0.200000000000000 0.250000000000000 0.300000000000000 0.350000000000000 0.400000000000000 0.450000000000000 0.500000000000000 0.550000000000000 0.600000000000000 0.650000000000000 0.700000000000000 0.750000000000000 0.800000000000000 0.850000000000000 0.9000