« first day (631 days earlier)      last day (4317 days later) » 

12:00 AM
Encoding is only for storage.
 
Ell
can you give me an example of something with one code point and one code unit, something with two code units and one code point and something with two code points, each with one code unit?
if its too much effort don't worry
 
@Ell 1:1 codepoint:codeunit is easy- any ASCII content.
 
Ell
I appreciate being taught this guys, I have never been able to grasp this
righ kk, got that one
 
@DeadMG UTF-32, too.
Any fixed-size encoding, really.
 
folks
any of you do HDR pics?
 
12:03 AM
@JohannesSchaublitb High Dynamic Range?
 
@Insilico yes
in any case, i'm gone.
 
@JohannesSchaublitb Wait. You ask something and then run, 30 seconds later? Oh misread. That's more like 4 minutes
 
sigh you know your bored when you make a 5 character md5 brute forcer >.>
 
It's called a rainbow table
 
Ell
5 character? is that apl?
 
12:16 AM
It's written in "MD5 brute-forcer" language.
 
Zing
 
So it's just "md5\r\n"
 
It took me a while to see ell considered that quite a code golf
 
12:34 AM
Hi guys, there's nobody in Lounge<C> right now, so hope you don't mind me asking here…
Is there any way to make this work:
typedef void A();
typedef struct {
A *a;
...
} Foo;
void A(Foo *foo) { //Error: Redefinition of 'A' as different kind of symbol
foo->a();
}
…without stripping the typedef and replacing "A *a;" with "void (*a)();"?
I'd rather not have to update two identical function declarations whenever I refactor any of them, as there are much more functions involved than just A/a.
 
...why would you post that in Lounge<C>.
Oh, wait, I'm too sleepy.
I thought you had exceptions there or something.
...why would you post that in Lounge<C++>.
 
The PHP room might be more appropriate.
 
@Mysticial: good one :P
 
@Regexident If you can reformat it properly I might be able to take a look at it.
 
typedef void A();
typedef struct {
    A *a;
    ...
} Foo;
void A(Foo *foo) { //Error: Redefinition of 'A' as different kind of symbol
    foo->a();
}
 
12:46 AM
ah, much better!
 
I had it formatted initially. Chat doesn't allow fixed & non-fixed texts to be mixed in one message though, which messed it up.
 
Um, why do you need that first typedef?
Cause, clearly there's a naming conflict between the function pointer A and the function A.
 
Otherwise I couldn't get the function pointer into the struct without a redundant declaration. The function is not the only one in my struct and they are by no means as simple as "void x(void)", making it a mess to keep up to date once something is changed. I'd rather not have to maintain any unnecessary function declarations.
 
I'd say just name mangle it. That's kinda what I do in these situations.
 
"A" and "foo->a" are of the same type. "A" is simply the public interface for my private implementation of "a" (some pseudo-virtual function).
 
12:51 AM
does anyone know a way to limit cpu usage of a python program by chance?
 
@ITNinja If you unplug the power cord and pull out the battery (if it has one) then it will cap it at 0%.
 
@Mysticial: mind to post a snippet of what you mean exactly? Just the changes would do fine.
 
@Mysticial HA!
 
typedef void A_fp();
typedef struct {
    A_fp *a;
    ...
} Foo;
void A(Foo *foo) { //Error: Redefinition of 'A' as different kind of symbol
    foo->a();
}
Or am I completely missing something important?
 
Well, then I'd still have to have a "void A(Foo *foo);" in my header (as A's implementation obviously(?!) is in a ".c") to make it callable from outside, which (the redundancy) is exactly what I'm trying to avoid.
 
12:56 AM
So you're trying to avoid a separate header and definition?
 
My goal is: one declaration, one (non-redundant!) pointer for my function table and last but not least the implementation.
 
Now I'm starting to get confused...
Maybe you could just declare the function static and put it in the header file.
Or even inline static for that matter... lol
 
@Regexident You can define member functions (without pointers) by function reference type. Also, you can have (implicit) conversions to function popinter types, to make your class callable. Just to (nasty) tweaks that might help you on to more unreadable code :)
 
Fixed the flickering problem in DirectX
 
@sehe I'm assuming it's supposed to be in C.
 
1:01 AM
I apparently had to use an NVidia card rather than an Intel chip.
 
@IDWMaster What, they accept contributions now?
@Mysticial Ah
 
@sehe No, they don't, but I guess it's a workaround.
 
@IDWMaster Gah. Fixed nothing then :)
 
