« first day (570 days earlier)      last day (4604 days later) » 

15:00
@RMartinhoFernandes Try Reverse-Polish
@RMartinhoFernandes Maybe that's why @Cat is insane.
@LucDanton My employer should consider suing over the use of our company name though :)
@LucDanton Holy shitnibbles.
0
Q: Trouble figuing out logic for bathroom syncronization

AaronFor homework I have been given the bathroom synchronization problem. A shared bathroom, a female cannot use while a male is in there and vice versa. What I am trying to figure out is how to stop and restart thread if the other sex is in the bathroom. So far I have several conditions that if no...

classic pooping philosophers problem
6
@LucDanton I'm speechless.
15:12
@RMartinhoFernandes better replace your vocal circuits
@sehe is that like reverse cowgirl?
reverse cowgirl notation
fuck me, it's meltingly hot
doing the fmul asm instruction four times per loop or doing the mulps SSE asm instruction once in a loop on four floats, doesn't seem to make much different in perf
those two lines out of context pwn
@TonyTheLion you're doing it wrong
@TonyTheLion does your data fit in cache? how many cycles are you using per loop?
@TonyTheLion are you bandwidth limited anyway?
@TonyTheLion Depends on the rest of your code. SSE won't do you much good if you're constantly loading/unloading it to/from register.
15:15
@stdOrgnlDave pretty sure it fits in cache, it's 4 float numbers
@TonyTheLion nothing else in the loop?
I was playing with this: ideone.com/2ptdc
and are you incrementing by 4 or skipping 3 out of 4 iterations with a conditional?
@TonyTheLion You're blowing all your bandwidth by constantly loading and storing
15:16
no he is not
his real problem is he's doing the same number of iterations
@stdOrgnlDave who are you talking to?
@TonyTheLion you. of course it will take the same time if you do 4x the work
@stdOrgnlDave oh lol
so the second loop should be /4
I had a bug in my timer I realized, lol
now the SSE one seems slower then the float
15:19
your algorithm doesn't even begin to approximate SSEing the work
probably too simple?
well, for one, you only ever do one iteration at once
mm, the first loop (with SSE) should be /4 since you'd like to compare doing that with SSE. however, as @DeadMG is being belligerent and hinting at and not saying, generally SSE is applied to an array of numbers, instead of the way you're doing it
that's like using a thread pool but holding a lock during all the work
This is for people too lame to download a video before they watch it: youtube.com/watch?v=wOua8txSPkk&feature=youtu.be
15:23
@stdOrgnlDave This has nothing to do with anything interesting.
@TonyTheLion your timing is wrong too I think as well as the /4 problem - you save to _end but use end
(and gcc -O3 removes all the real work on my system)
@awoodland yea I found that already
anyways, I'm reading up on SSE
Woo, just finished the CS AP test.
What's with all this interest in SSE lately?
I need help. Please look into this. stackoverflow.com/questions/10500574/…
15:40
@DeadMG unless you like action games or actually want to have fun playing ME3 instead of spending 5/6 of your time cowering behind barriers
@stdOrgnlDave You mean, if ME3 was even remotely interesting at all.
yes indeedly doo
which it isn't
just in case you missed that subtext
it's the best superhero game ever made (see: vanguard gameplay)
that's really not saying anything at all
15:42
I am so confused by the 11 flags in the કેઝ્યુઅલ ચેટ room, I'm assuming there's some subcontext I'm missing.
I could make the best game ever about cutting paper with scissors, but as there's no competition...
@MooingDuck What is that room?
@stdOrgnlDave Personally, ME2 > ME3.
@EtiennedeMartel I see that there are 19 flags on two messages, one in that room and one in "Android People", but they're just... gibberish...
in a whole conversation of gibberish, that google translate doesn't recognize
@EtiennedeMartel even after watching that video?
time to refactor
15:52
@stdOrgnlDave I didn't watch the video. However, I did not play Mass Effect for the gameplay, but for the story. And ME2 had a much stronger story.
@EtiennedeMartel ehh...I honestly found that femshep made the story of ME3 about 3x better. male shep's voiceactor, if you remember ME1, was GREAT at being a douche, but really terrible at being a real person like that had him try to be in ME3
and anyway, play it for the gameplay, watch the damn video
I hate refactoring
you endlessly re-arrange your existing code and don't get to do anything fun until it's done
I should, in future, properly design my fundamental systems before implementing them
@DeadMG Is this the SSE thingy you had yesterday?
@Mysticial Nah, that was tiny.
this is almost all of my existing simulation and UI code
I was thinking maybe it came from needing to modify the calling code to handle 4 at a time.
16:03
nah
that would only be the most hardcore sim code, and I dropped that transformation anyway
except in the octree
which is the code we worked on yesterday
this is more, fundamental restructuring
split a class up into interface and two implementations, changing ownership of things, etc
26
Q: What is the scope of a lambda variable in C#

