« first day (1485 days earlier)      last day (3465 days later) » 

user1804599
12:08 AM
> They come in bags of 100 for about $1.50. You only need one.
 
user1804599
lol
 
holy fucking shit Life
 
Ell
What?
 
@rightføld Allow me to extend my heartfelt condolences.
 
Ell
12:18 AM
Lol
 
HOLY FUCKING SHIT LIFE
 
but what happened?
 
Life owned Taeja
twice.
 
user1804599
lol
 
user1804599
dat pun
 
12:26 AM
-2
Q: Excessive amount of "use vector"

BarryIt seems that lately pretty much every C++ question on SO that involves any pointer indexing whatsoever leads to the comment "use vector!" It doesn't matter if the OP is using the pointer correctly or incorrectly or even if the OP's problem is related to the pointer at all. The latter is the wo...

 
user1804599
WithValue
 
user1804599
UpdateValue
 
user1804599
ReplacingValue
 
Update reads like mutating it?
 
user1804599
12:35 AM
Not if the result is used.
 
user1804599
Scala calls it copy and you can pass named arguments.
 
user1804599
Like x.copy(value = 2.0).
 
copy is decent
 
clone
 
user1804599
Not sure if you can do public Fuu Copy(string name = this.Name, double value = this.Value) and then fuu.Copy(value: 2.0) in C#.
 
12:38 AM
dunno, it is only value that will change
 
user1804599
Then you should mention Value in the name of the method.
 
maybe, it is mentioned in the parameter name
 
Anyone else gonna try and tackle #488 in twenty minutes?
 
@Columbo I tackled writing some code to deal with IEEE 488 interfaces years ago (in Commodore PET BASIC...)
 
@JerryCoffin Nice, that counts too :)
Surprisingly some of the recent problems were pretty easy, such as 485 or 487 (which I both solved)
I hope this one is easy too so I have a chance :o)
 
12:43 AM
Aaaand I'm back.
 
@Jefffrey We were waiting for you in sheer despair.
 
Pics or it didn't happen
2
 
I know. I tried to come back as soon as possible.
 
12:57 AM
holy shit, Life actually beat Taeja.
 
Three minutes left.
Ahhh, this is crap.
 
Ell
What are you guys on about
 
1:24 AM
The character limit on Twitter, Prevents limericks — if you're a quitter. But with one little cheat, You can quickly defeat (see line 1)
wp
 
Ell
Haha
 
I don't get it
You can quickly defeat -> The character limit on Twitter. Is that it?
It wraps around.
 
 
Yeah, the wrapping is the joke
 
nice
 
1:38 AM
 
@milleniumbug "the wrapping is the joke" sounds like something a "funny" dad would say to his crying daugther.. - Aw come on, the wrapping is the joke, don't you get it!?
 
Actually, the limerick is the joke
 
Ell
@sehe door.end()
 
@sehe well-played.
 
While browsing old questions I commented on, this caught my attention:
> does the above mean ctor and dtor are not useful or they are just useless?
 
2:05 AM
##c++ @ freenode just went into nutter mode.. so, erhm; what's up?
 
@FilipRoséen-refp So you drove them crazy, and now you're starting on us? ;-)
 
@JerryCoffin I've done absolutely nothing (fo'real; didn't say a word.. besides linking the trigraph related paper from IBM representatives) :(
but if you guys want crazy, I'll show you crazy..
 
@FilipRoséen-refp You posted something about trigraphs, and then try to disclaim responsibility when insanity follows? I don't think so!
 
@JerryCoffin it was a discussion already happening, I tried to calm it down with a "stop it, it's over, get real"
the Internet is apparently very bad a stopping.
 
@FilipRoséen-refp You too. You should have stopped at "bad".
 
2:12 AM
@JerryCoffin surely, but I'm just part of the greater machine
just got word that one of my DRs will be considered not a defect.. fcuking hell
 
Ell
Night guys
 
@Ell time zones.
 
@FilipRoséen-refp I've thought of doing a count--pretty sure the majority of formal DRs are resolved as NAD.
 
@JerryCoffin you should
 
 
1 hour later…
3:38 AM
@JerryCoffin Not really true. I have a degree and I feel like it left huge holes in what I should have learned.
 
