| open banner overlay when the page is loaded with fancybox 4 Posted: 17 Sep 2021 08:27 AM PDT I would like to update to the latest version of fancybox 4 the javascript code of my banner overlay that opens when the page is loaded. I don't understand where I'm wrong. <script type="text/javascript"> (function ($) { if(!Cookies.get('overlay2533')) { $(document).ready(function () { Fancybox.show([ { src : "#fancybox-overlay", type : "image" } ]); }); var date = new Date(); date.setHours(24,0,0,0); Cookies.set("overlay2533", "1", { expires: new Date( date ) }); } })(jQuery); </script> <div id="fancybox-overlay" style="display:none;"> <href="htts://....." target="_blank"><img src="https://....." alt="" /></a> </div>  |
| can't concat str to bytes error ON Veil FRAMEWORK Posted: 17 Sep 2021 08:27 AM PDT i am learning Veil now. but it has a lot of bugs. when i am creating a exploit it gives this error: Traceback (most recent call last): File "/root/Veil/./Veil.py", line 137, in <module> the_conductor.main_menu() File "/root/Veil/lib/common/orchestra.py", line 127, in main_menu tool_object.tool_main_menu() File "tools/evasion/tool.py", line 368, in tool_main_menu self.use_payload(selected_payload_module) File "tools/evasion/tool.py", line 400, in use_payload selected_payload.generate() File "tools/evasion/payloads/python/shellcode_inject/stallion.py", line 101, in generate encoded_ciphertext, constrained_key, encryption_key = encryption.constrained_aes(Shellcode) File "/root/Veil/tools/evasion/evasion_common/encryption.py", line 125, in constrained_aes real_key = small_key + str(helpers.randomNumbers()) TypeError: can't concat str to bytes there is a error at line 125.. but im not know python. Please help. Bugged PY File: https://github.com/Veil-Framework/Veil/blob/master/tools/evasion/evasion_common/encryption.py#L125  |
| Generate random words with button from text file in Android Studio using JAVA Posted: 17 Sep 2021 08:27 AM PDT I want to generate random words with a click of a button in Android Studio with java. I've managed to read .txt file with a click of a button. In this file, there are 2000+ words and it's displaying all at ones. So I want to display single line randomly. Here's my java code: public void correct_button(View view) { String text = ""; try{ InputStream is = getAssets().open("words.txt"); int size = is.available(); byte[] buffer = new byte[size]; is.read(buffer); is.close(); text = new String(buffer); } catch (IOException ex){ ex.printStackTrace(); } words.setText(text); }  |
| Why this assign doest not trigger? Posted: 17 Sep 2021 08:26 AM PDT After reading the officiel xstate tutorial, I tried to implement by own machine inspired by this post on dev.to by one of the xstate's dev. Everythin works as expected beside that output does not seems to be updated. The assign does not do its job I think. What did I forgot. Demo on Codebox To compare, here is a working demo from xstate where the variable in the context is updated as expected. my code: import "./styles.css"; import * as React from "react"; import * as ReactDOM from "react-dom"; import { createMachine, assign } from "xstate"; import { useMachine } from "@xstate/react"; interface FetchContext { output: string; } const fetchifetch = async () => { return await fetch( "https://jsonplaceholder.typicode.com/todos/1" ).then((response) => response.json()); }; const fetchMachine = createMachine<FetchContext>({ initial: "idle", context: { output: "wesh" // none selected }, states: { idle: { on: { FETCH: "loading" } }, loading: { invoke: { src: (context, event) => async (send) => { setTimeout(async () => { const data = await fetchifetch(); console.log("done"); console.log(data); // well. here I want to assign something to output assign({ output: (context, event) => data.title }); send("FETCHED_SUCCESSFULLY"); }, 4000); console.log("start"); }, onError: { target: "idle" } }, on: { FETCHED_SUCCESSFULLY: { target: "idle" } } }, fetch: { on: { CLOSE: "idle" } } } }); function App() { const [current, send] = useMachine(fetchMachine); const { output } = current.context; return ( <div className="App"> <h1>XState React Template</h1> <br /> <input disabled={current.matches("loading")} defaultValue="yo" onChange={(e) => console.log(e.currentTarget.value)} /> <button disabled={current.matches("loading")} onClick={() => send("FETCH")} > click to fetch </button> <!-- let's display the result over here --> <div>{output}</div> <div>{current.context.output}</div> </div> ); } const rootElement = document.getElementById("root"); ReactDOM.render(<App />, rootElement);  |
| Django or Flask synchronous one-time run and return to subprocess or system call in python and or vim Posted: 17 Sep 2021 08:26 AM PDT That's a mouthful of a title and i had a really hard time searching for what I'm trying to do pulling up tons of false hits. Let me explain. Say I am in a python script that requires some input values in real-time. Normally you use input for simple cases. But in my case, I want to synchronously fire up a django (or flask) app view route in a real browser that allows me to create the values I need in real-time on a real live page. These values don't exist so this can NOT be implemented using an API otherwise it would be easy! I want the original python program to block / wait until i fire "submit" on the live django (or flask) page. Then somehow I need the values that were submitted to be routed back to the calling python program that is still blocking / waiting for the values. Obviously I'm trying to make http which is asynchronous somehow act as synchronous. I'm not sure this can even be done but my thought was that if I could: - have
subprocess block by starting the run of the django dev server itself + open the desired page route (not sure if i can do both in one shot). - i then switch context to work with the page and hit "submit"
- then the "view" responsible takes the values and instead of generating a response back to the browser...
- bundles up the values, exits django or flask with a return value from the submission (sort of as the "exit code"!
- python script that is still blocking then receives the return value / exit code of the original subprocess
- and continues on to do what it needs with the values
I don't understand if django (or flask) is capable of doing what I want though. If the use case isn't clear it's just the ability to calculate the values you need as input in real-time in a much more sophisticated live graphical interface. Basically I need a "smart picker" from a script. If I can get it working in the python script, my thought is i could vim system() exec it to get the input into edited files as well. Any insights greatly appreiated. There's not any code to post because it's clear that I don't understand if what I can do on the django/flask side is even possible. In sum it's almost like calling and run/blocking django or flask server so that it exits on first submit on a pre-defined route so that the app functions more "like a one-time web-app task"!. Thanks  |
| How can I capture my emails from email client to custom web app? Posted: 17 Sep 2021 08:26 AM PDT I would like to create an app where I display, in a form of chat, all the e-mails I receive on my gmail or outlook account from specific addresses and then be able to reply to them (so I reply in a chat, but in fact my email sends back a message). How can I do this using NodeJS and react? Or maybe is there any ready library that I could integrate? I have been searching for this topic for quite a while but cannot really find any feasible solution other than ready made such as: https://www.convergehub.com/imap  |
| My program freezes the moment my spammer made with pysimplegui, pyautogui and timer starts Posted: 17 Sep 2021 08:26 AM PDT when i press "submit" the program freezes can you guys please help me. I am new to pysimplegui and am trying to turn one of my practice programs into a gui. Also could someone tell me how to make the arrows of the "spin" element functional? If i made some stupid mistakes please do let me know, like i said I am new to this stuff so any help is really appreciated import time import PySimpleGUI as sg import pyautogui as pyautogui # img_viewer.py layout=[ [ sg.Text("What do you want to do?"), sg.Button("Spammer"),sg.Button("Encrypter"),sg.Button("Decrypter"),sg.Button("Password generator"), sg.Button("Exit") ] ] window = sg.Window("Multifunctiontool", layout) layoutspammer=[ [ [sg.Text("Press Start to start the bot.")], [sg.Text("Press Stop and then enter to stop the bot.")], [sg.Button("Start"),sg.Button("Stop")] ] ] layoutspammerwindow=[ [ [sg.Text("How many messages do you want to send?"),sg.Spin(0,key="spammer")], [sg.Text("How long ist the cooldown? if not there just leave on 0"),sg.Spin(0,key="cooldown")], [sg.Text("What is your message?"),sg.Input(key="message")], [sg.Text("Do you want to leave a final message(Write down your message, if no just leave blank)?"),sg.Input(key="final_message")], [sg.Button("submit"),sg.Button("Exit")] ] ] layoutspammerwindow2=[ [ [sg.Text("please enter a valid parameter")], [sg.Button("Continue"), sg.Button("Exit")] ] ] spammerwindow= sg.Window("spammer",layoutspammer) spammerwindow2= sg.Window("spammer",layoutspammerwindow,force_toplevel= True) spammerwindow3= sg.Window("spammer",layoutspammerwindow2) while True: event,values=window.read() if event== "Exit" or event== sg.WIN_CLOSED: break if event== "Spammer": spammer_active = True while spammer_active is True: event, values = spammerwindow.read() if event == "Start": event, values = spammerwindow2.read() if event == "Exit" or event == sg.WIN_CLOSED: break if event == "submit": spammer = int(values['spammer']) cooldown = int(values['cooldown']) message = (values['message']) final_message = (values['final_message']) time.sleep(5) for xi in range(int(spammer)): pyautogui.typewrite(message) time.sleep(int(cooldown)) pyautogui.press('enter') print(xi) pyautogui.typewrite(final_message) pyautogui.press('enter') break elif event == "Stop" or event == sg.WIN_CLOSED: spammer_active = False else: event, values = spammerwindow3.read() if event == "Exit" or sg.WIN_CLOSED: break elif event == "Continue": spammer_active = True while spammer_active is True: event, values = spammerwindow.read() if event == "Start": event, values = spammerwindow2.read() if event == "submit": spammer = int(values['spammer']) cooldown = int(values['cooldown']) message = (values['message']) final_message = (values['final_message']) time.sleep(5) for xi in range(int(spammer)): pyautogui.typewrite(message) time.sleep(int(cooldown)) pyautogui.press('enter') print(xi) pyautogui.typewrite(final_message) pyautogui.press('enter') break window.close()  |
| How to block ads in a flutter webView ( web page in mobile app ) Posted: 17 Sep 2021 08:26 AM PDT I have made an app using the webview_flutter plugin, the webviews leads to a URL that streams a video. But there's a new advertisement pop-up every time I enter this webview. I'd be glad if anyone could provide a solution to prevent this from happening. I find a way to do that but for android native (check the link for more information : github repository  |
| AWS AppFlow export AWS CloudFormattion configuration Posted: 17 Sep 2021 08:26 AM PDT I'd like to try AWS AppFlow for moving the data from SalesForce account to Amazon Redshift. I have the following question - is it possible to configure AWS AppFlow Flow via UI and then export configuration for the process automation in AWS CloudFormattion ?  |
| Pythonic Enumerated list with attribute lookup, and list of values Posted: 17 Sep 2021 08:26 AM PDT A common idiom I have is something like this: (the iterator doesnt work btw): SUMMARY = 'summary' REPORT = 'report' class PDF_TYPES: summary = SUMMARY report = REPORT class __metaclass__(type): def __iter__(self): return iter(list(self.summary, self.report)) Firstly thats a lot of boilerplate for 2 values. I would like to define some constants in a list and be able to: - Refer to them individiually, e.g.
REPORT as above - Import the whole list from another module, and refer to them as
PDF_TYPES.report etc. A dictionary would be import PDF_TYPES, REPORT; PDF_TYPES[REPORT], i.e. 2 imports to access one value is not nice. - As a list, e.g.
if x not in PDF_TYPES: raise ValueError(....). I looked at dataclasses but they seem to be for instances of things, these are constants. A dictionary would be perfect except for the clunkiness in scneario 2, it doesnt have the attribute look up. What is the most pythonic way of achieving above 3 requirements?  |
| do not change the TAB of the QTabWidget until the form is complete Posted: 17 Sep 2021 08:26 AM PDT I did this code separately to focus on the main problem. I am trying to make the user not switch to the next TAB where "Form 2" is located until they fill in Form 1. I tried the "currentChange" event but it doesn't work the way I want as it shows the alert when it was already changed from TAB. Is there a way to leave the current TAB fixed until the task is complete? I attach the code and an image import sys from PyQt5.QtCore import Qt from PyQt5 import QtWidgets class MyWidget(QtWidgets.QWidget): def __init__(self): super(MyWidget, self).__init__() self.setGeometry(0, 0, 800, 500) self.setLayout(QtWidgets.QVBoxLayout()) #flag to not show the alert when starting the program self.flag = True #changes to True when the form is completed self.form_completed = False #WIDGET TAB 1 self.widget_form1 = QtWidgets.QWidget() self.widget_form1.setLayout(QtWidgets.QVBoxLayout()) self.widget_form1.layout().setAlignment(Qt.AlignHCenter) label_form1 = QtWidgets.QLabel("FORM 1") self.widget_form1.layout().addWidget(label_form1) #WIDGET TAB 2 self.widget_form2 = QtWidgets.QWidget() self.widget_form2.setLayout(QtWidgets.QVBoxLayout()) self.widget_form2.layout().setAlignment(Qt.AlignHCenter) label_form2 = QtWidgets.QLabel("FORM 2") self.widget_form2.layout().addWidget(label_form2) #QTABWIDGET self.tab_widget = QtWidgets.QTabWidget() self.tab_widget.currentChanged.connect(self.changed) self.tab_widget.addTab(self.widget_form1,"Form 1") self.tab_widget.addTab(self.widget_form2, "Form 2") self.layout().addWidget(self.tab_widget) def changed(self,index): if self.flag: self.flag = False return if not self.form_completed: QtWidgets.QMessageBox.about(self, "Warning", "You must complete the form") return if __name__ == "__main__": app = QtWidgets.QApplication(sys.argv) mw = MyWidget() mw.show() sys.exit(app.exec_())   |
| Fetching data from Firebase using Axios in React Posted: 17 Sep 2021 08:27 AM PDT  I am getting TypeError: response.forEach is not a function and can't fetch the data. Please help me out.  |
| NPM CI error bindings not accessible from watchpack-chokidar2:fsevents Posted: 17 Sep 2021 08:26 AM PDT When I run npm ci on Github Actions I got the error: Run npm ci npm ERR! bindings not accessible from watchpack-chokidar2:fsevents npm ERR! A complete log of this run can be found in: npm ERR! /home/runner/.npm/_logs/2021-09-17T15_18_42_465Z-debug.log Error: Process completed with exit code 1. What can be? My .github/workflows/eslint.yaml name: ESLint on: [push, pull_request] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Use Node.js uses: actions/setup-node@v1 with: node-version: '14.x' - run: npm ci - run: npm run lint My package.json { "name": "@blinktrade/uikit", "version": "1.0.0", "main": "dist/index.js", "license": "MIT", "devDependencies": { "@babel/plugin-transform-react-jsx": "^7.14.9", "@babel/preset-env": "^7.15.6", "@babel/preset-react": "^7.14.5", "@babel/preset-typescript": "^7.15.0", "@storybook/addon-essentials": "^6.3.8", "@storybook/react": "^6.3.8", "@testing-library/jest-dom": "^5.14.1", "@testing-library/react": "^12.1.0", "@testing-library/user-event": "^13.2.1", "@types/jest": "^27.0.1", "@types/react": "^17.0.21", "@typescript-eslint/eslint-plugin": "^4.31.1", "@typescript-eslint/parser": "^4.31.1", "eslint": "^7.32.0", "eslint-plugin-react": "^7.25.2", "husky": "^7.0.2", "jest": "^27.2.0", "prettier": "^2.4.1", "pretty-quick": "^3.1.1", "react": "^17.0.2", "react-dom": "^17.0.2", "rimraf": "^3.0.2", "typescript": "^4.4.3" }, "husky": { "hooks": { "pre-push": "npm run lint", "pre-commit": "pretty-quick --staged" } }, "scripts": { "build": "tsc -p .", "clear": "rimraf dist/", "format": "prettier '**/*' --write --ignore-unknown", "lint": "eslint --max-warnings=0 .", "storybook": "start-storybook -p 4000", "test": "jest" } }  |
| Keyword-only arguments without positional arguments Posted: 17 Sep 2021 08:27 AM PDT  Kindly Explain this code that is highlighted, especially the part where the method Definition is. Questions: - why Asterisk is on the Start without any parameter, What does it mean in python.
- Asterisk before calling a function "choice", what does it mean?
- How does it enforce python to use keyword-only arguments?
 |
| How to include percentage and numerator/denominator in the same cell Posted: 17 Sep 2021 08:26 AM PDT I am calculating numerators, denominators and percentages and would like these in one cell in R. How would I do this? For example, if I have a value of a = 1 and b = 2, if I doa/b, I would get 0.5. What is the best way to express this in the format "50% (1/2)" in a single cell.  |
| SAS HOW TO DO CALCULATION FOR A GROUP WITH MULTIPLE ROWS Posted: 17 Sep 2021 08:26 AM PDT I have a dataset with student ID, score, and assignment number. For each student, they have five assignments, I need to calculate a final score for them. If the student has more than one missing score, then the final score is a missing value. Else, the final score is 0.7*(average of the first 4 assignment scores)+0.3(last assignment scores). How can i do it in SAS?   |
| Creating dummy variables in tidyverse syntax? Posted: 17 Sep 2021 08:27 AM PDT I have a data frame like so: dat <- tribble( ~isHot, ~isCrispy, ~Restaurant, 1, 0, "A", 0, 0, "B", 1, 1, "B", 0, 0, "C" ) > dat # A tibble: 4 × 3 isHot isCrispy Restaurant <dbl> <dbl> <chr> 1 1 0 A 2 0 0 B 3 1 1 B 4 0 0 C I want to create dummy variables for all categorical variables to get the following output: isHot isCrispy Restaurant_A Restuarant_B 1 1 0 1 0 2 0 0 0 1 3 1 1 0 1 4 0 0 0 0 Can I do this just via tidyverse syntax? I don't want to use recipes, fastdummies, or other packages. EDIT: I want the code to be adapted to all categorical variables. In this example there is only one categorical variable, but what if there are more? I want to be able to take the feature name and create dummies. For example if there is another categorical feature called City, I would have dummies variables like..City_A, City_B, etc.  |
| Is there a way to get the html of form fields including current values? Posted: 17 Sep 2021 08:27 AM PDT Is there a way to get the resulting HTML of form fields where the user has entered data? For example, I only seem to be able to retrieve something like this using innerHTML: <input type="text" /> <textarea></textarea> But I would like to get something like this: <input type="text" value="John Smith" /> <textarea>Hello! How are you today?</textarea> Edit: Here's code for a minimum reproducible example: function go() { alert(document.getElementById('example').innerHTML); } <div id=example> <input type=text /> <textarea></textarea> <input type=button value=go onclick="go()" /> </div>  |
| Calling a function issues [duplicate] Posted: 17 Sep 2021 08:27 AM PDT If I try to call a function from outside of the 'Player' class, it doesn't work, and complains that it's missing the 'self' variable. If I call it from inside the 'Player' class, it complains that 'Player' is not defined yet. How do I fix this? Code needed to run it: import pygame import os.path # Initializes pygame pygame.init() screen = pygame.display.set_mode([800, 576]) PlayerSprite = pygame.image.load(os.path.join('assets', 'sprites', 'player', '01.png')).convert_alpha() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False screen.fill((125, 125, 125)) all_sprites = pygame.sprite.Group() move = 2 class Player(pygame.sprite.Sprite): def __init__(self): super().__init__() self.image = PlayerSprite self.rect = self.image.get_rect() self.rect.center = 50, 50 def keyboard_input(self): event = pygame.event.poll() keys = pygame.key.get_pressed() # Triggered if the user inputs a key. if event.type == pygame.KEYDOWN: key = pygame.key.name(event.key) # Returns the value of the pressed key if len(key) == 1: # All keys other than numpad if keys[pygame.K_w] or keys[pygame.K_UP]: # Move the player up self.y += move player = Player() all_sprites.add(player) all_sprites.draw(screen) Player.keyboard_input()  |
| Practical way of implementing comparison of unions in c Posted: 17 Sep 2021 08:27 AM PDT For some testing purposes, I need to compare two unions to see if they are identical. Is it enough to compare all members one by one? union Data { int i; float f; char* str; } Data; bool isSame(union Data left, union Data right) { return (left.i == right.i) && (left.f == right.f) && (left.str == right.str); } My hunch is that it could fail if one the unions has first contained a larger type and then switched to a smaller type. I have seen some suggestions mentioning wrapping the union in a struct (like here: What is the correct way to check equality between instances of a union?) which keeps track of which data type that the union currently is, but I don't see how that would practically be implemented. Would I not need to manually set the union type in every instance where I set the union value? struct myData { int dataType; union { ... } u; } void someFunc() { struct myData my_data_value = {0}; my_data_value.u.i = 5; my_data_value.u.dataType = ENUM_TYPE_INTEGER; my_data_value.u.f = 5.34; my_data_value.u.dataType = ENUM_TYPE_FLOAT; ... } It does not seem warranted to double all code where my union is involved simply to be able to make a perfect comparison of the union values. Am I missing some obvious smart way to go about this?  |
| Pandas returning whole dataframe when .loc to a specific column that is not existant Posted: 17 Sep 2021 08:26 AM PDT I have a dataframe with column names ['2533,3093', '1645,2421', '1776,1645', '3133,2533', '2295,2870'] and I'm trying to add a new column which is '2009,3093'. I'm using df.loc[:, col] = some series, but it is returning a KeyError meaning that column does not exist. But by default, pandas would create that column. If I do df.loc[:, 'test'] = value it works fine. But somehow, when I do df.loc[:, col], it returns me the entire dataframe. When it should actually return a KeyError, because the column does not existe in the dataframe. Any thoughts? Thanks  |
| How do I load an image from an URL (that has a different origin) into a File object? Posted: 17 Sep 2021 08:26 AM PDT At first I thought it should be as easy as: const img = document.createElement('img'); img.onload = () => { ... } img.onerror = () => { ... } img.src = url; But then it turned out I need to draw it on a canvas, then toBlob(). And don't forget to add CORS and crossorigin="anonymous" to the img tag. Isn't it a bit too involved? Is there a better way? To show you the final solution: function getFileFromURL(url) { return new Promise((resolve, reject) => { const fileName = url.split('/').pop(); const img = document.createElement('img'); img.setAttribute('crossorigin', 'anonymous'); img.onload = () => { const canvas = document.createElement('canvas'); canvas.width = img.width; canvas.height = img.height; const ctx = canvas.getContext('2d'); ctx.drawImage(img, 0, 0); canvas.toBlob(blob => { resolve(new File([blob], fileName)); }); }; img.onerror = () => { reject('error'); }; img.src = url; }) }  |
| Split character strings in a column and insert as new rows Posted: 17 Sep 2021 08:27 AM PDT Although I saw similar questions and solutions, but I still couldn't solve my problem. I want to split my elements in my data.table into single values and insert into new rows. The data is like this: dt <- data.table("0100"=c("9103,9048,9903,7837","8738,2942,2857,4053"), "0101"=c("9103,9048,9903","2537,1983")) I want it to be like this: dt2 <- data.table("0010" = c(9103,9048,9903,7837,8738,2942,2857,4053), "0101" = c(9103,9048,9903,2537,1983,NA,NA,NA)) Since I just start learning R, Please help me solve this problem  |
| Typescript compiler not saved json in root directory Posted: 17 Sep 2021 08:27 AM PDT I have a project in express/typescript and in my root directory backend, the files .json dont save in the folder dist tsconfig.json { "compilerOptions": { "module": "commonjs", "esModuleInterop": true, "target": "es6", "moduleResolution": "node", "sourceMap": true, "outDir": "dist", "resolveJsonModule": true }, "lib": ["es2015"] } tslint.json { "defaultSeverity": "error", "extends": ["tslint:recommended"], "jsRules": {}, "rules": { "no-console": false }, "rulesDirectory": [] } root Directory - appsettings.development.json -> This files are not saved inthe dist folder
- appsettings.json -> This files are not saved in the dist folder
- swagger.json -> This files are not saved in the dist folder
- tsconfig.json
- tslint.json
- dist
Directory order:   |
| SWUpdate with wrong mmc device address Posted: 17 Sep 2021 08:27 AM PDT I use this sw-description with device="/dev/mmcblk3p1",but swupdate will download files to "/dev/mmcblk3p2".   |
| Multiple sign in one docusign embedded sign Posted: 17 Sep 2021 08:26 AM PDT Can we send a DocuSign with multiple signature? I need to send a DocuSign with multiple signature field. One recipient has to sign one particular signature field and then send the same DocuSign has to another recipient and he has to sign other signature field keeping the previous recipient signature and so on and I have to set receipt programmatically. Is it possible? and how can I implement that? Is it possible on embedded signing?  |
| Merging not happening properly in json's Posted: 17 Sep 2021 08:26 AM PDT Currently I have 2 json's, Let us take json A and B. A and B are both of same type, but A has some extra fields. while merging these two json's, I am not getting the proper output. Here is the example: Obj1 is one json and Obj2 is other. If we merge these two Json's we will get Obj3. Please suggest me how to achieve this. info : json has list fields also there. Obj1:- { "name": "sai", "contacts": [ { "contact": "1234" }, { "contact": "6789" } ], "age": "25" } -------------- Obj2 :- { "name": "sai", "contacts": [ { "contact": "1234" }, { "contact": "6789189" } ] } ----------------- Obj3 :- { "name": "sai", "contacts": [ { "contact": "1234" }, { "contact": "6789" }, { "contact": "6789189" } ], "age": 25 } Please suggest on how we can complete this Merge using Java  |
| How to fix this error "A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade" Posted: 17 Sep 2021 08:27 AM PDT I can't run my app on AVD. I get this error. A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade My build.gradle android { compileSdkVersion 29 buildToolsVersion "29.0.2" defaultConfig { applicationId "com.example.myapplication" minSdkVersion 15 targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } }[E][1]} dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' testImplementation 'junit:junit:4.12' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'}   |
| Nginx reverse proxy to an app in host Posted: 17 Sep 2021 08:27 AM PDT I have an app that is running outside Docker on port 5000. I am trying to run a reverse proxy in nginx via Docker compose but am unable to communicate with the host's port 5000. In my docker-compose.yml file I have: ports: - 80:80 - 443:443 - 5000:5000 When I try to run this I get: ERROR: for nginx Cannot start service nginx: driver failed programming external connectivity on endpoint nginx (374026a0d34c8b6b789dcd82d6aee6c4684b3201258cfbd3fb18623c4101): Error starting userland proxy: listen tcp 0.0.0.0:5000: bind: address already in use If I comment out - 5000:5000 I get: [error] 6#6: *1 connect() failed (111: Connection refused) while connecting to upstream How do I connect to an already running app in the Host from a Docker nginx container? EDIT: My nginx.conf file user www-data; worker_processes auto; pid /run/nginx.pid; events { worker_connections 768; } http { upstream mysite { server 0.0.0.0:5000; } server { listen 80; server_name localhost; location / { proxy_pass http://mysite; } } } The response when I try to curl localhost is 502 Bad Gateway. The app itself and curl 127.0.0.1:5000 responds fine from the host. EDIT 2: I have also tried the solution found here but I get nginx: [emerg] host not found in upstream "docker". Docker is my host's hostname. EDIT 3: My docker-compose.yml version: '3' services: simple: build: ./simple container_name: simple ports: - 80:80 - 443:443 My Dockerfile: FROM nginx COPY nginx.conf /etc/nginx/nginx.conf EXPOSE 80 443 CMD ["nginx", "-g", "daemon off;", "-c", "/etc/nginx/nginx.conf"] EDIT: I am getting the computer host via the "hostname" command in linux.  |
| RS256 vs HS256: What's the difference? Posted: 17 Sep 2021 08:26 AM PDT I'm using Auth0 to handle authentication in my web app. I'm using ASP.NET Core v1.0.0 and Angular 2 rc5 and I don't know much about authentication/security in general. In the Auth0 docs for ASP.NET Core Web Api, there are two choices for the JWT algorithm being RS256 and HS256. This may be a dumb question but: What's the difference between RS256 and HS256? What are some use cases (if applicable)?  |
No comments:
Post a Comment