« first day (1129 days earlier)      last day (2893 days later) » 

12:01 AM
RELOAD! There are 2427 unanswered questions (93.0128% answered)
 
 
1 hour later…
1:05 AM
Your question is probably more suited to Code Review SE: codereview.stackexchange.comhsnee 31 secs ago
 
1:28 AM
Did so and commented. However, the goal was to get a working answer to the exercise. Your advice to post in code review is what required 40 mins. I do not see the reason for the neg. — Dan 30 secs ago
codereview is not good for numpy performance questions. vectorization questions like this are common on SO. @Yang, have you searched questions on how to replace iteration with operations on the whole array? There are many. — hpaulj 50 secs ago
possible answer invalidation by Jamal on question by Alex: codereview.stackexchange.com/posts/131158/revisions
 
1:47 AM
0
Q: Count number of occurrences of each word of text, display as circles of varying size

smithMy focus was to have clean, structured code. It has to be efficient. The display doesn't have to look that good. The circles do overlap and sometimes the word doesn't fit inside the circle, but those are problems aren't really my concern right now and I will fix later. circle.py import pygame i...

 
monking
 
monking
 
Monking.
Freaking autocorrect.
 
@EBrown lol. my phone autocompletes "mo" to "monking" :p
 
@Mat'sMug My Mac autocompletes "monking" to "mocking".
 
1:56 AM
oops
 
lol
 
@Quill "Babies got rabies"? lolwut?
 
wat. oh.
 
2:33 AM
0
A: Simple calculator in C#

EBrownI'm going to go over a few things in this answer, hopefully it makes them simple enough. First, let's talk about your input handling (or lack thereof). As programmers, we should strive to be able to gracefully handle any/all input, and do something appropriate as a result. For invalid input, u...

Helped a newbie out:
(Shameless pimp.)
 
3:25 AM
possible answer invalidation by Rahul Desai on question by Rahul Desai: codereview.stackexchange.com/posts/112828/revisions
 
False positive.
 
3:55 AM
possible answer invalidation by Komal-SkyNET on question by Komal-SkyNET: codereview.stackexchange.com/posts/131159/revisions
 
@Duga based on a comment, irrelevant to answer
 
4:21 AM
'List of helicopter prison escapes' and 'List of sexually active popes' are both entertainingly long, but sadly there's no 'List of helicopter prison escapes involving sexually active popes.'
7
 
Note to anyone who would be tempted to recommend migration: this post would be off-topic on Code Review. See a guide to Code Review for Stack Overflow users </PreemptiveStrike>. @K.K.: Minimal, Complete, and Verifiable example should help you improve your post. — Mat's Mug 2 mins ago
 
4:50 AM
This question may be better suited for codereview.stackexchange.com. — Jonathon Reinhart 53 secs ago
 
5:07 AM
@Vogel612 Yes, I would like to get a review of my actual code, not of my tests, nor of whether or not I should have even written the code in the first place.
 
5:27 AM
 
Monking
 
0
Q: Generate math facts

CesareI've written a model for an app that generates math facts by evaluating the difficulty chosen by the user and eventually providing a number1, number2 and answer. I don't like how I am repeating the code that performs the operations. How can I make this model better? import UIKit class Question...

 
IMO this isn't reviewable in its current state. Sure one could nitpick on variables names and not needed comments but having all the throw new NotImplementedException(); this looks more like stub code which is off topic. — Heslacher 18 secs ago
 
5:57 AM
0
Q: how do i use instance variables, getters, and setters properly with this code?

