Categories
Mastering Development

How To Draw Multi Column ListView in WM_DRAWITEM

The Covid-19 situation made me challenge myself with WinAPI coding. Oh my, what have I gotten myself into.. I have a 3 columns ListView (didn’t add the columns and items insertion code since these parts work): hwndListbox = CreateWindow( WC_LISTVIEW, “”, WS_VISIBLE | WS_BORDER | WS_CHILD | LVS_REPORT|LVS_OWNERDRAWFIXED, 100, 100,600, 300, hwnd, (HMENU)1, NULL, NULL); […]

Categories
User Help

How to Add Suffix to range of cells with existing Data

Input: 55958 55959 55960 55961 55962 55963 60346 60347 60348 60349 Output: 55958-K 55959-K 55960-K 55961-K 55962-K 55963-K 60346-K 60347-K 60348-K 60349-K I want to Add suffix “-K” with all Range of cells. First I tried with Custom Number Format { “#-K” } This is only works with formats, So i skipped it (Because i […]

Categories
Mastering Development

Advanced List Comprehension: how can I fit multiple for loops in one list comprehension?

I have been trying to fit the following list of words from a text file into one list comprehension: word_list = open(“Lincoln.txt”, “r”).read().split() for i,v in enumerate(word_list): word_list[i] = v.translate(str.maketrans(“”, “”,string.punctuation)).lower() for i in word_list: if i == ”: word_list.remove(i) This is succesful, but I’m not sure how to include the second part of the […]

Categories
Mastering Development

ggplot2 barplot – adding percentage labels inside the stacked bars but retaining counts on the y-axis

I have created an stacked barplot with the counts of a variables. I want to keep these as counts, so that the different bar sizes represent different group sizes. However, inside the bar plot i would like to add labels that show the proportion of each stack – in terms of percentage. I managed to […]

Categories
Mastering Development

Prevent SQL Injection – PHP Mysqli [duplicate]

I want to improve my code to prevent SQL Injection Attacks. But I have a small problem: I want to prevent attacks on a Login page. So my users need to enter their email and password. The password is hashed with md5 before it is stored in the DB. My db connection: <?php $con = […]

Categories
Mastering Development

Prevent from SQL Injection – PHP Mysqli [duplicate]

I want to improve my code from SQL Injection Attacks. But I have a small problem. I want on a Login page to prevent attacks. So my users need to enter their email and password. My password is md5 stored in DB. My db connection: <?php $con = mysqli_connect(“localhost”,”root”,””,”test”); ?> Code I want to improve […]

Categories
Mastering Development

use a string variable to address a struct field

In C# I have a struct with many fields, e.g. one called “key”. I’m reading an .ini settings file, which has values for all the struct fields. Is there a way to use the field names as strings (like the myField string array below) to address the struct fields during the reading process (see below)? […]

Categories
Mastering Development

Querying Firestore Database for Date Range

I’m building an app to help people carpool from the airport and I’m trying to query my database for rides within a certain range. Here is what I have: import UIKit import Firebase class DiscoverRideViewController: UIViewController { var userFullName = String() var dateEarly = Constants.UserInfo.chosenDate.addingTimeInterval(-900) var offset = TimeInterval() @IBOutlet weak var createRide: UIButton! override […]

Categories
Mastering Development

Force Javascript/Node to wait for service completion

I’m trying to make a call to a service and build an object with the resulting value. If I knew what I was doing, I’d also handle errors, but I don’t know how. Unfortunately, the code begins the service call, then returns to the statement following the service before the service call finishes. I don’t […]

Categories
Mastering Development

I’m making a simple PHP MySQL registration system and getting “syntax error, unexpected $end”. Any ideas why?

I’m making a simple PHP MySQL registration system and getting “syntax error, unexpected $end”. Here is my code for the login.php file. I’m also getting the same error on my register.php file. Any ideas why? <?php if($_SERVER[“REQUEST_METHOD”] == “POST”) { $username = $_POST[‘username’]; $password = $_POST[‘password’]; $bool = true; // Database connection $connection = mysqli_connect(“localhost”, […]