About Jeffrey Barke

Web worker

What’s happening with XFN?

Continuing a review of those “things” that end up in the head of our documents and proceed to nest there indefinitely, I ran across the XFN profile. This immediately made me wonder, what’s up with XFN?

I tweeted the following, but didn’t get a response: “Other than @WordPress, does anyone do anything with #xfn anymore? Most of the @microformats XFN implementation links are dead.” Since the #lazyweb didn’t pull through for me, this blog post is the result. As a bonus, I also review what XFN is and how to use it. Hopefully, maybe, this will generate enough good karma that someone knowledgeable will leave a comment below and fill me in.

tl;dr: XFN is an awesome concept that’s easy to implement, but probably not worth even that small amount of time, energy and bandwidth due to a lack of consuming services or apps.

What is XFN?

XFN is a way to represent human relationships by using the rel attribute of hyperlinks with a controlled vocabulary.1 It’s the “original” microformat, and was introduced in December 2003 by GMPG2 at a time when blogging was going mainstream and blogrolls were increasing popular.1

Why it’s awesome

XFN was about the social graph a year before Facebook was even launched. The concept:

XFN puts a human face on linking. As more people have come online and begun to form social networks, services such as Technorati and Feedster have arisen in an attempt to show how the various nodes are connected. Such services are useful for discovering the mechanical connections between nodes, but they do not uncover the human relationships between the people responsible for the nodes.3

On the practical side, the great thing about XFN is that it’s really easy to do. First, add the XFN profile to the head element of your document: <link rel="profile" href="http://gmpg.org/xfn/11">. Then add one or more of the values from the “XFN quick reference” table to the rel attribute of the a element.4

XFN quick reference
Relationship category XFN values
Friendship (at most one): friend, acquaintance, contact
Physical: met
Professional: co-worker, colleague
Geographical (at most one): co-resident, neighborhodd
Family (at most one): child, parent, sibling, spouse, kin
Romantic: muse, crush, date, sweetheart
Identity: me

But…

Does even this little bit of effort and bandwidth make sense?

The Google Social Graph API is gone. Most of the “new” implementations on the “XFN Implementions” page of Microformats.org are dead. The GMPG’s “XFN: What’s Out There?” page includes a notice that “WordPress has shipped release 1.0 with user friendly support for XFN!” Yikes! WordPress 1.0 was released in January 2004!

And the litany doesn’t stop. The Operator add-on for Firefox hasn’t been updated since 2010. I think Technorati may have used the XFN data once, but Technorati… Oh, Technorati…

Is anyone actually consuming, mapping or using the XFN data that’s out there? It doesn’t seem like it.

References

  1. GMPG. (2003). “XHTML Friends Network.” Retrieved 23 April 2013, from http://gmpg.org/xfn/
  2. XHTML Friends Network. (n.d.). In Wikipedia. Retrieved 23 April 2013, from http://en.wikipedia.org/wiki/XHTML_Friends_Network
  3. GMPG. (2003). “XFN: Introduction and Examples.” Retrieved 23 April 2013, from http://gmpg.org/xfn/intro
  4. GMPG. (2003). “XFN: Getting Started” Retrieved 23 April 2013, from http://gmpg.org/xfn/join

Learn more

The best way to learn more about XFN and how to use it is to read the GMPG material cited in the “References” section above. Microformats.org also has a lot of material (unsurprisingly, see the “PS FYI” below) on XFN under http://microformats.org/wiki/xfn.

Chris Messina wrote a really interesting post, “Portable contact lists and the case against XFN,” in 2008. This might seem a bit old, but since the majority of the XFN stuff is from 2004ish…

PS FYI

GMPG was founded in March 2003 by Tantek Çelik, Eric Meyer and Matthew Mullenweg after they met at SXSW. Tantek Çelik would later introduce and define the term microformats and Matthew Mullenweg is the creator of WordPress.

Track link and download clicks in Google Analytics

By default, Google Analytics (GA) only tracks page views for the pages the GA tracking code is installed on (complicated, I know). It doesn’t track interactions with the page or content that cannot include or evaluate JavaScript. This came up because I was curious to know how many people were clicking on the zip of my current weather widget for WordPress. I knew GA could be scripted to track interactions with a page relatively easily, but I couldn’t remember how.

A quick Google search later, I found some documentation and a script to dynamically add link tracking from Blast Analytics & Marketing. I liked the concept of the script, but (like every coder) there were a couple of things I wanted to change. While doing that, I thought of a couple more, and, the next thing I knew, I had several variations on a theme (all of which are available on GitHub).

