Category: Computers
Revisiting KMLs
So I am still not happy with my various methods of posting KML files (tracks from my Navionics chartplotter) to the blog while on a cruise. The last method involved using FTP Manager to upload the files from my phone which is a bit clunky and likely to break down in areas of bad internet—which hopefully I encounter lots this summer :-).
Brainstorm
It occurred to me that the Navionics app allowed me to post my tracks to Facebook directly, so there must be a way to leverage that for my WordPress blog. Then I remembered the Post by Email function built into WordPress. What this does is generate a complex email address and any email sent to it automatically posts to the blog. I checked it out again (haven’t looked at it for several versions) and it was vastly improved and no longer needs a specified mail server.
And it allows the use of a great set of shortcodes to provided most of the functionality I normally use.
[category d-autres]
[delay +2 days] [delay +1 hour] [delay 2015-12-01 11:30:00 MST]
[comments on | off]
[status publish | pending | draft | private]
[slug some-url-name]
[title Your post title]
[end] – everything after this shortcode is ignored (i.e. signatures). Make sure it’s on its own line with a blank line above it.
So if I combine my newfound use of Markdown and its shortcuts (previously detailed ) with the email function of the app, I could post directly to my blog with all the text for the blog entry, a thumbnail of the track and a link to the original KML file all in one swoop. Then I could come back later and reset the KML files using the ftp method so they stuck around for posterity.
So, write the blog post in a text-editor using markdown & shortcodes, copy it into the Navionics app on the appropriate Track, and hit send. Simple as pie!
The posts would look like this:
Day 4 Sailing Ho
To day I set sail and sailed the ocean blue in my sailboat powered completely by sails. It was grand!
Track recorded with Navionics App.
View it: http://tinyurl.com/pyp7fsh
Download it: http://tinyurl.com/o863o6f
Now all I need is to get back out on the water…
Fonts and Hidden Files
The current Adobe Creative Cloud suite comes with a ton of fonts. While researching the easiest/cheapest way to get a selection of fonts to use in projects and ad designs (other than the time honoured tradition of stealing them), I realized that if I am already paying for Creative Cloud then the 100+ fonts they offer in TypeKit for both print and web design were probably enough.
The issue comes when you realize that the fonts disappear when the subscription ends and, while the theory is that I have to be paying for InDesign to open old projects anyway, not being able to archive the fonts makes me nervous. And it occurred to me for a computer to be able to use the fonts they had to actually be on my computer somewhere…didn’t they? So I went looking for a solution and lo & behold I came across dylanvalade.com/post/74649521957/how-to-find-synced-typekit-fonts-on-your-computer.
Essentially the solution is to go to Macintosh HD/Users/YOURNAME/Library/Application Support/Adobe/CoreSync/plugins/livetype/.r/ and your fonts will be in this .r folder named FONTID.otf. Of course this is a hidden directory so for OSX 10.8 Mountain Lion (contrary to Dylan’s instructions) you must go to Terminal and type in:
defaults write com.apple.finder AppleShowAllFiles TRUE && killall Finder
To later make them all invisible again use:
defaults write com.apple.finder AppleShowAllFiles FALSE && killall Finder
Then it’s the long process he describes to move and rename all the files. Finder won’t let you change the folder or file names prefixed with a dot like a normal file. So after you copy the .r folder to a safe place on your computer, right click the copy of .r and select Get Info. Change the copied .r folder name to something else by expanding the Filename & Extension option. Then use Get Info to rename each font you need to save offline. The name of the font can be copied (using cmd-C) from the Get Info window just above the Name & Extension box.
Simple…sort of.
Addendum
Once you find the invisible files (cmd+shft+.) you can use some thing like transtype to convert them and that renames them and makes them visible.
How’d he do that?
Well the second issue of the magazine is off to the printers and should be on shelves next week. I did a lot of “fancy” photoshop work this issue—nothing too complex but more than I normally do. One of the articles is on the history of the Bruin Inn in St Albert and the Big Kahuna wanted to try a fancy archival/modern blend. We tried in vain to photograph it, but couldn’t get the framing right and the depth of field was screwing us. That and the photographer was constantly in danger of getting run over.
So we decided to blend three separate images in photoshop to get the desire effect. One was the original archival photo, one was a shot of the restaurant that was built to mimic the Bruin Inn’s architecture and one was of a hand holding a picture. With a lot of careful masking the picture below was slowly built. The big issue I had right up until the last minute was I couldn’t get the thumb to look like it wasn’t “photoshopped” in, which I didn’t want, even though it was. I fought with it several times in vain, but it wasn’t until Zak said the thumb needed a big, soft shadow that I realized what the problem was. It still looks a little fake, but it is miles above what I had. I guess my kid’s pretty smart after all.

