« first day (458 days earlier)      last day (4481 days later) » 

12:00 AM
Our climate is pretty mild, even in Winter it's uncommon to have days below 10°C
 
user142019
I'm gonna sleep. It's late.
 
user142019
good night!
 
12:38 AM
gn WTP :)
 
 
2 hours later…
2:58 AM
Where is everyone?
0
Q: why typeid returns that int and const int are same types

codekiddyif(typeid(int) == typeid(const int)) cout << "Same types"<< endl; PROGRAM OUTPUT: Same types am I missing something? these are not same types lol.

 
user406009
 
user406009
The knowledge of the internet is going down in ~27 hours.
 
user406009
Better get prepared.
 
3:51 AM
I'm trying to figure out how to make an iOs app run a shell script as root.
Considering that this is a C/C++ question, I'm asking here.
What's the deal with running a shell script on Unix systems as root?
Can I set root programmatically? Using setuid(0) fails.
 
You can fork & exec sudo.
 
how so?
Also, what header defines exec? </dumb-q>
 
Hmm, you don't know fork and exec? fork makes a copy of the current process, with mostly only two differences: PIDs and the return value of fork(). exec replaces the current process with another program.
So, you copy your process, and replace the copy (identifiable through the return value of fork()) with sudo.
 
I know, never coded primarily in C or C++. I use ObjC and snippets of C when necessary.
I'm having issues with exec(). Xcode Claims it's not a defined method.
 
exec is in <unistd.h>. And fork too.
 
3:57 AM
I only see a bunch of variations on exec, no vanilla exec
As in:
 
If you know all the arguments beforehand, you probably want execlp, I think.
 
What are the arguments?
 
execlp("program", "program", "argument1", "argument2", ...);
 
Ah, ok
Just running a shell script, no arguments needed.
 
"program" twice is on purpose.
 
3:59 AM
?
@RMartinhoFernandes What for?
 
@Moshe But you want to run sudo, right?
 
@RMartinhoFernandes yup
 
@Moshe First one is the name of the program. The second is argv[0] inside the program, which you probably know, contains the name of the program.
 