To use, choose one of the files below and add it to the page/site you want to track via the standard script element (near the foot of the document is probably best). As of 19 April 2013, it requires jQuery 1.7+ to run, but I’m working on a pure JS implementation.

ga-click-tracking-events.js

This is probably the version most people will want to use. It tracks clicks as events for the following link types:

  • External links (Different host than current site or marked rel="external")
  • File links (Executables, zip archives, PDFs, etc.)
  • Email links (mailto:)
  • Telephone links (tel:)

Tracked clicks will show up in Google Analytics under “Content” > “Events” in the following ways:

Event Category
External, email and telephone links will all have the category “Link clicks.” File links will have the category “Downloads.”
Event Action
External, email and telephone links are all labeled as such. File links are labeled with the file extension plus “download.” For instance, PDF download.
Event Label
External links are labeled with the URL of the link. File links are labeled with the file name. Email links are labeled with the email address of the link, and telephone links are labeled with the telephone number of the link.

Get ga-click-tracking-events.js on GitHub

ga-click-tracking-events-pages.js

This version is for people who want to inflate their pageviews! It’s very similar to ga-click-tracking-events.js, except PDF and text documents are not tracked as events, they are tracked as pageviews. (Note: Google recommends using event tracking, not virtual pageviews.)

The event tracking is the same as above, but clicks on PDF and text documents will show up in Google Analytics under “Content” > “Site Content” as pages. The page path is artificial. It’s constructed from the file extension plus the file name, for instance /PDF/PDF-file-name.pdf.

Get ga-click-tracking-events-pages.js on GitHub

ga-click-tracking-downloads.js

This is a stripped-down version of ga-click-tracking-events.js that only tracks clicks on file links as events. This is the version for people who don’t care about tracking clicks on external, email and telephone links because, really? create some new content instead. ;)

Get ga-click-tracking-downloads.js on GitHub

Cyber Intelligence Sharing and Protection Act (CISPA)

What it is

The Cyber Intelligence Sharing and Protection Act (CISPA) is a proposed American law that would permit the sharing of Internet traffic information between the U.S. government and certain technology and manufacturing companies. The purpose of the bill is to help the U.S. government investigate cyber thread and ensure the security of networks against cyberattack.1

The legislation was introduced to the House of Representatives as H.R. 3523 by U.S. Representative Mike Rogers (R-MI) on 30 November 2011 and was passed on 26 April 2012 (248-168). It failed to become law when it did not pass the Senate in the same session. Representative Rogers reintroduced it to the House on 12 February 2013 as H.R. 624.1

Why you should care

tl;dr: Security! Privacy! If you think the security benefits outweigh the privacy concerns, you are pro. If you don’t, you are anti.

CISPA has had both bipartisan support and bipartisan dissent in the House of Representatives.2 Facebook and Microsoft initially supported the legislation, but have since backed away due to privacy concerns,3 and privacy concerns are the crux of the matter.

CISPA’s goal, to promote intelligence-sharing between private companies and government agencies, is laudable, however the bill is vague about what information on cyber-threats can be shared.4 Groups like the Electronic Frontier Foundation and the American Civil Liberties Union want to see additional limits “on how and when the government may monitor a private individual’s internet browsing information. Additionally, they fear that such new powers could be used to spy on the general public rather than to pursue malicious hackers.”1

What you can do

The best thing to do is contact your House Representative by phone or tweet at them to let them know how you feel.

The ACLU, along with other groups, launched the “Stop Cyber Spying Week” campaign this past Monday.

More information

References

  1. Wikipedia. (n.d.). “Cyber Intelligence Sharing and Protection Act.” Retrieved on 17 April 2013.
  2. Tsukayama, Hayley. (27 April 2012). “CISPA: Who’s for it, who’s against it and how it could affect you.” Retrieved on 17 April 2013.
  3. McCullagh, Declan. (14 March 2013). “Facebook unfriends CISPA cybersecurity bill over ‘privacy’” Retrieved on 17 April 2013.
  4. The Economist. (17 April 2013). “From SOPA to CISPA.” Retrieved on 17 April 2013.

Current weather widget for WordPress

A simple sidebar widget that displays the current weather for a user-defined city. Powered by the OpenWeatherMap API.

The design has been deliberately kept simple. The current weather widget should match the default text of any theme, but can easily be customized by any web developer. It was built and tested on WP 3.5.x, but will probably work on earlier versions of WordPress.