Archival Photo Credit: Provincial Archives of Alberta, A11605
Testing WP app: Image uploads
So apparently as the latest version of the WP App, if I set my maximum upload size at 600, any images I post from my phone will be resized to 600px.
So here’s one I like to call My View When Working at My Desk. Let’s see if it worked.
Of course the app now seems to be crashing my website with too many unauthorized accesses, but what the hell…
Markdown Syntax for Dummies
Further to my post of a few days ago, I have compiled an easier-to-read list of Markdown’s syntax for future reference.
Basic Character Codes
**strong** or __bold__
strong or bold
*emphasis* or_italics_`
emphasis or italics
two spaces followed by a line break
Head Levels
Pound symbols (one for each level) followed by a space
## H2 Level Head
H2 Level Head
Block Quotes
> Block Quote text
Block Quote text
Lists
Unordered lists use asterisks *, pluses +, and hyphens —, followed by a space, interchangeably as list markers:
* bob
* frank
* sue
Ordered Lists have any numeral (e.g. 1) followed by a period and a space
1. abc
1. bcd
4. cde
1. abc
1. bcd
4. cde
Code
INline code can be displayed by using backticks ` at the start and end`
sudo write code here
Code blocks can have 3 backticks ``` at the start and finish:
line one code
line two code
line three code
Horizontal Rule
Three or more hyphens, asterisks, or underscores on a line by themselves
***
Hyperlinks
This is [an example](http://example.com/) inline link.
This is an example
or
Define [ID1]: http://example.com/` as a link anywhere in the body and call it usingID1`
ID1
Images


Images can also be defined. Define [ID2]: http://macblaze.ca/wp-content/uploads/2014/12/1-150x82.jpg`ID2`
and call it using
ID2
Backslash Escapes
Markdown allows you to use backslash escapes to generate literal characters that have special meaning in Markdown’s formatting syntax.
\*literal asterisks\*
*literal asterisks*
\ backslash
` backtick
* asterisk
_ underscore
{} curly braces
[] square brackets
() parentheses
# hash mark
+ plus sign
- minus sign (hyphen)
. dot
! exclamation mark
Tables (Markdown Extra)
(doesn’t seem to be working on WP’s Markdown interpreter)
|Trees|Cats!|Beer?|
|---:|:---|:---:|
|oak|ginger|ale|
beechnut|calico-cross|pilsner
walnut|manx|stout
| Trees|Cats!|Beer?|
| —:|:—|:—:|
| oak|ginger|ale|
| beechnut|calico-cross|pilsner
walnut|manx|stout
Markdown
Markdown is a text based language basically designed to allow you to do simple code while working in a text editor. The curious can learn more here: daringfireball.net/projects/markdown/. I bring this up because as it is approaching the end of the year, I have been tidying up my annual book list (2013, 2012) to get ready to post in the new year. In the past I have prepared the formatting of this list a number of ways from using search and replace to typing it directly into WordPress. In the end, I have found that maintaining a text file using IA Writer which syncs between all my mobile devices and that has the prepared html code has been easiest. I use this:
<i><strong>title</strong></i> author (date)<br>
<b>series</b> Book # – ebook; reread
And it shows this:
title author (date)
series Book # – ebook; reread
I simply copy and paste the code, fill in the proper info and am good to go. The only downside is occasionally I forget to copy the code and then have to recreate the code template. But that’s not too much effort so I haven’t worried about it. But a little reading about Markdown is convincing me that next year I should be able to simplify the procedure. The theory is if I type:
_**Cally's War**_ John Ringo & Julie Cochrane (2004)
**Cally's War** Book 1 - ebook; reread
It should come out as:
Cally’s War John Ringo & Julie Cochrane (2004)
Cally’s War Book 1 – ebook; reread
And look at that, it totally does… You can agree that it’s a whole hell of a lot less typing to format the entries using Markdown than traditional html. I just have to learn a little new syntax.
To enable Markdown for use on my WordPress blog I had to activate the default JetPack plugin and sign in to WordPress.com. After that simply activating the Markdown portion converts the code on the fly without destroying the original text-based code. That should make it easier to write all sorts of entries in my text editors.
Markdown Syntax
Here are a few more examples of Markdown syntax:
This is an H1
=============
This is an H1
===
This is an H2
-------------
This is an H2
or
# This is an H1
## This is an H2
#### This is an H4
etc.
This is an H1
This is an H2
This is an H4
Pretty simple stuff. The rest of this post is an abridged cut-and-paste from the Markdown Syntax page.
Markdown uses > characters for blockquoting. If you’re
familiar with quoting passages of text in an email message, then you
know how to create a blockquote in Markdown. It looks best if you hard
wrap the text and put a > before every line:
> This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
> consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
> Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.
>
> Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
> id sem consectetuer libero luctus adipiscing.
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
Markdown allows you to be lazy and only put the > before the first
line of a hard-wrapped paragraph:
This is a blockquote with two paragraphs. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Aliquam hendrerit mi posuere lectus.
Vestibulum enim wisi, viverra nec, fringilla in, laoreet vitae, risus.Donec sit amet nisl. Aliquam semper ipsum sit amet velit. Suspendisse
id sem consectetuer libero luctus adipiscing.
Blockquotes can be nested (i.e. a blockquote-in-a-blockquote) by
adding additional levels of >:
> This is the first level of quoting.
>
> > This is nested blockquote.
>
> Back to the first level.
This is the first level of quoting.
This is nested blockquote.
Back to the first level.
Markdown supports ordered (numbered) and unordered (bulleted) lists.
Unordered lists use asterisks, pluses, and hyphens — interchangably
— as list markers:
* Red
* Green
* Blue
or
+ Red
+ Green
+ Blue
is
- Red
- Blue
- Green
Ordered lists use numbers followed by periods:
1. Bird
2. McHale
3. Parish
- Me
- You
- Bobby McGee
The one other thing of note is the use of escape characters. A ` before and after a line allows the code to be displayed without applying the formatting or an indent of 4 spaces will show the code in an offset block:
* Bird
* McHale
* Parish
One has to do that in Text view and then post or else WordPress will helpfully delete the blank spaces, so its easiest to use the `
More Favorite Excel Formulas
Making Headings
Quite often I would have columns of headings but when I went to export the headings, I would only want the first instance to appear in the text I was using. For example if I was doing a list of recipes and they were divided up into Chicken, Beef and Seafood, I would like the heading “Chicken” to appear only before the first entry—think Table of Contents.
Thus:
| Chicken | Recipe 1 |
| Chicken | Recipe 2 |
| Chicken | Recipe 3 |
| Beef | Recipe 1 |
| Beef | Recipe 2 |
| Seafood | Recipe 1 |
| Seafood | Recipe 2 |
| Seafood | Recipe 3 |
Should be:
| Chicken | Recipe 1 |
| Recipe 2 | |
| Recipe 3 | |
| Beef | Recipe 1 |
| Recipe 2 | |
| Seafood | Recipe 1 |
| Recipe 2 | |
| Recipe 3 |
Again the first thing you ned to do is visualize the problem and then express it logically. If the heading is the same as the heading above then don’t show it. If it is not the same then do show it. I also threw in a bit to accommodate the space between Beef and Seafood in case it was necessary.
The first thing you need to do is insert a new column between the headings (column A) and the recipes (column B). Actually you can make the new column for the calculation anywhere you want but it is much easier to keep alongside the original.
| A | B | C |
| Chicken | Recipe 1 | |
| Chicken | Recipe 2 | |
| Chicken | Recipe 3 | |
| Beef | Recipe 1 | |
| Beef | Recipe 2 | |
| Seafood | Recipe 1 | |
| Seafood | Recipe 2 | |
| Seafood | Recipe 3 |
Then you fill column B with the following formula:
=IF(A2=””,””,(IF(A2=A1,””,A2)))
This is constructed from basic if statements. You will use them a lot if you spend any amount of time working with formulas and calculations. The syntax for an if statement is IF(logical test, is true then do this…, else do this…) So this =IF(a=b,”A”,”B”) simply put, is read as if a is equal to b then write A, if not then write B. My formula above uses two nested if statements, one that checks to see if the current row is blank or not and one that determines whether it is the same as the row above.
Is the row empty? If so then leave it blank; if not then go on to the rest of the calculation. Empty (blank) is indicated by two quotes with nothing (not even a space) between them.
=IF(A2=””, “”, next if statement)
The next if statement then decided if the current cell matches the one above or not. If it does, if leaves it blank. If it doesn’t then it put in the text from the current cell.
=IF(A2=A1,””,A2)
All together:
=IF(A2=””,””,(IF(A2=A1,””,A2)))
If cell A2 is blank then leave blank space, if not then see if A2 is equal to the cell above (A1). If it is, then again leave a blank space. If not, then write in the contents of A2.
One thing to remember about this sort of thing is the calculations are all related to the original list. If you delete column A—which you will likely have to if you are going to export it to a text file—then the text in your column B will also disappear. The easiest away around this is, just before you delete the column, you copy column C and then paste it right back using Edit: Paste Special, then select Text. This will paste not the column of formulae you cut, but the results in text form—perfect for exporting!
But I need to get rid of Headers
Just as often I would find that to manipulate the text, it would be easier to not have these headers, but rather the filled in columns (think sorting by header) so how do you do this the other way? Well, there’s a formula for that!
Turning:
| apple | Recipe 1 |
| Recipe 2 | |
| Recipe 3 | |
| Recipe 4 | |
| oranges | Recipe 1 |
| Recipe 2 | |
| Recipe 3 | |
| bananas | Recipe 1 |
| Recipe 2 | |
| Recipe 3 | |
| Recipe 4 | |
| Recipe 5 |
Into:
| apple | Recipe 1 |
| apple | Recipe 2 |
| apple | Recipe 3 |
| apple | Recipe 4 |
| oranges | Recipe 1 |
| oranges | Recipe 2 |
| oranges | Recipe 3 |
| bananas | Recipe 1 |
| bananas | Recipe 2 |
| bananas | Recipe 3 |
| bananas | Recipe 4 |
| bananas | Recipe 5 |
You begin by once again adding in a new column for the calculation and then filling it with the following:
=(IF(A2=””,B1,A2))
| A | B | C | |
| 1 | |||
| 2 | apple | =(IF(A2=””,B1,A2) | Recipe 1 |
| 3 | =(IF(A3=””,B2,A3) | Recipe 2 | |
| 4 | =(IF(A4=””,B3,A4) | Recipe 3 | |
| 5 | =IF(A5=””,”B4,A4) | Recipe 4 |
In order to make this work you need to have a blank row above your first row so the calc can always reference the row above. So this calculation says if the row to the left is empty, then make this cell the same as the one above it. If it isn’t empty then make this cell the same as the one to the left. Again remember that to do any sorting or manipulation you first need to change column C from a set of calculations to actual text data (by Paste Special) otherwise changing the order will just make it recalculate based on the new data in the column to the left.
Favorite Excel Formulas
Since I originally started this blog to help me keep track of coding and computer-related info, I thought I would write down some of my favourite Excel formulas for posterity. Most of these reside in an excel spreadsheet I have carried with me for over a dozen years but here they are appearing on the internet for the the very first time!
Last Name First Name
Simple and prevalent but a lot of people just don’t understand how handy spreadsheets can be for manipulating textual data and do it the manual way.
| Bill to Name | First | Last |
| Blow, Joe | Joe | Blow |
| Simmons, Mike | Mike | Simmons |
| Bill to Name | First | Last |
| Blow, Joe |
=RIGHT(A2,(LEN(A2)-SEARCH(“,”,A2,1))-1) |
=LEFT(A2,SEARCH(“,”,A2,1)-1) |
| Simmons, Mike |
=RIGHT(A3,(LEN(A3)-SEARCH(“,”,A3,1))-1) |
=LEFT(A3,SEARCH(“,”,A3,1)-1) |
A few things to know about calculations
- they all start with the “=” sign.
- calculations are often made up of many, nested, formulae.
- you refer to specific cells by their coordinates in the grid. “A2” refers to the cell in column A, row 2
- spreadsheet calculations are hierarchical, just like you learned in grade school. So brackets and nesting brackets are important. The spreadsheet will solve for the deepest level first and then work outwards.
- Things in quotes are treated as text; things not in quotes are treated as elements of the formula.
- Data elements within a formula are separated by commas
So, in the above, you first need to visualize the problem. Essentially I want everything after the comma to go in column 2 and everything before the comma to go in column 2. So that means first finding the position of the comma.
=SEARCH(“,”,A2,1)
search (for a comma “,”, in cell A2, and look for the first one to appear)
The syntax for this formula and all the others that Excel uses can be found by hitting the fx button right by the formula bar—there are a bazillion of them. Once you’ve found the comma you can then grab everything to the right (or left) of it. To do that you need to subtract the position of the comma from the overall length of cell A2.
=LEN(A20)-COMMA POSITION
To compensate for the space between the comma and the first name you add a -1 — be sure to remember the brackets because you are subtracting the 1 from the whole calculation.
=(LEN(A2)-COMMA POSITION)-1
So now you have the elements necessary to use the right formula whose syntax calls is Right(text, number of characters).
=right(A2, (length-comma position)-1) or
=RIGHT(A2,(LEN(A2)-SEARCH(“,”,A2,1))-1)
To find the last name is almost the same but using the Left formula, which has similar syntax to RIGHT. It’s a bit easier because you don’t have to subtract from the length to find the number of characters. You still have to subtract 1 to account for the comma itself.
=left(A2,position of the comma-1) or
=LEFT(A32,SEARCH(“,”,A2,1)-1)
Simple huh? I know, I know, it is complex and mind numbing. That’s why I generally figure these calcs once, store them in a master spreadsheet and then reuse them when necessary. Remember that Excel’s fill down command will allow you to repeat the calculation for as many rows as you need and will automatically update the cell numbers to accommodate you.
Putting it Back
Changing it back is even easier.
| First | Last | Bill To Name |
| Frank | Jones | Jones, Frank |
=B2 & “, ” & A2
Cell C2 is equal to cell B2 plus a comma and a space (in quotes because they are text not data) and then cell A2. Simple!
Klm, Kmz, Navionics and a Magazine
So it seems that my lovely maps from my 2014 trips are gone as previously noted. The KML files supplied by my Navionics app are now invalid and the maps gone. Interestingly enough the old Google Maps ones are still going strong. So now I have to go back and reset them all. Luckily I didn’t delete the tracks from my phone yet so I have the materials to try again. While I ma at it I think I will attempt to resize the images as the WordPress app had a bad habit of posting them full size. This is apparently going to be addressed in an upcoming update.
My current method will be to just add the “-400×300″ suffix to all the image names. This should just pull the already resized version on to the post.
<a href=”http://macblaze.ca/wp-content/uploads/2014/06/20140607-210710-76030948.jpg”/><img class=”alignnone size-full” src=”http://macblaze.ca/wp-content/uploads/2014/06/20140607-210710-76030948.jpg” alt=”20140607-210710-76030948.jpg” />
Becomes:
<a href=”http://macblaze.ca/wp-content/uploads/2014/06/20140607-210710-76030948.jpg”/><img class=”alignnone size-full” src=”http://macblaze.ca/wp-content/uploads/2014/06/20140607-210710-76030948-400×300.jpg” alt=”20140607-210710-76030948.jpg” />
One caveat is that portrait images have to have the numbers reversed: -300×400
In other news the magazine showed up today! Sweet!
Flexible Maps Again
I had previously figured out how to use the WP Flexible Map plug-in to re-integrate my Navionics KML files with my WordPress blog after changes to Google MAps made my old way inoperable. Those links, however, no longer seem to work. Either those links die after a certain period of time or, as the links themselves seem to indicate, Navionics has changed file servers to Amazons S3 service and broken them all. I could go back and relink them all but that seemed futile and, likely, temporary.
This means I need to figure out how to solve my problem again. And this time I intend to just figure out how to download the KMZs to my own file server or cloud and then cut out the possibility of depending on someone else’s data storage.
As a side note, Google has finally discontinued support for their old maps application and moved completely to the new one — which was what caused me problems in the first place. Older KMZ links to Google Maps from past adventures still seem to work, albeit very slowly.
My first plan was to use Dropbox as a file server. Along the way I discovered that Flexible Maps was now properly using KMZs — not sure when that happened. This allowed me to drop the step where I had to open up the KML file on Navionics server and the copy and paste the url to WordPress.
To Use Dropbox, I created a kmz folder in the Public Folder provided by Dropbox and then, in Navionics, shared the Track creating an email with link to the KML, a graphic of the track and an attached kmz file. The problem here is that to make the link to the kmz attachment clickable, you had to actually email it. To get the kml, the link was already active — you only had to click it to open it in Safari. Remember this is all has to be done on my iPhone. So I sent the email.
After receiving and opening the email to myself, I could hold down the kmz link and save the file to Dropbox, selecting my KMZ folder in the Public folder. So far so good, except I soon discovered that while using the browser or desktop interface I could easily generate a public link, this functionality was not available on the Dropbox iOS app. All I could do was download it. This means I had no url to paste into WordPress. Back to square one. But since I wasn’t completely keen on hosting the KMZs on Dropbox anyway ( I tend to think of it as ephemeral storage) I guess that is a good thing.
Plan B is to create a kmz folder on Macblaze.ca and find an ftp app to upload the KMZs there. I downloaded FTP Manager Free, and went through the whole process again. To be safe I created a new ftp user account on my hosting site that only had access to the kmz folder. So now I open the file on the received email and open with FTP Manager. From there I upload it to the kmz folder and voila…
Now I have a web-accessible link on my own webserver that will get backed up with the rest of my files. To call the KML file you simply include the shortcode [flexiblemap src="http://macblaze.ca/kmz/source url"]
[flexiblemap src=”http://macblaze.ca/kmz/Day15.kmz”]
Next
I am not overly happy with FTP Manager for this purpose ( a few too many steps for such a simple operation) and really don’t like having to send a n email to myself. This can get problematic when floating in some secluded bay somewhere with crappy access to the internet. I will keep looking but for now I guess I go back and redo all the old links…





