« first day (1622 days earlier)      last day (2694 days later) » 

00:00
RELOAD! There are 4498 unanswered questions (90.6338% answered)
0
Q: Writing an Arduino based photo-gate timer for physics experiments

Wayman Bell IIIand thank you in advance for your time and eyes on my code. I've tried to explain the code's purpose well in comments. I am interested in feedback concerning my commenting style (too little, too much, too frequent, god forbid not frequent enough?, too useless?...), as well as with regard to prog...

joshua I have edited your code and have commented why. Although code review would be a better place to do so — Scary Wombat 13 secs ago
 
1 hour later…
01:42
This is probably better suited to the code review site. — tadman 34 secs ago
02:10
Stack Overflow is not a code review platform. Do not ask such questions here. There is a code review stack exchange you can find at the bottom of this page. You should delete this question and ask there. — Rob 12 secs ago
02:28
0
Q: Best design for the command design in Java

Griffin BenderI'm implementing the command design in my Java project. The command design utilizes a command interface, were the actual command classes implement that interface and execute the command. I'm trying to figure out the best way to actually do this and how and where to actually execute the method. L...

02:55
I'd second Dan's suggestion you investigate code review. To give an example this version is a pure simplification of the verb above without investigating tacit or providing v & d as arguments: force_constant=: monad def ' ((y{v) ,. v) ,. <"0 > y{d'Tikkanz 13 secs ago
0
Q: Avoiding the God object antipattern with Access + ODBC backend

thisOne challenge I've encountered in a project involving Access front-end that uses an ODBC backend (typically a SQL Server instance, but the problem is applicable to any ODBC backend). Here are the conditions that we want to meet: User and passwords must be never stored. They must be inputed by t...

03:16
1
Q: Merge two integer lists in Pascal

LuckyThe purpose of the code is to merge two ordered lists (list 1 : 5 integers, list 2 : 8 integers) into another third ordered list, whilst maintaining their order, while entries that appear in more than one list also appear multiple times in the result. Example: An input of List1 (Feld1): 3 6 7 9...

03:28
I'm voting to close this question as off-topic because it belongs on codereview.stackexchange.commeagar ♦ 35 secs ago
0
Q: A TDD Exercise on ConnectFour

Rocket PinguI'm practicing my TTD skills and trying to apply best practices in Java. I finished (passing all the test cases) the ConnectFour kata in the Agile Katas and I would like to know if there is a way to improve my code. The Main Parts of the Code ConnectFourGame public class ConnectFourGame { ...

03:45
0
Q: Round a number and replace trailing zeros by spaces

Remi.bGoal From a number x, I would like a string of the rounded value at n decimals and replace each trailing zeros by a space. Examples Let n = 4 f(0.1, n=4) [1] "0.1 " # 3 whitespace f(0.1111999, n=4) [1] "0.1112" # 0 whitespace f(0.12, n=4) [1] "0.12 " # 2 whitespace f(0.1234, n=4) [1] "0.12...

04:03
This seems to work correctly, also can be probably be made more efficient...codereview.stackexchange.com? — nullpointer 5 secs ago
0
Q: Listing all numbers that are more composite than every number less than it

