on-internet

JsonUnwrapped to deserialize GET request parameters

I have the following: @RestController public class MyController { @PostMapping MyDto test(@RequestBody MyDto myDto) { return myDto; } @GetMapping MyDto test2(MyDto myDto) { return myDto; } @Data static class MyDto { private String a; @JsonUnwrapped private MySecondDto secondDto; @Data static class MySecondDto { private String b; } } } However: GET http://localhost:8080?a=a&b=b returns { "a": "a" } while POST http://localhost:8080 { "a": "a", "b": "b" } returns { "a": "a", "b": "b" } so it looks like @JsonUnwrapped and GET mapped Pojos don't work together as expexted. Any hint on how to use com

Join the discussion →

Windows Reverse Engineering

In the part of my malware analysis. I wish to learn more about windows malware reverse engineering. but I only have a little knowledge of reverse engineering. now I read some books related to reverse engineering. I need some resources for windows reversing and windows reversing challenges for practicing. most of the websites have Linux ELF-related challenges. As a beginner how can I start my windows reversing career? I don't know how to start? where to start? how can I improve my skill?

Join the discussion →

How to call an external command in Gimp Plugin?

How to use an external command to make an edit of pic in the gimp and then return the result to the stage in a plugin or script. Example in shell script.: magick label.gif +matte \ \( +clone -shade 110x90 -normalize -negate +clone -compose Plus -composite \) \ \( -clone 0 -shade 110x50 -normalize -channel BG -fx 0 +channel -matte \) \ -delete 0 +swap -compose Multiply - The command above (imagemagick app) create a gif and i want put back in gimp stage. May be other simple option or application, but i need of return the edited back to gimp. Python, script fu? Thanks so much.

Join the discussion →

JavaScript and HTML to show or hide an element

I think this is very easy, but I just can't seem to twig it at the moment. I want to use a JavaScript function to set the visibility of an HTML tag. I realise the below is wrong as hidden doesn't take a boolean. I'm just struggling to click what the easiest way to do it is? So I have some script like this: <script> function evaluateBoolean() { if (location.hostname.indexOf("someval" > 0) { return true; } else { return false; } } </script> And I wanted to use it something like this: <div hidden="evaluateBoolean()"> this will be shown or displayed depending on the JavaScript boolean </div>

Join the discussion →

Python/selenium how to use proxy with undetected-chromedriver

whenever I try to use a proxy with undetedted-chromedriver, it just doesn't work and diplays my ip. When I use the normal webdriver, it works perfectly. from selenium import webdriver from time import sleep ip_port = "ip:port" chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('--proxy-server=%s' % ip_port) driver = uc.Chrome(use_subprocess=True, chrome_options=chrome_options) driver.get('https://www.myexternalip.com/raw') sleep(999) How can I make the proxy work with undetected chromedriver? This is the site https://www.myexternalip.com/raw : With undetected chromedriver (

Join the discussion →

How to Obtain Reactions Updates via Telegram Bot API

Is it possible to obtain updates related to reactions to bot-posted messages via WebHooks or long-pooling requests? Or at least to obtain any reactions updates in a channel/group to which a bot was added. The appears to be an API method, but based on the response model, it looks like there are no possibilities to obtain updates related to reactions.

Join the discussion →

ML Kit Barcode Scanning doesn't detect QR codes in the photo of the monitor screen

I am using com.google.mlkit:barcode-scanning:17.0.2 to detect QR codes in the pictures. After getting URI from the gallery I create InputImage and then process this image with BarcodeScanner to find QR codes. When I select a photo of QR codes on paper code is found. But when I take a photo of the QR code on the monitor screen code is never found. What I should do to be able to detect a QR code in a photo of a monitor screen? (When I use the same scanner with CameraX to do live QR code detection it finds code on the monitor screen) val image = InputImage.fromFilePath(context, uri) val scanOptio

Join the discussion →

How to close a contour with OpenCV when dilating isn't enough

