@gwowen also, I should've mentioned that you can click next to the voting buttons on a post and click the "View raw" option; that'll show the markdown that the poster used. If you see anything in a post that you're not sure how they did it, you can use it to find out.
To be fair, most Dwarf Fortress embarks start with Urist McMiner, Urist McCarpenter, Urist McWoodCutter, Urist McMason, Urist McJeweler, Urist McFisher, and Urist McClothesMaker.
That's seven dwarves, although generally you don't get Urist McDonald until much later in the game unless you're unlucky and the king dies and one of your starting seven was their son or daughter or something.
When compiling programs that use the BGL, be sure to compile with optimization.
Why would it be important to enable optimization when compiling programs that use the library? How the heck are you supposed to debug code that uses it? I can understand turning on opt for speed, but the way it's written makes me think they need it for correctness, which is totally crazy.
I guess it's not for correctness, as it is for practical usability. When every character of source code translates into 200 lines of code with 20 nested function calls, you either enable inlining and monomorphization, or end up with hello world that takes 20 seconds to execute and leaves behind 200MB object files
I bet it's a matter of time before someone points out your first conditional and branch is redundant given the second conditional and its branch.
Hush you! I was just trying to keep the code simple while still providing an example of where there was only one conditional statement in the parentheses, which is a case in which I am okay with there being no spaces within or around the parentheses.
And that, kids, is why distinguishing nullable references from non-nullable ones in the type system is a good thing.
I don't see how that would actually affect this. If I understand the code correctly it's attempting to retrieve the member from a service of some kind. Which means that you would have to always have a nullable reference returned from that method, since you could be attempting to retrieve an object that isn't there. The only reason I assume the code says that it should never happen is that the author of the code either assumed that nothing would remove the member between calls, or was assuming some sort of transactional guarantee that is no longer true.
Which is why the error should be a custom exception type, with a description of what's actually wrong. Everything is wrong with the branch of logic that throws this exception.
@aliceif That's up there with the errors you can get in Java when you start really messing around with classloaders; things like (paraphrased) “can't call method; expected class a.b.c.Foo but found class a.b.c.Foo”. The first time you see those things, you totally go but the key is that classes in the JVM aren't just distinguished by name, despite what the errors say…
In my first example, the beetle is even created externally. It is requested.
In my second example, the beetle is explicitly created by the parent.
In neither case should the beetle be injected.
In your case, you should probably inject a factory.
public class Beetle
private SingletonService _service;
public Beetle(SingletonService service)
_service = service;
public class BeetleFactory
private SingletonService _service;
public BeetleFactory(SingletonService service)
_service = service;
public Beetle MakeBeetle()
return new Beetle(_service);
public class CreatorClass
private BeetleFactory _factory;
public CreatorClass(BeetleFactory factory)
_factory = factory;
public void DoStuff()
var beetle = _factory.GetBeetle();
// at composition root
var mainObject = IoC.Resolve<CreatorClass>();
Which makes me wonder: I should really check to see if it still fucks the Task Manager reporting of the current clock speed. Last time I enabled it on my laptop and it claimed I magically got almost triple the GHz...
Why does the idea of parsing an error message to fix it sound familiar... oh, I did that once...
Database-sourced errors in general are nasty to deal with. Entity Framework, for example, just tosses you a SqlException and it's up to you to unwrap all the inner exceptions and cross-reference the magic error numbers to find out what exactly the problem is - whether you've violated a PK, a check constraint, or just had the DB crap itself in a myriad of possible vendor-specific ways.
@dkf That's the thing where my brain went "looks OK-ish to me, but not egregious enough to scream ". That's as far as I got though, been ages since I learned German and I wasn't particularly good even then...
@blakeyrat I forget you haven't seen the lounge thread about this where I explain how much of a mess the code base is.
If disk space actually ran out, it would fail much earlier in the process than my recent changes would, in fact pretty much everything would grind to a halt long before my code. We have a code base, even before you factor the PHP evil into it.
@dkf The complaints you raised sound like something someone would do in PHP is what I meant:
PHP cannot overload methods
PHP functions do this return shit a lot. Like, strpos, given how similar it is to C you'd expect 0 or positive integer if substring found, -1 if not found. Nope! It's boolean FALSE in case it's not found. Many functions do this.
@Tsaukpaetra As long as the service they're supposed to provide is OK, who cares about how ugly their UI is? It's not like it's something that most users need; the people who want that sort of service tend to prefer a no-BS get-shit-done interface.
Leave the anti-parallax scrolling BS for the hipster websites…