Categories
Mastering Development

Window created with WINAPI is not drawing objects. What’s the problem?

I have my window file (Window.h): LRESULT CALLBACK MessageHandler(HWND, UINT, WPARAM, LPARAM); class Window { private: HWND hWnd; HINSTANCE hInstance; bool running = true; const char* ID = "WINAPI_JVM64"; public: Window() { init(); } virtual void draw(Gdiplus::Graphics*) = 0; void init() { hInstance = (HINSTANCE)GetModuleHandle(NULL); WNDCLASS wc; wc = {}; wc.style = CS_HREDRAW | CS_VREDRAW; […]

Categories
Mastering Development

Fast way to remove array of specific row values from 2D numpy array

I have a 2D array like this: a = np.array([[25, 83, 18, 71], [75, 7, 0, 85], [25, 83, 18, 71], [25, 83, 18, 71], [75, 48, 8, 43], [ 7, 47, 96, 94], [ 7, 47, 96, 94], [56, 75, 50, 0], [19, 49, 92, 57], [52, 93, 58, 9]]) and I want to […]

Categories
Mastering Development

update\replace df [cols] by df [cols]

i have two df with the same index, and i like to update\replace list of cols only when name=="A". so where i got name=="A" i want it to replace lits of cols ->cols=[col1,col2,col3,col4] so i have this df first_data={"col1":[2,3,4,5,7], "col2":[4,2,4,6,4], "col3":[7,6,9,11,2], "col4":[14,11,22,8,5], "name":["A","A","V","A","B"], "n_roll":[8,2,1,3,9]} df1=pd.DataFrame.from_dict(first_data) df1 and the sec df sec_df={"col1":[55,0,57,1,3], "col2":[55,0,4,4,53], "col3":[55,33,9,0,2], "col4":[55,0,22,4,5], "name":["A","A","V","A","B"], […]

Categories
Mastering Development

R subsetting a dataset and pulling specific rows and columns

I am trying to pull out specific columns and rows from a massive excel file i have currently done the following, there has to be a better way as i originally wanted just v1 <-v[,5:7],[,12:13],[,15:17] but it is wrong. I have been searching online but cannot find a solution. The reason for doing this is […]

Categories
Mastering Development

Python – How to divide directory values?

I have a dictionary comprising of keys and values as integers in a lists., i.e., input: { ‘example_key1’: [358, 57, 18602, 18388] ‘example_key2’: [415, 12, 4800, 2013] ‘example_key3’: [450, 10, 4500, 4500] } I wish to divide the last value with the second to last value in the list for every key, multiply the answer […]

Categories
Mastering Development

Object.keys(myObject) returns an arbitrary list of numbers, not expected value

This is a bit of a head-scratcher – and has been a source of pain for the past 3 hours. Here’s my code. const payloadBody = JSON.parse(gatewayEvent.body); console.log(payloadBody); console.log(gatewayEvent.body); console.log(payloadBody.paymentMethodId); console.log(payloadBody[‘paymentMethodId’]); console.log(Object.keys(payloadBody)); If I look at the CloudWatch logs for this (I am executing in Lambda), the line console.log(payloadBody) logs: { "customerId": "cus_REDACTED", "paymentMethodId": "pm_REDACTED", […]

Categories
Mastering Development

Laravel Eloquent request has no quotes in request data

I am getting the following error: SQLSTATE[42S22]: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Invalid column name ’employee’. (SQL: insert into [records] ([category_ID], [subcategory_ID], [employee], [fileDate], [notes], [disposalType], [fileType], [employeeSignature], [status]) values (9, 57, test, test, testing functionality, test, test, test, 1)) As you can see there are no quotes around any of the strings in […]

Categories
Mastering Development

str.replace() doesn’t replace nor throw errors (python)

So I scraped a list of heights from a website, and I am trying to find an average of these heights in ft and in. My problems is that the str.replace() is not working here and I am not sure why. (It doesn’t give me any error messages) Any suggestions on how to fix this? […]

Categories
Mastering Development

Divide two pandas columns of lists by each other

I have a df like this: col1 col2 [1,3,4,5] [3,3,6,2] [1,4,5,5] [3,8,4,3] [1,3,4,8] [8,3,7,2] Trying to divide the elements in the lists in col1 and col2 together to get what’s in the result column: col1 col2 result [1,3,4,5] [3,3,6,2] [.33,1,.66,2.5] [1,4,5,5] [3,8,4,3] [.33,.5,1.25,1.66] [1,3,4,8] [8,3,7,2] [.33,1,.57,4] Tried a lot of different approaches – but always […]

Categories
Mastering Development

How to resolve the nullpointer exception [duplicate]

While working on a GUI project i am stuck with an error called null pointer error. I am unable to resolve this problem. The line which shows the error is closed by double asterisk on both sides(**).(line 80) I have connected this with a SQL database and error erupts while assigning Jtable its value and […]