« first day (712 days earlier)      last day (3299 days later) » 

12:00 AM
@rolfl Hahaha nice
 
There are 1293 unanswered questions
 
@Duga Why are you so judgemental?
 
Because Duga?
Time to fix Lyle's mug-face
done.
 
@Lyle'sMug Interestingly, ChucK is neither esoteric nor a joke language. I think they mostly use this language to appeal to people who are not traditional programmers and want to make sounds and stuff
 
in The Whiteboard, Apr 10 at 18:33, by Ixrec
If I didn't program as a living I might have time to program outside of work
 
12:07 AM
- to chuck ( `=>` operator) = assign/pass on
- a shred = a class
- to spork = to import
 
@sᴉɔuɐɹɥԀ I have never heard of chuck.... I was being a Smart Ass
 
Imagine that LOL.
 
My mom said if I found something I was good at....
3
 
... and you've been breathing ever since?
 
lucky I was good at that too
 
12:09 AM
That's brilliant, completely negated the requirement for the string_hasher. Really good, I really appreciate it. — Jimmy 4 hours ago
Sometimes I wonder whether people read what I say.....
 
I do.
I don't always understand right away, but I read it and try to understand
 
> If you convert the const char* ID to be a std::string then you can just make it a map of std::string and use the default values for the hashing and equalities in the template.
I guess it is not immediately obvious that that means: completely negated the requirement for the string_hasher
Oh, @Lyle'sMug - I could not bring myself to +1 this: otherwise I would probably do it like @twohundredping ... ;)
Especially when twohundredping says: The swap method in the other answer is the approach I would use, however there is a similar answer that more resembles your approach so I thought it would be worth sharing.
 
@rolfl That is a horrible justification
(from the other person)
 
Thanks Santas.
And, for anyone whe was watching that Unity question from earlier.....
3
Q: Unity simple map generation

user2351722I am trying to generate a simple map like this. Everything works as I want, but I am new to programing. Is it a good way to do something like this? And if not, could someone explain to me where and why it is bad to do something like this? And how bad is it on performance? public GameObject cube;...

 
Hey, an Stack Overflow question I flagged made it's way here
2
Q: Swift iOS - Call back functions

Arasan RajendrenI'm working on an iOS app which handles API request based on authentication. Authentication is done through OAuth and every API request is sent along with access_token. In certain cases, the access_token might be expired causing the API request to fail. I would need to call the refresh_token meth...

 
12:23 AM
It now has a merged answer from SO.
 
How do you put a code block inside a block quote? I've been trying CRTL + K then CRTL + Q, but the last line of the code loses its spot in the code block.
 
Angle bracket > followed by 5 spaces.
 
or put differently, a quote block is a > and a space.
 
@rolfl I didn't dwell on your answer as long as I dwelt on his answer. but his answer does everything in one loop, and actually made sense to me after I stopped trying to love my answer more than the others. I was too focused on having the best answer, but I dropped trying to make his answer's code better and accepted I couldn't do it better than that
 
@SirPython Click the Quote button with the code selected.
 
12:24 AM
so, code in a code block is a > and a space, and then 4 spaces fpr the code.
 
CTRL + Q
 
@nhgrif That worked perfectly
 
Downvoted on an answer that contains link to documentation and a code sample to demonstrate. I don't know what people use as reasoning sometimes
 
@JeroenVannevel link to the answer?
 
2
A: How can I programmatically do method overload resolution in C#?

Jeroen VannevelThis is done using the overload that accepts a binder. There are two of these, I suspect this one is enough for your usecase. Type.GetMethod Method (String, BindingFlags, Binder, Type[], ParameterModifier[]) Searches for the specified method whose parameters match the specified argument typ...

 
12:28 AM
@rolfl your fast and slow confuse me... give me a second
 
@Lyle'sMug - the logic is really quite satisfying when the piceces click together
fast is just an index that goes through the list once.
from 0 to n-1
any time it finds a 0, it takes the first non-0 value in the list (at the slow index), and swaps them
so, for example, in the input:
1,2,0,3,4
fast starts at index 0, value 1
slow is pointing to index 0 as well.
fast moves to index 1, then index 2 and finds a 0 value there.
 
oh I see!
 
it takes the value at slow (the 1 value), and puts it at index 2, the 0 value, and then puts the 0 at index 0.
2 mins ago, by rolfl
@Lyle'sMug - the logic is really quite satisfying when the piceces click together
 
I used to be really good at seeing patterns in things. maybe I should be drawing things out more rather than trying to do it in my head.
 
