« first day (577 days earlier)      last day (4372 days later) » 

11:00 AM
simulated annealing too?
 
no heuristics then? My mind usually stops working with those :)
 
Newton/interior-point.
 
nice stuff. sometimes I regret not finishing college for not having 'seriously' played with stuff like that
Neural nets, too. Hard to come up with useful projects on your own. I bet I wouldn't recognize opportunities where they would be appropriate to solve problems
 
Is non-polymorphic virtual inheritance possible?
 
11:04 AM
@StackedCrooked Yes. Why
 
Just messing around :)
 
struct A { }; struct B : virtual A { }; struct C : virtual A {}; struct D : B, C {} ;
No need for any polymorphism
 
So I won't have vtable overhead?
 
You'll have overhead, vtables are implementation details. Likely, the compiler uses the vtable 'abstraction' to solve the dynamic casting hierarchy riddles it faces with diamond-class-hierarchies too.
But, even if it doesn't actually encode these in a vtable per se, it will still have to encode the type information in some way that makes it possible to upcast from, D to A or B
@StackedCrooked Long story short: there is overhead, and whether or not the compiler calls it vtable is irrelevant
 
I see.
 
11:08 AM
I do too.
I didn't reckon many users would use textmode browsers with braille displays (for SO chat), really
 
Guess I'll just have to try it out and see.
 
@StackedCrooked Since your illustration does no actual work you'll be happy to know there is no overhead!
 
11:28 AM
@LucDanton as-if
 
Onoes getters.
 
Inoes.
 
@StackedCrooked reminds me of ideone.com/XZrh9
 
@sehe Sort of, not really. More of a QoI.
 
That too
 
11:42 AM
0
Q: Coding in song - Representing music lyrics in a programming language of your choosing

NeilWrite a program in the language of your choosing which when read are the lyrics to a song. It must be a valid program which can be compiled and run without errors. While you could technically print to the screen all the lyrics, you're encouraged to do it with style and avoiding string literals ...

I was inspired by Freddy Mercury
 
I have to update MinGW. It'll end badly, as usual.
 
anyone knows a decent arena allocator? (C++03)
 
Boost.Pool?
 
@CatPlusPlus it's only for objects of same type, isn't it?
 
12:01 PM
Yeah.
 
@Neil Nice. +1
 
@sehe Ty. *bows*
 
there's a 'code-golf' SE ಠ_ಠ
 
There's "lego answers" SE.
 
There's religion SE.. worst of them all
 
sbi
12:14 PM
So archaeologists found the oldest rock carvings to date, 37k years old. And. It. Is. Porn. (This is interpreted as a vulva, allegedly a common motif in the art of the time.)
 
Prehistoric Internet.
 
I can undo a comment upvote, but not undo the undoing of the comment upvote
 
sbi
@rubenvb You can undo a comment upvote? That must a be a new one.
 
@sbi Yeah, I just discovered that too :)
 
It was added few weeks ago.
 
12:22 PM
@sbi I had heard it was a sort of sacred figure of female fertility, though that doesn't surprise me in the least if that's true.
 
sbi
@CatPlusPlus Is there a grace period?
 
No, you can upvote and unupvote just once.
 
sbi
@Neil Of course, fertility was sacred back then, look at all the prehistoric female figures, with their exaggerated female features. They had a high mortality back then, and fertility had to compensate for that.
@CatPlusPlus You mean I can go back to some comment upvote I gave 2.5 years ago and undo that?
 
Ah, that. Dunno.
 
@sbi > The authors declare no conflict of interest.
 
12:25 PM
60 seconds.
> 2012-04-12: It is now possible to undo comment votes within 60 seconds of casting them if you don't navigate away. An undone vote cannot be recast.
 
I love the arbitrariness of those restrictions
 
sbi
@sehe That just means they assert they aren't paid for interpreting their findings this way.
 
:)
 
sbi
@sehe You pervert!
@CatPlusPlus Thanks!
 
@sehe That's what she said!
 
12:27 PM
259
Q: Recent feature changes to Stack Exchange

