« first day (454 days earlier)      last day (4477 days later) » 

@MooingDuck: What do you use as temporary?
 
@Pubby oh hey, that looks very relevant
@Grizzly a template parameter :(
 
@MooingDuck Use GMP?
 
@RMartinhoFernandes I'm so happy that you aced that answer. Not just the answer, but the whole stackoverflow experience for the guy. He will be a better (internet) person for it! For fun, let me reference the (now-deleted) question posted by that same user1131997:
 
@sehe Oh thanks, I was looking for that earlier, but I couldn't find it.
 
12:13 AM
At least he was man enough to take my hint:
> @user1131997: you should ask specific questions and tell us why you are stuck doing what you tried. And stop arguing :) In fact, asking why A obj2 = *(new A()) is a memory would be a much better question already
I'm pretty sure he's gonna be completely awed by the difference it made, when he actually stopped arguing and posted a good question. Newbie question, but at least not a 'sucky/whiny' newbie question. I gave him the +10, so now he even has a Nice Question badge to show for it
@RMartinhoFernandes Yeah it took me about 5 minutes to locate it. Had to use his user-name to search my browser history for the original Q title, than searched that and found the link :)
 
@Pubby WHY IS IT ALL ONE ONE LINE
 
@MooingDuck What? It wouldn't be magic if it weren't on one line!
 
@Pubby you've got the ternary operator in there THREE TIMES!
@Pubby I am highly amused
 
@MooingDuck Did that so it could be constexpr
 
@Pubby oh right. Stupid overly-strict constexpr rules.
@Pubby I hate that constexpr doesn't allow const temporaries or ifs. Makes this overly complicated.
 
12:27 AM
 
I appear to have parsed it right. Good
Is there ane asy way to get the maximum value of a signed it at compile time? Or do I make a template struct?
 
The stuff in std::numeric_limits should be constexpr.
 
@MooingDuck: std::numeric_limits
 
@RMartinhoFernandes oh right. Stupid MSVC. I keep forgetting I have to specify my compiler
 
static_cast<unsigned T>(-1)
 
12:30 AM
lol
@CatPlusPlus You can't unsigned T.
 
You know what I mean.
 
Also, that's the maximum value of an unsigned integer.
 
@MooingDuck Actually I think it should be this: pastebin.com/2iE60G3K Haven't tested though
 
static_cast<unsigned>(-1) / 2 then.
 
@CatPlusPlus though that reminds me to overload make_signed and such for my class
 
12:32 AM
@CatPlusPlus Why +1
 
@CatPlusPlus Just divided by 2.
 
@RMartinhoFernandes for my specific example I need half the max, he's psychic
 
Maybe.
 
@CatPlusPlus I'm pretending your psychic
 
So, MSVC doesn't support constexpr?
 
12:33 AM
@RMartinhoFernandes no :(
 
How can you guys stand it?
 
@RMartinhoFernandes nullptr
@RMartinhoFernandes also: buttons
 
Xeo
@RMartinhoFernandes IDE
"I Don't know Either" :D
 
Both suck.
 
Xeo
12:36 AM
3 hours ago, by Xeo
But I'm going to bed Real Soon Now™.
 
@CatPlusPlus: Which both?
 
Xeo
Oh right, I posted that 3 hours ago
 
IDE and compiler.
 
@Xeo Ok exactly what is so great about the IDE that makes you go for a sub-par subset of the language?
Not to mention, the bugs.
 
And the lack of optimization in the compiler
 
Xeo
12:39 AM
@RMartinhoFernandes It doesn't require me to learn make and gdb. Y'know, stepping through your source with the visual debugger is nice.
 
@Xeo very
 
GDB has visual frontends.
 
Xeo
Just having everything in place is so good, I don't want to live without it.
 
@Xeo: I never bothered with either
 
There are gdb frontends. (I can't vouch for any though, I don't use them).
 
12:40 AM
And make is not related.
 
Ah. One thing I've learned since I started using gdb was to fire up the debugger less and less.
 
eclipse cdt solves those issues nicely (as does QTCreator)
 
Xeo
@CatPlusPlus Err, why not? In VS, I just "add to project"
 
@Xeo I just "create a file".
 
What robot said.
 
Xeo
12:41 AM
Oh, and of course, IntelliSense + Visual Assist X.
 
Setting a build system is one time thing.
And it doesn't have to be make.
Or make directly.
 
@Xeo Oh, so your VS is doped up!
Woot, silver badge. 75 watercraft to go for gold.
 
Xeo
@RMartinhoFernandes I could live without VA X, but the syntax coloring + few refactoring capabilities are nice to have
Also, alt-shift-S - "Find Symbol"
 
@Xeo: You should really look at other IDEs
 
IntelliSense is a good thing?
Since when?
 
Xeo
12:44 AM
@CatPlusPlus It's way better than nothing and not bad in itself, quite the opposite actually. Maybe all those haters never used the VS2010 version. Of course it got problems, but I overshadow those with VA X
 
@Xeo You mean the same syntax coloring that treats array as a keyword?
 
I used VS2010 and it constantly slowed to a crawl
 
@Pubby muldiv(0xABCDEF, 0x7FFFFFFF, 0x7FFFFFFF) is a case where your code is obviously incorrect. It overflows a TON.
 
Xeo
@Pubby Not for me
@RMartinhoFernandes Screw you. :) I said it's faulty. Stems from the fact that it has to highlight C++/CLI too, I guess. Who knows.
 
