• Screen recording on a mac

    349-quicktime-player-capture-screen-thumb-300x74-348.pngMac OS continues to keep me happy. Sure, it has it’s faults but I just needed to capture my screen to file a software bug report. I could have explained step by step by typing but sending a video file is so much simpler. Except, I hadn’t done it on my Mac before. A quick google lead to a page of results of screen capture applications. Most cost money, a couple of open source solutions… I was reluctantly expecting the need to invest in more software. Then I noticed another search result that basically said – ‘use Quicktime Player’… and I thought.. I have that – it’s comes built in to OS X!

    I never realised, quicktime as supplied with the Mac (and maybe with windows, I never looked when I used it before) has an option to capture video of your screen. Giving the option of the whole screen, or just a section of the screen you select. Just what I was looking for to file the report with an example the developer could see happening.

    Perfect. Simple. Life is good…. or it will be better once that bug gets fixed.


  • Useful bash command for ruby programming (find a string within a file including sub directory files)

    Here’s a useful bash command, great for finding the source of any ruby “unintialized constant” errors.


    steve@Steve-Root-MBP$grep -r 'Spree::Admin::Application' .

    Returns the file name and the line with the matching string, like:

    ./app/controllers/spree/admin/satisfies_controller.rb: class Spree::Admin::SatisfiesController < Spree::Admin::ApplicationController

    So, my constant that caused the error is located in app/controllers/spree/admin/satisfies_controller.rb

    The command is made up like this:
    grep = grep is a command-line utility for searching plain-text data sets for lines matching a regular expression
    -r = recursively search all the sub directories
    'Spree::Admin::Application' = The Needle = the string you want to search for, I enclose in apostrophes, I think you can use speech marks etc. You can also use a regular expression to match things
    . = The Haystack = Where you want to search, using just a dot means search every every file.

    grep can do much more, read the man file (grep man) or google for more ideas. The other cool thing I do all the time is use grep to extract data from a log file and output it to another file. For example;

    grep '111.222.333.444' apache.log > analyse.txt

    Here, any log line that has '111.222.333.444' will be copied into the file analyse.txt. This is an IP address, but it could just as easily match dates, pages, referrer strings and so on.


  • SPF with google site verification

    Ahh, the joys of computing. My plan for a 30 minute task dissolves once more into 3 hours of head scratching. As always, the solution was ridiculously easy.

    The aim: To add Spam Protection Filter/Sender Policy Framework to our DNS.

    The problem: Having more than one TXT entry wasn’t possible with my DNS provider (and if it was, it would have created an error)

    The solution: Put all the TXT strings in the same TXT entry field, ensuring a space character is present WITHIN the strings if multiple strings are to be concatenated.

    The TL;DR detail:
    We use google apps, so google conveniently suggest the SPF code to use. At the time of writing, that’s:


    To create an SPF record for a domain:

    Log in to the administrative console for your domain.
    Locate the page from which you can update the DNS records.
    You may need to enable advanced settings.
    Create a TXT record containing this text: v=spf1 include:_spf.google.com ~all

    Publishing an SPF record that uses -all instead of ~all may result in delivery problems. See Google IP address ranges for details about the addresses for the Google Apps mail servers.
    If your registrar also requires a host setting (such as @), see the TXT records for specific domain providers list for precise instructions.
    Save your changes.
    Keep in mind that changes to DNS records may take up to 48 hours to propagate throughout the Internet.
    If you have difficulty creating an SPF record, contact your domain provider for assistance.

    Which sounded so easy, except adding that to my DNS hosted with gandi failed with an error about a duplicate line.

    The duplicate was a google site verification entry also using the txt field. From reading about BIND, it appears TXT fields can be on multiple lines but will be consolidated later. I guess the Gandi interface want’s you to do the consolidation yourself.

    So for me, the correct SPF and Google Site Verifcation code look like this:


    @ 300 IN TXT "v=spf1 a include:_spf.google.com ~all " "google-site-verification=1-3-y-blah"

    Notice: The two strings enclosed by speach marks. I could have done this as one long string but I think I’ll find adding any other TXT entries easier if I can see where each one starts and finishes. Actually, I’ve simplified my TXT entry for the blog, I also list a couple of server IP’s and eventually will need to add some IP6 addresses. The a in SPF records appears to only picks up the domains @ host, not every single host in a domain.
    Notice: The extra space character within the SPF string – because …~all” “goog… gets concatenated to …~allgoog… with the missing space causing a PERMERROR for SPF validation and probably breaking the site verification too.
    Notice: using 300 seconds for the life is fine for testing but probably wants increasing to a larger number once you know it’s working. I’m going for 43200 seconds which is 12 hours.


Search this site


Free apps

  • birthday.sroot.eu – Your birthday or other celebration date based on [years on other planets] / [how many seconds/days] / [how far you’ve travelled around the sun]
  • stampulator.sroot.eu – Calculates the combination and how many 1st, 2nd, large 1st and large 2nd class Royal Mail stamps you need on large envelopes and packets

Recent posts


Archives


Categories