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

2d
comment is there a way/tool to find braces in a line of code that are alone and do not close?
Pretty-printing is a very useful technique. Mechanical techniques such as matching opening and closing braces aren't that useful because there's always a match somewhere.
2d
comment Why don't open source projects pay more attention to backward compatibility
You would probably be better served by posting your actual problem over at SO. It surprises me that Maven, at least, would have backwards-compatibility issues -- I'm still running Maven 2 build scripts that I wrote 6-7 years ago.
Jun
27
comment Strategy for writing a scalable chat server in Java
There are many different ways to scale, and which one you pick will depend on your requirements. Which, as a "newbie" programmer, you probably don't know yet, even if you think your do. I recommend building something simple, with a socket per thread, see how it behaves with a few hundred users, and then change your implementation as needed.
Jun
26
comment Is Logger.getLogger(MyClass.class) the best way to initialise log4j loggers?
That said, I prefer loggers as instance variables rather than class variables, so eliminate the static keyword and replace Foo.class with getClass().
Jun
26
comment Is Logger.getLogger(MyClass.class) the best way to initialise log4j loggers?
What do you find verbose about this (setting aside Java's syntax)?. You have to create a variable to hold the logger, and you have to tell getLogger() the name of the logger to get.
Jun
13
comment Expectations on a programmer too high?
That said, it's entirely possible that you're applying to positions that you're not qualified for, or are being hired by managers who are unable to tell that you don't have the qualifications they need (recruiters also fall into this bucket). In that case, the best advice that I have is to take a long, hard look at yourself, identify the one or two things that you do well (at 23, don't fall into the trap of considering yourself expert at anything), and focus on finding a job that lets you exercise and improve those skills.
Jun
13
comment Expectations on a programmer too high?
@Mothermole1: "Again, the expectation is, 'I can find someone cheaper[...]": my one word of advice is to not judge yourself by others expectations, especially expectations that drive a race to the bottom.
Jun
10
comment Explicit DAG instead of Vector Clocks for synchronisation
Yeah, my understanding of vector clocks is that they're intended simply for an accept/reject decision: "node C is trying to update this piece of data, but it isn't aware of node B's update".
Jun
10
comment Explicit DAG instead of Vector Clocks for synchronisation
I may be misunderstanding what you're saying, but it's unclear how a graph of all events leading to a state could be smaller than a vector of counters. Unless you're in a system that has an extremely large number of nodes and an extremely small number of changes.
May
22
comment What is the functional programming answer to type-based invariants?
In your example, a 2-tuple is a Fraction only if it was produced by one of the "fraction" functions (or, as a more relaxed definition, can be used by them). Otherwise it's just a 2-tuple, with no special meaning.
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
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?
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