Installation

  1. Download the zip file and extract the contents.
  2. Upload the current-weather-widget folder to the /wp-content/plugins/ directory.
  3. Log into WordPress, navigate to the “Plugins” page and active the plugin.
  4. Navigate to “Appearance” > “Widgets” and drag the widget to the sidebar.
  5. Set the city, country and units from the widget’s setting menu.

Screenshots

Widget admin options.

Widget admin options.

Widget in the sidebar of a “Twenty Twelve”-themed vanilla install of WordPress.

Widget in the sidebar of a “Twenty Twelve”-themed vanilla install of WordPress.

Widget in the sidebar of a “Twenty Eleven”-themed vanilla install of WordPress.

Widget in the sidebar of a “Twenty Eleven”-themed vanilla install of WordPress.

Changelog

0.0.1

  • Initial release

Download

Download version 0.0.1 (zip)

Some obsolete meta element values

Technically, some obsolete meta element http-equiv and name attribute values, but…

meta http-equiv values

content-language

Defines the default language of the page. Use the lang attribute on the body element instead. More info
content-type

Defines the MIME type of the document followed by its character set. Since only an HTML document (not XHTML) can use the content-type, most of this information is redundant. Use the charset attribute of the meta element instead. More info
imagetoolbar
Switch to disable a feature (a toolbar that appears when hovering over an image) that is only present in Internet Explorer 6. Acceptable content values include: false or no. More info

meta name values

MSSmartTagsPreventParsing
Switch to disable a feature (smart tags) that only appeared in beta versions of Internet Explorer 6. Acceptable content values include: true and false. More info

For a complete(?) list of meta values, try this gist.

CodeIgniter encryption key generator updated

My apologies. I don’t think I’ve looked at it since I posted it back in 2011, but since it’s still the most popular post on this site (and still getting comments), I updated the CodeIgniter encryption key generator. The update was based on feedback from the original post, and I’ll address a few of the comments here.

On 30 July 2012, 123kerala asked if the source code was available. It both was and it wasn’t. The code to generate the key is very simple and is basically Andrew Johnson’s genToken function. The actual code on the CI encryption key generator page is now available as a Gist.

On 20 January 2013, ataub2qf mentioned that the CodeIgniter user guide specifies that a “key should be as random a string as you can concoct, with numbers and uppercase and lowercase letters,” but that my generator included non-alphanumeric characters. This is a good point! The updated CI key generator is now alphanumeric only.

Geo NYC: Mapping the Environment

Live notes from Geo NYC’s 8 April 2013 meetup, “Mapping the Environment.”

For April’s meetup we’re highlighting innovative ways maps can help us build a more sustainable, understandable, and livable world. The line-up is amazing, inspiring, awesome. You’ll leave wanting to hug a tree, or a whale, or each other. Promise.

The Twitter hashtag is geonyc.

Update 24 April 2013: Embedded videos from OpenGeo’s Vimeo feed.

Update 16 April 2013: Embedded slides.

7:30 pm, starting now. Heading around the room, introducing ourselves.

7:46 pm, announcements:

7:50 pm, presentation time! Each presentation should last ten minutes; I’ll update this post after each talk.

8:29 pm, announcements:

  • OSM Editathon. 20–21 April. OpenPlans. Alyssa Wright & Liz Barry.
  • Rethinking Regulation Design Challenge. 20 April. OpenPlans. Noan Sheroff & Frank Hebbert.
  • Next GeoNYC meetup: 13 May

8:31 pm, general question and answer session. My notes have been moved into the relevant presenter’s section.

8:45 pm, wrap. Open chat time.

where things come from

Leonardo Bonanni
Sourcemap

Founder and CEO of Sourcemap, which is a crowdsourced directory dedicated to answering the question: where do things come from?

It’s a complicated answer. One of the chips in an iPhone uses almost every element in the periodic table (except for the radioactive ones).

How do you find out where things come from and what impacts they could have? Even more interesting when you map it. Sourcemap is a public resource to answer these questions.

In 2009, thing to do seemed to be local everything. Visitors can calculate the carbon footprint of a product using Sourcemap. In addition, can compare different supply chains to see equivalent carbon footprints.

Turns out, companies have no idea where there products come from. So Sourcemap went one step further. Can now crowdmap the entire supply chain. Ten years ago, impossible for a company to know where everything came from. Now, can use Facebook, Usahidi and get that info on Sourcemap.

People who contribute are “supply-chain citizens.” Their stories embedded in video feeds on the map.

New York Public Library’s old computers ended up in a café in Ghana.

