Friday, June 29, 2007

Google Analytics Fun

One of the new things I've been able to do with my new blog site is to add my own elements to the template (and Blogger makes this pretty darn easy to do).

This made it possible for me to add a script that Google Analytics uses to evaluate visits to my site. I can then go to the Analytics page and learn all sorts of things about how this blog is doing. Yes, this is pure narcissism, but it helps to know that somebody's listening.

I had a lot of fun zooming in finding out - OK, who visited from Europe -- drill down -- Northern Europe -- London -- hey, I know who that is, that's my little sister (or maybe it's her hubbie). Hi sis!

Thursday, June 28, 2007

Google Maps Are Now Draggable

TechCrunch announces a very cool new feature in Google Maps - you can now create your own routes or modify them using your mouse over the map. I'm sure I'll find an opportunity to use this soon.

Apache Proposes a Code of Conduct

Apache is proposing a code of conduct for email discussions. This seems like a big deal, and a great step forward. To me it's another sign that the Internet community is starting to wake up to the issue of online abuse.

Antidepressants are depressing me

I had a friend the other day who does not have any personality disorders, just a sucky childhood, and now and then he has bouts of depression. He said a number of friends were suggesting he get on medication.

I have another friend who has been diagnosed with mild bipolar symptoms. He is on an antidepressant. When I ask him how he's feeling, he usually says "I don't feel anything. I'm not happy, I'm not sad. I mostly feel a little disconnected."

True, he doesn't go into his binges of being excited about his latest project and flying into it with a passion, and then two weeks later falling into a depression. That's not a healthy way to live, and he needs help. But are antidepressants the solution? My concern is that the antidepressants are blocking his ability to feel anything, and this in turn prevents him from ever really healing himself. It's like living your life as a robot: safe, predictable, and ultimately pointless.

I'll be honest, I don't know very much about any of this. But sometimes you have to go with your intuition. Just as it doesn't feel right for all of us to be listening to music with little ear buds rather than getting together and singing and dancing as a community, it doesn't feel right for so many people to be on antidepressants. Now they're even putting kids on this stuff. Is this really the way we want to go?

I'm not saying that antidepressants aren't effective for the truly psychotic and troubled folks of the world (although there are some doctors committed to, and successfully treating, these folks without drugs). But that's a minority. These new drugs are being taken by everyone, and are being prescribed matter-of-factly whenever a patient tells their family doctor they sleep a lot and want to isolate and feel depressed.

I know there are different opinions and lots of facts supporting the effectiveness of antidepressants. To be honest, I'm not interested in that. I'm just saying, it doesn't feel right, it bothers me, and I believe there must be a better way...

Wednesday, June 27, 2007

Quick Link: Using an Exercise Ball as a Chair

I just hurt my back, and this looks pretty interesting. I might give it a try.

Quick Link: Lijit - A Quick Personalized Search Engine

Very fun to set up, and it looks useful. You tell it your blog and other places you hang out, and it generates a personalized search engine. The idea is you get much more relevant searches. Try it out, it's quite easy to set up.

Quick Link: A Veggie-Oil Powered Recycled Computer Cluster

The Alameda County Computer Resource Center is just down the street from me, and they do great things with recycled computer parts, including building a veggie-oil powered supercomputer.

Quick Tip: Making code readable in Blogger

My last post included some source code, and I really struggled how to make this look readable.

I use NetBeans, and I checked, and sure enough, there is an option to export a source file or a selection of source to HTML ("File->Print to HTML..." in NetBeans 6).

This takes care of all those nasty less-than / greater-than conversions. It also sets up some styles and applies those styles to the code, so you get readable code through color-coding.

The trick is, NetBeans generates this as a complete HTML page. But I want to embed this in an existing page. This worked generally, but the styles were lost.

After some thought, what I did was edit the HTML for my template, and then added the styles at the top of the NetBeans generated page to the styles for the template. And voila, I have nice, color-coded source code that is a simple cut-and-paste from NetBeans.

