« first day (311 days earlier)      last day (4622 days later) » 

1:08 PM
@TonyTheTiger well, like I said, the CV is just for getting their attention. You'll still need to sell yourself in the interview(s). ;)
anyway, good luck! Sounds cool
is it a game studio, or do they make middleware or libs of some kind?
 
@jalf hehe, true yes, but it got enough attention to warrant an interview :)
@jalf it's not a game studio per se, but more a hardware/middleware shop that focuses on the kinetic type stuff for the industry, though they seem to have a studio that makes some applications/games making use of that
 
sounds interesting
what's the job?
 
seems they want to interview me for embedded programming
so close to the metal
 
1:27 PM
Cue terrible code.
 
@DeadMG Damn, I wanted to implement the copy ctor.
 
Use std::copy then.
 
how can you implement a copy ctor and use memcpy?
 
0
A: "live C++ objects that live in memory mapped files"?

PlasmaHHWe use for years something we call "relative pointers" which is some kind of smart pointer. It is inherently nonstandard, but works nice on most platforms. It is structured like: template<class T> class rptr { size_t offset; public: T* operator-() { return reinterpret_cast<T*&g...

This answer got me thinking just how smart could this kind of pointer be.
 
@TonyTheTiger fun
 
1:41 PM
Damn you GCC. ideone.com/tshJI
> how often do you think there's a requirement to parse dates and times using non-ASCII digits?
 
@RMartinhoFernandes: What?
 
It's clear question, isn't it?
 
Every time you parse Japanese traditional years?
 
So, it's common?
 
Probably. I'd imagine lots of countries have month names using non-ASCII characters, for example
We have weekdays with non-ASCII names
 
1:48 PM
Oh, no, consider just the digits.
 
not much of a date parser then, is it? ;)
but yeah, if you restrict yourself to digits, you won't need to handle anything other than digits obviously. ;)
 
But there are non-ASCII digits, like ٣.
 
sbi
@RMartinhoFernandes In my language? One month per year. (March ==> "März" in German.)
 
There isn't just digits even to years specification.
 
Oh, let's see if I can be as clear as possible: how often do people use non-ASCII digits on dates?
 
1:51 PM
yeah, delimiters vary too
might be some non-ASCII ones there
 
Yes, but that we can handle (we expect).
 
Again, it is not just digits. You fail.
 
when in doubt, assume you'll run into non-ASCII
 
@wilx No, but there are digits. Assume I can handle everything else.
 
@RMartinhoFernandes: E.g., Arabic dates:
أغسطس ، اكتوبر ، سبتمبر
(Do you have proper fonts?:))
 
1:55 PM
yes, I do have proper fonts
 
With "Eastern Arabic" numerals: ١٩٩١/٠٥/٢٦
 
anyway, it's a pretty open-ended question. Where do your dates come from? What do you expect to parse?
and what kind of format are the inputs expected to follow?
 
平成十七年 - year 17 of the Heisei era.
 
in the super general case of simply "parsing dates", I'd say ASCII-characters are going to crop up a lot
 
Completely non-ASCII numerics.
 
2:00 PM
but if you can narrow it down to, say, "dates written down by Americans", or "dates written in a specific format", then that obviously changes the answer
 
Hmm, ok. I guess a 20% perf boost isn't worth the restriction in this case.
 
sbi
@RMartinhoFernandes In my language 31 days per year, all of the March. (Didn't I say this already?)
 
@sbi ä is hardly a digit.
But I don't know German.
 
sbi
@RMartinhoFernandes Ah, my bad. Sorry.
 
@RMartinhoFernandes that's why I said that without knowing more information about the expected input, it's impossible to answer ;)
 
2:02 PM
Yeah.
 
We're still deciding what inputs we will accept.
 
where will the input come from?
 
It's a date and time library. It will come from client code, which means pretty much anything goes.
 
