« first day (199 days earlier)      last day (4732 days later) » 
00:00 - 18:0018:00 - 00:00

12:04 AM
software nuts never need an excuse to use clevarâ„¢ code
 
@DeadMG I wasn't talking about the CPU. When's the last time you wrote output to a Braille "display", or reacted to input from wheel speed transducers?
 
never
but then, what's clever about the software on those devices?
if (GoingTooFast()) SlowDown();
 
i always thought clever code was the worst kind
 
depends on if the problem at hand is complex
 
agreed
 
12:12 AM
but you don't need to be a software nut to write non-complex code, so it's not a great application of a great mind
 
@DeadMG Hmm...no, but you sometimes need to be a software nut (or a good programmer, anyway) to come up with simple solutions to relatively complex problems.
 
yeah
that's not actually really what I meant, although it's what I said
when I said non-complex, I meant, solving a non-complex problem
as opposed to, the complexity of the actual source itself
 
i like the idea of a frontal lobotomy better
 
 
5 hours later…
5:25 AM
@FredNurk the typo is obvious, including to me. that doesn't make the question define what A is, though.
it could well have meant literally. If A is a list node, saying ListNode n = new ListNode(); looks entirely reasonable (creating a node with a next pointer of new ListNode).
@JerryCoffin since I don't think I have to admit anything, I don't understand what you are implying. Are you saying that I have a hard time admitting something in this case?
 
@JohannesSchaublitb No -- I'm saying that (at least IMO) he was wrong, and started to come up with far-fetched arguments about what could be done with macros instead of just admitting he was wrong.
But at the same time, that even if you have no problem admitting you're wrong when you are, those of us who are merely human sometimes have more difficulty with it, so you should work at forgiving us.
 
6:11 AM
lol
 
6:27 AM
Morning.
 
6:52 AM
Hi, has anyboby here worked with openXML SDK using c++ ?
 
Als
Hey Pedants ;)
 
7:07 AM
@DeadMG Lounge<C++> is the name, and i like it :)
 
you know it's been several hours since I was active in this chat channel
 
Me too, I went to bed.
 
Als
@ÓlafurWaage: We ocassionally dabble with names for the room, depending on trend of discussions
 
7:42 AM
You know, Lounge<C++> was my suggestion
or perhaps I had C++<Lounge> or somesuch similar
 
@DeadMG no cause it makes no sense to have a C++ instance take a lounge argument.... lol
 
hence why it was exchanged
 
@DeadMG how is the stomach today?
 
fine
 
7:45 AM
it's my work that's kept me up this not particularly fine night
 
cpx
@TonyTheTiger lol
 
I need to be working but the damn university server is down
 
@DeadMG oh wow, so you haven't slept at all?
 
nop
 
@DeadMG I don't think I could then do another day without falling asleep
 
7:46 AM
I usually sleep early on such days
 
I'm guessing you're prob gonna have a nap later on?
 
but I knew in addition I had to be up relatively early for me this day
 
yea
@DeadMG ugh, getting up has to be the worst part of the day for me
 
oh yeah
 
Morning @sbi
@DeadMG and then it just gets worse from that point on :P
 
7:48 AM
well the thing is normally I am extremely late sleeping
11am or later
plus a waking-up period of an hour or more
 
@DeadMG I go to bed between midnight and 1am on an average day
@DeadMG I need the whole morning to wake up, lol
I wouldn't take it as far to say that I'm grumpy in the morning, but it gets close sometimes :p
@DeadMG have you heard of read-copy-update mechanism for mutual exclusion?
 
you're talking about synchronization?
 
@DeadMG yes
I'm trying to understand it, not finding it that easy
 
so it's a slim reader/writer lock
 
@DeadMG hmmm
 
7:56 AM
you don't have to tag me every single time, you know
it's not like we're having multiple concurrent conversations here
 
Good afternoon, folks
 
@GrigoryJavadyan It's morning here!
 
well, its afternoon in my time zone :))
 
8:35 AM
sleep: I should probably get some
 
yes
If anyone can advise, I'd appreciate it:
0
Q: memcopy that doesn't really make sense to me...

Tony The TigerI have some socket connection code that makes use of boost::asio which reads from a socket the first 5 chars, from which it can determine if the sent string was compressed using zlib library. The project I'm currently doing is a rewrite of something existing, so I took some of the existing code ...

 
you should always std::copy, not memcpy
 
