Your question is both too broad and opinion-based for Stack Overflow. Since you have a perfectly working code and seek for a review, I suggest you post your question at Code Review, with the d3.js tag. — Gerardo Furtado39 secs ago
I have implemented counting sort in C. This program takes its input as integers from command line arguments, sorts the integers with counting sort, then outputs the sorted array.
This is my first attempt at implementing this and I would really like to see what I could do better in this code.
#...
Here I have the code for a 2048 game besides 1 main thing.
import random
import termios
import tty, sys
nlist = [0,0,0,0, 0,0,0,0, 0,0,0,0, 0,2,2,0]
score = 0
def spawnnum():
x = []
for i in range(0, 16):
if nlist[i] == 0:
x.append(nlist[i])
y = random.randint(1...
I'm voting to close this question as off-topic because this question belongs on another site in the Stack Exchange network (possibly code review) — collapsarjust now
I'm working on a d3 project that has multiple sub-plots with updating data. I have a working example below, but I think I might be overcomplicating the update() pattern. I didn't include an exit() because the data is consistent (there's always the same amount of divisions, teams and values).
d3 ...
The given problem: use bisectional search to find the minimum monthly payment to pay off debt after 12 payments (slight. Assume that the interest is compounded monthly according to the balance at the end of the month (after the payment for that month is made).
annualInterestRate=.2
balance=32000...
I am preparing for multi thread interview questions. I don't have much experience on multi thread. I referred some online article to come up with solution. Is this solution appropriated? Any suggestion is welcome.
public class ThreadSafeArrayList<E> {
private final ReadWriteLock readWriteLoc...
@202_accepted Usually when you go down to 5V, it's 5V DC. That means you need more than just a transformer. Do you want a DIY solution or a pre-build block?
This looks suspicious. You probably should create a package. Your run function should get the file name passed as a parameter. Also, your question is a better fit for codereview.stackexchange.com. — Roland8 secs ago
@diagold Hey, I never said that—a code review will always find stuff, that the point :) I'm not very familiar with learning resources but I think PHP Delusions has some nice articles and PHP The right Way is often recommended here. However, none of these are specific to OOP. I think the important thing is that you actually understand the code you write and not just blindly copy and paste code you find in Stack Overflow (clean_str() is probably the case). — Álvaro González37 secs ago
Code Review would be better. But a first guess is the myriad of .Range/.Cells calls - resolving all these range objects is probably the culprit. — Vegard41 secs ago
In this code, I focused more on code readability rather than algorithmic complexity. I didn't really care about the code in the main function because it was just used to test the code. Some of the classes have a D prefix to differentiate them from the regular Nodes.
A few problems in particular...
This is a revised follow-up to this question.
I have implemented most of the suggestions in the accepted answer. I am interested to see what I could improve in my code and what I could do to make it better.
I have implemented counting sort in C. This program takes its input as integers from ...
@talonmies (by definition)[en.wikipedia.org/wiki/… a plain observation of something being wrong is plain criticism , not constructive criticism. I am in the right place and I ask Why is wrong and How to fix it. You just have "observed" that it is wrong. I know it is. That is why I am asking. Otherwise the question would not be fit for SO, maybe codereview. I do not see how its wrong. in the loop I 1) grab the host pointer to the positions 2)malloc the device pointer 3)copy the host to device) 4)copy the device pointer to struct. — Ander Biguri52 secs ago
the java method below is responsible for making a JSON request to a Node.js server. When it makes the json request it returns an array of JSON with the values I need! I state that the code below runs on android and as api json use these: http://www.java2s.com/Code/Jar/j/Downloadjavajsonjar.htm!...
Problem :
Using the C++ language, have the function MaximalSquare(container)
take the container parameter being passed which will be a 2D matrix of
0 and 1's, and determine the area of the largest square submatrix that
contains all 1's. A square submatrix is one of equal width and ...
I recently developed an app as a part of the interview process. The result is still awaited. Since I work alone as an individual developer, my code never gets reviewed. I want to improve my coding style and learn better practices. Using this platform and some sharable code from this interview, I ...
I wanted to implement Dijkstra's Algorithm in an Excel VBA Add-In and built it to be used as follows:
Define a list of paths with distances between points. This list needs to contain 3 headings that are used as flags to pick up where the list is. The 3 headings are !dijk:dat:from, !dijk:dat:to ...
"How can I write my Struct to Firebase?" i have answered your question. For any more questions provide the relevant code and post a new question. If you have found a solution and want some feedback you should post on code review. Iterate through infoProvided, use my answer and you are good to go. — Do256 secs ago
TCP/IP server which controls up to 500 clients. Each client can send a lot of messages to the server. I face perfomance issues and trying to find bottlenecks. What do you think about that part which pinging remote clients?
using System;
using System.Collections.Generic;
using System.Linq;
using ...
i need to process rabbitmq messages with golang with worker style,
is this correct way to process rabbitmq messages with golang?
func main() {
conn, err := amqp.Dial("amqp://guest:guest@localhost:5672/")
if err != nil {
panic(err)
}
defer conn.Close()
for _, q := ran...
I have implemented a little snake game with Javascript and Html. This is my first game with Javascript. I use a Linkedlist to represent the snake. Both code snippets are in snake.js file.
It would be really nice if someone could give me feedback.
LinkedList:
function Point(x, y) {
this.x=x;
...
I was wondering if there is a better, more elegant way to write the following javascript code block:
var searchString = 'ma';
var names = ['Mark Kennel', 'Mary Smith', 'Jane Sue Annet', 'Peter'];
var filteredNames = names.filter(name => {
var words = name.toLowerCase().split(' ');
for(var i...
I have a use case in which I need to check a given value whether it is explicitely True or False:
def stringify(value):
"""Returns the string representation of the value."""
if value is None:
return '-'
if value is True:
return '✓'
if value is False:
re...
I'm writing a class to solve differential equation in python (I know that there is a lot of library but I want to learn .. and so I'm create something almost from scratch)
I would use the generator in order to compute an Integral stepper this:
@classmethod
def step(cls, f...
As in, how sure are you the input is exactly 24 and at what values does it still have to work?
If it's something permanent you want something smaller, but if it's for a test set-up, consider something like this. Doesn't care that much about the input and has 3 outgoing rails.
Way overkill, but hey, for that price on a one-off...
hex_re = re.compile(r'(?<!\\\n)^0[xX][0-9a-fA-F]+', re.MULTILINE)
for path in file_paths:
with open(path) as f:
for event_code in hex_re.findall(f.read()):
yield int(event_code, 16)
My question is... how find_all() per file more efficient than re.search() for every line of the file?
Hello I wrote the following code. It allows me to use objects as keys in a map. I have a constraint though:
In addElement function both arguments must be pointers
// Example program
#include <iostream>
#include <string.h>
#include <map>
typedef struct {
char * name;
} Test;
class Tes...
C++ code version (description copied from it)
gameKeys id is authentication function of an MMO game server. When someone wants to play with friends, he sends request to server, server calls generateId, then gameKeys id and returns it as JSON using encodeJSON to player via API. When a friend esta...
helo,i am a bit green in vba . I want to create a code that allows me to copy and paste my scoreboard plus resize the rows as many times as possible. but only pasting one copy for each run.
Meme: Monking
Originator: Morwenn
Cultural Height: The 2nd Monitor
Background: A morning greeting to the Monkey doing his monkey-business, in other words: monking
Examples: A small chat search
Variations: Monkernoon, Monkevening, Monknight, and the reversed gniknoM sometimes used when one le...
I have a function:
def palindrome(n):
res = [['0']]
for x in range(1, n + 1):
str_x = str(x)
l = len(res)
res.insert(0, [str_x] * l)
res.append([str_x] * l)
for line in res:
line.insert(0, str_x)
line.append(str_x)
retur...
IPDaemon component from nsoftware. I haven't found good example of using this control. I'm developing socket server which can accept up to 500 clients connections each client can send a lot of messages each second. What's the best configs for IPDaemon should be to be good for these requirements? ...
I've recently made a program which generates a (pseudo) random number which is tied to a specific subject to learn for every day of the week. The program generates the numbers the first time it's used and after that every Monday. Currently i'm using only 2 subjects and the program's got only one ...
So I'm writing a program that runs quite a few different tests. Which tests are ran varies based on which UI elements are selected by the user. For example, on one form I have 7 radio buttons and 6 check boxes. For each variation, anywhere from 2-5 different tests are ran. The user is able to sel...
As practice, I have written a prime number sieve in Standard ML.
It works in a pretty straightforward way:
The list of known primes starts with just 2.
Starting with 3, check whether each odd integer is relatively prime to all numbers in the list of known primes (i.e. is not divisible by them)...
I'm voting to close this question as off-topic because it is asking for a review. Please send this over to Code Review and then close this question. — Codexer20 secs ago
As I'm on a pursuit learning to program in C I'm making my trough K&R.
The goal of the exercise is to add a option to the program so that the sorting does not depend on upper or lower-case letters.
What are your opinions on my use of function pointers in this exercise?
Do you see any obviou...
Honestly, I don't expect such rules to be enforced too strongly in most chats. Rules are there to fall back on in case you run into someone being an asshat.
Rules this strict simply can't be enforced strongly on a platform this big.
Welcome to stack! In order to have a good chance at getting an answer, its important to ask a clear and specific question. This isn't a place for asking advice or getting someone else to debug your code (there is a code review section for that). Please try to reform your question to be specific about the issue you are experiencing, for example, what exactly do you mean it will continually redirect? — Jon Church17 secs ago
Hi there! Welcome to stack overflow. Although I'm sure this is a frustrating bug, this is not the part of the site to ask people to debug your code or review it. You can ask this question on the Code Review section of the site perhaps, or if you have a specific question about animation with jQuery, that would be more appropriate codereview.stackexchange.com Have a nice day! — Jon Church5 secs ago
I've not used this site before, I would like to get opinions on the code I've completed for my first 'program' in python. I would like to understand how 'good' it is and where it can be improved, anything that says "you're clearly a beginner and haven't learned xxx" would be helpful.
Background ...
Hello I have asked at another stack and had a poor response to my question.
maybe this is more suited for this stack.
I can not add the shebang #!/bin/bash to a option the app has when opening up a bash script from within the apps capability's and this is the line I need some help with, so if y...
For practice JavaScript I created simple To-do app.
This app can add TODOs and track the number of total TODOs as well as the number of unchecked TODOs.
For this I written 4 functions:
for add newTodo - newTodo(), where I add new todo to todos array
for render list of todo - drawTodoList(), ...
the issue is not in routing. if the scripts is in xxx.js file, your razor code won't work. and Url.Action return action result, not a url, it should be Url.ActionLink. and never try to do your first code, it won't pass code review. — Dongdong56 secs ago
Given the following instructions I have created a function that achieves the requirements. I feel my function is a bit too complex, though it does what it's supposed to. The difficult part for myself was avoiding the equality operators. The only way I could think to solve this is with a bit of ma...
If you have working code but are trying to improve it, maybe head over to Code Review - as your question is, it's hard to really nail down your issue. — BigBen28 secs ago
I have managed to write this piece of code but as I am using it on big data sets it ends up being quite slow. I am pretty sure it would be possible to optimize it but I am very knew to coding and I don't really know where to start.. I think getting rid of the for loop would be one way but honestl...
i don't think you can move the question, but next time you can create similar questions in code review if your code is working but not sure if it's good code :) — Vinit46 secs ago
Hi I am a beginner and have created this bash script that helps that very same Creating bash scripts.
It is no issues on shellcheck.net
The code can be found here. https://github.com/plutesci/Iwanttobash/blob/master/Icode.bash
I would like some feedback from more experienced users. Any sugge...
I have a huge array that I want to group by by category and subcategory. A Book is contained in a shelve. A Shelve is contained in a Library. The output is a list of Library. I cannot change my Book class, but I am free to organize the Shelve and the Library class.How can I improve the grouping? ...
I'm making a shooting game in Python3 with pygame for a practice.
I implemented Shot class, and PlayerShot class and EnemyShot class as subclasses of Shot one. However, since I would like to make shot images rotated, the constructors of subclasses don't look clear though it works.
Then, I would...