All Questions

57,925 questions
28 views

PHP CONNECTION - BEST PRACTISE TIPS [closed]

I have been learning phpmyadmin, this is my current learning/test environment below. I created my first database today I refer to as db1 it is simple structure with only three input fields. And one ...
71 views

Follow up Implementation on Monty Hall Simulation

I have taken your inputs on my original question and formed a new implementation of the Monty Hall Simulation: Again keep an eye on CleanCode and OOP The Price to be won: ...
37 views

45 views
+50

Automating A Workflow Using Selenium - Best Way To Fetch Elements & Make Code More Generic

I'm a newbie to Selenium and I'm trying to get better at it by taking up interview assignments. This YouTube link describes the workflow that needs to be automated. The following points are worth ...
34 views

Architecture Website Layout [on hold]

I'm a software developer trying to level up my front end skills. I used to be quite decent at it but haven't worked with front end for a long time so my skills are a bit rusty. As an exercise I'm ...
10 views

Lock file and interrupt signals in POSIX shell script running indefinitely

This script is running indefinitely as the Linux background process. I have put an enormous effort to make this POSIX shell script containing an infinite loop shut down tidily along with the ...
45 views

Bulk insert of employees into Oracle database [on hold]

I have data that is stored in a list of class Employee: ...
17 views

jQuery plugin for allowing only digits to be entered in html form input

I wrote this small jQuery plugin to set some fields so that they allow only 0-9 digits to be entered. I intended to do that by preventing user from typing, pasting or dropping non-digit content. It ...
14 views

Matlab code “glitch”? Matrix is turning into a single character, rather than staying a matrix [closed]

I am writing a matrix (a function) so I can plot it later on. It will go from theta2 = [-55:1:55] (-55 to 55) and the Y variable will be "theta4" which depends on theta2. The highlited area in the ...
13 views

Get Every Week's Start and End Date from Series End Date Range Linq [closed]

I have an application where a user will give input Start Date, End Date and Series End Date. Example StartDate= 02/12/2019 EndDate = 03/16/2019 SeriesEndDate= 12/31/2025 I want to get start and ...
43 views

Reduce a grid array [][] into a string

I have a class with a property of grid[][] and each value is either true or false. I need to convert this to a string with letters o and b in place of the boolean. ...
27 views

Position logo in middle of nav

I've recently migrated away from floats and have started using flexbox to build my grids. My navigation has 4 menu items. I'd like my logo to sit in the middle of these. To maintain a good page ...
65 views

Return array with products of old array except i

Coding problem: Given an array of integers, return a new array such that each element at index i of the new array is the product of all the numbers in the original array except the one at i. My ...
74 views

My malloc() in C using mmap()

My latest school project was to implement malloc(), free(), realloc() and ...
18 views

Priority Queue comparator map [closed]

I have a custom comparator for a priority queue. ...
59 views

Contiguous elements of the list sum to K

