instruction stringlengths 71 71.9k |
|---|
I want to shorten my code. You can see the following code i used many function for addClass, removeClass. But it is not usefully. Can do my work in one hover function ? If yes can anyone help me ?
$(document).ready(function() {
$('.star-one').hover(function() {
$('.star-one').removeClass('rate-btn-hover');... |
I have made a simple sliding puzzle/game of fifteen using SDL. I originally attempted this to learn about game states, but it turned into a general exercise in code organisation and SDL use. Therefore, I would especially appreciate comments regarding organisation and clarity, but general suggestions or comments are ver... |
My class has a method that does some stuff, and then wants to recursively operate on some data. Specifically, I'm generating an XML report whose output includes a flat list of elements derived from a hierarchical data structure.
Example Input (a Score)
{'wrapper':True, 'sub_scores':[
{'wrapper':True, 'sub_scores':[
... |
I have the following function count.ones that takes in a data frame data.l in which the observations have been subdivided into bins defined by indices, a vector of consecutive indices x, and the length of the sliding window width over consecutive indices. The goal of this function is to slide over the indices and count... |
In the ROOT framework (originally a C++ framework, but python bindings are also supplied), colors are objects (ROOT.TColor) identified with an integer index.
This short class creates a new such color, given the r, g, b values which stores the object inside an int sub-type (to prevent the gc from deleting it).
#colors.p... |
I did not add generics to my code because I am new to Java. I am on my way in learning data structures and algorithms. I just want to make sure that my code is clean and efficient.
package Double_LinkedList;
class Node{
int data;
Node prev;
Node next;
void setData(int data){
this.data = data;
... |
An easy to use type feature that uses the placeholder attribute and setTimer to give the effect of a user typing. Helpful if you need to draw attention to the search box field.
I'm looking to know if this type of implementation would be a performance impact or cause browser lag. Help in making this more condensed would... |
I work for a service desk and change A LOT of passwords. Most the time the end user is a complete fool that doesn't understand the requirements for the password they want to use. So I created a program that will generate random passwords based on a randomness level (1 - 3).
Here's how the levels work:
Reads the passwo... |
UPDATE: I have refactored the code into a Gist using @Dmitry's answer as a guide. The update is much simpler to grok, implements IDisposable, and is roughly thirty lines shorter.
I wrote this over the weekend for fun and am looking for critique. Style and readability comments are welcome but what I truly need to know ... |
Playing off Robust Bubble Sort in VBA and as suggested by @Henrik, I took a look at comb sort and tried to create an algorithm based on the documentation solely on Wikipedia.
Basically, the first procedure is just for the testing:
Take a string of numbers and create an array
Sort the array ascending or descending
Bu... |
I have a project for which I need to parse BibTeX strings. In v0.2.9 and before, I used Regex, and I want to change that. I set up a while loop system that reads the file char by char, but it seems slow.
I wonder if there is a better way to use while loops, or to parse in general.
Note: I'll worry about escaped charact... |
Inspired by the learn you a haskell exercise to express map with fold I wrote an implementation of scanl by means of a fold.
scanl2 :: (b -> a -> b) -> b -> [a] -> [b]
scanl2 f z xs = reverse $ foldl (\a x -> (f (head a) x): a) [z] xs
I have the idea that in terms of performance it kinda is up to par with standard sca... |
I'm trying to make my code smaller and less verbose.
The pass in the if statement are there because I need to check specifics on the dice roll.
The code is running a game of craps where on the first roll if I get a 7 or 11 I win, or if I get a 2,3,12 I lose. Any other number I keep rolling till I either get what I rol... |
That's gonna take long.
This program solves 8 puzzle game (mini version of 15 puzzle) using A* algorithm. Program consists of 2 parts:
Board.java - which serves as a representation for the board (N-by-N grid, not limited to 9 tiles)
Solver.java - as the name implies, this class solves the given puzzle (if it is solvab... |
I recently answered a question
on Stack Overflow about finding the k-largest element in an array, and
present my implementation of the Quickselect algorithm in Swift for review.
This is essentially the iterative version described in
Wikipedia: Quickselect, only that the
paritioning does not move the pivot element to ... |
I know there are probably thousands of INI parser implementations in C.
Nevertheless I want to implement one to learn the art of parsing grammar.
I just wrote a small piece of the INI parser and wanted to ask if I am on the right track:
void parse_line(const char *str, char **name) {
size_t length = strlen(str);
... |
I currently am writing a query which retrieves the max amount of rows for a junction table. I'll use the following example in SQL Fiddle:
MyTable
┌─────────┬─────────┐
│ a_field │ b_field │
├─────────┼─────────┤
│ a │ 1 │
│ b │ 2 │
│ c │ 3 │
└─────────┴─────────┘
JunctionTable
┌──... |
I am new to C, but have experience with Python and R. The following code implements the Game of Life and represents my first finger exercise in C. I would like to have some feedback regarding the coding style and conventions in the C community. (I commented out the two Windows specific lines, in case someone wants to r... |
I made a simple form with an option of adding one text field dynamically on mouse click. And I will be grateful for suggestions on how I may improve the code.
@Controller
public class MyController {
public ArrayList<NewField> fieldArrayList;
@RequestMapping(value="/create", method= RequestMethod.GET)
public String myF... |
Given an integer , print the next smallest and next largest number that have the same number of 1 bits in their binary representation.
How can I improve this?
void printNextNumber(int num){
int inputNumOfBits = calcBits(num);
int nextLargest = num + 1, nextSmallest = num - 1;
//nextLargest
while (tru... |
This solves Project Euler #11: In the 20×20 grid below, four numbers along a diagonal line have been marked as bold.
08 02 22 97 38 15 00 40 00 75 04 05 07 78 52 12 50 77 91 08
49 49 99 40 17 81 18 57 60 87 17 40 98 43 69 48 04 56 62 00
81 49 31 73 55 79 14 29 93 71 40 67 53 88 30 03 49 13 36 65
52 70 95 23 04 6... |
I am required to write a simple matrix program and swap the diagonal.
Given the input
1 2 3
4 5 6
7 8 9
After swapping the diagonal it should be
3 2 1
4 5 6
9 8 7
Here is my code:
public static void main(String[] args) {
int i,j = 0,m,k;
int Number[][] = new int [3][3];
Scanner scanner = new Scanner(Sys... |
This is a program to solve: Images with all Colors from Code Golf:
Make images where each pixel is a unique color (no color is used twice
and no color is missing).
Create the image purely algorithmically.
Image must be 256×128 (or grid that can be screenshot and saved at 256×128)
Use all 15-bit colors (15-bit color... |
The visual board game is currently a game in unity, where I've created a map and a grid. The visualization is like this:
Making this code obviously needed nested for loops and the like, but developing this I mainly had the attitude "just go with it", which means I now have rather confusing code.
I have created a class... |
Is there any other way to write this separation?
public Parent Method()
{
Parent parent = new Parent { ChildA= new List<Child>(),
ChildB= new List<Child>()};
List<Child> allChildren = _manager.GetChildren();
foreach (Child child in allChildren)
{
... |
I was inspired by this answer and the explanation and decided to support negative numbers. While testing, I noticed that the solution didn't handle the case with one number in the given range. A quick way to fix it was just adding
else if (a == b) {
return 0;
}
Here is what I have:
package xor;
public class Xor ... |
I am working with a lot of DOM manipulation and need to know several values of an element to determine its position within the DOM and I have written the following to help scrape several of the bits of information I need to proceed.
To me this looks very heavy and there might be some room to help improve the speed / ac... |
There's a need to have a mechanism in place that will process messages received from the network concurrently. However, only X number of messages can be allowed to be processed concurrently and there's a restriction: Similar messages must be processed sequentially. For simplicity's sake, similarity can be identified by... |
Can someone please review this algo and say if it has some weak places and/or what kind of algo is this (caesar, block etc)?
std::vector<unsigned char> TestCryptDecrypt(const std::vector<unsigned char>& data, const std::vector<unsigned char>& key, bool decrypt)
{
std::vector<unsigned char> result;
unsigned int ... |
I've got a database table in my application called "periods". The structure of the table is:
Year (Number)
Month (Number)
Period (Text)
The Year column stores years (Say, 2016), Month stores months (1-12), and period stores the period of the month/year - eg; November 2016 = 11/16, so period = 1116.
In the table, it s... |
I call many dataframes (using pickle), then I extract the interesting values of each one and finally combine them. Is there a better way to do it? For example with a for loop call them automatically instead of having to repeat the code many times?
#Dataframe 1
df_NB_E = pd.read_pickle('/Dataframes/Total Accuracy NB_E... |
My .htaccess redirects everything to my index.php, but I wonder if it's vulnerable to XSS attacks. Am I safe?
.htaccess file
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*$ index.php/$1 [L]
php_value auto_append_file none
index.php
<?php
require_once 'dbliteconnec... |
I work mainly at developing MSSQL databases but I've been trying to teach myself C# for a bit now and I wrote some simple code that prints a list of colleagues and their coffee preference.
I just went through it with my precarious knowledge and I can't find much more to add or remove from it, I thought maybe I can pos... |
We were given a homework assignment to create a C++ program that generates 3 different random numbers each time and the user is supposed to guess the three of them AND in order. I already achieved that, however I'm not very satisfied with how long my code is, especially with the fact that I had so many if statements. W... |
I was working on adjusting some variable naming on an Excel project and ran into an issue that the MSForm control names needed to be updated. When you change the properties of the control on the form, the underlying code for the form doesn't seem to update accordingly.
Examples:
You rename btn_button1 to btn_populate... |
I've been working on a simple neural network implemented in python. Currently, it seems to be learning, but unfortunately it doesn't seem to be learning effectively. The graph below shows the output of my neural network when trained over about 15,000 iterations, with 1000 training examples (it's trying to learn x2). Th... |
This code iterates through the table @Table1 to get the Purchaser, PurchaserID, SaleID store the values in a variable, then queries a secondary table to get data for the specific purchaser. 2 different data sets (one for daily, one for weekly) checks if a folder for the purchaser already exists. If not, it creates the... |
I have some elixir code I am using to score a ping pong game. Since I am new to functional programming I was hoping there might be a more elegant solution to this.
This part of the code is used in a GenServer to check if the next point could result in a win. So that means will the leading players next point meet the mi... |
Is there an alternative possibly cleaner way (without so much repetition) to write the following? I'm thinking about the headache it's going to be when I have to remove all of my even listers.
customCursor() {
const prevButton = document.querySelector('.previous');
const nextButton = document.querySelector('.next');
co... |
I've used multiple tutorials to get the exact look for show/hide using jQuery, but now that I've done it's too repetitive, I've tried to edit it using variables, but it didn't work. Is there a way to avoid repetitiveness here?
$(document).ready(function() {
$(document).click(function(event) {
if ($(event.target).... |
I have a number of functions that follow the basic pattern below. The intent is to provide a MongoDB implementation for a storage interface in a TypeScript application.
Is there a better way to clean this up so that is is simpler or more readable?
find(collection: string, query: any, sort = {}): Observable<[SyncedObje... |
As a programming exercise I made a square root function in C# using recursion, here is the function:
static double root(double x, double increment, double num)
{
num += increment;
if ((num * num).ToString() == x.ToString())
return num;
else if (num * num < x)
return root(x, Math.Abs(incremen... |
Would you consider this to be idiomatic Scala? If not, what would you do to improve it?
def fibonaccis(max: Int): List[Int] = { fibonaccis(max, 2, 1) }
private def fibonaccis(max: Int, prev: Int, prevPrev: Int): List[Int] = prev >= max match {
case true => List[Int](prevPrev)
case false => prevPrev :: fibonaccis(ma... |
I recently published a library for advanced awk-like file manipulation in Python 3. The code can be found here and here is the documentation. It is also available for download from pip (pip install awk). I would like to know if the code is well designed and how it can be improved to enforce readability and code reuse. ... |
I am almost completely done with this program. Now I just need to figure out how to use tkinter to put this in a GUI but here is what I have thus far. Constructive criticism is always welcome.
another_word = " "
sentence = " "
new_list = [ ]
def global_reset(): #I had to do this function to reset the variables becau... |
I recently learned how generators can be infinite in Python. For example, the infinite sequence can be the triangular numbers:
$$1, 3, 6, 10,...$$
def triangle_stream():
""" Infinite stream of triangle numbers. """
x = step = 1
yield x
while True:
step += 1
x += step
yield x
I ... |
I'm trying to solve a Hackerrank problem where you perform k array[n] rotations, and at the end, ask for m and print array[m]. My program is probably correct (it runs perfectly for most of tests, but some of them terminate due to timeout), but is inefficient and I don't know how to improve it.
#include <math.h>
#includ... |
I want to make some kind of file vault. I want to store encrypted files in a MySQL table, and the key to encrypt/decrypt them is never stored but only known to the user (that's the goal, anyway).
The user has to be logged in to view a list of his files. Then, to view a file, the user has to enter a key to decrypt a fil... |
I have posted here my working and accepted solution to the intepreter programming challenge (detailed here) for your review. The challenge is as follows:
A certain computer has 10 registers and 1000 words of RAM. Each register or RAM location holds a 3-digit integer between 0 and 999. Instructions are encoded as 3-dig... |
I pretty sure it should be shoter solution.
(defun modulename-vinlist(val lst)
"Check if value in list"
(let ((res "no"))
(let (vv)
(dolist (pi lst vv)
(when (string-equal pi val)
(setq res "yes")
(return))
(setq vv (cons pi vv))))
(when (string-equal res "yes")
... |
The code below is loading an svg into the canvas via RaphaelJS. There are mouseover/mouseout events, on click on an element of the svg, and drag/zoom.
I would like to know, what are some good practices, or how to improve the productivity and maybe shorten my code. One issues may be that I use a lot of iterations throug... |
Here is the pseudo code used inside a Rails controller:
defined_hash_10000_records.each do |data|
account = Account.where(account_identifier: params[:account_id]).first
program = Program.where(program_identifier: data[:id]).first
unless participant_account.present? || utility_program.present?
# this i... |
I'm using the following code in order to cite the images used in my android apps. My main concern is to never accidentally present an image as if it were mine, while it's not.
Questions:
The images I created are separately stored from third parties' images. The code in ignore_build_ensure_images_cited.py is run every ... |
I have an Android application which needs to retrieve JSON files from a server and then display the information in my app. To accomplish this I have the following architecture:
The main activity adds a job to the job queue requesting certain information from the server.
The job gets run, retrieving the specified info... |
I was given the following code challenge as part of an interview process, unfortunately I did not get through to the next stage. Any advice on how I could improve would be very much appreciated.
Here is the spec:
Our client is an online marketplace, here is a sample of some of the products available on our site:
Produ... |
Below stored procedure implemented for filtering and sorting operation.But number of table column increases below query becomes complex to read/maintain. This is good for small tables.
I want to modify the below one by using dynamic sql query. I will pass the parameter from front-end to here.
CREATE PROCEDURE [uspProdu... |
I've been learning Python for a few weeks and I created a simple game where you convert binary numbers to decimal. It shows you n binary numbers and you are supposed to enter the numbers in decimal system in sequence as a password. After failing three times you lose. I'd like to implement it into a bigger game later.
H... |
Firstly, would appreciate some code-review feedback, from a TDD and design perspective.
Secondly, what are your thoughts on implementing test case: testNumbersAreUnique()? The fact that API returns a Set of immutable objects means elements will be unique, but just wanted to know your thoughts. The reason I used a do-wh... |
I have a c# WinForms application in which I have tried to implement the Model View Presenter pattern with Passive View. The View derives from a parent IView which propagates the public members and events of the View to its Presenter. In this way, the Presenter can utilize these field and react to the events without rel... |
I recently found the Google Foobar challenges and am having a problem with level 3. The goal of the task is the find the minimum number of operations needed to transform a group of pellets down into 1, while following these rules:
1) Add one fuel pellet
2) Remove one fuel pellet
3) Divide the entire
group of fuel ... |
Write a function setbits(x,p,n,y) that returns x with the n bits that begin at position p set to the rightmost n bits of y, leaving the other bits unchanged.
#include <stdio.h>
unsigned setbits(unsigned x, int p, int n,unsigned y);
int main(void){
unsigned result=setbits(0, 4, 3, ~0);
printf("%d\n",result);... |
I have question regarding online PCA implemented in the paper. I am interested in the Algorithm 2. I am not certain if there is a bug in my code can someone confirm if my code is correct? The algorithm is as follows:
input: \$X\$,\$\Delta\$
\$U\leftarrow\$ all zero matrix (dimensions are not given in the paper , ... |
Scope is to throw any mail, html or plain or multipart into this and receive a readable formatted text that deals with special characters and html issues. Field of usage: System that imports mails into a mysql db, or prints them to pdf etc.
What can I improve here?
import imapclient, pyzmail, html2text
"""
Connect to... |
I have this simple IDE for playing with Brainf_ck. It has no file functionality; only the code, input and output fields are present, and the "compiler" is integrated. Here is how it looks like:
My code is as follows:
App.java
package net.coderodde.brainfuckide;
import javafx.application.Application;
import javafx.app... |
I am a beginner in Pygame (and programming in general) and tried to make a Flappy Bird game. It works fine, but I'm sure the code has a lot of scope for improvement. It is completely procedural, and while I do want to make it object oriented to clean it up, I'm not sure how to go about it.
For example: Bird will be an ... |
This code acts as an infinite generator of prime numbers.
As new prime numbers are found, they are added to a set. Then, a number x is found to be prime if none of the numbers in the prime set are factors of x. Only the primes less than or equal to the square root of x need to be checked.
import itertools
from math im... |
I'm solving a programming challenge that essentially consists of finding the highest product of elements in a set.
This is my current solution, and is passing all the test cases but one. The test case that is failing is not available to me, so I kinda have to guess what is wrong with my code.
public static String sol... |
This is an exercise in using ReactiveX in Python. I want to create an Observable in RxPy with the following characteristics:
Emits items through a custom function
Runs asynchronously
Sets up resources upon start and it cleans up at the end
Runs a loop indefinitely (until cancelled)
Can be cancelled
Shared among observ... |
I'm thinking of making a little strategic game using tkinter (player should interact with it using buttons). But my code is very repetitive. This is a mock-up of my program:
import tkinter as tk
import random
def multi(*args):
for func in args:
func()
def show_hide():
if not button["text"]:
... |
I am working on creating a scheduler which will connect to cassandra database and extract data from few tables and store it in few variables. Then from my main thread I will be using those variables by calling getters on them from CassUtil class. Basically, I will cache the result in memory and then from a single backg... |
Basically, this code does multiplication of chosen operations.
public static String[] gen8String(String[] pattern1, String[] pattern2){
String[] combinedSubset = new String[90]; //emty array for the subset of 90 strings
String combinedString = ""; //string holder for each combined string
int index = 0; //u... |
I have posted my solution to the jolly jumpers programming challenge(detailed here) for your review:
A sequence of n > 0 integers is called a jolly jumper if the absolute
values of the differences between successive elements take on all
possible values 1 through n - 1. For instance,
1 4 2 3
is a jolly jumper, bec... |
Is my implementation correct (it is matching this result)? How can I improve this code?
public class Parzen
{
public static double Variance(IEnumerable<double> source)
{
double avg = source.Average();
double d = source.Aggregate(0.0, (total, next) => total += Math.Pow(next - avg, 2));
... |
As a programming exercise, I decided to make a prime factoring function using recursion:
static bool isPrime(int n)
{
if (n < 2)
return false;
if (n % 2 == 0)
return (n == 2);
int root = (int)Math.Sqrt((double)n);
for (int i = 3; i <= root; i += 2)
... |
I am trying to come up with a minimal example of what is known as callback hell in JavaScript (so this would be a bad code review I guess). This is what I have so far, and I would like it to also run without making external requests. I'm not sure if that's possible or if this example is hellish enough (do I need to int... |
I was told the function "hompage" was too clunky to conveniently make a tableview. The cells will have the information in "PHOTO ALBUM ICONS" and "BUTTON ON TOP OF PHOTO ALBUM ICONS".
import UIKit
import Cartography
import ChameleonFramework
class ViewController: UIViewController, UITableViewDelegate, UITableViewData... |
I'm sure this game gets put up here all the time but I'd appreciate it if you could have a look over my code and give me some suggestions on how to improve it.
Here is a live example so you can play the game and here is the code on GitHub if you want to fork it and tinker with it.
(function(){
/*
* Rock, paper, sciss... |
The purpose of this code is to create a GoogleMap using PHP, add markers to it according to Place objects from database, add infoWindows for these markers. While reading about Factory pattern I came up with the following solution. What are the parts that can be improved. Thank you.
Factory for creating markers:
class M... |
My code is attempting to implement FP in an efficient / readable manner into some of my video games. I realize this may be a bit subjective, but I feel there is enough merit / objectivity to be of benefit to the community.
Why I'm asking for a review:
I'm not sure that my code is executing FP / procedural principles in... |
In this post, I asked a question regarding how to create a matrix of integers where elements in each row satisfy a particular property.
The notation in the original post is a bit cumbersome so I will try to explain the question in a nutshell. I have a vector of integers cvec, which has length l-1, and I enumerate all ... |
I'm calculating the GS1 SSCC codes that are 18-digit barcodes. The 18th digit is a check digit which is used to validate the rest of that code and check that it is correct. the check digit is a number between 0-9 and is calculated using a specific algorithm on the preceding 17 digits which are the input for this code. ... |
Hopefully the final chapter of my ForEachAsync code review. The original question was the starting point and the second question contained modifications suggested in the original trying to ensure I was handling cancellation and exceptions correctly. The second question also contained my test scenarios (in pseudo code... |
So the program will take input of a series of 9 integers which indicate which square was played on each move. Player 1 is always X and player 2 is always O. Player 1 plays first. Move 1 is first and Move 9 is last, sequentially.
The board looks like this
1 | 2 | 3
---+---+---
4 | 5 | 6
---+---+---
7 | 8 | 9
Winni... |
This seems to work for me, but I want to make it more secure. I want to see how far I can go without pre-built packages/bundles, so please don't suggest any.
How secure is this? What are some steps I can take to improve it?
In a controller:
public function loginUser($request, $response) {
if (Security::isUser()) { ... |
After seeing this post on StackOverflow, I thought I'd try it out. What I have now is a diamond shape with numbers like this:
1
212
32123
4321234
543212345
4321234
32123
212
1
My code looks like this:
int i, j, k, n = 6, l = 3, o = 2;
for (i = 1; i <= 5; i++)
{
for (k = n; k >= 1; k--)
{
... |
I'm currently trying to find a way to get my program to run more efficiently. If anyone has any ideas on how to optimize my program, i would appreciate it a lot. Also, the output has to display in alphabetic order without any duplicates.
package Palindrome;
import java.io.*;
import java.util.*;
public class Palindrome ... |
Motivation
I have worked extensively with JavaScript and have grown fond of some of its functional aspects. This got me wondering how one could implement the canonical example of a bank account - and a small application using it - in a purely functional manner in ES6.
Code
I introduce three types Account, Shop and Cust... |
In the process of learning Swift, I'm building a lotto numbers generator that generates a random number and appends it into an array, if the number already exists then it should re-generate a random numbers and append that one to the array.
I've come up with this. I want to be able to have a reusable class where I can ... |
I've created the following implementation of a trie in F# as an effort to learn the language. I would like to know what could be done to make it more idiomatic. Any other pointers are welcome as well.
Of particular interest are:
Are my tests sufficient? Is there a better way to construct the tests?
Can the logic for ... |
I'm solving Problem 3 in Project Euler:
The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?
Most answers I found made use of array to store the prime factors and iterate over them to find the greatest one which doesn't seem good.
I'm recently learning js and th... |
I have the following javascript es6 class (along with some functions) that generates an area where you can draw in a page.
class Painter {
constructor(selector, cols, rows, style) {
this.looper = null;
if (!selector)
throw new TypeError("Provide a valid table selector");
this.col... |
I am trying to decide between two designs of a class. The basic difference is the one calculates properties when they are called, and the other when the object is instantiated.
I would usually just take the first one, but the calculations call each other, so when calling all of them, they get recalculated multiple time... |
This Bash program extracts the 20 first lines of each man page present on a system and uses grep to remove lines matching a list of selected terms.
How can I improve the grep part? (something less repetitive, with less pipe but that do the same job)
#!/bin/bash
# generate the list
compgen -c > man
# extract each man ... |
I wrote an x86 assembly function using MASM that tests for whether or not an array is continuous. That is to say, if an array with length n that starts with the value k, all the subsequent entries in the array are k+1, k+2, ... k+n.
I am interested in becoming better at x86 and x86-64 assembly and I'm wondering if I c... |
This is a classic problem with a classic solution and I've seen it a number of times on this site, but I wanted to know what people thought of this C# implementation, as opposed to the numerous C implementations.
Below you'll find the source code, the output of the code and then a link to repl.it, so you can run the co... |
I'd like to form an algorithmic connections between a particular string and and a particular color, in such that each unique string is always the same color.
My particular use case is for a kiosk where each user should immediately notice if someone else is logged in, so my strings are employee first names. Reinforcin... |
Here is some code I wrote as a solution to Programming Exercise 15.3 in Stephen Prata's C Primer Plus, 6th Edition. It is probably worth pointing out that the title of the chapter is Bit Fiddling. The question asks:
Write a function that takes an int argument and returns the number
of "on" bits in the argument. Test... |
I just finished my first Python GUI project, a simple four function calculator. I think I've tested it pretty thoroughly. I'm learning python and OOP, so any critiques would be welcome.
In general, I was wondering if there is a more automated way to generate the number buttons and their actions - it was a lot of copy... |
I wrote a Python script to scan my music library, randomly select 50 songs, and play them in VLC media player. It works great, just a little slow (takes several seconds to launch).
I know that walking through my entire music library (thousands of songs) is a brute force (slow) way to do it. What would be a faster appro... |
I've written a red-black tree in C as an exercise. The tree works and it is not bad, but it is about 10% slower than std::multimap from libstdc++ which I'm comparing it against.
Full code of my implementation is here. libstdc++'s red-black tree written in C++ is here and here.
I'm using the following code to compare im... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.