« first day (358 days earlier)      last day (3659 days later) » 

12:00 PM
Holy cow, that was fast... I suspect it wasn't by someone from the chatroom right now though
 
@skiwi Needs more Jesus.
 
@skiwi I didn't even get a chance to look at it before the answer came up.
 
0
Q: Java Interview Coding Exercise

AAhadRecently I have given an interview to a widely well-known technology firm. The first interview was general and it went well but they rejected based on some technical things. They did not mention it so I expect may be due to my Coding Exercise that I submitted is not well designed. It would be gr...

 
@StackExchange Has no code in the question
 
12:22 PM
This is a non answer, right?
0
A: Creating a better NSLog

xzerorWhy just don't use CocoaLumberjack? It's "a fast & simple, yet powerful & flexible logging framework for Mac and iOS." I used own defined macros before. #ifdef DEBUG #define DebugLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE...

 
@nhgrif Doesn't look like one
 
Time foe a good morning!
Monking.
 
Doesn't look like an answer or doesn't look like a non-answer?
 
Monmking @rolfl
@nhgrif Doesn't look like an answer imo
 
Right.
 
12:23 PM
3
A: Field class used by my trading card game

Ingo BürkFirst, I don't think Field is a good name – it is really generic and doesn't reveal any information. Now a few notes on your unit tests: Instead of duplicating the setup Field field = new Field(6) in every test, you could use a @Before annotated setup method: public class FieldTest { priva...

He raised a good point about Optional<T>...
 
0
Q: Rotating the String -Codechef-Need Help in Optimizing the Code

arunkrishnamurthy01below is the code for the problem (http://www.codechef.com/problems/ROTSTRNG/) ,i have made use of String function equals in my solution,Solution is working fine for all the test inputs but still iam getting a TLE while I submit to the Judge,Need your ideas on optimizing the code import java.io....

 
@rolfl Good monking to you, sir.
 
Right, I woke up this morning to the busiest mod morning ever (for me).
 
(Note I can still return Optional<T> even if I don't store it as a Optional<T>[]
 
So, general statement about Not an Answer flags ....
0
A: Creating a better NSLog

xzerorWhy just don't use CocoaLumberjack? It's "a fast & simple, yet powerful & flexible logging framework for Mac and iOS." I used own defined macros before. #ifdef DEBUG #define DebugLog( s, ... ) NSLog( @"<%p %@:(%d)> %@", self, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE...

^^^^^^ It is an answer.
Just a bad one.
 
12:25 PM
I'm going to argue it's not an acceptable answer on CodeReview.
 
It can be dealt with using the appropriate tools that you (the community) have available.
 
And if I need to open a meta discussion, I will.
 
OK, but you will find the answer is:
downvote, edit, comment, all of the above
 
But simply recommending all of my code be replaced by a library, I don't think that's really acceptable here.
 
Yes it is
It can be expressed differently, better, and with more logic/reasoning
If you don't like it, flagging it as NAA is not the right response
 
12:26 PM
And maybe some example of how to use the library in your specific case.
 
Flagging it means "Only a moderator can solve this problem".
This is not true (in this case).
 
I flagged it as not an answer because I don't think it's an answer.. not because I don't like the answer and want it removed by any means necessary.
Moreover, skiwi agreed with me that it wasn't an answer.
That doesn't it make us right...
 
@nhgrif then you are both welcome to downvote it as much as you can
You have already commented.
You can also edit it if you want, to improve it.
 
The library he linked and his example macro (which he doesn't even explain what it does) doesn't even match the format of the example output I put in the question.
 
I am not saying it is a good answer! I am just saying it is an answer.
If you downvote it, (and others do as well), then it hets put in different queues, and the user gets the message, and it gets improved, etc.
 
12:33 PM
@rolfl An NAA flag doesn't put burden on the mods, right? It is a community thing if I'm not mistaken (like closevotes, etc.)?
 
Well, maybe someone else can provide a comment better explaining the problems with the code... but I really don't like the precedent of linking to libraries being an acceptable answer when that's all the answer is.
I realize that in some cases, using a library really is the best thing to do when you've got a really complicated project and you're talking about replacing numerous files and hundreds of lines of code with a well-tested library that does exactly what you want, but that should also come along with pointing out the issues the original code actually does have and why the library is better.
This particular answer doesn't point out what's wrong with my answer, doesn't explain to me why the library would be better than my code (just that the library was better than his code)
And my code is 20 lines. The library he's linking to is 21 files
 
0
Q: Writing an interface for networking in an embedded system

UnTraDeI'm writing a driver in C for a WiFi module attached to a PIC18 microcontroller. I want to implement some functions that I'm familiar with in computer application level programming like Window's API recv function for WinSock. The module itself already implements the WiFi communication protocol an...

0
Q: Disk Scheduling Algorithm

vidit jainAim is to provide total head movement in different disk scheduling algorithms namely FCFS, SSTF, LOOK, C-LOOK, SCAN, C-SCAN. #include <iostream> #include <cstdlib> #include <conio.h> #include <math.h> using namespace std; int compare (const void * a, const void * b) { if ( *(int*)a < *(int*...

 
@skiwi It is both handled by mods and the community. The community alone can't mark the flag as "finished" though.
In this case, I agree with @rolfl (Monking!), it is an answer. If you don't want to use the library, add a comment stating that (the fact that the library is 21 files when all you want is just a small portion of it is a good argument to not add it)
Btw, @rolfl, you said it snowed in Canada yesterday? Today, it's > +20 C here and feels like summer :)
 
I'm not a mod, so my opinion literally couldn't matter less, but a "answer" that is nothing more than a link to a library, has to at a minimum, point out the problems with code in the question and explain why the library would be better for it to actually be an answer in my opinion. And here's why...
This guy says he tried writing his own logging macro, and says the library worked better for him (doesn't explain why)
But let's suppose his macro was bad.
 
@SimonAndréForsberg Ah ok, so it differs from VLQ then?
 
12:43 PM
And let's also suppose he hasn't looked in the library at all (which is a safe assumption as long as he's not explaining anything about the library or why it's better)
How does he know that the relevant parts of that library aren't written exactly the same as my code?
He doesn't even comment on the efficiency of the library versus my code--only about the efficiency of the library versus some code he had previously written--and his code isn't the question.
 
@skiwi I think @rolfl can answer that better than me.
 
I do tend to agree with NAA, because it doesn't review the code in the question...
 
11
Q: What are the correct action to take when there is a 'bad' answer?

rolflWhen there is an answer you feel is 'bad', what are the correct actions to take? For example, the question: Similar methods using loops has an answer: If you always use both functions together it might be faster to run the code in one pass instead of two, but here it is perfectly fine to...

 
I was reading:
13
Q: Short answers and code-only answers

ChrisWWhat should we do with: Short answers (for example, "I suggest you use [hyperlink to this standard API] instead.") Code-only answers (for example, an improved version of the code in the OP) Such answers could be improved (e.g. by adding an explanation of why the suggestion is helpful). Is it...

Points 1 and 3 on the accepted answer on when to flag.
While this answer isn't strictly code-only, the answer certainly makes zero reference to my code other than the very weak link that it's about logging.
And if this answer is an answer, it can be 100% directly copy & pasted to EVERY question about logging.
Moreover if this is an acceptable answer that can be marked as accepted, every other Objective-C question about logging now has to be marked as a duplicate because the answer is to use this library.
 
You can't just tell advice someone to change their whole codebase
 
12:49 PM
Well... you can.
I'm not going to argue that.
Sometimes it's very necessary.
This week I'll be starting a rewrite of an app that will probably take 2 weeks or so... because we're changing the whole codebase.
BUT... we're not doing so based on a 30 minute review of the situation.
 
@nhgrif Questions on CR are rarely duplicates. Whether or not you accept the answer is up to you (I doubt you will). All we're (me and monkey) is saying is that it does not need to be flagged as NAA. The poster tried to help you by suggesting to use a library. Whether you like that or not is up to you.
 
There was a massive list of reasons why it was needed to be done before it was done.
But Simon, how is it helpful if he doesn't explain WHY the library is better?
 
Somewhat related ... I asked a question yesterday, the answer (a good one) told me to use a different program entirely.....
1
A: Directory of Snapshots

janosYour if conditions can be simplified. Instead of this: if ( `tcsh -f -c "ls -1 DSC*.jpg >& /dev/null" && echo yes` == "yes" ) then You could write like this: if ( `ls DSC*.jpg >& /dev/null && echo x` != "" ) then That is: you don't need to spawn a tcsh sub-shell you don't need the -1 for ...

 
True or false: This answer could be copy & pasted to EVERY Objective-C question about logging.
 
True, and it should be downvoted each time.
 
12:53 PM
@rolfl That answer is MUCH better and clearly different. He comments on your code first, points out some possible improvements. Then says you could use a different program, and here are some of the differences that is why I'd prefer the other program.
 
@nhgrif I never said that the answer was helpful.
 
@nhgrif - if a person has a pattern of creating bad answers (negative votes, etc) then they will be asnwer-banned automatically
 
If you agree that it should be downvoted every time, why am I the only person that has downvoted this answer?
 
By a mod deleting the answer, that will never kick in.
Because people value their reputation
and a downvote costs you one.
 
1.
But if 1 reputation is more important then showing the answerer that, at a minimum, this answer needs more imporvement, then how is the downvoting system really an acceptable alternative to flagging?
 
12:56 PM
I haven't downvoted it because I know too little about the subject. And the answer already has two downvotes now, I don't see how adding another one would help.
 
It would help him score a 'peer pressure' badge ;-)
 
Simon, you don't have to know anything about the subject to understand the reasons I'm talking about.
 
I'm a bit confused about this discussion... Couldn't that be applied to all answers? (Except the real offence ones)
 
He's suggesting I use a library without telling me what's wrong with my code or why that library would be a better option.
 
So NAA could effectively be replaced by a "this answer contains offensive content"? or other already existing reasons?
 
12:58 PM
I'm thinking of a parallel to Java here, if I saw code which uses a lot of System.out.println, and the answer suggested to start using Log4j, that would be a valid answer IMO. And in some cases, it would probably be a helpful one.
 
Not-an-answer flags are moderator attention flags.
 
@skiwi There are separate spam/offensive flags for that.
 
They create a big icon on my toolbar, and the only way to get rid of it is to delete the question, decline the flag, or mark it as kelpful, and don't do anything anyway.
What you are doing is effectively saying "I don't want to deal with it, so I am going to make a moderator have to pass a binding vote".
 
Simon--we're talking about an answer that doesn't point out anything wrong with the original code, suggests some of the original code be changed, and doesn't explain why.
And rolfl, that's not what I'm doing.
 
If you want moderators to pass binding votes for everything, then there will be a mess
 
1:00 PM
Again, I marked it as a non answer because I believe that's what it is. I immediately left a comment.
 
@nhgrif But you are ....
 
Then I immediately asked about it in here and skiwi agreed with my opinion of it being a non-answer.
If it is a non-answer, it should be flagged.
 
You are saying "This is something a moderator HAS TO DEAL WITH ....
 
If anything, my opinion of what constitutes a non-answer is wrong.
I'm not skirting responsibility.
 
I have to get breakfast before it gets cold... back in 40.
 
1:01 PM
No, rolfl, I'm saying it's a non answer.
Flag... as non-answer.
If non-answers don't need moderator attention, remove the flag option for non-answers.
Until then, I'm marking non-answers as non-answers. Because that flag option exists, I assume the people in charge of choosing the flag answers intend it to be used when appropriate.
It should possibly be an edit, a comment, another question, or deleted altogether. "You should check out this library..." is a fine comment. It's not a fine answer, as far as I'm concerned.
 
I think this comment is a good one:
At a minimum, your answer should point out what's wrong with my code, and why I should replace 20 lines of code with a 21 file library. — nhgrif 7 mins ago
Best case scenario: The answer gets improved somehow
Worst case scenario: The answer remains, with downvotes. Is there any harm in this?
 
Right. As I said, I'd be fine with the answer if it at least explained why the library should be used.
And to the latter, I guess not. But it's a little hard to listen to a moderator say "It shouldn't be closed, it should be downvoted" and then watch them not lead by example and downvote it themselves.
 
Oh, just saw that answer :( In it's current form, it's spam and might as well be deleted. It even reads as an advertisement: “I tried CocoaLumberjack and it solved all my problems. It's really easy to integrate it in your project
 
@amon That thought crossed my mind too a few minutes ago...
Downvoted and applied delete vote on it
 
1:20 PM
aw, I can't cast delete votes yet
Finally, completed this assignment in this game and now I can start programming (Isn't it normally said the other way around?)
 
I think I like Python. Very easy to get started with and useful for web-scraping.
And also, I love JSON :)
 
JSON is very useful for quick (and -sometimes- dirty) solutions
 
@skiwi Have you ever used the Jackson Java library?
 
@SimonAndréForsberg Nope
This is interesting though (unrelated): stackoverflow.com/a/23318644/2057294
 
You should :)
 
1:32 PM
3
A: Is it possible to use Java 8 for Android development?

ekcr1Android does not support Java 8. It only supports up to Java 7 (if you have kitkat) and still it doesn't have invokedynamic, only the new syntax sugar. If you want to use lambdas, one of the major features of Java 8 in Android, you can use gradle-retrolamba. It's a gradle build dependency that i...

 
I love it. It makes serializing POJOs so easy
"a tool that converts Java 8 bytecode back to Java 6/7" - I thought that should be possible!!
 
Does Android KitKat+ officially support Java 7 now? :o That sounds new to me
 
If this works for GWT too, then I'm in heaven!
@skiwi Yes, it does since just a while ago. I saw it in some Android SO question for a couple of weeks ago.
 
There is still hope!
Though I really disgust the Android framework itself
 
What's wrong with it?
 
1:36 PM
Everything
Well, first of all their API tutorials are half of the time outdated, which is a major annoyance
 
almost wrote 'lol'
 
Nor do their old versions denote that they are deprecated and link to the new versions
Then I find the API itself very verbose
 
I find the Android development documentation very useful (especially compared to the Python documentations I've read recently... yuck...)
 
It seems that WP8 is really lightyears ahead in terms of programming framework
But can't confirm it myself
 
Sure, there were some mistakes they made in some of the APIs, but overall I like it. Especially the usage of XML files to separate things.
WP8? WordPress???
 
1:38 PM
One sidenote is that we practically, for an assignment, had no time to actually learn Android, so might cause a load of frustration
Windows Phone 8
 
@skiwi Sounds more like it's your education that should be disgusted....
Windows Phone uses.... C#? Java?
 
I think C#
Anyhow, Java 8 does offer some oppurtunities for Android
 
Sounds like it's time I should learn how to use Gradle... anyone here has used it?
 
Catching up... but, in the mean time:
 
@rolfl Whoa... close queue? CR?
 
1:42 PM
first post.
 
@SimonAndréForsberg Yes, it works quite nice
@SimonAndréForsberg plus.google.com/+RayCromwell/posts/4WpGQYACYaC is this progress?
@SimonAndréForsberg Sadly I cannot test as I don't know GWT, maybe you can... once you have time?
 
'morning!
 
0
Q: Are there any bugs or ways to make my divisor code better?

Oliver PerringSo after coding my divisor code which I did as a practice for my GCSE stuff which I have to take soon I have decided to ask the community if there are any bugs or ways I can improve my code. The Code Is import time, math from array import * def programme(): num = input("Enter your Number: ...

 
@skiwi It does look a lot like progress, yes. We'll see when I can play around with it
@Mat'sMug Monking! / Afternoon!
 
morning @Mat'sMug
 
1:50 PM
It's so strange that it's 4 PM here and 10 AM (or is it 9 AM?) there...
@rolfl Apparently I look at the review queues not often enough.
 
@SimonAndréForsberg Do you happen to have some GWT questions around that show some of the syntax and usage?
 
almost 10am here
 
Hello again :)
 
This hurts:
 
Waiting hurts?
 
1:55 PM
Arrays.sort(stringArray, new Comparator<String>() {
    public int compare(String s1, String s2) {
        return s1.length() - s2.length();
    }
});
 
haha
 
Hey @Mat'sMug ....
 
could anyone familiar with O(n) notation check out codereview.stackexchange.com/q/48291/23788, I don't understand how my suggestion/answer could result in the exact same execution time (assuming OP did what I did when they "merged" the loops)... he's running 2 loops, I'm only running one, I'd expect execution time to be pretty much half of the original code...
 
new Comparator()? Isn't there any easier way to create a lambda that satisfies and interface?
 
@skiwi wouldn't Comparer be a better name?
 
1:56 PM
@Morwenn Not when this book was written
 
What about Java8?
 
Luckily nowadays it's Arrays.sort(stringArray, (s1, s2) -> s1.length() - s2.length());
Or...
 
yay lambdas!
 
How do lambdas play with interfaces?
 
Arrays.sort(stringArray, Comparators.comparingInt(str::length));
^^ Let me verify that
 
1:58 PM
I find it off-putting that lambda is -> and not =>
 
I find it off-putting that lambda in some languages is => and not ->
 
what other languages use ->?
 
[](auto s1, auto s2) { return s1.length() - s2.length(); }
 
I don't know, but => looks somewhat confusing in assignment in my opinion
 
lambda s1, s2: len(s1) - len(s2)
Choose your favorite syntax.
 
2:00 PM
anything is better than the "lambda" syntax
 
Correction, correct method was: Arrays.sort(stringArray, Comparator.comparingInt(String::length));
 
@skiwi I've been wanting to post some GWT questions here, perhaps I can post the view-part of my TTT implementation.
 
\s1 s2 -> length s1 - length s2
 
The \`? (code syntax` doens't like backslashes at ALL)
 
It's Haskell.
 
2:03 PM
@Mat'sMug Amdahl's law .... FTW
You have not changed the O(N) operation at all ... really.
 
@Morwenn Could you say which language was which there?
 
0
Q: Problems with Java - FileOutputStream

Matt.HamerI am attempting to write an address book in Java for an assignment at university and I am stuck on one bit. I am making a save button so that the user can save the people who have been entered so far to their computer, and when I am using the FileOutputStream and ObjectInputStream the program I a...

 
@rolfl help me out here, ...why/how is that?
 
I think lambda s1, s2: len(s1) - len(s2) is python?
 
I gave C++14, Python and Haskell syntaxes, in this order.
 
2:04 PM
@Mat'sMug which one is faster:
 
@Morwenn Java doesn't seem much worse tbh, probably until you actually store the lambda somewhere
 
for (int i = 0; i < 10; i++) {
    sleep(ONE_SECOND);
}
for (int i = 0; i < 10; i++) {
    sleep(ONE_SECOND);
}
 
(20 seconds, assuming ONE_SECOND == 1000ms)
 
Early enter... sorry, The above, or the following:
for (int i = 0; i < 10; i++) {
    sleep(ONE_SECOND);
    sleep(ONE_SECOND);
}
 
..right
so OP's code is unsalvageable then ;)
 
2:07 PM
@Morwenn I'm totally confused about the forwarding problem you helped me with, but I have to leave chat now because of annoying social obligations. I'll see if I can catch you sometime later
 
Well, the point is that, the loop condition is only a very small part of the operation time.
 
@Christoph Ok, see you later :)
 
(didn't mean to whore up some votes btw, it just boggled me that the OP said merging the two loops had about the same execution time)
but thanks Santa anyway!
 
It is more readable as a single loop, and all...
But, from a performance perspective, the loop has almost no overhead, so, merging them saves almost nothing ..... doing less work in the loops would be good though.
 
@rolfl Do you happen to know if there's a debug option that will print once a method gets inlined?
 
2:14 PM
gotta prep up for the twins' b-day party (2yo!), later guys!
 
@Mat'sMug So that was what I voted on!
@rolfl Speaking of loops and overhead, have you seen this one?
2
Q: Increment the cells around one in a matrix

dystroyLet's say you want to increment the cells around the position (x,y) in a square matrix m of size T. I've written the same code in a few languages. Here's the JS syntax version : if (x>0) { if (y>0) m[x-1][y-1]++; m[x-1][y]++; if (y<T-1) m[x-1][y+1]++; } if (y>0) m[x][y-1]++; if (y<T...

 
0
Q: Writing Data.List's intersperse

Kevin MeredithLearn You a Haskell shows the intersperse function: ghci> intersperse '.' "MONKEY" "M.O.N.K.E.Y" ghci> intersperse 0 [1,2,3,4,5,6] [1,0,2,0,3,0,4,0,5,0,6] Note that the interspersed element only appears inside of the elements. list elem ... item ... list elem ..... item .. list ele...

 
I'm quite surprised btw by the little response I've had on this question, is my Python code really that good?
8
Q: We'll be counting stars

Simon André ForsbergLately, I've been, I've been losing sleep Dreaming about the things that we could be But baby, I've been, I've been praying hard, Said, no more counting dollars We'll be counting stars, yeah we'll be counting stars (One Republic - Counting Stars) The 2nd Monitor is known to be a quite star-happy...

 
You have more upvotes as I got on my question though...
 
Yeah, the questions have plenty of up-votes, but I'd gladly trade half of them for another, more detailed answer about my code.
Why is this on-hold btw?
2
Q: Detect multiple devices in Keen.io collection

parsley72I'm trying to display data from Keen.io we're collecting from an iOS app where we report what devices of ours the app is used to communicate with. In particular I'm trying to find where there are more than one of our device. An entry from the Keen collection looks like: { "iOS_OpenUDID": "hex...

 
2:22 PM
I'm always confused then if people simply don't care about the question, or if they agree with it
 
@SimonAndréForsberg The code is already good enough, there is little to add.
if stars == None should be replaced by if not stars.
In Python, comprisons with None should always be implicit :p
 
sorry, that was nitpicky :)
 
No problem.
It's the kind of review I'm not at ease with since it boils down to "rewrite your code in C++, not in C" :/
 
0
Q: A concurrency-safe stack structure

KitThis is a teaching sample intended to illustrate use of mutability and list consing in F#. The structure is intended to be a thread-safe stack structure, which multiple threads can push to/pop from concurrently. Concerns: Will this actually be thread safe? Are the locks necessary? Is there an...

 
yeah...I looked at it and basically had the same thought
 
2:35 PM
@skiwi Yes, there is ....
^^^ PrintCompilation
 
@rolfl Cool, I've bookmarked that page... I was trying to confuse the JVM when inlining, but didn't succeed
 
aw man, SO thinks I'm a robot
 
@SimonAndréForsberg Actually, I couldn't find anything to back up what I said about None. I'll undelete if I find something.
@JeroenVannevel Aren't you one?
 
@Morwenn I don't think robots are evolved far enough yet to get startled the shit out of them by that chat beep
 
@JeroenVannevel That's what they want us to think.
 
2:43 PM
Huh, technically I can precompile Java code on JVM bootup if I demand it to precompile all my methods?
 
Possibly, yes...
Not one I have tried before
(also, I normally use the IBM JDK ... different options)
 
It is something interesting to keep in mind for 3D game development
Might take a while until I get back there though
And I'm possibly still confused on inlining vs compilation
 
I'm helpless when I try to name African countries -____-
 
Inlining is replacing a bytecode method call with the bytecode of the method call? And compilation is compiling bytecode of a method call to assembly?
@Morwenn South-Africa, I can name, and more
 
I can name like 15 of them, and even locate some of them on a map, but it's clearly the continent where I'm the worse.
I am better at naming micronations in Europe.
 
2:52 PM
@Morwenn The problem is they change quite regularly
It is hard to keep up.
 
@Morwenn: I did a double-take reading this answer -- it looked like the one I was writing!
 
@rolfl Appart from Yemen (which isn't really Africa) and the Occidental Sahara, I don't know.
@Edward If I remember well, you even wrote this kind of answer on another question yesterday or today :p
 
When I was a kid (in South Africa) I had to learn all the countries, and their capitals.
 
All. You mean the worlds ~200 countries?
 
In the 3 weeks between getting the assignment, and writing the test ... three countries/capitals had changed.
Just africa
 
2:55 PM
Oh, ok.
 
@Morwenn Likely.
 
I'll have you know I can name all the countries in North America
 
@rolfl You all might enjoy this online geography game.
 
Dwawing attention to this post.... because it has some interesting community-building opportunities.
1
Q: Are there any bugs or ways to make my divisor code better?

Oliver PerringSo after coding my divisor code which I did as a practice for my GCSE stuff which I have to take soon I have decided to ask the community if there are any bugs or ways I can improve my code. The Code Is import time, math from array import * def programme(): num = input("Enter your Number: ...

 
@rolfl But I don't remember Africa changing a lot when I was a kid. Ex-Yougoslavia was another problem.
 
2:56 PM
Hi, and welcome to Code Review. Here we welcome any answers that have valuable suggestions, even if they are small. This is a decent answer. — rolfl ♦ 5 mins ago
^^^ but, the question may need more than the answer it currently has
Rhodesia, Congo, capitals in all sorts of places...
 
@Edward My latitudes are rather correct, but my longitudes are always wrong.
 
@Morwenn It's rather fun, though, I thought.
 
The problem is that locations really resemble each other when the latitude is the same :/
 
I'm wondering... If I have a method that gets executed a trillion times and it returns two integers in Java, what would be a better way (just a brainfart I had yesterday evening):
1) Use an `IntPair` class
2) Use an `int[]` array
3) Use a `long`
Provided that the client can use some static method (which gets inlined at some point): `Result.getFirstArgument` resp `Result.getSecondArgument`?
 
@Morwenn Writing "This code is good because (...)" could be a fine answer :)
 
3:00 PM
@Morwenn I actually placed one in the UK when it was actually France. Sorry. :)
 
@SimonAndréForsberg Yes, but there isn't anything that I find incredibly good either that it's worth an answer :p
@Edward I got Canada and Norway confused. Thanks to boreal forests.
 
@skiwi what integers? What are the integers used for? Are they fixed to a certain range?
Confusing Canada with Norway, and UK with France? People, people, people... My European heart is broken.
 
I have a coffee to take with a square chocolate. Be right back :)
 
