- How to make a good ID in Atom [dive into mark]
Creating useful / good ID elements in Atom feeds.
(categories: id atom feed feeds syndication rss )
All posts by ajohnson
Java ZipEntry bug on Windows
I rolled out the Clearfox plugin on the Jive Software Community site a couple weeks ago and got some good feedback and some bad feedback. A number of people said they tried to install the Firefox part of the plugin, restarted Firefox and then didn’t see the Clearspace icon like my screenshots / screencast showed. There were no errors in the Clearspace error logs and no errors showed up in the Firefox JavaScript debug console. Through the help of a couple customers, I was able to narrow it down to running Clearspace on Windows: for some reason the zip file (really the XPI file) that the Clearfox plugin creates on the fly was invalid, at least according to Firefox. If you opened the XPI file using any common zip file utility the contents appeared to fine. As always, google came to the rescue and pointed me to this bug filed on bugs.sun.com, which has two parts. The Unicode file name bug didn’t matter to me, but this one did:
Within a ZIP file, pathnames use the forward slash / as separator, as required by the ZIP spec. This requires a conversion from or to the local file.separator on systems like Windows. The API (ZipEntry) does not take care of the transformation, and the need for the programmer to deal with it is not documented.
which wouldn’t hurt so much if it hadn’t been filed back in… get this… 1999. Are you kidding me?
Anyway, long story short: if you’re writing Java, creating a zip file that has paths while on a Windows based machine and deploying said zip file to a place that actually cares about the zip file specification (or violates Postel’s Law), then make sure to do something like this in your Java code:
String zipFilePath = file.getPath();
if (File.separatorChar != '/') {
zipFilePath = zipFilePath.replace('\\', '/');
}
ZipEntry zipAdd = new ZipEntry(zipFilePath);
noting that even the workaround they give in the aforementioned bug is incorrect because they show
... file.getName();
which doesn’t contain the path separators. Awesome.
Java, Commons HTTP Client and HTTP proxies
If you’re living at a giant corporation during the day and you want to browse the web you’re probably going through some sort of proxy to the outside world. Most of the time you don’t care, but if you’re writing a Java application that needs to access resources on the other side of said proxy (ie: the rest of the world), you’ll eventually end up over here. That wonderful document will hook you up with all your need to know about setting the proxy host, port and optionally a username and password for your proxy as long as you’re using URLConnection, HttpURLConnection or anything that deals with the class URL. If you’re really a go-getter you might even browse over here and read all about how to utilize those properties on the command line, in code or when you’re deployed inside of Tomcat.
Some of you won’t be so lucky: you’ll eventually want to use some advanced tools that abstract you away from having to fetch InputStreams to get your feeds and will instead depend on the Commons HTTP Client, which unfortunately (or fortunately depending on your point of view), doesn’t care about those nice little system properties that java.net.URL likes and instead goes off and uses sockets directly. No, instead you have to do something like this:
HttpClient client = new HttpClient();
HttpConnectionManager conManager = client.getHttpConnectionManager();
client.getHostConfiguration().setProxy("proxyserver.example.com", 8080);
and if you want to provide a username and password for said proxy:
HttpState state = new HttpState();
state.setProxyCredentials(null, null,
new UsernamePasswordCredentials("username", "password"));
client.setState(state);
which is all fine and dandy but sometimes I just wish the world were simpler. Ya know?
Links: 11-13-2007
- Java HTTP Proxy Settings « Information for Technology
HTTP proxy configuration settings for Tomcat / Java.
(categories: java tomcat proxy configuration proxyhost proxyport ) - todd: Google Android SDK released
A nice summary of the Android SDK feature set.
(categories: android google sdk java ) - com.google.android.xmppService – Android
Android does XMPP. Sweet.
(categories: google android mobile xmpp )
Links: 11-9-2007
- Jumpcut – Blue Angel # 5 low pass
If you’ve never seen the Blue Angels or the Thunderbirds… you’re just missing out.
(categories: blueangels aviation military planes videos video ) - Costco Trade-In and Recycle Program – Service Provided by GreenSight
Costco does consumer electronics recycling and in some cases will even give you trade-in cash.
(categories: costco recycling hotdogsmmmmmm )
Books, the last 12 months
It’s been almost exactly a year since I last pointed to my reading list, turns out I’ve read about 30 books in the last 12 months, highlighted by seven in the month of July (mom-in-law got me a gift certificate to Barnes & Noble for my birthday so I splurged and then read them all in quick succession). Here’s the list in reverse chronological order with no spacing:
The World Is Flat A Rumor of War The Ghost Map The End of Poverty The Design of Everyday Things Purple Cow: Transform Your Business by Being Remarkable
Small Things Considered: Why There Is No Perfect Design The Soul Of A New Machine The Last Night of the Yankee Dynasty: The Game, the Team, and the Cost of Greatness Seven Seconds or Less: My Season on the Bench with the Runnin’ and Gunnin’ Phoenix Suns The Teammates: A Portrait of a Friendship Stiff: The Curious Lives of Human Cadavers Mountains Beyond Mountains: Healing the World: The Quest of Dr. Paul Farmer Collapse: How Societies Choose to Fail or Succeed Acts of Faith Traveling Mercies Founders at Work: Stories of Startups’ Early Days Micro-ISV: From Vision To Reality To End All Wars SR-71 Revealed: The Inside Story The Architecture of Happiness Don’t Think of an Elephant: Know Your Values and Frame the Debate The Scandal of the Evangelical Mind Skunk Works: A Personal Memoir of My Years of Lockheed Next Crossing the Chasm The Man Who Shocked the World: The Life and Legacy of Stanley Milgram Clemente: The Passion and Grace of Baseball’s Last Hero This Beautiful Mess Love Me, Hate Me: Barry Bonds and the Making of an Antihero
I haven’t come across many new books lately (I keep my to-read list at Amazon and my have-read list here) so ping me (ajohnson@cephas.net) if you’ve read something cool lately.
Links: 10-25-2007
- Upgrading to Prototype 1.6: real world examples
Illustrates some of the diffs betwen 1.6 and 1.5 API.
(categories: prototype javascript )
Links: 10-19-2007
Links: 10-12-2007
- Dare Obasanjo aka Carnage4Life – Improving Website Usability with A/B Testing
Using controlled experiments (i.e. A/B testing) to improve the usability of a website.
(categories: experiments experimentation research testing ui usability a/b analytics ) - Open – Code – New York Times Blog
From the about: “A blog about open source technology at The New York Times, written by and primarily for developers. This includes our own projects, our work with open-source technologies at nytimes.com, and other interesting topics in the open source and
(categories: opensource nytimes.com cool nyt blogs development code ) - The Active Community | Active.com
A very nicely themed Clearspace community.
(categories: clearspace active.com community communities )
Links: 10-10-2007
- Working Backwards – All Things Distributed
Quote: “… start with your customer and work your way backwards until you get to the minimum set of technology requirements to satisfy what you try to achieve. The goal is to drive simplicity through a continuous, explicit customer focus.”
(categories: amazon wernervogels design marketing agile process development ) - Well-formed data | Elastic lists
Very cool combination of infoviz and browsing.
(categories: classification data filtering information navigation visualization ) - The Institutional Yes: The HBR Interview with Jeff Bezos
Quote: “… But I very rarely get asked “What?s not going to change in the next five to ten years?? At Amazon we?re always trying to figure that out, because you can really spin up flywheels around those things.”
(categories: amazon bezos business strategy ) - UnintentionalObjectRetention: WideFinder and Java
An attempted implementation of WideFinder in Java.
(categories: java parallelization threading threads widefinder ) - How well do you know prototype: part I
Good list of ways you can use really make use of Prototype.
(categories: prototype javascript tips )