I have been looking to close contour for shapes that are similar to circles or rounded objects. I found a very interesting answer here. I thought my problem was solved until I tested with different images. This is my mask from OpenCV canny AFTER dilating. As you can see, there is a big gap at the bottom. If the shape was a circle, I could try to recreate the circle, but the thing is the shape could be different. I could look like a cucumber or a rugby balloon. I wonder if it's actually possible to connect the contour without doing a straight line, which will make me lose a lot of information.

Join the discussion →

how to detect lane lines of a road image in python with opencv

hey so I am trying to detect lane lines that are colored white, yellow and red from a image and mark them as well as count the number of lane lines. I have tried several steps like using different masks but they are not working for every image. Either there are too many lane lines detected or few of the lane lines are missing. import os import re import cv2 import numpy as np from tqdm import tqdm_notebook import matplotlib.pyplot as plt col_images = list() path = r'C:\Users\nancy\Downloads\lane\lane1.jpeg' image = cv2.imread(path) plt.imshow(image) plt.show() col_images.append(image) idx = 0

Join the discussion →

Comparing images - one with coloured dots and one without

I am writing a tool for a game and I am stuck on doing some image comparison. Basically, I take a snapshot of the minimap, and compare it with a saved image I have of the same area to detect the presence of that part of the map. However, when in game, various white or yellow dots appear on the minimap in random positions, which can make it hard to compare the similarity of the images. I've used the template matching feature of OpenCV but I had to set the threshold very low, but this often resulted in false positives. Is there some way to ignore the variable details, i.e. the dots? Thanks! Firs

Join the discussion →

Is there a way to draw inscribed ellipse in a almost rectangular contour?

I am wondering if there is a way to inscribe an ellipse in almost rectangular contour? I am using openCV findcontours() method in my image and my aim is to fit biggest possible ellipses inside every object in the following image: Code I am using: import cv2 import numpy as np def find_contours(preprocessed, min_perimeter): contours, hierarchy = cv2.findContours(preprocessed,cv2.RETR_TREE,cv2.CHAIN_APPROX_NONE) #find contours contours_new = [] #new empty list of contours for cnts in contours: #looping trough contours perimeter = cv2.arcLength(cnts,True) #arc length if perimeter > min_perimeter:

Join the discussion →

add the mean gray value of image with python