Sure, I had to hack C++11 syntax into my vim syntax file, but the fact is, I could hack it.
 
12:46 AM
@Pubby it's slow, but my netbeans and eclipse are slower. I haven't tried anything else yet.
 
Use vim!
 
@Xeo that's what MS says
@Pubby how does one step through with vim?
 
Xeo
It's just all those features brought together that makes me love VS
 
Step through? In vim we call that flying through
 
@Xeo FTR, I do have VS10 installed, I just don't use it for C++. And I only use it for C# because of R#, so I think I can understand you using it with VAX.
 
12:48 AM
@MooingDuck Overflow? The result is only 1 off.
 
@Pubby it.... oh. It overflows, then divides.... hrm. I'll do some tests see if it fits my needs, or what I can learn from it
@Xeo also en.wikipedia.org/wiki/… seems related
 
@MooingDuck Are you sure? I don't see how it can
 
What turns me off the most about about VS is the non-existent maintenance cycle.
 
@Pubby I failed to notice int64_t, nevermind
 
@RMartinhoFernandes: Not the crappy compiler?
 
12:56 AM
@Grizzly that is irritating occasionally. Specifically the missing C++11 features
 
I worked alone on a project for four months and had to work around two different bugs in VS. None of those got fixed in SP1, and they won't be in VS11 either.
This is not acceptable.
You get an update once a year if you're lucky, and it doesn't fix things.
 
Xeo
@Grizzly It's funny that MS's STL clothkeeper, is doing a GCC port for mingw. :) Seems he didn't like cl too
 
@Grizzly Hey, it's not like I like GCC either.
 
@RMartinhoFernandes: Choices of evil...
 
Xeo
Another good thing is the "jump to code" from the output window
 
12:58 AM
@Xeo You mean, jump to code from errors?
 
Xeo
Just double-click the error line
 
@Xeo CTRL+F11 while debugging to step through the assembly
 
Here's a 10k link for your enjoyment:
 
@Xeo: Are there IDEs which can't do that?
 
@Pubby vim
 
Xeo
12:59 AM
@RMartinhoFernandes Yeah, but you can actually print your own stuff there and if formatted correctly, will still jump into the code
 
@Xeo I get that in vim.
 
@Mysticial page not found?
 
@Xeo Same for vim. You can even pick what counts as "formatted correctly".
 
@MooingDuck I'll post the body in a sec.
 
@MooingDuck It's deleted. It's awesome.
 
1:00 AM
Is it true that if my companies server is in Australia it will serve content that is “upside down” to the northern hemisphere? [closed]
up vote
+12
-11
down vote favorite
8
share [fb] share [tw]


My company recently decided to get a few more servers up and running around the globe and one suggestion was Australia because we have many clients there.

My CTO is in charge of getting all the new servers up and running and when i found out that Australia was not chosen as a place to locate one i asked why. He responded that if someone from the northern hemisphere connected to that server, in Au
 
@Mysticial LOL:
 
3


I ... really don't know what to say about this question. My first guess is that it's a joke, and yet... it's actually not that funny. – Anon. Dec 9 '10 at 23:04
3


+1 for the laugh. :D – kcoppock Dec 9 '10 at 23:04
1


thanks for the laugh :-) – Femaref Dec 9 '10 at 23:04



Someone is pulling someone else's leg. Is it you pulling the SO leg, or your boss pulling yours? – Jonathan Leffler Dec 9 '10 at 23:04
1


hahaha, love it.. Australasians are used to seeing the web upside down – devrooms Dec 9 '10 at 23:05
 
> ¿uo ƃuıoƃ s,ʇɐɥʍ 'ʎǝɥ ɥO – BoltClock♦ Dec 9 '10 at 23:25
 
> we're using .Net if that makes a difference.
This line kills me.
 
Brillant
 
