« first day (684 days earlier)      last day (3630 days later) » 

00:00
gcd? Only passing in one parameter.
@nhgrif Hint: Project Euler 12
oh yeah lol
would be kind of hard with 1 param....
actual method:
Pretty impressive obfuscation though.
    public static int numDivisorsFast(long number) {
        if (number <= 0) {
            throw new IllegalArgumentException("number must be positive: " + number);
        }
        int divisors = 1;
        long lastNum = 0;
        int lastCount = 0;
        while (number != 1) {
            if (number % 2 == 0) {
                lastCount++;
                number /= 2;
                continue;
            }
            for (long i = 3; i <= number; i += 2) {
                if (number % i == 0) {
00:00
ah, triangle numbers?
@SimonAndréForsberg 2 minutes early meant. And yeah, DST :)
calculating divisors!
Because a 1-paramater GCD: public static int gcd(long num) { return num; }
2
Morning peeps
ah, at least i'm not completely insane then
there was factoring involved!
just not cofactoring... :p
@Mehrad Good morning
i'm kind of disappointed in myself for not realizing the method only had 1 param thus couldn't reasonably be GCD :(
I think I'm going to do Fibonacci though. It's simple enough and a common enough problem that most people have done at some point (even non-programmers).
or well... depends on what you mean by factoring.... I did write a method to get the prime numbers for a method, but that was waaaay too slow of an approach. This calculates the number of divisors in a quite quick way
I may also want to demonstrate a case where it's important to add comments because you refactored from more readable to less readable for the sake of speed
00:03
@Corbin way too much code for GCD as well. but without proper variable names, it is definitely hard to tell what it is without running it (and perhaps it would be hard to figure it out even then)
but depends on how long this post gets before I get to that point.
yeah, i was thinking maybe it was some unnecessarily 'clever' GCD implementation
Heh... I could give you some awful Fib code I wrote too... sigh
mostly i just thought of everything i could think of that would involve factoring, and i blanked quite a bit
all i could think of was either finding primes or GCD, and it wasn't primes... so.... yeah :/
A one-parameter GCD implementation would definitely be quite clever.
00:05
@RubberDuck Yeah, because everybody looooves Fibbonacci right?
Lol. Yeah... By time I got "done" with that code I started ignoring the tag.
lol
3
@Corbin I have to give you half a point for that. It was clever, but not GCD.
Wooooo half a point!
2
kids.BeginBedTime()
00:07
for each kid As Person in kids {
    kid.beginBedTime()
}
NoSuchElementException: Kids not found
Parents.callEmergencyServices()
If you were implementing Person correctly, every Person would have an array of Kid... even if it's empty.
Or rather, every person would have an array of Person called Kids (or Children)
@Mat'sMug for the record: @Duga was right. It was reload. Perhaps a few minutes early, depends on your watch :) within two weeks though, I'll have to adjust the time for @Duga's postings with one hour I think.
@Simon - NTP
00:11
Hmmm... I wonder if I should post the obfuscated version of my method in my CR question? :)
Woah, lots of people. Awesome.
@Legato Welcome to the party!
@rolfl yes, I use that. I think.... my brother helped me set that up. I think I even got a cronjob doing it. I'm blaming @Mat'sMug's watch (until later when I will realize that indeed @Duga's time was off by a few minutes)
Well, I have .......
14 mins ago, by Duga
RELOAD!
23:58:41
alright, I'll take a look at my NTP settings.
The hardest part about doing Project Euler is coming up with a good question title...
00:14
Maybe a better fit for the Code Review Stackexchange. — Thilo 1 min ago
@Thilo Did not know that Code Review existed. You're right that it belongs there. — Kookbot 1 min ago
ntp is actually a PITA to set up.
@SimonAndréForsberg "good" as in acceptable, or "good" as in better-than-average?
That question banned user made a new account...
link @nhgrif ?
@nhgrif How can you tell?
00:15
@SirPython better than average. Better than "Project Euler 12: Highly divisible triangular number"
That's not a bad title, though
which is better than average: Make this code go fast
Point taken ;-)
-1
Q: Unable to set the delegate to class in Swift

VarnisThis is their example function [GTMagBarDevice sharedDevice].delegate = self; I tried rewriting it in swift like this GTMagBarDevice.sharedDevice().delegate = self; But I am receiving an error "type view controller does not conform to protocol GTMagBarDeviceDelegate" Any ideas?

same as this user:
For some reason I can't ask any more questions on my account, I must have done something wrong? But I have one more question i'll post here just incase you have the answer — user2034047 25 mins ago
@Thilo Code Review is NOT for seeking explanations of code written by other people, which is primarily what this question appears to be. — nhgrif 36 secs ago
GTMagBarDevice.sharedDevice().delegate = self; I am getting an error with this ... "type view controller does not conform to protocol GTMagBarDeviceDelegate", any ideas? — user2034047 24 mins ago
00:16
Thanks.
@Duga thanks, @nhgrif. Was about to comment something like that.
@rolfl to me it's bad average.
I cannot disagree.
When a post only contains a link to off-site code and you have already told the OP to paste the full code but they have done nothing, are you allowed to go to the link, copy the code, and paste it on to their post for them?
No. Can't remember what meta that was though.
Just had a rather encouraging customer service experience. I thought calling AT&T to change my mobile rate plan after I just paid today was going to be a PITA. Was pretty painless.
00:21
If I recall, it could violate copyright and is also OP's responsibility to make their Q on topic.
No, @SirPython. Primarily, the problem is copyright issues.
Was about to say the same thing ^^ ^^
But also, specifically, here... we don't actually want the entire code base. We want the OP to pick a pretty focused section of code to review ideally.
AT&T has amazing customer service.
Thank you.
00:22
@RubberDuck Surprisingly, yes. I made it a point to get a supervisor to tell them the service was good after all was said and done.
I guess...
Okay, I'm going to rethink this muddled code...
One thing I definitely want is something like a variable hiding another variable because of scope (and same name)
@RubberDuck For every generalization there is an exception
I wish more people did that, call center customer service is not an easy job, been there done that.
Aww.. That was a good typo too...
Sowwy
00:25
Agreed @rolfl. Just trying to recall the meta from memory.
Hmm... If I boot the laptop now, how late will I be up?
13
Q: Is editing code into the question good practice?

Anton GolovSome questions link to the code they want reviewed, which is against site policy. Should one edit the code into the question in these cases? The problem I see is that all content on StackExchange is cc-wiki, which may not correspond to the wishes of the author. This is probably fine when the c...

@RubberDuck Probably later than you'd hope?
evaluating 3rd party libraries
user image
3
Past, present and future: Past - two glasses of port. Present - two'nd monitor. Future - move two logical colums on a linux volume group to a 2nd physical volume....
Predictions?
> Alternately, install a localized version of Candy Crush, lock out all other features of the computer, and give it to the Furher. Then, when he's so addicted to the game that he isn't paying attention anymore...you win! (kidding, of course)
23
A: What would be the impact of modern programer and laptop being dropped into World War II, possible breaking Enigma?

guildsbountyThe biggest advantage I see being given here is simply processing power. You have a machine that can run calculations at a speed that would beggar imagination for someone living in that era. In relation to the Artillery mentioned in another answer. Generally, an artillerist would consult his ran...

00:30
Sure bring up some interesting conceptual questions, but... what for, in the end?
Here is another way to think about the question. Suppose that the response is handled by ignoring the response entirely, i.e., we do $.get(url, function(response) { /* do nothing */ }). In other words, imagine the code just does a $.get() and then ignores the response. Is that safe, or is it unsafe? (For $.getJSON(), the answer is "unsafe", even when the code entirely ignores the response, as explained at the other question. But what about for $.get()?) Note that this is a question about code review, not about what some random user viewing the source of a page would do. — D.W. 48 secs ago
What does it mean to "pimp" a post?
@SirPython announce it in chat
See, I have this post on Code review, an answer......
@SimonAndréForsberg Thank you
00:31
.... it is score 1, but I think it should be worth more.....
so I pimp it here:
Hey, check out my answer, it rocks:
1
A: Having sync and async methods by implementing future interface

rolflYour concept is flawed in a few different ways. One of the ways it is flawed is because you assume that someone calling the async method will actually call "get()" on the Future. This is not certain. Many times, with async systems, it is convenient to submit&forget a task especially if you don't...

Right @Phrancis? I mean, I love WB though. Those guys just never quit.
@rolfl To me, it seems as though most people would perceive this (and others like this) as rude
You don;t have to pimp your own stuff... ;-()
It's kind of like purposely editing a question of yours so it gets put higher on the feed.
Check out this comprehensive answer:
1
A: Slider module and extending it further

SirPythondocument.querySelector While it is a great function to use, you are using in the wrong situations. For every time you use it, you are getting an array of elements with a class that you passed in to the function. Why not just use document.getElementsByClassName? Sure, it takes a little bit long...

00:33
@SirPython That's why we only do it occasionally for our own stuff
(pimping, not edit-bumping)
See, the effect of pimping ;-) :
Yes. Thank you ;)
Let me rephrase the question yet another way. Suppose I'm doing code review to check Javascript for XSS vulnerabilities, and I see $.get(url, f); in the code. Suppose I know that url can be completely controlled by the attacker. What do I need to check, to verify whether this is safe (free of XSS bugs)? I already know that I need to check the code of f to see whether it handles the response safely, because if f is careless it could introduce a XSS bug. My question is: is that the only risk I need to check for? Or is this code pattern always unsafe, regardless of how f is coded? — D.W. 1 min ago
4
A: Having sync and async methods by implementing future interface