ah, ok
Did not know that. Now I do.
@RMartinhoFernandes - So how do I fork and exec then?
(I'm trying to get something going here on my own...)
 
@Moshe It usually goes something like this: ideone.com/Pji7L
 
4:06 AM
@RMartinhoFernandes So where do I take root? You're just passing in "sudo" as the process name there.
Does that just work, or do I need to log in a user?
 
Usually only a set of privileged programs can become root. Yours probably can't, but sudo can.
It will likely ask the user for permission.
If that's not okay, it's probably better to ask a real question on the site.
 
This is for iOS, so the user will probably not be prompted.
Trying to run a shell script at the press of a button.
Wait a second.
The user was running launchd manually!
 
Well, I don't know how to get superuser powers on that.
 
I wonder if there's a way to call that, passing the script.
 
Is that even allowed?
 
4:08 AM
On a jailbroken device, it is.
I'm an App Store dev, usually. Just helping someone out here.
@RMartinhoFernandes The app itself is running as root already, seems like bash drops down from that for some reason.
 
How are you invoking the script?
 
Well, we're trying something else now.
I was using system("script name")
ran, but not in root
 
4:24 AM
I believe system passes along suid status. ICBWT. Try making it a question.
 
0
Q: Error "Permission Denied" when accessing iOS Filesystem (Jailbreak)

MaxnerI am trying to write a .bundle file/folder containing 3 files from my app bundle to /System/Library/WeeAppPlugins . I have the app installed in /Applications and it is fake code signed and did chmod -R 755 to change the privileges. And in this line of code the NSError of NSFileManager returns a P...

We're trying the answer there first.
I'm off to bed for now.
 
4:49 AM
@EtiennedeMartel Morning.
 
hello
 
sbi
Wonderful!
 
Is "Weltraum" German for "Space"?
 
sbi
@RMartinhoFernandes Yep.
 
 
1 hour later…
6:21 AM
0
Q: C++ - std::list remove_if doesn't deallocate memory?

SpeedBurnerI have a Parent class and subclassed the two children Foo and Bar. Class declarations look something like this: class Parent { public: virtual void action()=0; std::string getName() {return name;} Parent(std::string name): name(name) {} virtual ~Parent() {} ...

vote to close as duplicate, please
 
7:05 AM
What does it mean to get 7 hours of sleep? Does it mean going to bed at twelve and getting up at seven. Or does it mean falling asleep at twelve and waking up at seven?
 
Depends on whether you count 'laying on the bed with eyes closed' as sleep.
 
That's basically my question.
 
Well, I don't.
If I know what's happening, then I'm not sleeping.
 
I just typoed std::male_pair(x, y);.
 
Dammit, then I didn't get seven hours of sleep after all.
 
7:15 AM
Lol.
 
@RMartinhoFernandes Nice.
 
^ And you thought your life sucked.
 
8:00 AM
How can I new an aggregate?
I have struct foo { int x; std::string y; }; and I'm trying to new foo { 42, std::move(s) }; but GCC refuses to compile :(
Oh, new foo({ 42, std::move(s) }) works.
 
Xeo
8:45 AM
new foo{...}; should also work IIRC
 
And it does on my end.
 
Xeo
new-initializer:
    ( expression-listopt)
    braced-init-list
 
mawning
 
Xeo
new-expression:
    ::optnew new-placementopt new-type-id new-initializeropt
    ::optnew new-placementopt( type-id ) new-initializeropt
 
I'm creating a HBITMAP in a function X and returning the HBITMAP. Then I'm passing it some other function. Can I call DeleteObject on it in this function?
 
8:48 AM
@LucDanton 4.7?
@TonyTheLion Yes, but make sure you don't use it anymore afterwards. It would be better to make a RAII handle for it.
std::shared_ptr<HBITMAP> wrap(HBITMAP bitmap) {
    return std::shared_ptr<HBITMAP>(bitmap, ::DeleteObject);
}
The simplest RAII handle :)
 
Xeo
Is HBITMAP actually a pointer?
 
@Xeo No idea.
 
It's GDI handle.
And it's already refcounted.
 
Xeo
8:51 AM
Well, then the robot's code won't work
 
typedef HANDLE HBITMAP;
 
Oh. Dammit.
 
Xeo
So, boost::intrusive_ptr incoming!
Even though I'm still not sure that would work
Since that too stores a HBITMAP* internally
So you'll need a handcrafted one
 
right
 
@Xeo With a unique_ptr inside, it's easy!
 
8:53 AM
@RMartinhoFernandes Yes.
 
Xeo
@RMartinhoFernandes No. That, too, will try to store a HBITMAP*!
 
@LucDanton Well, that explains it.
 
GDI+ has class wrapper for bitmaps.
Though I probably wouldn't bother, and just pass the handle around.
 
@Xeo: oh, shut up. HANDLE is a void*.
:P
 
Xeo
Then you need an intrusive_ptr<void> :P
And now, what if the definition of HANDLE ever changes?!
 
8:56 AM
@Xeo That doesn't work.
 
Right.
 
Xeo
@RMartinhoFernandes Why? oO
Wait, I can see why
 
seems not so simple
 
Xeo
Seems like we don't have an easily adoptable structure for resources that aren't actually pointers
 
What should I call a unique_ptr with a type-erased deleter?
template <typename T>
using something_ptr = std::unique_ptr<T, std::function<void(void*)>>;
 
Xeo
8:58 AM
ew
 
magic_ptr.
 
All the good names are already taken :(
 
Xeo
dirty_ptr
 
Xeo
It feels wrong to use a function<void(void*)> somehow
 
9:00 AM
Do you propose to write your own type-erasure?
@Xeo Oh wait, I meant std::function<void(T*)>...
 
0
Q: handle "The operation completed successfully" error WPF

Welsh KingI have a vast application running WPF and I seldom get the "The operation completed successfully" error randomly, could be a whole host of things. Is there any way to trap this code and just restart the app. Im already using #region "Error Checking" void OnAppDomainUnhandledException(...

lol @ title
 
Xeo
@RMartinhoFernandes Well, and what use is the type-erasure in there?
 
how can successful completion be an error?
MS fail....
 
@Xeo It doesn't force me to expose the deleter on interfaces.
 
It's not an error, it means something didn't set the error code properly.
Also why error codes in the "global error code" edition should never be used.
 
9:04 AM
Like error: success is the result of perror("error") if errno is 0.
 
Xeo
1
Q: Class size change between application and exe

PrabhuI have a console application that instantiates a class ( say Class X ). The class is defined in a dll -> X.dll. When I print the size of class in the application and inside one of class's functions (which gets called when application invokes it) - I notice a size change. I am using the VS 2010 a...

> the application prints class size as 6304 and the function prints that as 6352.
 
Gosh, I ran bjam on Boost and after 10 minutes it's just starting the actual compilation.
 
Xeo
Who needs a class that is 6kb big?!
 
std::array<char, 6 * 1024>? :P
 
Wouldn't it be advisable to heapify that?
 
9:07 AM
6kB is fine on stack. Also you can heapify the whole class.
 
so what's the difference between type-ereasure and setting up a class hierarchy with a common Base to act as the interface?
 
Still, it's fucking bigger than a page.
 
I bet it's a singleton anyway.
 
@TonyTheLion That's a type-erasure trick.
 
Xeo
9:08 AM
@TonyTheLion Type erasure is way more powerful.
 
@TonyTheLion Not having to set up a class hierarchy with a common base.
 
Xeo
inheritance is one way to do it
 
hmmm
oh, so it can be done without too?
 
Xeo
24
Q: Type erasure techniques

Xeo(With type erasure, I mean hiding some or all of the type information regarding a class, somewhat like Boost.Any.) I want to get a hold of type erasure techniques, while also sharing those, which I know of. My hope is kinda to find some crazy technique that somebody thought of in his/her darkest ...

 
Xeo
9:12 AM
I love void* + void (*)(void*) + template<class T> void f(void*)
 
Or shared_ptr<void>, for full type-erased type-erasure.
 
Xeo
@RMartinhoFernandes See one of the answers
Function pointers are actually type-erasing themselves!
Atleast for function templates
For those psychics in here: stackoverflow.com/q/8892083/500104
 
They don't want to repeat the type name.
C++ could certainly use some implicit this_type.
 
Xeo
Why? just use the class name
Injected class names are a wonderful thing
 
> i want to accomplish this: template<class Key, int b> split() {...}
What?
@Xeo I totally agree. That needs psychic powers.
 
9:25 AM
Why does google chrome remind me of a pokeball?
 
Because you like pokeballs?
 
look at the google chrome logo. Doesn't it look similar to a pokeball?
 
It looks like the Google Chrome logo cake they made a while back.
 
damn. wikipedia is shutting down. :(
look at this
good thing the puppy's not online. :D
 
WinAPI header versioning macros are hell. And MinGW manages to make them even worse.
 
9:33 AM
@CatPlusPlus I know what you mean. :(
 
It's incredible how much you can screw up simple thing like this.
 
9:53 AM
Hello all :)
 
@Xeo I think @tonyK is spot on: the question is really why that isn't allowed. it's reasonable.
 
ergh... had to move desks, so now all the world can see me.
 
@Xeo When was I reluctant to show my code ? :( I said that I dont mind uploading the projects source to a repo so you guys can see it .. but I hate being spoonfed and I doubt you guys wanted to go through all that !!
 
@thecoshman just turn your monitor 60 degrees or something. then at least they can't see what you're doing. or if you're doing anything.
 
sbi
@AlfPSteinbach 60° seems a lot, he might be unable to see what's on the monitor himself when doing this. :)
 
10:00 AM
@sbi well, I would just need to get my self a bed and work lying down :D
 
10:14 AM
@DeadMG ooh, reading that back it didn't come out quite like I meant it to :D I would try again, but I fear my reputation for as a necrophiliac will only be reinforced
 
10:25 AM
You're a necrophile?
 
Xeo
hm
Does anyone know how to make Visual Studio work with directory shortcuts?
 
@RMartinhoFernandes ¬_¬ no.
 
Xeo
In Linux it would be easy since soft-links just... work.
 
You can have that on Windows too!
 
Xeo
oh?
 
10:28 AM
(Assuming you're using NTFS, which you should.)
 
First you'd have to make Visual Studio work, but that's not trivial.
 
is that not a new feature for win 7?
 
Xeo
@CatPlusPlus Eh, it "works" enough for me
 
Symlinks are supported since Vista's NTFS.
 
10:28 AM
@thecoshman It's as new as NTFS.
 
Xeo
@RMartinhoFernandes Yeah, got NTFS
 
I don't remember the version numbers.
Pre-Vista NTFS only had junction points.
Directory hard-links, sortof.
 
@Xeo You need to use the command line. I think it's called mklink.
 
@CatPlusPlus haha +1
 
And have full privileges for some reason.
From non-elevated prompt you can only create junctions.
 
10:31 AM
@RMartinhoFernandes Beware of issues with the many Microsoft tools that don't expect symlinks - i.e. different paths referring to the same file(s)
 
Xeo
works, nice
 
@sehe You mean, like the search thing being totally messed up by recursive directories?
Or Explorer reporting your disk as using more space than its size?
 
Very nice if you have checked out a working copy to E:\Projects\A, and commit from E:\Symlinked\A, or worse yet if you want to load a Web project and IIS has the virtual directory hosted on the symlinked address.
 
Explorer had funny issues with junctions on XP.
 
Apparently, some(times) some tools will automatically switch from the one to the other representation
 
10:33 AM
And by funny I mean it deleted the original folder if you tried to delete the junction.
 
@CatPlusPlus Not on my XP box :)
 
... i'd tell you to go fuck yourself .. but from what i've heard .. you wouldn't be very good at it ..
 
@CatPlusPlus A junction is not a link
 
TC has no problems with recognising junctions.
 
@CatPlusPlus A junction is what's known as a 'reparse point' so that is actually more like a bind-mount. It is supposed to work that way?
 
10:34 AM
I don't use that, anyway.
 
> Never delete a junction point using Explorer, a del /s command, or other file system utilities that walk recursively into directory trees. These utilities will affect the target directory and all subdirectories.
 
@RMartinhoFernandes so are we ALL following her?
 
I don't.
 
@CatPlusPlus you should :D
 
I forget to even check Twitter lately.
 
10:38 AM
@thecoshman Dunno. I follow Miss Moans since sbi discovered her.
 
@RMartinhoFernandes me to :D she is rather funny, if you can accept crude humour into your life
 
11:00 AM
> I am trying to get C++ nailed down, (...)
 
Always good to try, not?
 
Seems like someone has found a hammer.
 
aha! All power to AutoHotKey!
 
What's that? A key that calls hos automatically?
 
@RMartinhoFernandes you saw nothing ¬_¬
 
11:04 AM
AutoHotKey is really awesome.
 
what it is, is awesome.
 
It's one of those things that is over-engineered in a good way.
 
@RMartinhoFernandes true, context sensitive automatic text replacement is rather nice. Though I feel I am lacking some true regex wonders
 
Snowmen are gone! Yupee!
 
Xeo
Great. I thought I'd safe myself some hassle and use SFML instead of SDL and what is? It's not compatible with VS2010 -.-
 
11:09 AM
Why not?
 
Xeo
1
Q: The application failed to initialize properly (0xc0150002)

Greg TreleavenI'm trying to compile an SFML program I've writting in Visual C++ 2010. It compiles fine, but when I run the executable I get this error: The application failed to initialize properly (0xc0150002). Click on OK to terminate the application. This happens every time I try to run an application t...

:|
 
Whatcha building, btw?
 
Xeo
Now I tried rebuilding the libs and get a slew of _ITERATOR_DEBUG_LEVEL mismatches
Playing around with some code
Haa...
 
> Microsoft Visual Studio 2010 wasn't compatible with the 2008 builds of SFML. I fixed the problem by not using 2010 and using Dev-C++ insead.
Sigh.
 
> Compile? I just stuck the header and library files in my VC folders..
Lol.
Rule #1 of precompiled open-source libraries: they don't work.
 
Xeo
11:18 AM
Interesting
I couldn't even just delete the SFML folder (I need admin rights.. FUCK, I am the admin), but if I deleted recursively from bottom up it worked. >_>
All hail Windows fail. -.-
 
@CatPlusPlus oh they do, you just have to spend hours weeks looking for the right version
 
Speaking of right versions, exceptions are no longer broken on GCC 4.7. Yay.
I can now unleash the full fury of my template aliases!
 
@RMartinhoFernandes huzzar!
 
Uncatchable exceptions was a bit troubling.
 
11:25 AM
@RMartinhoFernandes get some bigger gloves... or maybe smaller ones
 
Hmm, delegating constructors are already implemented.
Yet Another MVP question. Close votes welcome.
0
Q: Setting constructor default values in c++

HollyRecently I've learnt a bit about constructors but today i've been having trouble setting default values for the constructor parameter. The constructor declaration in the hpp file looks like this: class PlayingCard { public: PlayingCard(int value = 0, int suit = 0); //default values supplied...

 
I was just about to paste the same question to solicit more votes :)
 
sbi
I got a new gold badge: Stellar Question :)
 
is MVP a nick name, or is that an official name?
 
This is pretty silly. In Windows 7 elevated command prompt, logical drives created with subst are not visible to the rest of the Windows. And for some things you have to work in elevated command prompt to avoid running into brick walls all the time.
 
11:38 AM
checks own badge list for Stellar Question
Check. Yay.
 
sbi
@RMartinhoFernandes You're vain! We all know that you don't have to look to know which badges you have.
 
@sbi That's only because the list of badges I'm missing is so short :P
 
@thecoshman it's from Scott Meyers IIRC
 
@sbi he didn't look at SO's list of badges, he just looked at his won local copy
 
12 watercraft for C++ gold badge. Now if only someone would post one of those questions that are ripe for 10+ vote answers...
 
sbi
11:40 AM
@RMartinhoFernandes I bet you even know how many Nice Answer badges you have.
 
Almost fifty.
 
@sbi how many FTFY
 
And almost ten Good Answer.
 
sbi
@RMartinhoFernandes You're kidding!?
 
No, I'm not.
 
sbi
11:41 AM
@thecoshman Thanks!
 
@sbi np :D
 
sbi
@RMartinhoFernandes I'm baffled. I have more than twice that many! What's your problem?
 
You also have about twice my rep.
Seems like we having about the same ratio.
And twice the answers.
 
sbi
Indeed! What's holding you back? I haven't made much rep in the whole last year!
 
11:48 AM
i think striving for reputation points (on SO, or in RL) constrains how much real help one can give
it is like, yesterday someone complained here about 0.5 seconds "too late" answer not getting rep points
 
sbi
@AlfPSteinbach Nah. It's mostly how fast one can type.
 
I've mostly been answering stuff on a specific low-traffic tag lately
 
also like, when i had much slower machine i seldom got in early enough to get much rep points
 
You only need to get in early to get rep points on crappy questions.
 
i think the idea that there are many "good" questions on SO now, is incorrect
3
:-)
also, it's sad if the rep system steers one towards answering intriguing questions, rather than helping those who need help most
 
11:52 AM
It's not a crappy-good duality anyway.
 
but i think that's what it does
 
0
Q: A C++ function to delphi

Alexisplease how could this C++ function be converted to Delphi : int To_Asm_Fnc(dword Amem, dword Al, dword Ac) { int b = 0; asm ("push %%ecx; \ call %%eax; \ pop %%ecx;" : "=Al" (b) /* output value */ : "Al" (mem), "Ac" (Al), "d" (Ac) /* input value ...

 
@AlfPSteinbach intriguing questions are what keeps the site alive for the experts I suspect
 
@awoodland that and getting help with dam stupid things
 
@awoodland well i think the chat is more likely to play a prime rôle in that regard
 
11:55 AM
I got the impression that other than chat was largely under used
and even then it's a subset of the people who are active that use chat too
 
There are five or six Android rooms.
I suppose they are used.
 
iPhone/iPad is pretty full too
and PHP
 
@RMartinhoFernandes that happens when a bunch of toddlers get on the internet
 
They are used, but not useful.
 
So nice to see the old green circles and not the crappy snowmen with hats.
 

« first day (458 days earlier)      last day (4481 days later) »