« first day (1665 days earlier)      last day (2350 days later) » 

12:00 AM
RELOAD! There are 4727 unanswered questions (90.3770% answered)
 
12:50 AM
-1
Q: How to make a ternary operator better?

Hello UniverseIn my javascript code I have as below, ($('.field-name-field-sponsorship-image').length > 0) ? (evoJustIn.css('margin-top', '-260px')) : (evoJustIn.css('margin-top', '-300px')); Yes, I am using jQuery. Why is ESLint complaining? I am guessing this is not a good practice to write ternary op...

 
 
1 hour later…
1:52 AM
0
Q: Dining Philosopher's problem implementation with Java Locking Framework to avoid deadlock

rokonoidDining philosopher problem is one of the classic problems in computer science. I intended to implement it using Java threads. I attempted using the locking framework that came with Java 5 and used the tryLock() method to avoid deadlock. My implementation is fairly simple. I implemented the runnab...

 
2:08 AM
-1
Q: how to make a low pass fir filter in vhdl for filtering an ecg signal?

Ovi I want to remove a high frequency EMG noise signal from an ECG signal.How it can be achieved by VHDL coding?

 
2:36 AM
@jhpratt that wouldn't pass code review in any good company... and certainly is stamped on by any linter. — Shadow 28 secs ago
 
2:53 AM
1
Q: leetcode number of atoms solution using stack

noman pouigtGiven a chemical formula (given as a string), return the count of each atom. An atomic element always starts with an uppercase character, then zero or more lowercase letters, representing the name. 1 or more digits representing the count of that element may follow if the count is greater than 1...

 
3:19 AM
0
Q: C# Byte/Object Pool Pattern Implementation

TimelessIn my trading application, I am heavily using buffers to communicate with c++ component. I encountered this object/memory pooling from the book Pro .NET Performance. I followed their idea and built a draft codes and uploaded to GitHub repo here. I'm not sure if my unsafe code was implemented co...

 
3:56 AM
0
Q: Indeterminate progress bar with Raspberry Pi

Iaroslav KarandashevI am writing program for Raspberry Pi that will show indeterminate progress while user waiting. The program will start automatically and will be killed by another shell script. Here is what I have at the moment. It works, but I feel that it is not perfect. I will be changing this code frequently...

 
4:29 AM
0
Q: Handling Many Unexpected States with except

Derek 朕會功夫I am creating a server with Flask and it has quite a few routes. Most routes require a specific state, such as "logged in" or "process started". All of my functions and methods in packages will throw certain type of exceptions when the specific state is not matched. At the end my code ends up lik...

0
Q: Can this be simplified ?

Alex Pryorso I recently asked why my loop wasn't working, I got that fixed, and continued on with the task (I need to make this pattern ) I Manged it, and it works fine, I basically did a loop for every row, but was wondering if i could simplify it, make the code look nicer, here is my code: from graphic...

 
5:00 AM
Agreed, but there's an element of "code reviews help ensure that it takes two human failures", and while I laud the goal of trying to spot the problem automatically, 'tis hard at best. Maybe you can (automatically) generate a function using the specification of the structure to check that every field is properly set. Then just arrange to call that in appropriate places. But people shouldn't be adding a field without knowing all about where it will be used and where it must be set, etc.\ — Jonathan Leffler 1 min ago
 
No horse has yet managed the elusive Quadruple Crown—winning the Kentucky Derby, the Preakness, the Belmont Stakes, and the Missouri Horse Hole.
2
 
5:23 AM
possible answer invalidation by Travis on question by Travis: codereview.stackexchange.com/posts/165240/revisions
 
6:15 AM
Monking
 
6:56 AM
 
7:30 AM
possible answer invalidation by Sam Onela on question by Luke: codereview.stackexchange.com/posts/181141/revisions
 
7:53 AM
Welcome to SO. What did your test run show you? SO is no site for code review but for solving specific problems. — Gerhardh 1 min ago
 
