Skip to content

Dailyinvention Posts

My Entry Into NFTs

I’ve been interested in cryptocurrency for a while and have been following the emergence of Cardano. A couple days ago I minted a few of my photos to NFTs on the Cardano Blockchain and hope to get them approved on CNFT.IO, a new markeplace for Cardano NFTs.

Here are their links and policies:

My Github PR: https://github.com/Cardano-NFTs/policyIDs/pull/1219

Leave a Comment

My Interview With TWIGG About My Google Glass App

Last night I had the pleasure of speaking to Jeff Powers and Luke Wallace from This Week in Google Glass (TWIGG) to discuss the Ariadne app I created for Glass. If you’d like to check out the show, take a look:

I mentioned in the video that I would release the .apk for users to try out. Now, feel free download my Ariadne geolocation app .apk.

Directions on installing the .apk on your Glass can be found here. Enjoy the Glassy goodness!

Leave a Comment

Rolling With the Google Glass GDK and My Ariadne App

My first Google Glass app is now pretty close to production. It’s not novel, but it fills a hole that Glass does not support. I named it Ariadne after the heroine of Greek myth.

The app allows a user to store one Live card on their timeline with their current geolocation. You may add a more detailed description using voice dictation. And that location is stored on a that live card, so that it’s not just displaying latitude and longitude. Then the user may later reference the card to give walking directions back to the location stored.

It’s an app for people like me who get lost in parking lots. The tag line is “Helpful for those that forgot where they parked their car or are navigating labyrinths”.

My app can be found on Github, if you are interested in checking it out. I give a demo of the app and walkthrough of the code in the video above.

Leave a Comment

Changing Your WordPress Theme Using XML-RPC, Part III

This post is a follow-up to the previous postings discussing how to allow WordPress to change themes using XML-RPC. Part I and Part II talk about the creation of a WordPress plugin, so that we can enable these calls. This post is intended to focus on the creation of a client, to communicate with WordPress. In this case I have chosen the Android mobile platform, mainly because I own an Android device and it is fairly straightforward and less expensive to create and test. Forget paying a hundred dollars a year for a developer’s license.

I’ve posted a walkthrough of the app on Youtube:

This app uses the android-xmlrpc Android Java library to easily create XML-RPC calls. Demonstrations on how to use this library can be found in this Codeforest article. This article also helped get me started with building a Android XML-RPC client application, although it does not focus specifically on WordPress.

The WordPress plugin that I created in the last two articles can be found on my Github account, as well as this client for your perusing. If you have any questions, shoot me a comment and I’ll try to respond in a timely fashion.

All code was written using the Eclipse IDE, which offered a good set of training wheels for Java beginner like me.

This app is not quite ready for production. If you choose to compile and use this app on your own, it is preferred that you do this with a WordPress site with an SSL certificate. I bear no responsibility for your site getting hacked because of a man-in-the-middle attack. Be safe and be smart.

Leave a Comment

Changing Your WordPress Theme Using XML-RPC, Part II

Last week I talked about how to enable getting theme names within WordPress using XML-RPC. So now our imaginary mobile app can retrieve a list of theme names from WordPress, but we want to switch the theme once a name is selected. We’ll have to create another function and assign it to method to be called.

WordPress has another function called switch_theme, so this time around we will be making this available. Here is our plugin with the additional code:

<?php
/*
Plugin Name: XML-RPC Theme Changer
Plugin URI: https://github.com/dailyinvention/xml-rpc-theme-changer
Description: Allows the ability to get and switch themes using XML-RPC.
Author: Stefan Holodnick
Author URI: http://blog.dailyinvention.com
Version: 1.0
*/
  
function theme_get_themes($params) {
  global $wp_xmlrpc_server;
  $wp_xmlrpc_server->escape( $params );
  
  $username = $params[0];
  $password = $params[1];
  
  if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) ) {
    return $wp_xmlrpc_server->error;
  }
  else {
    return wp_get_themes(false, true);
  }
  
}
  
function theme_switch_themes($params) {
  global $wp_xmlrpc_server;
  $wp_xmlrpc_server->escape( $params );
  
  $username = $params[0];
  $password = $params[1];
  $theme = $params[2];
  
  if ( ! $user = $wp_xmlrpc_server->login( $username, $password ) ) {
    return $wp_xmlrpc_server->error;
  }
  else {
    switch_theme( $theme );
  }
}

  
function theme_methods($methods) {
  $methods['themes.getThemes'] = 'theme_get_themes';
  $methods['themes.switchThemes'] = 'theme_switch_themes';
  return $methods;
}
  
add_filter('xmlrpc_methods', 'theme_methods');
  
?>

As you can see the theme_switch_themes function that I added is very similar to the theme_get_themes function. It grabs a username and password sent by a client, sanitizes those values, and verifies the user with WordPress. If the username and password do not match up, then it returns an error, otherwise it runs the switch_themes function. You may also see an extra parameter called theme. This is the theme name that a user will send to WordPress through their mobile app. The switch_theme function then switches the theme to the name provided.

You’ll notice that I then include my function within the list of methods, giving it the name “themes.switchThemes”. Again this is the method that your client application will call to trigger a theme switch.

Now we have a plugin that allows a remote application to get and switch themes within WordPress. I’ve included the complete plugin at my Github account, if you would like to try it out. Maybe you may have a different idea for using WordPress’s XML-RPC commands. You can take this example and are free to do what you want with it. Some of the authentication code I used was directly from WordPress’s XML-RPC documentation.

Also, a word on security. Having an SSL certificate for your WordPress installation is preferred when doing XML-RPC calls. Although it is about as risky as logging in to a non-SSL encrypted WordPress site, you are still subject to man-in-the-middle attacks.

The next part of this tutorial, I will be talking about creating a mobile app that interacts with WordPress and uses the methods we have created to make the magic happen.

Leave a Comment