Xeo
1:02 AM
@RMartinhoFernandes I just can't seem to get used to vim on my debian box. all those shortcuts...
 
@Xeo If it eases your mind, they're the same on your windows box
 
@Xeo Just saying that that is not a magic VS feature.
 
@Xeo: You can always use something else
 
(that is without evil mswin.vim + behave mswin)
 
@sehe Don't mention that in polite company.
Ctrl+X is decrement, not cut.
 
Xeo
1:03 AM
What?
 
@RMartinhoFernandes Nothing agains mswin/win32, just hate it when a good editor has to be 'windowsified' (ok, I can edit my $MYVIMRC - no problem)
It takes the fun out of answering vim questions though, because you have always second-guess keybindings (Use C-v .... (or use C-q if you're on windows)). Bla. Boring
 
Yes, that's annoying.
@Xeo Ctrl+A and Ctrl+X increment and decrement the number under the cursor.
 
Xeo
@sehe So, what's with that notation anyways?
 
@RMartinhoFernandes Lemme guess, for consistency, Ctrl+D is excrement ? (hehe)
@RMartinhoFernandes Or, the first numeric token after the cursor on the current line. Very pwerful
 
I like CUA shortcuts.
 
Xeo
1:06 AM
@RMartinhoFernandes Okay... Seems like I don't want to get used to Vim. :(
 
@Xeo It's short. And im lazy.
1 hour ago, by sehe
You can see why I stick with sehe. It is short, and I am lazy.
 
@Xeo: I know that feeling
 
@Xeo That's just the default settings on non-Windows systems. The Windows installer sets Ctrl+X, Ctrl+C, Ctrl+V to cut, copy, and paste.
 
Also I never felt a need to
 
Xeo
@RMartinhoFernandes Well, consistency within the system, eh?
 
1:07 AM
@Xeo Vim commands are bit like talking to the editor in first letters of equivalent English sentence.
 
@Grizzly: be happy with you fancy IDEs then :)
 
(d)elete (i)nside (")
 
@Xeo Inconsistency for vim users!
 
@RMartinhoFernandes But we don't moan. We're Vim users. We have achieved Zen
 
@sehe: quite ;)
 
Xeo
1:09 AM
@RMartinhoFernandes Well, when you're using vim with default mappings, you come from linux (right?). So don't go complaining when you use windows. :P
 
@sehe At least those evil settings are well encapsulated in a separate file so you can take them out easily.
 
@Grizzly Hmmm. I'm doing C# + VS2010 + R# at work, and I'm awful happy that I have ViEmu and gvim.exe handy. So are my colleagues
 
Xeo
I mean, ctrl-c/v/x is just... idiomatic windows. :|
 
@RMartinhoFernandes Yeah, it's probably for the best. Otherwise, Xeo couldn't use vim :)
 
I don't mind the Ctrl+C and the Ctrl+X much, but Ctrl+V is important.
 
Xeo
1:10 AM
@RMartinhoFernandes What's that in vim?
 
@RMartinhoFernandes I hear you. I'm sometimes foiled with that.
 
Takes away the meaning of the next special key.
 
@Xeo Block selection or raw keycode insertion
 
Xeo
Wait, "or"?
 
@RMartinhoFernandes I utilize it more often to block selections.
 
1:11 AM
I don't find the need to select blocks very often.
 
@Xeo Modal editing, you know. Block selection in normal mode, 'escape' in all other modes
 
I barely ever do that.
 
@RMartinhoFernandes Use it all the time. Takes the boring out of repetitious edits
 
I do find myself editing register contents for macros/mappings often, and thus the want for Ctrl+V.
 
Xeo
Ah, right, that's another thing I can't seem to cope with ... not being in text edit mode by default. :|
 
1:12 AM
For commenting I have ,c<Space>.
 
Xeo
Maybe I'm spoiled by Windows
 
You can be in insert mode by default.
 
It's not the 'selecting' that does the magic. It is the 'bulk edit' ([I]nsert, [A]ppend or [c]hange) that takes the cake
 
:set im
shiver
 
@CatPlusPlus Nerdcommenter, quite nice
 
Xeo
1:13 AM
@CatPlusPlus I don't know, I didn't have the motivation to configure Vim in any way yet. :)
 
Yeah.
 
@Xeo I configured it in every way once. Then I achieved Zen.
 
Xeo
When I'm playing around with some code on my debian box, I just use gedit
 
... and the mouse!
 
I now use plain vanilla vim, with onnly NerdCommenter, repeat.vim and surround.vim
 
1:14 AM
@Xeo You can use premade vimrc.
 
