Patrick Garvin: Blog

If “X-Files” characters had Tinder

July 13th, 2015

Last week, Fox launched “201 Days of ‘The X-Files’,” a social media campaign aimed at getting fans of “The X-Files” excited about the new miniseries. The premise of the campaign is that if you started watching one episode of the show last Tuesday, you’d be caught up on all 201 episodes by the Jan. 24 premiere.

I’ve already binged all the episodes, an experience I wrote about for The Boston Globe.

If you do decide to binge, though, you’ll find that the world we live in now is very different from what is depicted in the show.

Many have people have asked what a modern, post-9/11 “X-Files” would look like, but no one has asked the most important question of all:

What would our favorite X-Files characters’ Tinder profiles look like?

—–

—–

—–

—–

—–

—–

—–

—–

—–

Share

We can be “Heroes”: To Chris Ewen and T.T.’s, with love

July 10th, 2015

On a recent Saturday in June, attendees of the “Heroes” dance night at T.T. the Bear’s Place in Cambridge paused to sing “Happy Birthday” to Chris Ewen, who has DJed the weekly dance night since he created it 2005. Ewen, onstage with hostess Xtine, was visibly moved. He thanked the fans for their years of support, and before he headed back to the DJ booth, he implored everyone to go to the back to get some cake.

Tomorrow night, Ewen steps into the DJ booth at T.T.’s for the last time. It will be the last “Heroes” at the vaunted Cambridge establishment, which is closing at the end of the month. “Heroes” will temporarily move to Brighton Music Hall for some dates before it settles into its as-of-now undetermined new home.

I had never been to a dance night where the DJ interacted with the crowd in such a way, and I certainly had never been to a dance night where cake was served. No club night has ever struck me as this personal or familiar.

But “Heroes” is a unique night, even in Cambridge’s Central Square, where “no one is weird because everyone is weird” is a way of life. “Heroes” stood out because of its diverse crowd and its diverse playlist. You could see preppy guys in collared shirts or long-haired Goths in all black, and they’d all dance to The Pointer Sisters and Nine Inch Nails. All together. “Heroes” has long been a family of misfit toys, with Ewen as its unassuming and humble patriarch.

It was a night for fans who appreciated music. That sounds like an obvious statement about a dance night, but Ewen’s years as a music fan showed through. He is not afraid to play deep cuts or transition from one song to one of a completely different genre. Having been his friend, I’ve enjoyed hearing him talk about transitions and beats per minutes. (If you ever get a chance to meet him, ask him about Pulp’s “Common People.”) He is a DJ’s DJ, and more than once, I’ve bumped into other DJs at “Heroes.”

Beyond making a cool place for DJs to watch a master, Ewen created a home for people who wouldn’t necessarily have a club night otherwise. It was gay-friendly without playing boots-cats-boots-cats remixes of top 40 hits. It was not an ’80s night, even though the music skews heavily toward that decade.

With the closure of T.T.’s and the relocation of “Heroes,” Central Square loses more than a great dance night. It loses a piece of its history and part of its charm. Other dance nights will pop up and can be good.

But how many of those dance nights will inspire you to take a break from dancing so you can sing “Happy Birthday” to the DJ?

Share

Beyond the rainbow: Other LGBTQ flags (and communities)

July 6th, 2015

The rainbow is no stranger to gay pride celebrations. It is as natural to the LGBTQ rights movement as the pink triangle, as inevitable a symbol to be seen at parades, festivals and rallies as red T-shirts and black armbands.

But when the rainbow came in social media form, it was previously associated with self-identified LGBTQ individuals and organizations, more likely to be seen in the gay districts and liberal enclaves of big cities or universities.

The rainbow has come to the mainstream, to corporations, to LGBTQ allies, and, well, everywhere.

Within hours of the US Supreme Court’s landmark decision granting same-sex couples the right to marry nationwide, Facebook unveiled a previously internal-only tool that allowed users to apply a rainbow filter over their profile picture. The filter, inspired by the pride flag hanging over Facebook’s campus to mark Pride Month, had been developed by two Facebook interns over a 72-hour hackathon. In the following weekend, more than 26 million Facebook users applied the filter to their profile picture.

I’ve not seen any data on whether those users were LGBTQ or were allies, whether they were showing pride in the Supreme Court decision or showing support for the myriad couples now able to get married, or all of the above. I know that personally, in my Facebook feed, most of the users with a rainbow profile picture were indeed straight, cisgender allies, making the phenomenon that much more noteworthy and that much more overwhelming.

Much has already been written about the rainbow-fied profile pictures. Some have speculated that the tool was another experiment to gather information on its users. Others have lamented that changing one’s profile picture has zero effect on anything and amounts to nothing more than self-righteous attaboy backslapping. And gay reporter/writer Peter Moskowitz said the use of rainbow profile pictures was an appropriation that cheapened the struggles of the gay rights movement. As Moskowitz wrote:

I’ve earned the right to claim pride through years of internal strife over my sexuality. Others have died in the name of gay pride. More still have been jailed, have been disowned by their families, and have sued their state governments for it. Gay pride is not something you can claim by waving a flag. The rainbow symbol is easy to co-opt, but the experience it represents is not.

That’s why it wasn’t comforting to see hundreds of my Facebook friends’ profile pictures draped in rainbows. It didn’t feel like they were understanding my struggle; it felt like they were cheapening it, celebrating a victory they had no part in winning.

Some of the rainbow-colored faces were people I would never talk to about being gay – a relative with conservative politics, high school buddies I didn’t come out to because I feared losing their friendships. They weren’t necessarily homophobic, but they weren’t great allies either. They didn’t march during pride celebrations; they didn’t participate in the “day of silence”; they didn’t even bother to inquire about my life. If they were true allies to me or the LGBT community, where were they before Friday?

Moskowitz’s Washington Post piece has been widely circulated, and resonated with many in the LGBTQ community. I didn’t share Moskowitz’s sentiments, though I did feel more than a twinge of sadness.

I thought of a gay friend I had who passed away a few years ago. He died of natural causes, but had attempted suicide years earlier, when he had been a lonely, alienated high school student. He felt isolated and alone at his high school because he was gay. With my late friend in mind, I did not see the profile pictures as an appropriation or as an attempt to jump on a bandwagon. Instead, I saw them as the digital equivalent of the “safe space” stickers I used to see around campus when I was in college. I saw the profile pictures as a way for straight, cisgender people to indicate they were supportive of their friends.

That said, however cynical Moskowitz’s take might seem, he does invite us to look at the history of the rainbow flag and other LGBTQ banners whose storied background many of us didn’t understand before the flood of profile pictures a few weeks ago.

Gilbert Baker first created the Rainbow Flag after Harvey Milk asked Baker to make a flag for a march he was organizing. The rainbow seemed a natural symbol, as it had been associated with the gay rights movement ever since the Stonewall Riots in 1969, which coincided with the week of Judy Garland’s death. The first flag, made in 1978, had eight colors:

hot pink, red, orange, yellow, green, turquoise, indigo/blue and violet — but it gradually lost its stripes until it became the six-color version most commonly used today. Each of the colors has its own significance, he says: hot pink for sex, red for life, orange for healing, yellow for sunlight, green for nature, turquoise for art, indigo for harmony and violet for spirit.