devinbThis is the official list of new features and various changes to Stack Overflow and the Stack Exchange network. It is jointly maintained by the community and Rebecca Chernoff (a Stack Exchange, Inc team member). RSS feed for this question Return to FAQ index

Useful.
 
@sehe probably just to help random bad clicks or something. That's what I did just now.
 
> You cannot cast upvotes on a wednesday, if you gained an even number of upvotes on any of the same-numbers days of the previous 6 months, except if the rep gain on such a day exceeded 78 (excluding awarded bounties).
> You can revoke a comment upvote, provided that you didn't navigate away, unless you can prove that that was because of a browser crash. In case of toilet visits, navigate away to totheloo.com and the grace period of 60 seconds will resume once you revisit the page that contains the upvoted comment
 
I just noticed the English "toodeloo" might have originated from "totheloo".
 
0
Q: ugly Qt app look under ubuntu

jovalI'm involed in developing some Qt application build under Linux. I have downloaded the source code and compiled it under Windows 7 firstly, but then I decided to work under Ubuntu. The problem is, the application in Linux looks like in Win95 times. I have installed Qt4 Settings and chosen GTK+ st...

ONOZUGLYAPPZ
 
@rubenvb :)
 
12:32 PM
"You cannot cast upvotes on a wednesday" *looks at calendar date* We've already passed April 1st
 
@CatPlusPlus google: failed
6 mins ago, by sehe
I love the arbitrariness of those restrictions
 
Google apps are ugly, too?
I can't not laugh at "waaah, my app looks like in 'win95 times'".
I just can't.
0
Q: User input function called but doesn't wait for input

NickI call the function getData() within my main program and instead of getting user input it just loops through it endlessly. The scenario is the user presses goes to the customer menu then selects add users. I'm guessing it's just my do while causing the problem but surely it should stop at the use...

Indentation by rolling a dice.
 
@CatPlusPlus Would be a brilliant way of making a random number generator.. counting the indentations per line.
 
@Neil in the output of /dev/urandom
 
12:54 PM
@sehe I heard of this web service which interprets the whitenoise and presents it as a random number. There used to be a limit on how much you could request, but I think that has since been removed
 
let's say you need a function that returns two strings, the 'meaning' of which are not the same, is it just me, or is some form of data type better then just a string array
I think I get the vague question award today
 
@thecoshman tuple or pair
return {"bla", "bloo"} ftw
 
If you're sure it's always going to be two, then pair.
 
yeah, so you would use a 'special' data type to represent this pair of strings.
 
Like a struct?
 
1:02 PM
I wouldn't call pair<string,string> "special"
 
It's Java btw, so trying to take a more theoretical view on this
 
C++ doesn't have multiple return types. That's one great thing about matlab.
 
We're talking about Java then?
Map::Entry<?,?>
 
well, it is a data type specially for this combination of other value. and it will only be the two value
my main point is, an array would be foolish as the meaning or returnValue[0] is not the same as returnValue[1] both would be strings yes, but what the strings are for is not the same
 
<-- confused
 
1:04 PM
It's a tuple.
 
Are we talking about a substring of another string?
 
I don't see the problem, really.
 
Still confused. What are you going to use the strings for?
 
Except for Java.
 
You could use a struct for every meaningful returned string combo yes, but that's a lot of structs for nothing. Just assign the returned stuff to a meaningfully named variable and be done with it.
 
1:07 PM
no, two independent strings, such as "MyName" and "TitleOfMyFavourateBook"
 
You mean, you have a method which returns two strings which are unrelated to each other?
 
Which is a pair. Which is a tuple. What's the issue?
Except for Java.
 
except for Java, no issue :P
 
Like, you call a method findAndLoadProperty which returns a string of the loaded property and perhaps another which indicates the name of the file it found.. for instance?
 
sbi
@WinterMute, have you been hanging out at afp a few years ago?
 
1:08 PM
AFAIK the 'best' way in Java would be a class specially for returning this 'new' data concept
 
Sign of bad structuring. Method should return a single piece of information. If it needs to return more than one, it should be made into a class.
If they cannot be related, that method should be split into two separate methods.
 
I was intending to make it a class with a static method 'getValues'
 