Julian(This is my first time posting here, not sure if I'm in the right place, but there is nothing in the "Asking Questions" section that condemned this type of question) the code below is my first naive attempt at writing a program that lists all numbers less than a given value that are more composi...

I'm voting to close this question as off-topic because this question belongs on another site in the Stack Exchange network - codereview.stackexchange.comnullpointer 19 secs ago
04:17
0
Q: Finding the number of perfect squares in an array (The Swift Way)

Gamzi am posting here for feedbacks about the code that i wrote var arr = Array(4...17) var count = 0 for i in arr{ if Double(i).squareRoot().rounded == Double(i).squareRoot(){ count += 1 } } print(count) The result from the code above is as expected. However, Is this the "correct" way o...

Monking
04:48
Monking
 
3 hours later…
07:20
I don't think anything related with your deadlines and your professor is relevant to the question. And also, as @MichaelHancock it is hard to see any question at all here. If you want code review, you should go to SE Code Review . If you actually have a code problem, bug or incorrect functionality, please be explicit on the errors/problems you encounter. — Pac0 5 secs ago
08:04
0
Q: Getting a unique identifier form shared table

JepzenI have a table that keeps track of a global identifier used in different other tables. Every time users create a new entity we need to give them a unique identifier from this row. My worries is what happens if 2 users hit the method for incrementing this counter at the exact same time. Would this...

Monking
Monking
08:20
possible answer invalidation by Marko Petričević on question by Marko Petričević: codereview.stackexchange.com/posts/177562/revisions
0
Q: 4x4 word grid generator in python

Daniel GeeSo this program should generate NxN boards where there are words going from left to right and words going from top to bottom. Words are valid if they appear in the scrabble dictionary. For example a valid 3x3 board would be: ACT TOO EGO as it contains ACT, TOO and EGO going across, and ATE, CO...

Kaz
Kaz
08:44
Monking @all
0
Q: Shared Pointer based Object Pool Implementation with fixed object count

prasadmadanayakeI'm implementing a object pool with shared_ptr to access with multiple thread. Any suggestions to improve my implementation template <typename T> class Section : public std::enable_shared_from_this<Section<T>> { public: template <typename... E> Section(std::size_t size, E... args) : std::en...

0
Q: Adding support of HTTP PATCH

ArtemI have an API endpoint to modify a race car, which supports PUT method: PUT /api/racecars/{racecarId} Since PUT must be idempotent it works as a full replacement of an entity. [Route("api/racecars/{racecarId}")] public class RacecarsController : Controller { private readonly IRaceCarsAp...

1
Q: Interview java puzzle

Cruz CarrolFriends A, B, C, D go for a trip. They spend on various expenses. Cost of the expense is shared. Example : A spends 100 for breakfast for A, B, C and D D spends 500 for cab for B and C B spends 300 for lunch for A, B and C Write a program to calculate how much each should get or each should giv...

09:00
possible answer invalidation by Rocket Pingu on question by Rocket Pingu: codereview.stackexchange.com/posts/177720/revisions
09:10
possible answer invalidation by Marko Petričević on question by Marko Petričević: codereview.stackexchange.com/posts/177562/revisions
09:55
0
Q: Refactoring functions working with same logic on different class fields

Marco StramezziI found those functions reviewing a C++14 codebase I am working on: struct Service { Service(std::string id): id(id) {} virtual ~Service() {} std::string id; HeartbeatCheckpoint lastPing; HeartbeatCheckpoint lastPong; }; std::map<std::string, Service> services; bool Pacema...

10:33
"Is it correct?" - it's probably better to determine that for yourself. Create a few test cases to exercise likely problems (e.g. empty input, very long input, etc). Once you're sure it functions according to your specification, you might want to ask for critique over at Code Review. Be sure to read A guide to Code Review for Stack Overflow users first, as some things are done differently over there! — Toby Speight 59 secs ago
0
Q: NER and its F Measure Calculation

Richard ParkerI am trying to write one Name Entity Recognition in Hindi. I have primarily used NLTK of Python. I have used HMM Module with its supervised training. The data is annotated and saved in .pos files as required by the training module. I have included one snippet of the labelled data here. I ha...

0
Q: Student Arrangement algorithm

Sarah MI'm working on this exercice: There is a classroom which has M rows of benches in it. Also, N students will arrive one-by-one and take a seat. Every student has a preferred row number(rows are numbered 1 to M and all rows have a maximum capacity K. Now, the students come one by one starting fro...

10:50
possible answer invalidation by Cruz Carrol on question by Cruz Carrol: codereview.stackexchange.com/posts/177737/revisions
@MartinBonner I added that description in the question itself. Please let me know what else I can do to avoid closing this question. Or should I just put it on CodeReview.SE? I can't put the real code there are people can't compile it without Mathematica (which costs money). Also, I was so uncertain about the "solution" I posted here that I did not even consider it a solution. Feel free to ignore it and answer the first part: how to share code between D1 and D2. — Szabolcs 57 secs ago
0
Q: Code refactor with promise

SajeetharanI am running jscpd tool with my code and it detect the following as duplicate code, dbService.connectDb(commonService.DB_CONFIG.CONNECTIONSTRING, {}).then(() => { return dbService.query(Model, { 'name':Name }, {}, {}); ...

11:27
0
Q: Separate areacode from phone number string with MySQL Database

soo29I have a database with 5000 entries of local area codes to separate the area code from a phone number string. I'm not sure if the code i use is the fastest way to solve these job. I shrink the number of db entries with the first three digits from phone number string. After these i put the entri...

Codereview says you should answer "Is it actual code from a project rather than pseudo-code or example code?" with "yes", so unless you rewrite the question it would be off-topic there. — nwp 9 secs ago
11:59
0
Q: Python: Pawn race

LudisposedAnother day, another Chess related CodeFights problem. Pawn Race Pawn race is a game for two people, played on an ordinary 8 × 8 chessboard. The first player has a white pawn, the second one - a black pawn. Initially the pawns are placed somewhere on the board so that the 1st and the 8th...

12:31
0
Q: How to make this code of shortest Path Finder more maintainable,extendable and get better static code analysis result?

MaverickHello Expert Reviewers, I have the below code for finding the shortest path between a source node and destination node in a BiDirectional graph.It is working alright. However, when I am running Static Code Analysis (VS2017), it is giving poor score (42) on Maintainability Index. My questions are...

0
Q: Cloning objects by serialization or by implementing ICloneable

OzkanI'm thinking about which manner is more efficient and in which cases. So I can do a deep copy using the following ways: public static T DeepCopy<T>(this T source) { return JsonConvert.DeserializeObject<T>(JsonConvert.SerializeObject(source)); } Or I can of course implement the ICloneable...

Why don't you try it yourself? We are not your testers or code reviewers. — John Conde 25 secs ago
12:57
sry, downvote because offtopic- you should ask such questions at codereview stackexchange — Matthias Burger just now
@MatthiasBurger issue is that every time it overwrite the previous log data there is actually an issue to be resolved. I'm not disagreeing that it should receive a downvote (it should!) but its definitely not for codereview — EpicKip 20 secs ago
possible answer invalidation by Marko Petričević on question by Marko Petričević: codereview.stackexchange.com/posts/177562/revisions
0
Q: Implementing an enum field for peewee.Model

Richard NeumannI implemented an enum field class EnumField inheriting from peewee.CharField. The reason that I use a character-based field is that I require human-readability of the enumeration values on the database level. I currently use the funcion is_enum to detemine whether the provided enum constraint is...

13:17
If you are willing to accept feedback on all aspects of your code besides how to make it shorter, you could post it on codereview.stackexchange.com. — mkrieger1 40 secs ago
 
1 hour later…
14:41
Greetings, Programs.
"My current implementation..." So, show it, with the description, of what, exactly, in your current implementation doesn't work as expected. Otherwise - it just looks as "write code for me" kind of "question". But wait.. "...and generates the expected output." If your code works correctly, and you want to improve on it, consider asking on codereview.stackexchange.com. — Algirdas Preidžius 43 secs ago
15:15
@DonBoitnott, "is good?", "is it professional?" sounds to me "I don't like it", which is "please codereview someone". They have their rules, question as it is doesn't fit there I agree. — Sinatr 52 secs ago
0
Q: Need Code for Forgot Password in c# OOP

AsmaI am developing business application for multi users..I want to generate random numbers when click on forgot password link..kindly help

Please read this guide and the tour before you post on CR. — Zeta 34 secs ago
Kaz
Kaz
@CaptainObvious VTC
0
Q: Runs View Model data through service calls to get data for Entity Type

MaxwellI have a few issues with the following code... private async Task<EntityType> FillEntityDataAsync(ViewModel viewModel) { First, I'm thinking I need some sort of intermediate/domain model between the ViewModel and the Entity to clean this up... var typeAObj1 = new Response<TypeA>(); va...

15:34
Monking!
@CaptainObvious I VTC as stub code, there's not enough code to be able to meaningfully review and they are not asking for a review anyway
possible answer invalidation by Toby Speight on question by Marco Stramezzi: codereview.stackexchange.com/posts/177739/revisions
0
Q: Optimization of if else in typescript

Girdhari AgrawalI have a piece of code, and I have one statement repeating in that. This is done intentionally to avoid two conditions checking at runtime. Can anyone please give there comment on that. Code 1 if(!obj.xyz) { o.xyz= new XYZ(); o.xyz.something = [""]; } else if (!o.xyz.something) { o....

15:50
It's unclear what "shortest binary with k subsets" means. If you want to optimise your code, show us your code. Your question might also be applicable to Code Review (don't cross post), but make sure your read the FAQ first should you decide to post there. — Reti43 13 secs ago
@Duga No, that looks ok.
@Duga Hmm, users arn't allowed to edit others code...
possible answer invalidation by hasti123 on question by hasti123: codereview.stackexchange.com/posts/177699/revisions
@Peilonrayz Without that edit, the code will not compile.
@Zeta Code doesn't have to be copy paste able, and run
16:03
Me, when writing tests:
    // brittle? what's that
2
context below:
it("works on class methods", () => {
  class TestClass {
    // NOTE: decorators are applied in *reverse*, so these are switched on purpose (when compared to bare function test)
    // brittle? what's that
    @route("/bar", "post")
    @route("/foo", "get")
    testFunction() {}
  }

  const [fooRoute, barRoute] = getRoutes(TestClass.prototype.testFunction);
  expect(fooRoute).toMatchObject({ path: "/foo", method: "get" });
  expect(barRoute).toMatchObject({ path: "/bar", method: "post" });
});
@Peilonrayz While true, I would definitely look more favorably on code that IS copy/paste/runnable.
3
Mother of hacks
if (typeof target === "function") {
  target[routeStoreKey] = target[routeStoreKey] || [];
  routeStore = target[routeStoreKey];
} else if (
  typeof target === "object" &&
  typeof target.constructor === "function" &&
  target.constructor !== Object
) {
  const targetMethod = target[propertyName];
  targetMethod[routeStoreKey] = targetMethod[routeStoreKey] || [];
  routeStore = targetMethod[routeStoreKey];
} else {
  throw new TypeError(
    "@route() can only be used on bare functions or classes"
Not sure if anyone knows how I can clean this up...?
@Donald.McLean I agree, I too prefer to be able to just copy and paste code, and for it to run. But code that has some context missing is not off-topic here. The edit however breaks site rules. Complain to the OP in the comments.
Monking
@DanPantry Does target[propertyName] need to be typeof target[propertyName] === "function"? As I don't think you check for that...
16:19
@Peilonrayz It does but I think it would be hard to do this without explicitly going out of your way to be a prat
you'd essentially have to do this
hm
I don't even think you can do that if you're using ES6 class syntax
You can't apply decorators to fields
@DanPantry How about:
So basically yeah I trust myself to not screw up and if it does then I will have a useful error message anyways
if (typeof target === "function") { }
elif (typeof target === "object" &&
      typeof target.constructor === "function" &&
      target.constructor !== Object) {
  target = target[propertyName];
}
if (typeof target !== "function") {
  throw new TypeError(
    "@route() can only be used on bare functions or classes"
  );
}
routeStore = (target[routeStoreKey] = target[routeStoreKey] || []);
Oh, that could work
16:59
I'm voting to close this question as off-topic because this is really much too broad for Stack Overflow, which deals with more focused coding problems than this. For advice on improving working code, consider Code Review instead - but do read A guide to Code Review for Stack Overflow users first, as some things are done differently over there!. — Toby Speight 58 secs ago
 
1 hour later…
18:11
0
Q: Find and Replace on PowerPoint Charts with Excel Sheets

PinlopThis will Search through all slides and shapes until it finds a chart, if it's not a Pie chart then it will open up the ActiveWorkbook behind that Chart then it will check the sheet for words in fndListand replace with with words inrplcList`. I would really just like to make this code run faster...

18:28
0
Q: C++ String Non-Member Operator Overloading

Zach HilmanThis is a practice for operator overloading, I am well aware that some of these don't make sense. I am seeking review only on the code/practices, not the purpose. /* (C) 2017 ZACH HILMAN * PROPRIETARY/CONFIDENTIAL. ALL RIGHTS RESERVED * * * * * */ #ifndef COMPUTERSCIENCE_ENHANCED_STRING_H...

This new layout is so stupid that I didn't even notice all my rep gains from the last days :o
normal person lying in bed: "did I lock the back door?" programmer lying in bed: "did I close the database connection?"
0
Q: AngularJS APP(Amazing css with week js)

SmileyI get the task to build simple social app with features as in the project. I want you to code review what can i do better next time/change to improve this app. Factory for data 'use strict'; app.factory( 'DataService', ( $resource ) => { return $resource( 'test-view.json', { update...

0
Q: Validating Parameters and Rich Comparisons

S.R.I wrote the following Author class in Python for a project I'm working on. I wanted to make sure that the rich comparisons and the methods I used to validate the constructor parameters were done properly. Author class: class Author: def __init__(self, id, firstname, lastname): self._valid...

18:45
I'm having the exact issue with the "Code Review Response" WIT and the ReviewedBy field. The above steps are generally good advice (except we don't install Visual Studio on the app tier machine, so running the command line on the TFS server machine doesn't make sense for us.) — JMiera 43 secs ago
19:09
Thank you all for your input, now I'm convinced, that there is no single answer to my problem and probably everything depends on who is doing code review :) I just wanted to know if controlling application flow by exceptions is always a bad practice even if sometimes it looks to be simpler and cleaner that way — nibsa 26 secs ago
0
Q: Is this singleton properly made thread safe. Swift

boidkanThis is a singleton class which can be accessed anywhere including the shouldLock variable. I want to make sure that the variable is thread safe. Is this the proper way to make a variable thread safe? Is there an easier or better way? I got my inspiration from here. class LockNavigation { ...

19:31
0
Q: Automatic database migration system

Conor ManconeGithub here: https://github.com/cmancone/mygrations I'm working on a different kind of database migration system for helping manage web applications. I asked a question about part of the system just yesterday and now I'm looking to get the main processing loop looked at. You can read my post f...

 
1 hour later…
20:34
0
Q: java.lang.NullPointerException

christian xI am working on simple Chat program and for some unknown reason the compilation process works smoothly, however when I try to run the program I get a bunch on exception errors... I have looked in every line of the code and I cant seem to find any problem. Is there something in the code below that...

0
Q: very simple d20 die roll if/else doesnt work

plshelpI'm a complete novice, just decided to try out python for fun, and I'm trying to make it ask you if you want to roll the die, if so, roll the die, if no, ok bye. The die roll works just fine, but not just if I enter Yes or yes, but typing ANYTHING will make the die roll, I can't get it to say 'ok...

 
1 hour later…
21:37
0
Q: Conversational Computing

Rilplease help out! I'm having troubles wrapping my head around how to code this. Please anyone help out. question: A conversational computer program. A program is not going to be able to talk about a lot of topics, but you can write it so it can talk for a few minutes on a specific topic. Some id...

21:52
0
Q: Enabling radio buttons using javascript that are already set to be disabled when created

sjaieI have a form wherein, radio buttons are disabled. The only way to enable them is by clicking a particular option from a dropdown menu. My issue is, when that particular option is selected from the dropdown, only the radio button with the value "Yes" gets enabled, but the button with the value "N...

0
Q: Basic one way hash to store a password C#

Daniel LoudonI am storing a password in a database (school coursework so nothing too complicated but I want to challenge myself), I am using a one way hash function, is this suitable? It works I just feel there may be nicer ways of storing the password. The database is SQL, language is C# static class Encryp...

22:20
possible answer invalidation by Neinstein on question by Neinstein: codereview.stackexchange.com/posts/115916/revisions
0
Q: Python infix to postfix

Mihai GSo my teacher wants me to create a infix to postfix algortihm in python using a given stack class and nothing more than basic operations... yet as I have tried implementing this I keep getting an error .. can someone help me out ? Stack class `class StackArray: """Implements an efficient la...

22:58
You question related to codeReview community. — Ibrahim 48 secs ago
23:12
0
Q: R: electronics analysis graphs

ReinderienI've hacked the following script together. It's stand-alone and does not require any external data input. It is for analysing possibilities to set up a circuit to measure capacitance. It's working well, but I have only a passing familiarity with R, so I'm sure that some of what I've written is te...

23:26
0
Q: A TDD Exercise on Snakes and Ladders

Rocket PinguI finished the Snakes and Ladders kata in the Agile Katas and I would like to know if there's a way to improve my code (specifically the part where the turn order is determined). Game public class Game { private Map<Player, Token> playerTokenMap; private Player winner; private final...

@CaptainObvious R looks pretty ugly... why is it popular? I'd take Python over that for crunching numbers any day of the week, at least based on readability

« first day (1622 days earlier)      last day (2694 days later) »