Articles
Kind:Syndication Links 4.2.1 and Simple Location 4.0.2 Released
Simple Location
-
- Rounds all numbers to a maximum of two decimal points, as I introduced a bug in the last version that would fail to fill in numbers in the post editor due form validation requirements.
- Extracts additional location information from Compass…mostly the information I store when I’m on a plane, to generate a better description of the location. It also passes this info to WordPress more effectively so it could do more in future.
- I also introduced a new location provider. If set, if you enter a 3 letter airport code in the location name box, it will replace it with the location and name of that airport, as well as the weather. In future, I may add a similar reverse address lookup for people.
- Misc bug fixes
Syndication Links
-
- Some bug fixes introduced in 4.2.0
- Due to the request to allow syndication provider checkboxes to be checked by default, I introduced two new filters: syndication_link_checked and syndication_link_disabled. The first parameter of each is a boolean that if true, will set either checked or disabled on that Syndication Provider. The second and third parameter is the uid of the provider and the post_id of the post.
I have been very reluctant to add an auto-post feature that just syndicated everything. I wanted some more granularity around this feature. But I’m not ready to implement it at this time. So, as a compromise, I’ve added a filter if someone does not want to wait for me.
Attending IndieWebCamp SF
I am once again co-organizing and once again volunteering to handle the video for the intros, sessions and demos. This means I will be bringing the equipment to record the sessions, which will be ultimately available online. You can watch our last event, in Berlin Germany, here. The intros, demos, and keynote are not yet up, but I’ve added most of the sessions. You can see examples of those at the prior event in Brighton UK, available here.
IndieWebCamps are a great place to talk about creating or updating your own website and the technologies or ideas around it. The first day involves sessions, the topics for which are chosen by the attendees. The second day is when you build and demo something you built the previous day.
It is a fun event at a minimal cost. If you are in the area, why not stop by?
Simple Location Version 4.0.0 Released
Version 4.0.0 adds/rewrites a lot of the plugin.
- The timezone handling functions were updated to use backported versions of functionality introduced for WordPress 5.3.
- Fixes related to when WordPress’s default timezone is set to a UTC offset over a timezone string. This only works if the site is running PHP5.5 or greater.
- Add support for WeatherBit as a weather provider
- Add support for LocationIQ as a geo and map provider
- APIXU is now WeatherStack
- Add elevation support to geonames provider
- Improve sunrise and sunset functions to account for elevation and introduce new class to handle astronomical functions…plan in future to add additional for weather purposes.
- Improve Settings page and settings page text. Page is now tabbed.
- Add airport weather widget and refresh airport data.
- Last Seen Widget now optionally shows local time, sunrise/sunset times and map.
- Comments are now adjusted with the timezone of the post they are attached to.
- Nominatim geo provider now gets admin email as required by the service
- Timezone overrides are cached.
- A completely redesigned settings page
- Previously, maps were set based on width and height, now width and aspect ratio. There are several presets there. This allows for the introduction of responsive images in the future.
- Enhanced styles for HERE Maps
- The default map zoom level for a post will be automatically adjusted based on altitude or the accuracy of the GPS information.
- Adding /map to a WordPress archive page will load a custom template called map-template.php, which will show all of the locations in that archive on a map, along with a location list. The map-template.php file can be added to any theme to override this.
- The timestamp data extracted from attachments is now adjusted for the correct timezone based on the picture location if set.
- The creation timestamp of media is now displayed if set on the media modal and edit attachment admin screens.
- The location is now displayed on the media modal.
- Historic location lookup in supported location providers(currently only compass). This means when you set the publish date to the past in the Classic Editor or in Micropub, it will look up the historic location if this functionality is available. Not currently in Gutenberg.
- Default Map Zoom settings now describe scale(City, Town, Village) instead of using Zoom number levels.
- You can now update the location of a user using geojson over the REST API, allowing it to be automatically updated by an external service.
- Compass as a location provider can be set on a per user basis, instead of globally.
- Weather is no longer added if the publish time is not recent. Will look into historic weather in a future update.
- Misc bug fixes and validation checks.
Converting Google Location History into GeoJSON for Compass
A few notes
- timeStampMs is the timestamp in milliseconds. Most functions use the timestamp as seconds, so this needed to be converted into an ISO8601 date format.
- latitudeE7 and longitudeE7 are the coordinates, and must be divided by 1e7 in order to get the more conventional format. Also, there was an issue where some of the numbers were incorrectly exported, so there is a sanity check on that below
- accuracy is, as suggested, the accuracy of the location
- Finally, there is activity. I considered doing more with this, but I’m just storing it. Will explain why below the example of my simple PHP code to export.
json = json_decode( $file, true ); $json = $json['locations']; foreach( $json as $item ) { $date = date_create_from_format( 'U', round( $item['timestampMs'] / 1000 ) ); if ( $item['latitudeE7'] > 900000000 ) { $item['latitudeE7'] = $item['latitudeE7'] - 4294967296; } if ( $item['longitudeE7'] > 900000000 ) { $item['longitudeE7'] = $item['longitudeE7'] - 4294967296; } $output = array( 'locations' => array( array( 'type' => 'Feature', 'geometry' => array( 'type' => 'Point', 'coordinates' => array( ( $item['longitudeE7'] / 1e7 ), ( $item['latitudeE7'] / 1e7 ) ) ), 'properties' => array( 'timestamp' => $date->format( DATE_W3C ), 'horizontal_accuracy' => $item['accuracy'] ) ) ) ); if ( array_key_exists( 'activity', $item ) ) { $output['locations'][0]['properties']['activity'] = $item['activity']; }
For activity, it only appears on some entries, and is for the most part, accurate enough..
"activity" : [ { "type" : "IN_VEHICLE", "confidence" : 100 }
It notes the type of activity, and the confidence level. However, in this example…
"activity":[ {"type":"UNKNOWN","confidence":50}, {"type":"ON_FOOT","confidence":36}, {"type":"ON_BICYCLE","confidence":11}, {"type":"IN_VEHICLE","confidence":2} ]
In this example, Google thinks I am either doing something unknown, walking, riding, or on a bicycle. I promise, never a bicycle. So, for now, I consider the information to be less than useful, but am storing it for future use only.
Looking forward to using the data in interesting ways.
Airplane Wifi Location Tracking to Tasker to Compass
The problem is transforming the input from Southwest into the format another system can accept. I did not want to write an Android app for this…I wish there was one.
So, instead I used Tasker, an automation app for Android that does have scripting in it.
So, if you retrieve http://getconnected.southwestwifi.com/current.json, you get the following JSON data.
{ "pcent_flt_complete": 0, "altVal": "-24", "lon": "-73.867", "satcomm_status": { "commlink": "active", "linkparams": "not-stale" }, "dtzone": "CDT", "within_us": true, "etad": "09:20 AM", "lat": "40.775", "gspdVal": "10", "ttgc": "2h 15m", "dist_remain": "888", "actime24": "07:05" }
The Task I created consists of three actions. It uses the HTTP Request action to get the above JSON. Then it uses the below JavaScriptlet(Tasker allows you to write JavaScript, to convert the data into the GeoJSON that Compass expects. The third action posts that to Compass.
var parsed = JSON.parse( http_data ); var gmt = new Date().toISOString(); var alt = Math.round( parsed.altVal * 0.305 ); var feature = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [parsed.lon, parsed.lat, alt] }, "properties": { "timestamp": gmt, "percent_complete": parsed.pcent_flt_complete, "dist_remain": parsed.dist_remain, "source": "flight", "airline": "wn" } }; var compass = { "locations": [feature] }; var featurejson = JSON.stringify( compass );
Now, I am known for not doing much JavaScript work, preferring PHP. But this was simple enough. I could have added more of their parameters, or, since Southwest does not put the flight number into their JSON, allow it to be set.
It is triggered when I am connected to SouthwestWifi, in Airplane Mode, and every 5 minutes. I wasn’t sure if I should poll more often, but 5 minute intervals seemed reasonable. Regrettably, Southwest does not provide more parameters like speed.
I wish some developer would write an app that would do this, partially because, if the wifi goes down, the request will fail and I’ll lose it. I’d rather cache and retry. Also, GPS Logger has some limitations. I wish there was an Android version of Aaron Parecki’s Overland app. Being as he wrote Compass, it works well with that and has those caching features.
I have two flights on two different airlines in the next month, and will see if I can write similar scripts. I enjoy the challenge of trying to write and test it on my phone live.
Next, I need something to display a visualization of this with altitude.
Indieweb Thoughts Post State of the Word
I joined the Indieweb community in 2014, and I feel after 5 years of work, things started to come together. We have a robust collection of plugins and opportunities. But over the coming months, there are some long term goals that need to be achieved.
- The WordPress Block Editor – It is, whether I like it or not, the editor for WordPress is now Gutenberg. The Indieweb plugins currently avoid that reality. I made an effort to make sure that several of them would work with Gutenberg, despite not being Gutenberg ready, but I will have to bite the bullet and learn how to think in blocks.
- The Webmention and Semantic Linkbacks plugin merge – This has been a slow process. It is holding up or delaying further iteration on the feature set…including things such as improved display.
- IndieAuth – Improving and hardening the security of the IndieAuth plugin to prepare for AutoAuth and private post support. This requires some additional refactoring.
- Indieweb Site Health Checker in the Indieweb Plugin – This would parse a site and check its MF2, similar to indiewebify.me
There are obviously other things I’d like to do…improve Micropub for one. but the above are the ones that I think would push things forward the most.
WordPress Webmentions Plugin Version 4.0.0 Released
In the lastest version, several useful features were added.
- Instead of an option to enable webmention support for pages, the plugin now let’s you select the option to declare support for any public post type. This means, by default, you can add support to Media(attachments)
- For outgoing webmentions, the plugin will now only send actual links, not plaintext URLs in content. It will not send webmentions for media files linked to in img tags or such unless you set this setting. Most sites don’t support receiving them directly to the file anyway.
- Avatar Support was previously handled by the Semantic Linkbacks plugin. A new implementation of this was added to this plugin and a version of Semantic Linkbacks will be released that will disable its handling if this is enabled.
- The new avatar support allows for either a URL or an attachment ID.
- For webmentions without an email address, it will serve a local anonymous avatar(a copy of the WordPress default avatar) rather than asking for one from Gravatar.
- If there is an email address, it will cache whether there is a gravatar for a defined period of time…defaultly one week and if not serve the local file as well. This reduces unneeded calls to gravatar.
- Webmention endpoint headers are now only available on URLs on the site that support them. You can disable this and show on all pages. Caching has been enabled to ensure this doesn’t slow page load.
- Misc improvements to the settings and metadata templates in the admin.
This is all part of a longer project to migrate features from Semantic Linkbacks over to Webmentions. But both plugins are several years old, and therefore it will take time to do it right. The goal is to upgrade, improve, and sometimes completely rewrite each part as it comes over, rather than merge the older code together and fix some of the issues subsequently.
The minimum PHP version for Webmentions is now PHP5.4, to accommodate the current official minimum of PHP-MF2, which will be merged in future when the microformats parsing is migrated to this plugin.
Thinking about Time
Part of going into this code, aside from normally doing the rounds of updates & bugfixes on my projects was because WordPress introduced some new functions to better handle date and time functionality. I backported them into my code and adopted them and added several based on the new methodology.
The time handling functionality in my Simple Location plugin started in 2015. I was in a timezone 7 hours later than home, and didn’t like my posts were showing 3AM…it completely changed the context of the post. So, I not only added to my site the timezone, but I wrote the code to transform the post’s time based on a per post setting that would be derived from the post’s location(functionality provided by the plugin already).
If you look at my recent posts, you’d see this adjustment, as I just fixed a few bugs in it. My California posts say PDT, as opposed to my normal EDT.
I also added a widget to my site that can show the current time where I am.
How I can take this further? So, I spent time at IWC NYC learning about sunrise and sunset. PHP, the language WordPress is written in, has built in functions for calculating sunrise and sunset…but it turns out that they don’t properly factor in elevation…which means that the visible sunrise and sunset could be off by as much as 2 minutes. My code does actually derive elevation from an API, so it can make the adjustment.
Being that type of astronomy and math is not my area of expertise, I had to do some reading. And now, with some modifications, my code is now a bit more accurate.
So, why is sunrise and sunset important? I wouldn’t mind my site changing based on time day, but it is mostly that in the Jewish calendar, observances begin at sunset, not midnight. So, I want to be able to account for that.
There are some plugins for calculations, but not with the location based goal I have…it is usually to show the start of holidays and such at a specific location, not to follow me around where I am. So, I want to incorporate work off of this. It makes for an interesting challenge.
There is always more to do. A new Simple Location should be out in the coming days/week and I’ll post about the features.
Playing with Image Tagging for Workflow
Now, in more recent years, my photography has moved from a digital camera to a cell phone. I just recently bought tools to better hold my cell phone when taking a lot of pictures and I enjoy taking pictures.
One of the issues has been with documenting the photos. Not everyone will I post online. Photos taken digitally will have a date, details of the hardware, and if with a cell phone, a location embedded(if that is turned on), but not notes on what it is.
I already had a rather complex app that allowed me to edit all embedded metadata on photos, but I found a simple one that only allowed editing 4 fields…namely title and author, and included bulk editing options.
I then, at the camp, fixed some issues that would pull that information out of a photo when uploaded and use it as the title and/or caption in the backend.
The problem is multi-fold. For one, will I actually label photos on my phone? Secondly, I upload to multiple places automatically…I’m not sure if the changes would sync before or after the automatic upload.
Glad that I am trying this, but more to figure out before it works.
Rules for Bughouse Chess
Bughouse involves 2 chess boards
- Teammates sit beside each other playing opposite colors
- Whenever a piece is captured, it is given to their teammate.
- Teammates can use a move to place the piece on an unoccupied square.
- Pawns cannot be placed on the ends of the board.
- The first person to lose by checkmate or time loses for the team.
- Bughouse is usually played with chess clocks.
- When played without a clock, there is usually a rule preventing a player waiting for pieces (stalling or sitting) indefinitely. One rule states that players may not delay their move beyond the time that it takes for their partner to make three moves
- There is no specific rule against verbal coordination.
Four Player Chess
Four Player Chess is played with a standard board with an extra 3×8 section on each side. There are no official rules. Here are my notes based on a little research.
- 4 Player Chess can be a partnership game, where the object is to checkmate both opposing players at the same time.
- In other variants, you can have partnerships, every player for himself, or temporary alliances.
- Turns move in clockwise order.
- Queens must be placed on the same color..usually white
The most well known 4 player chess was created by Capt George Hope Verney in 1881. There is a copy of his book on the subject here…
- Option 1 – Verney’s original rules for 4 handed chess
- The players who are opposite each other become partners
- No communication is permitted between the partners.
- The pieces of partners do not attack each other, therefore, their Kings can even be next to each other.
- No player can make a move to place his partner in check
- Castling is not permitted
- Pawns can only move one square at a time, not 2 on the first move as in normal chess
- For a pawn to become a Queen, it must reach the edge of the board of one of its enemies, not its partner.
- When a pawn reaches the edge of the board of its partner, it may reverse direction until it reaches the end of its own side…after which it may do so again. It should be marked somehow appropriately.
- The game is won when two of the partners are checkmated.
- When one partner is checkmated, his pieces are not removed from the board, but remain in position. His partner continues the fight singlehanded, while the player misses his turns. His pieces cannot move or be captured, they merely block the board.
- A partner can release his partner from checkmate by capturing pieces or forcing their move by the opponent.
- An opponent, having checkmated a player, can release him, but cannot capture other pieces in the same move.
- Option 2 – Hughes 1888 Variant. All of Verney’s rules except:
- Pawns may advance two squares initially.
- When a pawn’s move is obstructed by a pawn of its partner, it can leap over it, provided the square it moves to is vacant
- Option 3- Variant of prior options where your partner is next to you, rather than opposite.
- Option 4 -A Non-Partner Variant
- Castling and en-passing are permitted. All standard chess rules, except as follows:
- A player’s king must actually be captured to eliminate the player.
- A player may move into a potential checkmate
- A checkmated player may move any of his pieces
- An eliminated player’s remaining pieces stay stagnant on the board (default), but may be captured.
- Pawns can be exchanged for another piece on reaching any end row (ahead, or to the side).
- The last king standing is the winner, or the last two kings standing if they declare a truce or an alliance (unless one of them decides to eliminate the other.)
Packing for the Indieweb Summit
- Computer
- Dell Inspiron 7370 – This is a 13.3″ laptop running Linux which I bought open-box. As I spent more time away from home, I needed something that wouldn’t slow down under load.
- Eleduino 13.3 Inch 2K HDMI Portable Gaming Monitor – There are a variety of these available on Amazon and other sites. I use this as a second monitor for trips.
- Kabcon Quality Tablet Stand – This is a bit more stable then the tiny stand that came with the gaming monitor. It is designed to hold larger tablets.
- Nexstand Laptop Stand – This brings the laptop high enough to handle a keyboard.
- Royal Kludge RK61 Wired/Wireless Keyboard – This will be this keyboard’s first trip. It is a new mechanical keyboard, even smaller than the previous one I carried, that doubles as a bluetooth keyboard.
- Travel Gear
- Lectrofan Mini – I use the full sized version of this at home, and used to carry it around. This is a miniature noise generator that doubles as a bluetooth speaker. There is a new version of this now.
- Aukey USB-C PD Dual 18W Wall Charger – When I bring my USB-C Chromebook and my phone, this allows me to charge both at the same time.
- A GL.iNet GL-AR750S Gigabit Travel AC Router with a microSD card full of movies and music
- A Roku Stick. Carry this for watching video in hotel rooms.
- Monoprice Fast Wireless Charging Pad/Stand – A collapsible wireless charging stand that uses USB-C if needed
- Monoprice Mobile Series USB-C 3-port USB3.0, RJ45 Gigabit Adapter
- Camera Equipment
- Acer 4K Holo 360 Camera – Also the first trip for this item. I saw it on extreme discount and ordered it. It is a small Android LTE capable device that doubles as a 360 camera. I keep wanting to do more with 360.
- Smatree Q3 Telescoping Selfie Stick with Tripod Stand – I use this to hold the 360 degree camera. At the last IWC Austin and last years IWS Summit I used it to hold a webcam for remotely streaming one of the rooms. Will use this to experiment with the 360 camera.
IndieAuth for WordPress Question
I wanted to put out to any WordPress user for some input. The IndieAuth plugin creates an IndieAuth endpoint inside your WordPress installation. This means that you login to your site and that login generates a token to give Micropub, Microsub, or other clients in order to let them have access to your site.
Alternatively, if you don’t install it, the IndieAuth code inside the other plugins will connect to an external IndieAuth endpoint, defaultly indieauth.com. Indieauth.com, for example, delegates your login to a third-party site(Github, for examplle) on which you have an account that you link to from your website. So all you need is to add a link marked up properly to your site for that.
So, the question is, why would people want an external login to a built-in login? Since it uses the WordPress login system to get your credentials, you could install any number of login enhancements for WordPress that would work seamlessly to accomplish the same goal if you want to log in using a third-party site, for example.
It is definitely more secure for you to use authorization under your own control than delegating it to another site. To try and make my life easier, I would like to make Micropub and Microsub dependent on having the IndieAuth plugin installed.
The only use case presented for allowing an external site was…what if I want to sign into Site A with the credentials of Site B? That would be web sign in. There is functionality for that built into the IndieAuth plugin, but it probably deserves to be its own plugin so you can install it or not as the case may be.
Web sign in presents you with a URL and then, when you ask to log in, searches that URL for an IndieAuth authorization endpoint. If none is available, it would fail back on another technique, such as relmeauth…looking for alternative login providers.
Hoping for some comments on why people might want to maintain the external option.
Simple Location 3.7.0 Released
Going forward, Micropub posts with a location property will be set to public by default unless the client sends information indicating otherwise.
To support fixing the ones set incorrectly, there is now a bulk action to set multiple posts to private or public.
For Micropub posts without a location property, there is now a setting to add one from the backend geolocation provider. This will obviously not work with the web browser based provider, only the ones that work in the background. There are currently 2 bundled in.
- Set Location from Author Profile – This will always pull the location set in the user’s metadata. You can read about how to set this here. Thereotically, any external provider that supports HTTP requests could use this
- Compass – Aaron Parecki’s location storage system. I selfhost my own copy.
In a future update, will be looking to set Compass API lookup per user so each user could have a separate feed for location.