Reputation
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
7 15
Newest
 Yearling
Impact
~69k people reached

May
22
comment What is the functional programming answer to type-based invariants?
@BenAaronson: types are just conventions describing the use of data. In a language that provides classes and encapsulation, that convention is embedded in the class implementation. In a language that provides functions and simple collections, that convention is embedded in the function implementation. There's really no difference.
May
7
answered Legitimate cases of having .equals() behaving inconsistently with .compareTo()?
May
7
comment Legitimate cases of having .equals() behaving inconsistently with .compareTo()?
Thank you very much, @MichaelT. It's nice to see that an experienced programmer can answer that question. I wrote the comment, however, in the hope of getting the OP to think about the differences.
May
6
comment Legitimate cases of having .equals() behaving inconsistently with .compareTo()?
Why does it make sense for BigDecimal?
May
6
comment How does modulus work?
That said, I'd expect that a modern processor would implement in some form of logic array.
May
6
comment How does modulus work?
Long-division works the same way with binary numbers as it does with decimal. Try it, then think how you might code it (hint: you'll use a lot of shifts).
May
2
comment Is it possible to speed up a hash table by using binary search trees for separate chaining?
@Aviral - why are collisions happening? Do objects have the same hashcode, or are they going into the same bucket? If the latter, then pre-sizing your table to be much larger than needed may be appropriate. If the former, I suggest replacing your HashMap by a TreeMap and measuring the difference in performance. I think you might be surprised.
Apr
11
comment When there's no TCO, when to worry about blowing the stack?
@supercat - I'm not sure what your question is. The first point of this post is that the compiler can't know what the stack frame of all potential callees might look like (remember that the stack frame holds not just the function arguments but also its local variables). I suppose you could add an opcode that does a runtime check for compatible frames, but that brings me to the second part of the post: what's the real value?
Mar
25
awarded  Yearling
Feb
24
comment When to use a SortedMap interface?
You're expecting way too much from the type system. No matter how much you want to believe that types rigourously define behavior, it comes down to implementation by an ordinary human. In the case of Java interfaces, there's no pretense; the interface describes a contract, with luck that contract doesn't have too many corner cases, hopefully the people who implement classes based on that interface follow the contract without bugs, and the consumers of that interface use it in its intended manner.
Feb
19
comment Why html entity names for characters like ¥ € ¢ © ®
What if your <meta> tag lies, because your website admin doesn't know that you use UTF-8?
Feb
16
comment Using message queue systems - forcing synchronous processing
rabbitmq.com/tutorials/tutorial-six-php.html
Feb
2
comment Is a 1 < 10 comparison less expensive than 1 < 1000000?
Also, any actual implementation difference is going to be extremely architecture-specific, to the level of the micro-architecture. It's entirely possible that the microcode for Intel Sandy Bridge is different than that for Ivy Bridge, never mind that any arbitrary ARM chip is almost certainly different than an arbitrary Intel chip.
Feb
2
comment Is a 1 < 10 comparison less expensive than 1 < 1000000?
As edited, any difference in timing is almost certainly due to branch prediction, as @gnat said. However, this difference is likely to be infinitesimal, especially if measured in a high-level language running on a modern operating system. Are you actually seeing a difference, or is this a hypothetical question?
Jan
30
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).
Jan
30
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
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.