rolflYour concept is flawed in a few different ways. One of the ways it is flawed is because you assume that someone calling the async method will actually call "get()" on the Future. This is not certain. Many times, with async systems, it is convenient to submit&forget a task especially if you don't...

;-)
I always thought that, when a question was answered, it would get put back on top of the feed. But, from a recent post of mine, I discovered that that is not true. What does it take for a post to be put back on top of the feed?
00:36
It gets put on top of the feed.
It might take a minute or so.
gets put at the top of the 'active' feed, and the front page. not the new question feed.
Dammit, I think there's a bug. kids.BeginBedTime() looks like it's recursive. And I keep getting the occasional PoopException...
3
That must be it; I was probably looking at the wrong page
00:38
Talking about pimping:
3
A: My Rational struct, version 2

nhgrif namespace NotSystemAndOthersThingsThatIHaveNoPracticalUseFor I couldn't possibly imagine a worse namespace. Why not use something both simpler and more descriptive? namespace RationalMath

Edits to posts (Q's or A's) also bump the front/active page
Look out @Mat'sMug. It's often followed by NeedsAGlassOfWaterException.
Wtf is the "frequent" feed for? More importantly, why is the top question ANOTHER PHP/PDO question!
Comprehensive answer, isn't it? But true.
Let's see, when I was a kid, I tried both of those, as well as needing lotion.
@nhgrif - This - No need to demonstrate a fix:
> This is not an answer. This might make sense as a comment, but it's not an answer. For this to make sense as an acceptable Code Review answer, you'd need to explain the reason and demonstrate a fix.
00:39
@rolfl How's this for a title?
0
Q: Triangulate the divisors and divide the triangulars

