« first day (424 days earlier)      last day (4525 days later) » 

5:02 PM
What is a critical section in Windows? Is it the similar to a posix mutex?
 
in JavaScript, 20 mins ago, by Yi Jiang
You know, those flags aren't toys
 
21
Q: What is the difference between mutex and critical section?

ultramanPlease explain from Linux, Windows perspectives? I am programming in C#, would these two terms make a difference. Please post as much as you can, with examples and such.... Thanks

 
Pom po pom
 

أثممخ ًخقمي!
ٍSorry, my keyboard was switched to Arabic
Hi.
 
5:22 PM
university sent me an email asking about those assignments I should have handed in
 
sbi
yesterday, by sbi
@DeadMG You were procrastinating. (That was easy. You never do anythign else.)
 
Can anyone else see it moving? Or am I going mad.
 
sbi
@IntermediateHacker It must be you.
(Nah, I'm kidding. This is a well-known one.)
 
i know
 
5:27 PM
lol. For a moment there, i seriously thought about getting my eyesight checked
 
@sbi I'm practicing that now. Pursuing my phd on that matter.
 
sbi
@jweyrich A phd in procrastinating?
 
I could get PhD in that.
I'd be in top experts in the world.
 
@sbi yes. I'm also about to release my biography: The art of procrastinating.
 
5:30 PM
pfft, I think that I'm about to procrastinate to failure in my phd on procrastinating
 
sbi
@jweyrich Yeah, already it's almost finished, right?
 
But wouldn't that make a perfect dissertation? "I was too lazy to write the paper."
 
Procrastination may result in stress, a sense of guilt and crisis, severe loss of personal productivity, as well as social disapproval for not meeting responsibilities or commitments.
 
definitely got all of those things
 
5:32 PM
@sbi yeah, mostly pictures of me procrastinating. What's stopping the release is that there's too much to do to get it physically printed.
 
just procrastinate it.
 
I'm sure you'll get it done soon
 
@DeadMG LOL. Me too, but in 5 minutes I forget all this guilt.
 
Guilt? What's that?
 
5:35 PM
@Griwes his compiler probably ingested some LSD.
 
rofl
 
@Griwes damn, u were first.
 
guys
you fucking morons
you can't tell the OP what his compiler outputs
unless you're standing right behind him
which I doubt you are
he obviously didn't post the whole relevant program, so post a fucking comment asking for more code
there's neither need nor point to posting smug bullshit answers
 
hey, it's easy rep.
 
indeed
 
5:41 PM
oh, congratulatons
I'm sure that the +1 you gained is totally worth jerking everyone else around
idiot
 
Xeo
@IntermediateHacker Too bad you only have the rep as long as the answer exists. You know people can and in fact do flag it as "not an answer", which will result in its deletion if approved?
 
yeah. but anyway, it's probably the only question simple enough for an idiot like me to answer.
so I availed the opportunity.
 
you didn't post an answer, so you didn't take any such opportunity
 
damn... good to see one of the few answers I wrote wasn't really an answer.
 
why r u guys buzzing like bees now
2
 
5:46 PM
because a couple of morons decided to jerk around some guy for no reason
 
sbi
@AlfPSteinbach What's wrong with your keyboard?
 
Seems that moderators aren't happy with all the flagging. lol
 
sbi
@jweyrich ??
 
@sbi it's too small. they don't make decent keyboards anymoar
 
sbi
@AlfPSteinbach You eat too much, now you got fingers like sausages! It's hard to type with those.
 
5:49 PM
@sbi I said that because casperOne closed the question.
 
sbi
@jweyrich Yeah, just saw it.
 
Xeo
-1
Q: What's going on with C++ macro multiplication

Terry LiYifeng#define MAX 265 std::cout << 0 * MAX << std::endl; //to my surprise, the output is 9 rather than 0 What's the problem with this C++ macro multiplication? EDIT: The following is the complete version. #include <stdio.h> #include <string.h> #include <iostream> #d...

reopen please~
He edited the code and it's pretty clear what's wrong
 
sbi
@Xeo Got my vote already. I'm gonna flag the mods.
 
casperone's trigger happy with the close votes lately
 
I flagged one of those as not an answer.
 
5:54 PM
i voted to reopen but it was already reopen. i think that guy is going to get even more fuzz
 
I have hard time following the OP's thought process, though. "Oh, I'll put obviously correct code instead of the one I'm actually use and ask why isn't it working."
 
Xeo
nvm me.
 
I upboated everyone!
 
SOPA is voted on tomorrow. If you're not outraged, I hope you liked the Internet while it lasted. #fb
 
(There's a badge for upboating rival answers.)
 
5:57 PM
@RMartinhoFernandes well there was also this declaration of martial law, embedded innocently in the latest defence appropriation bill. going downhill over there
 
Wow. That guy is going to have a colorful career.
 
@AlfPSteinbach Yeah, I saw that one too.
 
@CatPlusPlus people try to make small snippets so others don't vomit while reading their bad code. Often they don't realise how a small change can impact on the final result.
 
I mean, it doesn't take a genius to recognise 0 * 256 cannot possibly give 9 as an answer.
 
it can in FORTRAN.
 
5:59 PM
It's not a small change, it's completely different and unrelated code.
 
… or he just has no idea what he's doing, at all, and just volunteered to maintain code in a language he's utterly clueless about.
 
Oh he has no idea all right.
 
@Pubby Very old versions of Fortran.
 
Xeo
@CatPlusPlus I already have that. :)
 
I don't.
 
6:01 PM
@CatPlusPlus sometimes I'm myself blinded by focusing on something else, and the answer might seem obvious from outside. His problem was too simple though.
 
@AlfPSteinbach What's that about? I haven't been following the news. That sounds really interesting if you're at all serious.
 
@CatPlusPlus Hah! I got that one without working expressly for it! My sportsmanship is not a farce!
You're a bad cat.
 
Xeo
Same
 
why is there an answer edit war going on?
 
What?
 
sbi
6:03 PM
@AlfPSteinbach Actually closing that question was justified, IMO. He closed it before it was expanded, after all.
 
sbi
@CatPlusPlus Well, if he knew it was the macro hackery, he wouldn't have had to post the question.
 
@Potatoswatter it's the ability to define any US citizen on US territory as a terrorist and lock him or her up without trial and without communication ability or anything, indefinitely; military law imposed on civilian land in peace time. And that's called martial law.
 
Oh, suspension doesn't show up here.
> This account is temporarily suspended for voting irregularities. The suspension period ends in 7 days.
 
@sbi yeah, and the OP literally replaced the question in that edit.
 
6:05 PM
Oh, I got +10 to flag weight, cool.
 
So he was awarded the badge for voting irregularities, but then he gets to keep it at the expense of all his rep.
@AlfPSteinbach Yep, that "fits the bill"
 
What's 'voting irregularities'?
 
Sock puppetry? Serial upvoting? Serial downvoting?
 
@CatPlusPlus I'm guessing he upvoted lots of competing answers to get a sportsmanship badge ;v)
 
sbi
@RMartinhoFernandes Who's that guy?
 
6:07 PM
@sbi Latest recipient of the Sportsmanship badge.
Ironically suspended for voting irregularities.
 
Xeo
lol'd
 
@Potatoswatter Nah, it can't be that.
 
Xeo
Maybe he removed all those upvotes after getting the badge? :D
 
sbi
@RMartinhoFernandes Ah. Ok. Oops!?
 
@Xeo lol, that's mean
 
Xeo
6:10 PM
I find that "this code does not do what you think it does" is a good introduction to many answers in the C++ tag. Sadly so.
 
 
please, someone try this: add a comment to a question, mentioning 2 persons that already commented on the same question. No need to submit/save the comment. Does the autocomplete work for you?
 
You can't mention two people.
 
It's by design.
 
6:12 PM
@RMartinhoFernandes really? remember if there's a discussion on Meta? Bad design IMO :P
 
Xeo
I kinda fail to understand that comment. Is it bad to use ALL_UPPERCASE_NAMES for whole program constants? oO
 
it's bad if you want to change it to be non-const
it's like systems hungarian notion in disguise
 
It's as "bad" as capitalising class names.
 
@RMartinhoFernandes oh, just found it, thanks anyway. meta.stackoverflow.com/questions/45273/…
 
6:14 PM
yes, you should avoid using ALL_UPPERCASE_NAMES
they're reserved for macros, by convention
 
Xeo
@Pubby Eh? It doesn't encode the data type, it encodes a logical type (constness), so it'd be apps hungarian notation.
 
Put whole-program constants in a namespace, if you want to distinguish them somehow.
 
since when is constness a logical type?
 
Xeo
@Pubby meh, "logical thing", whatever
@AlfPSteinbach Thanks, I know that macros can be evil if misused.
 
anyone familiar with jwplayer?
-1
Q: Is 0 divisible with 7?

Иван БишевацI have to write program that prints divisible numbers from 0 to 127. I don't know if 0 is divisible with 7. If 0 is divisible with 7 then this code is ok: public class Testiranje { public static void main(String[] args) { for (int i = 0; i <= 127; i++) if (i % 7 == 0) ...

 
6:22 PM
Zero is an even number. In other words, its parity—the quality of an integer being even or odd—is even. Zero fits the definition of "even number": it is an integer multiple of 2, namely . As a result, zero shares all the properties that characterize even numbers: 0 is evenly divisible by 2, 0 is surrounded on both sides by odd numbers, 0 is the sum of an integer with itself, and a set of 0 objects can be split into two equal sets. Since definitions can change, another approach is to set them aside and consider how zero fits into the patterns formed by other even numbers. The parity rules...
 
Suddenly all comments from the question disappeared. Just for me? O_o
 
Too many moderators
 
What's the C++ standard for macros if not all uppercase?
I believe it's uppercase for C code.
 
@Ozbekov the usual convention is all uppercase for macros. but not for constants. unless the constant is a macro.
 
Xeo
6:27 PM
There is no standard, there are only conventions on coding style
 
I understand that.
 
Xeo
And I love working by my own conventions on projects where there is noone else
 
@AlfPSteinbach For instance, #define TIMEOUT 5000 would be considered a constant macro right?
 
thus this shouldn't be uppercase?
 
6:28 PM
but instead you should just write int const timeout = 5000;.
@Ozbekov it shouldn't be a macro.
but as long as it is a macro, by common convention it should be uppercase, yes.
 
I see. I was just taught to use macros instead of global constants and variables in C
 
a main point is to avoid name collisions for macro names
to reduce that
 
Xeo
C != C++
6
 
and also to be able to recognize macros at a glance, because they're dangerous and obey different rules
 
@Ozbekov C has had const for a long time, as well. And enum. Avoid macros like the plague, in both languages.
 
6:30 PM
@Potatoswatter I do know that, I was just told NOT to use them as global vars.
 
@Ozbekov Um, macros can't be variables. And you said you were taught to use macros.
 
OK bit of a misunderstanding here.
I was told to use macros
 
And you shouldn't.
 
and NOT global constants or global variables at all for that matter
 
Xeo
Oddly enough, C == C++ in C and C++.
 
6:31 PM
Global constants are fine. Global state is bad.
 
I see.
 
Global state is fine unless you need extensibility.
 
Global state is ugly and hard to follow.
 
@CatPlusPlus I agree with that. I try to avoid it as much as possible.
 
If you want a program which is completely deterministic, it might be a good idea to put everything in global state. For example, control systems.
 
6:33 PM
@Potatoswatter er, I dont see the connection
 
Me neither.
 
Why not avoid global state entirely, if your program is deterministic?
 
The heap is inherently nondeterministic. And the stack is also harder to characterize, if you really need to know everything that can happen to every byte.
 
I suspect that you mean something different by "a deterministic program" than I do
 
Addresses of global variables can change between builds.
 
6:37 PM
For "big" programs, global state is awful. For "small, never getting bigger" programs it's often the elegant solution. For a cramped 8-bit microcontroller, doing everything with global variables is likely a good idea.
 
Determinism is about observable results.
 
"a good idea" != "the elegant solution"
 
By "deterministic", I mean hard real-time constraints defined in terms of clock cycles.
 
on a cramped 8-bit microcontroller, doing everything with static data might be the only practical way to fit in a program
but that doesn't make it elegant
@Potatoswatter oh. That's not what deterministic means, though
 
It's possible to make such a program elegant.
 
6:38 PM
Yes. It's also possible to write robust php code
 
Not really, no.
 
that doesn't make PHP a good idea
 
I was giggling the other day about someone complaining that Drupal core is unmaintainable.
 
6:40 PM
Hah, do you need to look at it for that conclusion?
 
Um, leaving a town to besiege it is not really a retreat.
 
Xeo
China sucks.
 
it's a valid point, though, the Communist Party has never been battered even that badly
 
The Party decided it would be better to spend an extra month and not cause a media sensation with a bloody massacre, but it's going to be a massacre either way.
 
Xeo
6:46 PM
As a government especially
 
@DeadMG No, the Party isn't losing anything here. They just prefer to starve the village than risk bad publicity with bullets.
 
no, you don't get it
in the past, they've never had to consider any options other than bullets
bad publicity? what do they care, they control the media exclusively
 
They care about what the outside world sees.
It's diplomacy.
 
the outside world can't afford to implement any geniune threats and they know it
 
@RMartinhoFernandes Damn.
 
Xeo
6:48 PM
@Potatoswatter Did they really ever care about that?
 
Still, starving thousands of people doesn't really count as good publicity, does it?
 
They care about their image now that they want to be seen as a regional leader by, for example, Australia.
Apparently if this was reported upon, there were some journalists around. They will be gone by the time the people are starved. Or burned, shot, who knows.
 
It isn't even about communism per se. The government is taking away their land in order to sell it for profit.
It's only natural that people are going to protest against that.
 
Starve a population, relocate others onto their land. Sounds like Stalinism to me!
 
Though not C++, it's funny :-)
 
Xeo
6:58 PM
damn ideone, slow as fuck again. :|
 
I can't find the funny.
 
They removed the question...
He said "I learned C# and I want to write a program like MS Word, text can be justified and there are paragraphs and [...]"
 
I felt merciful enough to make the final delete vote. Now he will get the points back.
 
Just yet another "I want to do <huge project here> but I can barely program." Not funny at all.
 
Points back?
 
7:00 PM
The question had -8 score.
 
Can you actually have a negative reputation?
Cause he had 1 point.
 
Negative total reputation is saturated at 1 point.
So it acts like negative but doesn't look negative.
 
Not really. It doesn't act like negative.
If you have a bazillion downvotes, and I upvote your question, you'll be at 6 reputation.
 
If you get 5 downvotes, then 1 upvote, your total rep is 1
 
7:04 PM
No?
 
When a 1 rep person posts a good question, I start by downvoting exactly because of this.
When I change my downvote to upvote a few seconds later, he gets 7 rep, totalling 8.
 
Though that's only temporary though. I think the rep-audit will still show 5.
 
Damn webserver arithmetic!
 
cpx
If you recalculate rep after you gained some reputation, you'll lose that negative rep at that point.
 
It's a known "feature".
 
7:05 PM
Yeah, everything gets recomputed periodically.
 
Calimero lost one of his dads. It's not fair.
 
Alright that makes sense.
 
8
A: Removing a downvote adds reputation that wasn't there

HuBeZaIt's "as designed" because the FAQ says: "A down vote on your Question or Answer is removed: +2". "A user's reputation may not drop below 1". I'm guessing a reputation recalc will fix this "by design" anomaly.

 
any boost::gil experts in here?
 
I think that not even with a recalc it will count as negative.
 
7:08 PM
Also, getting a downvote revoked when you already reached the repcap on the same day as the vote will give you +2. But it isn't counted in the rep-audit.
Happened to me twice.
Get downvote early in the day. Reach repcap. Then the downvote is revoked, and I get +2.
 
This is a lot of thought to put into getting 2 points!
 
@bamboon I've used it a bit but I wouldn't call myself an expert
 
@awoodland ok, do you know how I can concatenate two images? or do I have to do that manually?
 
@bamboon concatinate in what way?
like side by side?
 
So Awesome: DOJ tells DEA prolly wasn't a good idea to register their 'undercover' aircraft to the owner 'DEA' http://tpmmuckraker.talkingpointsmemo.com/2011/12/doj_report_dea_needs_to_be_more_covert_about_their_undercover_airplanes.php via @TPM
lol
 
7:15 PM
I think the easiest way would be to create a new image of the output side and then iterate over it with something that takes pixels from the right source
 
yeah ok thought so
thanks
 
Likewise with asking for our drone back from Iran. Wouldn't it be worthwhile to sell some spy drones to Israel, just for plausible deniability that a given one is ours?
 
What does "Zing!" means?
 
@Potatoswatter I thought Israel already had a large fleet of drones
 
They do, which makes my point even more valid.
 
7:20 PM
@curiousguy it's kind of like saying "awesome" and smiling at the same time
 
They don't need any more, but it would help the USA if they had some which were identical to American equipment.
 
According to this page Israel ranks #10 in the list of countries ordered by military power.
 
And there would be no other strategic consequences.
 
@Potatoswatter might not fly well with some of their neighbours (pun intended)
 
With all the other military aid we already give them, what's the difference?
I think the reason they developed domestic drones at all was that the American project was stalled and theirs surpassed us. But now I would suppose we're ahead.
 
Scanner software also hasn't improved in decades. Appliances aren't sexy.
 
It's almost 2012 and dot-matrix printers still cost $250.
 
@Ozbekov Modern dot-matrix printers are designed to run 24/7. $250 is less than they used to cost.
@StackedCrooked According to that page, Afghanistan's military is better than Kuwait's…
Under the constitution of Kuwait, the Emir of Kuwait is the supreme commander of the armed forces with a Minister of Defence who directs the Military of Kuwait through the Chief of the General Staff. The National Guard has its own commander, who reports directly to the minister of defence. Public security forces report to the minister of interior. The ruling As Sabah family maintain a tight grip on the centers of power, including many senior posts in the security services. Since 1999 women have served as part of the police forces. Organization The Military of Kuwait consists of the ...
Getting early here. Nites!
 
@Potatoswatter I need a very very very cheap printer, that can print thousands of low-quality stuff
not images, only text.
 
7:40 PM
Kuwait, Qatar, all the militaries of those little countries in SWA are a joke. In Qatar, for example, where the Qatari population is tiny compared to the population of foreign nationals, officers can only be true Qataris. All the enlisted men are foreigners. That's real dumb. They're rich and already have a sense of entitlement, and they suck at military stuff. They are way, way behind the Afghan army, even with the challenges there.
 
7:53 PM
@StackedCrooked How do you actually see the content of the post?
all I can see are the comments
 
@DeadMG It's a pure reddit post.
There is no link.
 
well that's worth jack shit then
just some random rant
 
It's from First World Problems. What can you expect?
 
I have no idea, I've never even heard of that part of reddit?
beginning to think that I'd be better off having never heard of reddit, end of
 
My printer can cancel jobs.
 
It has big cancel button that doubles as 'resume after error' and 'cancel'.
 
Does it work?
 
IME those things only serve to dig you deeper into your own personal hell of misprints.
But I haven't used a printer in years, so my experience may no longer be valid.
 
If I need to print something I do it at work.
 

« first day (424 days earlier)      last day (4525 days later) »