« first day (1519 days earlier)      last day (2515 days later) » 

12:00 AM
RELOAD! There are 4079 unanswered questions (90.9906% answered)
 
12:15 AM
codereview.stackexchange.com is down the hall, last door on your right. — Sam Varshavchik 37 secs ago
 
 
2 hours later…
2:03 AM
monking
 
2:24 AM
This might get a better response on CodeReviewtxtechhelp just now
 
 
2 hours later…
4:27 AM
310
Q: Which word begins with "y" and looks like an axe in this picture?

gmauchMy 1-year kid has a plastic ball that is decorated with all 26 letters from the English alphabet and besides each letter is an image. I suppose the images are of words in English that begin with each of the letters. That works for all of them, except for the Y, which image looks like an axe to me...

Interesting and features a very thorough answer
 
If this working code it belongs on codereview.stackexchange.com not here — Jarrod Roberson 57 secs ago
 
 
2 hours later…
6:25 AM
0
Q: Remove duplicate chars from String

TheLearnerI have retackled this problem but this time using a LinkedHashSet since previosuly I was using a Hashset but the answer was out of order. From this implementation my runtime should be BigO(n) correct? Does anyone see any room where I can improve my code or some mistakes? public static void main...

 
6:39 AM
0
Q: Finding Factorial of n numbers gives same answer as input using BigInteger

Rishabh Deep SinghI was trying to calculate factorial of t Large numbers using BigInteger in Java but it stops working after the input of n and then n numbers. I am new to coding please tell me where I am doing wrong. import java.util.Scanner; import java.math.*; public class smallFactorial { private static BigI...

 
7:00 AM
0
Q: efficient backend for finding nearby properties

SerenityI am thinking of building an app based on location for finding nearby properties around 15 km from the location of user. I am a beginner in Django and for such use case I could code the following for finding nearby properties. Is the following code efficient or how can it be improved for more pre...

 
In this case it would be better to post this on Code Review then here. — dee 37 secs ago
 
 
2 hours later…
8:53 AM
0
Q: Is this the proper way of setting the implementation of an abstract class from a range of possible concrete classes?

EskiladeI want to choose the implementation of an abstract class based on settings from a config file. Is this the proper way of doing that? I am asking because I am having doubts about using std::make_unique inside the if scope. Will the object created with std::make_unique still be valid outside of t...

0
Q: Decimal to binary converter and finding the maximum number of consecutive 1's

Flynn84Task: given a base- 10 integer, n, convert it to binary (base-2). Then find and print the base- 10 integer denoting the maximum number of consecutive 1's in n's binary representation. What can you say about my implementation of the problem? n = gets.strip.to_i array = [] while n > 0 array.pu...

 
9:45 AM
-1
Q: Implementation of Hashset

Vijay Kumar KRJava program to implement hashset with our own program not using default one. Like add and remove using arrays. Or any other examples

 
10:23 AM
Any chance you could add some potential test data, and values that you enter in the different text boxes? I also don't see where you define originalbytes. If this is working code, maybe it would be better to post this question on codereview — Icepickle 10 secs ago
 
11:04 AM
very nice (necessary) code review +1 — jonathana 58 secs ago
2
 
 
2 hours later…
1:09 PM
@RubberDuck I think the only reason why I don't experience the same year all the time is Code Review and my personal projects.
Work is more the same than anything else
 
1:27 PM
0
Q: Best approach to count occurrence of char in String in Java

Firoz MemonI have two approaches: First Approach: int count =0; for(int i = 0; i < text.length(); i++) { if(text.charAt(i) == charToCheck){ count++; } } System.out.println(count); Second Approach: count = text.length() - te...

0
Q: Time Card Web Application Offline

RepeaterCreeper About & Purpose Purpose: As said by the title this is just a simple web application for use of a SINGLE user. It has the features of calculating total hours, clocking in, and clocking out. It also has some functions that helps with the calculations. This is for OFFLINE USE ONLY.This is by no...

0
Q: From an given array of numbers remove duplicate values

Rahul ShivsharanI was asked an question for writing a program where the input will be array of numbers; the output of the program will be array of numbers without duplicates. I coded in javaScript which runs on node, as follows. In my first attempt, I first sorted the numbers in ascending order and then I re...

0
Q: Interactive animation in HTML5 / Typescript

stackolaI'm looking for some feedback on my typescript canvas animation, since even though I've been going to university for 5 semesters I rarely get feedback on my code. My friend showed me an animation on codepen.io and asked me how I would go about recreating something like this so I gave it a go. I...

 
Interesting point of view @SimonForsberg. That kind of makes me sad. My work has been pretty varied.
 
@RubberDuck I hope mine will be more interesting. We're going to start using Microservices, Docker, and Kubernetes.
Yesterday was fun though, spent some time investigating a bug in Wiremock.
 
Docker is the best thing since sliced bread.
3
 
1:42 PM
@RubberDuck Sliced bread is a lot easier to use though
4
I'm having some problems sometimes understanding how to best dockerize stuff
like our friend @Duga
 
1:57 PM
There is a dedicated site codereview.stackexchange.com for questions seeking peer review of your code. But make sure to read their FAQ first. In particular it is required that you include the code to be reviewed — Martin R 49 secs ago
 
0
Q: Replace constant in C programmimg

moheneQ. How to replace each constant in a string with the next one except letter 'z' 'Z' and 'a' 'A' .

 
@SimonForsberg I was really intimidated by it at first. I found that just playing with it was the best way to learn it. The docs are simultaneously terrible and incredibly thorough.
 
@EBrown Weren't we below 90% not so long ago?
 
@SimonForsberg Never that I've seen.
 
@RubberDuck Yeah, I've played around with it a little, but haven't memorized everything fully I guess
Sometimes I'm not sure if I should make something a docker volume, or if it should download it from the internet or add it to the filesystem with the ADD command
Like @Duga's executable for example
 
2:09 PM
My biggest advice is whichever you do, try to make sure your dockerbuild is deterministic. Like, if you download something from the internet, use a specific version instead of "latest".
As for @Duga, I'd probably ADD the executable. One sec, let me find a link...
@SimonForsberg this is an interesting example. It uses one container to compile/package then copies the results to the "runtime" container. github.com/rubberduck203/AspNetCoreDockerSpike
One thing I didn't do, that I should have, is specified a Docker tag in the FROM.
 
"COPY . .", wtf?
 
Copy the current directory to the WORKDIR
 
I haven't figured out copy vs add yet...
 
So it copies your Git project into Docker, essentially?
I was just about to ask you about that :)
I remember I've looked it up before, but unfortunately that's all I can remember
 