@Mystical: A more realistic snippet would be this:
typedef void A(Foo *foo, ..., BOOL lots, unsigned int of, int other, float parameters, char which_are_a_pain_to_keep_up_to_date_redundantly);
typedef void B(Foo *foo, ..., BOOL _another_function_with_lots, unsigned int of, int other, float parameters, char which_are_a_pain_to_keep_up_to_date_redundantly);
typedef struct {
    A *a;
    B *b;
    ...
} Foo;
void A(Foo *foo, ..., BOOL lots, unsigned int of, int other, float parameters, char which_are_a_pain_to_keep_up_to_date_redundantly) { //Error: Redefinition of 'A' as different kind of symbol
 
Yeah, typedef struct is one of the ugliest part of C. They should allow C++ style declarations.
 
1:04 AM
@Mysticial Some non-standard compilers do.
 
@sehe: Thanks will totally have a look into these!
 
By the way; what's with the teen-drama tag on the room?
 
@Regexident OOOOOOOH I see what you're trying to do in the room. I hate to say this, but try a macro.
 
@Regexident Keep your C code in the C lounge.
 
@IDWMaster Oh, apparently we were talking about gay-porn yesterday... :P
yesterday, by Cicada
Afk watching gay porn.
 
1:07 AM
@Mysticial More to the point, we were talking about teen drama
@Mysticial I hope your irony detectors will be back in operation soon
 
@sehe Ah, ok. I missed a good chunk of it.
 
High time for bed here. 3am
Night all
 
night
 
@IDWMaster: Would have done that, but I've been talking to myself for half an hour in front of my desk anyway. Lounge<C>'s loneliness wouldn't have contributed much to it. ;) (also was hoping for a simple quick fix, didn't want to abuse Lounge<C++>, sorry.)
 
@Regexident It's OK. The C++ lounge isn't a place where anything said is serious anyways.
 
1:10 AM
@IDWMaster Though you should also be aware that not everybody is able to see through all the sarcasm. I'm particularly weak in this area.
@Regexident But in any case, I would actually recommend a macro for all the parameters in this case. As ugly as it is, it'll probably work.
 
@IDWMaster Because we had two already, who got suicidal over relationship DRAMA.
 
@Regexident Don't take life too seriously -- remember, nobody gets out of it alive anyway.
 
The latter descended into full-on drama about everything, and good Internet advice like "fuck your ex's mother".
 
@JerryCoffin: Never. ;)
 
Read the transcript from yesterday and 2 days ago, basically.
 
1:13 AM
@CatPlusPlus Never. ;)
 
@sehe: xD
 
@CatPlusPlus Read all the transcripts. Historians gather 'round!
 
I would read the transcripts, if i wasnt absolutely terrified to see what has been said here >.>
xD
 
Anyways; somehow I doubt DirectX will ever be fixed.
They haven't even updated it since June 2010.
You'd think that with all of the new graphics cards coming out all of the time they'd release some updates for it.
 
Round 1: http://chat.stackoverflow.com/transcript/message/4404509#4404509
Round 2: http://chat.stackoverflow.com/transcript/message/4420998#4420998
Nothing's happening on the Internet, I'm going to sleep.
 
1:23 AM
There is always something going on on the internet. Whether it is interesting or not is arguable.
i cant believe they took "hackers" off of netflix... that movie is beast >.>
 
1:41 AM
@IDWMaster DirectX 9 remained current for something like 5 or 6 years. On the other hand, most of the biggest problems predate the name "DirectX" being used at all.
 
1:54 AM
10
Q: What additional rotation is required for deletion from a Top-Down 2-3-4 Left-leaning Red Black tree?

kortschakI have been implementing an LLRB package that should be able to operate in either of the two modes, Bottom-Up 2-3 or Top-Down 2-3-4 described by Sedgewick (code). Sedgewick provides a very clear description of tree operations for the 2-3 mode, although he spends a lot of time talking about the 2...

wow... tl;dr - automatic +1
 
@Mysticial: macros it is. shudder Anyway, enough of this, calling it a night.
 
night
 
2:20 AM
sigh im bored outa my mind x.x just watching the attempts fly by on this little cracking program :P
 
 
1 hour later…
3:44 AM
I'm confused. I'm trying to index three values in one key. Can't decide whether I should use three different std::maps or just std::map<char key, boost::tuples::tuple<value1, value2, value3>>
 
3:55 AM
@Mysticial: I would like to hear about how to calculate those pi digits sometime, but it's too late at night for my brain to process that kind of math.
 
lol
 
so another day
 
Of course, it'll depends on which part you wanna hear. The BBP stuff isn't that bad.
It's also a weekend. Everybody's brains are dead.
 
 
3 hours later…
6:29 AM
Hey wake up you boring sleepyheads.
It's Sunday.
 