Blogging delicious links

I've really been enjoying Simon Phipp's delicious bookmarks. Its actually one of my favorite feeds.

I like this much better than the "daily links" approach, where I have to open the blog and read them all together. I usually don't bother to open "daily links" blog entries, because the majority of the time there's nothing there of interest for me. With a blog per link, I can quickly scan and pick the ones I like.

That got me thinking, wouldn't it be nice if I could simply tag a link with a quick comment, and have it show up automatically in my Blogger/Blogspot blog? I'm not a big linker, I don't do tens a day, so it shouldn't overwhelm my readers...

Well, delicious doesn't support this capability. But with a little work, I was able to use their APIs and the Google Blogger/GData APIs to accomplish this. And I thought I'd share the code with you. You could probably pretty easily convert this to using other blog platform APIs.

With this in place, now when I want to do a quick blog of an interesting link, just tag it with "blogthis" and run this program. I can run it once for each tag, once a day, or even less frequently. Once all the posts have been blogged, the tag is renamed to "blogged" so that I don't keep blogging the same posts.

There is some preparatory work needed before you can compile and run the code I show below.

First, you need to download the Java client libraries for both the Delicious API and the Google Data APIs. The Delicious API was incredibly simple to navigate; the GData APIs not so. Somehow their documentation is just lightweight and obtuse enough to leave you scratching your head. Maybe they want to use it for interview tests :). Anyway, I finally made my way through and got something working.

Next, you need to get all of the dependent jar files. Ye gods, there are a lot of them. Here they are:

The delicious Java client requires
Then the Google Data client library requires
Finally, you need to get the id for your Blogger blog. To do this, simply go to your blog, view the HTML source, and look for this line:

<rel="" href="">

The href attribute is what you use as the postURL for Google Data.

I am using the ClientLogin mode of authentication with Google Data. This mode says it may reject the authentication request and ask for a Captcha response. I didn't want to deal with this, and you can register a particular machine to no longer need Captcha. Since this is for your personal use, this seems a reasonable thing to do. For more information on ClientLogin authentication, see this page.

OK, whew, with that taken care of, here is the fairly simple code to suck down delicious posts tagged with "blogthis" and posting them to my blog.

Make sure
you replace the placeholders for the delicious username and password, Blogger username and password, and the postURL.


import java.util.List;

public class Main {

public static void main(String[] args) {
try {
Delicious deli = new Delicious("your-delicious-userid", "your-delicious-password");

List<Post> posts = deli.getPostsForTag("blogthis");

for ( Post post : posts ) {
System.out.println("Blogging post: " + post.getDescription());

deli.renameTag("blogthis", "blogged");
System.out.println("All delicious posts blogged");
} catch ( Throwable e ) {

private static void blogPost(Post post) throws Exception {
// authenticate

GoogleService service = new GoogleService("blogger",
service.setUserCredentials("", "your-google-password");

// build entry
URL postURL =
new URL("");

Entry entry = new Entry();
entry.setTitle(new PlainTextConstruct("Quick Link: " + post.getDescription()));

StringBuffer buf = new StringBuffer();
if ( post.getExtended() != null ) {

buf.append("<a href=\"" + post.getHref() + "\">" + post.getHref() + "</a>");

entry.setContent(new PlainTextConstruct(buf.toString()));

// Set the label for the entry

Category category = new Category();

// post entry
service.insert(postURL, entry);


Moving here

I'm moving my technology blogging here, to consolidate and to make use of some of the flexibility of this blogging platform vs. Movable Type, which really is pretty limited.

I just wrote a cool little utility that pulls all my delicious links labeled "blogthis" and automatically posts them to this blog with the "quicklink" label. When I get a chance, I'll post how I did this, I think it's pretty darn useful and it took some time to figure out.

Talk to you later!

Quick Link: How to Label Posts via the Blogger API

A nice little post from uberdose (whoever he is) showing how to set the type field in your blog when using the Google Blogger API