@SimonAndréForsberg The integers can be any valid value for int.
 
@skiwi I have travelled through France and the UK, and I can say that some places really do look the same.
 
3:03 PM
Five-year-olds know geography better than you!
 
@Morwenn It's almost as if you read that I was the one that starred your message, unless you meant to ping @SimonAndréForsberg there ^^
 
@skiwi Then I would use int[] or IntPair. Definitely not long.
 
@skiwi Yep, i totally got my ping confused :p
 
@SimonAndréForsberg However the IntPair would involve creating an object a trillion times? However int[] is also an object, so doesn't make that much difference :(
 
@Morwenn Sure, some places indeed look the same IRL... but they are still in the same place, separately, if you know what I mean... :)
 
3:08 PM
@Edward You got 9439 points in total.
 
@skiwi Exactly, and a long is just... not good... but oh, I know... I'm not sure if it would work for you, but can you use a mutable IntPair class and then the calling method changes the existing values of it?
void setIntPairToSomething(IntPair result)
result.setFirst(42);
 
That might actually be correct performance wise now you tell about it :D
Sure it creates some extra burden, but you'll always have that if you are working with performance
Luckily it's purely theoretical
 
0
Q: Polling, parsing, validating and handling data cleanly and efficiently

VeksiIt's time for a quick code review, good points, examples, handholding if anyone has time to spare for commenting and, yes, even nitpicking too. I wrote a short piece of code, purpose of which is to Read a resource on some predefined intervals. This resource can be at least a file or a network r...

 
@Morwenn I edited your answer, what do you think of that? Can it be undeleted?
(Also, feel free to add "Overall the code is fine")
@skiwi Performance wise, it will be the best option yes. And assuming you don't need all the trillion IntPairs at the same time, I think it's the best solution.
 