sbi
@rubenvb Why is it a great thing about matlab that C++ doesn't have multiple return types? Ouch! (tongue got stuck in cheek)
 
Why would you have a static method on an instance you're returning?
 
@sbi /claps
@Neil so the function is part of data type
 
1:11 PM
@sbi I am going to be the better man and ignore that.
 
I guess it could be done in a constructor and just throw an error if the values passed in don't make sense...
 
Huh. Our RAID 5 had three disks fail. I wonder how that could have possibly happened all at once </endsarcasm>
 
@Neil Wut.
How do you make a method into a class?
(Also returning more than one thing is not uncommon.)
 
@CatPlusPlus The returned object should be a single class which holds whatever information the method should return
 
and should do via a class that aggregates together. Or return a collection, if you have a collection.
 
sbi
1:14 PM
@Neil pardon me French, but that is bovine excrements. A function/method is the implementation of an algorithm. A class represents the type of objects, which are entities that combine state (data) and behavior (algorithms). They are not interchangeable.
@Neil std::pair<> is such a class. So is std::tuple<>.
 
std::tuple!
 
@sbi I was talking about Java, not C++
And if the values are strongly related, I have no problems with std::pair or something of the like
Though I wouldn't try to justify the use of std::pair or std::tuple when the relationship between returned data is arbitrary at best
 
but my point is, the fact that both are of the same data is not a valid reason to jut return an array of said data type
 
I only meant that generally speaking, it's probably a sign that the method is doing more than it really should and still remain simple
 
function takes two strings, deduces one of 8 combinations, and returns two strings based on which situation it is
 
1:17 PM
@thecoshman I agree. That'd be true for any other data type for that matter, not only strings
 
yes, the strings passed in should be enum, but that is a minor consideration when looking at this code
 
It's Java, it sucks anyway.
 
the more I work with Java, the more I dislike it
you really do need to do things the 'Java way' and I hate it when tools make me work a certain way
I don't care how bad a job I do, I want to be able to hammer in my screws god damn it!
 
Not enough Ctrl+Space.
 
hang on... how many of us work with Java? I think both you @cat and the the @RMartinhoFernandes do
 
1:23 PM
I only do silly assignments.
 
working on silly assignments is still more exposure to Java then I would wish on any one
 
Just wondering if anyone can give some insight:
Is there a reason why GCC would produce just drastically different assembly on Mac vs. Linux?
I tried answering this question, but the assembly output on my machine in no way resembles what the OP is gettingL
11
Q: Cast performance from size_t to double

TimTL;DR: Why is multiplying/casting data in size_t slow and why does this vary per platform? I'm having some performance issues that I don't fully understand. The context is a camera frame grabber where a 128x128 uint16_t image is read and post-processed at a rate of several 100 Hz. In the post-...

 
same version of GCC?
 
I'm using 4.6.1. OP doesn't seem to specify.
 
If it's a default one from XCode distribution or something, then it's around 4.2.
 
1:32 PM
@CatPlusPlus That's old...
 
if it's not the same version, I would suspect that is the culprit then
 
Which probably explains it. Because the assembly that I'm seeing from 4.6.1 appears to be doing some very powerful optimizations that I don't see in the OP's assembly.
 
Yup, 4.2.
They can't use newer ones.
 
well, optimisations would drastically effect the binary as well of course
 
4.6.1 seems to be doing a very aggressive type of data-type emulation that allows those casts to be hoisted out of the loop. 4.2 doesn't seem to do it.
 
1:33 PM
@CatPlusPlus what? seriously?!
 
Does anyone know why I can't offer a bounty on my own question that is already answered
 
Yes. Licensing shenanigans. That's why they pour moneyz on Clang.
 
@SethCarnegie What question?
 
Yep. You can use Clang 3.0 on Xcode 4.2, but that requires Lion. If you have Snow Leopard, like me, you're stuck on Xcode 4.0, which has GCC 4.2
 
1:35 PM
@SethCarnegie It's not old enough?
 
@Mysticial it doesn't say that message "this will be eligible for bounty in x time" anywhere
 
Maybe you can't put bounties on questions with accepted answers.
 
@CatPlusPlus I can do it on other people's quesitons
Maybe it is just not old enough
 
