Preventing Java XML Parsers from resolving external DTDs
Posted by Kelvin on 07 Apr 2011 | Tagged as: programming
With some SAX parsers you can disable loading of external DTDs with this:
Not all do, however. Piccolo, for one, does not.
However, you can accomplish the same thing with this:
reader.setEntityResolver(new EntityResolver(){
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
return new InputSource(new StringReader(""));
}
});
10 things you should know about life at Google as an engineer
Posted by Kelvin on 30 Mar 2011 | Tagged as: programming
Slacy has a fantastic post about what Larry Page really needs to do to return Google to its startup roots, but what I really learnt about it, was what life at Google is like as an engineer.
If you're too lazy to read the article, here's the bullet points:
1. Lotsa meetings (duh)
2. Lotsa time spent compiling and fixing other people's code (for C++ devs)
3. Open-source software (or pretty much anything not invented at Google) frowned upon
4. Shitty cluster management system for scheduling jobs
5. Datacenter mayhem for deploying apps
6. If your product isn’t a billion-dollar idea, then it’s not worth Google’s time.
7. “unGoogly” system designs get shot down because they didn’t use Bigtable, GFS, Colossus, Spanner, MegaStore, BlobStore, or any of the other internal systems.
8. 20% time is a lie
9. Ignore the good ole 'Premature optimization is the root of all evil'
10. “Google Scale” is a myth (Google Search (the product) requires vast resources. Almost nothing else does, and yet is constrained and forced to run “at Google scale” when it’s completely unnecessary.)
Anything else you want to add to the list?
[SOLVED] Unknown initial character set index 'num' received from server
Posted by Kelvin on 13 Mar 2011 | Tagged as: programming
Recently when migrating from one server to another, my Java apps using an old version of Connector/J failed with this error:
Initial client character set can be forced via the 'characterEncoding' property.
No changes were made in the apps, so it had to do with MySQL.
The offending lines in my.cnf are
[mysqld]
character_set_server=utf8
collation_server=utf8_unicode_ci
Commenting them out fixes the problem.
[mysqld]
;character_set_server=utf8
;collation_server=utf8_unicode_ci
Great thread on Akka use cases
Posted by Kelvin on 08 Mar 2011 | Tagged as: programming
Akka is a Scala-based framework which promises "Simpler Scalability, Fault-Tolerance, Concurrency & Remoting through Actors"
SO has a great thread on use-cases for Akka here: http://stackoverflow.com/questions/4493001/good-use-case-for-akka
A clear-headed evaluation of MongoDB vs Redis, TokyoCabinet and BerkeleyDB
Posted by Kelvin on 01 Mar 2011 | Tagged as: programming
http://perfectmarket.com/blog/not_only_nosql_review_solution_evaluation_guide_chart has a lucid comparison of MongoDB, Redis, TokyoCabinet and BerkeleyDB.
What's nice about the evaluation is that it mentions what use-cases which solution is likely to be a good fit.
While we're on this topic, how about a recap of Brewer's CAP Theorem (pun intended)?
And to round things up, checkout this Visual Guide to NoSQL Systems
Recap: The Fallacies of Distributed Computing
Posted by Kelvin on 01 Mar 2011 | Tagged as: crawling, Lucene / Solr / Elastic Search / Nutch, programming
Just so no-one forgets, here's a recap of the Fallacies of Distributed Computing
1. The network is reliable.
2. Latency is zero.
3. Bandwidth is infinite.
4. The network is secure.
5. Topology doesn’t change.
6. There is one administrator.
7. Transport cost is zero.
8. The network is homogeneous.
Hide 'Uncategorized' category in WordPress
Posted by Kelvin on 26 Nov 2010 | Tagged as: programming
The solution to this is somewhat surprising. It doesn't involve any PHP code or modifications to functions.
It's a CSS declaration!
Change Redmine homepage to project page
Posted by Kelvin on 15 Oct 2010 | Tagged as: programming
Edit config/routes.rb
Change map.home to look like this:
How to copy a Subversion directory to another repo preserving revision history
Posted by Kelvin on 15 Oct 2010 | Tagged as: programming
svndumpfilter include path/to/docs path/to/anotherdir --drop-empty-revs --renumber-revs --preserve-revprops < ./repository.dump > ./docs_only.dump
svnadmin load /svn/new_repos < ./docs_only.dump
Courtesy of stackoverflow.
Note that the switches --drop-empty-revs --renumber-revs will change revision numbers. Omit these switches if preserving version numbers is important to you.
How to serve a Subversion repository from Apache
Posted by Kelvin on 14 Oct 2010 | Tagged as: programming
There are alot of tutorials out there on how to get Apache working with Subversion.
I think most coherent instructions can be found at http://csoft.net/docs/svndav.html.en
If you use Dreamhost like I do, and like the easy way in which subversions repos are setup, then you'll like what you see there.