Who said I was asleep?
:P
 
Who said you were a boring sleepyhead?
Bacon is like sex; fucking good.
 
 
1 hour later…
7:52 AM
@BenVoigt You might want to start with Carey Bloodworth's paper on it. I'm not sure Albert uses one of the algorithms he discusses, but it's likely to make the subject a bit more approachable.
 
@JerryCoffin That's longer than it needs to be. It's probably just faster to ask me for pointers.
 
8:03 AM
@Mysticial Oh yeah -- it spends a lot of time on methods nobody would even consider any more, but I found/find it pretty entertaining anyway.
 
8:20 AM
Morning
 
8:40 AM
@DeadMG Morning nub
 
mawnin
 
 
1 hour later…
9:47 AM
@ScottW WTF, bacon > sex? Your sex life must be a disaster.
@IntermediateHacker C++11 has std::tuple now, no need for boost::tuple anymore.
 
is it true that it's OK to hash code lines in a shell with md5 and when a code line is the same by the md5 hash, use the cached bytecode and execute it?
they say that a md5 collision is very seldom so that approach is OK
 
@Mysticial My experience is that many C people don't use typedef struct but "normal" struct instead, and then later use struct foo for type names instead of just foo.
 
also, a single line of code is of quite fixed length, not arbitrary
 
@JohannesSchaublitb Does MD5 have one width, or are there different variations like in SHA?
 
@FredOverflow Even more. MD-5 is unbounded, and SHA is not.
however, of course, the length of a single line of code is typically rather short, and the probability of collision when hashing each is quite minimal
 
9:52 AM
Anyway, why not simply check for content equality if the hashes are equal? Too inefficient? :)
 
as long as your security doesn't depend on the mechanism not being broken
 
Using hashes for hash maps rarely has something to do with security.
 
@FredOverflow it has one width
oh i thought it has. silly
 
128 bit according to Wikipedia
 
@FredOverflow I would not do the MD5 thing at all anyway
 
9:55 AM
I would probably just use a std::set or std::map or whatever and not even worry about hashes.
Because if the users inputs something, computing the hash for that new input is probably a lot more expensive than just going through the tree with string comparisons. Depending on the size of the container, of course. But that's my first gut feel.
And performance probably doesn't matter at all, anyway, because 99.9% of the time, the program is waiting for the user input.
 
eh
I think that the comparisons will be more expensive than hash
the fastest structure would be a trie
but as you accurately point out, performance is not the most important
 
@DeadMG Note that string comparisons are very fast for random strings, because they probably differ in the first few characters.
Hashing a string, on the other hand, especially with security hash algorithms, needs to process the entire string.
 
indeed
but that is only one hash compared to log(n) comparisons
not to mention that hash tables have a more cache friendly structure
 
Also note that hashes are not cached in C++ like they are in Java! But that's probably unimportant to the above usage scenario.
And how many lines will the user enter? Even if he enters 1000 lines, that's only 10 comparisons.
 
true
but it only takes a few similar characters to make 10 comparisons bigger than processing 80 characters
plus, the whole "cache" thing
 
10:08 AM
'true' lines. That could be 1, -1, or 42*42 lines, really
 
@FredOverflow he enters like 2 lines
 
I agree, C++ does have several memory related problems when it comes to trees. Creating all those nodes is also not very efficient, unless you overload operator new and give it a pool or something.
 
@JohannesSchaublitb Then why are you even doing it?
 
@JohannesSchaublitb Then using a vector is probably the most efficient solution :)
 
@DeadMG im not doing it. the other guy is doing it
 
10:09 AM
Then why is the other guy even doing it?
 
he's of the opinion "template macros are bad"
 
@FredOverflow I wouldn't say that C++, specifically, has memory related problems when it comes to trees. It's a fundamental property of how trees are arranged.
 
Pro tip: if you want to know whether two strings are equal in C++, use a == b.
 
in a map, you touch log(n) nodes and follow a pointer to their key contents for each one
in a hash map, you only touch the source string (once), then hit one contiguous structure, then hit one node
actually, I think it's more than one (but still bounded) depending on how you handle collisions...
 
10:10 AM
@DeadMG I meant if it comes to allocating lots of small node objects, languages that use a compacting garbage collector will outperform C++ easily, unless the C++ code is heavily tuned and optimized. But the simple XYZ code will always be faster then the simple C++ code.
 
maps can be implemented with skiplists
 
