on-internet

Pickle encoding utf-8 issue

I'm trying to pickle a pandas dataframe to my local directory so I can work on it in another jupyter notebook. The write appears to go successful at first but when trying to read it in a new jupyter notebook the read is unsuccessful. When I open the pickle file I appear to have wrote, the file's only contents are: Error! /Users/.../income.pickle is not UTF-8 encoded Saving disabled. See console for more details. I also checked and the pickle file itself is only a few kilobytes. Here's my code for writing the pickle: with open('income.pickle', 'wb', encoding='UTF-8') as to_write: pickle.dump(ne

Join the discussion →

Why would Amazon Athena throw an "Access denied when writing to location" error?

Access denied when writing to location: s3://[bucket]/queryDailyInventory/Unsaved/2019/07/10/4da06507-a43f-4db0-bd46-81660e58fe35.txt This query ran against the "default" database, unless qualified by the query. Please post the error message on our forum or contact customer support with Query Id: 4da06507-a43f-4db0-bd46-81660e58fe35. Hi all, Above is the error message in its entirety, unchanged except removing the bucket name which contains some private information. This bucket is public, and I have demonstrated my write access to this bucket by creating files and folders to it. However, my at

Join the discussion →

How to do countifs in powerbi

I want to do countif in PowerBI (Example: count of total item with condition #1: having transaction of 2 or more, condition #2: year) I have sample data comprised of PO (transaction) #, item #, date (year), item description, ship to location. I can achieve the result through Excel - Pivot a matrix table of rows of items, columns of year and the value is count of PO/transactions. A separate table on the side is utilized to count the total item within Column (Years) that has transaction count > 2. I can't figure out what DAX to use in PowerBI to achieve the same thing as I could with Excel: Samp

Join the discussion →

How to detect, when a juul started charging? Over ubs (vb.net)

I have a juul, a charger, and a pc. The pc has usb ports. Thats clear. When i plug a mouse, keyboard or any HID device, the pc can recognise these, but when i plug the charger, nothing happened. I'm try to watch the connected usb devices, with the "USBDeview" by NirSoft. The software cant list the charger. How can I detect, when any specified stuff connected via usb? Now the "stuff" is the juul charger. Thanks for any help, I tried to make it simple.

Join the discussion →

Warning: free hotel wifi is a hacker’s dream (alleged)

Is this article correct? A little bit? A lot? Or is it all bollox? Sure using public or near-public wifi (internet cafe or hotel) you should expect your browsing history to be visible to the world, but ... Specifically three questions: Does the hotel's wifi asking for a password make any difference to the visibility of your internet traffic? (A guest/hacker in another room would also get that password and could detect your traffic.) If you log into your bank over hotel wifi, that's encrypted. (Presuming your bank's site is https://... -- and if it isn't, change your bank.) Sure a hacker could

Join the discussion →

Select-Object Data Failure From Succesful Invoke-RestMethod

I have a working call to a rest service using Invoke-RestMethod -Uri https://.... The call's result, in JSON, can be piped the data to Format-Table -Property ... and data is shown. But when Select-Object -Property ... is used after the invoke with the same parameters, the PSObject has the columns but no data for them. If I use a different webservice the call will work. What could be causing the PSObject to not show any values? Working Example on public rest web services Invoke-RestMethod -Uri https://jsonplaceholder.typicode.com/todos/1 | Select-Object -Property title Result @{title=delectus a

Join the discussion →

How to keep same date when refreshing the page?

I'm getting data on button click from WebAPI and navigate the component to other component to show this data and this trick is working fine for me but the issue is when I refresh the page my data is empty, Please provide me some solution or example to keep same data. Thanks in advance component.ts //where I'm getting data onClick onSubmit(){ this.departmentService.GetDepartmentSearchResults(this.modelSearch1.value.Department, this.modelSearch1.value.Year, this.modelSearch1.value.No).subscribe(res => { this.objDepartmentsSearchedResults = res as DepartmentsSearchedResultsModel[]; this.departmen

Join the discussion →

Is performing a mapping operation without using returned value an antipattern? [closed]

Lets say I have a list and I want to add some values into it using a mapping function: const arr = [1, 2, 3, 4, 5]; const anotherArr = []; I do this using a functional approach: arr.map((item) => anotherArr.push(item)); Is this an antipattern / bad logic - that is, not using the mapping operation return value for anything? Are there any good resources on this? (I know this logic is silly and I can just copy the list - that is not the point of my question)

Join the discussion →

NestJS typeorm - can't create entity

I'm trying to add an Idea entity to my TypeOrm (configured to mysql), and it seems like the imports refuse to work. With the file added, the typeorm doesn't initialize successfully. I've reinstalled typeorm package, and I have no idea where to start debugging. I'm following a tutorial ( https://www.youtube.com/watch?v=EHlhvy-fh90), in which this error does NOT appear. I've deviated from it by replacing a postgresql database with a dockerized mysql. I've had some trouble setting up the node -> mysql connection, eventually opting to run a dockerized mysql 5 to account for auth errors (following

Join the discussion →

Implementing ping/pong for userData websocket

According to the Binance API: "The websocket server will send a ping frame every 3 minutes. If the websocket server does not receive a pong frame back from the connection within a 10 minute period, the connection will be disconnected. Unsolicited pong frames are allowed." So here's the problem I am having, I do have a websocket implementation however after that 10 minute period, it disconnect. My on('close') does not return me anything but I just stop getting any messages from the socket. This is the code I have to send back the pong: ws.on('ping', (data) => { console.log("ping: " + data); ws.

Join the discussion →

How to convert Map to array of objects?

I'm trying to convert a Map into array of objects Lets say I have the following map: let myMap = new Map().set('a', 1).set('b', 2); And I want to convert the above map into the following: [ { "name": "a", "value": "1", }, { "name": "b", "value": "2", } ]

Join the discussion →

Error "invalid_grant / Invalid JWT Signature." to get the access token using Oauth

For a long time I have tried to solve this problem. I need to generate a token access with a service account to use the Google calendar application. First I do the JWT with the library firebase / php-jwt based on a pem certificate where it stores the private key provided by the Google service account After doing a curl in Google to get the aforementioned token, but it throws me the following error "" invalid_grant / Invalid JWT Signature " $time = time(); $key = file_get_contents("./certs/certificado.pem"); $token = array( "iss" => "*****@*******.iam.gserviceaccount.com", "aud" => "https://www

Join the discussion →

Dropdown Select with Multiselect in Kendo-ui

Does anyone know if there is a multi-select for kendo UI like the ones we have for Angular Material? I looked up some of the Kendo controls and all I have is multiselect with keyword select. Not the ones I need. This is what I exactly need: [ but this is what I see:

Join the discussion →

Wide data format as input to a Shiny mapview app - reactive wrapper(s) needed?

I'm having trouble using columns from data originating in wide format as dynamic inputs to a Shiny map app. In the app I'm hoping to be able to: Select a parameter of point data (sample data below: 16 locations, 6 parameters) in a drop down type menu and adjust the symbol size to represent the selected parameter's absolute values with a slider (to help visualize positive and negative differences from zero) With any parameter selected, retain ability to see all parameters (the columns) in mapview's popup feature (mapview turns the columns into rows for the popup). It seems a filtered long forma

Join the discussion →

HTTP 400 for graph /sites endpoint - Error authenticating with resource

I'm getting an HTTP 400 on a request for https://graph.microsoft.com/v1.0/sites?search=* but expected response is an HTTP 200 w/ data. It works successfully in multiple client environments (i.e. 100s of environments), but it doesn't work for one of our clients. The application does successfully return calls for /groups, /domains, and other endpoints prior to hitting this HTTP 400. The error is: Error authenticating with resource Response from remote side is: { "code": "AuthenticationError", "message": "Error authenticating with resource", "innerError": { "request-id": "1d68c066-dba8-487e-b3a8-

Join the discussion →

Exit status 255 when trying to do npm start

When I try to run npm start I am facing this issue again and again with status code 255. Things I have tried till now: Uninstalled,removed node modules and package.json file and reinstalled still same issue. Changed the package.json file Removed webpack-dev-server and reinstalled There is no application running on port 3000 I have included screenshots of log file and errors below:

Join the discussion →

CucumberException: Failed to instantiate class stepDefinitions When run tests

Please help. I think that there is a mistake when initializing the page public class AuthStepDefinitions { private final AuthPage authPage = new AuthPage(); @When("^user on Auth Page$") public void onAuthPage() { AuthPage.getStartPage(); } etc. public class AuthPage extends TestBase { private String loginPassrod = "[email protected]"; @FindBy(id = "USER_LOGIN") private WebElement loginInput; @FindBy(id = "USER_PASSWORD") private WebElement userPassword; @FindBy(className = "btn") private WebElement btnEntrance; @FindBy(css = "table.dataTable") private WebElement table; @FindBy(css = "a.button-new

Join the discussion →

Why are the matrices in BERT called Query, Key, and Value?

Within the transformer units of BERT, there are modules called Query, Key, and Value, or simply Q,K,V. Based on the BERT paper and code (particularly in modeling.py), my pseudocode understanding of the forward-pass of an attention module (using Q,K,V) with a single attention-head is as follows: q_param = a matrix of learned parameters k_param = a matrix of learned parameters v_param = a matrix of learned parameters d = one of the matrix dimensions (scalar value) def attention(to_tensor, from_tensor, attention_mask): q = from_tensor * q_param k = to_tensor * k_param v = to_tensor * v_param atte

Join the discussion →

how can I parse an HTML response text of an XMLHttpRequest using JS?

here is my code : const http = new XMLHttpRequest(); const url = 'http://page/'; http.open('get', url, false); http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); http.onreadystatechange = function () { if(http.readyState === 4) { if(http.status === 200 || http.status == 0) { let str = (http.responseText); results = document.getElementById('test').value; alert(results) } } } http.send(); How can I sort the str into html so I can get the value using document.getElementById? I have tried var doc = document.implementation.createHTMLDocument("example"); doc.documentElement.

Join the discussion →

How To Merge Feature Branch Into New Feature Branch (Git)

I want to merge a feature branch into a newly created feature branch. My new branch was created off of the master branch and now I want to merge the changes from another feature branch into that new feature branch like this: git merge feature/my-new-feature However this did not work and I cannot find an answer that works. How can I do this?

Join the discussion →

Exclude certain paths for bootsnap loading

https://github.com/Shopify/bootsnap would load all ruby files at launch. However I have certain need to not load a specific directory. Is there a configuration for doing that? Or is there a simple monkey patch to achieve the same thing?

Join the discussion →

Replicating fixed-point math in Python

I am attempting to replicate a DSP algorithm in Python that was originally written in C. The trick is I also need to retain the same behavior of the 32 bit fixed point variables from the C version, including any numerical errors that the limited precision would introduce. The current options I think are available are: I know the Python Decimal type can be used for fixed-point arithmetic, however from what I can tell there is no way to adjust the size of a Decimal variable. To my knowledge numpy does not support doing fixed point operations. I did a quick experiment to see how fiddling with the

Join the discussion →

Replicating C Fixed-Point Math in Python

I am attempting to replicate a DSP algorithm in Python that was originally written in C. The trick is I also need to retain the same behavior of the 32 bit fixed point variables from the C version, including any numerical errors that the limited precision would introduce. The current options I think are available are: I know the python Decimal type can be used for fixed-point arithmetic, however from what I can tell there is no way to adjust the size of a Decimal variable. To my knowledge numpy does not support doing fixed point operations. I did a quick experiment to see how fiddling with the

Join the discussion →

How to use host network for docker compose?

I want to use docker compose with the host network. I have a docker container that access a local REST api. Usually I run docker run --net=host -p 18080:8080 -t -i containera which can access the host REST api which runs at http://127.0.0.1:8080. Since I want to scale the container containera I found docker compose to scale the container. But the docker compose file from the documentation does not work. The docker container does not query the REST API. I tried the following compose file: version: "3" services: web: image: conatinera:latest network_mode: "host" deploy: replicas: 1 resources: li

Join the discussion →

How to map oneToMany using ModelMapper

I am using springBoot, I want to map OneToMany relationship from parent to child. Directly using entity with eager fetching I get recursive records, therefore, trying using ModelMapper for DTO mapping to Entity but I am not able to figure out how to do it. Please assume getters and setters. Parent.java @Entity public class Parent { @Id private int parentId; private String a; @OneToMany(mappedBy = "parent") private Set<Child> child; Child.java @Entity public class Child { @Id private int childId; private String c; @ManyToOne @JoinColumn(name = "b") private Parent parent; I have working reposito

Join the discussion →

Explanation of % in SQL

Could someone explain the difference between % in SQL? I understand that % is a wildcard that allows you to query results with LIKE results, i.e. a% for words starting with a, but I am confused why the wildcard can be used as % 2 = 0 to query for even numbers? I saw an explanation that said % can be used as divide but I thought / was divide.

Join the discussion →

How to LOCK TABLE ... do stuff ... UNLOCK TABLE with Spring Boot?

The idea is basically to extend some Repositories with custom functionality. So I got this setup, which DOES work! @MappedSuperclass abstract class MyBaseEntity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Int = 0 var eid: Int = 0 } interface MyRepository<T : MyBaseEntity> { @Transactional fun saveInsert(entity: T): Optional<T> } open class MyRepositoryImpl<T : MyBaseEntity> : MyRepository<T> { @Autowired private lateinit var entityManager: EntityManager @Transactional override fun saveInsert(entity: T): Optional<T> { // lock table entityManager.createNativeQuery("LOCK TAB

Join the discussion →

Using Jest even after doing fetch.mockResponse actual fetch is getting called

I am new to react and trying to writing my first test case using Jest. I have to mock a fetch response. I am using jest-fetch-mock. But the call is going to actual fetch and data returned is undefined. package.json : "jest-fetch-mock": "^2.1.2" setupTest.js file global.fetch = require('jest-fetch-mock'); Actual api call method: static fetchUserInfo(){ return dispatch => { fetch('https://localhost:55001/api/userInfo') .then(this.httpResponseHandler.handleHttpResponse) .then ((resp) => resp.json()) .then(data => dispatch(this.onUserInfoGetSuccess(data))) .catch( error => { dispatch(this.onFetchF

Join the discussion →

Specs satisfying the `Firebase/Functions` dependency were found, but they required a higher minimum deployment target

I was trying to install pod 'Firebase/Functions' but failed with the following error: `[!] CocoaPods could not find compatible versions for pod "Firebase/Functions": In Podfile: Firebase/Functions Specs satisfying the Firebase/Functions dependency were found, but they required a higher minimum deployment target.` Here is my pod file # Uncomment the next line to define a global platform for your project # platform :ios, '11.0' target 'MyApp' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Pods for MyApp pod 'Firebase/Core' pod 'Fir

Join the discussion →
Older stories