1,890 reputation
615
bio website kdgregory.com
location
age
visits member for 3 years, 10 months
seen Jan 22 at 0:04

Jan
22
comment On a linux/rails app what tools would one use to have a write once record set
If you can write it, you can overwrite it. Before thinking of implementation, you should think about what particular cases of overwriting you're trying to avoid.
Jan
21
comment Determine exact coordinates for a map image?
I don't know why the closers chose "too broad," but in my opinion the question remains unclear. Even with your edit, I still don't know whether you're trying to place markers on an image that contains a blank map or something else. Your comment about knowing the lat/lon for an image is particularly strange: if you create the image, you should already know what it represents. I suggest a complete rewrite of the question, in which you paste pictures and description of what you want to do at each step. Also be very clear about what you already have and what you want to achieve.
Jan
20
comment Why sacrificing good software engineering practices is typically the first choice for software development projects assuming “good enough” quality
@David - or (3) say no. And yes, I've done it. And no, it never resulted in me being fired.
Jan
20
comment Scaling locks in high concurrency web apps
"This scenario" is actually many different scenarios, with many different solutions. From your description, it seems that your locks are long-lived, which requires completely different solutions than short-lived locks ("long-lived" for me is anything over a millisecond, it sounds like you're dealing with seconds or even minutes if you've turned to a database). To give a reasonable answer, we would need to know the actual use case that you're trying to solve.
Jan
18
comment Determine exact coordinates for a map image?
It's unclear what you're asking. If you want to plot lat/lon on a flat plane, then yes, projection is important. The standard "schoolroom" projection is Mercator, and the Wikipedia article gives you all the math you need.
Jan
18
comment Minimizing database requests for moves of a chess game?
If you somehow think that you can load all possible moves in one query -- or even store them in a database -- it ain't gonna happen.
Jan
18
comment Minimizing database requests for moves of a chess game?
Or are you simply looking for a way to uniquely identify each move (ie, the database key)? If that's the case, then you need to represent the state of the board. One approach would be to use a row-wise traversal that identifies each piece on the board, something like "A8BRB8BK...H1WR" (I combine piece name and location because that takes a maximum of 128 characters but will decrease as the game proceeds; you could also use a fixed-size format with just the piece names, taking 128 characters for each move).
Jan
18
comment Minimizing database requests for moves of a chess game?
What are you really trying to accomplish? The website that you linked maintains statistics about sequences of moves, and lets you navigate those moves. Given that navigation takes human-scale time, there's no reason to care about 40 database reads: the time they take is immaterial.
Jan
3
comment What does “business logic” actually mean if not “all non-3rd party code”?
If you order more than $50 you get free cheese-encrusted breadsticks.
Dec
30
comment What is different between the internal design of Java and C++ that lets C++ have multiple inheritance?
... which is why Java has distinct invokevirtual and invokeinterface operations (as well as several other forms of method invocation).
Dec
30
comment What is different between the internal design of Java and C++ that lets C++ have multiple inheritance?
@DVK - it's extremely difficult to give you an appropriate answer to this question. The trivial answer is that, because Java uses dynamic dispatch, there is nothing physically standing in the way of supporting multiple inheritance. However, it's unclear whether you understand how dynamic dispatch works (even though you mention v-tables), so a real answer would need to expand on how the compiler translates a method call into an indirect lookup. Or, at the other end, there are performance implications depending on the ordering of methods ...
Dec
30
comment What is different between the internal design of Java and C++ that lets C++ have multiple inheritance?
One could even say that Java is vtables all the way down.
Dec
26
comment Algorithm to merge two sorted arrays with minimum number of comparisons
You could create some adaptive algorithm that attempts to use a merge size > 1, but that isn't going to get you significant savings. A better solution is to map the source arrays into a form that is inexpensive to sort. This, however, depends on your actual situation (and neither of your examples would justify it).
Dec
24
comment What'd be better? To add one more local variable, or to call a method twice in general case?
@Doval - Yes IO is a side-effect. In my original edit I only had two points, but then thought that someone would be sure to call me out on volatile reads. That said, I think that it's important to understand and recognize the difference between what I'll call "active" and "passive" side-effects: the former are caused by your action, the latter are caused by external action. In my experience, most concurrency bugs are a result of the latter, not the former.
Dec
24
comment What'd be better? To add one more local variable, or to call a method twice in general case?
@BartvanIngenSchenau - I always find that profiling leads to more dramatic code restructuring than simply introducing a variable.
Dec
23
comment Disadvantages of Pointers
For whatever reason, the chat page thinks that I'm not logged in. So to respond to your earlier comment, I've updated the tag wiki to give a better explanation of what a "pointer" is.
Dec
18
comment Why can't the Scala compiler give pattern matching warning for nonsealed classes/traits?
It's unclear what you're asking. Do you want the compiler to emit a warning if the match expression doesn't cover all possible inputs? Perhaps an example would make your question more clear.
Dec
9
comment Using reflection vs creating a new class
Are you able to reflect on the Egg to determine what components it contains?
Dec
8
comment Caching build results
Does sbt do what you want? And if not, why not? You might have to modify your build to create actual JARs for your sub-projects. But yes, the dependency management problem has been solved.
Dec
6
comment Distributing a set of “Jobs” across multiple computers
You would probably find Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions by Gregor Hohpe and Bobby Woolf useful. In their terminology, you use a Splitter to distribute work and an Aggregator to assemble the results. Specific implementations of those patterns, however, are completely dependent on your requirements -- to use maple_shaft's term, it's a data store of some sort.