« first day (1162 days earlier)      last day (2858 days later) » 
00:00 - 19:0019:00 - 00:00

7:06 PM
Anyone else find themselves occasionally going overboard whne trying to review code?
There's so many points in this question that could be improved but it's hard to implement all of them.
 
@DanPantry Yeah. It is hard to know how throughout one should be.
 
I mean, the code itself is 242 lines long, even without my modifications
it's that type of code that I can just see becoming spaghetti (it already is) if someone doesn't modify it though
 
If the user is a beginner I usually point at the low hanging fruits, fixes the glaring mistakes and reffer them to some links regarding best practices.
 
For those doing the Monopoly challenge, check out this and this for values / board orientation.
 
@DanPantry In the end, if there's things that can be improved and you know about it, it should probably be added to your review. I'm actually in the process of expanding my (already kind of long) answer here: codereview.stackexchange.com/a/134241/88422
 
7:08 PM
@user2296177 I've added the points, but generally I like to show a complete code sample with all of the changes I've made with the review.
 
@Legato Also need to include community chest and chance cards!
 
It's very hard to actually review this because it's one of those typical javascript apps where the view logic and business logic are not separate at all
 
I@DanPantry I don't think you have to reimplement the code, you've already given a good review, but if you do find the time and actually do it, you can just put it at the end with a "this is what it looks like after changes" comment.
As in, your review already shows what could be better without explicitly having to show the changes.
So it's up to the guy who asked the question to apply it.
 
@user2296177 I somewhat disagree, what does the poster learn from just copying code?
 
@N3buchadnezzar I tend to give code as well as explanations of what I have done.
see here.
 
7:12 PM
And how can you be sure the poster actually read your review?
 
Also with the preface that the code on it's own won't likely work on it's own without modifications as I haevn't tested it, but it's a pointer towards how it might look with the points I've given taken into account.
 
@N3buchadnezzar I wasn't clear, I meant that you don't need to post the code with changes since you already gave suggestions, that is to say that the question's creator should be the one to actually implement it.
 
I can't guarantee they've read my review; they might as well have copied pasted.
If they've done that though they were never interested in the review in the first place, and would likely have: "oh, no complete code samples? give checkmark out to random person, close tab"
 
Most do not know what is good for them >x<
 
Monking!
 
7:13 PM
IMO my code sample being there is a benefit for reviewees who need more instruction, and so it's worth the effort
monking @Phrancis
 
It is a tough balance.
Deppends on the question, both in terms of complexity, length and how much time the poster has spent writing the question / the code.
 
The code in the review I just did is sufficiently complex that I would only give a code sample if there was a hefty bounty on it.
 
@Mast @SimonForsberg I might be, what do you have in mind? (for CR ad on PPCG)
 
@DanPantry I totally agree with your decision though! +1
 
Connected, @DanPantry.
 
7:19 PM
@Hosch250 ヽ(´ー`)ノ
 
What kind of face is that?
 
it's supposed to be a cheering one
 
It looks like a 2D pig face, or something.
 
( ͡° ͜ʖ ͡°) > ====∈ ヽ(´ー`)ノ
 
What kind of face is a Lenny face supposed to be?
 
7:23 PM
Lenny is just... Lenny
 
And what is Lenny?
 
@Hosch250 Please correct the wording:
I find the paragraph about tailoring the answer to the apparent level of the code writer somewhat confusing. Specifically when before the question answer is ready.pacmaninbw 44 mins ago
 
> you should not provide an answer suggesting advanced features before the question author is ready.
Is that a little better?
 
@SimonForsberg @Mat'sMug it turns out the reason why OP is trying to load so much data is because he's making a log viewer. My response.
 
@Hosch250 I would rather phrase it as @200_success phrased it. "One should strive to tailor the answer to the apparent level of the code writer"
 
7:26 PM
I like that too.
 
Better to tell someone how to behave instead of telling them what they are doing is wrong =) Psychology wise
 
@DanPantry Don't think I could have said it better myself (although I could have provided a link with more information). There's no way you can keep that much data in memory at once.
@Phrancis I don't have anything in mind at all :)
 
> Code Review: When shorter is not always better.
 
Love it ^^
 
@Hosch250 Interesting read: knowyourmeme.com/memes/lenny-face
 
7:29 PM
@Phrancis Code Review: Size doesn't mean everything
2
 
LOL
 
Code Review: The light side of the force.
 
I would avoid being overly prescriptive. Sometimes, using an advanced language feature happens to make the solution much easier.
 
@Phrancis ( ͡° ͜ʖ ͡°)
 