Since companies want to know where things come from and want to tell people where things come from, Sourcemap became a company. As a company, they providing information to managers to help mitigate the effects of global climate change.

They’re hiring!

Q: How does Sourcemap.com validate data?
A: Doesn’t do anything to data. If touch any of it, liable for all of it. As long as poster doesn’t break TOS.
Q: Sourcemap.com have an API?
A: Yes!

GeoScript

Ilya Rosenfeld
OpenGeo

From Vimeo

GeoScript is a library for processing of spatial data.

Several implementations for different scripting environments: Python, Groovy, JavaScript, Scala and Ruby. Python and Groovy most fully implemented.

Utilizes GeoTools under the hood. Basically, GeoScript exposes GeoTools through scripting languages for rapid development.

Why GeoScript?

  • Easy to learn
  • Simple to use
  • Familiar spatial metaphors
  • Choice of a scripting language
  • Versatile products
  • Evolving, free and open source

Succinctness is power.—Paul Graham. Author of Hackers and Painters.

Spatial metaphors and API

  • Geometry
  • Feature
  • Workspace
  • Filter
  • Layer
  • Style
  • Map
  • Projection
  • Function
  • Process

[Mr. Rosenfeld provides some code examples to show how simple and powerful GeoScript is. See his blog post, “GeoScript in Action: Part One” for a nice demo/tutorial.]

Green Map

Wendy Brawer and Thomas Turnbull
GreenMap

From Vimeo

Local NYC green map since 1992. In 1995 launched the Green Map System. Now covers 852 cities in 65 countries.

The Green Maps are about mapping sustainability.

Long time emphasis on paper maps; the Green Map archives are now housed at the New York Public Library.

Green Map currently includes 170 symbols, which can be downloaded.

Green Map works with community groups, NGOs, student groups, etc. They develop workshop and engagement tools in addition to their mapping tools.

In 2007, Thomas Turnbull from Google joined them to help develop technology tools.

Open Green Map (OGM)

  • Lowers technological and financial barriers to online mapping
  • Increase participation: Eight language interface

The Cape Town project used a mix of online and paper maps.

However, Green Map has discovered that their platform is too rigid. Next incarnation will use map as a verb and separate data storage from mapping tools with APIs defined with public standards.

OGM was built on Drupal (MySQL database server). While good for a prototype, Green Map sees limitations now. Drupal has bound presentation and storage closely, and they need to decouple.

They’d like to know: If starting from scratch, what is the best database for spatial data?

Prioritizing Street Tree Planting: Theory & Method

Peter Tiso
NYC Parks & Recreation

From Vimeo

Plant 17,000–23,000 trees per year, which is one tree every two minutes during a working day in the planting season.

Previous prioritization (Fall 2007):

  • Population density
  • Street tree Stocking Level
  • Public Health Neighborhoods (to address asthma)

Simple design fostered community understanding. However, eventually maps became outdated.

2011, new prioritization:

  • Retain simple design
  • 2010 census data
  • LiDAR-derived data

Two-tier system developed by USDA Forest Service. Preferable (tier 1) and possible (tier 2).

Tier 1 based on 2010 Census Neighborhood Tabulation Areas.

Tier 2 based on 2010 census tracts and includes the following variables:

  • Low street tree stocking level
  • More tree requests (from 311)
  • More tree removals

With new prioritization, some of the areas remained from 2007, but some new areas emerged.

The results of this method have been guiding the last several seasons of street tree planting. Prioritization is not a hard rule; simply tells foresters where to look first.

Method can be easily redone with new data.

Shameless plug time: Seven-class land-cover raster available from nycopendata.socrata.com.

Q: Has asthma gone down since tree planting?
A: No way to redo original study. Cannot tell if tree plantings have reduced asthma. In the future, might be able to measure particulate count and compare over time.
Q: When defining parameters, how do you determine weights?
A: Collaborative; Parks & Rec worked with another agency. Tier 1 common to both missions. Tier 2 parks specific. Allowed other agency to have their own tier 2 specific.
Q: When does Parks & Rec rethink parameters?
A: Not on set schedule. When maps become less useful. This is determined when foresters come back to us and tell us.
Q: How much do you take into account citizen need?
A: Use 311 for requests. 2007 map set years on map. First thing thrown out. 2011, didn’t set years. Map is purely advisory; guides forester search.
Q: How do you factor in new development? Such as when developers plant trees.
A: Taken into account when data is updated. Don’t update maps every season.
Q: Possible to combine Parks & Rec data with Sourcemap.com?
A: NYC Parks & Rec able to provide source information for all plantings.

