Reputation
2,770
Top tag
Next privilege 3,000 Rep.
Cast close & reopen votes
Badges
2 8 19
Newest
 Enthusiast
Impact
~80k people reached

Jun
28
revised Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
added 264 characters in body
Jun
28
answered Cleanest way to represent three states, where one can hold a Key/Value pair, and the other two are empty markers
Jun
28
comment Reading file during write on linux
I think the big difference between Linux and Windows is that Linux treats the file as separate from its file system entry. So you can unlink a filename while its open. Windows on the other hand delays the deletion until it gets closed. Does Linux allow the modification of running executable files? Or does it just allow deletion+recreation with different content?
Jun
28
comment How is a state machine different from any other computer program?
Sounds like turing tarpit. Just because it is possible to express any program like that, this doesn't mean it's a good form to model it like that. We're not computers, we need to reason about out programs, which for some programs works well when they're expressed as a state machine.
Jun
28
comment What's special about “non-blocking” node.js?
It isn't really special. You can use the same IO and threading model in other languages as well. The most special thing is that everything in node.js has been written with that model in mind whereas in other languages you have to carefully choose which libraries you're using.
Jun
27
comment Reading file during write on linux
You can choose to not lock files on Windows as well. I play half downloaded videos all the time. Locking is only required for loaded executables.
Jun
25
comment maintain rate of animation with requestAnimationFrame
Many games multiply movements by the elapsed time. Something like x += v*deltaT
Jun
25
comment Create new object or reset every property?
Can't really be answered without context.
Jun
22
comment Why is naming a table's Primary Key column “Id” considered bad practice?
This is occasionally the case, but in my experience it's pretty uncommon to have a nice unique immutable key. But even in your example you have a meaningless unique number to identify countries, just one that's allocated by ISO not by your database.
Jun
21
reviewed Approve Does Apple own any rights to software you create with their developer tools?
Jun
20
comment Would you create a specialized type just to wrap a primitive?
I misread the word "Speed" in the title.
Jun
14
comment How to write a test to cover a bugfix of a segfault
Is it possible to use something like @cython.boundscheck(not debug)? Or perhaps rather a @cython.boundscheck(optimize_boundscheck) which only set in debug builds?
Jun
11
comment What is a proper way to chain instructions if previous one is ok
For rare errors with no proper local response, apart from aborting the transaction, I'd use exceptions. (e.g. your database error)
Jun
11
comment How to pick a random move/action/element non-probabilistically?
@Qqwy You could just run a while longer, the probability of not finding anything drops exponentially (assuming your PRNG is good). Or you could switch to another search algorithm (enumerate all valid moves, then pick one or error out if there is none) in that rare case.
Jun
11
comment How to pick a random move/action/element non-probabilistically?
@Qqwy When playing a 'random' game, you wouldn't choose moves with equal probability, but you'll employ RAVE and various game dependent heuristics, e.g. "a move filling your own eye is unlikely to be correct".
Jun
11
comment How to pick a random move/action/element non-probabilistically?
A hybrid approach where you eliminate some points from the list (e.g those occupied by stones) and reject others once they're chosen is another possible choice.
Jun
11
comment How to pick a random move/action/element non-probabilistically?
@Qqwy AFAIK typical MCTS engines will use heuristics to choose move candidates with different probability. These heuristics will be more expensive to compute/update than merely tracking occupied points.
Jun
10
comment What's the best way to return an array as a response in a RESTful API?
Does that answer the question? I read it as "Should I use a json array or a json object as root?". Both can be parsed with json parsers, so your answer doesn't help them decide.
Jun
9
comment Are “plus” and “minus” appropriate method names?
sum sounds wrong in this context. I prefer .net's AddDays.
Jun
5
comment How to handle rating?
I'd store both the individual votes and the denormalized totals (and don't make the stackexchange mistake of storing only upvotes - downvotes instead of both).