I thought once it's got an accepted answer, you can't put a bounty on it
 
Probably.
 
1:36 PM
0
Q: Practice final exam questions, "Data Structures" class

user1334943I am working on my practice final for a data structures class. 1) void BST::traverse(Vertex *V) // post order traversal recursively { if (V != NULL) { traverse(V->Left); traverse(V->Right); cout << V->elem << endl; } } ...

Cute.
 
22 hours is definitely not old enough. I think it's 2 days.
 
@Mysticial ok, I'll wait then
I was expecting a message
 
@SethCarnegie You can post a bug report on meta. Make sure to include screenshots with free-hand circles.
 
Damnit, @Seth, I was already writing an answer to this question, and now you post a superior one right before I'm about to hit send. I'll have to begrudgingly upvote yours.
 
@CatPlusPlus Mac users can use macports GCC 4.5/4.6/4.7 if they like. It's just Xcode that won't work with 'm.
 
1:44 PM
@EtiennedeMartel you probably should post yours, I didn't explain it well
 
@rubenvb I meant Apple.
 
I didn't think GCC (or any compiler) today was smart enough to hoist data-type casting through mathematical expressions... I'm actually impressed at GCC. :)
 
@rubenvb Which is pretty much a dealbreaker if you ask me.
 
IDEs are overrated. Everything should be buildable without one.
3
 
@rubenvb +1
 
1:48 PM
Use vim.
Answer to every problem.
 
@CatPlusPlus No, because then what are those 4 GB or RAM for?
 
@EtiennedeMartel Linker.
 
@CatPlusPlus lol'd
 
That's freakin' awesome. Somehow through a feat of programming, I managed to do something I initially thought was impossible
 
Whenever Xcode gets mad and eats half my memory and 150% of my CPU when idle (i.e. it's doing some background operation I don't know about), I like to think that my incredibly expensive Mac is paying for itself.
 
1:50 PM
There's a medical term for that. "Delusions".
Also so sleepy, and I still have stupid English class today.
 
@Neil pictures or it didn't happen
 
@rubenvb It's a bit difficult to explain actually
 
@rubenvb didn't happen
 
@SethCarnegie I could show you a graphical representation of dynamic loading of an xml file, but that isn't what's impressive
 
@Neil wow. patent it
 
1:55 PM
@Neil I thought dynamically was the only way you could load an XML file
 
You can do it so slowly it appears to be static.
 
@SethCarnegie It is. Unfortunately other than code, it's the only thing I can show for my work
A third party library is loading this xml from a jar, and I dynamically intervene, modify the xml, and hand it over to the third party library
 
@Neil via?
 
Otherwise these xmls would have been static in this jars
 
Oh. Java and XML. I should have known.
 
1:56 PM
Wouldn't it be easier to, say, modify the jar.
 
So you basically did detours for java
 
Lol detours for XML.
 
lol
I love it when companies offer APIs in XML
 
@CatPlusPlus I can't modify the jar while they're loaded in the virtual machine
 
as if it's a programming language
 
1:57 PM
At least not without restarting the web server
 
Then modify them and load them again.
Duh.
 
err the web application, same same
 
Also use Erlang and don't use XML, then you'll have no problem with hotswapping things.
 
@CatPlusPlus I wouldn't have a problem with that if the client didn't mind. Apparently clients don't really care what difficulties arise when it comes to these things
 
And client minds what?
Not paying for code that'll break after next vendor library update? :P
 
1:59 PM
Client wanted to change positioning of certain fields on a web page dynamically, and since they're located in the jar files, it meant dynamically loaded
 
@johnathon I got the effect that I wanted: pastebin.com/zuhLNTLA
 
If client dictates implementation details, your job sucks.
 
@CatPlusPlus existing system?
 
@SethCarnegie Your job sucks doubly.
 
@johnathon However, I think this means that the child window is being painted twice, one for the parent window and one for itself, so I need to still find a way to "never paint the child window"
 
2:00 PM
@CatPlusPlus Not the client, my boss, but yeah, same thing in the end
 
@CatPlusPlus not mine, his
 
@SethCarnegie I know.
 
