Categories
Mastering Development

How do I reverse a hex string?

newbie here, will try not to be too idiotic. I’ve generated a public key using the secp256k1 crate, which gives me either the compressed or uncompressed key depending on which print formatting I use (dummy key values used below): println!("Compressed Public Key: {}", ex_pub_key.public_key.key); returns the 33-byte 03a593ae00ed6b402c801d2a2edca9f5c057f2be7327e3d81c5747df058e169cd5, and println!("Uncompressed Public Key: {:?}", ex_pub_key.public_key.key); returns […]

Categories
Mastering Development

Subset and collapse rows based on number

I am stuck on a problem that, in my head, should be pretty easy to solve. However, I can’t find a solution. I have a data frame containing time series, and I want to subset only certain rows. I created a dummy dataset: structure(list(ID = c("A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", "A1", […]

Categories
Mastering Development

How can I find which category has the most products shipped and the net income from sales in that category?

Using the w3schools.com SQL tutorial Northwind database, I’m trying to display the category that has the most products shipped. Additionally, I want to display the net income from all sales in that category. I can’t figure out how to take the category with the most products shipped, and use the amount of products shipped to […]

Categories
Mastering Development

Iterate via payload object v1?

struggling a bit to do that I want, perhaps you may help me. I have a dynamic output object with different amount of items and I don’t know name of keys, so I just do output like this: %dw 1.0 %Output application/json skipNullOn = "everywhere" — flowVars.OutputListArr orderBy $$ this work fine for payload like: […]

Categories
Database Development

Query Require for Opening and Closing

I want to Calculate opening and Closing between two table. Below is Data and expected output Create table #tbl_Receivable (Rec_ID int,Inv_ID int ,Customer_ID int,Rec_Date date,Rec_Amount varchar(50),Inv_type varchar(50),item_Weight int); Create table #tbl_Shop_InvM (Inv_ID int ,Customer_ID int,E_Date date,Rec_Amount varchar(50),Inv_type varchar(50),item_Weight int); Create table #tbl_Customer ( Customer_ID int ,Customer_Name varchar(50)); insert into #tbl_Customer values (1,’Akhter’), (2,’Hussian’); INSERT INTO […]

Categories
Mastering Development

Created this procedure, when I execute I am not getting excepted results

I have created this procedure and I am not getting all records out. It should print id, ssn and ValidSSN. ValidSSN should come from case statement where is checking if SSN is valid. Please could you let me know why? Number of other records matches from table I am pulling from but no results for […]

Categories
Cryptocurrency Ethereum Mastering Development

ethers.js wrong signature

From the same private key in ethers.js and secp256k1 I get the same eth address. But if I sign a message I get a different (wrong) signature in ethers.js. What is wrong with my code? import { createKeyPair, sign } from ‘@erebos/secp256k1’ import { pubKeyToAddress } from ‘@erebos/keccak256’ import { ethers, Wallet } from ‘ethers’; […]

Categories
Mastering Development

Pandas fill in missing data from columns in other rows

I have a df like below: df = pd.DataFrame({‘id’: [‘a’,’b’,’c’,’d’], ‘ac’ : [‘123′,’223’, np.nan, np.nan], ‘prev’ : [np.nan, np.nan, ‘a’,’b’]}) Output: id ac prev 0 a 123 NaN 1 b 223 NaN 2 c NaN a 3 d NaN b For ac are null, get prev’s value, and then look up at the id column. […]

Categories
Mastering Development

when we reshape numpy array, how is the stride size inferred?

I have an 1×1024 1-d array (flattened image). To see the image, I want to reshape its size as 32×32. I can easily achieve this by doing x.reshape(-1,32) and it works as I intended. It doesn’t screw the image. It reads the 1d array with 32-width stride each time. Say this time, there are 4 […]

Categories
Mastering Development

Projecting eigenvectors for fisher’s linear discriminant analysis

I am trying to implement this feature selection method that also allows me to classify data. Following this: paper I have tried many workarounds and ways to implement this, but always my data gets weird. The public dataset that is made available has only to aquisition 1 and 4, to which i have extracted the […]