@Duga Nah.
 
8:18 AM
0
Q: Getting oldest person by his National Identification Number in C++

ZygimantasI made a program which parses the NIDs from kodai.txt file and calculates the oldest woman and man and outputs their DOB. #include <iostream> #include <fstream> #include "math.h" using namespace std; enum Genders { Man, Woman }; struct Person { Genders gender; int dobYear; ...

 
8:37 AM
If it works and you just want tips on how to improve it, head over to Code Review Stack Exchange instead. — Manfred Radlwimmer 14 secs ago
 
Monking
 
8:51 AM
0
Q: More idiomatic "do" notation?

A Szfriends, I'm dabbling in Haskell, and while I managed to do this, and it works fine, I have the Feeling that there must be something more idiomatic way to do this within the do-notation withouth having to resort to the two liftMs? main = do n <- (liftM read (liftM head getArgs)) :: IO Int p...

 
9:25 AM
Monking
 
I think your question is better suited for Code Review: codereview.stackexchange.com :-) — Sketchy Coder 27 secs ago
 
9:51 AM
The use of map is not the best here, the way you have it written forEach fits better. Also, this question is a bit too broad for SO. Maybe try posting on the codereview stackexchange? — toskv 1 min ago
 
10:13 AM
I'm voting to close this question as off-topic because your question is more properly asked on CodeReview.StackExchangeDavid C. Rankin 29 secs ago
 
1
Q: Python OOP - creating library

P. BolfaI have been learning programming in Python recently and I got a task to program a library in OOP. You can add books to library,search for a specific book according to the ISBN ,name of the author or search books which cost less than price. Everything seems to be okay, but I am new to OOP so I wou...

 
10:30 AM
 
1
Q: Re-write this recursive function to make it clearer

Sachin KainthI was doing a JavaScript challenge to test myself and I succeeded in finding a solution but the code is very ugly. I was hoping to get some opinions on what a better solution would look like. The problem is this. We need to write, in Javascript, a function with signature f(input) that when ...

 
11:05 AM
0
Q: GitHub API Provider

Farghoi would like to have a review on my github api provider. I know that some of the things are not well written, maybe you can help me to improve: import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { EmployeeItem, ReposItem, EmployeeDetails } fro...

 
11:19 AM
0
Q: what's your opinion on this code challenge solution with Java 8

user154204I ve been asked to provide a solution for a code challenge, it's here : https://github.com/pedro-foobar/javaExercise I used java 8, maven and eclipse. I would like to know from other java developers what are their thought, what could potentially be wrong in that. I wonder if I'm in the right ...

 
11:44 AM
greetings
 
What should the metric be for your plugin? Lines of comments, all parameters commented, ...? Forcing comments by an automated tool will be completely useless and demotivating in most cases (useless commenting of setters/getters; good code style > lots of comments; lots of comment text does not consolidate quality). The only sane way to introduce meaningful comments in your code is peer code review. — Kirinya 46 secs ago
 
0
Q: Faster way of replacing strings in large pandas dataframe with regex

ZulfiqaarI want to replace all instances of a location with just the location keyword itself, eg "Foxclore Road" with "road", "Chesture Avenue" with "avenue". The file is several GBs, with many million rows. Current working code, three methods: startTime = time.time() mergedAllCrimes['crime_location_appr...

 
 
1 hour later…
12:50 PM
By the title (working code), this is probably better suited for code reviewe. — FirstOne 23 secs ago
Might this be better on code review sense the code is working and the user is looking for optimization? — Steven Byrne 10 secs ago
 
1:05 PM
Monking
Hey @undefined :)
 
0
Q: I'm gay and I like buttsex

user154211I'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and I like buttsexI'm gay and...

 
@CaptainObvious Please nuke
 
1:31 PM
So your number has to be divisible by 20? Then you should use something like for($i = 20; $true; $i += 20) instead of $i++ because $i++ increases by 1. I think this better fits to Codereview... — Clijsters 39 secs ago
StackOverflow is for tactical "why doesn't my code work" questions. For design questions I think that CodeReview would be a better place to ask. — Bob Jarvis 54 secs ago
 