The task: Given a list of integers and a number K, return which contiguous elements of the list sum to K. For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should return [2, ...
77 views

Printing out a table in console

This program prints out a table in the console. Suggestions for improvements are welcome. Example output ...
230 views

Get all monotonic sublists from a list

So, i recently wrote code that can count the number of monotonic items (increasing, decreasing and constant). For an input such as x = [1,2,3,3,2,0] The provided ...
2k views

Basic C copy file implementation

I'm a java programmer by trade and starting to learn C/C++. I'd appreciate any pointers on glaring issues with my code style which is acceptable in java but not in C. I feel like open_files is ...
35 views

PHP project with Google Calendar API

I'm playing with a simple (for now) project in PHP with Google Calendar API. I have posted the code here in order to improve my programming style about whatever you think it's worth suggesting. Thank ...
37 views

Slots and Dynamic Components

It's an exercise from a Vue.js course I'm enrolled into. The aim is to get comfortable with the Vue.js features Slots and Dynamic components. By clicking on the buttons one shall be able to change the ...
17 views

Retrun vs Print in While Loop [closed]

I am writing a simple code testing try: / except clause in Python. My code does what is expected but I don’t understand return/print behavior when I loop that code. ...
69 views

John Conway's game of life in Haskell

I have written a small code that simulates the Game of Life by John Conway. This is the code: ...
15 views

Why my script doesn't work properly [closed]

I have made a snake game with pygame but there are some problems. To begin with the code works but there are some minor problems. Firstly, snake isn't eating the apple(actually you have to pass over ...
15 views

Generate n appointments in the next m months

I work with an API where I need to write code to generate n appointment dates in the coming m months (from today). For the purpose, I write a Random date generator class provided. One condition is I ...
13 views

Trying to implement text editing with left and right cursor in UART [closed]

I am implementing a minimal command line in serial terminal using TivaC board from texas instruments. using Putty cursor detection is already enabled by application so I don't have to delete the ...
30 views

Simple Flappy Bird Clone using Kivy (with very minimum physics)

This is a very simple clone of Flappy Bird using Kivy, to be used for programming class for teens. The game consists of 3 classes: Bird, ...
30 views

Should I drop the 'else' from an 'if elif else' or 'if else' segment? [closed]

I often write statements such as: def foo(): if condition: return True else: return False To me, it makes sense to just drop the else, giving ...
19 views

UpvoteJS, a simple voting widget in vanilla JavaScript

I implemented a simple voting widget like the one used on Stack Exchange sites, to use for other purposes (see live on bashoneliners.com), as a reusable package, dubbed UpvoteJS. Here's how it works: ...
16 views

Extension to BindingList<T> that allows for cancelable notifications of changing and deleting

This is an extension of the System.ComponentModel.BindingList<T> class that allows for notifications of item changing and deleting. These notifications ...
86 views

Most basic fantasy combat simulator

I was wondering if anyone had anything to recommend for how to clean up the code I made below. Essentially I am asking if my code is messy or not and if there are any recommendations for my ...
49 views

NFL data scraper

I made a Python 3 class that scrapes data from Pro Football Reference. It uses requests and beautifulsoup4 to gather the data ...
14 views

Concatenating linked named entity tags in a list of tuples [closed]

Given a list of tuples, I want to merge all L- tuples with their corresponding B- tuple. The List is constructed in order, so that all L- tuples must follow a B- tuple This works, but I'm fairly new ...
33 views

Split data equally to Thread in java

Is this efficient way to split the record which is comes from database? So that the thread will process the record based on the start and end points. Step 1: Get the total number of records from ...
33 views

POSIX-ly finding a specific Java process

In this code I find a list all of the running java processes and give the below function a name to look for, it will do its best. But since I find my approach a ...
16 views

Sparking animation for Button

I just came through a GitHub repo, which has an amazing animation for Button in Android. So, I though why not make that for web buttons too. And I started ...
61 views

Write a function that adds two numbers stored in a linked list and returns the sum

Just for fun I did the following exercise from "Cracking the coding interview. 4th edition": You have two numbers represented by a linked list, where each node contains a single digit. The digits ...
46 views

Calendar holidays to XML

We are writing program which makes XML file which is a calendar with all free days in Poland (Saturdays, Sundays, and all hollidays). We tried to write this code as readable as possible so probably no ...
46 views

Simple war scheduling algorithm in Java

Let $\mathcal{C} = \{ C_1, \dots, C_n \}$ bet a set of $n$ different countries. We associate with each country $C_i$ with its potential $P_i$. We choose a specific country $C_e$ in \\$\...
50 views

Return the shortest substring containing all the characters in the set

The task: Given a string and a set of characters, return the shortest substring containing all the characters in the set. For example, given the string "figehaeci" and the set of characters ...
50 views

Code to plot graphs with multiple panels efficiently

I quite often plot graphs looking at how some property or function varies with different parameters. Normally, I find the analysis code can be written fairly succinctly and separated into a suitable ...
33 views

Two functions that move array elements [closed]

These two functions act on a stack, an array of integers (whose first element is the top of the stack, LIFO). The first function retrieves the first element and puts it at the end. The other is the ...
35 views

Bowling Game Kata

I wanted to practice my programming skill and I started solving exercises from kata-logs site. The exercise: The game consists of 10 frames. In each frame the player has two rolls to knock down ...
56 views

Command line sliding tile puzzle in C++

I have rolled a simple program for controlling a sliding tile puzzle via command line. I would like to hear comments on how to make it more idiomatic C++17 and efficient. Here is my code: ...
40 views

Reproducing the known results for random tic tac toe play using Python

I'm reading "Code Complete" by McConnel and I'm practicing using object oriented programming to "reduce complexity". (By that McConnel means, among other things, that it should be very easy to read ...
136 views

Read jobs from jobs.af (a jobs portal), categories them and write them to separate CSV files based on jobs gender

I am a beginner Python developer and I wrote a script in Python which fetches 50 latest jobs from jobs.af (a jobs portal) API, categories them based on jobs gender and write each to a separate CSV and ...
20 views

...
25 views

SQL Database for Visitor Registration System

This is intended for a web-based application that allows someone to register visitors, assign their hosts, and indicate the dates in which they will be visiting. Imagine this scenario: I want to ...
11 views

Fix Error given by server with gpg command [closed]

I am following this tutorial: Everything worked fine until I did this command: https://www.vultr.com/docs/installing-pritunl-on-centos-7 ...
28 views

Generic router in Rust

I am trying to make a router in Rust using Rocket.rs. I'd like to devise a way to use a default router for my more simple db tables that don't require different logic, to prevent rewriting the same ...

15 30 50 per page