JQ Jones/*Jaquan Jones * Project 1 */ import java.util.Scanner; import java.io.FileNotFoundException; import java.io.PrintWriter; import java.io.UnsupportedEncodingException; public class JaquanJonesProject1 { public static void main(String[] args) { Scanner input = new Scanner(System.in)...

 
6:15 AM
Monking
@JeroenVannevel ew
That should really read unless ... throw ...
imo
 
unless is an inverted if
I'd never use it over 'if' at first glance
 
I know
 
6:46 AM
Thanks, Windows, for running Windows Updates at 7:30am when I come into work and not giving me the option to postpone them...
Crap :\
 
@N3buchadnezzar paging @Zak
 
0
Q: Pizza Delivery System

Jyotinder SinghI have made this code as my summers vacation project in Turbo C++ (I know its old and outdated, but that's what they teach us in our school). Please tell me what you think! Note: the login for the admin panel is: USER ID : 123 PASSWORD : 321 #include<iostream.h> #include<conio.h> #include<...

 
7:31 AM
Monking all
 
Monking @Mast
 
8:00 AM
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: Archiving an SQL table of sessions and statistics
 
0
Q: C++ Socket Part-4

Loki AstariIn my ongoing attempts to become a better blog writer I have some written some more code that needs reviewing. Full Source: https://github.com/Loki-Astari/Examples/tree/master/Version4 First Article: <Not used published> This code replaces the hand written socket code with a libcurl wrapper. #...

 
Zak
Monking @all
 
hey @Zak
 
8:16 AM
Hey
 
8:27 AM
-1
Q: Best practice for number of files in a directory and number of lines in a file?

TrungDQIn a codebase, I believe too many files in one directory or too many lines in one file is usually considered bad, it shows that the codebase or the app is not well structured/modularized. I remember there was severals code quality checking tool put warnings on this, but I can't remember the tool...

 
8:50 AM
@Miguel, after another code review, we found there's a folder we missed to set this option. We've passed the review now. — Bastet just now
 
0
Q: Switch expression function

overactorI made a bunch of functions and an enumeration, that together allow me to write something like a switch expression. It's not as powerful as Swift switch statements, since it's lacking pattern matching and I don't intend to use this in real code, it was just an experiment. Here is what I got: enu...

 
Zak
9:12 AM
So, it appears I've graduated from crashing Excel on a regular basis to crashing SQL Server instead.
3
 
-1
Q: fizzbuzz python 2-liner

Benedict K.Came across this fizzbuzz implementation in python. Does it work by string * bool, where bool is either 0,1 and therefore string*0 is 0? Wondering whether the or statement views each of the n% separately? for n in xrange(1,100): print("Fizz"*(n % 3 == 0)+"Buzz"*(n % 5 == 0)or n)

 
@CaptainObvious 3 more VTC.
 
9:29 AM
0
Q: Binary protocol variability

Dmitry NoginLet’s imagine that we designed more or less universal firmware for a microcontroller unit to be used across multiple types of devices. So we have something common in the binary data exchange protocol, and something different. The most common way to define incoming command parsing is usually abou...

0
Q: Calculate attendance compliance based on attendance record

Ng Oon-EeThis is part of a larger working system which I'm now trying to clean up. In the interests of making the system more test-able I'm splitting up the functions which can be split, but this 100-line function is messing me up. Short overview, this takes 5 inputs:- matchedslots - A list of 4 times ...

 
9:52 AM
This looks cool
 
10:05 AM
I'm sorry OP, if one of the developers I work with sent me this for a code review I'd send them right back and tell them to fix it. You're mixing old and new join types, you've got data duplication everywhere. SELECT statements that contain joins are terrible for performance. If you must, make this a function that you call. — Rich Benner 8 secs ago
 
10:22 AM
0
Q: Portfolio Pro's and Cons

TobiMy names Tobi, I'm 16 and am super interested in pursuing a career in computer science. I created a 'Portfolio' page that I hope to fill up over the years, I wanted to know how it compares and if it gives off a good impression; also, are there any faults in the way I've coded it in general, as in...

 
10:32 AM
Monking
 
Zak
Evidence I need a faster computer:
 
Evidence your macros take too much resources? ^^
 
Zak
@skiwi Not even a Macro, just a bunch of worksheet functions
 
@Zak Is multi-core a thing in VBA?
At least it's efficient, 96%.
 
Zak
10:50 AM
@Mast Don't actually know about VBA, but Excel is certainly capable of marshalling the entire CPU.
New Top Gear now has lower viewing figures than The Antiques Roadshow. Kinda says it all really.
 
Who wants to see Chris Evans? Clarkson is the face of Top Gear
 
Who's Chris Evans anyway?
Ah well, I haven't caught up with the old episodes yet.
 
The new TG presenter
 
Well, Chris Evans is either this guy
or Captain America.
@Zak I hated both of those shows.
My brother made me watch Top Gear and my mother Antiques Roadshow
 
Oh, found him.
 
Zak
11:05 AM
I hear kinda-decent things about the guy from friends.
But yet to see anyone who likes Chris Evans as host.
 
Now I know why I couldn't find his profile. He isn't British.
 
That's probably why nobody likes him
It's a British TV show, after all..
Plus, say what you will about Jeremy Clarkson, he was funny
He was a dick, and you weren't meant to like him, but he was funny
 
He had his own style.
 
0
Q: Extendable format provider

t3chb0tI needed a better string formatting options like ToUpper and ToLower but I also wanted to be able to use the default formattings so I created a custom formatter. It's main purpose is to support a template engine where the user should be able to use different formattings like upper or lower case. ...

 
11:25 AM
@if (bool.Parse((string) ((IDictionary<string, object>)Experiment(ABTest.TEventListEventIsSellingFast).Data)[eventItem.EventId.ToString()]))
no shame
 
Heya
Quick q, is there any way to keep just the 5 last digits when multiplying two numbers togheter?
 
Zak
@N3buchadnezzar Convert to string, take last 5 characters?
Or, you could just create 2 numbers which are, respectively, the last 5 digits of the base numbers, then multiply those together.
 
@Zak I need to do this in the order of 1,000,000,000,000 times :p
 
@Zak That works only if they aren't float
 
Really want to avoid many string conversions.
@DanPantry They are integers alright
 
11:37 AM
@N3buchadnezzar So if I had 123456 you'd only want 23456?
 
@DanPantry Yeah
 
IMHO, this belongs to Code ReviewThomas Ayoub 57 secs ago
 
something hacky that might work
 
Could i not use modulo? Perhaps
 
11:38 AM
round to nearest 100000, subtract the original from that round
 
Zak
@N3buchadnezzar Why not just [Result mod 100,000]
 
...or that ^
% is the symbol for mod @Zak
weirdly
You'd think it would be getting a percentage of something, but apparently not
 
@Zak Do i not need 6 in order to account or rounding errors?
 
if you had 6 zeroes you would get the 1 as well in my example, I think
> 123456 % 1000000
123456
> 123456 % 100000
23456
 
@DanPantry I mean to account for rounding errors when repeating this process many times
 
Zak
11:41 AM
@N3buchadnezzar What rounding errors are you expecting?
 
¯\_(ツ)_/¯
 
Zak
If these aren't floats, there shouldn't be any.
 
@Zak just a major brainfart, thanks =)
 
0
Q: Partitions of a number (backtracking) - time efficiency

Skyp89I had to write an algorithm that prints the partitions of a natural number in lexicographic order. Example of I/O: If the algorithm reads from partitiinumar.in.txt n=5 In partitiinumar.out.txt we should have: 1 1 1 1 1 1 1 1 2 1 1 3 1 2 2 1 4 2 3 5 ...

 
Greetings, Programs.
 
Zak
11:58 AM
@Donald.McLean Greetings
 
Monking everyone!
 
@Donald.McLean You are only going to be watched three more times, Program.
 
@Zak Tried to do this one projecteuler.net/problem=160. Thought I had written an efficient solution but alas overflow :p Back to the drawing board.
 
Oops, an accidental branch.
 
@SimonForsberg I know. Sad.
 
12:05 PM
@N3buchadnezzar What language?
 
Python of course :p My program can find f( 10^6 ), eg the 5 last non trailing digits of 10^6! in 2 seconds. However 10^12 is way harder :p
 
I can top that.
 
@N3buchadnezzar Why don't you simply slice it? Too expensive?
 
@DanPantry The darkest timeline.
@Mast Slice it?
 
@DanPantry Yea, I might end up like that.
@N3buchadnezzar Python has a slicing operator.
 
12:08 PM
@Mast You will if you use a pull request workflow
 
Zak
@N3buchadnezzar Have you been retaining only the last 5 digits after each mutliplication?
 
16
A: Text message "reverser"

MastThis is going to be a short answer, but did you know Python has such a feature in-built? text = "I'm a stringy!" print(text[::-1]) Above would replace your reverse method and is the most Pythonic way to solve this. This is called extended slicing and has been added since Python 2.3. Slicing i...

 
@Zak Yea
 
@DanPantry Push and pull, that's all I do.
 
Zak
Something else to think about. If you only care about the last 5 digits, then multiplying anything by, say, 1,287,654 is the same as multiplying it by 87,654
 
12:09 PM
You could even use format I think.
 
Oh, clever
I did not think about that
 
Zak
Which means what you're really doing is multiplying by (1 through 99,999), 10^7 times
 
@Mast That works fine for single person workflows, not so much for team workflows sadly
The two faceless commits you see there are merge conflict resolutoin commits by a colleague because he doesn't use git rebase on his work :(
using PRs helps reduce that by having no one commit directly to master
 
@DanPantry Oh, is that how you get faceless commits? Perhaps that's what I've been doing wrong on OGNext.
 
Zak
Which then makes your calculations roughly equivalent to 10^5! * 10^7!, both of which are numbers your algorithm can calculate in a couple of seconda.
 
12:12 PM
@Mast No, that one is faceless because the guy doesn't have a Gravatar, but I do :-)
 
I tried to do something like that.
 
@DanPantry Isn't that easier to mess-up? Added complexity and all that.
 
@Mast If you're disciplined about it, I'd argue it's easier to organise than everyone committing to master
you keep local branches and only work on them, branch off of master (or develop) when you start a new feature
then you submit a PR, it's reviewed, merged into master
 
@Zak How did you get 10^7?
 
the alternative is having everyone commit to master and trusting devs to resolve merge conflicts themselves
 
12:14 PM
Monking
 
That's fine for experienced git devs, but for people who aren't so experienced - or without a test suite..
 
Merge conflicts are the main problem with doing Git wrong.
 
@DanPantry thats fine for devs that know the code inside and out
 
IMO
 
Eh, merge conflicts aren't a sign of "doing it wrong"
 
12:15 PM
Git gud
 
Zak
When we keep strippping it down to the last 5 digits. Multiplying by every number from 1 through 1 Million is the same as multiplying by (1 through 99,999) 10 times.
 
Merge resolution commits generally are
@Malachi Exactlly. That's why IMO PRs are better
there's an extra gateway before code gets to production
 
Zak
Mutliply both sides by 10^6 and mutliplying by every number from 1 - 10^12 becomes multiplying by (1 through 99,999) 10^7 times.
 
:30155792 I guess you could also see this by doing 10^12 / 10^5 = 10^7
 
Zak
Pretty much.
You just take your problem of size 10^12 and split it into 2 problems of size 10^5 and 10^7
And you end up with 99,999! ^ (10 ^ 7)
 
12:18 PM
@DanPantry I agree with you
 
Zak
99,999! you can do in a second, stripping out the digits.
 
@Zak You'd like Python.
 
Zak
which means 99,999! ^ (1,000,000) should only take, maybe, a minute using the same process.
 
@Zak Did you see the video with john oliver by chance?
 
Zak
@Mast It's on the top of my list of "Programs I want to learn that I don't need to learn for my job"
@N3buchadnezzar Not yet.
 
12:20 PM
here I pull the latest release branch and merge that into my branch (if anything has changed since I created the branch from release) and then let the release person merge ALL TEH BRANCHEZ for deployment into a new release branch
that way if I merged it wrong someone can tell
 
Are there many companies that use python in the wrorkspace?
 
I made a review of the comments on some code, and the user said something about that is the way that StyleCop mandates and I said they should mention that in the post, it wouldn't change my review, from what I see, StyleCop does more damage than it does fix things. but should I delete my review?
 
Zak
@N3buchadnezzar Depends on the company. My impression of Python is that it gets used a lot for back-end systems (servers, integrations, general-purpose scripting).
 
All stylistic decisions and conventions like this are somewhat arbitrary and down to personal preference. You're right, sometimes it might make sense to group many components into one file with helpers, especially for small/simple projects. I guess one reason to have one component per file is testing ... when importing that file to test it, it can help if you're just importing the minimal amount of other code and sub-dependencies along with it. Another reason could be for simple diffs on small focussed files during code reviews etc. — WildService 34 secs ago
 
0
Q: Format numeric fields properly

gstackoverflowpublic String format(final Field field, Object o) { try { AccessController.doPrivileged(new PrivilegedAction<Object>() { @Override public Object run() { field.setAccessible(true); return null; } }); Ob...

 
12:32 PM
0
Q: Is StyleCop bad?

MalachiI made a review of the comments on some code, and the user said something about that is the way that StyleCop mandates and I said they should mention that in the post, it wouldn't change my review, from what I see, StyleCop does more damage than it does fix things. but should I do something diffe...

 
Meta is really, really slow for me so here's my 2c RE StyleCop
We used to have StyleCop enabled, but we found that the default styles basically ran completely counter to the .NET standard style guidelines that were baked into VS2015
It got to the point where we had some 2,000 warnings from StyleCop that were causing us to ignore the actual warnings of the application
 
my team also has a stylecop file
every rule is disabled
 
Anything that gives you 2,000 warnings is not a good tool
 
lol
I asked what it's used for. They couldn't tell me
 
I instead use the ReSharper style guidelines
They are what VS2015 suggests by default
And removes a lot of cruft like superfluous this.
I decided to do that after a few errors in production were tracked down to a warning that was in VS but we had ignored because of the 2,000 errors from StyleCop
 
12:37 PM
1
Q: Is StyleCop bad?

MalachiI made a review of the comments on some code, and the user said something about that is the way that StyleCop mandates and I said they should mention that in the post, it wouldn't change my review, from what I see, StyleCop does more damage than it does fix things. but should I do something diffe...

 
@DanPantry Sadly it seems that in Rust self is mandatory (the Rust variant of this)
 
wow! :O
 
That said, I'm not going to say that StyleCop is bad, it's good at enforcing consistency of style, and that is its job
Unfortunately, the style it enforces by default is garbage
And for some reason it was being stored in source control, and we all know how well git and binaries play together
@skiwi Rust is pretty terse as it is, and with variable shadowing, I'm perfectly okay with it requiring self
C# is quite the opposite, it can get quite... verbose. Kingdom of nouns etc
 
0
Q: Entity framework core RC 2, Unit of Work and Unity in an WPF MVVM application with local SqLite database

ajrI am having beginner problems regarding the correct implementation of UnitOfWork within the WPF/MVVM application. Specifically, with the scope/lifetime of the context. The instance of entity type 'Socket' cannot be tracked because another instance of this type with the same key is already b...

 
Baaah, not able to implement the idea
 
12:47 PM
@CaptainObvious broken
 
0
Q: Is it good style to give an argument to a member function the name of a member?

Peter A. SchneiderThis is a question about a naming convention; if that is not on topic here (there doesn't seem to be a tag for it, but it is not in the exclusion list either), I have no problem with it, just holler. Consider (1) this code snippet from an MIT opencourseware presentation: class IntegerArray { ...

0
Q: Read current picture with OpenCV and always return a new picture

GildrathsWhen opening a rtc-stream a thread should always grab the newest picture because otherwise there would be a huge buffer with "old" pictures. Also a call from getMatFromStream() should never return the same picture. If there was no new picture it should wait till a new one is available. package a...

 
@N3buchadnezzar Academia uses it.
And it's used as a tool to help development in other languages.
 
@Mast Heh "solved" it
 
The answer got edited. Feel free to revert. Thanks to @Malachi for forgetting to properly capitalize his review in the first place ^^ — Mast 19 secs ago
 
1:04 PM
@Mast I was working on an edit...lol
 
Ninja'd ^^
 
thank you for taking the time to explain. it is very appreciated. I have also updated my answer and hopefully you find it a little more helpful than it was before. — Malachi 3 mins ago
 
my edit is a little more substantive than yours....lol
 
Sometimes I'm amazed at how professional and polite people on CR are compared to SO.
props to being able to take criticism, @Malachi
 
1:11 PM
@DanPantry I am suprised how unprofessional and rude people on SO are compared to CR.
4
 
@DanPantry thank you
I truly am here to learn and to help others learn. I don't see the point in being rude to each other.
besides I might have to maintain their code at some time in the future
 
@Malachi Good :-)
 
I love spagetthi
 
@N3buchadnezzar You'd love to see some of the code I'm working on.
mucho spaghettio.
(I'm aware that adding o to the end of a word doesn't make it Italian)
 
@DanPantry Mama mia
(adding a to the end of a word does make it Italian)
 
1:15 PM
lol
 
@Malachi For what it's worth, I think your review was probably correct.. those comments are just noise. Having an enum called Foo and then having a constant in it called Bar and the only comment being "The Bar of Foo" says absolutely nothing.
If you write documentation to avoid warnings, it's probably not good documentation.. all it does is get rid of the warning so you can avoid writing good documentation.
So in that manner I would prefer to suppress the warnings about documentation instead of writing crap docs to cover it
Similarly, having an enum named Pages with a member called First.. telling me that is the First page is not very helpful, I already can tell that just from the name :P
We should write a community book called "The Art of Code Review" lol
3
 
@DanPantry It is funny how good variable names are exchanged for crappy comments more and more the further into a project one are.
Doing it from the start is not a great solution though :p
 
      // Subject is a translation key
      $scope.Note.Subject = this.$translate.instant($scope.Note.Subject)
I'm totally guilty of that myself, @N3buchadnezzar :(
 
 // def Please_send_help_been_trapped_here_for_weeks( vacation, where_are_my_kids):
3
 
Bloody hell Microsoft
It took you until June 2016 to support SSH for Git? really? :S
 
1:31 PM
@Malachi Why did you revert an S to an s?
 
Questions for working code ... might go to codereview.stackexchange.com — Jägermeister 24 secs ago
 
@Mast I thought that was one of my changes.....
that sentence isn't really a full sentence, it is more of a sentence fragment, isn't it, @Mast?
 
@Malachi There's a full stop in front of it though.
 
@Mast and a period at the end
 
@Malachi That usually defines a sentence. However I am by far a word-expert.
 
1:38 PM
lol, I was never good at Grammar or English
but I get better every day
 
after finishing a feature:
user image
2
 
@DanPantry Git pushed.
 
git gud
 
 
Why is codereview both more professional and more fun to hang out it?
2
 
1:44 PM
Morning all.
 
*Act normal everyone!
 
@N3buchadnezzar at ease, reviewer, he's a regular.
:p
@N3buchadnezzar Because we care more about making code better than internet points, I guess. [citation needed]
The regulars of 2nd, at least, seem to have more drive for making good solutions than any other people I've met
3
 
@DanPantry I really wish you were students in my math class. All they wonder about is wheter their answer is correct. The means to produce the answer is meaningless to them.
 
When I was younger and studying maths I didn't care about the process either and didn't understand why we didn't get full marks for just getting the right answer. Having worked with other people with that mindset, I now understand why it is important
 
I would be horrified if any of them got into CS.
 
1:50 PM
Ah yes, our lord and saviour, The Flying Spaghetti Monster.
 
The flying spaghetto monstero codeo
 
Hi everyone.
 
0
Q: Convert Differential Equation into Stochastic Differential Equation

AshutoshI am trying to find a way where we can do stochastic simulation with differential equations available for a given set of reactions. Consider the lotka voltera model with following code: from scipy.integrate import odeint import numpy as np import matplotlib.pyplot as plt def lottka(var,*args):...

 
@overactor Hello!
 
Monking
 
1:57 PM
A quick question, am I right in assuming that Code Review doesn't see a whole bunch of Swift questions?
Also, I don't usually spend time on this site, but it seems like a great community.
4
I might have to stop by more often.
4
I don't exactly feel proficient enough to contribute answers though...
 
You should post some, if you can. I know someone would be happy to see in particular who would be happy to see more on this site.
 
@overactor Yea that sounds about right. is underrepresented
 
@Legato *cough* @nhgrif
shameless namedrop
 
@overactor You'd be surprised. Just go ahead and try it out.
 
@overactor Definitely do.
@overactor Even if you can't answer, just reading the answers can help you learn.
 

« first day (1129 days earlier)      last day (2893 days later) »