well, as long as you're clear about the limitations, I'd be fine with ASCII only. As long as I know that the inputs are supposed to consist of, say, 0-9 + "standard" English punctuation, that should cover a lot of use cases
but it would probably trip me up if I'm allowed to use a-z, but not ø, for example
 
2:57 PM
Are the ISO formats specified strictly in terms of 0-9 digits?
(plus separators)
 
ISO-8601 allows only the decimal digits U+0030 to U+0039.
 
Sounds ASCII to me.
 
If you restrict your input to ASCII, but mention ISO as the format, won't that look fancy?
 
We're planning to support non-ISO calendars.
 
3:04 PM
@RMartinhoFernandes My copy seems to have is_trivial and is_pod though.
 
Yes, those work. Hence the surprise.
 
the heck is this useful for virtual inheritance?
class A { ... };
class B1: virtual public A { ... };
class B2: virtual public A { ... };
class C: public B1, public B2 { ... };
 
C only has one A base/subobject.
 
e.g. you can do C c; A& view_as_a = c;
Without virtual inheritance there'd be two bases: C c; A& one_view = (B1&)c; A& the_other = (B2&)c;
(Is there a nicer way to do those casts?)
 
3:08 PM
What do you mean "nicer"?
Like static_cast?
 
Nah.
But for instance inside class scope I can use B1::A to disambiguate.
 
Oh I see
 
@LucDanton And here you use (A&)(B1&). I don't see a lot of complication. Yes, it's a bit ugly, but you're already doing something ugly in the first place.
 
Well assuming void interface_coded_against_A(A&);
What's ugly about using a C with that interface?
 
You need to pick a base.
Just like you did before: interface_coded_against_A((B1&)c). I find this ugly.
 
3:13 PM
But is it ugly because I'm doing something ugly in the first place?
That's what I don't understand.
 
What makes people think that static typing means sprinkling code with type declarations? C[++]?
 
@LucDanton Ah, I think MI with two bases of the same type is a bit ugly.
(ugly in the sense that I feel a certain dislike for it, not that it's inherently bad.)
 
Oh okay.
 
Don't you know MI is evil?
 
FWIW GCC accepts C c; C::B1::A& as_a = c;
Perhaps that'll help you reconcile with MI.
Wait no I'm stupid.
Ah, yes, it is ambiguous after all.
I don't think B1::A actually disambiguate anything at all.
 
3:19 PM
@CatPlusPlus MI?
 
Multiple Inheritance.
 
Metal ingots.
 
@CatPlusPlus Perhaps this is due to people not trying out languages outside their comfort zones. Can't remember who did that angry-ish rant about 'the blob language effect'.
 
What's that?
 
Any programmer will find this language of choice as the most expressive programming language he can think of.
 
3:25 PM
(My standard counter-argument to the misconception Cat mentioned is Haskell)
 
When presented with language X which has more expressive features, he/she will claim that 'No, language A can do that as well, like this' and e.g. present a work-around or how to implement what is a first-class feature in language X.
I guess it's that 'mediocrity syndrome' as applied to programming languages and their uses. Also I'm lousy with remembering names right now.
 
@LucDanton I don't. It might be the one I can express myself better with, but not the most expressive I can think of.
 
The one syndrome where people systematically overestimate their capabilities with respect to their peers.
@RMartinhoFernandes It's not my proposition. It's a rant I'm really uncomfortable with, it's quite patronizing.
 
@LucDanton It's the Dunning-Kruger effect.
 
Thank you.
 
3:28 PM
I never remember the "Dunning" part, but it's the first Google hit for "Kruger effect".
:)
 
Anyway, it's really weird when someone acknowledge that yes, language A can't do feature so-and-so as well as and/or not on a first-class level as language X but they don't need it anyway, it's a silly feature. And the feature in question is coroutine or whatever.
 
Well, I don't think I find Python the most expressive language, but it's expressive enough to be enjoyable.
 
Well... No language I know needs a mingle operator.
It's really a silly feature.
 