@DeadMG Hash maps are not contiguous; at least in C++, they are arrays of singly linked lists. In fact, std::slist was introduced into the standard to support the std::unordered_... types.
 
@FredOverflow Right. The array is contiguous. That's what I meant.
you index once into the array, and then you hit that node of the linked list.
 
You mean "nodes" as in plural, right?
 
can you not apply the small list optimization
so you can put the item directly into the bucket array if the size(bucket) == 1 and sizeof(item) <= sizeof(bucket)
 
10:13 AM
well, I have to admit, I only have le basic knowledge of hash tables, but I'm pretty sure that it's only as many nodes as in that bucket
@FredOverflow Then how do they support bidirectional iteration?
 
In theory, you can build a perfect hash function and only have 0 or 1 objects in each hash bucket; in practice, probability will pwn you, and you will have some buckets with a lot more objects in it.
@DeadMG I don't think std::unordered_... supports bidirectional iteration, let me check.
@DeadMG I cannot find a reference in the standard, but here is a quick check:
std::unordered_set<int> primes { 2, 3, 5, 7, 11, 13, 17, 19 };
auto it = primes.end();
--it;   // As I thought, this doesn't compile
 
hm
how curious
twould seem to me that it would work fine if you just used a doubly-linked list instead of a singly-linked one
 
But that would be less efficient if all you need is forward iteration. And since unordered containers don't have a logical notion of order, anyway, why would you ever want to iterate backwards?
 
that's actually a good point
I was fairly sure there were some meaningful algorithms which required backwards iteration, but they all only have meaning on data with some kind of order, even if that order is only insertion time or smth like that
 
10:29 AM
> Rehashing invalidates iterators, changes ordering between elements, and changes which buckets elements appear in, but does not invalidate pointers or references to elements.
Ah, that's probably why they are using linked lists (instead of vectors or whatever) for the buckets.
 
yeah
that part was obvious to me :P
not sure why they allow it to invalidate iterators, though
 
Well, rehashing potentially changes the order, so what good would an "old" iterator do after rehashing, anyway? You will miss some elements if you keep iterating on, and you will get some "duplicates" that you already visited before the rehashing.
 
right
but it doesn't have to change the order in the list
all you've changed is the order and position in the vector
 
No, the buckets will also change, because some elements will disappear from the buckets, and some will enter. Remember that not all elements in a bucket have the same hash code; there are far more hash codes than there are buckets.
 
yes... but the buckets do not exist in the list.
the list has no idea about buckets and does not care about them
when you change the buckets, the list does not change
 
10:33 AM
What? The linked list is the bucket.
A hash map is an array of linked lists of pairs.
 
you could just use a single linked list and have an array of (vector/deque) of iterator into that list.
 
What benefit would that give you?
 
well, for one, you can guarantee no iterator invalidation even in the case of rehash
 
hm serious discussion
 
and for two
the iterator implementation is super-simple- you just forward to that single list's iterators
 
10:37 AM
6 mins ago, by FredOverflow
Well, rehashing potentially changes the order, so what good would an "old" iterator do after rehashing, anyway? You will miss some elements if you keep iterating on, and you will get some "duplicates" that you already visited before the rehashing.
 
nope
 
@DeadMG Okay, that's tempting, especially since implementing iterators in C++ is a pain (compared to, say, C# with its yield keyword).
 
because the order of elements in the single list never changes
regardless of what bucket they're in
 
What if the list says "A B C", but A and C end up in the same bucket after rehashing, but B is in a different bucket?
 
who cares? the order is undefined
 
10:40 AM
If I ask the set "is C in the list", then only one bucket should be searched. How will that work if the elements of one bucket are not contiguous in the list?
 
because the bucket has a bunch of iterators telling you which items are in it
 
Aha, I thought one bucket would simply be two iterators (begin and end).
What data structure do you use to store all the iterators for one bucket?
 
depends on what collision strategy you use
but something like std::array<iterator, N> or std::vector<iterator> would be fine
 
I don't know, but a list of elements plus an array of vectors of iterators sounds a lot more memory-expensive to me than an array of lists of elements.
 
well, for one, consider the allocators.
if you have a stateful allocator, that's 1 allocator copy per bucket.
I have like, 2 instances of the allocator and that's it.
 
10:43 AM
Didn't Scott Meyers say (in Effective STL, I think) that stateful allocators don't work?
 
no idea, I like them
they were believed not to work previously, which is why they were never in C++03
but the reason they're in C++11 is because they work just fine
the Standard committee would not have added them if it was believed that it was a problem
 