mfcI'm confused about the scope of the lambda variable, take for instance the following var query = from customer in clist from order in olist .Where(o => o.CustomerID == customer.CustomerID && o.OrderDate == // line 1 olist.Where(o1 => o1.CustomerID == customer....

Seriously... there are way too many C# people on SO...
Rarely do C++ questions get that high in 8 hours without getting linked.
is it UB to cast a derived type to a base type and destruct it if it doesn't have a virtual destructor even if the derived type has no additional members and a default destructor? I can't recall.
@MooingDuck Always UB to destroy derived class through base class pointer if non-virtual.
16:08
@DeadMG bummer
@MooingDuck why? virtual dtor is the simples
@DeadMG utf8string inheriting from std::string. Moot point anyway, I forgot I had other members.
i'd say not UB (the actual behavior is quote obvious to me) but simply not a good idea (as you just showed)
@IgorSkochinsky do you know what UB means?
undefined behavior?
16:11
@IgorSkochinsky It is UB if the Standard says that it is UB. And it does.
@DeadMG I tried to find the exact wording, but I can't find it. Oh well, unimportant
@kizzx2 you should come here more often :) — sehe 42 secs ago
huh, comment one-box fail. Ha there were query params on the page url
I was trying to write a utf8 string class, but it really seems significantly easier to just work in UTF32 and simply provide conversions to and from utf8.
(due to members that require random access)
you don't really need random access to strings, in most cases
16:21
@sehe It did, but a colleague convinced me to change my architecture and use a separate Makefile per directory … unfortunately, I won’t have time until Sunday to try either suggestions since this is for a side-project in my free time …
ARGH
PPL headers y u include windows.h?
now my codebase is all polluted
@KonradRudolph Using a makefile per directory is sweet (I do that) but largely orthogonal. You'll simply find your self including 'global' makerules (include ../shared.mak) and the 'local' defs in the per-dir Makefile
@sehe Yes, that’s what I fear
anyway, I might need to use a makefile generator (autoconf …) anyway since I’m using third party libraries
at the moment I just hard-code the paths or use some informed guessing
@KonradRudolph Good luck with that. I always got scared of autotools.
I tried autoconf/autoheader on some (very) small projects and it seemed to magically work quite nicely, but I wouldn't know how well it would work for me in a larger project
@sehe my, they are scary
@TonyTheLion Standard integer overflow?
Yep, looks like overflow to me.
long is 4 byte long on GCC, I think.
@EtiennedeMartel On Linux it's 8 bytes. Windows is 4 bytes.
Anyway, fib(50) is 12 586 269 025. Way too large for a signed 32 bit integer.
16:40
how do i get a 8 bytes int or long?
You can't. Use long long.
Or, better yet, an appropriate typedef.
@TonyTheLion You can use __int64 on MSVC.
int n = // nth fibonacci number;
return (unsigned long long)(pow(1.6180339887498948,n) * 0.44721359549995794 + 0.5);
Though a lookup table is fastest.
@DeadMG and you were fulminating about including windows.h just minutes ago
16:42
@sehe __int64 has scope. The million billion macros defined by Windows.h do not.
@Mysticial is there a wiki reference on this formula?
@DeadMG i agree windows.h sucks very very very badly
@TonyTheLion Fibonacci entry? I have a hunch it'll be called closed form or something
@TonyTheLion It's just a simplification of the closed-form formula for fibonacci numbers.
In mathematics, the Fibonacci numbers or Fibonacci series or Fibonacci sequence are the numbers in the following integer sequence: :0,\;1,\;1,\;2,\;3,\;5,\;8,\;13,\;21,\;34,\;55,\;89,\;144,\; \ldots\; . By definition, the first two numbers in the Fibonacci sequence are 0 and 1, and each subsequent number is the sum of the previous two. In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation :F_n = F_{n-1} + F_{n-2},\!\, with seed values :F_0 = 0,\; F_1 = 1. The Fibonacci sequence is named after Leonardo of Pisa, who was known as Fibonacci. Fib...
It has two terms. One gets exponentially larger, the other exponentially smaller.
I just threw out the smaller term. And (correctly) rounded the larger term.
16:45
ohhh
@Mysticial One doesn't simply toss diminishing parts into Mordor
anyways, the problem from ProjectEuler I'm trying to solve doesn't seem as easy as it looks
@TonyTheLion linky?
find the first fibonnaci number with 1000 digits
@sehe But it works...
16:47
problem being that no basic type holds a number of 1000 digits
Yeah. True. That was a reverential comment.
We're all usually in awe of math so much that we don't dare be pragmatic about it.
"One doesn't simply walk into Mordor" conveys the sentiment
so I will need to use digit buckets or containers of some type
@TonyTheLion But you can take the 10log to see the magnitude. ln(x)/ln(10) gives the 10log (Briggs log)
do std::cout << " 1\n 1 1\n 1 2 1\n 1 3 3 1\n1 4 6 4 1\n"; while (false);FredOverflow 1 min ago
What do you guys think about my comment?
@FredOverflow epic! :)
16:48
@TonyTheLion Which is why Project Euler is much easier in a language which provides for you arbitrary-size arithmetic, for example.
Just link to the comment :)
do std::cout << " 1\n 1 1\n 1 2 1\n 1 3 3 1\n1 4 6 4 1\n"; while (false);FredOverflow 1 min ago
@DeadMG and what language is that?
Python
Python or Lua?
Python
16:48
@sehe Oh, I didn't know that was possible. Cool.
Python and I think some others like Java and possibly C# also provide this function
I really wonder what his teacher would say if he submitted that loop
@DeadMG C# should have been getting BigDecimal with .NET 4.0 but it failed to get into the release. There is a CTP of it somewhere
@DeadMG Java has had BigInteger/BigDecimal for ages
@stdOrgnlDave Depends on the course subject. If it is 'CS403.4 Test Driven Development' he will get the mark :)
heh, heh.
I need to go and buy food
16:52
@sehe but is it web scale?
but I'm feeling much too lazy
@DeadMG Well, as long as you don't starve... how hungry are you exactly?
not very
but then, if I don't go, when I do get hungry in a few hours, I'mma starve to death :P
@DeadMG I've never seen the "I'mma" syntax before. Like it!
16:57
Wolfram CDF Virtual Workshop in 3 minutes
@KianMayne Does it start in 3 minutes, or is it 3 minutes long?
@stdOrgnlDave :)
Starts now
@TonyTheLion If it is of any consolation, gcc will bail out at fib(1475), with fib(1474) being some 307 digits long: http://ideone.com/97x29
it will "bail out"?
what you mean is that particular machine will run out of stack space at that number
17:01
@stdOrgnlDave well, the double no longer represents the numbers well enough to get determinate results :)
@stdOrgnlDave Absolutely not. Next time, you may find it beneficial to click that link first
Considering that there is going to be 1 inlined function and an entry point (main) no excess stack space was hurt approximating these fibonacci numbers
@sehe I did, I just didn't scroll down far enough
You didn't need to scroll to see that the algorithm was closed form
nor did I pay attention enough to see that it wasn't a recursive implementation
That's more or less what I meant :) No probs :)
@sehe ok that concludes this problem then, I don't want to start messing around in Python
17:08
@TonyTheLion Python doesn't bite ;)
^ warning, pun
@sehe you realize that it would cost you very little speed to gain much more accuracy, right? simply do sums. up to 1k doesn't take long, and then you're just humming along getting each one
import math;