The flag lost its hot pink stripe when Baker approached the Paramount Flag Company to begin mass producing them – the hot pink fabric was too rare and expensive to include. The flag lost its indigo stripe before the 1979 Gay Freedom Day Parade. The committee organizing the parade wanted to split the flag in half and fly each part from the light poles along both sides of Market Street, so it became a six-striped flag.

The rainbow flag is the most commonly known flag associated with LGBTQ issues, but certainly isn’t the only one. It’s not even the only one that you can overlay on your profile picture.

Michael Page created the bisexual pride flag (above) in 1998 to represent bisexual people at Pride rallies. Page’s reasoning for his design:

The pink color represents sexual attraction to the same sex only (gay and lesbian), the blue represents sexual attraction to the opposite sex only (straight) and the resultant overlap color purple represents sexual attraction to both sexes (bi). The key to understanding the symbolism in the Bi Pride Flag is to know that the purple pixels of color blend unnoticeably into both the pink and blue, just as in the ‘real world’ where bi people blend unnoticeably into both the gay/lesbian and straight communities.

You can even overlay the bisexual pride flag onto your Facebook profile.

Monica Helms, a transgender woman, a created the transgender pride flag (above) in 1999. The reasoning for her design:

The stripes at the top and bottom are light blue, the traditional color for baby boys. The stripes next to them are pink, the traditional color for baby girls. The stripe in the middle is white, for those who are intersex, transitioning or consider themselves having a neutral or undefined gender. The pattern is such that no matter which way you fly it, it is always correct, signifying us finding correctness in our lives.

You can even overlay the transgender pride flag onto your Facebook profile.

The International Bear Brotherhood Flag (above) was introduced by Craig Byrnes in early 1996 to represent bears, “a term for rugged gay men who often exhibit body hair and can be heavyset (though this isn’t always the case).” A similar but different flag had been designed by Steve Heyl and Jim Maxwell in early 1992.

Of course, these are but a few of the flags associated with communities within the LGBTQ movement. There are many other flags.

The rainbow flag, which may or may not have just experienced its “tipping point,” has become the most well-known flag associated with gay rights. If you hadn’t seen it before two weeks ago, you’ve certainly seen it now.

Will the other flags be as ubiquitous?

LGBTQ advocates have long said that same-sex marriage was but one of many issues affecting the community. Transgender issues have gained more visibility in the mainstream press, for a variety of reasons. Laverne Cox was featured on the cover of TIME and Caitlin Jenner appeared on the cover of Vanity Fair. Islan Nettles’s murder and Leelah Acorn’s suicides have highlighted the threats and pressures facing the transgender community, especially transgender women and and transgender women of color.

Share

How spreadsheets can make journalists’ jobs easier and projects better

May 17th, 2015

In a recent blog post about journalists using technology to make their lives and jobs easier, I mentioned that one of the ways I’ve made my job easier and more efficient has been to rely heavily on spreadsheets. I use spreadsheets to make color-coded maps, to update my gay marriage map/timeline, to help reporters and editors update projects on their own, and to easily organize my own interactive projects. I even use spreadsheets when making simple charts in Illustrator. Not just for the data, but adding the labels.

When we think of spreadsheets, it’s easy for us to think of them in terms of numbers: daily history of the Dow, changes in gas prices, budgets from fiscal year to fiscal year.

These are fine uses for spreadsheets, as we know, but we can use them for so much more than numbers and charts. We can, and should, be using them to help organize and execute a variety of alternative story forms, and not just things we know will visually be presented as grids. Some examples:

  • Series of bio boxes
  • Q&As
  • Timelines
  • Photo galleries
  • Map locations and associated text blocks
  • Step-by-step process explainers

And those are just some of the examples.

There are several reasons to use spreadsheets:

  • Shared Google spreadsheets mean that everyone can collaborate and edit a spreadsheet, rather than having to walk over to someone and dictate a change (or having to be the guy to whom all those changes are dictated).
  • This eliminates people making fixes by just sending body copy in an e-mail. If you send an e-mail, you don’t know if the manager of the spreadsheet has gotten around to updating it. But if you can go in there yourself, you know the change has been made.
  • By keeping the content in one Google spreadsheet doc that you can share on the cloud, you eliminate having multiple files that could confuse everyone. You know which file to use, because there’s only one, rather than ones called “version2,” “version2NEW,” “version2USETHIS.”
  • If everyone can see what’s on the spreadsheet from the beginning, it opens up communication and can potentially prevent problems later.
  • Having a spreadsheet means that whomever is working on the digital presentation can easily turn the data into a JSON that JavaScript and jQuery can use to write the HTML for you. If you have a spreadsheet with 20 rows of data about school board members, it’s a lot easier to write the script to write those div tags and image tags once rather than having to copy and paste the code 20 times. Copying, pasting, and deleting can be dicey, as you might delete div tags or forget to change the content of a p tag.

You might sense a theme in these reasons: Not only do they make things easier, they minimize or eliminate the introduction of errors. Cutting down on errors is good for us, our bosses, our readers and our sources. It’s good for everyone. Using spreadsheets to help me do that is worth any of the effort I put into it.

A colleague asked me for a primer on how I use Google spreadsheets, and I thought I’d share it here. For the sake of this exercise, we will assume we are creating a spreadsheet of bios on candidates of some kind.

For many people, the top of their Gmail inbox looks like this:

Click on the three-by-three square toward the right side of the top:

You’ll see multiple icons. Click on the one that says “Drive.”

You’ll be taken to a screen that should look like this:

On the left side, click on the big red button that says “NEW” and select “Google Sheets.”

You will then be taken to a new page: your blank spreadsheet.

To rename it, click on the part at the top that says “Untitled spreadsheet.” You’ll get a pop-up that looks like this:

In your spreadsheet, you can now fill in the columns as you please.

To share the spreadsheet with reporters, editors, designers, web producers and other collaborators, click on the blue share button at the top right.

In that share window, you’ll get the option to type in email addresses and decide what level of access you want to share. You can allow them to just view the spreadsheet, or you can allow them to fully edit it.

Once the spreadsheet is edited, the real fun begins. This is where producers, graphic artists, developers or whoever can use the spreadsheet to make the magic happen. The following steps are not going to directly affect reporters or editors, but they are cool steps that show just how awesome and powerful these spreadsheets can be for journalists.

Select all the data in your spreadsheet and copy it:

Go to Shan Carter’s Mr. Data Converter, a resource I use almost daily and the reason why Mr. Map Generator is named what it is.

Carter’s tool is fantastic: it converts your Excel or Google spreadsheet data into one of several web-friendly formats, including HTML, JSON and XML. You paste your data in the top box and it spits out your format in the bottom box.

For our example, we want the format to be JSON, in row arrays:

We then copy our JSON from the bottom box and add it our JS file. Using a combination of JavaScript and jQuery that cycles through a for loop, we append div tags to our document using elements from the JSON.

The HTML itself is only one line:

And the CSS is not complex, either:

Thus, we’ve been able to turn a spreadsheet that looks like this…

Into a digital presentation that looks like this:

It’s a rather simple process, in which all the players who need to edit the text can do so at once. By turning the spreadsheet into a JSON and having jQuery/JavaScript write the HTML elements for you, it makes editing easier. In the past, the designer, developer or producer handling the web project would be peppered with changes and edits from reporters and editors. This makes it way easier for everyone: just make the change you need in the spreadsheet, alert the the designer, developer or producer to update the JSON and that’s about it. There are ways to have the Google spreadsheet directly hooked up to your code, but depending on your newsroom’s setup, that could require some server access that not everyone has.

Earlier this year, Boston Globe reporter James Pindell wrote about the activists whose endorsements are key to Republicans in the New Hampshire primary. Data and multimedia editor Laura Amico, James and I used a spreadsheet to keep tabs on all of these people: their names, hometowns, current jobs, endorsements for 2016, 2012 and so forth.

I then used that spreadsheet to create our endorsement tracker. I wrote code that goes through the JSON, tallies how many people have endorsed whom, adds those up, and includes those numbers on the labels and buttons referring to the candidates. It also calculates how many fields in the spreadsheet are blank, meaning the person hasn’t endorsed anyone yet. The code does all the math for us. As more people endorse more candidates, we just update the spreadsheet, update the JSON and then re-upload it.

That’s it. No having to get out our calculators to add up how many have endorsed a candidate. No having to go into the HTML and look for the labels for each candidate. No having to go into div tags and no worrying that we are deleting a tag on accident. Just the JSON, and the code then automatically updates all the numbers and rewrites the HTML.

Another spreadsheet project that I worked on with Laura Amico was a primer on all the people in the case of Aaron Hernandez, the former Patriots player on trial for murder. Metro Editor Anica Butler, Laura and I formatted the sheet, adding links to stories about the various individuals connected to the case.

I then wrote code that would sort through the spreadsheet-turned-JSON and put the bios of these people in the proper categories: victims, family, legal, and so forth. Thus, if the editors decided to move anyone to another category or add/remove someone altogether, I didn’t have to change anything or move anything other than re-pasting the JSON in the file. That’s it.

Even quizzes can benefit from the content being organized in spreadsheet. Last year, The Boston Globe’s deputy editorial page editor, Dante Ramos, wrote a profile of each of the five tech hubs in the Boston area. For BostonGlobe.com, we thought it could be fun to present a quiz allowing users to find out which of those tech hubs suited their personality. The quiz relied on JavaScript, jQuery, an extensive JSON file and a whole lot of if/then statements. That JSON file was made from a spreadsheet that allowed many members of the editorial staff to read over the quiz questions and edit as they went along.

The most ambitious project I’ve used a spreadsheet for, though, is something a project I blogged about in late 2013..

For the last year and a half, I have been editing and updating this BostonGlobe.com interactive graphic about the history of same-sex marriage in the United States. There’s a sticky navigation that stays with you when you scroll through the timeline, shows maps and tallies that change as states allow gay marriage, ban gay marriage or allow civil unions or domestic partnerships. The timeline includes links to archived stories, copies of bills and statutes, and PDFs of past Globe front pages.

Each blurb on the timeline has its own row in a spreadsheet that has more than 700 rows:

Every time there is a new update or development, I use Shan Carter’s aforementioned great resource, Mr. Data Converter, to turn that spreadsheet into a JSON file. The jQuery reads that and appends a main div on the page with a div for each event, including nested divs for the headline, the text, the photos, the captions and the links.

The maps are SVG, taken from a template that former graphics director Chiqui Esteban created for our department. When the timeline is scrolled through, the color and tally changes are triggered by div IDs when those IDs are near the top of the screen. What the tally and colors should be are dictated by values in the JSON that was created from the spreadsheet.

Read more about that project here.

As you can see, these spreadsheets help in a variety of projects. Shan Carter’s Mr. Data Converter especially incentivizes the use of spreadsheets. Reporters and editors need not know about JavaScript or JSONs or any of the terminology. They need not know how the sausage is made to appreciate that these spreadsheets make it easier for them to edit projects and that it makes it super easier for graphic artists, developers, web producers and anyone else creating web projects.

Share

Trent Reznor is industrial’s George Brett, Green Day is punk’s Ozzie Smith

April 17th, 2015

The Rock and Roll Hall of Fame’s 30th Annual Induction Ceremony is Saturday. This year, the inductees are notable for who is getting in on their first year eligible and who is finally getting in after languishing in the ether for years. And, ss with most years, who isn’t being inducted is just as notable as who is.

This year’s inductees:

  • Ringo Starr
  • The “5″ Royales
  • The Paul Butterfield Blues Band
  • Green Day
  • Joan Jett & the Blackhearts
  • Lou Reed
  • Stevie Ray Vaughan & Double Trouble
  • Bill Withers

Notably not among this year’s inductees:

  • Chic
  • Kraftwerk
  • The Marvelettes
  • N.W.A.
  • Nine Inch Nails
  • The Smiths
  • The Spinners
  • Sting
  • War

Among past inductees:

  • Daryl Hall and John Oates
  • Randy Newman
  • David Geffen
  • Madonna
  • Public Enemy
  • Run D.M.C.
  • Beastie Boys
  • Donna Summer
  • R.E.M.

I mention past inductees not to throw shade on those inductees, as that list includes some of my favorite artists. I merely mention those artists for context. In other words, why those guys and not their counterparts who’ve been neglected?

This year was the first year that both Green Day and Nine Inch Nails were eligible. Joan Jett & the Blackhearts have been eligible a few years now. Ringo Starr, Lou Reed, and Bill Withers have been eligible for decades.

The interesting thing is that while both Green Day and Nine Inch Nails were eligible for the first time, Green Day was inducted and Nine Inch Nails was not. These two have more in common with each other than they do with any of the others who were inducted or eligible but not inducted, which is why inducting one and omitting the other seems so noticeable. To put this in perspective, let’s think of the Rock and Roll Hall of Fame like the Baseball Hall of Fame, and let’s think of Green Day’s and Nine Inch Nails’ respective genres — punk and industrial — of music as Major League Baseball teams.

Punk is like the St. Louis Cardinals, having had several inductees in the Hall of Fame: Patti Smith, The Sex Pistols, The Ramones, The Clash. Green Day, thus, is the genre’s Ozzie Smith: immensely popular and one of the more well-known players of the last 30 years. They aren’t the all-time best, but they are considered up there, particularly among younger fans. And don’t think age doesn’t matter in the context of punk. Any punk fan of a certain age can’t have a barstool or coffee shop conversation about punk without bringing up Green Day and modern acts just to point out how inferior they are to the forefathers, whether it’s because Billy Joe affects an over-the-top faux-British accent whine or because the band has moved into “Time of Your Life” ballad-type cheese. Now, I don’t think any Cardinals fan will ever dare hate on Ozzie, but if you ask Cards fans who their favorite shortstop is, age will divide your answers: Ozzie among younger fans, Marty Marion among older fans. Marty Marion, like the punk band Black Flag, never made it into the Hall of Fame. But both were among the best at their game.