@rolfl Actually 9807. Try this geo-challenge
 
3:14 PM
9439 was 'my' score ...
 
@SimonAndréForsberg Also the other assumption would be that the calculation method takes quite some time, so much that it is not more performant to simply calculate twice and return result one in one method, and result two in the other method
 
new challenge accepted
 
@skiwi Speaking of Android Framework, here's from where I got the idea: developer.android.com/reference/android/view/…
 
@Edward That's an interesting, though a bit awkward interface, site
@SimonAndréForsberg I see, but then they might aswell have provided a Location object, as storagewise it's the same... possibly (atleast Location could internally implemen itself as an int[2] if it were not the same)
 
3:17 PM
@Edward apparently I won ......
 
@skiwi Sure, they could have used a Location / IntPair there, not sure why they didn't exactly but I don't think it matters much... What's important is that the method takes a parameter and mutates it.
@ChakDeIndia Aha! A new user. Welcome.
 
@rolfl Excellent! What was your score, and did any of the locations surprise you?
 
@SimonAndréForsberg I'm still not sure this is valuable advice. Unless I can back it up with a good link, I'm not going to undelete it.
 
Also, I can't say "it's good overall" because I don't really know BeautifulSoup and some BeautifulSoup expert may think it's not good enough :p
 
3:19 PM
@ChakDeIndia New chat user maybe?
 
 
@Morwenn Ok then :)
 