2:20 PM
Yup. The build image has the whole sdk, the other image just has the runtime. Makes the deployable image smaller.
 
2:47 PM
Monkdfzgfngfning
@SimonForsberg That's a bit of a bummer I suppose... knowing you a bit from CR ;)
 
0
Q: code that builds a simple random equation of size

Lovestospoo4u2Okay, i'm trying to find a way to make this code more efficient then using a lot if statements because there are a lot of combinations. The final result variable is an equation made from randomly chosen arithmetic signs and the operands are random numbers between 1 and 10 to create an equation. b...

 
879
Q: What is the difference between the `COPY` and `ADD` commands in a Dockerfile?

SteveWhat is the difference between the COPY and ADD commands in a Dockerfile, and when would I use one over the other? COPY <src> <dest> The COPY instruction will copy new files from <src> and add them to the container's filesystem at path <dest> ADD <src> <dest> The ADD instructio...

Neat!
 
@RubberDuck What about those minor bugfixes? Like x.x.y
Unfortunately at work the most revolutionary utility technology we're working with is SVN
On the other hand we do use C# 7 and the newest web technologies
But then we also have C++ code where the standard library is practically banned
 
3:21 PM
0
Q: Swift architecture

MonkeyDMatI just pushed an idea of an architecture for swift (https://github.com/MonkeyDMat/Swift-IO), and I wanted to ask you for opinions and feedbacks. Thanks

 
4:16 PM
@skiwi it's a philosophical question really. Do you need deterministic builds or do you want to be always up to date? Or somewhere in between? How good is your CI and test suite?
Personally, give me the latest all the time and we'll fix it. Unfortunately, most orgs don't see it that way.
But if we're talking about Docker specifically, most images provide a major.minor tag and x.x.x tags disappear regularly.
 
@RubberDuck Hm okay, I guess that makes sense
What is Docker most useful for?
 
At work, we use it to standardize compiler versions and local testing environments.
But the best part is that you can hand the container to your OPs folks and they can deploy it with a simple docker run command. Scaling up and down becomes really easy.
 
4:31 PM
Hmm I can see most of that, just don't see how it would fit within my work environment for example
 
You should go ahead and put this on Code Review. — Coldspeed just now
 
It might not.
I fell in love with it because I can rebuild my webserver in about 30 minutes.
I don't even use snapshots. I just dump my mongo db and copy it local once in a while.
 
I guess it makes most sense if you host your applications within environments?
We tend to install things as windows services, windows applications, etc.
 
Yeah. Docker doesn't make much any sense for those things.
 
4:47 PM
@SimonForsberg Working on the front-end for the chess web app. I need a chess board object to load.
 
5:13 PM
Why not fake it for now @Hosch250?
 
Because I'm busy building the pieces?
I'm using the unicode images, but they have transparent sections, which look funny on the board.
So I'm using Photoshop to create them and save them with white backgrounds.
 
5:54 PM
Where do you guys get all that motivation?
Tell me the source.
To be fair, I have tons of imagination at work, but it's hard to combine it with programming at home
 
What motivation/imagination?
 
To make stuff
 
What else is there to do?
What do you do all day?
 
Not much useful ^^ Playing Rocket League on and off, and doing other random things
And of course watching all Moto3, MotoGP and Formula 1 qualifying and races, those also eat into my time
 
I don't have a TV or a Steam account.
Worst I do is go on a Minesweeper/Sudoku/MS Jigsaw binge.
And that makes my arm sore soon enough, so I have to stop.
 
5:59 PM
Hmm right, I do still have an idea to make something that searches for stuff on eBay periodically and notifies me when there's something new
Just not sure of how to set it up yet, eBay has API's and all, that side is covered
 
Sounds expensive.
 
I probably should learn something new for the GUI
I liked React a lot, but I don't want to make it on the web, I want an application
and traditional GUIs suck to code
 
WPF.
 
Played around with it, not my favorite thing to do in my free time
 
Here's my work so far (all hard-coded for now): chessonline.azurewebsites.net
Going to pull the board into a partial view and create a board object to load after lunch.
 
6:10 PM
@skiwi for me, it's 100% imposter syndrome. If I don't keep pushing myself to learn all the things people think I know, then someone will eventually figure out that I'm an over priced consultant who has no clue what they're doing.
 
Also, you don't need to tell me that the contrast could be improved.
But, I'm too lazy to update it right now.
@RubberDuck That too.
 
@RubberDuck I'm doing that 100% on my job right now
 
That's partially why I'm doing this. I work with ASP.NET MVC and Entity Framework all day long, and I'm getting a lot of questions to look into more.
 
Which is a huge perk, I know, but it doesn't leave me with lots of motivation at home anymore
 
Same here. 7 weeks in, though, and I'm getting my motivation back.
 
6:13 PM
I don't have a ton of motivation outside work any more either TBH. If I don't need it for work, I don't find the time for it. Like Akka & F#. I'd really love to learn those, but... meh. Too busy learning a dozen other things.
 
Who was the one that jokingly said some time ago that I might be involved in a compiler team in the future?
 
6:30 PM
Much better. I'm glad you reordered the two main paragraphs. I'm not convinced by the foo() || printf(…) or foo() && printf(…) examples. Were you to present such code to me in a code review, you'd be sent back to write it in sane C with if (foo()) printf(…) or if (!foo()) printf(…). — Jonathan Leffler 49 secs ago
 
-1
Q: Incoherent Ncurses Game ("How can I make this code better?")

Braden BestAs much as I would like to correctly format this code, or give a better title, I probably shouldn't. If only to communicate the frustration I'm experiencing with the person who is actually requesting this code review, whom, out of respect for his privacy, will not have his name mentioned. If I ne...

0
Q: Team Roster. Manages Player names, phone numbers, and jersey numbers

Ryan LNote: This is written using Python 3.+ I am having issues with my add function repeating the prompts to the user repeatedly. Not sure if it is doing it for removing or editing new players, but I assume it will happen no matter which option you choose. Does anybody have any idea what is causing t...

 
6:48 PM
@skiwi I might be that one. It came out to be true, right ?
 
@MrGrj Yep it came out
 
@skiwi Congrats ? Would you mind giving us some inside ? What are you doing now ?
Did you start building some ASM compiler in brainf*ck ?
 
7:12 PM
0
Q: Reading and storing nested data

BillyJeanI'm reading data from a json-structure that describe aquariums and how many fish they contain (among other things). Overall, the structure of the data is like this: "house" "info" "animals" "fish" As I am looking at aquariums, I only want to keep the data/aquariums that actually contain...

 
@MrGrj No, I'm not insane (yet)
@MrGrj We have a proprietary language that is currently being interpreted in C++, I'm working on getting it compiled to .NET bytecode via expression trees using C#, and then executing those methods
Our C++ application hosts a .NET run-time, that's why it's possible
 
If this code works fine, then it is off topic on Stack Overflow, but may be good for our sister site Code Review. — Joe C 43 secs ago
 
0
Q: simple virtual machine in C (updated)

NergalI've previously put my virtual machine for review and I've applied the changes and more to the code. This is iteration 2 and I'd like to remind the reviewers that this virtual machine is meant to be embedded into a C++ game engine application as a compiled, exported C library (static, not dll). ...

 
7:33 PM
@skiwi that's some seriously interesting work. May I ask why it's being migrated?
 
@RubberDuck There's some performance concerns with the current version being interpreted, and performance is a hot topic right now
 
@skiwi Auch. Sounds like an impossible thing to be done for me
 
@MrGrj For me it's very much possible :)
@RubberDuck What's more interesting personally is that I had no clue that I would be going to do this when I signed for the jo, I think it's always hard to find out what you're going to do unless it's an assignment, but it turned out be very good :D
 
 
I'm having 50-100% performance gains so far on simple things, things where performance gains are not really expected, with in the next month or two I hope to be able to compile more interesting pieces of code
There's almost no way to prove that the project was really going to work, so I'm very happy that I even got assigned to it :)
Calling from a .NET run-time into the C++ code from its hosting process is also an interesting technique ;)
@DanielR.Collins - yes indeed, whenever I interview a candidate who "wrote a compiler" (or even just "parser") as a group project I always drill down and down and down to find out what part of the project the candidate actually did. It's like pulling teeth and nearly impossible and the reason is that the answer is invariably that they did nothing at all worth mentioning. Same for any other kind of group project too. Someday I'd like to meet the guy who did all these group projects for the others ... — davidbak 24 hours ago
lol ^^ just saw that comment
(modified my wording there as I may have worded it a bit poorly...)
 