Leaflet: Web Maps for Better Cities

Aaron Ogle
OpenPlans

From Vimeo

Tool of choice for JavaScript mapping is Leaflet.

Leaflet:

  • Simplicity: What you get is simple and works well. No projection support
  • Performance: Targets fast, contemporary browsers
  • Usability: Lightweight footprint and ready to work out of the box

Leaflet at OpenPlans

Shareabouts: platform for crowd sourcing data about places. PostgreSQL backend. Have done several projects (for different bicycling groups) that are powered by Shareabouts.

Argo: Working with government client with a lot of geo data (GeoJSON). Client wanted to make own maps, but didn’t want to write code.

Argo let them construct and style maps using WordPress-style type admin and existing geoJSON.

Browser-based cost-distance calculations: https://github.com/atogle/walkshed.js

Cisco AnyConnect VPN Client reverts hosts file

While working on localhost yesterday, I noticed that changes I’d make to the hosts file kept getting reverted. The hosts file wasn’t getting completely reset, only the most recent changes I’d made were lost. I’ve never had this problem before, so I thought, “What am I doing different today?” The only thing I could think of: using Cisco’s AnyConnect VPN client to connect to my work computer.

After it happened again this morning, I did a quick Google search for “cisco anyconnect resets hosts files.” Turns out AnyConnect is the problem. To solve it, you need to edit both hosts and hosts.ac. I agree with ANewBite: “Why AC generates another hosts file is either beyond my comprehension or really stupid.”

References

Local development environment

This post was last updated on 22 August 2011.

Related to my recent “restart,” I want to talk a little bit about my local development environment. I apologize; this is kind of a long, boring post that is basically “listy.” However, I both wanted to document the things that I have, don’t have and do and share them with other developers. I’m also very interested in hearing about other developers’ local environments.

My new computer is a 15-inch MacBook Pro running Snow Leopard (10.6.8) with a 2 GHz processor and 4 GB of RAM.

The core of my local development environment is MAMP (2.0.1), which includes:

  • Apache 2.0.63
  • MySQL 5.1.44
  • PHP 5.2.13 & 5.3.2
  • APC 3.1.3
  • eAccelerator 0.9.6
  • XCache 1.2.2 & 1.3.0
  • phpMyAdmin 3.2.5
  • Zend Optimizer 3.3.9
  • SQLiteManager 1.2.4
  • Freetype 2.3.9
  • t1lib 5.1.2
  • curl 7.20.0
  • jpeg 8
  • libpng-1.2.42
  • gd 2.0.34
  • libxml 2.7.6
  • libxslt 1.1.26
  • gettext 0.17
  • libidn 1.15
  • iconv 1.13
  • mcrypt 2.6.8
  • YAZ 4.0.1 & PHP/YAZ 1.0.14

In the next few days, I plan to revisit the previous how-tos I’ve written on MAMP to see if they’re still valid.

TextMate (1.5.10 (1631)) is my text editor of choice and I use Transmit (4.17) as an FTP client.

Subversion is the VCS I use for all of my sites, and it turns out the MacBook Pro (either) comes with (or was installed with the developer tools) Subversion 1.6.26 and Git 1.7.3.4. Since I use both from the command line, I haven’t installed a GUI for either.

My primary browser for development purposes is still Firefox (I know, I know… So old-fashioned! :p). I have version 6.0 installed and I use the following extensions:

For testing/development, I also have Chrome 13.0.782.215, Safari 5.1 and Opera 11.50 installed. All ship with good developer tools, so I haven’t installed any extensions for any of them.

I have the latest version of the following browser plugins installed:

  • Flash
  • Java
  • QuickTime
  • Silverlight

On my previous laptop (also a MacBook Pro), I was running Parallels with four virtual machines installed:

  • Windows XP with Internet Explorer (IE) 6 and various old versions of other browsers.
  • Windows Vista with IE 7 and various old versions of other browsers.
  • Windows 7 with IE 9 and various new versions of other browsers.
  • Ubuntu. Primarily to test Konqueror. (I did a job for the BBC and they require it. Srsly!)

At the moment, I haz none. :(

I also don’t have a graphics editor (or, at least a good one I know about) installed. I’m debating whether I should install GIMP or just shell out for Photoshop. And there’s no diagramming software installed either (I used to run Omnigraffle).

As I change my local development environment (or, in the event I forgot anything!), I plan to update this post. If you have any comments about my setup or would like to share your environment (either a long “post” in the comments or a link in the comments to a post on your blog), I’d love to hear them/about it!