Anyway, nobody familiar with that rant? :(
 
I have a vague recollection of something like that, but seems like I didn't pay much attention to it.
This is awesome:
> Adhering to the general philosophy that a compromise should leave no one happy, the following rules have been selected.
 
3:34 PM
> Just replace the leading tabs in your source code with eight spaces before submitting your code.
This makes so much sense!
 
> In addition to the above rules, you should always use composite numbers when writing new code. Prime numbers are reserved for use by other parts of the code to fall back on when they run out of numbers in their designated block.
(for context, INTERCAL uses numbers for labels, and labels are very useful.)
 
Using non-standard features

Con: INTERCAL extensions such as threading and operator overloading are non-standard and poorly tested, and may therefore have broad unforeseen side effects.

Pro: INTERCAL extensions such as threading and operator overloading are non-standard and poorly tested, and may therefore have broad unforeseen side effects.
 
I can't understand all of it :( Apparently there are idioms in INTERCAL!
 
@RMartinhoFernandes I'm having a lot of trouble with the concept of "useful" and "Intercal" in the same sentence!
 
Er, it's a "scoped useful" :)
 
3:45 PM
Computed labels are great for writing an interpreter! Or so I'm told.
(Or is the extension called computed goto? I forget)
 
I've heard computed goto.
Which makes some sense: you make the computation in the goto.
 
@RMartinhoFernandes Oh, one of those where the first thing in the scope is: #define true false. I think I'm starting to get it...
 
Computed labels on the other hand, sounds just like what COME FROM needs.
 
@JerryCoffin That's a trick non-question! Macros have no scope! Gotcha.
 
It's computed goto.
 
3:48 PM
@RMartinhoFernandes The sad part is that the computed goto actually came from a real language (FORTRAN). In older versions of FORTRAN, a typical if statement would look something like if x - 20 100, 200, 300
@LucDanton Sure they do -- they all have file scope.
 
Is that an if with three paths? for TRUE, FALSE, FILE_NOT_FOUND?
 
True, false, why are you stealing my sandwich.
 
@LucDanton Yes. It was apparently the inspiration for strcmp. It does the computation, and goes to the first label if the result was <0, the second if ==0, and the third if >0.
 
Ah, thanks.
So it's like a spaceship operator.
 
Why do we have if/else, can't we just use a switch? :)
switch (condition)
{
    case true: /* ... */ break;
    case false: /* ... */ break;
    default: std::cout << "It's a miracle!\n";
}
 
4:02 PM
So as to not write switch(!!some_integral_thingy)!
 
@CatPlusPlus Is there anything in C++ that is not evil? ;)
@LucDanton Hm, makes sense. Although you could just say:
switch (condition)
{
    case false: /* ... */ break;
    default: /* ... */
}
With default being the true case.
Yes, this does not handle miracles, but they don't seem to appear too often, anyway.
 
@FredOverflow Integers!
 
@CatPlusPlus I don't know, abs(i) is not guaranteed to yield a non-negative number, seems pretty evil to me...
abs(MIN_INT) < 0
 
4:35 PM
@FredOverflow Why not eliminate both, and just use expressions? if (x) y; is equivalent to x && y;
 
4:56 PM
-2
Q: Python Interactive Program

user889789I recently came across a code implementing Artificial intelligence in Python. It is called Eliza. http://www-ai.ijs.si/eliza-cgi-bin/eliza_script (this one is not in python- just given the link for a reference without having to install Python ide) I am trying to code a virtual assistant like El...

Lol AI as a FAQ.
 
Stupid POST link. Or whatever that is.
 
Don't see any FAQ tags
 
5:27 PM
@CatPlusPlus Worse still, believing that Eliza bears any more than a vague resemblance to AI. The hallmark of intelligence (artificial or otherwise) is learning -- but Eliza is entirely static, and never learns anything.
 
5:41 PM
It's fun watching one Eliza instance talk to another instance... for about 10 lines, then it gets boring.
 
@FredOverflow 10 lines? You're more patient than I.
 