If punk is the St. Louis Cardinals, and the goofy Green Day is its backflipping Ozzie Smith, then industrial music is the Kansas City Royals and Trent Reznor is its dour-faced George Brett. Ozzie Smith, a contemporary of Brett’s, was one of many beloved players for the Cardinals. But there is no Royals player more beloved or well-known than George Brett. If you’re only a casual baseball fan, then Brett is probably the only Royals player you can name, just as Reznor and Nine Inch Nails are the only industrial act that mainstream music fans probably know. Nine Inch Nails’ “Closer” off 1994′s “The Downward Spiral” cemented Reznor’s stature the way that the Royals’ 1985 World Series win cemented Brett’s. Only fans with some deeper knowledge would really know much about:

  • Dan Quisenberry, who was the Royals’ version of Ministry
  • Bret Saberhagen, who was Kansas City’s Skinny Puppy
  • Frank White, KMFDM to Brett’s Reznor
  • Amos Otis and Hal McRae, the Die Krupps and Throbbing Gristle who set the stage
  • Carlos Beltran, the Frontline Assembly to Saberhagen’s Skinny Puppy

If you only knew a few of those bands or players, you prove my point: George Brett is the standard-bearer of the Kansas City Royals and Trent Reznor is the commercial face of industrial music. Not that these are bad things. Neither guy is anything to sneeze at, to be sure. Brett is one of four players in MLB history to accumulate 3,000 hits, 300 home runs, and a career .300 batting average. The others being Hank Aaron, Willie Mays, and punk rock St. Louis Cardinal Stan Musial. Brett had longevity, being the only player in MLB history to win a batting title in three different decades. Reznor has had success not only with Nine Inch Nails, but in his film scores as well. The man has won Golden Globes, Grammy awards and an Oscar. He’s immensely talented and driven, which is why he’s still recording and performing 26 years after 1989′s “Pretty Hate Machine” introduced many squares to industrial music.

I’m hammering this point home like George Brett’s 3-run home run off Goose Gossage in Game 3 of 1980 ALCS because the Rock and Roll Hall of Fame has managed to have artists from almost every genre of rock. Nine Inch Nails’ induction would give industrial a presence that no other mainstream commercial artist could give. They’re certainly not going to induct Al Jourgensen. (Or Dan Quisenberry.)

Of course, these things aren’t always fair, which is why Bill Withers is just now being inducted. Or why Daryl Hall and John Oates got in before Stevie Ray Vaughan. Or why Chic hasn’t been inducted yet. Or why so many others aren’t in the Hall of Fame. Finding instances of unfair omissions in the Hall of Fame’s history is like finding MLB players who used steroids: not difficult. Pontificating on all of those oversights would take a while. A lot more than nine innings.

The main thing to remember here is that contemporaries George Brett and Ozzie Smith each entered the Baseball Hall of Fame when eligible. I don’t think many fans would disagree, nor would any fan argue that either one shouldn’t have been inducted.

Thus, if Green Day can enter but Nine Inch Nails can’t, well…

Wake this basketcase when September ends.

Share

How designing for different web browsers is like throwing a dinner party

April 15th, 2015

Designing web sites and interactives for different browsers is like planning a dinner party for widely different guests. None of whom has RSVPd. You don’t know who could show up, so you have to be prepared that they all could.

The most fickle is Internet Explorer, which is like that guy who was really popular in high school but hasn’t really done a whole lot since then. He invited himself to your party after hearing about it from someone else. He’s nice and well-intentioned, but planning for him is a pain in the ass.

Depending on the version, Internet Explorer can’t handle SVG, and when it can, it needs a lot of special help if you want to animate the SVG. This is the equivalent of a party guest who doesn’t always drink booze, but when he does, it’s Budweiser from a can and he’s hammered by the the third beer.

Beyond that, Internet Explorer can be finicky about aspects of CSS that other browsers can handle without any problem. Like break points in media queries. This is to say that this Budweiser-drinking party guest is also lactose-intolerant, but sometimes drinks milk anyway and then complains about it. He doesn’t eat red meat or chicken, but does eat turkey. He’s allergic to nuts, gluten, oats, soy, baby carrots, cherry tomatoes, white onions, food products made in July, and pickles cut the long way. He can’t eat black beans because they give him horrible gas.

Some versions of Internet Explorer can’t even recognize borders applied in CSS, which is the equivalent of this party guest saying, “Bee tee dubs, I’m allergic to water.”

You can’t just uninvite him, either, because he’s still popular among many circles and you can’t risk the fallout that could come from cutting him off. His retired family members no longer work, but they could still show up and wreak havoc at your party.

He might not show up, but just in case he does, you want to have something he can have. Maybe a jar of gluten-free air.

Much more agreeable is Safari, your bubbly coworker in her mid-20s. Just as Safari shows up in every Mac product, this party guest shows up at every party you have, usually 10 minutes early. Safari handles CSS much better than IE, which is to say that you don’t have to worry about this guest not eating any of your tapas. I’ve noticed in some of my projects that CSS break points look a little rougher in Safari, which is to say that if you ask this party guest to pick up chips on the way, she might just get the store brand chips unless you specify the brand you want.

Where Safari can have issues is the css for animated SVGs. This can sometimes cause Safari to flip out, much in the same way that certain hard liquors will send your bubbly party guest into a blackout drunken stupor where you have to confiscate her phone so that she doesn’t keep texting the guy she met on Tinder.

Firefox is much more capable and reliable than Internet Explorer and probably Safari, but that doesn’t mean it’s not without its quirks. Firefox is that friend you invite to the party because you like him even though he can be kind of a snobby, pedantic smartass. Firefox can handle SVG with aplomb, but I’ve had to use an if/else statement to distinguish whether the user has Firefox, and thus whether to apply different JavaScript. This is like having to make a separate booze run because your contrarian friend insists on drinking a more expensive “specialty” vodka that you can only get at certain liquor stores. He uses terms like “craft cocktails,” and if that didn’t make you roll your eyes, his blog about craft cocktail trends as a symbol of populism in the west will shoot your eyeballs from your skull.

These criticisms so far stem from SVG, but there are more generic irritations with Firefox. There are times I’ve had to add “float:left” to the CSS because Firefox has pushed divs with a 100% width all the way to the right off the screen. This is a quirk that even IE didn’t have. This is the equivalent of asking your friend to pick up ice on the way to the party.

“Can you grab ice? The bodega by my house sells pink bags in seven and 20 pounds. We just need one seven-pound bag. Thanks!”

And then from the store, your friend calls and says, “I can’t find anything like what you’re talking about. All I see are light magenta bags of ice that weigh 6.95 pounds and 19.95 pounds. What should I do?”

“Right now, I wish an actual Firefox, like a fox made of fire, would come and eat your face, you pedantic nerf herder.”

In the grand scheme of things, having to add “float:left” or Firefox-specific JavaScript isn’t a deal-breaker. But those things can make designing web packages annoying, particularly because Firefox is so capable otherwise. This is why Firefox’s quirks can make it more annoying than IE. Internet Explorer, with its myriad food allergies and other quirks, is so demanding that you’ll never be lulled into thinking that you don’t have to attend to it. Firefox’s quirks feel like that party guest who throws a tantrum while the host administers CPR to Internet Explorer because he accidentally had water with an ice cube.