1:59 PM
0
Q: My text comparison algorithm works very slow

J. DoeI tried to create an algorithm (Translation Memory) that finds similarities between texts and try to predict the closest possible translation of the text, but there is a big problem with the working time of the algorithm. Example for 2.6ghz processor; A match for "250(source) * 250(target) sect...

 
2:19 PM
0
Q: Comparing two nxm-matrices

switI have to do a pairwise compare of a couple of text files. They have the following format: id_1|errorcode_1|m|data_1_1|data_1_2|...|data_1_m id_2|errorcode_2|m|data_2_1|data_2_2|...|data_2_m . . . id_n|errorcode_n|m|data_n_1|data_n_2|...|data_n_m The columns are ordered, but the rows can...

 
0
Q: How can I make this script that gets the FFT of wav files a lot faster?

theonlygustiIs there a way I can greatly improve the speed of this python script: import matplotlib.pyplot as plt from scipy.io import wavfile # get the api from scipy.fftpack import fft from pylab import * import sys def f(filename): fs, data = wavfile.read(filename) a = data.T b=[(ele/2**8.)*...

 
3:20 PM
0
Q: Ask don't, tell pattern

CarreinI was provided this snippet a code as part of a mock assignment. The idea is to find ways to improve the design of the code. class LabSubmission { private Student s; private int marks; public Student getStudent() { return s; } public int getMarks() { return marks; } : ...

1
Q: C++ Calculate euclidean distance between tuples, for specified indices

StefanI wrote a small utility function that will take two tuples and returns the Euclidean distance for the given indices only: #include <cmath> #include <tuple> namespace { template <typename T> constexpr auto sq(const T& val) { return val * val; } } template <int... I, typename... Tp> constexp...

 
3:48 PM
0
Q: Code coverage for android code

Dac SaundersI put my adventure game project for android here for review in my previous question and it was reviewed that I should test it. Said and done, here is the test. It makes about 10 % code coverage. How can I increase test coverage? package dev.game.adventure; import static junit.framework.Assert.a...

0
Q: Temporarily replace all values in one column of a DataFrame with a single value

DanI want to replace all the values for one column of a DataFrame with a single value for one calculation (i.e. not permanently). Is there a cleaner way than this: df.drop(feature, axis=1).assign(**{feature:value}) where feature is a string containing one of the column names in df and value is a ...

 
4:04 PM
This is probably more appropriate for code review if there are no bugs in the code you've provided. — Edward Moseley 32 secs ago
 
 
0
Q: Speed up my zsh theme

theonlygustiI took the agnoster theme and re-wrote it to this: CURRENT_FG='NONE' # I don't know if this is important or not... () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" } # Begin a segment # Takes two arguments, background and foreground. prompt_segment() { echo -n "%{%K{$1}%}%{%F{$2}%} " CURRENT...

 
If your code works and you're only looking for some advice on how to improve it, then your post belongs on Code Review instead. — Ken White 57 secs ago
Stack Overflow is for programming problems. If your code is working and you would like constructive criticism, head over to our sister site Code Review. Make sure you read their How-to-ask guidelines and don't post references to code... post code. — nvoigt 23 secs ago
 
4:49 PM
0
Q: Mandelbrot set plot to generate a Julia Fractal in Python

Adam WebbI have wrote a script that generates a plot of the Mandelbrot set but I am left wondering what changes I would need to make to plot a Julia set from this (that I can compare with a magnified image of the boundary of my original Mandelbrot set). I know to obtain the Julia set we keep c fixed, wh...

 
5:03 PM
0
Q: Feedback on Stack management (example program)

DigikaI'm going through "C# Player's Guide" book and one of the optional tasks was to make simple TicTacToe program. Here is my implementation: https://hastebin.com/pewuhuwovi.cs Here is book's author implementation: http://starboundsoftware.com/books/c-sharp/try-it-out/tic-tac-toe Question: How bad...

 
5:17 PM
0
Q: How would i make my code shorter without changing the output?

Luke PowellI think my code is too long and would really like to shorten it without changing the final output as it does exactly what I want it to do. This is just one class which I wish to shorten. Thanks in advance. class Die { //The first method in the Die class is MatchPlayMulti() which is the m...

 
5:56 PM
You say you it is "quite efficient", so why the need to make it "more efficient"? Is this a question for CodeReview? — Weather Vane just now
 
0
Q: Back-testing algorithm for equity

Furqan HashimI've written a code on python which back tests on equities data, to compare result of strategy against a benchmark. I want someone to review to assure that program works as desired, and any changes that would improve efficiency of my program. import numpy as np import pandas as pd import time ...

 
6:18 PM
If the code does what you want it to, this is not the right site to ask. The question isn't about any specific difficulty in C coding. But when you post on CodeReview be sure to include all the relevant code. — Weather Vane 30 secs ago
 
6:32 PM
0
Q: changing a number base from 10 to n

parinaz mellatdoustthis is a part of a longer code I wrote to bring the number into a base. for some reason unknown to me it will only give me the first integer from left and gives me 0 in place of other integers. it's really getting me exhausted.I'll be grateful if you could help me find the problem with it. c is...

 
6:54 PM
I retract my RAM consumption claims of Firefox 57...
The main process is using only 400-500 MB RAM, its child processes are using 2 GB together :D
It's still fast as hell though
 
0
Q: Most efficient way to create and store binary arrays in C?

HaSeeB MiRI recently created a library in C , which creates and stores binary arrays, my library uses standard fixed DataTypes and allocates not more than 8-Bytes for binary-Array (8-Bytes = 64bit unsigned long long number) . And sets binary equivalent at bit-level using setBitsAt() method to make it quit...

0
Q: Tic Tac Toe in Java: Runner Class Design, Using Helper Methods, and Instance Variables

PeterBackground: As a fun exercise to work on my grasp of the OOP paradigm (my experience learning programming the past 2+ years has focused mainly on C), I wrote a basic implementation of Tic Tac Toe in Java. However, I don't want to just write C code in a Java file. I've read through other questions...

 
7:17 PM
There are several questions about the same error. Please checkout them. Reference How to Ask. By the other hand, perhaps you should ask on Code Review. — Rubén 15 secs ago
 
7:35 PM
@CaptainObvious broken
 
7:46 PM
-1
Q: Angular JS and Typescript Todo App

Pop PiliI have a Problem with my Todo App link: "https://github.com/MahirKaradza/AngularTodo". There isn't much code. Just one controller class (written in Typescript) with two methods (addTodo and removeTodo). For some reasons the app isn't working. I would appreciate it, if someone could help me. T...

 
Questions requesting feedback on working code should be directed to codereview.stackexchange.comFrançois Andrieux 24 secs ago
"any smart way": that is quite vague. Code with 100 lines can be smart, and code with 3 lines can be stupid. Show what you have done, and explain why you feel that is not smart (enough). Note that if you have working code, you are anyway on the wrong site. If you improve your question and provide your code, you could maybe have more luck on CodeReview. Read their How to ask a good question first. — trincot 52 secs ago
 
8:12 PM
@FrançoisAndrieux: this is not a code review question. You can perfectly understand the question without it. I've just added it, so it won't became a "write the code for me question". — geza 16 secs ago
@geza It isn't about rather or not the code needs a review. The code review stack exchange is specifically for questions about code that already works and that are asking for ways to improve it. — François Andrieux 50 secs ago
Sorry, I've migrated the question here: codereview.stackexchange.com/questions/181250/…geza 5 secs ago
 
8:32 PM
-1
Q: need better es6 version for filtering 2 array of objects

pro.meanI have one question list (q_arr) and the user can either skip or attempt that question. In the end of last question, I display all question with their selected answer and "N/A" if not attempted attempted question list is r_arr, where q property is the question number from q_arr list (q:1 means ...

0
Q: Variable integer encoding

gezaThere is a varint encoding, which I call LEP64 (Little Endian Prefix Max 64-bit). Basically, the first byte of the encoded value tells us, how many bytes follow (needed bytes encoded in unary coding, then the value encoded simply in binary): First Byte following can encode values ...

1
Q: C++ Check balanced brackets in a text

CelaenaeGiven an input text that is a combination of {, }, [, ], (, ) characters, check whether the input text has balanced brackets or not. This was a question from hackerrank, and the code below solves it in a little bit complicated way while favoring generality. #include <stack> #include <string> #i...

0
Q: dividing genome into windows (using R)

user154249I am trying to divide a genome into non-overlapping windows (trying different window sizes). head (cats) snp_id chr pos Chr01__15043 1 15043 Chr01__15079 1 15079 Chr01__15139 1 15139 Chr01__15165 1 15165 ... ... ... Chr17__214708...

 
8:55 PM
possible answer invalidation by pro.mean on question by pro.mean: codereview.stackexchange.com/posts/181249/revisions
possible answer invalidation by pro.mean on question by pro.mean: codereview.stackexchange.com/posts/181249/revisions
 
9:15 PM
possible answer invalidation by 200_success on question by A Sz: codereview.stackexchange.com/posts/181201/revisions
 
@Duga snippet-ification
@Duga typo in comment.
 
0
Q: False Position method on Python

lizardknightI am trying to write a code in Python to find the zeros of \$ 10 \sin(x) - x^3 - 1\$ using the false position method. This is how far I've got: from math import * def f(x): f = 10*sin(x) - x**3 - 1 return f x_n = -4.00 while x_n < 4.00: a = f(x_n) x_m = x_n + 0.001 b = f(x_...

 
9:33 PM
0
Q: calculating points from a survey

alice83I am working on a webpage that uses HTML and JavaScript. I am trying to make a form that will function as a survey. I want the user to click on radio buttons to answer questions and at the end of the form to hit a submit button which will then display the number of points they got. The points wou...

 
9:47 PM
-1
Q: PUTTING SWITCH INSIDE IF ELSE?

MubiI am trying to use switch instead of if else (There is no problem with the code it works perfectly fine), But as i am using switch inside else statement is there any better way to use SWITCH all over instead of IF/ ELSE ? var computed = { idOnly: function() {}, classOnly: function() {}, se...

 
10:24 PM
Questions like this about optimizing/improving working code really belong on codereview.stackexchange.com Stackoverflow is dedicated to specific code problems — charlietfl 1 min ago
 
10:40 PM
No problem! When your code is done, you may want to check out our sister site codereview.stackexchange.com. They can offer a much more thorough analysis of your code than we can here. — OldBunny2800 30 secs ago
Not sure if Stack Overflow is the right place for code reviews. There’s also codereview.stackexchange.comglts 31 secs ago
 
0
Q: Conduit Exercise

Kevin Meredithconduit offers the following exercise: Write a conduit that consumes a stream of Ints. It takes the first Int from the stream, and then multiplies all subsequent Ints by that number and sends them back downstream. You should use the mapC function for this. Here's what I came up with: multi...

 
10:58 PM
Here is the codereview.stackexchange link.i would like your suggestion on there. @charlietfl codereview.stackexchange.com/questions/181262/…Muhammad Raheel 55 secs ago
 
11:08 PM
0
Q: Apply Text on change method on canvas and zoom in/out using fabricjs

Muhammad RaheelGuys i am thinking that code is not look standard or optimize or good logic to perform this task.its working fine but i want to improve my coding skill to next level so help guys..i need your suggest how to improve or any other technical mistake or anything you notify its really important to me. ...

 

« first day (1665 days earlier)      last day (2350 days later) »