@FredOverflow: Do they loop?
Or do they get into some sort of fixed state?
 
They just get stupid.
You can see for yourself here, just wait.
xD
 
5:56 PM
:))
 
@wilx I bet real therapists talk to each other exactly like that :)
 
6:13 PM
I have half a mind to go around putting comments on answers, "Code or it didn't happen."
 
Why would you have any construct other than `if` and `goto`? Because it makes it easier to write correct code, or at least it makes it marginally harder to write bad code:

for ( initialization; condition; step ) code

initialization
for_begin:
code
step
if ( condition ) goto for_begin;
And the same for many other constructs, but having a for and a while and a do and a switch makes it easier to write code without errors
 
0
Q: When is dynamic scoping useful?

FredOverflowThere are programming languages where a callee can access the variables of its caller. Pseudo C code: void foo() { print(x); } void bar() { int x = 42; foo(); } Since I have never programmed in such a language, I wonder what a real world use case for that would be?

@DavidRodríguezdribeas I don't think the C-style for loop is particularly useful. Scala finally got rid of it.
 
sbi
Actually, it's `if` and `goto` from which you can build all the others. But using so many similar but different syntactic constructs helps expressing the _intent_ of the code, rather than just implementing the _algorithm_. The underlying CPU (usually) just knows `if` and `goto`, which is why we have such a hard time to understand compiled code. Using high-level constructs such as `while`, `for`, `switch` etc. instead makes the code's intent clear to readers and maintainers.
Being able to write understandably for _humans_ is way more important than only for the _compiler_As I always used to
 
You do realize that my suggestion to switch on booleans was meant as a joke, right?
 
@FredOverflow That was just an example, as @sbi is saying, with if and goto you can implement the rest
@FredOverflow no, I have no sense of humor
 
sbi
6:24 PM
@FredOverflow Of course I do. (I never take serious anything you say!) That doesn't mean I wouldn't jump on it, though. :)
 
Or maybe I have... I just jumped in the middle of a conversation :P
 
sbi
Ick. Morkdown sucks.
@DavidRodríguezdribeas That is a sentence that contradicts itself.
afk
 
@sbi does it? No [I did not realize it was a joke because] I have no sense of humor
then again, I might have no sense of contradiction/consistency either
 
Well, at least your head didn't explode, so you're not a robot. At least not a badly programmed one.
 