7:55 PM
0
Q: An android application regarding the tsp

TTTI am working on an android application the travelling salesperson problem (a list of cities and the distances between each pair of cities, counting shortest possible route that visits each city exactly once and returns to the origin city? The app works well and i am just looking for any improve...

0
Q: trying to accumulate the charAt(*) for each n

TurtleWolfthis is a helper function, along with three other's it should be called as a .filter(); to return only prime numbers. It is for one of the exercises at FreeCodeCamp.com, Sum all Primes. I'm just trying to accumulate the charAt(*) for each n, so 10 would return 1, being 1+0 21 would return 3, bei...

 
I guess I'm just about ready to put the beginning of my chess on CR.
Even though it is C#, I'm doing it in an extremely functional manner.
It actually suits the language surprisingly well.
I like functional objects :)
 
possible answer invalidation by Lovestospoo4u2 on question by Lovestospoo4u2: codereview.stackexchange.com/posts/167113/revisions
 
public struct Piece
{
    private bool _hasValue;

    private Piece(Token token, Player player)
    {
        Token = token;
        Player = player;
        _hasValue = true;
    }

    private Token Token { get; set; }
    private Player Player { get; set; }

    public static Piece None = default(Piece);

    public static Piece WhitePawn = new Piece(Token.Pawn, Player.White);
    public static Piece WhiteRook = new Piece(Token.Rook, Player.White);
    public static Piece WhiteKnight = new Piece(Token.Knight, Player.White);
public Board SetPiece(Coordinate coord, Piece piece)
{
    if (piece == Piece.None)
    {
        return this;
    }

    if (GameBoard.TryGetValue(coord, out Piece _))
    {
        RemovePiece(coord);
    }

    var tmp = (Dictionary<Coordinate, Piece>)GameBoard;
    tmp.Add(coord, piece);

    GameBoard = tmp;
    return this;
}

public Board RemovePiece(Coordinate coord)
{
    var tmp = (Dictionary<Coordinate, Piece>)GameBoard;
    tmp.Remove(coord);

    GameBoard = tmp;
    return this;
}
Uh oh, @Nox hasn't awarded the checkmark yet. Think of all that rep just being lost :(
 
jrh
This is probably okay but I figured I'd ask, is it fine to post code I wrote in a SO answer for review?
 
Yeah.
Just as long as it follows the rules, that is.
Talk to y'all later.
 
8:09 PM
1
Q: Using deferToThread in Twisted to run multiple tasks

Chengxin MaI have a list of strings and for each string in the list I need to do some processing work. The selection of strings isn't just using a for loop. Instead, in my case I need to pick up the strings randomly one after another. The interval is 1 second. As soon as all the strings in the list is sele...

 
@Hosch250 FP C#? What's next, OOP Lisp?
(defrecord Program-State [instruction-pointer cell-pointer loop-anchors cells]
  Object
  (toString [self] (str "<" (s/join " " (vals self)) ">")))

(defn new-state [n-cells]
  (->Program-State
    0
    0
    []
    (vec (repeat n-cells 0))))
Oh yeah, that already exists ^
 
OOP Lisp, what?
 
Clojure is Java under the hood, so you can use objects
5
Q: Clojure BrainF*** Interpreter

CarcigenicateSince I want to try writing my own language at some point, I wanted to have some experience writing an interpreter. BrainFuck is the simplest language I (kind of) know, so I decided to try writing an interpreter for it. Going in, I decided to use a parsing concept I never fully learned when I us...

 
Why does it look so much like Clojure?
Oh... right, that's why, it is Clojure
@Phrancis Just double checking that I did not write that question.
 
I don't think old Lisp has any OOP support, not sure if Scheme does
 
8:33 PM
this seems more geared toward code review or programmers SE — Kritner just now
 
jrh
8:53 PM
0
Q: Exporting Matlab Figures as PDF with a Minimal Amount of Whitespace for use in LaTeX

jrhAbout this code This Matlab function takes in the handle of a figure and exports a PDF containing a vector image of the plot. The caller of this function can opt to even remove the axes if he or she really just wants the plot area (this also removes text like the plot title, units, etc.) An...

 
@Hosch250 What can I help with?
 
jrh
first Matlab CR for me, I kind of taught myself Matlab so my style kind of just got adapted from other languages
 
Matlab is... interesting.
 
jrh
I find it more challenging to stick with the typical advice on avoiding comments in Matlab than I do in C#
either that or I end up with variables with names that are even more verbose than what I'm already using
which is funny because the built in functions are abbreviation heavy and a bit cryptic IMO
I've been waiting for somebody to say "but that's just how Matlab is" because I'm honestly curious to see if somebody finds that easier to read, despite what books like Clean Code recommend
it would be interesting from a language design perspective if what worked for readability in C#actually made things worse in Matlab
 
@juanpa.arrivillaga Yup!. If there is one thing I learned on SO, is that there seems to be some attraction to shove everything in to one line. Especially if you get to use the words "comprehension" and "lambda". Once you start throwing in requirements for testability and maintainability, that just bites you in the behind and the quickest way to get your code reviews rejected. Cute != good code. — idjaw 45 secs ago
 
9:04 PM
it's useful to remember that Matlab wasn't made for programmers. It was designed for engineers and scientists.
@Duga "cute != good" amen.
 
jrh
I guess that explains a preference for single letter variable names (to match the variables in equations)
I've noticed that mathematicians tend to use variable names that only make sense if you bought their math book
7
 
Nox
Hi
 
jrh
hello
 
Nox
@RubberDuck hey, are you there
?
 
Monking @Nox
 
Nox
9:08 PM
:P I didn't forgot what you dais the other day ;)
*said
about the bounty
have you read the answers?
 
I have.
Did you find them useful?
 
Nox
in terms of style, yes
 
Well, don't feel pressured to accept one if you don't think they deserve a checky.
I'll check in tomorrow to see if there's one.
 
Nox
I don't like to waste all that reputation, I was waiting to the last day
in the hope someone will read more code and do a more elaborated answer
if not, I'd accept the second one, at least it's more complete
 
@Nox What's wrong with the current one(s), out of curiosity? They seem to be pretty decent.
 
Nox
9:13 PM
I suppose it's too much code to ask for more
 
0
Q: Exporting Matlab Figures as PDF with a Minimal Amount of Whitespace for use in LaTeX

jrhAbout this code This Matlab function takes in the handle of a figure and exports a PDF containing a vector image of the plot. The caller of this function can opt to even remove the axes if he or she really just wants the plot area (this also removes text like the plot title, units, etc.) An...

 
Nox
@EBrown oh, neither of them are "wrong"
 
If this code works, then perhaps you should post for a review. codereview.stackexchange.com/tourcricket_007 20 secs ago
 
Nox
I don't think so, I just expected more about the code
or the algorythm and less about the style
 
@Nox Ah, I see.
 
Nox
9:16 PM
but they're ok! And I didn't specified it because I wanted that type of answers too
 
I'll see if I can't throw my two-cents in later tonight.
 
Nox
but not only :D
Well, I'd appreciate that ;)
in fact I came here earlier today precisely to speak this, but there were nobody
anyway
that said, it's a little late and I want to see a movie :P
cya guys ;)
and thanks again @RubberDuck
 