@johnathon so that the only time it's painted is when the parent window asks for it to be painted in its backbuffer
 
can anyone make sense of: stackoverflow.com/q/10602173/168175 ?
 
@awoodland the question seems clear
 
2:08 PM
he's asking for something a bit more like pthreads in C++11?
 
He's asking why isn't there anything to spawn new processes in the standard library.
 
@awoodland seems so
 
I think he things std::thread is always 1:N
and that pthreads/OpenMP isn't
 
What is stupid Chrome leaking, that's the question.
 
@CatPlusPlus there is system
 
2:10 PM
system is useless.
 
@johnathon actually apparently it's not being painted twice (does windows validate the invalid region when you send a control a WM_PAINT?) here's a version that has a console and prints to the console whenever the child paints, and it only paints once per mouse move: pastebin.com/ZV2Jm9BZ (along with extra comments for you in case it's unclear)
@johnathon so now the only problem is that I have to manually iterate every child window of a window to do this which seems inefficient at best
 
@SethCarnegie you still going on about that? I've slept. I'll have dinner and perhaps look at it again? And yes I still think there's no way around iterating over controls, but that must be possible to automate and abstract...
 
@CheersandhthAlf that code that I just pasted has precisely the effect that I want (transparent no flicker) however it seems like Windows should handle this
@CheersandhthAlf and as it is now, I am doing 1 bitblt for the parent window and 2 for each child window
which is probably going to be slow for a lot of controls
 
Gahh, I hate when MEF refuses to work.
 
2:24 PM
@CheersandhthAlf I think you can somehow set the coordinate system and clipping rectangle of the backbuffer so you don't have to bitblt at all for the child windows but that is only the second problem, the first is iterating the children
 
@rubenvb isn't it?
 
0
Q: Any signal/slot implemention using C++11 ?

chmikeI'm looking for a signal/slot library implemented with C++11 (bind & function) as replacement of the boost signal slot library.

Has anybody ever bothered to write a multicast_function template for C++11?
(And just in case that isn’t clear, what I’m talking about is essentially a std::vector<Function<…>> but which has the same interface as std::function.)
 
@KonradRudolph so when you call it then it calls each function in the list or what
 
@SethCarnegie exactly
aka. multicast delegate in .NET
 
@KonradRudolph shouldn't be too hard to write should it?
 
2:32 PM
nope, not at all
 
w/ our new variadic templates and stuff
 
vector<function<…>> doesn't look as a memory-efficient solution
 
@Abyx Possibly. But suggest something better ;)
 
arena allocator
hm...
vector and function with arena allocator?
 
@Abyx I’m listening … what’s an arena allocator?
 
2:39 PM
(I'm writing an arena allocator right now, so everything looks as a good use-case for arena allocator to me)
well... however, if you need to implement operator-= for that delegate, arena allocator isn't good idea
@KonradRudolph it's a thing with alloc<T> and free_all methods
 
hmm
alright
no, it isn’t ;)
 
oh hai
 
and anyway, it wouldn’t be an alternative to std::vector, just its allocator, no?
or maybe not, it’s probably not interface compatible
 
yep
but vector is overkill here, list would be better
single-linked list
 
Are you cereal.
 
user1157393
2:44 PM
Ok, i know im going to get a bias answer here. But, i really want choose a general purpose language, mainly just for me. and im thinking C++. However a lot of people have said its dying out, waste of time etc and i should go with python. what are peoples thoughts?
 
@Abyx Nonsense, I bet you anything that vector is more efficient
 
@LucDanton wut?
 
(cache locality)
 
@KonradRudolph cache locality is not a problem, if list items were allocated one-past-other
 
@Abyx But they generally aren’t, and even if, you still carry the overhead of the link pointer which the vector doesn’t have
 
2:47 PM
@ChrisTill Don't choose a language -- you can learn them both. That said, the stuff about C++ dying out is rubbish
 
and iterating over it is potentially slower for the same reason
 
what you actually need - is to store Callables of different types, and then iterate an call'em
 
@Abyx That’s a std::vector<function<…>> right there …
 
user1157393
@Collin That's what i thought. Surely C++ is still the most powerful?
 
