Dan's blog

Delicious Feed Broken? Delicious Changed Its Domain Name

Dan's picture

I ran into an issue recently where Delicous links weren't being updated as expected. It turned out sometime in August 2010 Delicious switched from using http://delicious.com/ to http://www.delicious.com/

I fixed my problem by changing the Views filter from http://delicious.com to http://www.delicious.com

Most changes should be as easy as that.

"Coders at Work"

Dan's picture
Tags:

I know the development community at large has been pretty enamored with the recently released book "Coders at Work" by Peter Seibel and I'm pretty sure the tech team at EchoDitto is tired of hearing me go on about it. So now that I've finally finished it, I'll say my piece and move on.

We Still Love You Drupal

Dan's picture

Drupal is now being used to power WhiteHouse.gov. I came across a criticism of the decision.
While Drupal certainly is not without its flaws the criticisms offered simply don't hold.

1) Drupal knows best - First off this simply isn't true. One can easily setup permissions to allow for the use of JavaScript, by default, it prevents regular users from using JavaScript and that is a good thing.

2) Drupal is impenetrable - I think the button labeled "Create Content" is pretty clear. In the first argument the complaint is that I can't put code in, the second argument I CAN put code in. Getting simple pages up for people who aren't web savvy is one thing Drupal does very well.

3) Drupal hates change - The upgrade process for Drupal could certainly use some improvement but I'm sure the White House has competent technical staff on hand who can upgrade without a snag.

4) Drupal is disorganized - In this complaint there is a link to a module that remedies the problem. Problem solved!

5) Drupal is righteous - Again this would be a valid complaint were the White House website run by a volunteer on weekend who had not used Drupal in the past. I'm sure the technical staff at the White House knows what they are doing and it doesn't take 45 minutes to figure out how to upload a photo.

6) Regarding Recovery.gov - "The site originally used Drupal but soon hired a private contractor—at a reported cost of $18 million—to rework the site." This sounds like a strong case FOR using Drupal.

Free Zip Code Database Import

Dan's picture

When you need a zip code database for the US you should get it from here
http://www.free-zipcodes.com/
But you shouldn't spend time trying to install all the required perl (sigh) libs needed to import it into MySQL.
Simply create the table structure

CREATE TABLE zipcodes (
       zipcode INT NOT NULL PRIMARY KEY,
       latitude FLOAT(10,8),
       longitude FLOAT(10,8),
       state VARCHAR(2),
       city VARCHAR(128),
       county VARCHAR(128)
);

Then fire up Sequel Pro. File-> Import. Set "Fields terminated by" to || and uncheck "First line contains fields names."

As a bonus Sequel Pro supports ssh tunneling out of the box so you can do it directly to firewalled DBs.

As always make sure you back up your DB first incase of failure.

Safari Flash Cache

Dan's picture

If you are having trouble getting rid of a stale .swf with Safari
open ~/Library/Caches/Metadata/Safari/History/
Delete files at will then clear the Safari cache and reload.

UPDATE:
I found iPurge Safari Cache

Which does the trick!

PDF Forms

Dan's picture
Tags:

One of our clients has a simple enough request. They wanted a PDF form to be populated in with a set of values gathered from a web form. We decided to settle on xfdf as a method to do this.

I wasn't familiar with xfdf, but was pleased to discover it is an easy format.

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve">
<fields>
  <field name="firstname">
    <value>Dan</value>
  </field>
  <field name="lastname">
    <value>Cocos</value>
  </field>
  <field name="email">
    <value>dan@echoditto.com</value>
  </field>
</fields>
<f href="example.pdf"/>
</xfdf>

Now that the xfdf problem was solved we had to move on next to adding the fields to the PDF. We were unable to find suitable PHP libraries to handle it. Luckily there is a free and open source Java* library iText that does all of this and more.
Miles an EchoDitto intern took the first crack at it and had a working example in no time. A little bit of code clean up and voila a short while later a working tool to merge form data into a PDF.

*There is also a C# port for those so inclined.

Legacy Compatibility: Why The Site Never Looks Exactly Like It Does in the Design

Dan's picture
Tags:

I have high hopes for when the web approaches the phase of dumping backwards compatibility. This phase, when it happens, won't be a single flip of the switch but I imagine will be close to the slow, slow move to IPv6. As everyone knows backward compatibly while often important can also put a real stranglehold on progress. This example cannot be made more clear than see how dropping legacy compatibility helped transform Mac OS 9 to Mac OS X. Even Microsoft is getting the idea and Windows 7 appears to be doing the same. This doesn't mean it won't be without without hiccups, the crutch used by both OS X and Windows is a virtual machine that allows you run legacy code until you can move everything else forward.

I feel the HTML has gotten to the point where the legacy support has become a burden to progress. There are several places where this is evident. Where hacks have been applied to work around fundamentalmentally different uses than what was expected.

The first strong example of this is cookies. HTTP is a stateless protocol, yet when doing something like making an online purchase or maintaining a shopping cart state is very important, this led to cookies in 1994. While the model works, it was created as an innovative solution to the stateless problem it isn't perfect and has problems.

The second place this is really prominent is page layout.
<--[if lte IE 6]>
<link rel="stylesheet" type="text/css" href="http://echodittolabs.org/ie_hacks.css" />
<![endif]-->
Is an example of backwards compatibility code. Couple this with large dynamic sites and Ajax and not only will your site not look like the cut ups from the designers it may not function anymore.