But the browser that gets you through this soirée is Google Chrome. Testing iterations of your responsive interactive graphic on Chrome is like having your BFF at your side for this chaotic gathering of misfit toys. Chrome gets you. Chrome knows you inside and out. And that’s not just because Chrome is synced with your Google accounts and thus literally knows everything about you.

Chrome will call you on the way to your dinner party and ask you if you need her to pick anything up at the store. Unlike the other guests, Chrome doesn’t need any more instruction than “ice” or “chips.” Chrome will get it for you and even get you a six-pack of your favorite beer, because Chrome could hear in your voice that you were a little stressed.

Chrome’s got your back.

Chrome can handle SVG with ease, whether it’s static, animated with SMIL, whatever. This is like having a BFF that’s not picky about beer, wine, or liquor. You could even have bottom shelf vodka that stings like rubbing alcohol and your bestie wouldn’t care.

“What y’all drinkin’ on?”
“Burnett’s.”
“Awesome. Gimme some.”

Now, only every once in a while, Chrome will stall on a page and give you an “Aw snap” fail page. But if you refresh it or try it in another tab, it’s dependable again. That’s the equivalent of calling your bestie and saying, “Hey, you wanna get drinks tonight?”

“I would, but it was a long day, I’m just getting home and I have to be up early tomorrow. But what are you up to tomorrow night? I’m gonna make a casserole and binge-watch the last few episodes of Scandal, drinking Olivia Pope-sized glasses of wine. Wanna join?”

“I’m totes there.”

There are certainly other guests beyond these four, but they aren’t as noticeable at the party. Opera is your friend’s friend who your friend invited at the last minute. You like this guy and think that if you lived in the same city, you’d hang out more. And there are certainly many more Linux web browsers out there. These could be the party guests who came because they were walking by your place, heard the music and knocked on your door. You didn’t prep for them, but they seem cool and you don’t mind if they come in for a bit.

As long as they don’t have weird food allergies.

Share

Obama, conversion therapy, and presidential stances on LGBT issues

April 9th, 2015

When President Obama told Robin Roberts on ABC in May 2012 that he supported same-sex marriage, he added, “I’ve stood on the side of broader equality for the LGBT community.” Thus, in the context of an Obama presidency, Wednesday’s announcement that Obama condemned conversion or “reparative” therapy for LGBT youth could seem like just one more example of the president standing “on the side of broader equality for the LGBT community.” Less than two years into his first administration, he repealed Don’t Ask, Don’t Tell. A year and a half later, he became the first sitting president to endorse same-sex marriage, and has since then stated his support for the end of bans on gay marriage.

But Obama hasn’t always been this vocal when discussing LGBT issues. No president or candidate has been. Thus, in a larger context, Wednesday’s announcement signalled that once again, the Obama presidency could be remembered for how Obama talked about and interacted with the LBGT community in a way different from past presidents. Because, in a larger context, this entire time in US history will be remembered for how society as a whole changed the way it talked about and interacted with the gay community, regardless of who was president at the time.

One need not go back too far in history to see how US presidents have evolved when talking about LGBT issues. This is a cursory list, and is certainly not meant to be exhaustive.

1993
President Clinton announced and later signed the policy that would become known as “Don’t Ask, Don’t Tell,” in which LGBT members of the military could continue to serve, but not openly. The policy forced gays to hide their sexual orientation or face dismissal. More than 13,500 people were discharged under the rule since 1993.

Sept. 21, 1996
President Clinton signed the Defense of Marriage Act, allowing states to refuse to recognize same-sex marriages performed under laws of other states. Between then and the general election in November, Clinton’s campaign broadcasted ads on Christian radio touting that he had signed the Defense of Marriage Act.

Feb. 24, 2004
President George W. Bush announced support for a constitutional amendment banning gay marriage.

Aug. 3, 2004
Missouri voters passed an amendment that added a ban on gay marriage to the state constitution. Senator John F. Kerry, who was then the Democratic presidential nominee, said in an interview published with the Kansas City Star later that week that he would have voted for the gay marriage ban.

Nov. 2008
Barack Obama and John McCain faced each other in the general election. Though both men said they oppose same-sex marriage, they disagreed on whether the state constitutions should ban it.

Dec. 22, 2010
President Barack Obama signed legislation allowing gays to serve openly in America’s military, repealing “Don’t Ask, Don’t Tell”.

Feb. 23, 2011
President Obama declared that he will no longer defend DOMA.

May 9, 2012
President Obama became the first president to endorse same-sex marriage. Mitt Romney, who would face Obama in the general election in the fall, reiterated that he opposed same-sex marrige.

Jan. 2013
In his second inauguration address, President Obama referenced LGBT rights and struggles when he said, “Seneca Falls, and Selma, and Stonewall”.

Feb. 2013
In a friend-of-the-court brief, the Obama administration told the US Supreme Court that California’s ban on same-sex marriage violated the Constitution’s guarantee of equal protection.

March 2013
Former president Bill Clinton wrote an op-ed for The Washington Post, calling for The Defense of Marriage Act to be overturned. “As the president who signed the act into law, I have come to believe that DOMA is contrary to those principles and, in fact, incompatible with our Constitution,” Clinton wrote.

January 2015
President Obama became the first president to use the word “transgender” in a State of the Union Speech.

March 2015
In a friend-of-the-court brief, the Obama administration urged the US Supreme Court to rule that states could not ban same-sex marriage.

This, of course, is a very incomplete list. And this is not to say that Obama always had the same stances on LGBT issues. He will often say that he evolved. Clinton himself said that when he signed DOMA, it was a “different time.”

I wrote last year that some bloggers and pundits thought Obama had unfairly gotten a “pass” on his 2008 statements on gay marriage. The unifying question was this: If Brendan Eich had to resign as CEO of Mozilla because he gave $1,000 to support Proposition 8 in 2008, why does Barack Obama get a pass for saying in 2008 that marriage should be between a man and a woman?

As I wrote then:

If Obama or anyone who voiced opposition to same-sex marriage ever got a “pass,” it certainly wasn’t an across-the-board pass from the LGBTQ community. A quick Google search of the terms “Obama” “gay marriage” shows quickly that prominent sites and blogs about LGBTQ issues — The Advocate, The Bilerico Project, GoodAsYou and Towleroad — show that Obama, Hillary Clinton and other Democrats did not get a “pass” on their stances on same-sex marriage or other issues. Bill Clinton, the president who signed the Defense of Marriage Act into law, didn’t receive a pass last year when he wrote an op-ed denouncing the law.

How presidential candidates will discuss gay marriage will probably be strongly influenced by how the Supreme Court will rule this year on the topic. It’s not an issue that will go away. Obama’s presidency does not mean that no candidate will ever oppose same-sex marriage again.

Nor do the LGBT milestones during an Obama presidency mean that he is responsible for them. As I said earlier, the Obama presidency could be remembered for how Obama talked about and interacted with the LBGT community in a way different from past presidents. But that probably has a lot to do with the fact that this entire time in US history will be remembered for how society as a whole changed the way it talked about and interacted with the gay community, regardless of who was president at the time.

Share

If the 2015 Final Four teams were “Star Wars” characters

April 6th, 2015