@Edward At least all my guesses were on the right continents ...
2
 
@SimonAndréForsberg For the usability of the android API it does, for our conversation it indeed doesn't
 
@SimonAndréForsberg Yeah
 
3:21 PM
@rolfl Hey, that could have been Haiti. :)
 
and the noob bashing begins even though I am not a noob
 
@Morwenn - other C++ folk ... you may be interested in this:
2
A: Perfect forwarding results in an error I don't understand

YakkYour code review was a failure. The universal references technique is not naively applicable to virtual abstract interfaces. Do not use Args&& in the signature, use Args..., of your pure virtual interface. Inside the implementation, the last time (or only time) you use the arg use std::forward<...

 
@rolfl Yeah, we noticed a few hours ago that it was a failure.
 
@Malachi I would not consider those responses to be unexpected.
They are reasonable.... in all respects.
 
3:27 PM
None of my guesses where on the right continent...
 
@rolfl that is what I meant, I knew they were coming
 
url.geoguessr.com/7wh0 for anyone who wants to challenge me
 
@SimonAndréForsberg - that one was tough....
 
@rolfl At least you got some contintents right!
 
The URL works now.....
 
3:36 PM
0
Q: Getting the System.Type from an assembly loaded at runtime

Jeroen VannevelAs a followup to this question I have now come to the problem of being able to get the Type of a type that is defined by the user in his own solution. Using the standard mscorlib types, everything works. The question is very easy: how can I get this type from an assembly that I will only know at...

 
LOL I couldn't get that site to work, it said Click anywhere to start playing, I was clicking on Click anywhere to start playing the whole time, but that didn't work. I had to click outside the Click anywhere to start playing.
"Your guess was 11806.354 km from the correct location and gave 271 points." This is nothing abnormal?
 
