@Mast @SᴀᴍOnᴇᴌᴀ This is normally good enough, but with the variance in the graph you should repeat that a couple times (say 5 / 10) an take the lowest. It should make the graph smoother. If you're noticing spikes it could be due to the GC or something. I normally repeat 'all the timings' rather than 'each timing' (if that makes sense) to fix this. (unfortunately it's normally not an insignificant amount of work :/)
In my code, I have to wrap some classes so that I can store them under one type (Normally I would use interfaces/inheritance, but I can't in this case). Here is the code for that:
public interface Wrapper<T> {
default T getWrapped() {
return (T) this;
}
}
Using this, I can wrap a...
If your code isn't working then ask a question about that specific thing. If it is working and you're looking for a review then this isn't the right place to ask. Try codereview.stackexchange.com but make sure to read their help to make sure you make your question on-topic. You should also choose one language tag as C and C++ are not the same. — Retired Ninja5 secs ago
I have the following code:
void record_preferences(int ranks[]){ // Update preferences given one voter's ranks
for(int i = 0; i < candidate_count; i++){ //Cycle through candidates
for(int j = 0; j < candidate_count; j++){ ...
Here is my simple model.
public class Product
{
public String Name { get; set; }
public int Price { get; set; }
public String Info { get; set; }
}
When I use this in viewmodel as following:
public MainViewModel()
{
Item = new Product() { Name = "Coffee", Price = 4, In...
I have two sets of results that I want to combine.
The structure of the set looks like this:
public class ResultSet
{
public IList<ResultItem> Results { get; set; }
}
public class ResultItem
{
public Guid Id { get; set; }
public string UniqueValue { get; set; }
public string Othe...
@d4rk4ng31 No, it doesn't. If the test cases are failing, it's not working as intended and thus not ready for review. Please take a look at their help center. — Mast35 secs ago
I am trying to find if a pair exist in a queue. However, my program cannot run. Here is my code:
#include<iostream>
#include<iomanip>
#include<cstdlib>
#include<vector>
#include<queue>
#include<algorithm>
#include<deque>
using namespace std;
int main(){
queue < pair <int, int> > q;
q.pu...
I’m voting to close this question because it belongs to codereview.stackexchange.com — Anmol Singh Jaggi53 secs ago
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — Tschallacka20 secs ago
It seems that your code currently works, and you are looking to improve it. Generally these questions are too opinionated for this site, but you might find better luck at CodeReview.SE. Remember to read their requirements as they are a bit more strict than this site. — Tschallacka54 secs ago
I have been designing websites with Django for a while and I have also designed various sites. But here is a question that comes to mind at the beginning of any new project:
What is the best a URLs architectural Design that creates both logical and meaningful URLs path as well as plugable apps?
I...
I would like to use this site to review Alloy code. However, I do not have enough reputation on this site to create a tag. However, without a tag I cannot post code ... This seems a chicken and egg problem?
Line 1
Line 2
Line 3
I have the code below:
float H (double t, int Hm[36][36], int Hp[36][36], int Hu[36][36], int t0, int a){
int i,j;
double A=E/w*cos(w*(t-mu))*pow(cos(w*(t-mu)/(2*M)),2);
float H[36][36];
for(i=0;i<36;i++){
for(j=0;j<36;j++){
H[i][j]=Hu[i][j]+t0*(cos(-a*A)+I*si...
I've created a little class which helps me to generalize many query cases. I have a DbService and couple methods in it. Can you please take a look at it and share some criticism. The usage of that tool is really easy to me and I do wanna know how to make it more safe and optimize.
public class D...
@Mast I certainly don't but then I don't know Java. I skipped it in the First Post Queue. I was going to VTC based on the user of 2 classes that weren't defined, but then googled the 2 classes and found they belong in a Java API.
For some reason, I can't change the schema of the tables. So I can only optimize by optimizing SQL statements.
SQL:
EXPLAIN ANALYZE
select "INVOICE_LINE_ITEM"."state_id" as "state_id",
"INVOICE_DESC_CATEGORIZATION"."invoice_desc_categorization_id" as "invoice_desc_categorization_id",
date_part...
I would like to use this site to review Alloy code. However, I do not have enough reputation on this site to create a tag. However, without a tag I cannot post code ... This seems a chicken and egg problem?
Line 1
Line 2
Line 3
This may be a better fit for Code Review since it's code that's working with no errors. "How do I improve this" questions are a bit broad/opinion-based when they're so open-ended. — TylerH29 secs ago
It seems fine and cDU is the right place to make a side effect like this. Unfortunately, the question seems to belong to codereview but there isn't so much to say :) Maybe instead of doing all the stuff in cDU, it can be a separate function and you can call it in cDU. — devserkan20 secs ago
I created a Tkinter app for user-input, and the same types of widgets are repeated on each row. A single row is similar to a slide in PowerPoint because it has an image, numbers, and input text.
Since each row is a repeat of the one above it, I know I could somehow create a "row-object" using a c...
I am looking for an approach regarding one of my projects.
I have a JSON file that includes a template for a survey.
I am planning to usşng Spring Boot and H2 for the backend side.
But I am new in frontend.
I need a quick solution to convert the JSON data template to an HTML page.
Data provided i...
This is my first F# program. It's a simple Rock-Paper-Scissors implementation.
I am looking for feedback of all sorts, e.g. the choice of types (e.g. List vs Array), whether there are parts that could be solved more elegantly / idiomatic, formatting, etc.
open System
let allowedActions = [ "r"; "p"
Honestly I don't find that much easier to read, although it's a good starting point for refactoring. I followed roughly the same process, but pulled out most of the internals. Ended up with three external functions, three locals in the map function, and pretty clean HTML. But since I don't answer OT questions (if anything this belongs on code review) I'll just keep it in my editor and write a blog post or sthng ;) — Dave Newton30 secs ago
I have build a custom table component, but here i am not using a common state for doing the actions. So i am just listing the issues here where i need guidance how to achieve it.
I Search for do in name column, only one results comes up, but if i click on sort, it will sort the entire data, so h...
I'm posting my code for a LeetCode problem. If you'd like to review, please do so. Thank you for your time!
Problem
A game on an undirected graph is played by two players, Mouse and Cat,
who alternate turns.
The graph is given as follows: graph[a] is a list of all nodes b such
that ab is an edge...
@CaptainObvious He thought there were not enough comments.
Napalmd the crap out of it.
@SᴀᴍOnᴇᴌᴀ Just that it runs 3x as fast over here, in FF.
Welcome to CR, this is a site to review working code, which this question does not have. It will get closed in the near future. As it has no code at all, it is not even a good fit for stackoverflow. — konijn2 hours ago
@konjin I know. I am using this platform for code review. You can look at to my profile but in this case, I need some information to find my way before starting coding because I am new in frontend development. — Neslihan Bozer2 hours ago
Sir, you're not allowed to do that. - I know, but can you help me anyway?
@Mast you voted to Leave Open on this yet appear to have voted to close before or after that.... did you pick LO since you had already voted on it? should it be reopened or wait until OP answers questions in comments?
I think you are updating it wrong but I can't help you much further as you said your tried setstste and streams and futures, I think you are using them wrong, but I can't be sure as I don't have access to the full code, and honestly I don't have the time to do a full code review — mFeinstein52 secs ago
@Peilonrayz Code itself is suspect, may not run. Could've been remedied by providing a usage example, but user hasn't logged in since May. Both objective and usage are unclear.
@Mast Hmm, that doesn't sit right with me. (gut feeling only) and I'm too tired right now to properly thing about it. I'll look into it tomorrow if it doesn't get closed
I'm relatively new to Scala and made a small TicTacToe in a functional Style.
Any improvement options would be highly appreciated.
There are some things which I am unsure of if they are made in an optimal way.
Error Handling in the readMove Function
If i should incorporate types like (type Playe...
@Peilonrayz my initial findings are that Date differences in JS only return milliseconds as integers...
so I don't believe I can get them as floats... I might look at a benchmark tool like benchmarkJS , or take you suggestion and average out multiple iterations/runs
@SᴀᴍOnᴇᴌᴀ Yeah, that's making the graph much worse than it otherwise could look. That library that you linked look like it has 'times' and 'cycles' which should work reasonably but it has an API I'm not a fan of
In addition to @FranzGleichmann comment - since you have not clarify what you expected we can't say whether those tests achieve your goal or not. We could discuss style/possible additional tests but that is off-topic for SO as mostly opinion based. If you are satisfied with behavior of your code and need code review - Code Review could be good place to ask for one. If you want something from SO please edit to clarify what you expect/ have problem to achieve. — Alexei Levenkov19 secs ago
FYI there is also a code review stack exchange. Since this is a general coding question and somewhat opinion-based, it may be better to ask there. codereview.stackexchange.com. But you aren't wrong to ask it here :). — Garrett Motzner11 secs ago
@GarrettMotzner FYI the question as stated is unacceptable at Code Review since it does not tell us anything about the context in which the code is used. This would be considered a snippet, thus explicitly outlawed. — Mast36 secs ago
This is my first major project in F#, looking for any critique on how I can make it more standard or more concise.
Some things I feel like I could have done better are the command flag parsing and the actual crypto random generation itself. I do know that crypto generators are slower than pseudo ...
I'm writing an adjacency matrix, in this moment I'm trying to figure out how to indicate a default numeric value for an unassigned edge. There is the macro _I64_MAX but it is said that it's a bad practice to use macros. I wish to know if there's other way to assign such value (as a keyword as in ...
I had an xls file with lots of full names in the following form at work:
+----------------------------+--------------+-----+-----+
| [Full name] | [More data] |[...]|[...]|
+----------------------------|--------------------------+
| Cristiano RONALDO | ... | ... ...