5 hours ago, by rolfl
So, why does it irritate me when people are surprised that things I recommend work?>
 
12:33 AM
I need to tell my bosses that I need an Office with White boards on all the walls!!
 
hehehehe
 
What is the code snippet?
 
23 mins ago, by Lyle's Mug
I don't always understand right away, but I read it and try to understand
 
6
A: Rearranging array elements depending on their indexes

rolflThe trick you are missing here is a simple swap. All you need to do is keep a "fast" and a "slow" index in the array. The "fast" index scans forwards looking for 0 values. The "slow" index is an insert-point for where the next 0 would belong. Consider this loop: public int[] zeroFront(int[] nu...

 
:p
I edited my answer, to remove the extraneous text
 
12:35 AM
Dinner time .... and you are boeing watched ;-)
 
Not me.
Who is the person of interest this time?
 
0
Q: Identifying array elements, rearranging them, and replacing them

alanbuchananI am completing the CodingBat exercises for Java, and, having learnt from the answers to the previous one, I completed the one that follows: Return a version of the given array where all the 10s have been removed. The remaining elements should shift left towards the start of the array as need...

 
@rolfl Boeing probably watches with drones.
 
for (; slow < nums.length; slow++) {
    nums[slow] = 0;
}
for (int i = fast; i >= slow; i--) {
    nums[i] = 0;
}
The first is mine. Is it worth being posted as an answer?
 
++slow, --i
 
12:49 AM
@nhgrif They are the same performance wise except in C++.
 
Depending on compiler and optimization settings.
 
OK.
 
It's just a good habit to pre-increment unless you actually need the behavior post-increment provides.
 
I do it reverse.
 
Any decent compiler will treat them the same, but you never know.
 
12:51 AM
Alright.
I'm 3/10 away from getting to 20k before the real RELOAD!
I should write a bot that loads the page and compares the design every second and sees if we were reloaded.
 
What....?
 
The new design.
Apparently I am a quiet leader: brighthub.com/office/home/articles/76450.aspx
 
1:07 AM
> One photon. Forty-two seconds.

42 is indeed the answer to the ultimate question.

And pencils cannot be balanced on their tip.
 
0
A: Swift iOS - Call back functions

nhgrifVery regularly when dealing with asynchronous stuff (among other things) in iOS development, we have to make a decision between three tools. Closures (blocks, callbacks, etc) NSNotificationCenter The delegate pattern. Which one is right for you depends on the scenario. It won't always be the...

 
0
A: Identifying array elements, rearranging them, and replacing them

