« first day (599 days earlier)      last day (3716 days later) » 

15:01
Ah ok
Speaking of which...
Welcome to Code Review! It looks like you left out some code on purpose? All these /* Special condition */ comments make it look like it's not your real code... Can you please clarify? — Phrancis 1 min ago
I am working it the other way around.... working in Eclipse for the code, paste to notepad++, do some post editing in there, post to pastebin.... then, copy/paste from pastebin to my phone app, and then post from there....
will still need to do some trickery for the tags, etc.
I thought the tags worked fine on the mobile app?
using the android app, pasting from anywhere resulted in badly formatted code every time
so I immediately visit from my PC and clean up
0
Q: Project Euler #8 - Largest product in a series

Mehdi.SqalliI just finished Project Euler #8 in Swift, and since there is not any version yet on Code Review, I would like to have some comments on what I did to try to improve it. The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. 7316717653...

15:16
@CaptainObvious That's one massive number!
Today counts as Christmas? Nice!
Hats hats hats!
> 755 days, 5 consecutive
IT WASN'T WORTH IT
I'm a casual now
15:30
lol
We need a "longest consecutive days streak" stat... even if it's hidden, we need it!
Do comments count as activity?
As activity, yes. As a post... depends on the hat.
Just asking for "Longest consecutive activity days streak" SEDE query ;-)
Nice!
French guys, what's "4 cuilleres a soupes rases" ?
15:39
4 shaved table spoons
what's a shaved table spoon
Uh.. leveled?
aaaaa
ok thanks
/away back to cooking
@Mat'sMug Shaved spoons? LMAO
What's the term?
@Phrancis?
15:48
2
Q: By `1 tbsp of x` should I assume heaped tablespoon or leveled tablespoon?

TheIndependentAquariusWhen they (recipes) say 1 tbsp of flour (example), do they mean heaped or leveled? What's the standard guess?

Leveled is correct, just made me literally LOL when you said "shaved" ;-)
That was ..literal indeed ;)
The app really does suck for formatting code, doesn't it.....
and including images..... not possible?
3
Q: Web socket server which needs to query some API and to pass chunk per chunk of data to its socket clients every M seconds

SrleLet's say that I want to query some API which will respond with array of random numbers: [4, ..., 17, ..., 25] To keep things simple enough, let's say that array has always 10 elements. For every element in that array, I need to emit via socket to all clients just ONE number every M seconds...

@Mat'sMug I'm thinking I might need to make a freaking loop to do this...
0
Q: My pastebin replica - anything I could change?

JustLloydHere is the class I'm using: <?php /** * Pastr 1.0 * @author Lloyd * Pastr is a quick and easy tool you can use to upload snippets of text and code * */ class Pastr { /** * Our database information is stored here * Array */ public $dbInfo = array(); /** * Our arra...

0
Q: Pi by Monte-Carlo

rolflI was inspired by this SO post to investigate a good Java8 way to calculate Pi based on simulation. I used a similar task to learn about parallel programming on both CUDA, and Intel Xeon Phi processors. Those systems are more geared for parallel programming, but I felt inclined to apply it to...

16:09
Wow, tough crowd today....
Well, it's Xmas eve... At least you got ...
I did, and no +1 after the edit, scandalous ;-)
I wanted to do something else... but @rolfl, your question is tempting me
@skiwi Well, it was fun .... ;-0
and I knew it would trigger some interest ;-)
Spotted first point!
Now I should grab some motivation together
16:14
@rolfl you can insert pictures, you just have to write the markdown yourself.
Is there anything I/we can do to make it easier to create a project out of a question?
Would be easier if I could download a thing instead of manually copypasting everything
interesting that I have not yet gotten the app-hat.... I wonder if I edited it to clean it up too soon?
@RubberDuck ...... @RubberDuck looks nothing like SNAP.... what's with that?
Whew:
> You earned Got a Tablet for Christmas on Code Review!
1
Q: Rolling my own Configuration with UI