@CatPlusPlus You can use Visual Studio. So you can pay for using plugins
 
Xeo
@RMartinhoFernandes Well, yeah. But really only in gedit, everywhere else I just use the terminal and stick to my keyboard
 
@Xeo I use set -o vi in shells too :)
 
vi is everywhere!
 
Xeo
Also, I'm still learning the ropes of Linux
 
1:16 AM
@RMartinhoFernandes Yup, cat ~/.inputrc:
> set editing-mode vi
 
Xeo
And I currently only really use it for cross-compiler testing anyways. And playing around with C++11 features VS doesn't have
 
You mean nearly all of them.
 
@sehe When I enabled that at first, I realized I mostly used it only to dd.
 
Hehe. I just compiled a Spirit grammar from the spirit-general user list. It compiled (single TU) in ... 5 minutes roughly :) Good thing is, it compiled, because it was breaking the OP's compiler.
@RMartinhoFernandes Really? I never need dd on CLI
 
I just found something strange on the GrubHub site and went to post on meta.grubhub.com about it. It didn't work. #everysiteshouldhavemeta
 
1:21 AM
But I heavily use 'f ', ';', 'd2f ', (followed by 'A [esc]p') and sometimes just '<Esc>v' to get into a damn editor
Silence. I hope not everyone is compiling that Spirit Source right now :)
Nice statistics: It blew the fuses out of g++ on 64-linux with 8Gb
MSVC2010 compiles it into a 809k executable, from a 42Mb object file (woah)
 
All it took to 'fix' compilation was a few carefully placed typedefs instead of repeated template references. I better let the poor guys know so they can test the fix :)
 
Xeo
@sehe ... nice link-time optimization?
 
@Xeo Actually, pre-link de-optimization
 
Failure.
 
1:26 AM
@CatPlusPlus My mis-edit?
 
That, too.
58 secs ago, by sehe
@Xeo :2354427 Actually, pre-link de-optimization
 
Magic numbers!
 
I mean, the compile inlines all that template wankery (wink) but it figures it needs to implement the implicitly instantiated templates so they have the required external linkage.
gcc would have -fno-implicit-[inline-]templates for that
@CatPlusPlus fixed
 
So, that's why Spirit is called Spirit. Because it kills the compiler and rips its soul out.
 
@CatPlusPlus Yup. All cool things have that ability. Why are you using C++?
 
1:36 AM
I don't know.
 
i need your guys help once again
gotta a project for tommorow
and im trying to compile it under linux
 
I thought it is pretty terrific that the same source (177212 LoC preprocessed) compiles across all of GCC, MSVC and Clang++ (and apparently mingw32 as well)
@coolbartek good luck
 
gotta a couple of compilation errors such as
 
MinGW is GCC.
 
@CatPlusPlus basically, yes
 
1:37 AM
SDLfunctions.cpp: In function ‘void LoadHighscores(std::map<int, std::basic_string<char> >&)’:
SDLfunctions.cpp:491:50: error: ‘atoi’ was not declared in this scope
 
@coolbartek Inlcude a header. The manpage specifies whih ones
 
Apparently, atoi is not declared in this scope.
 
where can i find atoi in linux?
 
Also, don't use atoi.
 
@coolbartek linux.die.net/man/3/atoi (so: stdlib.h)
 
1:38 AM
Use boost::lexical_cast.
Or at the very least strtol.
 
@CatPlusPlus Give the guy a break. He is obviously learning, it is probably C and he is in a pinch
 
atoi is broken.
 
@CatPlusPlus +1 for that
 
@sehe "SDLfunctions.cpp".
 
exactly :P
 
1:39 AM
Also std::map.
 
@CatPlusPlus hehe. I read the error only
 
one more problem
SDLfunctions.cpp: In function ‘void Loadlevel(int)’:
SDLfunctions.cpp:574:24: error: no matching function for call to ‘std::basic_ifstream<char>::basic_ifstream(std::string&)’
/usr/include/c++/4.5/fstream:455:7: note: candidates are: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::ios_base::openmode) [with _CharT = char, _Traits = std::char_traits<char>, std::ios_base::openmode = std::_Ios_Openmode]
/usr/include/c++/4.5/fstream:441:7: note: std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char, _Traits = std::char_traits<char>]
string filename = "levels/level ";

char lvlnum[2];

sprintf(lvlnum,"%d",level);

//itoa(level,lvlnum,10);

string format = ".txt";

filename += lvlnum;

filename += format;

//difficulty

int totalenemies = 0;



ifstream file(filename);
 
It takes const char* instead of std::string.
Because it's iostream, and they suck in that way.
 
the thing is that it had no such problem in Windows VS
 
