1,905 reputation
615
bio website kdgregory.com
location
age
visits member for 3 years, 10 months
seen 21 hours ago

21h
comment Is there any harm in using amazon AWS as a development environment?
I use an EC2 instance for development in my current project, because it provides a known environment: I can control exact versions of frameworks and installed software, and I can ensure that my development machine config exactly matches production config. And I ensure that the configuration for one project does not "pollute" my laptop going into a new project. As a side benefit, I think working on EC2 with a scripted install gets you into the habit of "throw the old one away" whenever you change configs, rather than attempting to maintain a single system (and not knowing what it runs).
21h
comment Is there any harm in using amazon AWS as a development environment?
One additional bullet point: you will need to learn basic server security. If you expose your server to the open Internet, it will be pounded by crackerbots. Learn to use security groups to restrict access to specific IP addresses. And never enable password-based authentication or direct root login.
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
15
answered Turn on gzip on nginx, upstream (nodejs) or both?
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.
Jan
2
answered What is eventual consistency?
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
24
answered What'd be better? To add one more local variable, or to call a method twice in general case?