def fib(n):
    return math.trunc(math.pow(1.6180339887498948,n) * 0.44721359549995794 + 0.5)

for n in range(1000, 5000):
	print "%i: \t%i" % (n, math.log10(fib(n)))
throws in the towel at n == 1474, same spot
So you'd need numpy, which I have zarroo experience with
And you copied before my correction
Next time, not so fast.
1 min ago, by sehe
throws in the towel at n == 1474, same spot
17:14
oh I'm sorry
:)
Anyways, gotta run
I have Python 2.7
@FredOverflow Or, i'mma be late
@TonyTheLion I don't think versions matter. Libs do here
Won't somebody please think of the children!?
17:20
@TonyTheLion Woah now, lets not say that Schools and Prisons are the same. Prison you get free higher ed, three square meals...
@TonyTheLion hmm, could you cherry pick more?
@SamDeHaan and in prison the meals are healthier for you
@stdOrgnlDave I don't think he created this.
High school is dreadful. I don't know about college.
@stdOrgnlDave I didn't create it
@TonyTheLion to answer your question about "why are there negative numbers," it's because two's complement "wraps around" at 2^(bits-1), which in this case is 32. use stdint.h if you want to get a precise number size. a 64-bit unsigned integer will bring you further than the floating point methods of computation
Can't see the image. Dumb proxy.
Komodo Edit looks promising...kind of sad it's closed-source, though.
Use vim.
Vim intimidates me.
To be honest.
Sublime Text also looks nice, but it's paid-for.
I find Vim is less intimidating than Emacs.
Certainly.
17:43
I also thought vim is difficult, but after some time of usage (googling whenever stuck up), I think it is good.
To clarify, are you referring to the terminal or GUI version of Vim?
vim is amazing
gVim can be better for starters. As you can access menu sometimes
I have no idea how it can be as amazing as MSVC w/ intellisense, but it is
Terminal UIs are crappy.
17:45
vim doesn't have a UI
it's too oldschool for a UI
Yes, it does.
chuck norris wanted to edit code so he made vim, and no 'advances' in UI have been in any way an improvement
@stdOrgnlDave How can a user interface with software without a user interface?
@stdOrgnlDave But that's a user interface!
@EtiennedeMartel hardware flip switches for memory address/byte content...or, punch cards
17:47
(Putting my reply in ahead of time)
pizza time :)
@stdOrgnlDave Still UI.
OK, how about if I shoot gamma rays at my processor with such precision that it does what I want it to. is that a UI?
@stdOrgnlDave Yes.
anyway, "vim has no ui" was a joke, but nobody cares, we're in lounge<c++>, everything must be taken literally first, picked apart, and then perhaps the idea it is humor may enter our minds a few minutes after we have derided one another
17:49
Not all software have UIs. Background processes, for instance.
@stdOrgnlDave No, only bad jokes are picked apart.
@EtiennedeMartel sigterm counts as a UI
We are a bunch of stone hearted haters who kick kittens for fun.
it's like, an on/off button
an on/off button is a damn UI
my hosue lights have UIs
so do my shoes
the only thing in the universe that truly, truly has no UI is dwarf fortress
...except for the third-party UIs for it
I created a Quiz, on Performance of DS and algos's. http://codepad.org/t8aodrWi It is in text format.
Anyone interested in trying it?
I have a quiz
(a) why did you paste n<sup>2</sup> into non-HTML place. (b) do we have to give our answers here? (c) what is the point? are you trying to expose our ignorance?
17:54
Dynamic array is not a data structure. At least, not in any way different than ordinary array.
in addition, both heapsort and mergesort can be made in-place
Umm, I was going to upload the quiz, so just wanted to see if it is good enough
quick sort can be made in place too
@stdOrgnlDave: i knew it, but...
But worst-case Quicksort is O(n^2), IIRC.
17:56
@CatPlusPlus: yep
@CatPlusPlus:what should i call dynamic array?
in Q9 it's arguable whether or not a linked list or a tree is the answer, depending on implementation
I find all kinds of quizzes silly. Especially ones that you need to memorise stuff for.
yeah. with quantity, quality must suffer
Also, inserting in the beginning is incredibly fast on arrays if they fit in the cache.
@stdOrgnlDave: so what is your answer for q9?
17:58
@EtiennedeMartel erm...technically, in terms of complexity, insert to beginning of array is O(n) or O(n/2) if you're clever
@VinayakGarg trie duh
although I suppose that depends on what data you're storing
I kind of assume you're talking about a prefix trie
then where is the ambiguity?
hm. I suppose Q9 passes then.
@stdOrgnlDave Yeah, but your program does not run on paper. It runs on a processor. Inserting in a linked list on a typical implementation means a memory allocation and a potential cache miss.
I think it was Bjarne who compared performance for insertion and removal in the middle with vector and list during a GoingNative talk.
@EtiennedeMartel it's pretty hard to have a cache miss for inserting as the first element, but possible. anyhow, what platform are we talking about? mobile processors still have ridiculously small caches
if they have any at all
anybody submiting answer-sheet?
18:02
@stdOrgnlDave Snapdragons have have between 512 KB or 1 MB cache, IIRC. And those things are on smartphones.
but q3 needs to be fixed i guess
Total cache or cache-line size?
@CatPlusPlus Total.
I find it comforting that people here can assume we know what the correct answers are and we actually do
@VinayakGarg I think it's important for you to outline the objective of this quiz before I can say if it's any good or not
I am just adding this quiz to my own website. just a general, normal, casual quiz. With no intentions to trip someone
18:06
Stupid school computer won't let me mount .dmg files. Aaaaaaaaaaaaaaaaaaaaaaaaaaa-
and anyway, i don't want to know good or bad. correctness is important
hey, bubble sort has a best-case complexity of O(n), and it's in-place. let's all use that!
why is bubble sort called buble sort anyway?
@stdOrgnlDave Because high values originally at the bottom "bubble" to the top.
"The algorithm gets its name from the way smaller elements "bubble" to the top of the list." <-- I want to put a [citation needed] tag on that
@VinayakGarg I'd say that the question about graphs is a bit more advanced than the others. not sure who your audience is.
right, i think i messed the complexity
18:10
if I were doing this I would try to make something about tail-end recursion
It really seems illogical to make a cake-walk
i don't mind anyone googling, while taking the quiz
well it depends on your audience. are they supposed to go to wikipedia and look up the different algorithms and decide for themselves? or do it from memory?
ahhhh
if googling is permitted, then sure, looks OK to me
it is test-yourself-quiz
I am just happy if anyone, comes by, and gives it a go
18:15
I'm trying to figure out how I can bring a basic tutorial about shannon-fano compression that introduces concepts like recursion over a binary tree in C-like code, and use it to then show how it can be written well in C++11, then go on to optimize it to become Huffman...I think it's a good idea for a series of blog articles for beginner-ish types, but I think I may be overreaching
@VinayakGarg I didn't find it very compelling.
you could change the quiz do "Do you know the complexities of these algorithms? Yes -> have a cookie. No -> fail."
anyhow there's no good standard containers for a binary tree
I'd end up basically showing how to write wrapper classes for the code, wouldn't I? could anyone suggest actual improvements C++11 could bring to a shannon-fano encoder?
I mean, vector<bool> is basically a god-send there, but other than that...
aaand nobody has any ideas
@DeadMG oh, i should explain a bit more about this quiz: it is one out of dozens of quiz, all with different topics, and complexities. user can browse quiz list, and pick one of interst. and anyway it is open for anyone, so i am not gauranteeing any professionalism or anything
wait a second, can you pass lambdas into other lambdas, and...recurse lambdas?
@EtiennedeMartel @CatPlusPlus expertise needed
Oh wait, pass. Then as std::function.
18:22
so you can recurse lambdas? hmmm. that might be helpful.
too bad it isn't really technically an improvement over a recursed function
auto l1 = []{}; auto l2 = [](std::function<void()> l){ l(); }; l2(l1);
Or decltype(l1) l instead of std::function.
does l1 resolve to an std::function automatically? or does it...*gasp*...decay!?
Lambda has an unspecified class type.
Non-capturing lambdas decay to function pointers.
so it decays
like an array
they must be evil and wiped off the face of C++11 then
Not really, std::function just erases the type, like usual.
18:24
wait what?
I have used std::function without understanding it
I figured it was mostly a template that created a functor (class with overridden ())
I suppose I should go read about it
It creates a functor, but erases the type of the source in the process. That's why you can create it from lambdas, function pointers, member function pointers, bind objects, and whatever.
@CatPlusPlus does that mean it's a core language feature, or is it implemented via templates and such?
No, it's purely library feature. It was in Boost before being pulled into C++11.
gentleman please help me with this question stackoverflow.com/questions/10500574/…
It's magic.
18:28
@VinayakGarg you should bring that quiz to PHP room so you can see how people who don't know anything about programming respond to it
@stdOrgnlDave: PHP people don't know programming??
And what do you think, why i brought this quiz here? ;)
@sanket Stop spamming us. You already posted that earlier today and you were flagged for it.
I know PHP as well
Well, being strict, they don't, they do scripting... unless they actually do know any programming language?
It's difficult to learn programming when your language continuously works against you.
18:31
when have you ever had to worry about complexity theory in PHP? except if it's web scale or not, or howcomplex it is to try to port from one revision to the next
Yes, I forget nice coding practices when I start writing PHP code
@Mysticial there's ar eason for it, though. you can stop std::string's from allocating anything straight-off.
@JulianBayardoSpadafora You can't do "scripting" without a programming language.
@stdOrgnlDave Replied to wrong person?
oh wait, I didn't read the code
18:33
Any suggestions to dilute this quiz?
@VinayakGarg go see how the PHP peeps do on it, that'll give you a good idea
You have scared me, I don't want to.
I wish people would stop using quicksort, especially for strings
quicksort tends to be the algorithm everyone gets shoved in the face at school/college though
@VinayakGarg here's a question for you: which has worst case behavior, hash or quicksort or merge sort?
18:39
quicksort, but they ain't related
why aren't they related?
hash is not for sorting
or is it?
it can be the n in n log n
I mean, the first n
metaphorically
...sigh.
you can pardon me for the quiz. i have spent entire day reading "Introduction to Algorithms", so there was bound to be one
the point is in many hash implementations you can use it as an unordered list to pass into a sorting algorithm
18:44
i was thinking on the same line
hi there
anyhow, I'm going to go drive in crappy weather for 1.5 hours while overtired, see y'all later
Have been trying to successfully install mac os x on windows / Via virtual box
@sbi Apparently they also hate novelty (aka new).
i have done a lot of research but i not having success with it
18:47
Is it possible to avoid new if you need to work with a list of polymorphic base classes?
Im on an intel process.
sbi
sbi
@StackedCrooked Actually they hate deletionists a lot more than novelists.
sor
@sbi Esp when it comes to that book question :D
sbi
sbi
Ok, which of the #StackOverflow moderators deleted all the comments on the C++ Book Guide and List? http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list
18:49
anyone every tried or had anyluck with running mac os x lion/lepord/or 10.7 in win 7 via vmware or virtual boox
@sbi This is similar to censorship in countries like China.
hackintosh
Xeo
Xeo
@sbi That was a whole while ago, wasn't it?
i going to keep at ping me if you have any insight
sbi
sbi
@JamesMcNellis It happened many weeks, if not a few months, ago.
Xeo
Xeo
18:50
heh
@sbi You surely got your bases covered.
sbi
sbi
@StackedCrooked What you mean?
@sbi Xeo mentioned that was a while ago and you promply replied with that tweet. It is as if you were prepared for that remark.
@sbi It's probably only funny in my head.
sbi
sbi
@StackedCrooked As you can see, I sent the tweet a while ago. Once I had dug out @Jame's tweet, the other one was right there.
In other news, apparently the VS team has finally learned to listen to their users when it comes to the more important decisions regarding their product:
THE VS 11 RC HAS BROUGHT BACK SOME COLOR AND NO LONGER RESEMBLES SEATTLE SKYLINE http://blogs.msdn.com/b/visualstudio/archive/2012/05/08/visual-studio-11-user-interface-updates-coming-in-rc.aspx
@stdOrgnlDave quicksort is simple, fast (in most cases), and works on everything. Sure there's faster sorts, but they are either complex or have to be customized, which people don't want to bother with.
@stdOrgnlDave also, why not quicksort on strings? It's relatively performant on average
@sbi Woa, this looks much nicer.

« first day (570 days earlier)      last day (4604 days later) »