@sbi <Sarcasm>The problem is, you forgot that you're just supposed to take their money, give them some kind of test that repeats what you said, then give them a piece of paper with a letter on it. Actually worrying about whether students learn a skill is secondary to worrying about whether they have a paper to show how much money they spent listening to people who have no skills. @Sbi you don't belong, teaching is below your pay-grade.</Sarcasm> (for @Fred's benefit)
 
6:29 PM
@Xaade We need excellent teachers. Most students don't surpass their teachers skills.
@Xaade I understand sarcasm most of the time, thank you.
 
@DavidRodríguezdribeas Those constructs are superior even if all they provided was a way to not have to write 500 different for tags for each file.
 
@sbi I don't consider switch high level anymore. Pattern matching, anyone?
 
pattern matching... haskell
 
Well... do you usually use 'high level' ironically?
 
or Scala
 
6:34 PM
@FredOverflow Just don't get too high level. Just "Think and it happens" would be hard to maintain.
 
Should I ever name a language, it will be "Elevator". Because you need an elevator to get to the really high levels.
 
@FredOverflow Yes, that kind of use! Thank you.
 
There is nothing wrong with low level per se. I have written a Tetris game in assembly language, it certainly was fun.
 
@FredOverflow In the really high levels, you start to see thinner atmosphere. It becomes hard to breathe, which also means it is hard to think. I think that a similar thing happens with programmers. Give them too high of high-level language, and they start doing dumb things with it.
 
#include <stdlib.h>
#include <stdio.h>

struct Bool { void virtual throwX() const = 0; };
struct True: Bool { void throwX() const { throw True(); } };
struct False: Bool { void throwX() const { throw False(); } };

int main( int c, char* v[] )
{
    Bool const& t   = True();
    Bool const& f   = False();
    static Bool const* const    x[]     = { &f, &t };

    try
    {
        x[c == 2]->throwX();
    }
    catch( False )
    {
        fprintf( stderr, "Usage: PROGNAME ARGUMENT\n" );
        return EXIT_FAILURE;
 
6:37 PM
@FredOverflow Everything not sarcastic is unintended sarcasm that takes a wittier person to find.
 
@AlfPSteinbach What is that, Smalltalk++? :)
 
@AlfPSteinbach It appears anyone can take common sense and turn it into a complicated object.
 
@Xaade You mean like a manager factory singleton?
2
 
Surely you mean a singleton manager factory singleton.
 
@FredOverflow Wrapping my head around that I come up with a singleton that grants access or distributes factories. Seems like that undermines the point of factories being able to be hot-swapped at run time to produce different sets of objects.
 
6:47 PM
@Xaade Don't worry too much, I was just randomly concatenating pattern names :)
 
@Xaade It's okay, you use the [singleton] manager singleton factory factory singleton to obtain it in the first place.
 
@LucDanton I don't think singletons can appear on the left side of factories.
 
@LucDanton Because, there should only be ONE WAY to get a dynamic set of factories which produce static singletons.
 
An 'X' factory produces 'X'.
An 'x' factory singleton is a refinement of that.
 
A factory can't produce a singleton!
A singleton's constructor is private!
 
6:49 PM
Now an 'X' factory singleton can produce singleton manager; that is different kinds of manager, but each one is a singleton.
 
Not really
 
So that's what I designate with a 'singleton manager factory singleton'.
 
Nope
You can't produce something with a private constructor.
 
For instance you can ask the factory singleton to obtain the 'audio manager singleton'.
Or the 'video manager singleton'.
 
The best your "factory" would do is hand out interfaces to the singletons.
 
6:50 PM
Isn't a singleton already a (minimalistic) factory?
 
@Xaade Produce was not used literally.
@FredOverflow Yes, but the factory allows dependency injection. Duh.
 
So you can hand out interfaces?
 
@LucDanton dependency injection interface adapter module manager
 
@Xaade Implementation details.
 
@Xaade I can hand out in-yer-faces!
 
6:52 PM
I suppose it would be useful, IFF the factory could be swapped for a different one that produced the same interfaces to other singletons that have the same methods.
 
@Xaade That's why I mentioned the singleton manager singleton factory factory singleton.
So you can pick the right factory singleton without coupling your code.
 
ZOMG, you just invented the multiton.
 
Am I not verbing English correctly?
 
@Xaade You mean like, a regular class?
 
What if.... now hear me out.... what if, you have each factory produce a different singleton, but it can only be one singleton of each interface, such that if you ask for a different factory to produce the singleton, it returned an object that was moved from the other singleton.
 
6:54 PM
What do you pass to the factory?
 
Gasp
 
moved as in C++0x moved?
 
A dynamically implemented singleton.
@FredOverflow yes
 
How do you know someone else is not holding onto the old singleton?
 
Oh, gah, the universe is collapsing.
@FredOverflow Factory is smart enough to actually send you smart pointers, so no one's holding onto the singleton.
 
6:55 PM
@FredOverflow Paths to find the XML documents.
 
Okay seriously, what about a composite memento builder adapter proxy? I think it has a nice sound to it.
State visitor strategy seems nice. "I'm gonna visit Florida, Oregon and Texas!"
 
@Fred I think you just found your life passion. Identifying all stupid code with concatenated pattern names.
Just like all logic comes from a finite set of constructs, all code must come from a finite set of patterns.
 
sbi
@Xaade Yeah, teaching without a heart is a test that I failed fatally. :( In fact, one of the reasons I had to give up teaching as a second job is that I couldn't do it with half a heart (and I need two hearts already, for the kids and my first jobs).
 
@sbi You're lucky you didn't end up tangled in a lawsuit with the teacher's union for trying to be better than everyone else.
 
sbi
@FredOverflow That depends from where you look at it. Of course, coming from PROLOG makes switch almost equal to a machine-level instruction. But try to implement it efficiently in assembler...
 
7:15 PM
0
A: How to increment a 64 number when OS only supports 32?

FredOverflowHere is the solution suggested by @Mark in C++: template<typename Iter> void increment(Iter begin, Iter end) { for (; begin != end; ++begin) { ++*begin; if (*begin == 'G') { *begin = '0'; continue; } if (*begin == ':')...

my first use of continue in several years!
 
@LucDanton XML that's processed with XSLT that yields another XML document that describes paths to XML documents.
 
@sbi two hearts, eh?
 
@FredOverflow Why not else if?
 
oh hai! ™
 
@CatPlusPlus Oh wait, I was missing an important break at the end of the loop body :) fixed
 
sbi
7:21 PM
@Xaade I was actually teaching at a university (well, FH, for @Fred), as an external lecturer, and competed with professors, rather than teachers. (I have no idea whether this distinction makes any sense in the US.)
 
@sbi Yes, it does.
 
@sbi Yeah, In America professors are mostly private endeavor, so they have to stand on merit. However, public teachers are a public endeavor, so they stand on their failure having not been noticed for 10 years.
 
lol
 
Which ironically, is about the time it takes for a school to notice a decline in testing due to one teacher's negative impact.
 
@Xaade Quick, segue into shrimps on treadmills.
 
7:28 PM
What?
 
@Xaade Doubtful. My sister got her doctorate in statistics from Iowa State University, purveyors of the Iowa Test of Basic Skills. Their statisticians were good enough at producing the "desired outcome", that they would guarantee (for the right price) that your class' scores would be "above average", with no prior knowledge of who would be taking the test -- and I don't believe they ever had to refund a school's money either.
Guess how many schools try to find and fix problems, vs. how many try to prove there is no problem to fix.
 
you know, I realized another important part of parallel grammars
you could rebuild them incrementally, if you incrementally changed the token stream
 
0
A: What's the fastest way to print the address of a member function?

Alf P. Steinbachc++ does not give any portable means of printing the address of a virtual function. cheers & hth.,

argh
i mean, the question
and the answers
no i have to delete that -ve comment
did
for some reason google associated the shrimp on treadmill with this image:
what's the story?
 
sbi
7:44 PM
@FredOverflow Well, I'm not that old yet. At least, so I'd like to think.
@Xaade Except for some private once, in German universities professors are employed by the state, just as teachers. They do enjoy more freedom, though.
 
@sbi So what do you do now, ordinary programming job?
 
sbi
@FredOverflow Yeah, and only that. Too bad, I miss teaching. But if I only taught, I'd miss hacking.
 
@sbi Can't you teach hacking? Or hack teaching?
Or manage a hacking singleton teaching factory?
How many gotos must a programmer write before you can call him a man?
 
sbi
@FredOverflow I was teaching programming. But teaching that is very different from actually doing it yourself. The only synergy out of it is that my students benefited from a wealth of experience. (I didn't just say "Don't do that!" I said "Yes, you can do it that way, but when I was part of a project where they did it, this here happened, and you really wouldn't want this to happen to you!" I got praised for backing up most of my rules by experience.)
@FredOverflow Programmers writing (many) goto statements are below man.
 
How many gotos must a loader execute before he can call main?
 
sbi
7:57 PM
Anyway, I do need to leave. I have to get up at 6am, and I need to fit enough sleep plus an hour's worth of reading in the remaining eight hours.
See you guys.
 
@sbi haha, i get 30 minutes more :)
 
sbi
@FredOverflow Yeah, but you're way younger! Besides, I only had 4hrs last night. (Too good a book, always dangerous.)
 
@sbi title of the book?
 

« first day (311 days earlier)      last day (4622 days later) »