IMO the CR ad on PPCG idea should probably go on meta
 
7:31 PM
@DanPantry size matters
 
This room is quickly becoming off topic :P
@Phrancis What's the reasoning behind having it? @SimonForsberg
 
1 hour ago, by Simon Forsberg
So apparently the PPCG folks have Community Ads now, I added one for Brainduck but what someone else said made me think:
1 hour ago, by Simon Forsberg
in The Nineteenth Byte, 1 min ago, by Downgoat
@SimonForsberg >_> i have a bad feeling it's gonna be "stop writing bad code and come to CR"
Side note, I've written a utility method to prime-factorize a number in C#, it's not a lot of code, but it's kind of slow and I feel I could be doing things better, is posting just one method too short for a code review? About 25 LoC counting the braces
 
Shouldn't the subints exclude 1079? Also this question is about performance improvements of working code, which belong more on codereview.stackexchange.com. — Spencer Wieczorek 49 secs ago
 
@Phrancis 25 should be plenty fine, we've had 4-5 liners before
 
Should be fine, but you might get the please try this completely different algorithm comment
 
7:38 PM
Okay, I'll include test cases as well
@N3buchadnezzar That's also OK :)
 
@Phrancis I'd support that line as an advert, but it may be too honest.
 
is @konijin back?
I've seen him post a few times today
 
@DanPantry He's been more active recently
In other news.... can anyone explain this one to me?
 
7:56 PM
@SimonForsberg Magic
 
Couldn't have said it better myself...
scratching head
 
@SimonForsberg CGI
The green screen is not used as green screen. Likely he has some blue object which he places which is CGId into whatever they need it to be.
 
Notice how he only touches the extreme borders.
@SimonForsberg Computer animations.
 
So... you think he's cheating?
If he would be cheating, he wouldn't be a finalist in the Best Illusion of the Year Contest of 2016.
 
8:02 PM
No, he isn't cheating. You're just looking at a computer rendering instead of something 'real'.
 
If there's nothing broken about it, you may get better feedback on codereview. — kfsone 47 secs ago
 
The real part is having a post-recorded overlay.
Have you seen Wolf of Wallstreet?
It's a lousy movie, but they took computer animation to the next level.
Almost nothing on set actually happened.
Just like LotR.
Harry Potter, any Sci-Fi really.
Star Wars, Star Trek.
They aren't illusions. They're simply digital creations.
I even doubt whether that's a real mirror he has there.
 
I honestly do think it's real.
 
I second that^
 
Perhaps there's something special about the mirror, but I don't think a computer has anything to do with it.
 
8:06 PM
I don't think it can be done without one.
 
With the right objects, the right mirror and the right angles you can do pretty cool stuff.
Especially the angles are important.
 
If you look at 00:15 you can see grooves on the top of them. With some clearly going up and some down.
 
Nvm, the solution is here.
Obvious spoiler alert.
They're squarcles.
That was done really good though, I checked for indents in the original video and couldn't find them.
 
Naruto answer; accepted non-selfie answer with 0 score: Checkboxes array to delete images
 
0
Q: PrimeFactorize method for int

PhrancisI have written this PrimeFactorize utility method in C# (using LINQPad) which appears to work great, but feels like it is a bit slow, I was wondering what might be improved. Also looking for any criticism not related to efficiency to make the code better. // Generate prime factors for a number, ...

 
8:11 PM
@CaptainObvious You get a star today
 
@DanP Why?
 
@Phrancis you should include your primes between code
 
@Mast I agreed witr hthe reasoning
with
 
I agree too
nothing about winforms in there
 
@N3buchadnezzar done
 
8:15 PM
=)
 
Ripe zombie; open question with answers, at least one answer having score 0, no answer having score > 0: SessionHandlerInterface Class
 
@DanPantry I think it says something about context.
 
I did initially think that, but OP is only using calculations - there's nothing about UI work in there at all.
The only winforms related thing is the method name - you could copy paste that code and put it in a normal main method and you'd see nothing different.
 
In any case, it wasn't the editors call to change it.
That's way out of his jurisdiction.
Use a comment instead.
 
of course properly tagging a question is what an editor can do
you've got an inline edit-tag function for precisely that reason, for starters
 
8:26 PM
@CaptainObvious Deleted? @Phrancis
 
Deleting my post temporarily, I just realized my measurements are skewed
 
Does PrimeFactorize(12) really produce 2 2 3?
 
@200_success Sure does
The output can vary depending on how you use the IEnumerable, that's where I found my tests were skewed
I'm basically right now just calculating the time it takes for the runtime to call the state machine for the iterator, not to actually do the work
 