In C++ computer programming, allocators are an important component of the C++ Standard Library. The standard library provides several data structures, such as list and set, commonly referred to as containers. A common trait among these containers is their ability to change size during the execution of the program. To achieve this, some form of dynamic memory allocation is usually required. Allocators handle all the requests for allocation and deallocation of memory for a given container. The C++ Standard Library provides general-purpose allocators that are used by default, however, custom...
> In short, this paragraph (...) is the Standard's "I have a dream" speech for allocators. Until that dream becomes common reality, programmers concerned about portability will limit themselves to custom allocators with no state
 
I'm pretty sure that virtually all recent compilers support them
even VS does
 
@DeadMG Ah, okay. I'm not an expert on allocators.
> Meyers observes that the requirement for all instances of an allocator to be equivalent in effect forces portable allocators to not have state. Although the C++ Standard does encourage library implementors to support stateful allocators, Meyers calls the relevant paragraph "a lovely sentiment" that "offers you next to nothing", characterizing the restriction as "draconian".
sounds pretty serious
 
that's C++03
(and 98)
C++11 enforces stateful allocators
 
10:48 AM
Anyway, how about you implement hash maps both ways and tell us your results? :)
 
@FredOverflow
how is the lambda
 
Why two messages?
And wtf is "how is the lambda" supposed to mean?
 
@FredOverflow i hope you dont mind the question
 
I don't know; I have no idea what the question means.
 
oh i'm sorry :(
 
10:51 AM
he doesn't know what the question means.. jesus christ.
I'm speechless.
 
Ell
hi guys, quick question thats not exactly related to programming so feel free to tell me to stfu. I am trying to install linux mint 13 alongside windows 7, I have two options of where to install the bootloader, /dev/sdb (the ssd on which windows is installed) or this other partition thing which appears called "Windows 7 (loader)" on /dev/sdb1

any ideas?
 
@JohannesSchaublitb How is the epsilon?
 
I doubt that Jesus Christ would know what a lambda is. :P
 
@FredOverflow it's called the empty rule. you use it when there's nothing to match.
hope it helps friend
 
oh
 
10:52 AM
0
Q: Which partition to install boot loader on?

user12411I am about to install Ubuntu 10.10 on my Windows 7 system I will be dual booting with Windows 7 and want to use Windows 7 as my default OS for now. Where should I put the boot loader/grub, on the Windows partition or the root partition of Ubuntu? I have read elsewhere that Windows 7 tends to cor...

 
@TonyTheLion he only knows about alphas and omegas
 
@JohannesSchaublitb I didn't ask what it is, I asked how it is, just like you asked about the lambda.
 
@TonyTheLion he used them all the time.. if it weren't for lambdas he'd have to call up on his father every time he wanted to make an inline miracle, and that would be tedious. Jesus knew about lambdas
 
who's talking about me
 
10:53 AM
@refp lol
 
@refp Please give an example of an inline miracle.
 
@CheersandhthAlf we're talking about Jesus, last time I checked that wasn't your name
 
@TonyTheLion Maybe he walked over water in the meantime and now he thinks he's the messiah.
 
here's a miracle <---- it's inline, cause it's all on the same line
 
I don't see any lambdas.
 
10:55 AM
@FredOverflow oh ghosh
 
@FredOverflow []{*reinterpret_cast<int*> (0) = 0xBEEF;} () // this is what jesus did all the time.. his compiler was a little bit more fun when creating UB than ours..
 
@refp Wouldn't a static_cast be just fine?
 
@FredOverflow bible says jesus did johannes
 
@FredOverflow it would be "just fine", but I'd prefer reinterpret_cast when working with pointers-to/from-integral
 
10:57 AM
@refp But 0 can be converted to a pointer just fine as a special case.
int * p = 0;
 
details
 
0 is of type int
some say "0 is typeless"
 
@JohannesSchaublitb He had sex with you?
 
@FredOverflow I did not want to create a temporary, and writing *(int*)0 isn't very jesus like, he wouldn't have done that
 
10:58 AM
@refp int * p = 0; does not create a temporary.
 
a temporary has an address. 0 does not have an address
 
How about []{*nullptr = 0xbeef;}(), or does nullptr not support dereferencing? :)
 
@JohannesSchaublitb wasn't Johannes the traitor in that story?
 
@FredOverflow I knew you were gonna say something about that, but I don't care.. but alright rephrase; I did not want to declare a variable to hold a value in that lambda
@FredOverflow no, you cannot deref a nullptr
 
@refp I'm sorry, but I'm allergic to things erroneously being called temporaries.
 
10:59 AM
lol
 
@refp That's actually sane.
 

« first day (631 days earlier)      last day (4317 days later) »