Crossposting and Crontab

About 15 minutes after I wrote the below post my dissatisfaction with that plugin and Jetpack’s Publicize (which posts to social media like Facebook and Twitter) sent me looking for an all-in-one solution. The most popular plugin seemed to be SNAP (Social Networks Auto Poster), so I gave it a try. It does require you to create an app in both Facebook’s and Twitter’s developer pages but the step-by-step instructions were detailed and flawless.

As a result I now am using the plugin on neverforever.ca and it auto-posts all new content to all three (and more if I want) sites.

Slick-er

I have been neglecting this blog after a great start to the year… sigh. It was mostly a conflation of an issue of the magazine, buying a boat and then setting up another blog for the boat. I have read a lot of boat blogs leading up to our decision and thought I would document our ‘journey’ for the edification of others.

Anyway one of the things I wanted to set up to help alleviate the problem was a way to post to both blogs at once. When we get going it is unlikely I will have the time or bandwidth to maintain both blogs. My initial attempt is using a plugin called feedwordpress. What it does is allow this blog (macblaze.ca) to monitor the RSS feed from neverforever.ca and then, when a new post appears, syndicate (repost) it here.

It’s not the simplest interface I have come across and so far the bells and whistles don’t seem to functioning as advertised but the basic premise is ok. The big issue was I couldn’t get it to do it automatically without digging through the wiki. It seems I needed to set up a cronjob on my web server. Now I am pretty lucky and my server has a great interface. I just went to the crontab button and added the command:

 */10 * * * * /usr/bin/curl --silent http://macblaze.ca/?update_feedwordpress=1

And then I added a test post and voila! What this does is tells the server to go to the url “macblaze.ca/?update_feedwordpress=1” every 10 minutes. By doing that the plugin does an update on the RSS feed and then posts anything new.

Slick.

The issues comes with the options to control the post categories and post authors. To date I haven’t been able to make those options work. But I’ll keep trying. And I will have to remember to remove the cron job if I dump this particular plugin.

 

Online sketching!

I am so a visual person. Most times if I am trying to explain something I will grope around for a paper and pen to try and sketch it out even if it has nothing to do with a visual concept. Hell, you should see my notes from writing papers in University—tree diagrams and thought bubbles…

Anyway I came across this cool tool today while reading an online argument about pulleys and mechanical advantage. One that I would never have been able to follow without the many sketches involved. It’s an online whiteboard (free) that allows you to quickly sketch something out and then share it. Like this:

Above is a hot link to the image on their site. I don’t know how long it will be hosted there but you can just as easily download the image and host it yourself:

e6

But even if the hot link doesn’t last for ever, this is a totally, totally awesome tool for communicating remotely. https://awwapp.com/

 

Ascending Order

I can’t believe I don’t have blog post about this. But I went looking for it today to make some adjustments to my new boating blog and there are absolutely no instances of me blogging about it. So without further ado…

Reversing Blog Post Order

One of the things you often come across is a blog or online journal that traces someone’s journey. For me lately this has been blogs of boaters or people who have set out on a grand adventure to sail away from their land-based lives. Naturally you want to read these from the beginning to the end. I was/am astounded the number of blogs that don’t allow this. But its not really surprising given the hoops one has to jump through in order to change how a blog is designed to be used. This is my solution for WordPress but there must be one out there for Blogger or other common blogs.

Since this blog uses a theme I designed myself from ground up, I figured it should be pretty easy too solve the issue and this turned out to be pretty true. For a couple of years now people have been able to read my Trip Reports in chronological order simply by reading them by category. With a bit of file editing, this was a snap to do.

Duplicate the category.php page ( /wp-content/themes/[your theme])and rename it category-(insert category ID).php. For example all the posts in my Broughton trip are in category with the ID of 89, so I created category-89.php file in my Theme’s folder. WordPress automatically uses that file when asked to display all the posts in the Broughtons category. Finding the category ID might take a bit of trial and error.

The Loop

Most category pages will have a thing called The Loop, which essentially calls all the entries from the database while certain conditions are true. WordPress’s default is to call the posts in descending order. This is the basic loop:

<?php 
if ( have_posts() ) {
    while ( have_posts() ) {
        the_post(); 
        //
        // Post Content here
        //
    } // end while
} // end if
?>

To change the order I edit that file’s php adding <?php query_posts($query_string.”&orderby=date&order=ASC”); ?> after the initial if ( have_posts() ) call. That way the loop calls the individual posts in ascending order. Since this is done in the custom category php file it only effects that specific category. Other categories will still display posts in the traditional descending order.

<?php if ( have_posts() ) : ?><?php query_posts($query_string."&orderby=date&order=ASC"); ?>

Good Code

Now I am admittedly not much of a coder and since I wanted to have all Trip Reports viewable in ascending order, this method has resulted in a score of category-x.php files littering up my theme. But it worked for me and I haven’t been motivated to change it.