As a wee child, I watched WWF with the fervor that I now watch prime time soap operas. As the years passed, my dad told 12-year-old me that I would be better reading JFK’s “Profiles in Courage” instead of WWF Magazine. (Though the publication did publish my letter to the editor when I was 10.)

I ended up being more than OK with that. As I got older, I traded the Ultimate Warrior and Macho Man Randy Savage for Will Clark and Wesley Stokes. I no longer needed to root against Sgt. Slaughter, The Million Dollar Man or Rick Rude, because now I had Bill Self, Lebron James, and Kobe Bryant.

Because even though I knew WWF was not an actual sport, it gave me the outlet that baseball, college basketball and college football give me and so many others. Which is, to say, it gave me a chance to root for underdogs and unabashedly boo at the bad guys for whom I had nothing but abject loathing.

Sure, real sports have gifted individuals showing awe-inspiring athletic prowess and feature the joyous triumphs that can only come from teamwork. But we are kidding ourselves if we don’t think that at least part of the joy of watching sports comes from rooting for our heroes, and maybe more importantly, rooting against the villains.

Perhaps there is no forum that more succinctly displays this psychological aspect to sports fanaticism than the March Madness tournament. We cheer for underdogs who just barely scrape into the tournament and hope they will knock out a smug number 1 seed. We root for the earnest teams whose players’ back stories get us choked up. And just as importantly, we tune into games where our only vested interest is seeing a team lose, whether it’s to help our bracket or because we relish the possibility of trash-talking our friend who roots for Kansas even though she’s an otherwise lovely human being.

This year’s March Madness, and particularly this year’s Final Four, has had that delicious aspect of earnest heroes, fan favorites and universal villains. It mirrors pop culture’s best portrayal of the fights between good and evil.

That’s right, Padawans. This year’s Final Four is “Return of the Jedi” to the overall “Star Wars” universe that has been this year’s March Madness. Saturday, Wisconsin’s Luke Skywalker defeated Kentucky’s Darth Vader and Duke’s Emperor Palpatine dispatched of Michigan State’s Han Solo. And tonight, the earnest farmboy Luke Skywalker — in the form of a plucky, fun-to-watch Badgers team — will face the unrepentant Emperor Palpatine, represented by Duke’s aptly named Blue Devils.

You might protest, but search your feelings. You know this to be true.

Earnest and somewhat naive farmboy Luke Skywalker was the “Star Wars” series’ poster boy for unshakeable good, abandoning his training in “The Empire Strikes Back” so that he could go save his friends whom believed were in trouble. This strong moral compass fits nicely for University of Wisconsin’s home of Madison, a social activist’s haven where two’s a party and three’s a protest. It’s not a stretch to think that if Luke Skywalker were to be from any part of America, he’d be from the rural Midwest, where a strong work ethic, friendly demeanor and headstrong stubbornness are a way of life.

Michigan State is sarcastic smuggler-turned-rebel Han Solo. Michigan State didn’t garner any widespread fan hatred, but was also never cast as chipper underdog, either. Michigan State, while also Midwestern, does not have the golly-gee earnestness that Wisconsin does. Han Solo is ultimately a good guy, but he never wanted to be a good guy. He as not the series’ symbol of purity, because as a self-interested smuggler, never viewed good and evil as black and white. He was merely a means to get Luke to the main event, where he could face off against the villainous Darth Vader and purely evil Palpatine.

You might think that the Midwestern duo of Michigan State and Wisconsin would be better portrayed by twins Luke and Leia rather than Luke and Han. I considered that, but in the grand scheme of the 2015 March Madness tourney, Leia is Wichita State, because Leia defeated the horribly villainous Jabba The Hutt. By which, of course, I mean the University of Kansas Jayhawks.

And speaking of villains…

A long time ago in a galaxy far, far away, Darth Vader was once Anakin Skywalker. Sure, he was always obnoxious and somewhat full of himself, he wasn’t always the bad guy. Many have found Kentucky fans unbearable for years, as the fans have smugly boasted the team’s impressive legacy. Kentucky’s been a dynasty for years now, and that will always garner some envy and disdain. In that sense, Kentucky is the insufferable Anakin. But it was John Calipari who elevated the team to hatable Darth Vader status. By many, Coach Cal is seen as an opportunistic cheater who bends the rules and doesn’t play clean. Sounds about right for an intergalactic dictator who chokes people and blows up planets, right? If Kentucky were coached by a more likable, grandfatherly character such as Charlie Spoonhour or Al McGuire, would they be as hated as a Cal-helmed Kentucky?

Wisconsin defeating Kentucky this past Saturday was a rematch from when the two teams faced each other in the Final Four last year. Kentucky won that game, though, just like Darth Vader had won the last time he fought Luke Skywalker. In other words, the Final Four in 2014 was Kentucky cutting Wisconsin’s hand off and devastating the earnest team, and the Final Four in 2015 was that earnest team coming back with a green lightsaber to beat Kentucky.

But Vader was not Luke’s ultimate enemy in “Return of the Jedi.” Luke’s ultimate enemy was evil and temptation. Vader was a flawed character who had chosen the allure of the Dark Side, but he was not the representation of pure evil. That distinction went to Palpatine. In this Final Four, the only team hated as much or more by fans than Kentucky has been Duke.

Coach K is not the defining factor. He has his enemies, sure, but if he were replaced tomorrow, would Duke’s haters hate the team any less than they do today? Probably not, because more than Mike Krzyzewski, it’s Duke’s fan base that earns the team its role as super-villain. When reading a friend’s Facebook post about Duke this weekend, the thread contained the words “smug,” “arrogant” and “entitled” only a bajillion times.

Now, Duke fans are probably very lovely outside of the sports bar. I have friends who root for Duke. So, no, I don’t think that Duke fans are actually the representation of all evil and darkness. But hyperbolic exaggerations are the basis of our choices of whom we root for and boo in sports, which is why WWF’s cartoonish characters were such a hit.

And tonight, in a sports bar equivalent of the Mos Eisley Cantina, I’m going to affect a Wisconsin accent, shout out “uff da” and root for the Badgers. And come November, I hope my Missouri Tigers and Saint Louis Billikens don’t repeat their performances as, well, anything from “The Phantom Menace.”

RELATED: If Leonardo da Vinci tinkered the way George Lucas does…

Share

How to make an SVG animation, from Illustrator to HTML

April 2nd, 2015

Last week, I discovered Rob Levin‘s podcast, “SVG Immersion: The Anything and Everything SVG Podcast.” On one of the episodes, Rob talked to front-end developer Petr Tichy about SVG animation, as Petr had created this really cool animated Christmas card using SVG. Just click on it and it watch it.

Cool, eh?

Inspired by Rob and Petr, I Googled how to create SVG animations myself. After looking at some examples and a few tutorials, I decided to attempt my own. This SVG animation was the result of my efforts. It was easier than I expected, and I think SVG animation is a tool my colleagues and I will be able to use for many interactive projects.

Below, I’ve written a tutorial of how I put the animation together. It’s a rather long explanation, but I wanted to document it in depth. I used the starter files from Mr. Map Generator to help build this animation and thus the tutorial will read similarly to the one I wrote for that.

