« first day (769 days earlier)      last day (1932 days later) » 

12:02 PM
Explain xkcd:
> 2 + "2" uses the + operator on a number and a string. In a normal language, this would result in "22" (string concatenation); however, the new language converts the string to an integer and adds them to produce 4.
@Mast I know...
^^ Don't want to know what they call a "normal language".
41 mins ago, by rolfl
So, is the 12/14 thing intentional?
that ^^^^^ ???
12:05 PM
Didn't see that till now.
@rolfl Must be part of the language.
I think it's a bug ;-)
@rolfl No, no, this is a very exotic language.
Definitely a feature.
Exotic behaviour in an exotic language. Totally expected.
@rolfl: It is consistent with range's replacing 2 by 4 in that line's result
I asked the mods on Puzzling and they claim it is part of the joke, but then can't tell me what's funny about it... then again, those mods are just like the Programming Puzzles & Code Golf mods, and who knows what they obfuscate.
@Nobody - it is.... but, how did the prompt know that before the command was typed?
@rolfl: You are analyzing this with the wrong concept of a real process
and besides: the REPL could simply have changed it after the command
12:11 PM
@Nobody The language is self-learning.
@rolfl Note that XKCD has been known to mess-up the numbering
The joke is that the code 2+2 has added 2 to the digit "2", so that it now is printed as "4". Hence 2+2→ "DONE"; the line number [12] is printed as "[14]", and the number 2 in the output of RANGE(1,5) is printed as "4"
In early versions of FORTRAN, it was possible to modify constants like this (because constant values like 2 were stored in modifiable global slots). See Changing the value of 5.
Thx @GarethRees
@GarethRees I remember reading about that. Never dared to touch the language afterwards.
Steve - Never heard of codereview before. I'll check it out. Do I do anything to close the question? Servy - If there isn't a problem to fix, then that is the answer to my question. A lot of questions on stackoverflow deal with a better way of achieving the same results. While I agree that codereview would be a better forum for the question, I think improving coding practice falls into the scope of stackexchange. — Kalev Maricq 25 secs ago
12:30 PM
@GarethRees Still possible to modify constants in Python.
You can have 2+2 == 5 with a bit of effort.
#define 4 5
#define == !=
#define + +1+
Fortunately, it's not possible to #define everything.
Meh, we can't ping ourselves :(
@Morwenn Yes we can.
@Mast ^^
Replying on a message you sent yourself will ping yourself.
12:45 PM
@GarethRees And so the penny drops, thanks
hello everyone
would be a question on the lines of "I have a bunch of static const float at the top of my .c file, is there a better way?" on topic here?
@Morwenn: I remember it being possible
12:46 PM
@Nobody test?
yep, it is possible to ping oneself
An iOS question just got the Java treatment...
A: UITableView Cell repeating