4:02 AM
In fact, the more work I do in the industry the more disappointed I am in the quality of my degree.
I like a lot of things about my alma mater, and I even like my CS professors a great deal, but I feel like they failed in actually teaching me stuff I should have known.
 
4:32 AM
@caps Bjarne often talks about the gap between what's taught and what's needed.
 
 
4 hours later…
8:21 AM
4 hours ago, gee ... the longest in the past 12 months probably ...
 
8:32 AM
my phone told me that I walked more than 50km in 2 days
 
So, I'm picking up scala again, and after a few months with mostly imperative languages I'm very dissatisfied with the code I'm producing. Anyone here knows scala and feels like helping me out with a code review?
It's just the code feels very imperative, and shitty, but mostly imperative
 
hi Benjamin!
I guess that's due to many years of imperative programming :P
 
@BenjaminGruenbaum @rightføld
 
I'll post it on CR.SE
 
Also good morning
 
8:39 AM
haha, good morning
(haven't said that due to different countries and all that)
 
Well it's morning here
 
it is here too
my 'here' is spain
where is yours?
 
Mornin
0
Q: Ported C# scheduling to Scala - does not feel idiomatic

Benjamin GruenbaumI'm taking a design workshop, we've received a short task which is: To parse an input file of processor jobs. To simulate scheduling of those jobs on a parallel computer (each job needs X processors) The scheduling should be FCFS but it should be easy to to swap it out for a different scheduler...

Here, I asked on CR.SE
Go mock my horrible code
 
@XavierAriasBotargues Poland
 
btw, been taking a look at c++17 at wikipedia
C++17 (also called C++1z) is the informal name for the future revision of the C++ ISO/IEC standard. The specification for the C++17 revision is speculated to be finished in 2017. == Expected Features == As the specification for C++17 is just beginning, the following list is just a start. Many features will certainly be added in the next years. Addition of a default text message for static_assert Removal of trigraphs Terse range-based for loops Allow typename in a template template parameter == See also == C++ C++14 == References... ==
does anybody know what "Removal of trigraphs" means?
I think that the proper question would be what are trigraphs in this context
 
8:48 AM
There won’t be trigraphs anymore.
@XavierAriasBotargues They are alternatives character sequences, e.g. you can use ??/ instead of `\`.
To clarify, those are characters of the source code.
 
In computer programming, digraphs and trigraphs are sequences of two and three characters respectively, appearing in source code, which a programming language specification requires an implementation of that language to treat as if they were one other character. Various reasons exist for using digraphs and trigraphs: keyboards may not have keys to cover the entire character set of the language, input of special characters may be difficult, text editors may reserve some characters for special use and so on. Trigraphs might also be used for some EBCDIC code pages that lack characters such as { and...
 
thats for multi-line macros?
 
No.
It allows you to input a character that you may not have on a particular system (or at least that was the wisdom at the time).
 
Shit, I hanged our app on heroku
I hope deployment will kill it.
 
8:51 AM
Similarly you can write not foo instead of !foonot is a keyword alternative to !.
 
I knew that you could write (a or b)
but seems like they want to kill that
to simplify parsing, I assume
C++ would really use simpler parsing, haha
 
There has to be a less dumb way to write:
  override def getDoneJobs: Iterable[Job] = {
    val currentDoneJobs = new mutable.Queue[Job]()
    while(queue.nonEmpty && queue.head.time <= runToTime) {
      val current = queue.dequeue()
      current.eType match {
        case EventType.Added => queue.enqueue(addJob(current, currentDoneJobs))
        case EventType.Done => releaseProcessors(current)
        case EventType.Retry => queue.enqueue(retryJob(current, currentDoneJobs))
      }
    }
    currentDoneJobs
  }
I think the problem is Scala's PriorityQueue does not have guaranteed iteration order, only dequeue maintains order, maybe I should wrap it
 
My game design is mess at the moment, the files look somthing like this: gyazo.com/09edf2a0bf97b76bd03f77963cc07414 (Yeah; there is circular dependicies, messy code, overused inheritence...) anyone know any changes I could make? I'm using a service locator but it might be smart to change.
 
ungh I want >>=
 
Huh?
 
9:03 AM
Oh wait, I can add it, nvm
 
-2
A: Does delete[] really work in C++?

PuppyNo, no it does not work in C++. Do not ever use delete[]. Use resource-managing classes like std::vector exclusively.

lols downvoted already
@Mixerman123 lol UML, lol "WorldManager" and "service locator". That's so bad.
 
I know; sorry. I'm new and really confused. :/
 
@Puppy lol
 
sigh
 
9:18 AM
@Puppy that's not UML, that's just a chart
It's perfectly fine to draw charts to understand your code better
 
well, it's clearly hand-drawn, but the << >> stuff reminds me a lot of UML.
 
@Mixerman123 service location is no better than a global, just like singletons, you don't want to actually do that if you have a choice.
 
argh.
 
<<interface>> is just how you describe an interface.
 
9:19 AM
Everyone says that
 
Because it's true.
 
My alternative is passing it
 
@BenjaminGruenbaum so true
 
It took people a long time to understand too
 
OH NOES PASSING THINGS
HOW WILL YOU LIVE?!
 
9:19 AM
@Mixerman123 So pass it. passing it is excellent, you have to write a little bit more code but the dependency is explicit.
 
but it got so messy passing things that I ended up passing the service locator
which means I may as well have it global
 
That indicates a bigger problem, it's exactly why passing it is a good idea
 
no, it means that your design is broken.
 
If you find out that a class has too many dependencies - that means you need to rethink your design.
 
which was conveniently highlighted for your attention.
 
9:20 AM
I know my darn design is broken, and I have no idea how to fix it
 
That's good
 
ok well pro tip: when your design gets broken, don't just hack around it with global variables.
that just makes things so much worse.
 
"I know my darn design is broken, and I have no idea how to fix it" - Story of my life
 
ha!
 
I know it sounds stupid, but writing unit tests usually helps me reason about my design.
 
9:21 AM
Alright, pup, what do you suppose I do. When virtually everything needs to know about everything
 
If everything needs to know about everything - you have a big problem.
 
ahh.
 
pretty much that.
 
You should rethink the logical components of your app.
My advice would be to start with unit tests, again - it's counter intuitive but it makes you think in small components. The alternative is to just force yourself to think what the logical parts in your app are.
 
looks like you separated tasks/responsibilities badly
 
9:23 AM
Well its a game. A button needs to use audio, so does a laser, oh, and the gui, dont forget the players, nearly forgot the tiles.
 
no, buttons do not need to use audio.
 
Argh
 
the button class does not give a shit about audio.
 
@Mixerman123 a player certainly doesn't need to use audio
Neither do buttons.
 
Bad example
A tile needs the render window, so does the player, etc
 
9:23 AM
@Mixerman123 I do see where you're going
 
Audio happens way after the player in the logic, a player does stuff, you have listeners to those stuff elsewhere and they know about the audio, so it becomes a chain rather than a star.
 
you could be thinking in components
 
@Mixerman123 great, so pass all of them to the component that renders.
 
@Mixerman123 Well, actually, they don't. Why not have the renderer render the player?
 
That means that the component that renders can get a renderable, and render it - so while it processes the players, the tiles ETC it has no knowledge what those things really are - only that it can render them.
 
9:24 AM
Hmm
I feel like I should be writing this down lol
I have made my map 'drawable' with sfml
 
I generally found that there's a general tradeoff here.
 
I dunno how to implement this for my own classes though.
 
afk class
 
Keep in mind I am abit of a noob.
 
I had a somewhat similar problem in my compiler.
an AST expression can be evaluated to a semantic expression, but if you put that function in the AST expression class, then the AST expression becomes tightly coupled to the semantic analyzer, which is bad.
 
9:27 AM
Argh. What the hell did you just say
 
hahaha
never written a compiler (or parts of it) I assume
I did that on college, so I assume you don't have your degree, yet ;)
 
Dude, I am still getting my head around smart pointers.
And no, I don't.
 
ok well what I'm saying is
just because it makes sense to perform an operation on a given class does not mean it should be a member of that class.
 
Alright... I always see example code having all objects with a draw method though
 
first lesson: most example code is shit.
 
9:29 AM
yeah
 
Haha!
 
mostly about game programming
 
they're written to demonstrate a particular thing.
not good design.
 
Yeah, I suppose thats true.
 
or the one that written that doesn't know any better!
 
9:31 AM
I'v always heard that it's good to have an object understand what it is doing. Somthing about coupling. Am I thinking of somthing else?
 
probably.
 
Encapsulation to limit coupling.
 
that doesn't obviously map to any good design note I've heard.
 
I think that "it's good to have an object understand what it is doing" means that an object generally should own the information that it needs, other than asking others through getters and ugly stuff
 
everything I have heard about these designs have always been "this pattern" or "this way of doing things" is evil.
mm
 
9:33 AM
protip: everything is a tradeoff
which tradeoffs make sense really depends on what your design is and what it's supposed to do.
 
if the information is to be shared, then you have like 3 options:
 
Mmm
Somone even emailed me this: Anyway, I used to organise my code into hierarchical structure of classes, but accessing something way up in the tree was just plain ugly and hard to read. Lately, I've been using singleton pattern, in which you basically have a single instance of a class, and then just access it from anywhere when it's needed (for managers and such). You can read more online, there's plenty of good literature on the topic.
 
there are a few things that are universally evil
 
1 is to have information in object A and get it from object B
2 is to have it the other way around
 
@Puppy hitler
 
9:34 AM
and 3 is to have it in a newly created object C
 
Wait my question had disapeared
 
mutable global state
 
I didn't delete it
 
Also cats
Proof: come to this room when Cat is around, ask him your programming question
 
Argh
How the hell do I turn this conversation into code. It's the same everytime I research this.
Only reason I am using a service locator is cause I got it -_- :/
 
9:37 AM
write a really short sample with stubbed-out methods.
 
To try and get my head around a good pattern?
 
Oh sehe deleted it
 
yes.
the implementation of the methods is less concerning than what methods you have and what classes they're on, so just leave them out.
also
fuck patterns, seriously.
 
But how else can I access my shit?
 
try just using code.
the code that you write does not have to be made of patterns, or use patterns, or patterns anything.
 
9:39 AM
How?
 
the quality of code is not directly proportional to the number of patterns you've introduced.
 
Yeah, I figured that, but how else can X not about every glyph written in freaking space?
 
what's X?
 
A class; knowing everything else.
 
don't let it know everything else.
 
9:41 AM
Sorry, this'll make my rep to you go down the drain, but the only other game I wrote was in javascript. If I wanted to make a var, it was freaking global in a 3k line file
It tought be to code like crap
 
honestly that's pretty much what I expected
 
me*
Yeah
 
JS is a shit language that really does not help at all
so I feel some sympathy
 
Ha, yeah. I was pleased though - I made a game. It doesn't mean much now...
 
I started out in Lua which is not quite as bad as JS but shares many of the pitfalls with it
 
9:43 AM
mm
How do you suppose I set it up my code? Sorry, I just really need to work with somthing.
 
OPening
I don't understand some of the syntax in the middle, but I get that you are making an object that can be rendered. What I don't get is how you might do this without having a draw method on your objects...
Thanks for the gist, btw.
 
this bit is key
std::unordered_map<std::type_index, std::function<void(Renderer& renderer, const Renderable& renderable)>> rendering_functions;
 
Yeah, thats the line I didn't get :P
 
it means that, in this container, for each type, there is a function (that takes a Renderer and a Renderable).
and as an additional constraint, we say that this function is the rendering function that renders the object.
 
9:53 AM
What functions might this store other than drawing..?
 
std::function<Sig> can store any callable object which can be called with Sig.
so this pattern is applicable generally to pretty much any function you can imagine.
I also threw in the SelfRendering bit so you can see that you can also choose to have a Render() function on the object if you want.
 
Hmm, trying to understand this.
You're storing functions in the map? Or the map stores id's to functions?
 
the map maps types to functions.
 
hmm
So std::type_index is any type?
Sorry I can sense a facepalm :P
 
yes (but in this case, we say it must be a type that derives from Renderable)
 
9:58 AM
No way!
In a real game, where might you put r.AddRenderingFunction<Player>([](Renderer& rend, const Player& p) {
rend.RenderText(p.name);
});
 
not sure, really.
but it honestly doesn't matter tremendously much because the position is not fixed.
anyone who knows about Player and Renderer can make that function anytime.
 
you'd probably just make a dedicated function to add the rendering functions for your predefined types
or do them in the Renderer constructor maybe.
 
Yeah, thats what I thought
So you can add multiple rendering functions; does that mean you might have one for, I dunno, renderGlossy (with shader) and renderFlat? etc?
 
well, currently, it's selected purely based on the most derived type of the object.
but there's no reason that you could not change the selection logic.
what matters is that Player doesn't have to know shit about Renderer.
 
10:02 AM
Thankyou so much puppy.
I actully get this
 
and if you're desperate, Renderer doesn't have to know shit about Player either.
 
I really need to go now; thankyou very very much, you have no idea how long I have been struggling with this
I will read this discussion alot :)
Thankyou very mugh, g2g! :D
 
@cpx The only way to keep track of things is by dropping beepers and using recursion. Karel does not have variables :)
 
cpx
10:29 AM
@FredOverflow Using recursion sounds interesting. I was thinking about memorizing the directions you can possibly move to by using their (x,y) coords values.
 
How do you configure syntax highlighting in Sublime Text D:
 
View->Syntax->C++
Or just save the file in a specific format and it will automatically detect the language you're using
 
Ell
@Puppy the renderer has to know the camera position too though
Meh I have to go to work now
 
10:46 AM
I'm trying to add terms to be highlighted by Sublime Text for Rust
It doesn't highlight print! or println!
I don't know how to get it to
I'm in Rust.tmLanguage
 
user1804599
That's a question which should be asked at physics.stackexchange.com ;) — Dariusz Nov 4 at 12:50
 
user1804599
lol
 
11:05 AM
@Puppy patterns are not mad persay, it's the writing of code so that it fits the perfect example of the pattern that is bad. They should be used to help talk about the code, being able to say you are using a 'facade pattern' and having people know what that means really helps, compared to having to explain it each and every time.
 
@thecoshman iirc @Puppy also holds this opinion (according to one of his answers on programmers se)
but C++ is evolving away from that
 
user1804599
Patterns are a substitute for the lack of language features.
 
@StackedCrooked I think most of us here would agree that patterns are good for talking about how to write code, but bad if you try to stick too strongly to them.
@rightføld well, something like facade... I don't see how a language could implement that for you.
 
user1804599
what is facade
 
Besides, it's still nicer to say that this language provides a convenient way to do partttern X
@rightføld ffs, you are banned from talking about how bad patterns are if you don't know what they are.
 
11:11 AM
@thecoshman the word "pattern" implies kinda implies that
it's just a "pattern" not a prescription
 
user1804599
> A facade is an object that provides a simplified interface to a larger body of code, such as a class library.
 
user1804599
Ah, a wrapper.
 
A need for facade is not caused by lack of language feature.
 
user1804599
I don't see how that is a pattern.
 
user1804599
It's never implemented the same way twice.
 
user1804599
11:12 AM
There is no pattern there.
 
@StackedCrooked yes, but some people get it the wrong way around, the pattern matches the code you are writing, you don't write your code to match the pattern.
 
we know that :)
 
@rightføld it's (usually) object bar (the facade) has a hidden instance of an object foo
 
user1804599
Yes, a wrapper.
 
Note it's design patterns, not implementation patterns
 
user1804599
11:14 AM
Decorator pattern is incredibly useful for separating concerns, but now I have free functions and function composition hurray.
 
decorator = extra level of indirection
 
@rightføld yeah, it's a simple enough pattern, but it's used a lot. Some library offers you some shitty object which has functions that require a but tonne more stuff be passed to them, so you write a facade, maybe just for the few common functions that you actually want to use.
 
composite = tree
 
user1804599
I implemented the decorator pattern before I knew what the decorator pattern was.
 
user1804599
But the interface had like ten functions and I wanted to implement only one, but I had to provide forwarding implementations for all the other ones.
 
11:15 AM
yeah, took me a long time to understand what 'dependency injection' was, until I realised it basically boils down to 'pass shit you need into the constructor'
 
user1804599
Which is terrible boilerplate.
 
user1804599
Scala solves this with self types.
 
@rightføld sounds like a bad 'interface' if you 'have' to implement ten functions when you need only one to do shit. Especially as interfaces are easy to combine.
 
user1804599
Yes, it was a bad interface.
 
Good morning, gentlemen
 
11:17 AM
@StackedCrooked yes, but that doesn't mean patterns are bad, just like anything, applying them badly is bad.
 
user1804599
But even in good interfaces if you want to do decorator you have to write forwarding implementations for all functions.
 
well, with Java you could probably use reflection...
 
@rightføld I know. It's way too verbose.
 
user1804599
@thecoshman Except C++ and PHP. C++ and PHP are bad even when not applied badly.
 
user1804599
@thecoshman I prefer to have the class available at compile-time.
 
11:20 AM
also, you probably didn't want a decorator, you just wanted a facade. Decorator is usually for when you want to put some logic around an objects functions. ie, foo decorated to verboseLoggingFoo (where each function has logging of input parameters and output return values)
 
user1804599
No, I wanted decorator.
 
user1804599
Function took NodeInserter interface as argument and I passed it an instance of Neo4jNodeInserter but I also wanted to index the node into Solr, so I created a decorator IndexingNodeInserter that took NodeInserter in constructor and also implemented that interface.
 
user1804599
 
I think with decorator, you would normally allow the decorated objected to be directly accessed. something like decoratedFoo.getFoo() that way, your decorator just provides the extra logic you want on your foo object.
 
user1804599
No, of course not.
 
user1804599
11:24 AM
Why would you.
 
vOv it depends what exactly you want.
 
user1804599
You decorate it with extra logic.
 
user1804599
Which reminds me, I should decorate my room.
 
user1804599
There is little art here.
 
decorator is about providing extra logic for an object. That could... in theory... be done via a static function. Depends if you decorator needs to store some state... like if you wanted it to keep 'callCounts'
 
user1804599
11:25 AM
Also I want those fucking type hints in Python.
 
ITT @thecoshman is consultant for @rightføld
 
user1804599
I should be able to write a tool that takes a Python module with functions that have annotations and turn them into functions that throw exceptions when passed arguments of wrong type.
 
user1804599
@thecoshman eh, how can I do this with static function
 
Often when doing facades I do let the 'raw' object be retrieved, but that's mostly when I'm writing the facade for internal use. ie, I trust the user of it to only get the raw object when they need to..
 
user1804599
The whole point is that I 1) implement NodeInserter and 2) don't do anything with indexing in Neo4jNodeInserter as that's not its job.
 
11:27 AM
@rightføld Decorator::doLoggedCall(T toDecorate, ... args) it's not ideal, and probably not strictly speaking decorator.
 
user1804599
Oh that, lol.
 
again, depends what it is you want to be doing.
 
user1804599
You cannot generate classes at runtime in PHP except with eval, so I'd rather not do that.
 
I think with decorator, you're supposed to do something like Decorator::apply(T toDecorate) so that at runtime you can 'upgrade' an instance of T... it's not something I've used a lot though.
 
user1804599
That's called new Decorator(toDecorate).
 
11:31 AM
yeah, sure, if you want to use sane syntax :P
 
user1804599
Oh you mean upgrading the instance, not creating a new one? Because that's a horribly shitty terrible idea.
 
user1804599
I mean, mutability is bad, but replacing methods is just batshit insane.
 
no, the 'Decorator' type would store an instance of DecoratedType
 
user1804599
This was the usage:
 
user1804599
$nodeInserter = new Neo4jNodeInserter($neo4j);
$nodeInserter = new IndexingNodeInserter($nodeInserter, $solrClient);
 
11:33 AM
AFAIK decorator and facade are mostly the same implementation wise. Facade is aobut removing functions and decorator adding.
 

« first day (1485 days earlier)      last day (3465 days later) »