But now that I have started to work on a boat blog and I wanted to use someone else’s more elegant theme, my simple solution didn’t work. For one thing the theme I chose didn’t have a loop in the category page, but simply a Function that called the loop based on a parameter of ‘category’. Then when I investigated the function.php file, I found this theme doesn’t use a simple and easily parsed Loop and, since it’s a Function not a direct php call, the code is subtly different.

The theme’s function used one main loop to do calls for all the various scenarios: list by category, list by author, list on front page, list on blog page, etc. What I needed to do was find the appropriate IF statement and embed query_posts (array( ‘orderby’ => ‘date’, ‘order’ => ‘ASC’)); within the appropriate <?php statement. A bit of trial and error resulted in a limited success. Always remember to have backups you can revert to! Now if you select anything but the default post view i.e. a category page, all posts will now be displayed in ascending order.

If I want to display only certain categories or posts by certain authors I am going to have to figure out both how and where to insert a custom IF statement in the Function or easier yet add a new Function by duplicating the existing one, adding the change and renaming it. Then I can call it from my typical custom Category page. I haven’t decided which is a more elegant yet simple solution…

 

Postscript

So after all that I still updated the Fruitful theme and still lost my custom code, and this babling above was still not enough to make it an easy fix. Sigh.

So what I needed to do was insert the code below in the functions.php file at around line 1670.

/* CUSTOM REVERSE ORDER ON CATEGORIES ETC */
query_posts (array( 'orderby' => 'date', 'order' => 'ASC'));
/*END CUSTOM*/

This is the section that starts if ( ! function_exists( ‘fruitful_get_content_with_custom_sidebar’ ) ) and comes right after the

< ?php if ( have_posts() ) : ?>

somewhere around line 1735

< ?php 
/* CUSTOM REVERSE ORDER ON CATEGORIES ETC */ query_posts (array( 'orderby' => 'date', 'order' => 'ASC'));
/*END CUSTOM*/
            if ( is_category() )

WordPress nonsense: Solved?

I have been having trouble using the WordPress app with my site. It  gives me an error (NSXMLParserErrorDomain Error 111) and then locks me out of the site. So I have been unable to post using the WordPress app at all. After much Googling and a few go-rounds with my hosting provider, I had a solution that involved disabling ModSecurity but even that failed to be a long term fix. I mean, who wants to disable anything that has Security in it?

So for the 10 millionth time I stretched out pleading arms to Google and voila! This Topic turned up on the ios.forums.wordpress.org site. Using all the right words the OP asks the right questions an get the right answers.

Hello,
I’m having some troubles with the XMLRPC requestes that the iOS app generates. I manage a WordPress 4.1.1 set as a Network install.

My hosting company has the ModSecurity activated and, for that reason, it blocks every time the users that have the App:
Message: Access denied with code 403, [Rule: ‘user:bf_block’ ‘@gt 0’] [id “117”] [msg “IP address blocked for 5 minutes. More than 2 XMLRPC POST requests within 60 seconds.”] [severity “WARNING”] [MatchedString “1”]

My question is: is it possible to limit the amount of XMLRPC requests if someone only open the stats page (and not, for example, the Post or Comments page)?
Or, better, limit the XMLRPC requests only if the user opens the Post, Page or Comments pages?

Thank you in advance,
Gabriele

****

After browsing some other topics, I figure out that the issue comes from the latest App version that makes too many XML-RPC requests that are interpreted as a potential attack and blocked.

The block works at IP level and that’s the reason why if you use WiFi for example, you won’t be able to connect to your website anymore (you see 403 or 406 errors).

At the moment the only possible solutions are uninstalling the App or temporary disabling the ModSecurity, waiting for a solution for the App developers.

****

Hi Gabriele

More than 2 XMLRPC POST requests within 60 seconds.

That is a ridiculously low limit. Who is your hosting company?

You might also try the steps in this FAQ to rename your xmlrpc.php file and avoid triggering the block.

Right there, in the FAQ, that I couldn’t find in any of my previous attempts is the answer:

  1. My Host Blocks XML-RPC Access! How do I fix that?
    1. Rename your xmlrpc.php file to something different, but only change it after the ‘xmlrpc’. Ex: xmlrpc_wp.php.
    2. Install this plugin. (Rename XMLRPC By Jorge Bernal)
    3. Read the installation instructions and activate it.
    4. Remove your blog from the app and add it back again.

And now, for now, all is golden. I guess even in this age of the internet and instant info, the maxim of “Try, try again…” is still in force.

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.

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.

Bruin Composite
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.

IMG_4245-2.JPG

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
<br />

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

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 using
[ID1]
ID1

Images

![Alt text](http://macblaze.ca/wp-content/uploads/2014/12/1-150x82.jpg)
Alt text

Images can also be defined. Define [ID2]: http://macblaze.ca/wp-content/uploads/2014/12/1-150x82.jpg
and call it using [ID2]
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

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 &amp; 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

  1. Me
  2. You
  3. 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 `