0
Q: Improving rendering of JOGL

user111000I'm trying to use JOGL and Java to draw a hexagonal based game. I currently have it so that it displays correctly, however it seems to run poorly and needs optimization. Currently I create a glList that has objects for the cells, the cell walls and the player. When I draw one these objects, I ...

 
gah, I should have read the rest of the transcript
 
8:42 PM
Ugh, LINQPad is missing some very useful assemblies
System.Diagnostics.StopWatch and System.Random, among others
 
@Phrancis try Visual Studio ;-)
Oh wait, Apple right?
 
Look what cool horribly over-engineered code I just found!
3
11
Q: Project Euler "Largest prime factor" (#3) in Java

skiwi The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? I wrote the following code with help of some Java 8, I'll explain the equivalent to Java 7 under the code. I'd like general comments. One note to give up ahead is that I did not...

 
@Mat'sMug No I don't have the Apple anymore, bought a Windows 10 laptop a few months ago, remember? ;P
I think firing up Visual Studio to do Project Euler problems is probably overkill though. I was going to use those just for benchmarking, but I think I found a workaround
 
This question is probably better-suited for the Code Review stack exchange site, since that allows detailed discussions of improvements to working code. — TheBlackCat 47 secs ago
 
OK, it's fixed now, sorry for the inconvenience codereview.stackexchange.com/questions/134394/…
@200_success ^ I included the test case results as well
For some reason I can't see to make <!-- language: lang-none --> highlighting hint to work for the quoted code block console output
 
9:06 PM
Slick. I'll be back to award a bounty for teaching me something new. ++ — RubberDuck Sep 12 '15 at 11:49
@RubberDuck Did you ever come back? ^^
(Just found that question)
 
Hmmm?
 
@Phrancis That's what I can't stand about VS--it is too slow for simple editing.
I'm constantly dreaming about building a basic text editor around the Roslyn compiler, but I doubt I'll ever get around to it.
 
@Hosch250 Could you maybe build a plugin for an existing text editor like Notepad++ or Sublime Text 2?
 
Maybe, but I'd kind of rather build my own on the Universal platform.
If I got a phone as reliable as mine was on 8.1, I'd definitely use it for experimenting with small snippets when I wasn't at my computer.
 
9:20 PM
:3092236 Did someone mention Sublime? Drools
 
It's :30922361
 
@Phrancis I think I have an improvement for your algorithm (without changing the basics)
 
@N3buchadnezzar Is it enough to put it in an answer?
 
You check primes up to the length of your number right? But you only need to check up to the square root.
@Phrancis Oh, I have no clue about C syntax :p
Say n has two factors a*b = n. Where b > sqrt(n). Then we will find b after we have divided n by a.
 
That's what I am doing now, no?
Well, I'm not doing sqrt, not sure where it would change though
 
9:24 PM
    List<int> primes = IntUtils.GetPrimesBetween(2, number);
    while(!IntUtils.IsPrime(number))
Change the top row to sqrt(number)
 
Continuing on that note, wouldn't it be better to use a prime generator instead of a prime list?
 
I wonder who at Microsoft decided that the Math methods in C# should work on double but not on int.
@N3buchadnezzar Per above, I would need to refactor several methods to make it work, are you sure it's worth the while?
 
@Phrancis Why? You would only need to generate a smaller list of primes?
 
@N3buchadnezzar I would need to convert everything to use the long type though, or roll my own version of Sqrt to work with the int type
(which may be a good idea to do anyways, the latter that is)
 
When I say sqrt I really mean int(floor(sqrt(n))) or something like that
Just take the square root and round down to the closest integer-
 
9:33 PM
ok
 
def prime_factors(num):
    if isprime(num):
        yield num

    limit = int(num**0.5) + 1

    # Import some magic list of primes
    primes = generate_primes(limit)

    i = 0
    prime = primes[i]
    while prime <= int(num**0.5):
        while num % prime == 0:
            num //= prime
            yield prime # Returns the next factor
        i += 1
        prime = primes[i]
    yield num
I think this is something what you are looking for. I tried to write it as close as possible to your implementation.
 
OK great thanks
 
Note that the int(num**0.5) changes every time you run the loop. So you are narrowing down the search for each successive prime division.
 
Is num**0.5 like a Sqrt?
 
@Phrancis Yeah, exactly. I just used it to avoid importing math.sqrt
Just ask if something is unclear. THe only change should be that you refer to prime by index instead of iterating over them. Hopefully that made sense :p
 
9:37 PM
So in general, N-root(X) is the same as X^(1/N) ?
 
indeed =)
 