i want to add the gray mean value of image y to image X but i get this error : imgr=X+mean ValueError: operands could not be broadcast together with shapes (299,299) (4,) img = cv2.imread("X.png") img = cv2.resize(img,(299, 299)) X = img[:,:,1] Y = cv2.imread("Y.png") mean = cv2.mean(Y) imgr = X + mean` cv2.imshow("AND", imgr)

Join the discussion →

Getting 'fetch has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present... on React page

while I am experienced in .NET and JavaScript, I am currently learning React and during the fetch to my REST API I am getting this error. Access to fetch at 'https://localhost:7142/api/Campaign' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled. Here is my Startup.cs using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microso

Join the discussion →

Python OpenCV - How to recognize the specific colour in the image

Hello all I am working on the program that will simply recognize % of violet colour in the image. I am struggling with this rgb values.. Is there any smarter way of predefined static values for colours like 'blue' or 'green' or 'violet' in openCV already? This is the code and the picture import cv2 import numpy as np imagePath = "probki/b.png" img = cv2.imread(imagePath) violet = [84, 39, 60] diff = 100 boundaries = [([violet[2], violet[1]-diff, violet[0]-diff], [violet[2]+diff, violet[1]+diff, violet[0]+diff])] scalePercent = 1 width = int(img.shape[1] * scalePercent) height = int(img.shape[0

Join the discussion →

Client-side throttling response from kubernetes kubectl command

I have a 3-node ubuntu microk8s installation and it seems to be working ok. All 3 nodes are management nodes. On only one of the nodes, I get an error message and associated delay whenever I use a kubectl command. It looks like this: $ time kubectl get pods I0324 03:49:44.270996 514696 request.go:665] Waited for 1.156689289s due to client-side throttling, not priority and fairness, request: GET:https://127.0.0.1:16443/apis/authentication.k8s.io/v1?timeout=32s NAME READY STATUS RESTARTS AGE sbnweb-5f9d9b977f-lw7t9 1/1 Running 1 (10h ago) 3d3h shell-6cfccdbd47-zd2tn 1/1 Running 0 6h39m real 0m6.

Join the discussion →

AWK comparision after sub

I don't understand why AWK doesn't compare properly after using the sub() function. When I run: echo -e "LG:1000\nLG:3" | awk '{aa=$1; sub("LG:","",aa); if(aa <= 20) {print $0}}' the output is LG:1000 instead should be LG:3. If I run this command: echo -e "1000\n3" | awk '{aa=$1; sub("LG:","",aa); if(aa <= 20) {print $0}} It works properly the output is 3.

Join the discussion →

Suppress messages and possibly warnings when loading libraries in a reprex example

I would like to use a reprex package when generating an answer/question1 that utilises multiple packages. Say I want to provide the following answer library("gdata") dfA <- data.frame(colA = c(1, 2), colB = c(3, 4)) ls() mv(from = "dfA", to = paste0("df", "B")) ls() If I pass this code directly to reprex the output will be as follows: library("gdata") #> gdata: read.xls support for 'XLS' (Excel 97-2004) files ENABLED. #> #> gdata: Unable to load perl libaries needed by read.xls() #> gdata: to support 'XLSX' (Excel 2007+) files. #> #> gdata: Run the function 'installXLSXsupport()' #> gdata: to

Join the discussion →

NetSuite OAuth 2.0 Client Credentials using Postman

I am trying to connect netsuite using Postman's get auth code functionality. According to NetSuite help center a POST request needs to be sent to the token endpoint with the JW token and grant type. But if we go to postman and select Oauth 2.0 client credentials in the Authorization then we get a button "get auth code" And fields like client id, client secret and the urls. After entering all the details its not working. Only the POST request is working. The reason I am asking this is I am trying call some restlets from Appian. But in the Appian screen we only get client id, client secret, auth

Join the discussion →

ModuleNotFoundError: No module named 'paho'

I am trying to make connection with my raspberry Pi and my PC windows through MQTT protocol. And I have a problem I cant solve on my PC - I can t import library that I have installed to my program: import paho.mqtt.client as mqtt Results in the error ModuleNotFoundError: No module named 'paho' The topic was already issued here (Import Error: paho.mqtt.client not found), but solution doesnt work for me. I see it in the python folder: C:\Users\mhucl\AppData\Local\Programs\Python\Python310\Lib\site-packages\paho\mqtt\client I see it in the pip list. But the program can t find it. Do you know wher

Join the discussion →

Moviepy: How to concatenate moviepy composite video clips?

I am working on looping through a nest of my home camera videos and concatenating videos. I want to have a program that I can run periodically to organize my videos. The directory structure of my memory card is as follows: /day --/hour ---00.mp4 ---01.mp4 ... My strategy has been to define getHour function that combines all the minute files in a given directory with concatenation returning an object that can be written. This functions without issue as in I can write any hour. However when I try to run this in a loop to combine hours the object that I return is a composite video class which I c

Join the discussion →

Ever Default Tagging - for Credit Risk Modelling- Python

I'm new to python and i faced some difficulty on writing this certain of codes. So to give a background, i want to do an ever-default tagging for credit risk modelling. 0 for non-default accounts and 1 for default accounts So the idea/concept is that throughout the date performance ( of 12 months), if the specific customer (ID) ever has one event of default (1) then the next performance after that event (for that customer) will be tagged as a default (1) even though the 'default tagging' is 0. so the input like this: ID Date Performance Default Tag AAA 2021-03-01 0 AAA 2021-04-01 0 AAA 2021-05

Join the discussion →

How to split openAPI/Swagger file into multiple valid sub-files?

Our service implements different levels of access and we are using one openAPI YAML file internally. For external documentation purposes, we would like to create multiple openAPI files, that are valid in themselves (self-sustained), but only have a partial set of the global file, e.g. based on the path or on tags. (The same path may be used in different split-Files but I don't think that is a problem then.) Any idea on how to achieve that? Is there some tooling around for it?

Join the discussion →

sql connnection error faced using tkinter, python only while editing/updating the table

I get this message when i have created a table, i ask the user to edit their info and this error message pops up I am using Windows 10 Xampp version 8.1.2 Tried reinstalling xampp but didnt work Have triple checked the table name, database name etc. All are correct Here's my code from tkinter import * import mysql.connector as mysql from tkinter import * my_w = Tk() my_w.state('zoomed') my_w.resizable(0,0) global b my_command = mysql.connect(host = "127.0.0.1", user = "root", passwd = "", database = "employee_form") #check bookamrks def display(): my_cursor=my_command.cursor() query = ("SELECT

Join the discussion →

react-table with filter and select column in the same table

I'm trying to use react-table 7.5 to have a table with search bar and select by rows features. I have the code of both search and select row separately, but I can't make it work together. This is my Table component: const Table = (...) => { const [data, setData] = useState(MOCK_DATA); const columns = useMemo(() => COLUMNS, []); const defaultColumn = React.useMemo( () => ({ Filter: ColumnFilter, }), [] ); // table props let { getTableProps, getTableBodyProps, headerGroups, footerGroups, rows, prepareRow, setGlobalFilter, selectedFlatRows, state: { selectedRowPaths }, } = useTable( { columns, da

Join the discussion →

C#: ensure static variable retains its value

Goal: I am having some issues in C# when ensuring that a variable retains its assigned value for the duration / runtime of a program. In particular, I am attempting to: Read a number in from some input Save it to a variable of type double Print the variable Ensure that this value stays the same for the duration of the program, so that on the next iteration when a new value is read in, the previous value from step (2) is still printed. Attempts: I have attempted to use a global static variable such as public static double foo;, however, whenever the method that retrievs new values is called aga

Join the discussion →

SessionNotCreatedException: Message: Could not start a new session. Response code 500 error with Python Selenium Chrome In Docker

I installed selenium/standalone-chrome in docker, and the version is 4.1.2. But when I run my python code get bellow error: My selenium/standalone-chrome in docker: My python code: def demo(): options = Options() options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Remote( command_executor="http://localhost:4444/wd/hub", desired_capabilities=DesiredCapabilities.CHROME ) driver.get("https://www.google.com/") print(driver.current_url) driver.quit() Could anyone give me a favor on this issue? Thanks.

Join the discussion →

How to use MockedStatic verify on static methods?

I have the following mocks for 2 different static method; UnitConversion.isCompatible() and Logging.error() that are called in my service method. Here is my test method: myService.demoMethod(); try (MockedStatic<UnitConversion> unitConversion= mockStatic(UnitConversion.class)) { unitConversion.verify(never(), () -> UnitConversion.isCompatible(any())); UnitConversion.isUnitsCompatible(any()); } try (MockedStatic<Logging> logging = mockStatic(Logging.class)) { logging.verify(times(1), () -> Logging.error(any())); Logging.error(any(); } The first method is never called while the second one is cal

Join the discussion →

How do you put padding/margin around the content of the drawer in antd?

It is showing up like this for me. How do I make the content have padding, without having to write custom CSS and use the className property? My drawer essentially looks like this: <Drawer closable visible width={400} placement="right" title="Create" > <Form layout="vertical" > <Form.Item name="name" label="Name"> <Input /> </Form.Item> </Form> </Drawer>

Join the discussion →

How can I quickly return to Singapore after being denied entry due to testing positive for THC at the airport?

I am a French student going to Singapore to study for 4 months on a campus. I have been sent back from Singapore to my departure country as I have been tested positive to THC in the airport with CBD oil and empty grinder in my possession. Do you have any information on how to come back as soon as possible? Or any valuable information that would help?

Join the discussion →
Older stories