Chuck Grimmett

Tools

Taxonomies

  • Comparing Sheet of Data in Excel

    Comparing Sheet of Data in Excel

    Here is a problem I was faced with at work last week: Individuals who had two different kinds of relationships with an organization had two different contact records stored in two different files in a legacy database. The client wants to collapse those contact records down into one if possible, so we had to do a comparison between then.

    Difficulties:

    1. Names were concatenated in one file and stored separately in the other.
    2. Some addresses didn’t match (which is what we were checking in the first place), but even if they did, they were often entered differently between the two files (APT vs #, ST vs St., S vs South).
    3. In one file, all postal codes were stored in one column. In the other file, domestic postal codes were stored in one column and international postal codes were stored in another column.
    4. One file had about 30 duplicates for some reason. This means there were multiple entries in the database, but for some reason they all contained exactly the same information.

    First things first: I got the information in a CSV file for comparison. I pulled this into Excel. Thankfully there was a unique ID between the two files that matched, so I was able to quickly deduplicate the first file and get the number of entries to match. Then I sorted the two files in the same order.

    Here are the formulas I used for comparisons:

    Compare cells on two different sheets and put out Yes if they match, No if they do not: =IF(E2='Sheet 2'!C2,"YES","NO")

    Compare the first 5 characters of two cells instead of the whole contents. This is how I solved the whether or not addresses “matched” even if they have slight issues (APT vs #, ST vs St., S vs South). This won’t work for every situation, but I spot checked the cells and didn’t find any issues in my data set. =IF(LEFT(E2,5)=LEFT(F2,5),"YES","NO")

    Counting the number of NOs in a particular column: =COUNTIF(G2:G150,"NO")

    Count the number of YESes or NOs in a particular row. This will give you a good indicator of whether or not a row matches overall: =COUNTIF(H2:AC2,"NO") =COUNTIF(H2:AD2,"YES")

  • Emmet

    Emmet

    Emmet is a tool I just found that expands your HTML and CSS workflow. It expands HTML from CSS-based abbreviations and quickly selects important parts of the code you are editing.

    For example, div>ul>li turns into:

    Visit the Emmet site to learn more, download it, and read the docs.

  • Moving Files to a Mac from Microsoft Remote Desktop

    Moving Files to a Mac from Microsoft Remote Desktop

    When moving files between Windows machines via Remote Desktop, you typically go to Local Resources > More and check the box in front of Drives to map your drive on the remote machine. Then you can use xcopy and \\tsclient to move the files.

    This isn’t quite the same on the Microsoft Remote Desktop Mac app. I believe this is because Mac OS X can’t accept SMB connections by default, so you have to map a special folder on your machine to accept transfers.

    When you add or edit a Remote Desktop connection, click “Redirection” on the top of the window.

    Redirection

    Then check “Enable folder redirection” and map a folder on your machine to be mapped to \\tsclient. I like to map a Dropbox folder so I the items are automatically backed up for me.

    Map a folder

    The folder you map will be available at \\tsclient. You can either use xcopy from the command line or find it under the Network drives area in the file browser.

  • Powering a Blog Through Medium

    Powering a Blog Through Medium

    Medium is a wonderful network and editorial platform that allows anyone to share their stories and their ideas. It allows those who don’t want to run a full blog to publish their content easily. If you do want to start a full blog without the overhead of buying hosting or running a WordPress site, it is super easy to power your blog with a custom domainArchived Link through Medium. This means you can buy your own site name (i.e. http://amandagrimmett.com) and the Medium publication will show up there. Here is what you need to do:

    1. Sign up for a Medium account.
    2. Set up a new publicationArchived Link on Medium. Think of this as your blog.
    3. Fill out this form with your publication’s URL and what custom domain you want to point to it.
    4. Medium will respond within 12 hours with a list of A records and a CNAME record that you’ll need to add to your registrar. Here is a cheatsheet for you and Medium’s support pageArchived Link. This is a bit of a pain, but thankfully a good registrar like Hover can do this for you. Hover’s new Connect service presets the 12 A records for you and steps you through setting a CNAME record.
    5. Within a few hours your domain will point to your Medium publication and your blog will be live!

    I just set one up this weekend for my wife’s awesome new blog. I couldn’t believe how simple it was. My only frustration was the wait time between submitting the request and getting a response from Medium. It was a weekend though, so I can’t complain.

    Once it is set up, you log in through Medium and publish to it through the Medium platform. It has the benefit of being tied in to the entire Medium ecosystem, so sharing, commenting, and gaining followers is easy. You are constrained to the limits of their platform, but it does have some customization optionsArchived Link. This is perfect for those of you focusing on your writing.

    Go forth and write!

    Medium gif

  • How to Pre-fill Google Forms

    How to Pre-fill Google Forms

    Did you know that you can pre-fill Google Forms based on a URL? Did you also know that if you have a basic example you can automate it with a database and send personalized forms?

    General Instructions

    1. On your form, click the vertical ellipses in the upper right corner to reveal the menu.
    2. Click “Get pre-filled link” Get pre-filled link
    3. This shoots you over to a page where you can fill in the fields you want pre-filled and it will generate a URL for you. Copy this. If you want the link you send out to everyone to have the same pre-filled info, your work is done. Send the link out!

    How you might automate it

    Here is my example form.Once I went through the above steps to get a pre-filled link, here is what I got:

    https://docs.google.com/forms/d/1nuxTbnUGkTaZw1uGIXXgqfx3hYRi3ZaPahdwDNEgy3Q/viewform?entry.2005620554=Chuck&entry.1045781291=cagrimmett@gmail.com&entry.1065046570=308+Negra+Arroyo+Lane,+Albuquerque,+NM+87114&entry.1166974658=281-330-8004&entry.839337160=This+is+so+useful!

    The stuff we are looking for is between the “=” and “&” signs:

    https://docs.google.com/forms/d/1nuxTbnUGkTaZw1uGIXXgqfx3hYRi3ZaPahdwDNEgy3Q/viewform?entry.2005620554=Chuck&entry.1045781291=cagrimmett@gmail.com&entry.1065046570=308+Negra+Arroyo+Lane,+Albuquerque,+NM+87114&entry.1166974658=281-330-8004&entry.839337160=This+is+so+useful!

    As you can see, those are the items I filled in on my own. How might one automate this, then? Here are a few suggestions:

    1. Using handlebars or Liquid, fill them in with the appropriate expressions and use the appropriate objects to fill them in: https://docs.google.com/forms/d/1nuxTbnUGkTaZw1uGIXXgqfx3hYRi3ZaPahdwDNEgy3Q/viewform?entry.2005620554={{name}}&entry.1045781291={{email}}&entry.1065046570={{address}}&entry.1166974658={{phone}}&entry.839337160={{comments}}
    2. Using PHP, you might assign variables for these items and fill them in from your database with a select statement: https://docs.google.com/forms/d/1nuxTbnUGkTaZw1uGIXXgqfx3hYRi3ZaPahdwDNEgy3Q/viewform?entry.2005620554=$name&entry.1045781291=$email&entry.1065046570=$address&entry.1166974658=$phone&entry.839337160=$comments
    3. On Mailchimp, you’d have to use Merge Tags: https://docs.google.com/forms/d/1nuxTbnUGkTaZw1uGIXXgqfx3hYRi3ZaPahdwDNEgy3Q/viewform?entry.2005620554=*|name|*&entry.1045781291=*|email|*&entry.1065046570=*|address|*&entry.1166974658=*|phone|*&entry.839337160=*|comments|*

    Note: Make sure you are URL encoding things with weird characters and spaces like an address. Example: 308+Negra+Arroyo+Lane,+Albuquerque,+NM+87114 vs 308 Negra Arroyo Lane, Albuquerque, NM 87114

    Completion of the code in 1, 2, and 3 is an instruction left to the reader. I’m assuming that if you want to do something like generate thousands of personalized URLs to a form, you probably already have a database and know how to use it. I hope this guides you in the right direction! Email meArchived Link if you want some help.

  • Trifacta Wrangler

    Trifacta Wrangler

    Trifacta Wrangler

    Trifacta Wrangler is a free program (currently in beta) that helps you clean up data sets and gives you a first cut at basic analysis. It is great for quickly turning messy data into structured, manageable formats.

    Trifacta Wrangler

    In the past few days I’ve used it to analyze huge log files and turn messy JSON in structured CSVs that I could import into SQL.

    Quick tips:

    • splitrows always has to come first. The program usually tries to split by \n (new line) first, but that doesn’t always work for JSON. Try splitting by something like },{, or do a quick find and replace ( },{ for }|||{ ) and do the split by ||| if you want to keep the curly brackets for an unnest.
    • unnest is very powerful for splitting out JSON values out into separate columns titled by their keys.
    • flatten works better than unnest in cases where the JSON does not have keys. It creates new rows and repeats other values in adjacent columns to keep the relation. This works well if you have an ID column and are going to eventually stuff things into a relational database.

    Here is documentation for the Transforms.