nhgrifThe problem is this method: override func numberOfSectionsInTableView(tableView: UITableView) -> Int { // when searchcontroller is active, return the number of search results. If inactive simply return the count of the full AED list. return self.AEDItems.count } This method is asking f...

@Nobody I guess that this is for me? :P ok I'll post :)
@Federico That wasn't for you.
sry for the confusion @Federico
@Federico It really, really depends. What sort of code are you posting?
Are you posting just some static const declarations?
12:48 PM
@nhgrif working code that I would like to clean up
and I do not know if it can be improved
@Federico If the complete code is working and included in the post, it's on-topic.
@Mast I can post a snippet, but not a MWE because is part of an embedded system
@Nobody But I didn't have the sound.
@Federico Most likely, the answer to this "is there a better way?" is probably "No."
@Federico As long as the snippet is working on itself and can be verified, there shouldn't be a problem.
12:50 PM
3 mins ago, by Federico
would be a question on the lines of "I have a bunch of static const float at the top of my .c file, is there a better way?" on topic here?
@Morwenn: I did only check for the red dot
@nhgrif Put them in a .h file?
Post the code and ask what can be improved. Perhaps someone will suggest a way that works out better for you than what you have,
@Nobody and it only works with the :<number> reference
@Morwenn You don't get the sound because the window is still active.
12:51 PM
@Mast that's something on the lines of what I would like to achieve.
@Morwenn: Sound is working too
@Mast: despite the window being open/active
@Nobody Just realized my headphones are plugged in a different laptop than my 2nd-monitor laptop.
@Mast Moving something from the .c to the .h? I can't see that being a useful suggestion that could also be an on-topic question for Code Review, unless we were being shown several files that duplicated the declaration.
@Mast I moved them to the corresponding .h file and it works, I did not realize that it could be done. thanks!
But moving from .c to .h increases the scope of the variable, and that's not a good recommendation.
A variable's scope should be as small as possible. No larger than necessary.
Moving a variable's declaration from .c to .h drastically increases it scope. Does the variable need that larger scope?
12:55 PM
@nhgrif no, the intention is to leave only function declarations in the .c files
the variables are needed only in one function of that .c file
That intention sounds extraordinarily misguided.
code cleanliness
If a variable is needed only in one function, it should be declared IN THAT FUNCTION.
If a variable is needed only in one file (but multiple functions), it should be declared in that .c file.
12:56 PM
putting the variables in the function would require memory allocation every cycle, time we do not have
Not if you use static const...
@nhgrif They already were at the top of the file, so there's no shift of scope.
@Mast Yes there is. There's a difference in scope between a .c and .h declaration.
Only one file gets to use what's in the .c...
@Morwenn Cool! But how do you do it? (Write a custom importer and modify the AST? Use ctypes to hack the small_ints array in longobject.c?)
Anything that #includes the .h gets to use the .h declarations..
12:57 PM
@nhgrif The compiler won't care afaik.
@nhgrif the consequences of making a non-programmer code :P I've self-learned the few programming I know, could be that I am wrong
So, when doing OOP stuff, I shouldn't ever bother with using private or protected?
@nhgrif This is C.
I know what it is.
Different problems, different solutions.
12:59 PM
In objective-C, OOP, there's technically no such thing as private, technically...
As programmers, we can call any method
C isn't OOP.
But we agree to only use what's in the .h
And in C, it's much the same
You might be able to force the compiler to use something only declared in another .c
But you should only use something from another file if it's in a .h
The difference between something declared in .c or .h is whether it's one file or multiple files.
If something isn't intended to be used outside of this .c, it shouldn't be declared in the .h
You're saying it should be declared in the .h anyway, which would be the equivalent of using public for everything in OOP.
1:11 PM
I think your question would be better tailored towards Code ReviewJasonWilczak 43 secs ago
or VB is OOPs
Q: Simple audio playback system

LinusI am trying to optimize my game written in Java and I used the VisualVM launcher for profiling and monitoring my game. What caught me by surprise was that my basic utility to play sound effects was using the most CPU in my game. I'd really appreciate some tips on improvements which I can implem...

1:27 PM
Can't we auto-warn users if they're trying to invalidate answers by editing their question?
1:42 PM
@Mast and how would you detect that?
Monking @Mat'sMug
@Vogel612 edit in code block after an answer is posted?
@GarethRees I don't remember, but I think that there was a question on Programming Puzzles and Code Golf about this.
It had to do with the fact that CPython stores an array for the first 256 numbers.
And you can somehow access and modify it.
@Morwenn Here we go — it uses ctypes to hack the small_ints array in longobject.c
2:04 PM
@Mast mwahahaha thanks!
@Per Fair enough. I have the same situation myself right now -- a for loop that works on small data but takes hours on my big data though and I'm about to happily make it my first post on Code Review :) — Hack-R 12 secs ago
hmm... yes, sounds alright
I don't think we have many -reviewers though
@Vogel612 True.
Find some, attach them and bring them back here.
Q: synchronized procesing of queued objects

ZavaelI have a queue, where new objects are inserted and processed. For processing I use singleton thread that can end and can be restarted. private Thread backgroundThread; private final Queue<ImgData> queuedImgs = new LinkedList<>(); public void scheduleNewCodeImg(ImgData imgData) { LOG.log(Lev...

would this question be a valid candidate for migration to Code Review? it looks like working, non-hypothetical code to me and the asker has a specific issue he's interested in fixing/improving
@Ixrec It seems borderline. He's suspicious there might be an error.
2:17 PM
@Ixrec This part is suspicous.
> I am suspicious that there can be some error of not procesing an item that gets inserted in the very moment of the last iteration ending. I thought about some synchronisation, but I am not sure that synchronizing both methods will help as the process runs in backgrounf thread. Can you point me how to fix this?
In other words, he's not quite sure whether or not it works correctly.
Violates "The code works to the best of my knowledge" rule.
ah, ok, I wasn't sure if that counted as "working code we'd like to make safer" or just "non-working code"
For Code Review, askers can be suspicious that there's room for optimization, but they should be relatively confident that the code works.
I'll vote for migration to SO instead then
2:18 PM
@Ixrec Yeah... this is probably a gray area for this specific question.
Because sometimes "I'd like to make this code safer" is on topic.
It all looked really good until I hit that last paragraph.
Q: Resolving promises on resolver (ui-router )

avcajaravilleSo, we are now rewriting some parts of our application. We are trying to avoid the promise anti-pattern and do things properly. But still, Im not very convince with the results. More precisely, we are rewriting the resolver of a state using ui-router. So far, this is the current code: .state(...

Q: Python program for polygonal outer billiards

homersimpsonI have made a python program for polygonal outer billiards on convex polygons. The program used to run fine earlier however, it has started acting weird lately. I can't seem to figure out the bug in the code. If you can help me to make the program correct then I would appreciate your help. from ...

If I could get someone to mute/kick me for 30 minutes, I'd be grateful
I really need to focus on schoolwork ><
2:35 PM
Mug is in a meeting, Simon is somewhere...
get outta here then!
maybe you can prod one of the mods..
on a completely unrelated note: can we have some non-american ROs besides Simon, please?
Room Owner
people with italics usernames
it's kinda moot to make mods ROs, because they can do all the stuff anyways
Hey, a legitimate opportunity to advertise my own library...
A: Objective C Asynchronous to Synchronous Database Access

nhgrifSo, I have some experience with the github library you're using. It seems most likely that you might want to make this call synchronously because of some of the problems this library has (you can't make multiple queries at once, and can't open multiple connections to the server because the libra...

2:43 PM
Oh, I never even noticed the italic usernames.
ROs can kick-mute, move messages, pin messages, unstar things..
Don't make me a room owner, I tend to disappear from time to time without any guarantee that I will ever be coming back.
I wouldn't want to either, but the room-owner times are heavily skewed..
@nhgrif this might even become a reversal somewhen
15 mins ago, by Vogel612
on a completely unrelated note: can we have some non-american ROs besides Simon, please?
I have considered RO's in this room a number of times before... I am reluctant to wade in to changing things unless there's a real problem.
@Vogel612 It has 3 "unclear what you're asking" close votes.
2:54 PM
hmm... I hope we never need to change that list then
I can see people having a problem with the question, as they're asking about a library that isn't at all popular...
But I don't see what's unclear.
The code in the question runs asynchronously and the user wants it to run synchronously... what's unclear?
but @rolfl from my experience with chat it's simply better to always have someone available that could press the red button, before things get really nasty
especially in main chatrooms
@Vogel612 which red button?
the red button. You know, the big one...
the good old kick-mute to clear your head
anyways TTQW
2:58 PM
RO's have 4 significant things -
1. ability to move messages
2. ability to pin messages
3. ability to kick people
4. italic names (and the glory that comes with that).
the kick one is the one that actually worries me.
@rolfl RO = Room Owner?
three successive kicks result in an auto moderator flag
I didn't know rooms could have multiple owners.
check the info page ;)
2:59 PM
What are the criteria for "reversal" badge?
Q: Scaling up the intelligent concatenation of 2 columns in R

Hack-RI've got a huge dataset in R which contains (among other things) 2 columns indicating "Term Code", which are "Term Code" and "Term Code1". "Term Code" is the mostly-correct column, which usually contains a 6-digit code for year and academic term: > head(data$Term_code) [1] 201230 201230 201230 ...


« first day (769 days earlier)      last day (1932 days later) »