« first day (933 days earlier)      last day (3067 days later) » 

12:00 AM
RELOAD! There are 1645 unanswered questions (94.3243% answered)
 
INTERRUPT!
 
ಠ_ಠ
in Cardshifter TCG, 4 mins ago, by Duga
[Hosch250/Rubberduck] 112 commits. 24369 additions. 24593 deletions.
@Hosch250 been busy? Or just merged? :)
 
Zak
@Quill I thought that wan't possible anymore?
 
0
Q: Optimizing a function in R over 10000000 values

user3678028This is a follow up: Optimization over 7 constants, running a function 10,000,000 times And my data can be downloaded at: http://we.tl/J0qBfgnPUY Thanks to a very helpful post by Joshua Ulrich, the function percentcorrect function is now running much, much faster. The only kink left is the bet...

1
Q: Limiting access to configuration settings

MaxxiInitially I had my configuration data (db credentials, cookie expiry time..) in a GLOBALS variable, which I know is not a good idea. So now it is in a ConfigManager class which handles this information: <?php class ConfigManager { private $config; function __construct() { $this->...

 
@Zak I'm just magic (just kidding, why wouldn't it be though?)
 
Zak
12:11 AM
@Quill Bevause @duga no longer posts 2 messages.
 
oh...
rip
 
Zak
So there is nothing to interrupt anymore
 
how long have I been gone? ;-;
 
Duga specifically no longer posts two messages because someone thought INTERRUPT was annoying...
 
In that case, I'll pre-interrupt tomorrow's message
3
oh lol
now I feel like a fool ;-;
 
12:13 AM
lol
 
 
1 hour later…
1:21 AM
-1
A: Listing users in Azure Active Directory

Anthony Fawcett@Heslacher Even though the duplicate return statement is functionally superfluous, it does provide value in describing the program logic to Sam the maintainer. If Sam the maintainer needs to alter the return on an exception condition, the logic already shows exactly where that needs to happen. ...

This should be a comment instead of an answer. — Quill 15 secs ago
 
User does not have the rep to comment... seems like
 
Perhaps a mod could convert it for him, then?
 
If one of them is around they'll see if you flagged it
Meanwhile we can VTD, mods can convert it even if it's deleted
 
Fine, then you fix Heslacher's comment. I'm all for reviewing other people's code and giving practical advice where appropriate, but not for criticising what is perfectly acceptable coding for no reason. I've been using stackexchange for years and never felt the need to comment before. — Anthony Fawcett 2 mins ago
We are not disagreeing with your point of view, merely stating the method you chose to state it is not the correct one to use. Answers are for answering the question, not for commenting on other answers. — Quill 20 secs ago
@EthanBierlein, using the G constant and using 1 give very different values
 
1:38 AM
0
Q: Implementing the Hashable Protocol in Swift with the DJB hash function

SuragchA while back I made a custom String struct (see github repo) because of the difficulties in dealing with Mongolian Unicode rendering when using Swift String or NSString (see this question and the accepted answer for more details). The struct is an array of UInt32 so that it represents a string of...

 
Going AFK for a while
 
I'm voting to close this question as off-topic because it would belong more on code review. — Claudiu 30 secs ago
 
1:56 AM
0
Q: Find one duplicate in container with N+1 integers between 1 and N

mashTime complexity is supposed to be: O(n * log n) // Copyright [2015] <none> #include <cstdlib> #include <cstddef> #include <cassert> #include <iostream> #include <vector> #include <iterator> #include <utility> #include <numeric> #include <random> #include <algorithm> #include <limits> // #define...

 
2:16 AM
This might be more on topic on Code ReviewArc676 54 secs ago
I'd prefer use res.writelines('|'.join(zip(f1.strip(), f2.strip()))+'\n'), but if your code works I think you should go Code Review. — Kevin Guan 37 secs ago
 
2:44 AM
0
Q: Next Palindrome Python

Simon ZhuI've written a function which, given a number string, returns the next largest palindrome in string form. For example, if the input string is "4738", the output should be "4774". The original problem description is found here. The function seems to be working for all the tests I have thrown at i...

 
3:02 AM
0
Q: Get touched event to be continuously active

user3698201I'm trying to make a game i want to be able to press down on my gamePadUI to keep my character walking. Far as I can tell the TouchEvents only get called 1st time I push down on the screen I have 2 methods called constantly update() which keeps track of my game states and in each state has Touch...

 
3:21 AM
This question could be suitable for Code Review, as long as (a) your code works as intended, (b) your code is real code, rather than example code, and (c) your code is included in the body of the question. If you wish for a peer review to improve all aspects of your code, please post it on Code Review. — Phrancis 55 secs ago
 
@CaptainObvious Not working as intended, but seems like a good migration candidate for SO.
 
3:47 AM
0
Q: which is the best way in Rest endpoint development with multiple table mapped forien key?

KumarI am developing rest api for business service.jpa table entity use to connect database. same pojo using rest endpoint also. it is good method to develope rest end point or i need make separate pojo for rest endpoints.

 
codereview.stackexchange.com/questions/tagged/java shows we have 5k questions tagged as Java!
2
 
Yay for Java! ᕕ( ᐛ )ᕗ
@CaptainObvious Oh course that crap one had to be our 5001st lol.
 
 
1 hour later…
5:08 AM
Writing for the majority, Justice Kennedy called the man's arguments that he could be either Alito or Ginsburg "surprisingly compelling, but ultimately unconvincing."
2
 
 
1 hour later…
6:17 AM
Thanks for the code review, but you are talking about classes that you have not explained. Do you want me to map the board in a 2d array first? — WhiteWolfza 46 secs ago
 
6:33 AM
Monking
 
7:00 AM
0
Q: Checking for the presence of each and both members of a string pair in a list of strings [Python]

traggatmotIn python, I have many pairs of strings, and I need to check for their presence in a list. However, some pairs have one blank string and one real string ['','string2'], and some have pairs have real string for both members ['string1', 'string2']. The output of searching the list for the names is...

 
7:55 AM
0
Q: Uploading Multiple Images w/ Previews via JS FileReader

HybridI have created a way for users to upload multiple images onto my site, and then see them previewed in a slider. However, my code is a bit clunky, and so I was wondering if anyone had any suggestions to optimize my code. <script> $(document).on('click', '#_haveImage', function() { // Dummy li...

 
8:35 AM
@SirPython @Quill Justice has been served, so I'm fine.
Monking all
@Vogel612 Was it salvageable in your opinion?
 
monking @all
 
8:50 AM
Should be posted there Code Reviewdotvav 8 secs ago
 
@Mast the question? No. The user? Yes
 
@Vogel612 So the question deserved deletion. The user is still free to post questions, he didn't get banned or anything. All is as it should, right?
 
Aside from that the user didn't get useful feedback. Only: we don't want your question. One comment downvotes another comment by Ethan which was stooping to their level and instadelete...
Not a good experience...
 
It's not a good experience, no. But the alternative is to cherish all incoming users like it isn't their fault they don't read the rules and make them feel cozy here.
Sure, we shouldn't handle all OT questions like this. But this one was way out of line. Un-salvageable crap, a question.
 
True, but IMO not enough justification for what happened. Benefit of the doubt.
Also it's not about making users feel cozy, but about being polite and maintain a level of professionalism
 
9:02 AM
If he picks the wrong site (a SO question posted on CR), sure, we can point it out like civil people and help the guy fix it up and migrate. Assuming he put some effort in it himself of-course. I'm not against helping misguided people.
 
Bbiab gerting to university
 
But this was off-topic for any SE site written with a style that just screams "I don't care you guys are actually people instead of an automated free code writing service, just give me my code"
I simply can't feel compassionate with such users.
@Vogel612 Have fun :)
 
Zak
9:15 AM
Monking @all
 
0
Q: Pub/Sub in JavaScript

RaineThis seems to work, but for some reason I'm not entirely sure about it. Can anyone point out any issues with this simple pub/sub library? Thank you! (function (undefined) { window.mylib = $.extend(window.mylib, (function () { var subscriptionsBag = function() { var se...

 
@Zak Monking
 
9:31 AM
Monking
 
Monking
 
9:51 AM
0
Q: Sudoku Solver in C++ weekend challenge

Kilian HeI am very new to programming (using C++) and coded a sudoku solver as a weekend challenge. I guess there are so many things to criticize, but I would really appreciate some constructive criticism. Just what strikes you the most. If you want to run the code, a "sudoku.txt" has to be in the same di...

 
10:07 AM
monking
having to debug DOM nodes being orphaned but not being deferenced.. yay memory leaks
 
Sounds bad ^^
 
6MB in 2 minutes of memory leak, yeah, its pretttty bad
 
/me is wondering why Pops is lurking in here...
 
@DanPantry "Add more RAM"
@Zak Meanwhile Firefox still works with 1073 tabs shared over 7 windows
(Yes it uses 10% CPU and 1.7GB RAM)
Yesterday something started leaking to 2.7GB RAM though and then it started being a bit more unresponsive :|
 
I'm still looking for a way to decouple Firefox instances from each other. If one window fails, the rest shouldn't follow suit.
 
10:22 AM
@Mast Yeah, that'd be nice ^^
 
ffs. I think I've found a really stupid reason for this memory leak
 
Will probably eat more RAM, but if that's the only drawback I'm all for it.
@DanPantry goto?
 
some idiot (third party) made it so that every time you create a new window you create an arbitrary html string then wrap it in jQuery and bind it using Angular
but the scope made by angular & the jQuery elements are never destroyed
 
Sounds easy enough to fix.
 
Yeah, sounds easy tof ix
NOt so much in reality
 
10:24 AM
You can't wrap it?
 
This affects every window in the entire app
And the library it uses (Kendo, shudder) only works if you use jQuery
 
Does anyone have suggestions to be productive during a daily bus ride? So far I'm just listening music, pretty hard to work
 
Yea, but you can't wrap it so the memory gets dumped the moment the window goes down?
 
@Mast trying to work that out now
 
I'm losing pretty much my whole day for 2.5-3h of actually doing stuff, kinda bugs me
 
10:26 AM
Informative audiobooks/podcasts?
 
@skiwi Books work quite well on the bus.
 
VS if you could stop crashing on me.. that'd be great
 
Zak
@SuperBiasedMan +1 from me
 
@Mast They don't work that well for me, tried it already
@SuperBiasedMan Hmm, that might work, though I'd rather do something myself, but it's something
 
0
Q: Simple 1-dimensional labyrinth

RUser4512I am training a colleague who is familiar with Python but has a limited knowledge of C# and complexity. I thought the following problem could be a good start. You are in a desert, there is a (infinite) wall in front of you and you know there is exactly one door, but you don't know if it is on th...

 
Zak
10:37 AM
@skiwi Without access to a table, things you can "do" productively are rather limited. If you want, I can recommend some awesome podcasts for quite a wide range of topics
 
I can also recommend ones, depending on what you'd be into.
 
11:06 AM
In fact you might post this to the Code Review site. They will turn up about a dozen issues which will be quite instructive. — usr 5 secs ago
Just a note: make sure that whatever you ask about on Code Review is about already working code. — Zak 16 secs ago
 
11:23 AM
@DanPantry is this what you had in mind? gist.github.com/Vannevelj/c8901ad12f223bbde40d
I've been trying to write a SSCE that fixes the issue but I can't seem to do so
 
11:38 AM
Wait.. I think I fixed it with just callbacks? How is that possible
 
@JeroenVannevel magic ?
 
@JeroenVannevel Uh.. that won't work
 
You completely ignored the part where I said that promises are always asynchronous..
Your second example works because you're invoking cb synchronously
 
^ How does this work? Why doesn't it return result before the callback is finished?
what
how am I invoking it synchronously?
This is how I've always invoked cbs
 
11:40 AM
You're calling this function synchronously
Its just like any other function call
i.e, synchronous.
That means it will execute straight after the loop finishes
and the function you're invoking won't "end" until after your cb function is invoked.
By contrast..
The function you pass to .then() won't execute until after the replace function has ended.
This is because .then is guaranteed to be asynchronous.
And so in this example, result is undefined.
 
Ah, I misunderstood your explanation then. I thought you meant that somehow, that then() would be executed before the return
 
Well, the function you pass to .then will be queued synchronously.
 
Looks like my SSCE is wrong then because the invocation of the callback should be asynchronously of course
 
But it will not do anything until at earliest next event loop iteration.
I'll fix it for you now.
Woops, I clipped input and missed a capital letter, but I think you get the idea
 
mmm this looks different from what I have
 
11:46 AM
there's the diff. I can't do much helping today, have to debug this memory leak as top priority.
IE is climbing to 400MB RAM usage per user and unfortunately "don't use IE" is not an option
 
The function that is passed to input.replace(regex, func) is the one that receives the regex match
It seems like here you're doing it the other way around
 
What do you mean?
In the code you've given me, you get a character from myPromiseFunc and return it to input.replace.
the return value from the function in input.replace is the one which decides what to replace (unless I'm wrong)
And I probably am because the caffeine coffee machine is broken here.
 
In your string.replace, the second argument is a string
It can't be a string -- it needs to be a function
 
Yes
Well, that's fine.
 
@skiwi Laptops may work as well.
 
11:50 AM
However you can't use asynchronous actions inside of that function.
 
@DanPantry and that's the issue I'm trying to solve :P
 
Given that, I instead resolve the string before and pass that to the input.replace instead.
 
I do have asynchronous actions
 
@JeroenVannevel The answer is to wait for the promise to resolve first, then do something on that data
 
but the problem is I can't resolve it before
I have to resolve it based on a regex match
which I do inside the string.replace
 
11:51 AM
Then do a regex match before doing the replace.
var regex = /foo/g;
var captures = regex.match(input);

return getReplacementAsync(captures).then(replacement => input.replace(regex, replacement));
 
Can I match and replace separately? I need to be able to refer to the result of the match inside the replace somehow
 
@JeroenVannevel yes, see above
regex.match returns capture groups for the regex (in some weird format check the docs), regex.test tests whether input string actually matches the given regex instead
payslips arrived :D
 
If that would work, that would indeed solve the problem. I'm not quite familiar with this regex matching though so let me try and see what it does. It feels like magic -- I don't know how it keeps track of which replacement belongs to which capture since it has to parse the regex again in string.replace
 
@JeroenVannevel that'll be in the docs, but javascript doesn't support named captures byd efault
I believe the return value looks something like an array with [0] being matching string, [1] being first capture, [2] being second and so on
return value of input.match^
 
that's the same as regex.replace(string, func) then
but still..
 
11:57 AM
I got a bonus £480 this month.. but I lose £150 of that to tax...
 
My regex matches on a string [ID.ATTRIBUTE] and gets the groups ID and ATTRIBUTE
 
now I understand why americans hate taxes
 
The string I want to replace it with depends on ATTRIBUTE
 
Zak
@Ludwik Hey!!!
 
It feels as if the code above will replace everything I match with just one of the replacements
 
11:58 AM
hey guys!
 
Hello @Ludwik
 
Ludwik is back!
 
what would you say about this text on t-shirt: cl.ly/image/0O1l2A0K3m1K is that funny or not at all? :D
 
Ehm, what are you trying to say with it?
 
Zak
I don't get the joke
 
12:01 PM
@Mast absolutely nothing. i was just trying to find some 'funny' text to put on tshirt.
ok, let's forget about this text :)
 
@Ludwik If you need a text, we can take it to meta for you.
We really appreciate the effort and we're here to help.
 
@Mast i wanted some neutral actually. some programmers' joke that would be funny to read when some other programmer read it
 
I think this would fit better on codereview.stackexchange — MHakvoort 54 secs ago
 
Zak
@Ludwik Best option is definitely to crowd-source it through meta
 
for sure, but we will do that once I post everything on meta. i just wanted to have some mockup first
it doesn't have to be final text or something. it can be changed later. just wanted to put there something so people get the idea how it would look like
 
12:05 PM
hey @Ludwik nice to see you here. Unfortunately I haven't been around at the weekend, but I read the whole thing this morning. Great to have the design soon.
 
There are so many programmer jokes around.
 
@Mast yeah, like little bobby tables
 
> A SQL query goes into a bar, walks up to two tables and asks, "Can I join you?"
> To understand what recursion is, you must first understand recursion.
I think you could write a book with them.
Let me fix that: somebody probably wrote a book with them
 
Zak
@Mast And several meta-threads no doubt
 
@Mast Take a look at
827
Q: What is your best programmer joke?

hmasonWhen I teach introductory computer science courses, I like to lighten the mood with some humor. Having a sense of fun about the material makes it less frustrating and more memorable, and it's even motivating if the joke requires some technical understanding to 'get it'! I'll start off with a cou...

 
12:10 PM
@Heslacher these are mostly typical jokes... i was thinking about some oneliner statment (very short, few words) rather than dialog like "how many programers do you need to change lightbulb? ...."
 
I think the joke coming closest to Ludwik's idea is this one:
> A programmer puts two glasses on his bedside table before going to sleep. A full one, in case he gets thirsty, and an empty one, in case he doesn't.
3
If you prefer a joke expressed as illustration:
 
Zak
If it's just for temporary purposes, how about:
 
i like this one: "Keyboard not found ... press F1 to continue" (from the post that @Heslacher linked)

not because it's super funny, but i wanted to show you strucutre i'm looking for: few words, one line.
 
Zak
"Making code slightly less wrong"
 
12:13 PM
@Zak that's a nice one!
 
> Two threads walk into a bar. The barkeeper looks up and yells, "hey, I want don't any conditions race like time last!"
 
"That's not how this works. That's not how any of this works."
 
@Phrancis Join us!
 
Monking!
 
12:17 PM
*snort*
 
0
Q: Navigate using PHP include

MitsosI am developing a platform in HTML/PHP where I do REST calls to mine data from two APIs. I would like to ask you if it is a good programming practise to to make it like that: I have a home page home.php. I get the action to perform each time from the url. home.php?appointments home.php?users ...

 
@Heslacher lol
 
hiyo
 
let's go with this one for now: "Making code slightly less wrong" and then we can think about something else on meta guys
 
12:21 PM
What's the game here?
 
@Phrancis What do you want on the CR t-shirts?
Does CR have a motto or did we somehow skip that step?
 
I don't think any SE site has a motto.
 
"Making good code better" could work, but we also accept very, very crappy code here. As long as it works.
For those who missed the original proposal:
 
@Phrancis StackOverflow's "Just Use jQuery" disagrees
 
Nov 19 at 2:34, by Mat's Mug
it's off the front page already, just... ♪ let it go ♪ ;-)
^^Still in my head, @Mat'sMug ;p
 
12:25 PM
@DanPantry meme != motto
 
@Mast let me dream
 
@DanPantry s/dream/meme
 
@SuperBiasedMan I have a meme that one day my children will be judged...
on the content of their code and not the rarity of their pepes
or something like that
 
That's the gist of how it goes.
 
If you want a review of working code, codereview.stackexchange.com might be a better place to ask. — Andy Turner 54 secs ago
 
12:28 PM
BTW, on front page of reddit right now (and hilarious - slightly NSFW language): github.com/NARKOZ/hacker-scripts
 
Zak
Nov 19 at 2:33, by Phrancis
Not broken, not hypothetical, not unwritten, not unclear, not opinion-based, not abusive or offensive, not a duplicate... it's just... garbage
pure gold
Unfortunately, it's also deleted so I can't observe this curious specimen
 
@Zak The C++ question slightly above?
 
Zak
I assume so
 
Enjoy.
 
@Phrancis first thing I noticed was teh french flag..
 
12:35 PM
Iffy question incoming.
@DanPantry It's super closed as duplicate by Jamal. Both because he's moderator AND because he has a golden badge.
 
First thing I noticed was the giant ASCII art in main(), which is essentially the whole question
 
Zak
Just had a thought for our motto.
"Not the [] you deserve, but the one you need"
Can't think of a good term to put in yet
 
@Zak Hah, I coined that a while back in chat. Lemme look it up.
Aug 5 at 19:50, by Mast
@IsmaelMiguel Code Review is not about what you need. It's about what you get.
Kind-of.
 
Zak
How about "Code Review, not always what you want, but always what you need"
 
Some questions don't deserve anything and get it anyway.
It's not always what you need either.
 
Zak
12:39 PM
@Mast Well almost-always doesn't quite have the same ring to it
 
If the question isn't clear enough, the answer will be useless. It's part of the game.
 
Code Review: Here be pedants.
2
 
@Mast Saying iffy and PHP together like it was surprising!
 
Zak
@DanPantry I like that one
 
"My code works, but..."
 
12:41 PM
"We can review anything. Even LOLCODE/BrainFuck."
 
We can review it. We have the technology.
We can make it better than it was. Better, stronger, faster.
 
"Improving code quality since 200x"
"Preventing technical debt since 200x"
Both could work.
How old is CR, 2008?
 
(More than, hour, hour, never ever, after, work is, over)
 
Morning :)
 
2010 probably
 
12:43 PM
@Mast More like 2011 or 2012 I think
@DJanssens Hey!
 
15
Q: Tiny Encryption Algorithm (TEA) for arbitrary sized data

Adam DavisThe TEA is a very simple encryption algorithm requiring little time and space - perfect for embedded systems. There are extensions to it, and every version has its flaws (WEP was based on it), but for casual protection it's perfect. Also, the encrypt and decrypt routines are exactly as found fr...

2008 ^^
 
Zak
According to the SE site list, 4years, 10 months
 
Oh, damn
 
Zak
But that'll only be since what, open beta?
 
Open beta is usually 2 weeks after private beta, so I'm not sure where they got those 4 years from.
 
12:45 PM
@Mast "migrated from stackoverflow.com Apr 23 '11 at 22:02"
 
Why the heck did they migrate a 3 year old post?!
 
Why not?
 
People find old posts and decide to moderate them on SO all the time
 
The oldest user on CR ('Community') was created 2011-01-19 19:31:34. That's probably about as close to "the beginning" as you will get
That said, TTGTW, back in a little while
 
Zak
@Phrancis 4 Years, 10 Months, sounds pretty conclusive
 
1:00 PM
Yup.
Answered a question two days ago, don't think OP is going to accept it...
 
Monking!
> I often declare about 30 variables declared at the top of a procedure and it would be nice to be able to sort them.
I knew that feature request would come one day or another
> If a procedure has 30 locals, it's clearly doing too many things. The correct way of addressing this isn't to sort the many locals, but to extract simpler, more specialized methods.

I would feel like RD gave tools to fix the symptoms rather than the actual issue, if this were implemented.
Is that a harsh response?
 
Somewhat.
In some projects, having many variables declared at the top is simply inevitable.
 
I have made the following attempt, which works. If your code works, I'd recommend ask this question at Code Review. — Kevin Guan 56 secs ago
 
Greetings, Programs.
 
Zak
I'd say 30 is definitely a Code Smell
And generally, you don't want tools to manage Code Smells
because they shouldn't be common enough to warrant the development effort.
 
1:10 PM
I'm voting to close this question as off-topic because it is about Code Reviewhjpotter92 53 secs ago
 
The alternative would be writing a feature which correctly splits them up, which sounds very error prone to me.
 
@Mat'sMug No, that is exactly correct. 30 local variables is way too many. The code is doing too much and they need to extract methods or extract objects/structures.
and/or
 
@DanPantry !!!!!!!
This seems to work. Did I overlook anything? gist.github.com/Vannevelj/7431a14671df0aab8b23
 
1:25 PM
@JeroenVannevel yes. Why are you using async with promises.
Bad @JeroenVannevel, bad.
 
possible answer invalidation by mash on question by mash: codereview.stackexchange.com/posts/111547/revisions
 
@Duga rolled back
 
0
Q: ReactJs Tabbed component

PavlinI've written a simple tabbed component in ReactJS, whose purpose was to make defining different tabs very simple. My implementation does this very well in my opinion, since defining tabs becomes very simple: <TabbedComponent> <Tab> <Name>Tab 1</Name> <Content> <h1>This is the fir...

0
Q: Get a list of all the members of an enum, and then remove the existing ones in a given list

Oscar GuillamonThe idea of this code snippet is to retrieve a list of all the items in an enum in the form of a list, removing afterwards all the elements that exists in a list provided. An application of this code would be to retrieve the list of keys remaining to press in a given device private List<enumType>...

 
Well, I managed to get more unit tests into the build. That's probably not a bad thing.
Good morning, @Phrancis. Welcome to Monday.
 
1:34 PM
@Donald.McLean Happy Monday to you as well
 
You might want to post this question on codereview.stackexchange.comOddDev 25 secs ago
 
Zak
Ooh, just got served a 500 error. Haven't seen one of those in a long time
 
Zak
1:48 PM
Best case of simplifying jargon I came across today:
"Data Scientist (=Statistician who can code)"
 
@Zak That's quite fitting.
 
> This field doesn’t update
Lovely
 
@DanPantry so the big difference here is using Promise instead of the async package?
When I use your code I'm not getting any output
 

« first day (933 days earlier)      last day (3067 days later) »