Hosch250First, I would give slow the same scope as fast - give them both loop scope: for (int slow = 0, fast = 0; fast < nums.length; ++fast) { Second, rather than creating a new variable i and iterating backwards, I would write my second loop like this: for (; slow < nums.length; ++slow) { nums[...

 
I am probably quiet/situational.
And maybe slightly participative.
@Hosch250 Does your answer change the code...?
 
@nhgrif A bit, why?
The first two points do.
 
Does it produce the right results still?
 
1:14 AM
Yes.
I tested it at Ideone.
Why, is this because of my second last answer and EL's bug catch?
 
I don't know what your talking about, but...
You appear to actually change the code quite significantly, but don't really offer much explanation for the actual difference.
 
Does it look wrong somewhere?
Not really.
 
No, really.
 
Here, I just change the scope of the variable: for (int slow = 0, fast = 0; fast < nums.length; ++fast) {
 
His version of the code only modifies slow in an if within the outerloop.
 
1:17 AM
    int slow = 0;

    for (int fast = 0; fast < nums.length; fast++) {
 
Your version adds modification of it within the inner loop.
slow will increment significantly quicker now.
 
His:
if (fast == nums.length-1) {
    for (int i = fast; i >= slow; i--) {
        nums[i] = 0;
    }
}
 
I'm about to go upstairs to bed... and I haven't figured out exactly what either is doing.
 
Mine:
 
But yours makes a drastic modification without explaining why exactly we should be changing slow so fast now.
 
1:18 AM
if (fast == nums.length-1) {
    for (; slow < nums.length; ++slow) {
        nums[slow] = 0;
    }
}
It doesn't change fast.
Look at the if.
 
Yes it does!
Where does your i come from?
 
No, that if isn't run until the very end of the loop!
 
It's within the outerloop.
And if it runs, you increment slow once per run of the inner loop.
 
It will not run until the very last iteration of the outer loop.
 
Do you know what your code is doing? Do you know what his is doing?
I'm not asking if either/both work.
 
1:20 AM
if (fast == nums.length - 1) {
Yes, both work, and I know what they are doing.
It is just a slight mathematical change.
 
I'm asking if you can explain his algorithm and your algorithm in plain English without pasting snippets.
Because your answer doesn't explain this change.
 
Oh, sure.
I'll update it.
@nhgrif How's this?
 
mm...maybe I translated wrong, but neither code works for me in Swift.
One takes [1,10,10,2] and turns it into [2,10,10,2] (his), and the other takes [1,10,10,2] and turns it into [1,2,10,2] (yours)
 
Are you remembering to do the last bit in the if and set the values to 0?
 
Okay, now I fixed the problem that was causing different results.
Ah, now they're both working.
1
A: Identifying array elements, rearranging them, and replacing them

nhgrifIt's extraordinarily confusing to have if (fast == nums.length - 1) as a conditional within a loop that continues while fast < nums.count returns true. This is the last part of the loop, and it only executes on the last iteration of the loop... so why is it even in the loop at all? A couple of ...

 
1:36 AM
^^ Explaining to non-coders...
I've looked through his music files folder... dupstep, dubstep2, dubstep3, dubstep4, hiphop, hiphop2
 
@nhgrif Nice, but I would make the last loop:
// zero out the elimination number
while (nextMoveIndex < nums.length) {
    nums[nextMoveIndex++] = replaceNum;
}
 
I was actually considering that.
 
@nhgrif Yours is better than mine.
I should delete mine and get the disciplined badge.
 
@Hosch250 @nhgrif has a different solution, in a sense, the generalization of the problem makes it worse ;-)
 
Well, alright.
 
1:40 AM
the skip/replace parameters, while a nice suggestion, also make the method incompatible with the judging software.
 
Potentially, yes.
 
Probably.
 
Regardless, I consider both answers to be good/useful
Certainly not worth me adding an answer on.
 
I assume the asker is intelligent enough to whittle those two extra params back out.
 
Hopefully.
 
1:42 AM
I actually consider the two comments my answer adds to be the most important part.
What these bits of code are doing is very simple, but it took me a second or two to figure it out.
 
I have a habit of using slow and fast as variable names, it's good to be reminded that sometimes describing what the index does is not as important as what it is for.
 
Pulling the loop out and making two separate loops helps me see what's actually happening.
 
I like your two loops better than my nested loop.
When you have nested loops, you don't usually expect them to work like this.
 
but here's an example though where I don't think any reasonable variable names will convey what each little block is doing as effectively as a simple comment.
 
Noone has yet suggested the inverted logic solution to the problem.
it's just as concise, but requres some inverse thinking.
 
1:44 AM
Return the array, then do the modifications?
 
...
 
No, make the 'slow' cursor part of the loop.
instead of the fast one ;-)
    public int[] withoutTen(int[] nums) {

        int use = 0;
        for (int i = 0; i < nums.length; i++) {
            while (use < nums.length && nums[use] == 10) {
                use++;
            }
            nums[i] = use < nums.length ? nums[use] : 0;
        }
        return nums;

    }
The other way of writing that, is to have just one loop .... ;-)
    int slow = 0;
    int fast = 0;
    while (slow < nums.length) {
        if (fast < nums.length) {
            if (nums[fast] != 10) {
                nums[slow++] = nums[fast];
            }
            fast++;
        } else {
            nums[slow++] = 0;
        }
    }
    return nums;
 
2:01 AM
@moarboilerplate Welcome to the 1k club!
2
I wonder what $\$^2$ would mean… — columbus8myhw 10 mins ago
That should display as
They might buy you a square meal. — Robert Israel 2 hours ago
In response to:
> Squared-dollars can't buy you lunch.
 
Interesting:
Task TenForward -> OP: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   72.7140
  Fastest  :   59.9010      Slowest  : 8711.0730
  95Pctile :   79.3760      99Pctile :   96.0250
  TimeBlock : 77.005 71.996 71.700 71.942 72.158 74.061 71.871 71.350 73.106 71.953
  Histogram : 99583   366    22    15    10     1     1     2

Task TenForward -> MB: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   60.4240
  Fastest  :   47.3980      Slowest  : 8837.2950
  95Pctile :   68.4910      99Pctile :   83.4390
I thought the MB version would be fastest, but the inverted one is the fastest.
I need to validate those results.
 
W3Schools is busted.
 
Invertted code failed to produce the right results.
 
My very first SQL query:
SELECT Id, AcceptedAnswerId, Title
FROM Posts
 
Task TenForward -> OP: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   14.3710
  Fastest  :   11.0600      Slowest  : 6367.6610
  95Pctile :   16.0160      99Pctile :   23.5840
  TimeBlock : 16.158 14.004 13.765 13.895 13.890 14.009 14.074 14.538 15.290 14.088
  Histogram : 98751   972    98   155    12     2     2     7     0     1

Task TenForward -> MB: (Unit: MICROSECONDS)
  Count    :    100000      Average  :   10.3830
  Fastest  :    7.1470      Slowest  : 3053.5580
  95Pctile :   12.0830      99Pctile :   18.4250
In essence, the following code is about twice as fast as the alternatives:
    public int[] withoutTenMB(int[] nums) {

        int slow = 0;

        for (int fast = 0; fast < nums.length; fast++) {
            if (nums[fast] != 10) {
                nums[slow++] = nums[fast];
            }
        }
        while (slow < nums.length) {
            nums[slow++] = 0;
        }
        return nums;

    }
 
2:26 AM
0
Q: A very secure procedural MySQLI login script against injections

coderminatorI know there are other ways to create a login script like Object Oriented, Prepared Statements and PDO, but how about those old MySQL PHP users like me trying to change from old style to the new ways? here is a login script code I created for those like me changing from MySQL to MySQLI the easy w...

 
Anyone around for an SQL question?
 
What kinda question?
 
I have this query:
SELECT Id, Text, PostId
FROM Comments
WHERE (Text LIKE '%offtopic%' OR Text LIKE '%off-topic%' OR Text LIKE '%off topic%')
 
Yeah
 
I'd like to only post comments from posts that are still open.
Is that possible, given that I know the PostId?
Hmm, I think I might have it.
 
2:42 AM
So, you're trying to find comments that say a version of 'off topic' in posts that are still open?
 
Yeah.
I need to do the dishes now.
And, I don't want you solving it for me.
 
WTF is happening to me... I just reviewed some code...
 
@Mat'sMug Who are you?
Have you put root-beer in that coffee-mug?
 
oh crap
lol
 
@JeroenVannevel i like how that question is tagged performance
 
2:48 AM
@Hosch250 - you will need to join to the Posts table.
 
@mjolka Performance he'll get!
 
and select posts where the Closed Date is not null
 
2
Q: function that convert decimal to binary

donquixto DacI have a function that convert an integer to binary. i am wondering if there is anyway i can improve the function. public List<string> Conversion(int x) { var bitConversion = new List<string>(); var result = x; while (result >= 0) { if (result == ...

0
Q: PowerShell md5 hash compare two folders

user4317867I'm very new to Scripting/PowerShell so I'm posting this code here to find out if there's a better method for accomplishing this. Using This Page for a starting point into comparing MD5 hash values from files in two different folders, I've put something together that outputs either Copied if bot...

 
@JeroenVannevel And an incompatible result .... WTF does he have a return type of List<string> ?
 
Ehhh
I'll just tell him his code is wrong
2
 
2:52 AM
@JeroenVannevel people love hearing that
 
lol
> You're returning a List<string>.... and I don't get it.
 
@Mat'sMug You could also add using Insert(0, string) instead of .Add() and .Reverse()
 
yeah, but the implementation is moot
and your answer is better
 
Isn't it always
Bedtime! Later muchachos
 
I'm getting empty data sets but it's somewhat there
http://data.stackexchange.com/codereview/query/edit/301580
 
2:59 AM
later!
 
@JeroenVannevel good night
 
Me too, off like a prom dress.
2
 
'night @rolfl
 
But, just in case someone feels like santa:
That's brilliant, completely negated the requirement for the string_hasher. Really good, I really appreciate it. — Jimmy 7 hours ago
 
that upvote was the last one I needed to score a tag badge, thanks @Santa!
2
 
3:06 AM
I got the SQL Query all good too Hosch250
http://data.stackexchange.com/codereview/revision/301582/390991/find-offtopics
Going for lunch, later
 
@Quill You can do some magic in SEDE. If you change your select query to be:
SELECT Posts.Id as [Post Link], ....
it will create a clickable link, with the post title as the text.
@Quill Your SQL is broken ;-0
Your where clause has:
 AND (Posts.Id=Comments.Id)
but that really should be:
 AND (Posts.Id=Comments.PostId)
 
ooh... looks like they also changed something in the "tag score daily recalc" ...or the timing was very very tight
oh wow, nevermind. you click "track the next one" and still shows 99/100 score
UX-FTW
7
A: New profile pages are out - bugs and feedback master list

Aaron BertrandNext Badge can't decide if I've earned the next badge or not When I go to my dba.SE profile, I see this: When I click Track the next one >, I see this: The first state comes back after 10 minutes or so, and then I wash, rinse, and repeat. I assume this is some kind of caching or synchroni...

 
4:00 AM
@Quill Thanks.
Really, though, I'm only going to look at that if I need to.
 
@Hosch250 Alright, no worries
 
I am learning SQL for the sake of learning it, not just for the query.
 
I suppose that's better than 'I have to learn it, because I need it'
 
Well, I will need it later, probably.
Trying to prep for my internship next summer (2016) and first job summer after that.
OK, I have the two joined.
Now to figure out how to check if a post is closed/on hold.
 
4:19 AM
@Hosch250 Any luck?
 
Sort of.
I think it has to do with the PostTypeId.
If only there was documentation...
 
  and p.ClosedDate is null
 
Oh, pffff.
 
2 hours ago, by rolfl
and select posts where the Closed Date is not null
@Hosch250 ^^^
 
Got it.
OK, get your flag handler button ready.
 
4:23 AM
Brushed my teeth, going to bed ;-)
 
OK.
 
But, there's more than just me
 
Actually, I can just VTC those.
Hmm.
I need something for bad answers to flag.
I suppose I can VTC and flag?
 
You could search for "JAVA"
 
Lol
Oh, now I remember.
I was going to flag comments as obsolete.
 
4:25 AM
I think checking for grammatical errors could work LIKE '% i %'
 
No.
What does it do, or do I have to figure that out?
 
It's SuperSekrit
 
Hmm, looks like what I'm trying to do.
 
@rolfl 'morning!
 
4:35 AM
@rolfl I would also add to SuperSekrit to check for 'Welcome' and 'to' because often people say 'Welcome to Code Review' before question flagged
 
YAHOO!!
Public Function Execute(renamed As ADODB.connection, ByVal sql As String, ParamArray parameterValues()) As ADODB.Recordset
'Returns a connected ADODB.Recordset that contains the results of the specified parameterized query.

    Dim parameters() As Variant
    parameters = parameterValues

    Set Execute = ExecuteInternal(renamed, sql, parameters)

End Function
renamed was originally named connection - Rubberduck's refactor/rename works! ...in all cases I could think of!
see that @mjolka? ^^
 
@Mat'sMug Nice.
I'm a bit irked.
@rolfl wrote a query for me that works, so now I still haven't learned as much SQL as I should have, I don't have a query to write, and I don't have any code to post on CR for review.
I suppose I could write a query to find C# zombies or something.
Ones without any answers.
 
@Hosch250 He made it in March, he just reposted it
 
1
Q: Minesweeper algorithm that works within O(1) space complexity

Michael RanFor minesweeper algorithm, instead of the most obvious BFS or DFS solution, I want a O(1) space solution. First of all, I'll explain how the program works. I will pass in a 2D array, with 1 represent mine and 0 represent blank space. The program return true if the map can be opened with single ...

1
Q: Shutdown method in queue implementations

raghuraviramI am trying to implement a shutdown method in queue implementation. I took the code from BlockingQueue source from Java and trying to check the shutdown method. Will the following code be thread safe and an acceptable implementation? import java.util.concurrent.atomic.*; import java.util...

0
Q: Code improvement to transpose a 2D array

Andrea.cabralWould you have any suggestions for improvements for the code below. Being a beginner, it's always great to compare with others and especially more experienced developpers. Thx a lot! def my_transpose(arr) # number of rows m = arr.count #number of columns n = arr[0].count transposed_a...

 
@Mat'sMug woohoo!
 
4:45 AM
Oh.
Well, what'd he post it for?
If I hadn't read it to learn what it was...
 
@Mat'sMug what solution did you go with? (or should i just browse the repo)
 
I'm going to bed. See you.
 
haven't committed yet ....the code is the ugliest piece of shitty crap I've ever written. but it works
'night @Hosch250
 
@Mat'sMug well that's step 1, isn't it. make it work
 
I went with a hybrid
 
4:47 AM
night
 
I'm only using the TokenStreamRewriter when I'm dealing with a parameter declaration.
for the rest (including parameter usages) I kept the regex replace
 
Drat, someone took the bathroom before I could :(
Now I'll be up until 1.
 
that's 10 minutes from now... well over here at least ;)
 
It is midnight here.
Just 20 more flags to Deputy.
I run out for today with 10 more.
 
@mjolka if you want to look at the mess: github.com/retailcoder/Rubberduck/commit/…
 

« first day (712 days earlier)      last day (3299 days later) »