« first day (597 days earlier)      last day (1993 days later) » 

7:10 PM
Q: Private methods in Angular factory

LaurensI have the following code for an Angular factory that enables and disables geolocation when the app is opened and paused: MyApp.factory('geolocation', function () { var _clearWatch = function () { navigator.geolocation.clearWatch(_watch); }; // More functions omitted for bre...

Q: Achieving a never-ending loop of game tasks

ChrisTThe following is a basic implementation of a loop which is intended to launch a series of games in a loop (generic ones that can be overridden, but that have always have finite durations). The intention would be that a game can broadcast events to clients and would always broadcast its completio...

7:27 PM
Alright, how active are the folk in here at the moment.... what odds on a pizza question for ,, and
I don't know.
I know HTML and CSS.
It sure has been quiet today.
It seems so....
I've been building my question for a bit.... so been off-site.
@RubberDuck I have one lined up ;-)
I wrote a WPF FizzBuzz to try for pizza, but no one wants to review it.
I'm holding off on posting it.
For a while.
@rolfl I'm around and knowledgeable enough on HTML and CSS, not so much JavaScript :)
you can count on me @rolfl
7:31 PM
4 .... (if you count me).
Let's see how it goes, will post in 9 minutes ;-)
Still getting the snippet right.
Hmm, I'd wait until 5, unless someone posts twice.
Here's @nhgrif. Maybe he'll help.
I'm at work
rolfl is trying for a pizza hat.
7:35 PM
And I don't know those languages
OK, I was just wondering.
can you review AWK ?
can you review Perl?
@janos I can read it, but have never written it in earnest.
7:41 PM
I can do perl, somewhat
I'm gonna need a few more people :)
Q: Radix Sort with C++

TanvirI have tried to implement Radix sort in c++. At first the input array is traversed and for each number the lsb is found. Then the number is put into appropriate bucket according to it. For example for an input array { 123, 45}, at first 123 will be put into bucket 3(because 123%10 == 3). 45 goe...

Hey @Malachi - you in for a pizza attempt?
1 hour ago, by Malachi
now I get to scour a report and re-label stuff and change things, so that they can reject the report and go with the one that it built into the 3rd party application like I suggested after someone pointed it out that the built-in already does what I need it to do.....
wants me to spend a couple of hours on this report that will probably get scrapped. but the report is crap and seems to be taking a very long time, it is horribly written, one of my first. and I really don't want to write it over again
7:44 PM
so maybe it's time for a quick pizza break :)
and neither report is returning data now....
+ easy CR rep
@janos a-friggin-greed
Yup, ready, steady go.
Q: Who's in the fellowship? When are Frodo, and the rest of the gang, together

rolflAs a variant on the fizzbuzz concept, and as an exercise for learning JavaScript, HTML5, and CSS (I know none of them very well). The regular fizzbuzz is somewhat tired, but having a web-based, visualizable output seems to be useful, and being able to adjust the inputs at will, allows you to see...

@CaptainObvious Off-topic and unclear what is being asked, in my opinion.
7:50 PM
Q: Who's in the fellowship? When are Frodo, and the rest of the gang, together

rolflAs a variant on the fizzbuzz concept, and as an exercise for learning JavaScript, HTML5, and CSS (I know none of them very well). The regular fizzbuzz is somewhat tired, but having a web-based, visualizable output seems to be useful, and being able to adjust the inputs at will, allows you to see...

Q: generates all permutations of a list

pdh54449I'm looking for feedback on the following functions to generate permutations of a list. I'm new to programming and did this as an exercise after taking an on line algorithms course. I think it faster than itertools.permutations Thanks. def perms2(a_list): '''takes a list and generates all pe...

Could not resist the temptation....
@janos around?
A: Extensible and testable FizzBuzz

skiwiThe code in general looks quite good, although it may be slightly over-complicated for the problem it is trying to solve! You can improve though by using a StringBuilder rather than directly adding two strings together: public String getValue(int num) { String output = ""; for (Fizzer f...

I worked a bit on 'simplifying' your FizzBuzz solution
@skiwi busy now making pizza
Damnit, @Hosch250 - that one thing I will re-edit.... I thought I snuck it in fast enough.
I updated my answer.
No, your answer was right, and I reverted my question....
7:54 PM
Go beat this
public String getValue(int num) {
    String result = fizzers.stream()
        .flatMap(fizzer -> fizzer.flatMapIfCanDivide(num));
    return (output.isEmpty() ? Integer.toString(num) : output);
There was a bit of confusion over the snippet working or not, and I 'fixed' that by adding a prompt text.
It's almost as simple as the original FizzBuzz problem again!
But, it has multiple components, dynamically updates, is web-based, in a snippet, and you can have multiple factors.
And, I am new enough at the language(s) that it's all new to me;-0
It's funny how @janos on my implementation suggested to not use StringBuilder, and I suggest on @janos' implementation to use StringBuilder, kind of makes a cycle.
One more!!
8:02 PM
"Your pizza has arrived!"
OK, I'll merge my answers now.
Or maybe I won't.
Q: Python Prime Number Sequence generator

supersmarty1234I have just started using python, and i am attempting to make a prime number sequence generator, where it will print the a specified amount prime numbers in terminal. I have other versions of this also, and versions for the Fibonacci sequence, although, I will post just the version for prime num...

Q: My recursive parser is wet behind the ears (well, it's not DRY at least)

Mat's MugYes, I've written this ........crap. I'm guilty of Ctrl+C/Ctrl+V coding here, of which I'm very unproud, but I'm not sure if it's because I messed up or because it's just the way it has to be (please, no!). [ComVisible(false)] public class Parser { private readonly IEnumerable<ISyntax> _gram...

@janos I am so confused... if, I have the following:
  for (var tmp in fizzPlayers) {
    table += tmp.id + "<br>\n";

  for (var i = 0; i < fizzPlayers.length; i++) {
    player = fizzPlayers[i];
    table += player.id + "<br>\n";
The result I get is:
Value	Message
@rolfl got the pizza yet?
Nott sure ... let me check
Whoo Hoo:
> You earned 30 Minutes or Less on Code Review!
8:09 PM
phew, congrats!
I posted my 2nd answer at 17 minutes.
@rolfl I just noticed you have multiple loops like that, will check in those too
None of them 'do the right thing' for me unless I index them.
but first, @Mat'sMug are you going for pizza with that?
@rolfl that's very strange. I've never seen that not working in any browser. I'm in Chrome now btw
Lol, every answer tied at 5 on your question, @janos.
8:20 PM
you mean rolfl's
No, not quite.
on my today's question there's an answer at 7 and 3, none at 5
@rolfl somehow the other loop doesn't work if I rewrite, looking closer now....
Oh, yes, rolfl's.
@janos - if you want to follow it through, i have the system as three files on my linux machine, if you want to do it on your own servers/debuggers/environment
I lost a lot of time to this issue, so it has me curious, and a potential SO question in there too, but I could not isolate it to my satisfaction
@janos nope
but I wouldn't mind one ;)
8:25 PM
I get as much satisfaction out of a virtual pizza, as I do out of making my own real pizza from scratch....
@rolfl mind if I post on SO? I really want to get a pizza somewhere, and SO could be easier than here
@janos No, I don't mind at all...
I don't know whether it's my own lack of knowledge that;s the problem, or if there's something else.
@rolfl That's my favorite thing to do with the kids.
If you have that confidence... then go for it.
that will be my x-mas bounty
8:28 PM
@RubberDuck Well, if you follow the corollary, I get a lot of satisfaction out of making pizza from scratch... a lot....
which is a way for me to say thanks all, for helping me with the pizza ;-)
LOL. I was ready to VTC it for a second. =;)-
Hello people..
I am short of 15k rep by 86 rep and short of Rep Cap by 63 rep!!!
any JavaScript gurus around? (ready for a pizza on SO + maybe easy rep?)
8:32 PM
@janos - post the Q back here.... ^^^ that
@konijn @flambino @200_success ^^^
just a click away from posting, I'll give it a few minutes in case 200 shows up
@janos I'll check tomorrow if I can improve your FizzBuzz implementation even more!
Too bad there's no generics over primitives yet, but only peasants use int for FizzBuzz anyway
cool, thanks @skiwi
8:33 PM
Real men count in BigInteger
@skiwi nope... they count in AtomicLong...
and one more... and one more... and one more..
Why would you need generics for fizz buzz?
until it wraps over
@nhgrif to change the Number type..
that being said: <T extends Number> sounds about right.
because... nitpicks???
8:35 PM
@nhgrif You can't expect people to only count in int obviously
You can use generics with primitives in Swift btw
@skiwi Real men (like me and Carlos Ray) can count to infinity
time to go get my Daughter from school. then hopefully by the time I get back that report will be done running for the second time....lol
in VBA, 29 secs ago, by Mat's Mug
I just realized "_" looks like a spooked out smiley
so, no other AWK or Perl reviewers?
maybe it's for the better. putting out my old crappy Perl scripts will be extremely embarrassing
What's your question?
8:40 PM
Can I mute notifications of comments on an answer?
Or do I need to just delete my answer?
Q: Cannot convert traditional for loop to for-each loop

janosFor some inexplicable reason, I cannot convert this loop into a more natural for (var player in fizzPlayers) { ... } loop: for (var i = 0; i < fizzPlayers.length; i++) { var player = fizzPlayers[i]; var val = parseInt(player.value); if (val != 0) { active.push(player); ...

^^^ @200_success
I'm trying to look for the duplicate.
thanks 200
need 2 more answers for the pizza
5 answers in, hopefully this will work out
and I can use the answer in my answer for Rolfl :)
5 answers in 5 minutes - wow.
6 answers in 6 minutes - wow.
8:49 PM
And no upvotes..... any question that gets that much interest deserves an upvote.
There. Fixed it.
I +1'd it.
Are enough C#, XAML, and/or WPF people here to get a pizza?
At my in-laws, in rural ontario, and the net went down... missed it alll
Q: What can I do to this PHP CRUD Object to make it better?

PrinsigI'm trying to create a single class to interact with my database (MariaDB, in this case). Is there anything I can do to improve this code? It's not quite finished, but I want to check it before I progress. I'm fairly new to PHP OO. <?php namespace TOB\Model; use \TOB\Utility as U; abstract cla...

I saw that.
8:57 PM
Woah, people must have been so impressed by my answer, that they didn't see those compiler error
@RubberDuck thanks a lot @RubberDuck !
got the pizza, awesome!
hey guys
#1 again on MSE. That is until the other #1s manage to get their missing hat. Which is only a matter of time
Q: Call methods of a collection of interfaces with a single call

PhoenixSo I have the following: public interface Client { void Operation1(); void Operation2(); } public class Client1 : Client { public void Operation1() { Console.WriteLine("Client1 - Operation1"); } public void Operation2() { Console.WriteLine("Client1 -...

let me know if you understood anything
9:14 PM
@janos - was so engrossed in getting my stab-at-pizza question ready I did not see any other questions go through... including your fizzbuzz.
it wasn't meant for pizza
How many of you know C#, XAML, or WPF?
For what it's worth, about that missing hat, I think I have to go to SO....
I actually didn't expect as much feedback as I did
spam a bunch of java answers there.
on users with < 15 rep, and obscure topics
9:17 PM
Ugh, I just broke Java again @janos
public class FizzBuzzDemo {
    public static void main(String[] args) {
        FizzBuzz<Integer> fizzBuzz = FizzBuzz.<Integer>builder(i -> i + 1, (number, divisor) -> number % divisor == 0)
            .add("Fizz", 3)
            .add("Buzz", 5)
It only compiles if I provide the type witness up there
I wonder if this answer should be deleted, or if it is good enough to get me Major Award: codereview.stackexchange.com/a/74437/34073
I don't really like it, I'll probably delete it.
I can do this now though:
FizzBuzz<BigInteger> fizzBuzzBigInteger = FizzBuzz.<BigInteger>builder(bi -> bi.add(BigInteger.ONE), (number, divisor) -> number.mod(divisor).compareTo(BigInteger.ZERO) == 0)
    .add("Fizz", BigInteger.valueOf(3))
    .add("Buzz", BigInteger.valueOf(5))
Q: Parse File or String input in a uniform way: Is it possible with Generics?

rathI have a Parser class which creates a collection of String pairs, parsed in the format key=value. public class Parser{ private final HashMap val <String, String>; private final File source; public Parser(final File path){ /*initialise stuff*/ val=new HashMap<>(); ...

private final HashMap val <String, String>;
How to treat that question? It can never compile like this
@Hosch250 Do as you feel best, but being the only answer on there, I don't feel it takes away from the question to have your answer there. If someone writes a better answer, then they are welcome to compete with your answer for the bounty!
Q: Parse File or String input in a uniform way: Is it possible with Generics?

rathI have a Parser class which creates a collection of String pairs, parsed in the format key=value. public class Parser{ private final HashMap val <String, String>; private final File source; public Parser(final File path){ /*initialise stuff*/ val=new HashMap<>(); ...

@Phrancis Alright. I was mainly trying to get Major Award and this was all I knew about it.
9:30 PM
Going for a walk ... back in an hour
> Site Stats
20,001 questions
@rolfl It's nice reviewing a FizzBuzz question where I can talk about everything other than the FizzBuzz.
Q: Mutable String Class - Would going immutable be better? How about Unicode?

ValrandirHere is a String class that I've made for fun in my spare time, for myself. I have a few concerns about it, and am considering going immutable or a mix of the two where the string would be immutable when initialized from a constant, and then mutable when changed. Also I am considering how to imp...

Lots of C++ questions today
9:44 PM
@200_success So say we all.
@rolfl improved my post based on what we learned from SO :p
6.1 more answer upvotes to hit rep cap.
10:00 PM
nobody knows who Carlos Ray is?
43 more Rep until cap. I have plenty of answers out there today.
@200_success I came up with the idea to do that a couple of days ago, but struggled to both get it right, and to get the time to play with it. I decided a reasonable attempt at the 5-in-30 required enough 'fodder' for people to have a reasonable number of non-competing answers. Combined with the need to be in a language/system where I am a novice, and make enough beginner mistakes to be non-cheating representation of my abilities.
Out of interest, your code/answer is giving me the following:
Also, I would like to discuss some of your suggestions, but the comments won't cut it, when you have a moment in chat .... ;-) Please?
I have a lot of excuses for the mistakes you point out ;-)
10:19 PM
@Malachi Want to swap votes?
Well, I'll give you some.
@Malachi Chuck Norris?
41 to go for me.
And half an hour to get it.
@rolfl innerHTML is more widely supported than innerText. Actually, it's more correct as well, since you are plopping the string into the output without escaping. Corrected.
I use innerHTML, don't I?
Yes. I tried to use innerText, which turned out to be a bad idea.
Oh, OK.
The DOM 3 spec has textContent, but that requires IE 9.
Welcome to browser development.
10:34 PM
OK, my excuses for the arrays ;-) I really got 'lost' on the issues with the for/each style loop, and it caused me to backtrack, an rewrite parts.
part of that was the loop for getting the 'players'.
it was my original intention to allow arbitrary numbers of 'players', and then to locate them with a loop over the fields in the fieldset... but I kept getting undefined values.
I should have known better too. I think I'm a bit burnt out from the last few days
Is there another FizzBuzz invasion today?
Sort of.
Yup, good for so many things.
I'm waiting to post my WPF version until 5 C# or XAML people are here.
10:35 PM
two pizza's from fizzbuzz today
I want that pizza hat.
Any Java people I need an answer here:
Q: Project Euler #1 in Java

Manny MengProject Euler #1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Here is my solution: public class MultipleFinder { private static final int ...

@Hosch250 try another hour and 20 minutes
It resets for me at 5:00, I think.
It is 4:39 now.
Might be remembering wrong.
somebody has iptables experience?
10:41 PM
@janos what iptables? the SQL table?
kidding right?
Oh, nvm.
the linux firewall
oh, I'm out :)
Oooh, I earned Major Award.
10:42 PM
@janos Yes.
At least, I got the upvote.
@rolfl this on serverfault is not good enough for an upvote? serverfault.com/a/654065/124187
Most certainly
Nice find
I was actually considering buying a pizza today...
great, thanks! decided to pimp to test how the limits of Solstice work
10:44 PM
Is that good for nurato too?
Q: Project Euler #1 in Java

Manny MengProject Euler #1: If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Here is my solution: public class MultipleFinder { private static final int ...

I got Naruto for that already
I got Naruto on 4 other sites the first day I tried each. I've been trying to get it here pretty much since day 1, and it's pretty hopeless. As expected :)
oh yes, one could still get Solstice today
I wonder when I'll be able to line up enough people to get a pizza hat (and sorry for being so persistent).
6 rep away from capping. Thanks, whoever is doing it.
Ooh, thanks, I capped.
A: LinkedList (doubly) implementation

nhgrif@bazola's answer hits on some points I would otherwise make, so be sure to stop by there. Meanwhile, in this answer... First of all, I don't particularly like objectAtTail or objectAtHead as method names. I think that as a general guideline, we can make our linked list work very similarly to...

11:00 PM
I was worried that I wasn't going to find enough of your stuff to upvote @Hosch250. but I see someone else was voting while I was talking SQL queries
Thanks, @Malachi.
I know I haven't got a lot.
@Hosch250 you're welcome
anyone want to explain how I get the Announcer badge?
ho ho ho
@Hosch250 I was just about to post my answer :-/
but it's good you removed
or booster or publicist?
11:01 PM
@janos Sorry.
it was a poor implementation ;-)
I repcapped too. thank you Santa
@Malachi You share a link using the 'share' URL from a question.
When you share a link, it has a URL like:
@rolfl but I never get the badge?
@janos I'm going to repost probably tomorrow.
11:02 PM
this http://codereview.stackexchange.com/q/74566/31503
So keep your answer somewhere.
you would think that 25 different IP's would be easy
I just didn't want to waste some perfectly good upvotes.
Note that the question ID is the first part, and the sharing user-id is the second number.
@rolfl I didn't know that
11:03 PM
Then, that link has to be shared in a way that the referring site that 'clicks' that link, is not from the stack-exchange network
I am going to have to start up my blog again huh?
So, sharing the link is one thing, but where you share it is another.
@rolfl what about when I click the Twitter share on that little window?
or the Facebook or the google?
The twitte-rlink will include your userid
so, people following it from that share, will count, in theory
11:04 PM
@rolfl it does. I will have to check the others later.
TYJ - Thank you Jesus?
@rolfl YES
You on holiday now?
I am so drained. I hate December sometimes....lol not enough sunlight
@rolfl nope I get 25th 26th off
but it's been a long day. tomorrow I will get to play with some SQL that will probably never see the light of day, only people searching through the archives with flashlights.
11:08 PM
ttgtb for me too
see y'all tomorrow ;)
11:24 PM
A: Board Evaluator for Bejeweled Clone

nhgrifThis can be 100% eliminated: -(void) setBoard:(DMGameBoard *)board { _board = [DMGameBoard boardWithBoard:board]; } And instead, change the property declaration to look like this: @property (copy) DMGameBoard *board; I'd rewrite this method: -(BOOL) findMatchesForOrb:(DMOrb *)orb { ...

@nhgrif very nice answer! i appreciate it
does @property (copy) work for all types of variables? that is a really neat workaround if so
Q: More efficient way to consolidate an array of objects?

Tom SterkenburgIn my program, I'm getting facebook objects and using temp to display on a separate screen how many unread messages they have. However, we have since decided to consolidate similar messages, such as getting xp from a facebook friend more than once. We want those messages to be one message with th...

Q: Collection with both Set and List interface

markspaceHere's something I wrote a while ago. I needed a collection that was ordered, but also guaranteed duplicates did not occur. So I made a class with both Set and List interfaces. It seems to work well. I'm interested if there are better ways of doing this, maybe in the standard API or some libr...

11:45 PM
@bazola I think the class has to conform to NSCopying. And obviously, it can't be a value type--it has to be an object.
@nhgrif ah, okay. In the end its pretty much the same then, i suppose. I would have (copy) but then I would have to have an initializer that has the logic that I currently am doing so that it conforms to NSCopying
It'd be cleaner, and may provide more usefulness later.
Plus, in Swift, you really want your things to conform to the protocols they need to do.
And if you're writing Objective-C code, you're writing code that potentially someone will use in Swift later.

« first day (597 days earlier)      last day (1993 days later) »