Perhaps not. I’ve commented in the past about the effects that P2P networks have upon the ISP traffic topologies (timing, upstream/downstream biases etc.) and we all know they can be used to illegally share copyrighted files. However, I strongly believe that P2P applications are the prototype for the next generation of highly resilient and scalable internet applications. In my former job as a telecomms researcher at TSSG we came up with quite a novel approach to integrating active networking and peer-2-peer apps at the top of the stack. I’m not sure what became of that work but my faith in the technology hasn’t waivered.
I guess that’s why I was so fascinated by the following post on boing-boing about 2 Princeton researchers who’ve cooked up a P2P app in 15 lines of concise Python code. The original post is located on Ed Felton’s blog. It was damn funny to see someone hack up a Perl version in 9 lines. Without disrespect, the python implementation is more legible but the Perl code wins my “tight code” Award for 2004. Matthew Scala has a well used styrofoam cup with an strategicaly embedded 1/2 fried 2Mb Dimm (circa 1993) winging its way to him at this very moment. Enjoy! What a prize and what a hack 😀
Month: December 2004
As old as a chinese brewery
Would be very old indeed if a recent article in Scientific American is to be believed. It appears that proof has been found that Chinese villagers brewed alcoholic beverages more than 9000 years ago. A technique known as mass spectrometry was used by researchers at the Pennsylvanian Museum of Archaelogy to detect tartaric acid (a bi-product of grape fermentation) on shards of pottery that dated from around 7000 BC. The tests revealed that:
“13 of the 16 remnants came from containers that had held the same liquid, a “mixed fermented beverage of rice, honey and a fruit”
.
While I’m at it here’s a informative extract from that well known organisation The Amercian Society for Mass Spectrometry.
“Mass spectrometry is a powerful analytical technique that is used to identify unknown compounds, to quantify known compounds, and to elucidate the structure and chemical properties of molecules. Detection of compounds can be accomplished with very minute quantities (as little as 10-12g, 10-15 moles for a compound of mass 1000 Daltons). This means that compounds can be identified at very low concentrations (one part in 1012) in chemically complex mixtures. Mass spectrometry provides valuable information to a wide range of professionals: physicians, astonomers, and biologists, to name a few.”
So that explains that then! Actually it’s a very interesting website and I recommend people to take a look.
The Law of Empty Plenty
I’ve discovered a new law which seems to govern most of human desire and explains a great deal about many social interactions. It’s kinda ironic too! I call it Shane’s law of Empty Plenty and it goes like this
Past a threshold of desire the probability of obtaining something that you want appears to be inversely proportional to your desire for it. The greater the desire the less chance there is of successfully realising it.
Or in other words “it often seems that you can have an unlimited amount of what you don’t really want”. I’m sure some readers will think this is nonsense but I believe it just may be true. The semantics are more subtle than it first appears. Many of us are familiar with something difficult suddenly becoming easier when we stop caring so much about it. Be it study, work, relationships etc. It’s not that the thing itself has become any less complex but we’ve given our minds the chance to see with clarity as opposed to being clouded by desire. We work ourselves into a state over many different things and become incapable of objectivity. Other careers become exciting and fantastically lucrative, everything would be OK if you could persuade Mr/Miss X that they love you etc…. It’s quite possible that there are more realistic alternatives that may be just as good but they are mostly overlooked as they don’t seem so attractive. It often seems that there are a limitless amount of these not-quite-so-perfect opportunities around us but we don’t act on them. Unfortunately it’s only hindsight and often bitter experience that helps us to refocus.
The Gaisan regular expression toolkit
If you want to match URL’s reliably without creating a regexp monster so big that you need to connect up the digital projector just so you can work on it then this is something tasty I’ve come up with. Demonstrated in java, my language of choice
Pattern urlPattern = Pattern.compile("(((URL:|url:|http:|htt:)\\/\\/)|www\\.)(((([A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9]"+
"|[A-Za-z0-9])\\.)*([a-zA-Z][A-Za-z0-9-]*[A-Za-z0-9]|[a-zA-Z]))|([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+))"+
"(:[0-9]+)?(\\/([a-zA-Z0-9$_.+!*'(,);:@&=\\~\\#-]|%[0-9A-Fa-f][0-9A-Fa-f])*(\\/([a-zA-Z0-9$_.+!*'(,)"+
";:@&=\\~\\#-]|%[0-9A-Fa-f][0-9A-Fa-f])*)*(\\?([a-zA-Z0-9$_.+!*'(,);:@&=\\~\\#-]|%[0-9A-Fa-f][0-9A-Fa-f])*)?)?)";
Matcher urlMatcher = urlPattern.matcher("http://streamserver.gaisan.com/ourapplication?sd=234324&cam=1");
boolean matches2 = m2.matches();
System.out.println("Match should be true:\t" + urlMatcher.matches());