UGH I wish I paid more attention in math class lol
 
you can get it into your head over the multiplication rules
because that's what exponents are
Monking btw
 
Monking!
I feel like PE problems would be a lot easier to solve programmatically with Lisp/Clojure than C#, seems like C# is just constantly getting in the way
 
Every number not a primes n has at least one factor less than sqrt(n). Assume by contradiction that this is false. Since n is composite then n has atleast two factors right? So n = a*b. Since the statement is false a > sqrt(n) and b > sqrt(n)
But then a * b > sqrt(n) * sqrt(n) > n
And we have reached a contradiction.
 
9:41 PM
Hmm I see that
 
It is a cute proof.
 
@Phrancis those are more "mathsy" languages, yea
though you can make it easier on yourself if you think about the problem before brute-forcing it
 
Right lol
 
@Phrancis I am thinking of switching to C# because Project Euler starts to get hard. Lol
Just gotta have that machine code fix, man.
 
Decisions, decisions
Unless you really want to learn C# though, you'd be better off with a more mathsy language
 
9:44 PM
What about using the evil language that decieved Eve?
 
Lisp is surprisingly fun, despite all the crap it gets about the round brackets
It's been used a lot in academia for decades
 
FORTRAN. Or Ada.
I can't recommend COBOL unless you are a bank.
 
I usually use a day or two reading up on Project Euler before I start to code.
 
2
Q: Project Euler #35 in Common Lisp

korabelnikTo start with Common Lisp I am doing Project Euler using this language. Usually I manage to solve problems but I am quite sure that my code is not as efficient as it could be in Common Lisp. That is why I need a review from experienced lispers. This is my code for problem 35. Please offer any im...

 
Really helps avoiding writing sub-optimal code.
Unfortunately I am not a experienced lisper :p
 
9:47 PM
I like writing many versions. Usually I write a quick brute-forcer, then think about what it does and how to optimize it.
 
@Hosch250 Been writing a pdf on some of the PE problems =)
 
@N3buchadnezzar Lisp is pretty easy to pick up. Clojure (Lisp dialect that compiles to JVM code) in particular is really cool
 
(Too ((many) parenthesis))
 
@Phrancis Varying output is probably not intended.
@N3buchadnezzar Python is about the best language you can get for Project Euler IMO.
 
9:57 PM
@Mast Eh. Maybe for the first 100-200
 
Python is good at math.
Take a random problem above 200, 354 for example. Why would C# be better at that than Python?
 
Oh, yeah, Python looks good for PE/math
 
Or 421.
I'd definitely pick a language like Python or Ruby over C# here.
 
10:20 PM
I looked some more into C#'s Math stuff and finding out it's really not been designed with math in mind. I'm only at PE5 so maybe I should switch now instead of later
All the Math stuff has to be Doubles, and Doubles don't support any of the regular operators like == or >= instead it has to be Equality(x, y) and GreaterThanOrEqual(x,y)
 
10:57 PM
1
Q: Efficient text to binary conversion in Java

AdempusI wrote a Java FX application that translates binary to and from String and numbers in Java. Whenever the program is translating large amounts of text to binary it takes a very long time, and leaves the application unresponsive. Could a more efficient algorithm be used to speed up the process? ...

 
Hmm, this wasn't so bad, after all
public static int NRoot(int number, int nRoot)
{
    double _number = (double)number;
    double _nRoot = (double)nRoot;
    double result = Math.Pow(_number, 1/_nRoot);
    return (int)Math.Floor(result);
}
 
11:32 PM
monking
 
monking
 
11:54 PM
@Phrancis those are both in mscorlib. It's there, you just might have to do an import
@Phrancis what about it doesn't have math in mind?
 
2 hours ago, by Phrancis
All the Math stuff has to be Doubles, and Doubles don't support any of the regular operators like == or >= instead it has to be Equality(x, y) and GreaterThanOrEqual(x,y)
In other words, integer math is very limited, you pretty much have to roll your own functions
 
what functions are you talking about?
There's a reason double has to be compared like that and it's language-agnostic
 
Like Pow, Sqrt and other stuff in Math
I know floating point numbers have special characteristics and all that
 
Math specific items like that have their own equality systems because the internals of most languages want a value to compare which usually goes back to a general int, for example, comparing Dates in JS works because they give unix timestamp ints to compare
 
There's an implicit conversion from int to double. Why is this an issue? Math.Pow(5, 3) is perfectly valid (both args are integers here)
 
00:00 - 19:0019:00 - 00:00

« first day (1162 days earlier)      last day (2858 days later) »