So my code works as intended, but suffers major performance issues every time I add a new object to the screen. The speed of my objects basically gets cut in half.
All you have to do to observe this is run the code and hit spacebar to create a new object. it is suppose to represent a productio...
If the code is correct, but just needs performance improvements, it should be on Code Review, not here. Note though that they require working, complete code. — Carcigenicate43 secs ago
Today I started learning C++ and at the end of the day have made a simple generic matrix class. I'm looking for feedback on techniques and features. It's still not complete, though. But everything works!
I put some functions outside the class and inside a namespace because I was trouble defining...
I have little experience with coding, and I have this problem solving the Comma Code problem in chapter 4 of the book.
Instructions: Write a function that take a list value as an argument and returns a string with all the items separated by a command a space, with and inserted before the last ...
I have created a basic web page that contains a panel which displays some details about an object, and a panel which contains some tiles that are used to choose which object to view. The idea is straight-forward, and with plenty of C# experience, the learning curve was small. However, since I am ...
I'm voting to close this question as off-topic because code that works and should be optimized makes a great question for Code Review. — Klaus D.35 secs ago
I'm writing a loss function for a linear classifier. The function takes in several arrays and outputs the loss. 's' is a score array which contains 10 entries that are the scores for each class. y is the array that contains the correct class assignments. My loss function takes the max of 0 and th...
I have an exercise that ask to plot the prior and posterior distribution in the Poisson-Gamma model. I did it (I think it's correct) inspired
in the answer of this question https://stats.stackexchange.com/questions/70661/how-does-the-beta-prior-affect-the-posterior-under-a-binomial-likelihood
Is...
I am writing a code for the Krikwood-Buff Integrals which has the formula as: https://i.stack.imgur.com/lMtie.png
import os
import numpy as np
import matplotlib
from matplotlib import pyplot as plt
A = np.loadtxt ('abc.dat')
B = open('1.dat','w')
r = A[:,0] #r is the 1st column (ie., x-axis valu...
I have built a small maze game in which you have to navigate to the end before the 10 second timer runs out. The timer works fine and restarts the game if you run out of time, however I have tried numerous methods to update the textview with the timer but all of them cause the app to crash upon s...
Please read this stackoverflow.com/help/how-to-ask. First of all stackoverflow is not for questions like ”why doesn’t my code work”, second: your code had a simple error that a read through would have caught and the solution will not help anyone but you, third: there is a stack exchange for code review codereview.stackexchange.com and lastly: even though you didn’t follow any of the community guidelines, you still got the help you wanted. Don’t be ungrateful — SimonF52 secs ago
I have been developing an API for my product for the first time. I am bit confused whether the way I have designed the endpoints are correct or not.
For example, I have a POST endpoint when updates a record when called and it is like so.
/testRunResults/status/{projectID}/{testRunID}/{resultID}...
Is it better to do
Result = random(36)
Dice1 = Result/6+1
Dice2 = Result%6+1
Or
Dice1 = random(6)+1
Dice2 = random(6)+1
Would there be more bias on second option or first option
So, to start off, the below code does work, but it feels like a newbie solution to me, and if I ever need to come back to this code, I will have no idea what I was thinking.
I have a table called incomes with a model Income, and one of the columns is called description_id. If the description_id ...
I am using a panda's dataframe and I am doing filtering and some calculations per column and per row.
The dataframe looks this:
100 200 300 400
0 1 1 0 1
1 1 1 1 0
Each header of the dataframe represents a company ID (x) and the rows represent specific users (y)...
How can I avoid the unchecked cast warning when using generics when IDE is too dumb to realize I actually checked it?
Before I submit a feature request to IntelliJ (they really have the best inline static code analysis I've ever seen, but it's never enough)
This is my current code:
((Collection<?
I'm writing a helper library that would be able the client to configure Serilog sinks to write logs into several sources. For example, in case of I need to write into console and to some source by tcp in Program.cs file of dot.net core web api I could configure it as follows:
public class Progr...
I have several (12) WCF services which are structured like this:
I have inherited a very large 10-year-old project, I've introduced some inheritance so that I can have 1 echo method where I can control the timeout and not have duplicate code everywhere.
The PostalAddressFinderServiceService (Sh...
I have an alternative solution for family tree that have been posted some time ago and please forgive the similarity of the task but when i tried to post alternative solution in someone else's post and asked for review I got deleted.
Model the family tree such that:
Input:
Person=Alex Relat...
I am in the second week of my first-ever python (and coding generally) class, and one of the assignments is to count the number of occurrences of a specific letter (variable is letter) from an external txt file that we created. When using file.read(), the output showed the entire text. However, w...
I have two processes. First (main) one is "dealing" with user stuff. Second one is doing some internal stuff and should update its internal state according to user actions. So I've created two pipes. By one I send actions to subprocess, from another I get messages that emits this subprocess.
I w...
@Opsse. The question (in bold) is why it's posted here and not on Code Review. The code is mainly to help understand the question. — svenema52 secs ago
I have a function which does the following:
When new Post Entity is added some fields in Category table are updated.
When new Thread Entity is added the same fields in Category table are updated.
Because of this, some lines are completely the same.
public function postPersist(LifecycleEv...
I'm creating some web apis to sync some data between desktop/mobile apps.
Working on it, I wrote a simple wrapper for mysqli connection to simplify querying like:
// examples
$connection = new MySQLiConnection();
$connection->execute("INSERT INTO songs VALUES ('God\'s Plan', 'Drake')");
$connec...
The following program takes 3 integer inputs(noOfThreadToBeCreate,fromNo,toNo) and print the Consecutive numbers based on the range using different threads e.g (Thread 1 - Print 1, Thread 2 - print 2, and so on ).
I am new to the multi threading and implement this program as per my basic unders...
I have a spreadsheet with five sheets all of which run the same VBA code; everything was good when it was on just the one sheet, but now its running on all five sheets Excel is extremely slow to load and the items take a while to update.
I have a drop down menu in one column and if a user sel...
We use a third party dll which has an object called CServer and was provided by one of our software vendors to act as an API between our applications and their applications.
CServer has the following method:
bool SynchroniseData() which can be called if we want to fetch data from server which i...
I found a trick to significantly reduce the time needed to compute Huffman codes in my implementation of RFC1951. I was slightly surprised to find it slightly improves compression as well, something I had not anticipated.
The trick is to encode the required information about a tree node in a ul...
I have a project that I used to try out in-memory databases. After fighting it for a few days, I'm code blind and need to have it reviewed. Haven't been much on this particular site (I'm well acquainted with SO, though) so I thought better to ask than have this epic downvote and a bucketfull of l...
Here's my solution for the Leet Code's Two Sum problem -- would love feedback on (1) code efficiency and (2) style/formatting. Thanks!
Problem:
Given an array of integers, return indices of the two numbers such
that they add up to a specific target.
You may assume that each input wou...
I'm trying to determine if an instance of an object exists within a collection.
I'm using array_walk_recursive to walk and check the leaves of an array.
I've added a small short circuit, but still all leaves will be iterated over.
I could alternatively use something like an exception which is ...
Why did this recent question: FizzBuzz in Javascript get so many views and presumably more votes? My initial theory was that it contains the tags fizzbuzz and possibly that tag combined with javascript, though I created a related question with those same tags (plus a couple others) and (at the ti...
I recently tried to optimise some code by using parallel processing, putting two cores to work on the problem instead of one.
For whatever reason it didn't work, I don't know why, but I doubt much can be done about the reason why it didn't work, on the other hand posting the failure might save s...
@rob in other words, last seen does not mean I have not seen you since I last saw you. It just means THAT was the last time I saw you. I might see you again in 2 minutes, too. — Jeff AtwoodNov 16 '10 at 2:26
⊙﹏⊙
apparently UPS started allowing customers to see the location of a delivery vehicle with their package(s)
I'm a beginner to programming and I need help with my code.
It isn't currently working and I can't see what's the error of my code.
Thank you in advance.
def Inserction_Sort(array):
if len(array)>1:
copy_array=array[:len(array)-1]
Inserction_Sort(copy_array)
key = array[len(arra...
How can I improve that? Hard to say. What work you are assigning and how you are assigning it to the threads has not been documented in the question. A Minimal, Complete, and Verifiable example would probably be very helpful in getting your point across. With a good code example you might be able to take advantage of Code Review. — user458130155 secs ago
I have the following testing suite that I'd like to get criticized and suggested improvements to and weaknesses in.
public class GameTesting
{
private Context Before { get; }
private Context After { get; }
public GameTesting()
{
string name = "test_db_" + new Random().Next();
Be...
I know randomness in programming can be a deep topic, and searching the topic seems to result in Fisher-Yates being the best method, but I'm curious what people would say about this method.
Basically, since I have the cards as objects, I just add a property of a random number then sort the entir...
We have a little tournament in our company between coworkers and I decided to write an application for managing games, results and rankings of players and teams.
The base logic for application is quite simple:
We have players.
We have teams, which are formed from players
We have game/s
There ...
Task: convert this array of hashes:
animals = [
{"cats" => 3},
{"dogs" => 5 }
]
to this hash:
{
"cats" => 3,
"dogs" => 5
}
This is my solution, any feedback is appreciated :-)
animals.reduce({}) {|m,e|
e.each{|k,v| m[k] = v}; m
}