Yw @Nox
 
9:52 PM
0
Q: Promises in loop

kentorI am new to Promises and ES6 and I am struggling with writing clean code for my problem to process uploaded files. Users can upload multiple files via ajax and if possible I want to process them (parse specific information from that information). If the application fails to process the file it sh...

 
10:04 PM
I feel this belongs to code review rather than here to be honest — Lee Brindley 39 secs ago
 
0
Q: Node JS routing system

ShashimeeI am doing a website for an association and I have never done the server side before. Here I made a very simple routing system: app.set('port',(process.env.PORT || 5000)); app.use(express.static(__dirname + '/public' )); app.use(express.static(__dirname + '/views' )); app.get('/',function(re...

 
10:43 PM
0
Q: PHP - MVC - Too many controllers?

ClemCI'm building a CMS app with the help of a custom framework. The back-office is composed of the following pages: post list page list user list post edit page edit user edit Actually, my routes are defined as follow (I don't put regex here for clarity sake): return array( '/post-list/' => ...

 
10:58 PM
0
Q: Program Architecture for a Music Player

JoshuaDI am refactoring the code for a music player I wrote in Java/JavaFX. I have a few key objects which are accessed throughout the program by various other classes. I think there will be four or five by the time I finish moving everything around. There is only ever one instance of these objects in...

 
11:17 PM
@SimonForsberg Anything you like. You said you wanted to do the backend.
@Phrancis Linq is almost entirely functional, and so are most of the features in C# 7.
 

« first day (1519 days earlier)      last day (2515 days later) »