Simon André ForsbergProject Euler 12 - Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be \$1 + 2 + 3 + 4 + 5 + 6 + 7 = 28\$. The first ten terms would be: \$1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\$ (...) 28 i...

......
Yeah. Much better @SimonAndréForsberg
That ^^^^^ is effective pimping ;-)
@SirPython What are you, a politician?
Where is the link, though?
00:40
@RubberDuck thanks. Will be hard to beat "A grid and a menu walked into a program" that I came up with for Henrik though...
> The same goes for a bigger number, such as 32063349528.
@rolfl Well, I'm right that it's not really an acceptable answer though, right?
@SimonAndréForsberg Did you just let a cat on your num pad? ;D
@nhgrif It was not a good answer, but, a word-wise description of the problem is an adequate review.
A working counter-example is unnecessary
@SirPython - more subtle pimping is this:
This good answer was given to a question that was deleted, and then recently undeleted:
1
A: Efficiently having a sync and async method by implementing future class

ratchet freakYou should rethrow any InterruptedException, they are meant to shutdown the current thread or in the case of Task.call signal cancelation of the task. I would change execute synchronous to just creating the Task and calling it without messing with the executor: @Override public DataResponse exe...

Does that put it back on top of the feed?
00:43
@Phrancis Nope. I got that number from one of my earlier runs, where I had a method running that did an actual prime factorization. It seemed like an interesting prime factorization to test with, so I asked WolframAlpha how many divisors that number had, and I was happy to find out that my new approach that I just had come up with seemed correct!
@SirPython Undeleting does, yes
I have the best pimping style:
The best thing about doing a slow approach and a more elegant approach is that you get a method to test your newer approach against.
@SimonAndréForsberg Hah ok. I'm still a bit astounded at how big of numbers computers can handle in the blink of an eye.
> I just wrote this answer, and I'm not sure if some of my points are correct. Could some <language> person take a look at it?
00:44
Thanks, but that kind of thing is not likely to appear in normal code, so this doesn't really answer the question of what checks I need to do when I see $.get(url) during a code review for XSS. Or, to put it another way, it sounds like you are saying the answer is "$.get() is unsafe if the code handles the response unsafely by <this crazy thing involving global variables>". OK, fine. But what if the code doesn't do that crazy thing? Is the code safe in that case? — D.W. 6 secs ago
<Post URL here>
By the way, today a work, we figured up our project to be 1.7M lines of VB.NET code.
Sounds like a lot, but not really surprising.
No. No no no.
HOLY CARP
00:45
@Phrancis Me too for the most part. But you should know that the prime factorization method was definitely not a fast one.
If you are writing an ERP in VB.NET, what do you expect?
@Phrancis IJRATCRMT
@SirPython ???
I expect good clean code @Hosch250.
@nhgrif it's not a fizzbuzz is it?
5
00:46
I just read a trash comment...
@Phrancis I just read about that Code Review meme today
@RubberDuck ERP's are HUGE.
(it's a meme inside a meme, sort of)
@Mat'sMug FizzBuzzPlopPingBlurpDorpArg
3
I am willing to bet it doesn't need to be 1.7m LoC huge.
00:47
It doesn't.
3
Q: Triangulate the divisors and divide the triangulars

Simon André ForsbergProject Euler 12 - Highly divisible triangular number The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be \$1 + 2 + 3 + 4 + 5 + 6 + 7 = 28\$. The first ten terms would be: \$1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...\$ (...) 28 i...

@SirPython You must have read about IWNPFETTOLAI also then :D
@RubberDuck I am willing to bet as-is, it doesn't need to be.
I can easily see it growing to 1.7m LoC with more features.
Also... for a full ERP system and/or 1.7M LoC... I'd expect more maintainers than we currently employ.
From what I'm reading, you can't make an ERP too big or powerful.
@nhgrif Does that guy you're hiring need to know VB?
00:48
We haven't hired anyone.
I know.
@Hosch250 and how not to write VB
@Phrancis ???
@nhgrif Hm. If it were Java, you'd probably halve the amount of LoCs... and double the amount of characters :D
That seems to be an elusive skill @Mat'sMug
00:49
18
A: What's a Zombie? And what are the many other memes of Code Review?

Vogel612Name: Overly long acronyms Originator: Simon André Forsberg Cultural Height: The 2nd Monitor Background: IWNPFETTOLAI (I will not provide further explantion than this overly long acronym itself)

@SirPython ^^
If you haven't hired anyone by next summer, and I can persuade my parents to let me come over, I'm interested in doing an internship for you, if you don't mind someone with little knowledge of .NET ( :( )
@Phrancis You just broke the first statement to that meme - you provided further explanation.
3
I do learn quickly, though (at least, I've been told I do).
ducky hides before he gets hit with another link to an app
@RubberDuck No, I'm not going to post that again.
Sorry if I've bothered you guys.
00:51
@Hosch250 Everyone is a bit bothersome here.
3
Huh? I meant nhgrif.
Oh, I thought you were referring to my app.
I've been looking for work and he keeps reminding me that they're hiring.
Oh, and you can't move, you said?
Yeah. =)
00:52
@CaptainObvious Nice title ;)
@Hosch250 You mean summer 2016?
Yes.
That's a million years away.
I am slated to take an internship next summer, but I may be able to take it this summer.
We'll see RD v3.0 by then. Lol
00:54
Good night, everyone.
I would have to contact my adviser.
Night, @SirPython
See ya @SirPython
lvreduce --resizefs -L 230G /dev/mapper/kubuntu--vg-root
Do you want to unmount "/"? [Y|n] n
fsadm: Cannot proceed with mounted filesystem "/"
  fsadm failed: 1
  Filesystem resize failed.
Drat.
BBIAB, I need to reboot.
00:55
I should probably start looking for my internship in September
Although I'm too late for a F1 visa anyway
@RubberDuck - I have a 1TB HDD, and a 240GB SSD... I am trying to move everything from the HDD to the SSD.
~# df -h
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/kubuntu--vg-root  901G   93G  763G  11% /
none                          4.0K     0  4.0K   0% /sys/fs/cgroup
I am only using ..... 93GB of the HDD partition.
I'm willing to send you my source code of you want to know what level I'm at.
I was hoping to just resize and relocate the logical volume....
I will just have to do things "the hard way".
Almost everything I know is in it at some point.

« first day (684 days earlier)      last day (3630 days later) »