To create this responsive SVG animation, I used Adobe Illustrator and a text editor. If you’re following along, I’m going to assume you are familiar with Illustrator and only a little familiarity with basic HTML. For the most part, this requires a lot of copying and pasting. You need not have any SVG experience, and I’ve written this as if the reader has never used SVG.

This was my first time using SVG animation, so I am not an expert by any means. Rather, I am writing this from a perspective to say, “Hey, look how easy this was for a newbie!”

Let’s get started. Here is a zip file of four files:

  • ocean.ai
  • starter.htm
  • svg.css
  • responsive.js

When you’ve downloaded the zip, open up the Illustrator file called ocean.ai.

You’ll see that there are elements hanging off the artboard. Our artboard is 600px wide and 400px tall. But when animating SVG, you can make your artboard whatever width or height you want.

Each section of the ocean scene has its own layer in the Illustrator file. Furthermore, each layer has a name describing the content of said layer: greenFish, orangeFish, etc. These names are one word, with no spaces or breaks. This is important.

Our layers are:

  • orangeFish, the orange fish
  • greenFish, the green fish
  • orangePath, the path the orange path will swim along
  • greenPath, the path the green path will swim along
  • sun
  • oceanScene, which is the water and the sand
  • sky

Save the Illustrator file as an SVG. It’s easy to do in the “Save As” settings.

Illustrator will give a pop-up and you can leave it be.

Once you’ve saved the file as an SVG in Illustrator, open the SVG in a text editor. Programs like Notepad or TextEdit are free with your computer. They are perfectly functional, but I use TextWrangler, which you can download for free. It color-codes tags in HTML and makes it easier to organize what you’re writing. Sublime and other editors are fine, too.

When you open the file in a text editor, it could look rather daunting if you’ve never looked at SVGs in text editors. Looks like a lot of gibberish, right?

And yet while it looks foreign at first, certain things will look familiar. Just as p tags and div tags need opening tags and closing tags, so do g tags. In SVGs, g tags are group tags. Another way to think of g tags is to think of them like div tags for SVGs. Like div tags, g tags can have classes and IDs.

Look at the line that says “viewbox.”

Look at the part that says viewbox=”0 0 600 400.” That 600 means the box for your SVG is 600 pixels wide and 400 means it is 400 pixels tall. We’re going to eventually delete that part, but before we do, write down those two numbers somewhere or copy them into another file.

Write them down yet? Ya sure? OK, good.

In your text editor, highlight everything from the first line until the space just before the first g tag.

Got it highlighted? Good. Now delete that.

At the bottom of the document, highlight everything after the last closing g tag. And then hit delete.

Now select all that’s in the document and copy it. We’re ready to add it to our HTML file: starter.htm.

Look for the part that says, “HIGHLIGHT THIS AND PASTE YOUR SVG OVER IT!” Highlight that part, and well, do what it says: Delete it, and paste your SVG that you’ve cut and pasted.

In starter.htm, that is going to be on line 30.

OK, now that you’ve pasted that, look for the areas that say “viewBox” and “enable-background.” Particularly, notice that they each include a line that says “0 0 XXX XXX.”

This is why I told you to write your width and height down. Or paste it somewhere. Because now you need it.

Paste over “XXX XXX” with your actual width and height. In our case with our file, we had a width of 600 and a height of 400, so we changed “0 0 XXX XXX” to “0 0 600 400″ in our file.

Open up responsive.js. The top three lines of the file will look like this:

Change the XX to reflect the appropriate value. Our exercise had a width of 600 and a height of 400.

Save the JS file and close it. You’re done with it.

At this point of the process, if you were to open up starter.htm in a browser, you’d get a static, non-moving image.

Now we are ready to start animating!

In your text editor, in starter.htm, find the g tag for sun.

Most of that code is for the orange part on the outside. The circle tag is for the middle circle of the sun.

The code that will do the animating will look like this:

<animateTransform attributeType=”xml”
attributeName=”transform”
type=”rotate”
from=”0″ to=”360″
begin=”0″ dur=”10s”
repeatCount=”indefinite” />

What that does is rotate the sun from 0 degrees to 360 degrees, beginning 0 seconds into the animation. The “dur” refers to the duration, which we have as 10 seconds. Where it says, “repeatCount,” we’ve left a value of “indefinite,” meaning we want it to repeat indefinitely. We will paste that just before the closing g tag. That will make our sun rotate.

Test it in the browser, and it should work!

Now we want to add code that will have the sun float up after 2 seconds. That could will look like this:

<animateTransform
attributeType=”XML”
attributeName=”transform”
type=”translate”
from=”0,0″ to=”0,-400″
begin=”2s” dur=”2″
fill=”freeze”/>

This will move the sun from an X,Y coordinate of 0,0 to 0,-400, 2 seconds in and over a period of 2 seconds. In other words, want it to move up 400 pixels over 2 seconds. We will paste that in the sun group, just after where we posted the rotating code: before the closing g tag.

Test it in the browser, and it should work. Except now we see that when the sun starts moving up, it has stopped rotating. We want it to keep rotating, though, as it moves up.

What we need to do is to add <g> tag between <g id=”sun”> and the first <path> tag. Then we add </g> tag before the second <animateTransform> tag.

That keeps the rotating animation going while moving the whole sun upward.

Now we want to add code that will have the water and sand float up after 2 seconds. That could will look exactly the same as the code we just added to the sun:

<animateTransform
attributeType=”XML”
attributeName=”transform”
type=”translate”
from=”0,0″ to=”0,-400″
begin=”2s” dur=”2″
fill=”freeze”/>

We add it to the code for “oceanScene,” which contains both the water and the sand. We add just before the final g tag:

This will move “oceanScene” from an X,Y coordinate of 0,0 to 0,-400, 2 seconds in and over a period of 2 seconds.

Test it in the browser, and it should work!

Now when we look at the page in the browser, we should see the sun rotate, and then after two seconds, the sun, water and sand move up. That gives the appearance that we’ve panned down to the bottom of the sea.

Now, all we need to do is add the animation that makes our fish swim!

So, in the Illustrator file are two paths that we’ve put on layers: orangePath and greenPath. They both have no fill and no stroke.

Here’s how they look in code:

We want the orange fish to move along orangePath. We want it to begin at 4 seconds, and take 4 seconds to complete. We want that to repeat indefinitely. Here’s the code that would do that:

<animateMotion
xlink:href=”#orangeFish”
dur=”4s”
begin=”4s”
fill=”freeze”
repeatCount=”indefinite”>
<mpath xlink:href=”#orangePath” />
</animateMotion>

We want almost identical code for the green fish. We want the green fish to move along greenPath. But we want it to start a second after the orange fish, and have the green fish swim a little slower. So with this tag, we want it to begin at 5 seconds, and take 5 seconds to complete. We want that to repeat indefinitely. Here’s the code that would do that:

<animateMotion
xlink:href=”#greenFish”
dur=”5s”
begin=”5s”
fill=”freeze”
repeatCount=”indefinite”>
<mpath xlink:href=”#greenPath” />
</animateMotion>

Now we just need to add that code to our file, starter.htm. In the past examples, we have been adding tags inside g tags. These animateMotion tags, though, will be placed outside of any g tags. These will be pasted before the closing svg tag.