@ChrisTill I would like to warn you not to pick up a language based on trend. But it's true that there's such as a thing as being aware of how much the community around a language is alive in the sense that new tools, techniques and idioms are being created and circulated. Anyway in the case of C++ that community is alive -- so I'd suggest you decide on real merits of the languages/ecosystems.
 
2:48 PM
@KonradRudolph oh... what about dereferencing a function? what's with cache misses there?
 
@ChrisTill Depends on what you mean by 'powerful'
 
user1157393
Well at the moment im web developer. PHP / javascript etc. But i would love to just do something bigger.
 
@Abyx Either I don’t understand you or this would be the same for a singly-linked list
 
@ChrisTill It's faster than most languages, if that's what you mean. However that's becoming a less important attribute to a programming language with each passing day.
 
user1157393
@Collin well, i would like to think that if i wanted to create something like MS Office, or Pro Tools etc I could if i had the skill in that language
 
user1157393
2:49 PM
@Neil is it that much faster than say Java? Can you notice the difference?
 
@KonradRudolph you have functors at random locations of heap, and you have a vector with pointers to that functors
 
@ChrisTill Powerful in the sense of raw computation power – yes. In the sense of building powerful APIs – yes. Powerful in the sense of getting things done – no. Python wins hands down here.
@Abyx Same for the linked list, no?
 
user1157393
@KonradRudolph thats what i meant.
 
@ChrisTill Tests have shown that Java can be faster than C++, but you have to tweak it quite a bit. Lets say in general, it's not faster but not even slower really.
 
@KonradRudolph very close to it
 
user1157393
2:51 PM
@Neil ok cool.
 
@ChrisTill Again, there are things that are more important than speed, like the programmer which makes the program. :)
 
user1157393
To be honest, It's always been a goal of mine since about the age of 10 to be able to program in C++. So far I have managed hello world.
 
@KonradRudolph so what's with "cache locality"? why vector is better?
 
user1157393
@Neil of course :)
 
user1157393
but i guess my worry was that i would learn a language (C++) and then wouldnt be able to find work as nobody used it any more
 
2:52 PM
@Abyx Well, vectors still have better cache locality than linked lists, always, regardless of the element type
 
@ChrisTill I used to think knowing the language was critical, but as it turns out, knowing the concepts behind the language are far more important. Once you know that, learning any language is only a matter of learning the syntax of that language
 
@KonradRudolph in this particular case?
 
user1157393
So, Adobe Photoshop say, can that be achieved with C++ or is there several languages that make it up>
 
@Abyx Yes. Like I said, the element type doesn’t matter
 
user1157393
yeh, I started with php, then javascript and im findin that it is all the same, if's functions, loops etc just wrote differently
 
2:53 PM
@ChrisTill I'm sure they have some scripting in there somewhere, but I believe it's mostly C++
 
user1157393
@Collin cool. So when you say scripting what do you mean by that?
 
user1157393
sorry, totally new to dev that isnt web
 
@ChrisTill I imagine they have some simple interfaces to things, perhaps they write some bits in perl or python or something
tcl even
 
I like to think of programming as carpentry of sorts. It's nice to have a bulldoser, and it's indispensable in certain situations, though sometimes you need a shovel, not a bulldoser.
 
user1157393
@Collin oh right cool.
 
2:55 PM
Knowing different programming languages is like having a shovel, a bulldoser, or whatever else at your disposal.
 
user1157393
@Neil nice.
 
user1157393
ok so if i decide on C++, where do i begin?
 
user1157393
I use mac
 
At main()
 
@ChrisTill Hello World, like the rest of us.
 
user1157393
2:57 PM
I meant in terms of software i need / books?
 
user1157393
but then hello world lol
 
@ChrisTill X-Code is free, right? It has a C++ compiler
 
@ChrisTill I would recommend bloodshed.net/devcpp.html to start.
 
@ChrisTill This chat has an associated wiki and there's a page containing book recommendations, including recommendations for beginners (no idea if that means complete beginner or beginner with a background in another language tbh).
 
It's straightforward and does what it should. Visual Studio can come later.. that's a world of complication that you can avoid for now
 

« first day (577 days earlier)      last day (4372 days later) »