@skiwi I did the same thing.
 
So close...
Could almost read it
 
I could use a hand
 
Left or right?
 
3:42 PM
0
Q: Yet another 'any'

iavrThis is a follow-up of 'any' class implementation. After posting my answer, I kept working on the code towards parametrizing with respect to memory management as I had promised. I ended up in some pretty non-trivial piece of code that I decided to post here as a new question for review. Basicall...

 
closest that I have come to the right answer so far....lol
 
@Malachi I'm waiting until it will show where I live
2
 
there was a blue mustang in the picture and these two areas look fairly similar I assume
 
Stupid car! Why don't you show the number plate! I could almost read it
 
Do you know how to cheat with this game?
 
3:48 PM
Half of the places I get is in Russia
 
Those are the areas covered by Google Street View.
Appart from South Africa and Botswana, you will hardly find an image from Africa.
 
@Morwenn I keep getting images from Africa. and that is old
I just got one from the philipines and it is outside the highlighted area
 
:o
Beats me.
Here is an update map of the GSV coverage.
 
@Morwenn Yes, because of the source of images, it's very skewed to the northern hemisphere.
 
I should really start with the actual implementation of the TCG, after working on the model for 2 weeks.
 
3:59 PM
I succesfully named Europe's 46 countries. I'm happy :)
 

« first day (358 days earlier)      last day (3659 days later) »