RubberDuckThe Rubberduck Saga continues as I find a need to roll my own configuration. Since the program is really a *.dll and available to several host applications, using app.config is not an option. I decided to leverage XML serialization to allow a user to modify which comments get picked up in the Tas...

Bounty on ---> codereview.stackexchange.com/q/41238/18427 check it out and make sure this is deserving of the bounty please!
@rolfl Does this seem correct...?
For your apportion method
> In my opinion too much is going on is this method, there needs to be a way to write it in a cleaner way. What you really seem to be doing is given an integer n, split it over k bins, such that the first bin contains 0, k, 2k, etc. The second bin contains 1, k + 1, 2k +1, etc.
Is that what you are doing?
16:25
No, it's splitting the data such that no one bin is much less than the next.... there was a discussion.... here:
In my opinion does the documentation not really clarify the implementation
But I may not be focused enough to see it ;-)
Um.... if you want to split 97 students in to classes with at most 20 students, you want....
20, 20, 19, 19, 19 and not:
20, 20, 20, 20, 17
Ah
There must be a nicer way to do it though
All ears .....
Yeah, I'm figuring that nicer way out right now
16:28
split X items in to Y groups where the difference between the largest and smallest group is a minimum
Sounds like Euclidean calculation
In mathematics, the Euclidean algorithm, or Euclid's algorithm, is an efficient method for computing the greatest common divisor (GCD). It is named after the ancient Greek mathematician Euclid, who first described it in Euclid's Elements (c. 300 BC). It is an example of an algorithm, a step-by-step procedure for performing a calculation according to well-defined rules, and is one of the oldest numerical algorithms still in common use. The GCD of two numbers is the largest number that divides both of them without leaving a remainder. The Euclidean algorithm is based on the principle that the greatest...
Hmmm
> Loop 99 guesses Pi at 0,00000
Overall calculation is 0,00000
Does this qualify as nicer @rolfl?
private static final long[] apportion(final long samples) {
    int cores = CPU_COUNT;
    long[] portions = new long[cores];

    //calculate minimum amount of samples per core
    long minSamples = samples / cores;
    Arrays.setAll(portions, index -> minSamples);

    //calculate remaining samples after evenly dividing the minimum amount over all cores
    long remaining = samples - (minSamples * cores);

    //split the remaining samples over the cores
    int coreId = 0;
    while (remaining > 0) {
Eh... I never decrease remaining
That's an interesting one.... you can possibly do it all in one setAll....
//split the remaining samples over the cores
for (int coreId = 0; remaining > 0; coreId++) {
    portions[coreId]++;
    remaining--;
}
This looks better
@rolfl that's because Mug and I aren't completely clueless. =;)-
3
16:37
int remainder = samples - (minSamples * cores);
Arrays.setAll(portions, index -> minSamples + (index < remainder ? 1 : 0))
That one has a high magic-level though
2
But it's technically correct
something in there needs to be a long .... bbut yes.
oh carp! I am no longer a 15k user
Nope nope nope
> Overall calculation is 19632,83088
Abort operation.
That's not PI!
@Malachi Damn how big of a bounty did you put up?
16:42
Funny how replacing a count() with a sum() can give wrong values!
Yes, I'm still the first answerer!
0
A: Pi by Monte-Carlo

skiwiThe code and documentation look fine in general, so this review will focus on minor optimizations on a per-method basis. Use ThreadLocal.withInitial You can set your LOCAL_RANDOM with the following: private static final ThreadLocal<Random> LOCAL_RANDOM = ThreadLocal.withInitial(Random::new); ...

@rolfl You broke my pretty stream attempt of the main though :(
double average = IntStream.range(0, 100)
    .mapToDouble(index -> sampleCircleArea(100_000))
    .peek(localAverage -> System.out.printf("Loop %d guesses Pi at %.5f%n", i, localAverage))
    .average()
    .getAsDouble();
System.out.printf("Overall calculation is %.5f%n", average);
The index is not available in the stream anymore :(
@rolfl I'm having a moment with SEDE... The multi-part identifier "SuggestEdits.OwnerUserId" could not be bound.
  SELECT
    Users.Id
  , Posts.CreationDate
  , Comments.CreationDate
  , PostHistory.CreationDate
  , SuggestedEdits.CreationDate
  , SuggestedEdits.ApprovalDate
  , SuggestedEdits.RejectionDate
  , SuggestedEditVotes.CreationDate
  , Votes.CreationDate
  FROM Users
  INNER JOIN Posts
    ON Users.Id = Posts.OwnerUserId
  INNER JOIN Comments
    ON Users.Id = Comments.UserId
  INNER JOIN PostHistory
    ON Users.Id = PostHistory.UserId
  INNER JOIN SuggestedEdits
    ON Users.Id = SuggestEdits.OwnerUserId
Any clue what I'm doing wrong?
@Phrancis one for 150 and another for 50 to get some attention on one of @Mat'sMug's question
@Phrancis In the inner join, replace:
SuggestEdits.OwnerUserId
with
SuggestedEdits.OwnerUserId
OH. Easy typo to miss, thanks for pointing that out!
np.
17:07
@skiwi The long-range slows things down by .... 3%?
(Streamify SamplePortion).
My 'timed' main method:
public static void main(String[] args) {
    double[] calculations = new double[100];
    long[] nanos = new long[calculations.length];
    for (int i = 0; i < calculations.length; i++) {
        long start = System.nanoTime();
        double calc = sampleCircleArea(10000000);
        nanos[i] = System.nanoTime() - start;
        calculations[i] = calc;

        System.out.printf("Loop %d guesses Pi at %.5f in %.3fms%n", i, calc, nanos[i] / 1000000.0);
    }
    System.out.printf("Overall calculation is %.5f%n", Arrays.stream(calculations).average().getAsDouble());
@rolfl That I haven't tested actually
It might be that the performance hit is in inlining and then compiling the code? You could maybe check if the first iterations are the worst
Initial:
    Overall performance is best 157.987ms and avg. 173.625ms
ThreadLocal:
    Overall performance is best 158.062ms and avg. 173.861ms
Streamified samplePortion:
    Overall performance is best 163.908ms and avg. 179.236ms
Though the best is also worse
But you're dealing with more objects there
@rolfl I'm getting a server timeout on this query even though it's the exact same as I posted earlier, only written as a CTE... Am I missing something here?
Only functional difference is I added this to my select:
  , Users.DisplayName AS [User Link]
  , Users.CreationDate AS UserCreationDate
Hmmm... the query is giving me results...... but also,
the [User Link] requires a User ID, not a DIsplayName
17:14
Ahhh
My results must be cached.
I'll try that and see if that fixes it
Note that you have: 50000 rows returned in <1 ms
50,000 is the upper limit of all queries, and you are missing data now.
Do you know a workaround? Man I wish I just had the data on my machine
Or maybe I don't. Must be pretty massive.
It is available.....
17:18
If I just used that CTE in a NOT IN type of clause, will that circumvent that limitation? I don't need to actually see the result set, just testing bit by bit as I go along
@Phrancis That should help.... what are you trying to report?
2 hours ago, by Mat's Mug
We need a "longest consecutive days streak" stat... even if it's hidden, we need it!
Huh, I missed that
@MannyMeng ??
17:22
That's a hard, hard SEDE to build
?????
??????
????????????????????????
? x 100
17:23
@rolfl I'm starting to realize that. Found some things on MSDN that might help me.
It will certainly keep me busy today since work is sllllllllooooooooooooowwwwwwwwww...
wow
@RubberDuck oh
@LokiAstari earned Naruto on CR, for this: codereview.stackexchange.com/a/74519/12390
is it thanks to carefully not upvoting him, or we just overlooked his good answer?
@Phrancis You will run in to time-limit before you get a result... I'm not sure you will be able to succeed. Too meany
@janos How embarassing ..... I missed it, not my tags...
@RubberDuck can't you just assign to the function all the way through instead of creating that throwaway variable?
17:26
Yeah. You can, but that still might catch my DV. That tends to make for less readable code.
@rolfl Too meany what?
@janos Had an interesting review history, currently at 4 close votes; codereview.stackexchange.com/review/close/31393
@Phrancis too many scans of big tables with too many large aggregations.
You will need to aggregate comments, posthistory, suggested edits, and more, by dte and userid.... which will be huge....
You need to find a way to restrict it first, by user, reputation, or something.
@rolfl interesting. I would have VTC
I'm going to add a @UserID = ##UserId## and see if that helps
@RubberDuck I see. VB makes for less readable code too though
17:31
That did it!
You are doing things differently to what I would do, by the way.... I would certainly go with a bunch of UNIONs....
I try to avoid UNION when I can
But, I'm all ears if you have ideas ;-)
@DJanssens @JaDogg I'm here now!
17:34
@SimonAndréForsberg Merry Christmas!
@Phrancis You should use UNION when it is the right tool for the job
A Very! Merry! Christmas!
Hey Simon, Merry Christmas!
Also, @Phrancis - note that all activity in the Posts table is also reflected in the PostHistory
@rolfl I guess I don't really know when it is the right tool for the job
Merry Christmas folks
17:35
Lol. I guess that's true @Malachi. I guess you just get used to it.
17:51
@Malachi depends who's writing it ;)
2
0
Q: Why doesn't this Tkinter after 'loop' not stop when I hit the stop button?

bibbly bobblyWhen 'start' is clicked, a red dot grows out of the centre of the black canvas, eventually subsuming the whole thing, using an after loop. I get an error saying 'TypeError: 'int' object is not callable' when I try to use the 'stop' button. The most import parts to our discussion are: def grow(...

Is a language?
@rolfl I think you need to be careful with performance impacts if they are relatively minor
> Tkinter is the standard Python interface to the "Tk" graphical user interface toolkit.
I understand they can add up, but I think code that is readable and maintainable is a major plus
17:57
@Mat'sMug don't people read tag-wikis anymore? ;)
6
Thanks, Santa!
Wow, chat sucks on the phone.
7
lol
3
I like this website
There is a form to change your password and/or email; I just changed my email, now I want to change my password and I get a notification that you are only allowed to change your email once every 30 days
3
Q: Web socket server which needs to query some API and to pass chunk per chunk of data to its socket clients every M seconds

SrleLet's say that I want to query some API which will respond with array of random numbers: [4, ..., 17, ..., 25] To keep things simple enough, let's say that array has always 10 elements. For every element in that array, I need to emit via socket to all clients just ONE number every M seconds...

@SimonAndréForsberg phone, with wifi struggling a bit.. I thought screw the wiki, I'll just ask ;)
So it's (/was?) missing a tag then
@Jamal welcome to the masochist club!
2
18:08
1
Q: Print the list of winter bash 2014 hats as a list of checkboxes in GFM format

janosIn Winter Bash 2014, since there is no easy way to see the hats I'm missing per site, I decided to use Gists for that. A perhaps not so well-known feature of GitHub Flavered Markdown (GFM) format used everywhere on GitHub is that if you write bullet point lists with embedded [ ] like this: - [ ...

yo @200_success : tomorrow morning is not too late to award you the bounty right? codereview.stackexchange.com/q/73611/12390
@Mat'sMug the tag doesn't help make it more on-topic though
thank you awesome SO users:
Please don't forget to award the bounty, otherwise it will just disappear into thin air. And it would be great if you could also upvote my answer so I get a hat. Thanks. — janos 2 hours ago
@Jamal it does. I can't even star your comment about it sucking. XP
@RubberDuck RSA ;-)
18:18
Good man ^
Thanks
Little help please! I have the following section as part of query:
WHILE @FirstDay < @LastDay
BEGIN
  IF ( SELECT DATEADD(DAY, 1, @FirstDay) NOT IN #UserActiveDays )
    INSERT INTO #ConsecDaysCount (DaysCount) VALUES (@ConsecDaysCounter);
    BREAK
  ELSE
    SET @ConsecDaysCounter = @ConsecDaysCounter + 1;
    CONTINUE
END
> Incorrect syntax near the keyword 'NOT'. Incorrect syntax near the keyword 'ELSE'.
I don't do loops often, especially in T-SQL ... Anyone have a clue what I'm doing wrong?
Don't you need a cursor to use a loop in SQL? Idk though.
I've never actually had to use a loop. I wrote a cursor once just to learn how it's done.
@Phrancis I don't think there's a WHILE loop in TSQL.. or I never used one - use a cursor
You can use WHILE syntax or CURSOR syntax in T-SQL. They do the same thing
@Phrancis s/#UserActiveDays/(select ColName from #UserActiveDays)/
@Mat'sMug A crusor is managed with a while loop
18:27
From MSDN:
USE AdventureWorks2012;
GO
WHILE (SELECT AVG(ListPrice) FROM Production.Product) < $300
BEGIN
   UPDATE Production.Product
      SET ListPrice = ListPrice * 2
   SELECT MAX(ListPrice) FROM Production.Product
   IF (SELECT MAX(ListPrice) FROM Production.Product) > $500
      BREAK
   ELSE
      CONTINUE
END
Really? I only remember looping cursors with FETCH NEXT
thank you Santa!
@rolfl I don't understand what you mean...?
You cannot do "Not in #table" .... you have to do:
18:29
Not in (select  somecolumn from #table)
Ahhh ok
Still getting same error with this :(
CREATE TABLE #ConsecDaysCount ( DaysCount INT );
DECLARE @ConsecDaysCounter INT;
SET @ConsecDaysCounter = 0;
WHILE @FirstDay < @LastDay BEGIN
IF ( SELECT DATEADD(DAY, 1, @FirstDay) NOT IN (SELECT * FROM #UserActiveDays) )
    INSERT INTO #ConsecDaysCount (DaysCount) VALUES (@ConsecDaysCounter);
    BREAK
  ELSE
    SET @ConsecDaysCounter = @ConsecDaysCounter + 1;
    CONTINUE
END;
TFL though
Whoever makes this code work with AddressOf will get an additional over-the-top bounty. — Mat's Mug 43 secs ago
@RubberDuck ^
@Phrancis Can't use *, has to be 'column name'.
I can pimp later. :-)
2
@janos It's your gift. You can decide when to award it. (Thank you, by the way.)
18:45
No @Mat'sMug. No. Just no. That's insanity.
busts out the VBE
Huh, what's this? Am I going to get a bounty @janos?
Merry Christmas to everybody!
You too @MartinR!
0
Q: Morse Code String

Manny MengI was bored recently and decided to write a class, MorseString. What this class does, is it takes a String that is coded like Morse (.... ..) and stores it. It also translates the String that is coded like Morse into a more "english-friendly" way (HI). This is just the basics I have written; ther...

18:55
Tis the season .... and, in that spirit, have you all cast votes on the best-of-2014 categories?
@MartinR Merry Christmas.
It is just past noon on Christmas Eve for me.
@rolfl yup :)
Everybody, here is the timer for Mistletoe hat: bing.com/search?q=utc+time&form=MOZSBR
@rolfl Huh, there's a post up for that?
Nope, is that on Meta?
18:57
Have I been living under a rock?
6
Q: Best of Code Review 2014 — Categories Discussion

200_successAs 2014 comes to an end, let's kick off Best of Code Review 2014! All Code Review users will be invited to nominate (link to) the best questions and answers from this year, and showcase them as examples of what great CR questions and answers should look like. Prizes in the form of bounties will...

Pin.
@rolfl Ugh that's terrible
Or Star.
WOAH, there have been a lot of bounties posted.
Has anyone gotten Stockings hat yet?
A number, yes.
Getting sent home early, yay!
19:02
OK, then posting another.
I'm giving myself a badge at the same time.
And there will be another in 55 minutes :)
@ChrisWue - expect a bounty in about 23 hours.
0
Q: Notification if there is a post requiring review

Manny MengI always hated going to the review page, only to find nothing required reviewing. It is a time-consuming task going between Questions and review. I was thinking, if there were a notification, or at least a little sign, that a review is required, it would save all us reviewers going back and for...

Bah, one of my professors didn't even grade the midterm and final!
Stack Exchange? Hmm...
19:09
0
Q: Scala BitSet implemented with Java BitSet, for use in Scala Enumerations to replace ValueSet

experquisiteDue to a performance profiling hot spot detailed in http://stackoverflow.com/questions/27632554/scala-enumeration-valueset-slow-replacement-based-on-java-bitset , I implemented my own BitSet using Java's BitSet. This is intended to replace the Enumeration.ValueSet. However, it's a bit awkward t...

Yup, I got the hat.
0
A: Best of Code Review 2014 — Categories Discussion

Mat's MugJamalizer Award category, for question edits that turned bad questions into good ones.

@Mat'sMug Nice.
@Jamal your meme might turn into a little statue ;)
BTW, I have a huge WPF project I'm working on.
Everything is working perfectly, but I am sure it is too big to post as a question.
I am not sure my style is 100% right, so I think I'll simplify it and post it soon.
19:14
Just post parts of it
I already am doing that, with the search and sort questions.
The Rubberduck project is about 60% posted on CR, across various posts
I'll do a couple more partial questions, then the framework.
It is mainly the framework I want reviewed.
The more [questions], the merrier!
Boo, my adviser is leaving my U.
Now I have a new guy.
19:28
@Mat'sMug if you get some time, let me know what you think of this answer. He has a good point about injecting the Configuration object, but at that point, there's no reason to inject the TodoMarkers. I was originally doing that, but it felt dirty that the TodoConfig model knew how to go get the markers. codereview.stackexchange.com/a/74789/41243
@200_success What I meant, I hope it won't be lost. You already capped today, I think it's better for you if I award tomorrow when it might help your progress for Legendary, 'cause today you don't need it anymore. I guess it will work.
@SimonAndréForsberg Yeah mate. Your review helped a lot, and also the Maven tip you gave elsewhere was extremely valuable. Been meaning to reward you for that, I was just saving it up for winter bash ;-)
2
ok that's it for me for tonight before my wife kills me
4
enjoy the rest of the evening, Merry Christmas guys it's been a blast
7
Cheers Janos
0
A: Best of Code Review 2014 — Categories Discussion

PhrancisLots of Laughs category: Answer that makes the best use of humor to illustrate a point.

This question seriously need attention:
14
Q: Virtual Texturing - Page Indirection Table

glampertI'm working on a Virtual Texturing library for mobile devices based on OpenGL-ES. This is the PageIndirectionTable, one of the library components I would like to have some feedback on: vt_page_indirection_table.hpp: #ifndef VTLIB_VT_PAGE_INDIRECTION_TABLE_HPP #define VTLIB_VT_PAGE_INDIRECTION_...

19:47
@Phrancis That's a good one.
@janos I thank you very much :)
Thank you!
@MannyMeng I have a question with a bounty expiring in 3 days.
11
Q: Lock-free multiple-consumer multiple-producer queue

Javier BlazquezThe code below implements an intrusive lock-free queue that supports multiple concurrent producers and consumers. Some features: Producers and consumers work on separate ends of the queue most of the time. The fast path for producers and consumers has 4 atomic ops. Version numbers are used to ...

12
Q: Is the magic liquid in the bottle safe to drink?

VajuraYou buy a bottle with a letter from the merchant, the merchant tells you that when you drink the liquid in the bottle it grants you eternal life, he supposedly deciphered this from the letter. After you get home you decide to study the letter if it really says what the merchant told you, can you ...

Interesting puzzle.
Those questions on Puzzling are hard!
I usually just read the answer.
19:58
@Hosch250 i see
And my bounty ends in 6 days
14
Q: Virtual Texturing - Page Indirection Table

glampertI'm working on a Virtual Texturing library for mobile devices based on OpenGL-ES. This is the PageIndirectionTable, one of the library components I would like to have some feedback on: vt_page_indirection_table.hpp: #ifndef VTLIB_VT_PAGE_INDIRECTION_TABLE_HPP #define VTLIB_VT_PAGE_INDIRECTION_...


« first day (599 days earlier)      last day (3716 days later) »