Because it takes std::string in C++11.
 
1:42 AM
Also, don't do char lvlnum[2]; sprintf(...);
It's buffer overflow waiting to happen.
 
i got that covered
the level is never bigger than 5
 
For now.
It's sloppy coding.
 
And VS has what little C+11 features it supports enabled by default.
On GCC you need -std=c++0x.
Or just grab a c_str() from the string.
 
i might do the second
 
std::string filename = boost::str(boost::format("levels/level%1%.txt") % lvlnum);
std::ifstream file(filename.c_str());
 
1:45 AM
thanks
i got another question (sorry for such spam)
where can i find rand over at linux?
 
@coolbartek please.... google man rand
 
alright
 
It doesn't depend on platform.
Also, rand sucks.
Well, I might as well say "everything in C library sucks" right now.
 
Besides, it was the exact same solutiion strategy as for atoi strtol
 
Boost.Random (or C++11 <random>) is superior in every possible way.
 
1:46 AM
(google) man rand, man strtol, man atoi and whatnot. Works like a charm on the commandline too
 
thanks again guys :)
 
@coolbartek Don't go. I want you to learn something you can use:
what linux is that? Debian? Fedora?
 
Ubuntu
 
See, I was about to say that.
 
I had a Linux class in high school. Every time someone asked something, the teacher would reply "Just run $ man the_command."
 
1:48 AM
I prefer Google.
 
@coolbartek sudo apt-get install manpages manpages-posix manpages-dev manpages-posix-dev
 
@CatPlusPlus Ha, kids these days. When I was in high school, Google was still starting to beat the competition.
 
It has nifty cross reference things (See Also) too.
 
thanks :D
 
@RMartinhoFernandes When I was in high school, no one heard of google. It was yahoo, lycos and altavista (oh and ilse.nl IIRC)
 
1:50 AM
@RMartinhoFernandes Plink.
 
@coolbartek Now go.
:)
 
Lol.
Go forth and C++.
 
Go Forth and Sin No More
That's an awesome tagline if you program in Forth
 
Don't forget "Go"
3 languages in 1 sentence!
 
Good spot
 
 
2 hours later…
3:34 AM
I'm trying to use open up a socket, and I'm getting:

> Socket.cpp:38:29: error: ‘AF_NET’ was not declared in this scope

Code:
Any ideas why?
I'm pretty sure it's defined in sys/socket.h
 
AF_INET, not AF_NET.
 
@CatPlusPlus . . . I hate that. I just couldn't see that I was missing an I. Thanks.
 
This might not be the right place for this question, but is it "safe" to leave a computer on when the GPU fan suddenly starts sounding like a jet engine, due to bad bearings?
It's on a critical server to be specific
 
1 message moved to bin
 
By the way; placement new was misplaced in my case
I could have just copied the object.
Ended up doing that anyways; because I got a bunch of strange bugs.
 
3:52 AM
On cars, bad bearings are to be replaced as soon as they make enough noise that they can be identified. Not sure how that works with GPU fans.
 
Contacted the company hardware guy, and he said that "they usually last for years" after they start making noise. Don't know if he really knows what he's talking about though....
 
in my experience, they can stop and start fairly intermittently
it's a smart idea to replace them, though
 
I will eventually; just not tonight
Probably tomorrow
But I'm curious to know if its a good idea to leave the server on
 
if it doesn't need to be on, turn it off
 
The server happens to be hosting our company website.....
 
3:54 AM
Well, you can hope that GPU exploding won't damage the hard drives.
Or that'll just melt.
 
then why the hell do you have a GPU on it?
 
@DeadMG It's a small business and we use GPUs for doing a lot of computations for our cloud computing service.
 
ah I see
 
It'll turn into cloud soon enough all right.
 
It's also the reason we don't have a backup server (being a small business, without the funds to license another copy of Windows Server 2008 R2)
 
3:56 AM
lol
 
the whole purpose of the cloud is to protect you from hardware failures because you have redundant fallbacks
 
Pirate it!
 
if you don't have protection against your server failing, then that's no cloud at all
 
It's a cloud of one!
 
@RMartinhoFernandes That's only what the creator of Minecraft would say -- pc.ign.com/articles/121/1216416p1.html
 
3:57 AM
yes, another copy of Windows Server would be expensive, but how much is it gonna cost if you lose all your business?
 
Do you actually need WS?
 
@IDWMaster I saw that.
notch is awesome.
 
he is
 
@CatPlusPlus Yes, as the license of Windows 7 doesn't really allow for commercial hosting of sites.
 
That was not the point.
 

« first day (454 days earlier)      last day (4477 days later) »