And what is tempbuff?
        if (tempbuff[0] == 'Z') // I don't see a declaration for tempbuff
            b_zlib = true;
 
@DeadMG I've read this before, but what is the reason for this?
 
@GrigoryJavadyan I edited the question
 
8:44 AM
@StackedCrooked probably because memcpy copies raw bytes, it will not do deep copying (won't call copy ctors)
but in this example memcpy is perfectly fine, since we're dealing with POD
 
@GrigoryJavadyan deep copy seems rather irrelevant in this case
 
yes, I agree
 
@GrigoryJavadyan Of course, objects should never be copied using memcpy. However, I'm interested the copying of memory.
 
@TonyTheTiger I still can't completely understand what your code does... It is not clear who changes tempbuff. Apparently, someone writes the required buffer size there and then the buff is resized to that.
 
@GrigoryJavadyan tempbuff is written to by the socket
and it contains the size of the string that follows which is handled by handle_read_s
 
8:57 AM
@TonyTheTiger Ok, then why does this check: if (tempbuff[0] == 'Z') b_zlib = true; use tempbuff and not buff?
 
@StackedCrooked: Because std::copy falls back to memcpy when appropriate
for example, std::copy takes properly typed iterators, is more generic, and has no performance overhead over memcpy if memcpy is appropriate
 
@DeadMG is it in the standard or does it depend on the STL implementation?
 
It is not prescribed but it is one obvious optimization.
 
it's not mandated, but almost all known STL implementations do it
 
@GrigoryJavadyan cause those first few bytes are read into tempbuff and not buff
James Kanze seems to indicate that copy isn't going to be working on different architectures, is that right?
not sure what to use now....
 
cpx
9:18 AM
I know for arrays, if a pointer points one past the end of last element, it is considered legal.
E.g.
int a[4] = {};
int *p_begin = a;
int *p_end = &a[4];

But is it valid for any type?
 
@TonyTheTiger it might not work, it's an endianness issue... Just convert it from network to host byte order with ntohl
 
@cpx iterators point to one beyond the last element for any type you place in the container....
 
cpx
E.g.
int i = 10;`
int *p = &i;
++p; // is p still legal?
 
@cpx it works on my machine, but dereferencing p after that inc will lead to undefined behaviour
not sure as to whether this is legal as per the standard
 
cpx
C++ standard talks about array objects but not about the objects itself.
 
9:32 AM
@cpx you'd only use this kind of thing with arrays, not in the above way you suggested with a single element
 
cpx
C++ Standard section 5.7:5 says:
When an expression that has integral type is added to or subtracted from a pointer,
the result has the type of the pointer operand. If the pointer operand points to an
element of an array object, and the array is large enough, the result points to an
element offset from the original element such that the difference of the subscripts
of the resulting and original array elements equals the integral expression. In other
words, if the expression P points to the i-th element of an array object, the
expressions (P)+N (equivalently, N+(P)) and (P)-N (where N has the value n) point to,
 
Als
@TonyTheTiger: Pointers is the order opf the day is it? :)
 
@cpx Incrementing is legal. But from that point on it points to a location that you can't dereference. What exactly are you trying to achieve, if I may ask?
 
@Als just @cpx's order of the day :p
 
cpx
@StackedCrooked Just out of curiosity as my good book says: A pointer is valid if it points to the address one past the end of another object :S
 
Als
9:38 AM
@TonyTheTiger: Made some good reps with pointers :)
 
@Als heheh :)
 
cpx
Similar question:
14
Q: Take the address of a one-past-the-end array element via subscript: legal by the C++ Standard or not?

Zan LynxI have seen it asserted several times now that the following code is not allowed by the C++ Standard: int array[5]; int *array_begin = &array[0]; int *array_end = &array[5]; Is &array[5] legal C++ code in this context? I would like an answer with a reference to the Standard if pos...

 
morning
my uni server still isnt up
no coursework doing for me
 
lucky or unlucky?
 
10:11 AM
what would you guys say if you had a dev working with you that only mostly used the offline MSDN for help and rarely used Google?
 
10:25 AM
@TonyTheTiger I don't know. He's free to do as he likes I guess.
Lunchtime.
 
10:44 AM
MSDN is an awesome resource
I'd never put anyone down for using it
offline MSDN though- why do that?
 
@DeadMG cause he likes to be able to code without internet access
problem with that is, as I see it, is that it might not be up to date
not saying that MSDN has anything wrong with it though
 
Als
@TonyTheTiger: I would say its a matter of preference. If using google there is not much left to code anyways...Everything is avavilable one just needs to pick things up then
 
@Als I am talking when you need help with something, not to copy& paste, but yea I get your point
 
Als
@TonyTheTiger: Not copy pasting blindly but sometimes one can find much more efficient ways of doing a thing than what he/she thinks of
 
@Als true that
 
Als
10:54 AM
@TonyTheTiger: Also, tight project deadlines may sometimes prevent one from reinventing the wheel eventhough one would like to dearly do so.
Meeting deadlines are over and above coding satisfaction or urge to learn is a fact of the profession we cant deny.
 
@Als :)
 
11:42 AM
Could someone link to advanced production C++ code they think is good to read?
I've been trying to browse github but I'm not sure what would qualify
 
ok so is it possible to write a non-trivial program in which you can recover from ALL errors in ALL cases?
@ÓlafurWaage boost?
 
ahh of course, thanks.
Isn't it all as header files though?
 
@TonyTheTiger Recover from all errors? Like disk failure?
@ÓlafurWaage The Poco C++ project has high quality code that is also very readable.
 
thanks!
 
@StackedCrooked or memory corruption?
see someone where I work claims that I should in my project always get my program to keep running, no matter what error is occurring, I state that this is not possible
 
11:57 AM
@TonyTheTiger AFAIK Memory corruption can only be caused by an error in the code. In any case, keeping the program running if the computer breaks is obviously not possible.
@TonyTheTiger what kind of application is it?
GUI/console/service?
 
@StackedCrooked multithreaded server
console
 
One option would be to split the program in two processes: a front-end that launches the backend. If the backend process crashes, then you can have the front-end relaunch it.
 
or even a failure to create a synch event where the rest of the application is based on this event working
@StackedCrooked we used to have something like that, with COM and it was a nightmare to get working correctly
 
@TonyTheTiger It doesn't have to be COM.
 
@StackedCrooked surely, buts that's how it was
 
12:02 PM
You should probably also make sure that no exceptions can escape the request handler.
 
anyhow, my point was, in my current app I cannot guarantuee that in all cases I can recover from an error, as with certain things going wrong, it would seem senseless to try and recover
 
@TonyTheTiger In any case, crashes are not recoverable.
You probably can't recover from out-of-memory situation also.
 
@StackedCrooked true
 
@TonyTheTiger Stroustrup also mentions that sometimes it's better to terminate the program with an error code instead of trying to salvage the situation.
 
12:23 PM
@StackedCrooked see that's what I thought, but yea
try explaining that to some people
 
@TonyTheTiger Just found this: stroustrup.com/Programming/lecture-slides.html Check chapter 5
 
@StackedCrooked thx
 
12:40 PM
Not sure if it will help though :)
 
@StackedCrooked I actually have that book at home, I'll have a read tonight
 
sbi
@StackedCrooked Or as one professor of mine used to hammer into his students: It's better to cleanly die than to dirtily muddle on. (He said it in German, though. Any error in translation is mine.)
 
@sbi In the Dutch translation of "The C++ Programming Language" the word is "aanmodderen" is used.
 
sbi
@StackedCrooked That does sound similar.
 
@StackedCrooked you have a dutch translation of that book? ewwww
 
12:47 PM
@TonyTheTiger It's not too bad.
 
@sbi I tend to agree with your professor
 
sbi
@TonyTheTiger I used to have TCPL, 2nd in German, but that was the last translated C++ book I ever bought. Just the index was worth reading the English original.
 
@sbi I never buy a book in another language then English when it comes to IT books
 
@Tony, there are a few books written in other languages than English. It is worthwhile to buy those in their original language instead of the English translation is you can read it.
 
@AProgrammer true, but I have to speak the language too if that is the case
so far I haven't bought any book that wasn't originally written in English
 
1:00 PM
One example I know of is Yannis Yxxxxx book on fonts and codage which has first be written in french and then translated in English.
 
@AProgrammer oh ok
 
sbi
@AProgrammer Bernd Eggink used to have a pretty good German book about the Io stream lib (amazon.de/dp/3446179836), but that became obsolete with the templatification of streams during the standardization process. The current IO streams bible (amazon.com/dp/0201183951) - as well as the std lib bible (amazon.com/dp/0201379260) - is also written by Germans, but they wrote it in English.
And Josuttis teamed with a Flemish speaker for the template bible...
 
@sbi Cool I had no idea the IO Streams also had a whole book dedicated to them
@sbi I say woot :)
I wondered, is MFC actually standard C++?
 
@sbi you mean David Vandevoorde?
 
@StackedCrooked I'd guess that's him yes
 
1:09 PM
I don't think he's Flemish.
Or he moved to the USA: vandevoorde.com/Daveed
 
@TonyTheTiger Ok, I guess he's Flemish and moved to the USA :)
 
Hmm...
 
sbi
@TonyTheTiger And a mighty tomb it is.
@TonyTheTiger Heaven forbid MFC becoming anything than the bad example it is!
 
I have some binaries of an application and I want to find out whether it has been built using VC6 or something else.
The only mark I can think of is that is should be using MSVCRT.DLL but that seems to be rather vague.
 
1:15 PM
@sbi so I guess it's as horrendous as I always thought it was?
 
@TonyTheTiger I don't think it requires language extensions.
 
@StackedCrooked huh? elaborate?
 
@TonyTheTiger I mean I think it's standard C++ yes.
 
@StackedCrooked oh ok
@StackedCrooked but what does @sbi mean with his last statement on MFC then?
 
@TonyTheTiger I prefer using the simple WinAPI though (one of my pet projects is a xul implementation using WinAPI code.google.com/p/xulwin)
 
1:17 PM
I maybe have wrongly understood
 
@TonyTheTiger That MFC has bad code style.
I mean, bad design.
Dang, I can't think clearly today.
 
@StackedCrooked wow, my coworker just said the same to me
 
sbi
@StackedCrooked Yep. I think he did move to the U.S. for a job, and would place "Daveed" as Flemish, but that's just a guess.
 
@sbi I've never seen it spellt that way in Flemish
 
sbi
@TonyTheTiger Oh, so I'm likely to be wrong on that one. Sorry.
@TonyTheTiger Dietmar Kühl once said that, when it comes to design, "MFC is a very good example of a very bad example". (At least that's what I remember, but when I once searched for it, I couldn't find it, so I might have dreamed it up...)
 
1:22 PM
@TonyTheTiger It's just a intentional misspelling of his name that shows how his name should be pronounced.
 
@StackedCrooked :p
@sbi oh ok
 
I wouldn't see any reason to use MFC for new code today.
 
sbi
@StackedCrooked I dunno. He's using "David" a lot in the U.S., probably because he's sick of it being misspellt.
 
@sbi so if you had to choose between MFC or WinAPI, which would you choose?
 
@TonyTheTiger The MFC classes are a thin OO layer on top of WinAPI. I think it's mainly the code generation wizards that suck. WTL however is highly esteemed on SO though.
 
sbi
1:24 PM
@TonyTheTiger That's like choosing between Scylla and Charybdis.
 
@sbi I assume both of those are unpleasant things.
 
sbi
@StackedCrooked Did you never read Odysseus??
 
@sbi Nope.
 
sbi
@StackedCrooked Mumbles something about today's youth...
Being between Scylla and Charybdis is an idiom deriving from Greek mythology. Several other idioms, such as 'on the horns of a dilemma' and 'between the devil and the deep blue sea' express the same meaning of 'having to choose between two evils'. The myth and the proverb Scylla and Charybdis were mythical sea monsters noted by Homer; later Greek tradition sited them on opposite sides of the Strait of Messina between Sicily and the Italian mainland. Scylla was rationalized as a rock shoal (described as a six-headed sea monster) on the Italian side of the strait and Charybdis was a whirl...
 
@sbi lol
 
1:31 PM
@TonyTheTiger Qt wouldn't be an option?
 
@StackedCrooked I'm not using MFC, I was just trying to verify the correctness of someone's statements
1
Q: Where did endianness come from

Maxim GershkovichI am just wondering what is the history of endianness? I would have thought that the way that binary data was stored at lowest level would have long become standard yet clearly it has not. Why?

not a stupid question
 
1:48 PM
@TonyTheTiger Answers can be found in the corresponding Wikipedia article.
 
@StackedCrooked I was just looking at that, but it doesn't say much tbh
 
If someone makes you choose between raw WinAPI and MFC, punch him and use Qt.
3
 
@CatPlusPlus nice one :)
 
2:16 PM
@CatPlusPlus : Yeah.... I have to use MFC...
If my company were a person in the road about to get hit by a bus, and I tried to convince them to move. They'd simply say that they can already walk in the road; the sidewalk doesn't provide any benefit to walking.
 
"What is your favorite bottled beer?" reddit.com/r/AskReddit/comments/h2ze6/…
I'm surprised by the current top choice: Chimay Blue. Didn't expect it to be so well known.
 
2:33 PM
2
Q: Why can't my C++ compiler deduce template argument for boost function?

mister whyI define a method like so: template <class ArgT> void foo(ArgT arg, ::boost::function< void(ArgT) > func) { func(arg); } and use it like this --for instance--: foo(2, [](int i) -> void { cout << i << endl; }); Why can't the compiler deduce the type since it's ...

hmmm I'd be interested to know why that is?
I'm guessing because now it's two templates using one another, boost::function and then the one he wrote
 
@TonyTheTiger MFC isn't nearly as bad as many people make it out to be. It's old, and yes, it's somewhat on the giant, monolithic hierarchy side -- but most of the alternatives (e.g., wxWidgets, Qt, etc.) are about equally so. Its message maps aren't as nice at Qt's signals and slots, but not really all the horrible either. I could go on for a while, but you get the idea.
At the same time, I feel obliged to point out that there are only a few areas where MFC provides major improvements over using Win32 directly. Just for example, if you're going to use ActiveX controls, there's no comparison -- it's a pain doing it directly via the API, and trivial with MFC. A lot of code that just creates some windows and draws on them gets minimal benefit -- basically just converting something like DrawText(myDC,...) to myDC->DrawText(...).
 
@JerryCoffin oh ok, but I'm no big fan of it
@JerryCoffin but can you mix the two in one project?
 
@TonyTheTiger : WinAPI and MFC.... yeah you can. I think there are a few things that you have to use the handle for anyway.
 
@TonyTheTiger Yes. An MFC program can use the API directly quite easily.
 
@JerryCoffin hmm ok
Friends don't let friends do singletons.
 
2:51 PM
MFC has the benefit of being extremely well documented: you could fill a library with the books written about it
 
@JerryCoffin I remember trying to embed an HTML control in a WinAPI application. That was indeed quite painful and I think even impossible without MFC or ATL. I think I found some workarounds by having a look at the Google Gears code though...
 
It also hasn't changed much over the years, which is one way to define stability
 
So I guess this MFC thing is also a matter of preference, as there is no facts to prove whether it is good or bad
I'd say it's funny how people's opinions can be so different about one subject, and none aren't necessarily wrong therefore, just another way to look at things really
 
@TonyTheTiger It is a fact that it is not cross-platform (not considering the Wine project).
 
2:55 PM
@StackedCrooked Oh, it is possible -- but sufficiently painful that the only way I'd want to write code to do it would be if I was writing another framework to compete with MFC/Qt/WxWidgets (though, technically, I have actually done it in the dim, dark past, even though I wasn't writing a framework).
 
@StackedCrooked true
@JerryCoffin but given a choice for MFC or no MFC?
 
Personally, I'd go for Qt
 
@StackedCrooked From a practical viewpoint, you're right -- at least AFAIK, you can't get any of the other ports of it any more. It has, however, been ported to MacOS and a half dozen (or so) flavors of Unix.
 
It had all the bulkiness of MFC, but it's portable bulkiness ;-)
 
@TonyTheTiger You seem to be very interested in MFC. Are you that tempted?
 
2:57 PM
Qt is awesome.
 
@TonyTheTiger If the choice is purely between Win32 API and MFC, I'd probably use MFC. If Qt (for one example) was included as a choice, it's almost certainly a better one.
 
@JerryCoffin Also keep in mind that MFC isn't free.
 
@StackedCrooked no, I have a coworker that seems to be all over MFC and stating such things as "you cannot use WinAPI and MFC together" and I just have a feeling that something is awkward, so just verifying things
 
@StackedCrooked That depends on your definition of "free". Ultimately, nothing is truly free, but if you're using one of the paid versions of VS/VC++ anyway, MFC is included, and it's installed and working right out of the box, so getting started with it will take less effort than the alternatives.
@TonyTheTiger This is sort of half true. If you start with an API application, you can't just add in bits and pieces of MFC as you see fit. If you start with an MFC application, you can use the API directly, pretty much any time/anywhere you want.
 
@JerryCoffin he was referencing a project of the latter kind
 
3:04 PM
@TonyTheTiger This is not true. Either he is totally clueless what he is talking about, or he is referring to something else.
 
Actually, you can pick and choose parts of MFC and mix it with the native API. You just have to be careful when you do so
 
Help, they're making me implement quicksort in Java. I'm terrible at this.
 
@CatPlusPlus I'm sure the internet has plenty of those around :P
 
@TonyTheTiger Actually this link is even more specific: msdn.microsoft.com/en-us/library/5ewd17cw(v=VS.71).aspx
> Further, you can generally mix calls to the class library freely with direct calls to the Windows API.
 
3:08 PM
That's what I meant with "extremely well documented" :-)
in slightly over a minute, you get two links that answer your question with the necessary background info
 
@StackedCrooked thx :)
 
@TonyTheTiger And yet I keep screwing up the details. My brain just refuses to do it.
 
@CatPlusPlus Quicksort is a nice algo though...
recursion....
can be tricky to think with though
 
@TonyTheTiger In that case, what he's saying is just plain wrong. In fact, MFC rather goes out of its way to make things like this easy -- for example, most of its classes that wrap Windows objects (Windows, DCs, etc.) make it easy to get direct access to the underlying windows handle, so you can use it directly with the API when/if you want.
 
@CatPlusPlus First partition the set in two. Sort each partition. Merge the two partitions.
If I remember well.
 
3:12 PM
@JerryCoffin now what about using std::string in an MFC project?
is that an allowed mix?
 
@TonyTheTiger Nope, it will blow up the universe.
 
@TonyTheTiger Yes -- I do it routinely. I also use vector, map, iostreams, etc., on a regular basis.
 
sbi
@CatPlusPlus I'm sorry if this comes across harsh, but if you can't implement the Quicksort algorithm given en.wikipedia.org/wiki/Quicksort in any language you have minimal knowledge of, you might want to consider a different profession.
Well, let's say Brainfuck is an exception. Not that you shouldn't be able to do it, but nobody should be forced to prove the ability by implementing Quicksort in Brainfuck.
 
@TonyTheTiger For example void CWnd::SetWindowText(LPCTSTR lpszString); => You can simply pass myString.c_str() here.
 
3:17 PM
@sbi ...Quicksort, or anything else. For that matter, there are a few dozen other languages like Brainfuck that make it about equally stupid, going all the way back to Intercal.
 
Hmm... Sounds like a fun challenge, implementing quicksort in brainfuck
 
@RonaldLandheerCieslak yea
 
sbi
@RonaldLandheerCieslak Implementing anything in Brainfuck is a challenge.
 
does anyone know any problems with the current implementation of std::string?
or reasons why CString (if you're doing MFC) should be preferred?
 
@sbi ..but a silly and pointless one. If you want to challenging language, have them do it in assembly.
 
3:21 PM
@JerryCoffin now that sounds interesting
 
@TonyTheTiger CString isn't quite as theoretically sound (e.g., converts to a pointer to const char implicitly) but in some ways is more convenient (e.g., doing a search/replace across an entire string is easier).
 
sbi
@JerryCoffin Yep. The only thing that's not a challenge with Brainfuck is to implement a compiler/interpreter for it. Well, it would be, if coming up with good test programs wouldn't be a challenge...
 
@TonyTheTiger Somewhat -- I've probably done it in a half dozen different assembly languages over the years. It's a simple enough algorithm, it's really not all that much tougher than in C or Pascal, as long as you have a stack that's easy to access. On something like an IBM mainframe or early Cray (with no stack) it would be more challenging.
 
@JerryCoffin oh ok
 
@sbi I just don't view this as useful in any regard. I know how it works in theory, I know performance characteristic, I just don't see how reinventing the code is useful. And the details are annoying.
 
3:24 PM
@sbi Yes, but who's going to bother testing anyway?
 
@CatPlusPlus it's useful because you might learn something while doing it....
 
There is some Brainfuck code out there, I wrote a compiler for that. :P
 
sbi
@CatPlusPlus What @Tony said.
@CatPlusPlus Did you write a compile that eats Brainfuck or one that shits Brainfuck? :)
 
The only thing I'm learning right now is that I hate Java. But even that I already knew.
@sbi Eats. :P
 
@CatPlusPlus you're starting off with the wrong attitude, forget that it's Java and just write it and see if you do learn something
 
sbi
3:26 PM
@CatPlusPlus When I studied, I had to implement Quicksort twice. Once in Ada, and once in C.
 
@CatPlusPlus But on the other hand implementing quicksort should be fun.
 
@sbi what do you do when your coworkers disappoint you?
 
sbi
@TonyTheTiger In several companies I have worked for I have given C++ seminars. :)
 
@StackedCrooked I prefer writing practical code for fun, not something I'll throw out anyway.
 
@CatPlusPlus lol
 
sbi
3:34 PM
@CatPlusPlus If you don't feel like you'd rather throw out some piece of code you had written a year earlier, you haven't learned enough in that year.
@JerryCoffin Sadly, I think that adequately describes the state of this industry.
 
@sbi can you do one here?
lol
 
@sbi Unfortunately true. OTOH, pervasive testing was (IMO) badly timed -- it started to get popular just as multithreading/multiprocessing came along and rendered comprehensive testing essentially impossible.
 
@sbi I feel like throwing the code out I wrote yesterday :P
 
sbi
@TonyTheTiger That only shows that you learn at a tremendous rate. :)
 
@sbi Well, it could show more than that... :-)
 
sbi
3:39 PM
@JerryCoffin I dunno. We're working on a distributed system consisting of any number of processes running across the network, most of them being heavily multi-threaded, we do lots of unit tests, and they find lots of bugs.
@JerryCoffin What would that be?
 
@sbi Oh, I feel that a lot. But I think there's a difference between an ugly code in a production codebase that needs refactoring and useless code I throw out a second I'm done with it. Maybe not, I never claimed to be a great programmer.
 
@sbi Sure, they'll find bugs -- bug when they pass, there's still a rather good chance that there are still bugs.
 
sbi
@JerryCoffin Well, if by "comprehensive testing" you meant proving absolute correctness... We can't afford to hire Knuth.
 
@sbi Could be all sorts of things, such as an attitude that "old" automatically implies "bad".
 
@sbi :P
 
sbi
3:42 PM
@JerryCoffin Well, if that attitude stretches the meaning of "old" until it extends to yesterday's code, I'd think a visit to a shrink is in order.
 
@sbi I doubt that anybody can afford to hire Knuth (indications are that he's happily retired now). My point wasn't proving absolute correctness (which would have been more Dijkstra's thing than Knuth's) but the fact that with concurrency, you can't even come close in a lot of cases.
@sbi Hmm...imagine that -- somebody thinking a programmer is slightly strange. I'm sure that's never happened before! :-)
2
 
lol
 
sbi
@JerryCoffin Then maybe we're one of the odd cases? Or am I reading too much into our test results?
 
@sbi Maybe. Knowing nothing about the code or the testing, I couldn't possibly guess.
 
3:57 PM
@JerryCoffin I thought is was the code written by other people that was automatically bad?
 
sbi
@JerryCoffin It's a document processing system. There's an entity managing the system somewhere in the net, and a data base manager. Then there are processing agents distributed in the net, which can house any number of processing modules. Data is passed between those module. Most tests revolve around testing the processing modules or the API they use. There's tests faking the environment for a processing module, but many are run on a full-blown live system (though usually only on one machine).
Many of these tests only involve a test processing module creating test data, the module being tested processing it, and another test module logging the results, which are then checked for plausibility. These tests are run on virtual machines, and the timings sometimes vary wildly, depending on the load on the underlying system. But they still are pretty good in catching changes that break some esoteric processing module that's rarely ever used.
 
Als
4:15 PM
Pedaannttss..
 
@Als speak for yourself :P
 
Als
@TonyTheTiger: I am busy rep whoring today :P
2
 
@Eugene That too...
 
@Als repwhore
 
Als
@TonyTheTiger: Don't tell me you haven't felt like being one, once in a while..
We all do. I just felt so today in a long time though :)
 
4:27 PM
@sbi The real question is whether you're trying to use testing to find synchronization problems. If you have the synchronization correct, and the testing is primarily to see that the results stay sane, the fact that it's multithreaded probably doesn't make a big difference. Trying to catch synchronization problems via testing is what usually works out particularly poorly.
 
Als
Anyone any ideas about Thread monitoring mechanisms, where in a monitor thread can monitor a n number of other threads and handle the scenarios where one of the threads gets blocked infinitely or for a predefined time interval?
 
@Als usually called a watchdog timer. Perhaps some of the stuff at: stackoverflow.com/questions/1015494/… would be helpful?
 
sbi
4:50 PM
@JerryCoffin Ah, Ok. Yes, the protocols are all established. That code has been running for more than 1.5 years, and is running at quite a few customers'. I wouldn't be surprised if some esoteric threading bug surfaces one day, but the last I have seen must have been about a year ago. (And that code spends weeks shuffling GB of data in process, across processes, and across machines in the network, so it's heavily utilized.)
We have many other subtle problems, though, like running out of address space on 32bit machines, some processing modules taking a few seconds too long for processing a single page (which can sum up to days and weeks for millions of documents), customers putting loops into their workflows (not bad per se) that let circle thousands of documents thousands of times (bad, since it takes days instead of hours), and similar headaches.
 
Argh, of course bug is not in the quicksort but in those damn comparators.
Debugging recursive code is not fun.
 
Als
@JerryCoffin: Yeah watchdog timer is one similar implementation i guess for GUI or MMI applications....I am looking to have something similar in a middleware layer, with just pthreads...no STL...and i need to monitor n number of threads....and take corrective actions..
 
@sbi Yup -- those sound like things for which testing is at least reasonable (though I'd wonder about the workflow including a loop -- might it be possible to do a topological sort on the workflow and (for example) mark a document as already processed on second/subsequent loops?
 
Als
Any specific framework or design patterns which do this and might help in with ideas?
 
@Als Right -- that was just one example. Watchdog timers are fairly common at a wide range of levels (e.g., some IBM's have them built into the hardware, so if the OS doesn't clear a flag regularly, the machine reboots automatically).
 
Als
5:06 PM
@JerryCoffin: Any ideas about specific framework or design patterns or open source projects which do something similar and might help in with ideas?
 
@Als Not right off, no. If I think of something, I'll let you know.
 
sbi
@JerryCoffin An example for a workflow that needs a loop is one where a processing module rejects an already processed document for some reason and that document needs to be reprocessed. The classic example would be humans doing quality checking.
 
What happens when a significant number of items in a quality check test fail, given the statistical conclusion that the batch is fried. I would assume they'd test another sample, but if samples keep failing, do they hand check each item, or trash the batch?
 
Als
@JerryCoffin: Thanks..Do post me here in the chatroom if something comes to your mind.:)
 
@sbi Right, and presumably as-is, that's not a problem. I'd assumed the problem was (for example) one document being rejected leading to a group of related documents being re-processed.
 
5:14 PM
hmm
 
Hi Johannes.
 
After how many edits does an answer become community wiki?
 
@FredOverflow A dozen, if memory serves.
 
10, afaik
theres a diff whether others participate in the edit party or not
 
Unrelated: merge sort is easier.
 
5:25 PM
lol
 
sbi
@FredOverflow 12, I think.
 
WAH.... automatically becomes community wiki?
That sucks.
Do you get to keep your rep on it though? You have this awesome answer and some stupid guy comes and edits it over and over...
 
I've seen a question once that had 5 or 6 edits in one minute.
 
sbi
@Xaade If some question or answer turns CW after you already earned rep on it, you get to keep the rep you had until then.
@Xaade That could indeed be a problem. Now that gives me ideas... And There's nothing he can do!
(Why did I know this would be starred?)
 
Because it's so subtle.
 
5:38 PM
@sbi But first you have to find an awesome answer from the target...could be tough.
 
sbi
@JerryCoffin The system tries to find an optimal number of documents, so that no processing module ever has to wait for documents, but not too many documents are being processed at the same time (memory/address space issues). If lots of documents are rejected and transfered back to some earlier point in the workflow, this will increase the number of objects in memory. Depending on how the involved processing modules are distributed across different process, this leads to address space problems.
@JerryCoffin Why would I need an awesome answer? The guy has hundreds of questions, and a dozen answers. If on any question he posts, a couple of users make edits, he won't continue to earn rep on asking questions and being rude to answerers.
 
Unbelievable. I had 8405 rep reported, and suddenly there's 8406. They're doing that on purpose.
 
sbi
@CatPlusPlus Supposedly one question/answer you downvoted got deleted.
 
And a rather old one, too.
Meh, I'm too slow to answer C++ questions.
 
00:00 - 18:0018:00 - 00:00

« first day (199 days earlier)      last day (4732 days later) »