And that, friends, is how to animate an SVG.

I found that I had to adjust my Illustrator file and resave it to SVG a few times to get the positions just right. The first few times, I had my fish too low, then too high, just a hair too right, etc. Having to toggle between Illustrator and a text editor was cumbersome, and that’s a complaint I’ve heard on a few different SVG podcasts.

When I made this, I got a lot of the code from examples I Googled. This example from CSS-Tricks was especially helpful, as it was where I got the code for how to animate something on a specific path.

There’s a lot more, of course, but that page has a great overview to get started.

Share

How to make your own Mr. Map Generator with your own SVG

March 26th, 2015

A few days ago, I wrote about a responsive mapping tool I created called Mr. Map Generator and explained how to use it. Charles Apple blogged about the reasons behind why I created the tool. In the days since, people have reached out to ask me how they could make similar generators for their own cities, states, countries, and so forth.

The aim of this post is to walk you through the process of how to do that, starting with an Illustrator AI file and ending with testing it to make sure it works. It might seem like a tedious process, but it will be worth it in the end when you can easily generate maps rather quickly.

Here is a zip file that includes all you’ll need:

  • An Excel file for your data
  • An Illustrator file I’ve created for this exercise
  • A folder called “The files to make the generator”
  • A folder called “The files to make your responsive map”

Open up the Illustrator file called mapGen.ai. In this example, I’ve put together a map that divides the US into three regions: the west, the southeast and the northeast. This was an arbitrary selection of just grabbing states and making a path with the pathfinder tool. Meaning that… No, I don’t think the northeast extends down to the midwest. It’s simply relative to the other shapes, as it is the most northern and eastern of those shapes.

Each section of the map has its own layer in the Illustrator file. Furthermore, each layer has a name describing the content of said layer: southernUS, northeasternUS, westernUS. These names are one word, with no spaces or breaks. This is important.

To be safe, I select everything in the layer and then use the pathfinder tool to combine those elements to make a compound path. You can also go to the objects menu, select compound path and then select make.

Save the Illustrator file as an SVG. It’s easy to do in the “Save as” settings.

Illustrator will give a pop-up and you can leave it be.

Once you’ve saved the file as an SVG in Illustrator, open it in a text editor. Programs like Notepad or TextEdit are free with your computer. They are perfectly functional, but I use TextWrangler, which you can download for free. It color-codes tags in HTML and makes it easier to organize what you’re writing.

When you open the file in a text editor, it could look rather daunting if you’ve never looked at SVGs in text editors. Looks like a lot of gibberish, right?

And yet while it looks foreign at first, certain things will look familiar. Just as p tags and div tags need opening tags and closing tags, so do g tags. For the sake of this exercise, let’s think of g tags as like div tags for SVGs.

Look on one of the earlier lines in the code, probably around line 6.

You see that, right? Of course you do: one of the g tags has an ID of “southernUS.” It has that ID because that’s the name of one of the layers from the Illustrator file. Whatever those layers are called will be the same names used as the IDs for the corresponding g tags. That’s why it’s important to name them something easier to distinguish from each other than just using “Layer 1,” “Layer 2″ and “Layer 3.”

Look just above that line to line 5, particularly the part that says “viewBox.”

Look at the part that says viewbox=”0 0 337.5 212.5.” That 337.5 means the box for your SVG is 337.5 pixels wide and 212.5 means it is 212.5 pixels tall. We’re going to eventually delete that part, but before we do, write down those two numbers somewhere or copy them into another file.

Write them down yet? Ya sure? OK, good.

In your text editor, highlight everything from the first line until the space just before the first g tag.

Got it highlighted? Good. Now delete that.

At the bottom of the document, highlight everything after the last closing g tag. And then hit delete.

Now we just have to clean up the file a bit.

In my original file, the shapes had a black stroke and a white fill. We want to get rid of that. Do a find-and-replace search for fill=”#FFFFFF” and replace it with nothing.

Next, do a find-and-replace search for stroke=”#000000″ and replace it with nothing

The last find-and-replace search is to find all the g tags that include an id. Our file will have three.

By adding class=”state,” we are assigning a class to our three g tags. That class is defined in the CSS files already downloaded.

Now select all that’s in the document and copy it. We’re ready to add it to our two different HTML files.

We have two files: baseForm.htm and starter.htm. The first one, baseForm, is the template for the page where you actually paste your data, click the buttons, decide your colors, preview your map, etc.

The other file, starter.htm, is the blank file that will become your map that you post.

In both files, look for the part that says, “HIGHLIGHT THIS AND PASTE YOUR SVG OVER IT!” Highlight that part, and well, do what it says: Delete it, and paste your SVG that you’ve cut and pasted.

In starter.htm, that is going to be on line 34.

In baseForm.htm, that is going to be on line 89.

While you’re in those files, notice the parts that say “viewBox” and “enable-background.” Particularly, notice that they each include a line that says “0 0 XXX XXX.”

This is why I told you to write your width and height down. Or paste it somewhere. Because now you need it.

Paste over “XXX XXX” with your actual width and height. So if your SVG had a width of 300 and a height of 400, “0 0 XXX XXX” should become “0 0 300 400.” In our case with our files, we had a width of 337.5 and a height of 212.5, so we changed “0 0 XXX XXX” to “0 0 337.5 212.5″ in our files.

Save the two HTML files, close them, and go back to the two folders. In both folders, there will be a JS file called responsive.js. Open both of those.

The top three lines of each one will look like this:

In both files called responsive.js, change the XX to reflect the appropriate value. Our exercise, with our three regions of the US, had a width of 337.5 and a height of 212.5.

Save the JS files and close them. The only thing left now is to format your spreadsheet.

In the zip file you downloaded, open the Excel spreadsheet called data. It should be blank and look like this:

We have three columns: “G id name that matches layer names in Illustrator,” “What name you want to appear in the rollover,” and “Dataset.”

We’ll use an example from the previous blog post about how to use Mr. Map Generator. Here is a screen grab we had of state-by-state data about the “Dawson’s Creek” finale, showing the percentage of people in each state who rooted for Joey to end up with Pacey, Dawson, or neither.

Notice that the first column is the US postal codes, the second is the name of those states, and columns three through five are actual numbers.

The postal codes match the names of the g tags in the SVG. So, the row with MA in the first column corresponds to Massachusetts, and the g in the SVG has an id of MA. For this to work, the text in the first column has to match the g tags in the SVG files.

In our Illustrator file, we gave the layers these names: southernUS, northeasternUS, westernUS. Thus, our g tags have the ids of southernUS, northeasternUS, and westernUS. Thus, we have to use those in our first column in our Excel spreadsheet.

The second column is where we type whatever we want to see when the user rolls over the shape. That can be whatever you want.

And the third, fourth, fifth, sixth, seventh, and forever onward columns can be, well, the actual data.

So now you’re ready to test out your generator!

Copy your data from your spreadsheet, and in baseForm.htm, paste it to try it out.

If it doesn’t work at first, refresh it once or twice. If it still doesn’t work, check console.log to see if any errors appear.

If it does work, copy the code from step 8 and then paste it in code.js.

It might seem like a tedious process, but it will be worth it in the end when you can easily generate maps rather quickly.

Share