Posts

Showing posts from March, 2021

How to export multiple parameters from JSON to AWS SSM Parameter store

I am trying to copy SSM Parameters from one account to a different account and different region. I have 100's of parameters which I have imported using get-parameters-by-path. Now I want to export them to a and different region in a different account. When I add one after the other using : aws ssm put-parameter --cli-input-json file:///../parameters.json --region us-east-2 With parameters.json as: { "Name": "/env/../../..", "Type": "String", "Value": "/env/../../.." } it works without any issues, but I would like to know how I could export more than one at a time, I want them all to be loaded at once. Here is the sample paramaters.json which does not work. It doesn't throw any error but prints the same again. { "Name": "/env/../../..", "Type": "String", "Value": "/env/../../.." }, { "Nam...

How to balance and format String in java swing

Image
I know that there are many previous explanations, but similar to my problem I did not find ! Simply i have a code to drow a bill info using graphics2d ! My Full Code IS : public PageFormat getPageFormat(PrinterJob pj) { PageFormat pf = pj.defaultPage(); Paper paper = pf.getPaper(); double middleHeight = 99999; double headerHeight = 2.0; double footerHeight = 2.0; double width = convert_CM_To_PPI(8); //printer know only point per inch.default value is 72ppi double height = convert_CM_To_PPI(headerHeight + middleHeight + footerHeight); paper.setSize(width, height); paper.setImageableArea( 0, 2, width, height - convert_CM_To_PPI(1) ); //define boarder size after that print area width is about 180 points pf.setOrientation(PageFormat.PORTRAIT); //select orientation portrait or landscape but for this time portrait pf.setPaper(paper); return pf; } protected static d...

Is there a non-UART python transfer protocol layer to work with 512byte packets or less for BLE?

I'm on a team working on a non-profit, open-source project and we're creating a web-based configuration tool to control a piece of custom hardware on a Raspberry Pi, using the "Web Bluetooth API" . Packets over the BLE connection are limited to 512 bytes, so we seem to need a transfer protocol layer to assist communication with the Pi. We do not want a UART implementation, as we want transmission guarantees. Does such a transfer protocol layer exist, ideally implemented in Python? Or is there a simple way to generate a python implementation of a transfer protocol layer, that would work with 512byte packages? from Recent Questions - Stack Overflow https://ift.tt/39tjhEE https://ift.tt/eA8V8J

SolrCloud Time Routed Alias Architecture

This is a broader question around building the architecture for SolrCloud Time Routed Alias application. I'm using SolrCloud to ingest time-series data on a regular basis and have SolrCloud running in a Kubernetes Cluster. A Solr node gets attached every time we add a new Pod to our cluster. Since I'm trying to use Time Routed Aliases, it creates a new collection with preemptive calculation and currently places them across the Solr pods based on how much free-disk space is available in a pod, so new pods will get selected for shard placements whenever a new pod is introduced. However, I would like to design a solution where we can avoid hot-spotting Solr nodes by distributing the shards across older pods and yet still maintaining SolrCloud architecture that grows in size as data is ingested every day. I'm unsure what the best configuration would be at a collection/cluster level based on the available policies in https://solr.apache.org/guide/8_6/solrcloud-autoscaling-po...

StandardRestrictedSSLContextService - TrustStore Password as a Parameter

Im trying to get Nifi StandardRestrictedSSLContextService working if I manually enter the values, I am able to enable the service. TrustStore Filename: /usr/local/openjdk-8/lib/security/cacerts TrustStore Password: ImBHi7TI9C_XGay3lyRw..... TrustStore Type: JKS Once I try to move the password into a Parameter I get an Invalid Password/Type message. from Recent Questions - Stack Overflow https://ift.tt/2O7MQ7b https://ift.tt/eA8V8J

Google Reverse Geocoding API doesn't work on mobile internet

So i was able to get Google Geolocations and Geocoder API to work via desktop and on my phone when its connected to wifi, but when I disconnect from the wifi, geocoder doesn't display the results. just to explain a bit more about what my code does, i use the geolocation APi to get lat/long values and then i use that output that is stored in a variable and i use it to get the city information using the reverse geocoding google API. my code below is as follows jQuery(function() { var GOOGLE_API_KEY = 'MY_KEY_HERE'; var outlatlong = null; jQuery.ajax({ url: 'https://www.googleapis.com/geolocation/v1/geolocate?key='+GOOGLE_API_KEY, data: JSON.stringify({ "considerIp": "true" }), type: 'POST', contentType: 'application/json', success: function(data) { outlatlong = [data.location.lat, data.location.lng].join(', '); if(da...

exitBeforeEnter is not working as intended - Trouble w/ Page Transitions

I'm trying to create a smooth page transition using a combination of react-router-dom and framer-motion, and I'm trying to have my pages fade out on exit and fade in on enter. But exitBeforeEnter is not working how it's supposed to. The page will not fade out on exit but the next page will fade in every time. Below is my code, and I'll attach one of the page files (all of the pages have pretty much the same code). Index.js import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import { BrowserRouter as Router } from "react-router-dom"; ReactDOM.render(<Router><App /></Router>, document.getElementById('root')); App.js import React from 'react'; import About from "./pages/About.js" import Home from "./pages/Home.js" import Projects from "./pages/Projects.js" import { AnimatePresence } from 'framer-motion' import { BrowserRouter as S...

Python web scraping: websites from google search result

A newbie to Python here. I want to extract info from multiple websites (e.g. 100+) from a google search page. I just want to extract the key info, e.g. those with <h1> , <h2> or <b> or <li> HTML tags etc. But I don't want to extract the entire paragraph <p> . I know how to gather a list of website URLs from that google search; and I know how to web scrape individual website after looking at the page's HTML. I use the Request and BeautifulSoup for these tasks. However, I want to know how can I extract key info from all these (100+ !) websites without having to look at their html one by one. Is there a way to automatically find out the HTML tags the website used to emphasize key messages? e.g. some websites may use <h1> , while some may use <b> , or something else... All I can think of is to come up with a list of possible "emphasis-typed" HTML tags and then just use BeautifulSoup.find_all() to do a wide-scale extraction....

I got no output using echo $SLURM_NTASKS

I create this batch file myfirst_slurm_job.sh that contain the following code: #!/bin/bash #SBATCH --output="slurm1.txt" cd $HOME/.. echo $PWD echo $SLURMD_NODENAME echo $SLURM_NTASKS and then I run this command line: sbatch myfirst_slurm_job.sh note: it's my first post from Recent Questions - Stack Overflow https://ift.tt/3rDqN5W https://ift.tt/eA8V8J

How to merge data frame with different length in R by group?

data frame A1 Type Worker A SHARON B RUN C JACK D NICK K EMILY data frame A2 Type Rate A 0.39 A 0.78 A 0.22 A -1.09 ... K 0.56 K 0.73 K 0.88 K 0.04 K 0.69 This is my coding. K = merge(A1, A2,all.x=T) Type Rate A 0.39 B 0.78 C 0.22 D -1.09 K -1.28 A 0.93 B 0.39 ... A 0.56 B 0.73 C 0.88 D 0.04 K 0.69 But my desired output is sorted by worker and type then show the corresponding value. Any ideas on different length of data frame merge? from Recent Questions - Stack Overflow https://ift.tt/3czw4Hp https://ift.tt/eA8V8J

Is there a way to specify that a template parameter type must be derived from a particular base class?

Is there a way to specify that a template parameter type must be derived from a particular base class? This is how I wish it would work: class foo { a_foo_function(); } //....... //....... //....... template < class F : public foo > // <<<=== my deceptively creative syntax class bar { F * pfd; bar(F* food){ pfd = food; } void f() const { pfd->a_foo_function(); } //guaranteed to work in my book } //....... class foo just_a_plain_foo; //....... class foodish : public foo {} a_foodish; //....... class foolish : public not_foo {} a_foolish; //....... typedef bar<foodish> barf; barf b(a_foodish); //ok barf c(a_foolish); //NOT ok barf d(just_a_plain_foo); //NOT ok ... pdf pointer is to a derived Ain't that beautiful? But my beautiful syntax won't compile, though; and I can't seem to find how to do this. Note that using the base class as template parameter won't work for me, as I may have distinct and ...

Is a mutex capable of performing this

I have a situation where I have multiple threads accessing the clipboard and performing an action with some sleeps. Basically I don't want to copy the wrong thing to the clipboard and perform something in an incorrect fashion. Currently, I have an idea of using a mutex to lock a std::string variable and store the required data in it, then to the clipboard. After I finish the action, I unlock it. Then the other thread accesses the variable, then clipboard, and action. As I have never used a mutex, my question is - will it work by just doing the above? I'm using the following library to manage the clipboard: https://github.com/dacap/clip from Recent Questions - Stack Overflow https://ift.tt/31va4aq https://ift.tt/eA8V8J

Python Pandas Dataframe - Nothing being returned from my function

I have two dataframes: energy_calculated (the time_stamp columns were just formatted using 3 decimal values to make sure there weren't any hidden values disrupting the simple math): fl_key min_time_stamp max_time_stamp energy 0 10051 1614556800019.000 1614556807979.000 0.352 1 10051 1614556808019.000 1614556815979.000 0.275 2 10051 1614556816019.000 1614556823979.000 0.429 3 10051 1614556824019.000 1614556831979.000 0.406 4 10051 1614556832019.000 1614556839979.000 0.444 5 10051 1614556840019.000 1614556847979.000 0.348 6 10051 1614556848019.000 1614556855979.000 0.381 7 10051 1614556856019.000 1614556863979.000 0.456 8 10051 1614556864019.000 1614556871979.000 0.362 9 10051 1614556872019.000 1614556879979.000 0.465 10 10051 1614556880019.000 1614556887979.000 0.577 11 10051 1614556888019.000 1614556895979.000 0.305 12 10051 1614556896019.000 1614556903979.000 0.347 13 10051 1614556904019.000 1614556911979...

How to filter the Chrome console so you only see messages/errors from one content script/Chrome Extension?

I'm running a content script on a page for an extension I'm building. I simply want to see only errors and messages from that one extension in the Google Chrome console. I need to be able to make this happen without: without blocking messages/errors from other extensions [like this post explains] , since I have a ton of extensions and I might need to know about their errors in future and don't want to forget to unhide their messages/errors without installing a fresh install of Chrome on a VM, using Chrome incognito, or something similar What I've tried filtering in the console using "chrome-extension://myChromeExtensionIDHere" showed my extension's errors, but that didn't show any console.log messages I was sending in my script in my extension. url:chrome-extension://myChromeExtensionIDHere showed my extension's console.log messages, but didn't show the errors clicking my "content_script.js" on the side, but that didn...

How to create a "hard-coded" small SQL join table in code?

Context: I do not have the ability to create/update/edit the tables in question. I have two tables that I am trying to join via a manual SQL query in Tableau. There exists a column in each table I can use to link the tables together, but I need a third table (that does not exist) to link them. There are only 6 values I'd like to link, I was hoping there is some way to declare an "in-memory" table or similar in SQL to join these tables. For example - I'd like to join these two tables together: Table 1 name value place 1 14 place 2 10 place 3 100 Table 2 identifier property superstore awesome hospital bad port great Can I somehow hard-code the following "table" into SQL code to join them? hard coded table name identifier place 1 hospital place 2 port place 3 superstore Should yield the following: name identifier value property place 1 hospital 14 bad place 2 por...

An XPath expression in Java for getting xml elements

I want to get nodes from an api which contains xml elements. https://www.w3schools.com/xml/cd_catalog.xml Here is the link for the api. So my Java code is like this: package in.automationtesting.neh; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; import com.fasterxml.jackson.databind.ObjectMapper; public class Test1 { public st...

Should and Filter combination in ElasticSearch

I have this query which return the correct result GET /person/_search { "query": { "bool": { "should": [ { "fuzzy": { "nameDetails.name.nameValue.surname": { "value": "Pibba", "fuzziness": "AUTO" } } }, { "fuzzy": { "nameDetails.nameValue.firstName": { "value": "Fawsu", "fuzziness": "AUTO" } } } ] } } } and the result is below: { "took" : 1, "timed_out" : false, "_shards" : { "total" : 1, "successful" : 1, "skipped" : 0, "failed" : 0 }, "hits" : { "total" : { "value" : 1, "relation" : ...

How does the serverless datadog forwarder encrypt/encode their logs?

I am having trouble figuring out how the datadog forward encodes/encrypts its messages from the datadog forwarder. We are utilizing the forwarder on datadog using the following documentation: https://docs.datadoghq.com/serverless/forwarder/ . On that page there, Datadog has an option to send the same event to another lambda that it invokes via the AdditionalTargetLambdaARNs flag. We are doing this and having the other lambda invoke but the event input that we are getting is long string that looks like it is base64 encoded but when I put it into a base64 decoder, I get gibberish back. I was wondering if anyone knew how datadog is compressing/encoding/encrypting their data/logs that they send so that I can read the logs in my lambda and be able to preform actions off of the data being forwarded? I have been searching google and the datadog site for documentation on this but I can't find any. from Recent Questions - Stack Overflow https://ift.tt/3sHEKkM https://ift.tt/eA8V8J

Phaser 3 collider fires endless

I try to make a bouncing bullet for a game that should disappear after bouncing 3 times. I thought it's simple, I gave my bullet a variable with the value of 3 and decreased it in my bullet-platform collider by one. After it didn't work and checked the variable with console.log(), I found out that the variable gets decreased continuously. I tested my other colliders and found out that only the bullet-platform collider do that, while the player-platform, enemy-platform, bullet-player and bullet-enemy collider don't. In addition my function for destroying bullets, when they hit a platform, oddly work fine. My bullets only get destroyed when hitting a platform. Does anyone have an Idea how to fix that? Edit: I made a Github repository of my game for better insight. (At least I hope I did, I haven't used Github before.) https://github.com/Kiroho/Game Edit2: After testing around, I found out that it must have something to do with how I use my ammoGroup class. I found ou...

confusion_matrix() | ValueError: Classification metrics can't handle a mix of multiclass and multiclass-multioutput targets

Definitely has been asked before, but I've not been successful at analysing other posts' solutions for my own instance of this problem. I have many classification models I want to compare using confusion_matrix() matrix = confusion_matrix(y_test, y_pred) # ERROR >>> y_pred [[2 2 2 ... 2 2 2] [2 2 2 ... 2 2 2] [2 2 2 ... 2 2 2] ... [3 3 2 ... 3 2 3] [2 2 2 ... 2 2 2] [3 3 3 ... 3 3 3]] >>> y_pred.shape (500, 256) >>> y_test [1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

Use fillna() and lambda function in Pandas to replace NaN values

Image
I'm trying to write fillna() or a lambda function in Pandas that checks if 'user_score' column is a NaN and if so, uses column's data from another DataFrame. I tried two options: games_data['user_score'].fillna( genre_score[games_data['genre']]['user_score'] if np.isnan(games_data['user_score']) else games_data['user_score'], inplace = True ) # but here is 'ValueError: The truth value of a Series is ambiguous' and games_data['user_score'] = games_data.apply( lambda row: genre_score[row['genre']]['user_score'] if np.isnan(row['user_score']) else row['user_score'], axis=1 ) # but here is 'KeyError' with another column from games_data My dataframes: games_data genre_score I will be glad for any help! from Recent Questions - Stack Overflow https://ift.tt/3w9t9wQ https://ift.tt/3u8TSYN

How to configure Hangfire with Autofac in a dotnet core console app

I'm trying to port a working Hangfire setup embedded in a Kestrel webserver to a console app. I've modified the web app so it still provides the Hangfire dashboard but doesn't start its own Hangfire server. The code I must port uses Autofac. I've added the Hangfire.Autofac package to the console app and have already performed all the steps detailed in the answer to Hangfire Autofac .net core 3.1 When I create a job (using the web app) the console app Hangfire server tries to execute the job but I get this failure message: The requested service 'AED.ServicesLayer.JobProcessing.ProcessManager' has not been registered. Investigating this we examine the setup of Autofac in the console app. This is how I set up my container. IConfiguration config = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .Build(); var containerBuilder = new Autofac.ContainerBuilder(); containerBuilder.RegisterInstance(Log.Lo...

curl https time_appconnect is zero

my company has a web project, named projectA , is deployed in a cloud server(similar as AWS). projectA is in tomcat. we have ssl certificate, e.g. mycompany.com , users are able to access projectA by typing https://mycompany.com/projectA which will be redirected to https://mycompany.com/projectA/loginPage.action page if user has not login(only type https://mycompany.com will show 404 page), the browsers shows this website is secured. however, either curl -w "TCP handshake:%{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://mycompany.com or curl -w "TCP handshake:%{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://mycompany.com/projectA , or curl -w "TCP handshake:%{time_connect}, SSL handshake: %{time_appconnect}\n" -so /dev/null https://mycompany.com/projectA/loginPage.action their time_appconnect are zero, why? time_connect has value. i run curl in a cloud server whose CentOS is 7.9.2009(Core),...

Making Regex combination of multiple chars and numbers combined

How to write a regex that will combine numbers and chars in a string in any order? For example, If I want to read some kind of invoice number, I have example like this: example 1: 32ah3af example 2: 32ahPP-A2ah3af example 3: 3A63af-3HHx3B-APe5y5-9OPiis example 4: 3A63af 3HHx3B APe5y5 9OPiis So each 'block' have length between 3 and 7 chars (letters or numbers) that can be in any order (letters can be lowercase or uppercase). Each. 'block' can start with letter or with number. It can have one "block" or max 4 blocks that are separated with ' ' or - . I know that I can make separators like: \s or \- , but I have no idea how to make these kind of blocks that have (or do not have) separator. I tried with something like this: ([0-9]?[A-z]?){3,7} But it does not work from Recent Questions - Stack Overflow https://ift.tt/3cyQtwv https://ift.tt/eA8V8J

Bootstrap 5 floating label for a textarea overlaps with input on scroll

Image
Looking at the documentation for a floating label of a textarea, https://getbootstrap.com/docs/5.0/forms/floating-labels/ , it appears that the label overlaps with the input if the content is scrollable: Is there a way to prevent this and make the scrollable area below the label? from Recent Questions - Stack Overflow https://ift.tt/2P91Zpv https://ift.tt/2Pg6kac

automatically updates the table without refreshing/reloading the page

I would like to ask if how do I get the latest update of my data that is displayed in my table without reloading or refreshing it. The insertion of the data is already good, it already inserts however I see that the page is still reloading. I am still new to ajax and sweetalert using the client-side. addingUser.php $(document).ready(function(){ $('#addStudent').click(function(e){ e.preventDefault(); Swal.fire({ title: "Are you sure?", text: "New student will be added added!", icon: "success", showCancelButton: true, allowEscapeKey : false, allowOutsideClick: false }).then((result) => { if (result.isConfirmed) { var valid = this.form.checkValidity(); if(valid){ var studentNumberId = $('#studentNumberId').val(); var studentFullName = $('#studentFullName...

The weighted means of group is not equal to the total mean in pandas groupby

I have a strange problem with calculating the weighted mean of a pandas dataframe. I want to do the following steps: (1) calculate the weighted mean of all the data (2) calculate the weighted mean of each group of data The issue is when I do step 2, then the mean of groups means (weighted by the number of members in each group) is not the same as the weighted mean of all the data (step 1). Mathematically it should be ( here ). I even thought maybe the issue is the dtype, so I set everything on float64 but the problem still exists. Below I provided a simple example that illustrates this problem: My dataframe has a data, a weight and group columns: data = np.array([ 0.20651903, 0.52607571, 0.60558061, 0.97468593, 0.10253621, 0.23869854, 0.82134792, 0.47035085, 0.19131938, 0.92288234 ]) weights = np.array([ 4.06071562, 8.82792146, 1.14019687, 2.7500913, 0.70261312, 6.27280216, 1.27908358, 7.80508994, 0.69771745, 4.15550846 ]) groups = np.array([1, 1, 2, 2, 2, 2, 3, 3,...

Python 3: Code is looking for directories that don't exist when it isn't supposed to

I have been working on the following code: #ZIPPYORACLE USB worm module. import os, random, stat #User chosen at random picked = 0 userchoice = random.choice (os.listdir ("/media/")) randomdir = random.choice (os.listdir ("/media/" + userchoice)) picked = "/media/" + userchoice + "/" + randomdir os.chdir (picked) os.chmod ("usb.txt", stat.S_IWRITE) with open ("usb.txt", "w") as file: print (picked) file.write ("Create a new text file!") It is supposed to upload a file to a random USB drive. The problem is it works only 10% of the time, but 90% of the time gives errors like these: NotADirectoryError: [Errno 20] Not a directory: '/media/asher/Ubuntu-MATE 20.10 amd64usb.txtusb.txtusb.txtusb.txt' I have no idea why this is happening, and have been debugging it for an hour now. Do any of you more experienced programmers know what's causing this issue? from Recent Questions - Stack Over...

Python plot two heat maps at once using squares divided in 2 halves

I am trying to generate a heatmap where each rectangle is split into two pieces and can be colored differently. Essentially, I have two 20x20 matrices that I want to be able to plot on one Heatmap, similar to what is done in this here except I want to divide into 2 rectangles rather than triangles. Any suggestions on how to do this? It's not obvious there's an easy way to do this but I was thinking of using a hacky solution where I use pcolormesh to draw a 40x40 grid and then somehow plot my points onto that. I'd like to be able to color the outside of single rectangle in a dark line and then use a thinner line to divide the rectangle in 2. from Recent Questions - Stack Overflow https://ift.tt/3sMuPut https://ift.tt/eA8V8J

Split the date and time in data frame itself

I am working on 15 minutes historical OHLC stocks data and calculating few technical indicators like stochastic, VWAP and RSI etc. Followed is my code, and I need help on splitting the date and time right in the data frame itself then I can save it to CSV file. import requests import pandas as pd import arrow import datetime window = 10 window20 = 20 window50 = 50 window100 = 100 window200 = 200 ema_time = 8 import numpy as np import csv def get_quote_data(symbol='GOOGL', data_range='10d', data_interval='60m'): res = requests.get('https://query1.finance.yahoo.com/v8/finance/chart/{symbol}?range={data_range}&interval={data_interval}'.format(**locals())) data = res.json() body = data['chart']['result'][0] dt = datetime.datetime dt = pd.Series(map(lambda x: arrow.get(x).to('US/Central').datetime.replace(tzinfo=None), body['timestamp']), name='Datetime') df = pd.DataFrame(body['in...

How to specify repc's output path in qmake?

in qmake I have REPC_SOURCE = rpc/SomeRPC.rep and it generates rep_SomeRPC_source.h in the root of the project. I would like to store it somewhere else to keep root as clean as possible. Documentation says repc creates the rep_SimpleSwitch_source.h header in the build directory that you specify . But how to specify build directory ? The only option I see is to change OUT_PWD , but documentation says Do not attempt to overwrite the value of this variable. from Recent Questions - Stack Overflow https://ift.tt/3m7qcbB https://ift.tt/eA8V8J

Java :: Generics :: Capture Wildcards

I have a couple of classes having identical methods, except with respect to certain parameter types: interface ICls<T> { void doSomething(String key, T value); Map<String, T> getSomething(); } class ClsA implements ICls<Boolean> { void doSomething(String key, boolean value) {} Map<String, boolean> getSomething() {} } class ClsB implements ICls<String> { void doSomething(String key, String value) {} Map<String, String> getSomething() {} } Now I'm trying to have a main class that stores a mixed list of these class objects and for each of these instances, passes info between its two methods: class Main { List<ICls<?>> list = List.of( new ClsA(), new ClsB() ); void run() { list.forEach(cls -> { Map<String, ?> data = cls.getSomething(); data.keySet().forEach(key -> cls.doSomething(key, map.get(key)); }); } The List<ICls<?...

Show an image based on date

I'm trying to show a check mark image based on date, the date format is March 28, 2021 for an event list For example: if the event date is on March 29, 2021 then it will show the following image (green checkbox) <img src="https://i.imgur.com/iw9fm7A.jpg"> but if today date was March 28, 2021, and the event has not happened yet then it will not show any images, just blank. Code: <table width="80%" border="1" cellspacing="0" cellpadding="0"> <tr> <td>Event Name</td> <td>Event Date</td> <td>Completed? </td> </tr> <tr> <td>E-Bike meet up at <strong>Los Angeles, Griffith Park</strong></td> <td>March 29, 2021</td> <td>Show Checkbox Here</td> </tr> <tr> <td>E-Bike meet up at <strong>Los Angeles, State Historic Park</strong></td> <td>Apri...

How to get result back as JSON in looped query?

I am looping and getting results from multiple tables, and forming a result. How do I get the result back? All I am doing right now is logging it. Also, when I use array_append, it is converting the json into string. This is the code I am running to get the data. do $$ DECLARE sampleproductId varchar; productIds text[] := array [ 'abc1', 'abc2' ]; tId varchar; DECLARE result jsonb; DECLARE resultS jsonb[]; begin FOREACH sampleproductId IN ARRAY productIds LOOP tId := (select id from product.product where uid = sampleproductId); result = (select row_to_json(row) from (select accountid as "accountid", tId as "productUID", sampleproductId as "sampleproductId" from product.account...

Thunk Fetch is Undefined When Called from React Component

I was playing around with a Thunk function called from a form submit, but had to stop because the fetch returns undefined inside the component and won't trigger .then(). I can't figure out why, I simplified the Thunk to its core, but still no luck. I have the same pattern with another form in the same app and it works smoothly. The backend answers correctly. // actions/users.actions.js export const login = (formData) => { return (dispatch) => { return fetch("http://localhost:3001/login", { method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify(formData) }).then(res => res.json()) } } // containers/LoginForm.js import React, { Component } from 'react' import { connect } from "react-redux"; import { Link } from 'react-router-dom' import { login } from '../actions/users.actions' class LoginForm extends Component { state = { use...

Button color is not changed.Android Studio

Every time when I want to change color of button through xml, color is not changed and stays in default color. When I change color through java code, color changes but totally to another color which i don't want. Now I am changing colors of buttons by changing default color in themes.xml file. I tried a lot of ways on Youtube , searched old answers on stackoverflow but could not solve the issue. How can I fix this problem in my Android Studio? from Recent Questions - Stack Overflow https://ift.tt/3dfJzLL https://ift.tt/eA8V8J

Uncaught ReferenceError: sapper is not defined, in main.js Svelte file

Image
I have done the following: installed node.js Svelte Sapper created client.js server.js This is my main.js: import App from './App.svelte'; const app = new App({ target: document.body, props: { name: 'Acme Limited' } }); export default app; client.js: import * as sapper from '@sapper/app'; sapper.start({ target: document.querySelector('#sapper') }); Top of App.svelte: <script> import { writable } from 'svelte/store'; import * as sapper from '@sapper/app'; My app was working until I added Sapper. I tried adding this line to main.js: import * as sapper from '@sapper/app'; The only code of mine that references is Sapper is in the index file: <!-- src/routes/index.svelte --> <svelte:head> <title>Welcome</title> </svelte:head> <h1>Hello, and welcome!</h1> <nav> <a href=".">Home</a> <a href=...

Save a Google Form as PDF on a Drive's folder using Google Scripts

Image
This is my first approach using Google Scripts so apologize if the question is too easy. All the steps are explained here: Hacking it: Generate PDFs from Google Forms . I took the following image from there: The code is posted on the link but I post it here anyways: function onSubmit(e) { // From https://medium.com/swlh/hacking-it-generate-pdfs-from-google-forms-3ca4fcc5a0aa const rg = e.range; const sh = rg.getSheet(); //Get all the form submitted data //Note: This data is dependent on the headers. If headers, are changed update these as well. const cName = e.namedValues['Client Name'][0]; const cEmail = e.namedValues['Client Email'][0]; const cAddress = e.namedValues['Client Address'][0]; const cMobile = e.namedValues['Client Mobile'][0]; const sendCopy = e.namedValues['Send client a copy?'][0]; const paymentType = e.namedValues['What is your agreed upon payment schedule?'][0]; const fixedCost = e.namedValue...

Google Sheets slicers don't work until I refresh the page on a large project

I have a very big project and have set up my project and slicers carefully following Google's documentation. I have 3 tabs with a chart on each tab and 4 slicers for each chart. The slicers will not respond to the slicers unless I refresh the page first. Is this normal behavior? I can only find two other posts related to this issue, and they are both unanswered. I can't share a dummy project because when I set up smaller projects the slicers work as expected. I know this question is not very specific, but does anyone have a suggestion on what would be a good way to handle this or even where I might be able to look in order to fix it? How can I make the page refresh automatically when it is open, for example on an on_open trigger in Google Apps Script? I don't want to spend too much time scrutinizing everything to see what is wrong if there could be a general fix. Thank you. from Recent Questions - Stack Overflow https://ift.tt/3tXmnZo https://ift.tt/eA8V8J

R web scraping function getPageNumber error

I am building a webscraper and trying to understand why my getPage Number Function does not work. The function worked last night and tonight I have been having an error getting the right output library(rvest) library(RCurl) library(XML) library(stringr) getPageNumber <- function(URL) { parsedDocument <- read_html(URL) results_per_page <- length(parsedDocument %>% html_nodes(".sr-list")) total_results <- parsedDocument %>% toString() %>% str_match(., 'num_results":"(.*?)"') %>% .[,2] %>% as.integer() pageNumber <- tryCatch(ceiling(total_results / results_per_page), error = function(e) {1}) return(pageNumber) } getPageNumber("https://academic.oup.com/dnaresearch/search-results?rg_IssuePublicationDate=01%2F01%2F2010%20TO%2012%2F31%2F2010&fl_SiteID=5275&page=") The output I am getting is NA, when it should be numeric number from R...

How to keep track of old versions of objects in .net core?

I was working on a project on ASP.NET Core where I had to keep track of edits to Contracts here is where I've come so far, Models - //Contract Model public class Contract { [Key] public int Id { get; set; } public string ContractId { get; set; } } //Contrat History Model public class ContratEditHistory { [Key] public int Id { get; set; } [DisplayName("Edited By")] public string EditorId { get; set; } [ForeignKey("EditorId")] public virtual ApplicationUser User { get; set; } public int ContratId { get; set; } [ForeignKey("ContractId")] public virtual Contract Contrat { get; set; } [StringLength(2, MinimumLength = 255)] public string ChangeReason { get; set; } [Required] [DataType(DataType.Date)] public DateTime DateEdited { get; set; } } This seems to work fine in logging who made chan...

how can insert multiple record using

I'm working on a small project Django Rest Framework , I already create add contact function as you can see in my create function. now I'm working on bulk import, but when I submit my data as a list not as a dict I get an error message : {"non_field_errors":["Invalid data. Expected a dictionary, but got list."]} this is my code to add a contact, class ContactView(ListModelMixin, viewsets.GenericViewSet): queryset = Contact.objects.all() serializer_class = ContactSerializer def create(self, request): serializeObject = ContactSerializer(data = request.data) if serializeObject.is_valid(): serializeObject.save() contactObject = Contact.objects.all() contactSerializer = ContactSerializer(contactObject, many=True) return Response(contactSerializer.data, status = status.HTTP_201_CREATED) return Response(serializeObject.errors, status.HTTP_400_BAD_REQUEST) Now i would like to ...

How to get the length of every column in a kdb database?

We've seen issues where a kdb database is corrupted and are looking for a way to implement a check that every kdb column is the same length in a particular table. Any recommendation on how to do this? i.e., would like to get a return value of each column in a table and it's length. These tables have upwards of 200 columns. Any way to go about this efficiently? Any help is appreciated. Thank you. from Recent Questions - Stack Overflow https://ift.tt/3rzT51t https://ift.tt/eA8V8J

awk pattern matching one file to another then save the difference in new file

$ cat File1 781789 989778 898989 $ cat File2 AA^ABB^ACC^A781789^B781782^AEE^AFF^A781789^B781782AA^ABB^ACC^A7817891^B7817821^AEE^AFF^A7817891^B781782AA^ABB^ACC^A781789^B898989^AEE^AFF^A781789^B898989^B898923 Field Separator: "^A" or "\x01" Record Separator: "^B" or "\x02" I would like to create a resultant file "File3" where records from "File1" DOES NOT match any of the records for Column number 4 and 7 in "File2". If the record matches then DO NOT consider. Expected output: $ cat File3 AA^ABB^ACC^A7817891^B7817821^AEE^AFF^A7817891^B781782 Tried with the below awk code, where I am able to parse "File2" with field separators, but not able to match records from "File1" to "File2". awk 'BEGIN { FS="\x01"} NR==FNR{A[$4]~/$0/;next}{print A[$0]} File1 File2 > File3' awk 'BEGIN { FS="\x01"} NR==FNR{A[$7]~/$0/;next}{print A[$0]} File1 File2 > File...

How can I plot several series in groups in Julia?

Image
I am trying to plot a large number of line series in Julia, and I want to use two colors to differentiate between two groups. With the code below, which uses a small dataset, I get the following: using Plots toy = rand(10, 5) color = rand(0:1, 5) full = vcat(toy, color') plot(full, label = color) What I am trying to do is to have only two colours, corresponding to the value in "color" {0, 1}. How can I do that? PS: I have seen a similar question for matplotlib: How do I plot multiple time series grouped by different colours? from Recent Questions - Stack Overflow https://ift.tt/3w9SIxZ https://ift.tt/3tXmnIS

How to transfer data from multiple websites to Excel with MSXML2.XMLHTTP

I am trying to transfer data from multiple Websites to Excel. It is meant that the homepage creates a query page after data input. In main-site: http://www.zvg-portal.de/index.php?button=Termine%20suchen with MSXML2.XMLHTTP I choose for example "Berlin" in dropdown LAND , it changes to a query-site: http://www.zvg-portal.de/index.php?button=Suchen and there I try to access this content: (HTML part:) <td valign="top" align="left">Objekt/Lage</td> <td colspan="2" valign="center" align="left"> <b> Eigentumswohnung (3 bis 4 Zimmer) <!--Lage---> : </b> Schützenstraße 41, 10117 Berlin, Mitte </td> with my code: Sub GetDataInformation() Dim xml As Object Dim html As Object Dim elements As Object Set xml = CreateObject("MSXML2.XMLHTTP") Set html = CreateObject("htmlFile") With xml .Open "POST", "http://www.zvg-portal.de/index...

MongoDB async save parallel desync

I'm using mongoose to save an communicate with my mongo database. The question I have is: what happens if I load a document from a database, make changes to it, then asynchronously load the same document in another instance and change it there too before the first change has been saved? For example i might have a user with email and a name. In this case the first operation would change the name and the second would change the email. Will the name not be changed in the end as a result of this occurence? Will the first operation be saved to the database and then be erased by the second or how does it work? And if it turns out to be a problem how does one manage it? I know the chance of this occurence is very slime but it's not non-existent right? What's the best practice here? from Recent Questions - Stack Overflow https://ift.tt/3u1CNjh https://ift.tt/eA8V8J

Combining PiHole stats from Prometheus in Grafana

I have two PiHole instances, and I am trying to display their stats in a single Grafana display. Prometheus is being used to store the PiHole data. I have a Prometheus metric called "pihole_top_ads" that I can successfully call from Grafana, and display each domain and count returned in a bar graph format for each PiHole instance. I can combine two of them using the 'Mixed' option in Grafana, but this does not merge the two results, it only lists the first set then the second set. Duplicate domains are not combined, which is what I'm trying to achieve. What I get: Domain "A - as seen by PiHole 1" count Domain "B - as seen by PiHole 1" count Domain "C - as seen by PiHole 1" count Domain "D - as seen by PiHole 1" count Domain "B - as seen by PiHole 2" count Domain "D - as seen by PiHole 2" count Domain "E - as seen by PiHole 2" count Domain "F - as seen by PiHole 2...

Discord Python Reaction Role

I want that my bot add the role "User" to a user who react with a heart. But it doesn't work. My code: @client.event async def on_reaction_add(reaction, user): if reaction.emoji == "❤️": user = discord.utils.get(user.server.roles, name="User") await user.add_roles(user) I hope you can help me :) from Recent Questions - Stack Overflow https://ift.tt/31vc8zj https://ift.tt/eA8V8J

Laravel streaming platform

I am currently working on a streaming platform especially music. The API with Laravel and the front with REACT.JS. My question is how I can set up a streaming server with Laravel or if someone has ever had to work on something similar he could help me with some leads. Thank you from Recent Questions - Stack Overflow https://ift.tt/2O0aNgD https://ift.tt/eA8V8J

GROUP BY and get the columns values into single row column

i was thinking if possible to get all the values of using GROUP BY room. example i have a tables named subject , room and classroom table subject subject_id | subject_name ------------------- 1 | math 2 | science 3 | english table room room_id | room_name ------------------- 1 | sunflower 2 | cornflower 3 | redflower table classroom id | room_id | subject_id ------------------- 1 | 1 | 1 2 | 1 | 2 3 | 1 | 3 now the query. not sure if the query im used was correct or enough querying.. but the outputed query show expecting not that SELECT * FROM classroom LEFT JOIN subject ON classroom.subject_id = subject.subject_id LEFT JOIN room ON classroom.room_id = room.room_id GROUP BY room_name now the output i want to expecting like this classroom room_name | subject_name ------------------------ sunflower | math | science | english ...