Signed up for Facebook, Twitter, and Instagram

Step one complete. I just signed up to all three big social networks that offer APIs. The process for each of the networks was very easy to sign up.

First I signed up to Facebook:


Then I signed up for Twitter.



Finally I signed up for Instagram.



Next step is prioritizing which API to dig into first. Me thinks I’ll start with Facebook to start accessing that sweet sweet graph API.


Learning the Facebook API

I want to make a page here on my site to showcase how I learned the Facebook API.  I’m about 150 pages through Jaron Lanier’s Who owns the future, and it’s getting clearer and clearer that I need to build a “siren server.”

In Who Owns the Future?, Jaron Lanier posits that the middle class is increasingly disenfranchised from online economies. By convincing users to give away valuable information about themselves in exchange for free services, firms can accrue large amounts of data at virtually no cost. Lanier calls these firms “Siren Servers,” alluding to the Sirens of Ulysses. Instead of paying each individual for their contribution to the data pool, the Siren Servers concentrate wealth in the hands of the few who control the data centers. For example, he points to Google’s translation algorithm, which amalgamates previous translations uploaded by people online, giving the user its best guess. The people behind the source translations receive no payment for their work, while Google profits from increased ad visibility as a powerful Siren Server. As a solution to this problem, Lanier puts forth an alternative structure to the web based on Ted Nelson’s Project Xanadu. He proposes a two-way linking system that would point to the source of any piece of information, creating an economy of micropayments that compensates people for original material they post to the web.

More info as it’s mined.

List of Resources:

Top Graph API videos on YouTube:

Running PHP in WordPress

By the end of this tutorial you will have learned how to create a child theme on your WordPress installation. You will also have learned how to run your own custom PHP inside of WordPress.

Create a child theme

You’re probably going to dismiss this instruction because you can get away with not doing this: Make sure you create a child theme first.

There are a lot of blog posts on how to create child themes in WordPress. Most of them are out of date.

The best tutorial on creating child themes in WordPress was written by Nick Roach. Follow the instructions on his blog to get this done before moving on.

Create a new page in WordPress

WordPress puts restrictions on where it will allow PHP to be run. You will need to create a template page. Please follow the instructions below to create a new page:

  1. Log into WordPress.
  2. Go to the Dashboard.
  3. Create a new page.
  4. Save the new page.

There, you’ve finished setting up a new page. Next we will go to the file browser and create the template file that your new page will point to.

Open your file browser and find the location of your wordpress installation. Mine is: /home/david/Documents/website

Navigate to the folder with your current theme. This should be the child theme you created in the first part of this blog post. Mine is: /home/david/Documents/website/wp-content/themes/hemingway-child

I copied the file page.php from the parent theme into this directory for my child theme. Let’s rename page.php to templatePage.php.

Remove the page’s content

The only parts we need of this page are the scaffolding. Let’s remove the following code from templatePage.php:

<div class="post-content">
  <?php the_content(); ?>
  <?php if ( current_user_can( 'manage_options' ) ) : ?>
  <?php edit_post_link( __('Edit', 'hemingway') ); ?>
  <?php endif; ?>

<!-- /post-content -->

Add your own PHP

Now templatePage.php should look like this. I’ve added comments to show where the content of the page should be put in the updated page. Be sure to wrap your PHP code with PHP tags!

<?php get_header(); ?>

<div class="wrapper section-inner bottom-margin">						

<div class="content left">
  <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div class="posts">

<div class="post">
      <?php if ( has_post_thumbnail() ) : ?>

<div class="featured-media">
          <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php the_post_thumbnail('post-image'); ?>
    <?php if ( !empty(get_post(get_post_thumbnail_id())->post_excerpt) ) : ?>

<div class="media-caption-container">
        <?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?>

    <?php endif; ?>

<!-- /featured-media -->
<?php endif; ?>								

<div class="post-header">

<h2 class="post-title"><?php the_title(); ?></h2>


<!-- /post-header -->   				       	        		            

<!-- This is where we will put our code. Be sure to wrap your PHP with php tags! -->
<?php echo "Hello World!"; ?>
<!-- END CONTENT -->


<!-- /post -->
<?php if ( comments_open() ) : ?>
<?php comments_template( '', true ); ?>
<?php endif; ?>

<!-- /posts -->
<?php endwhile; else: ?>
<?php _e("We couldn't find any posts that matched your query. Please try again.", "hemingway"); ?>
<?php endif; ?>

<div class="clear"></div>


<!-- /content left -->
<?php get_sidebar(); ?>

<div class="clear"></div>


<!-- /wrapper -->
<?php get_footer(); ?>

Now we can run any PHP code inside of templatePage.php that we want. This page can be used to set up a form, query the database, and process forms. Contact me if you have any specific questions about this part.

Name the template

The next step is to name the template so it is accessible from the WordPress Dashboard. Add the following lines to the top of templatePage.php:

<?php /** Template Name: My Awesome Template */ ?>

Upload the template

Next you need to upload your new template file into the child theme directory. This is how WordPress will see your new template.

Set page with new template

Go back to the page you created at the beginning of this blog. Find the following section on the “Edit page” screen in the Dashboard (it’ll be in the sidebar. Quick note, if you are not self hosting, you will not see this option):


That’s it!

Save the page and reload it in your browser. If everything has been set correctly, you will see a standard looking page with your PHP code running inside of it.

Contact me if you have any questions.

Just submitted my first post to Hacker News

IMG_8933Very happy to have posted my first post to Hacker News. This weekend I hacked together 2 scripts that I have been wanting on my computer for a long time.

Gotta remember next time to post it with “Show HN:” in the future. I have been reading HN for a very long time and it’s nice to have finally posted something up there that I made.

I plan on posting more now that I have an account with my name. I want to get into more discussions on HN and maybe start responding to some questions, or give my feedback on things.

I’m glad that I set it up with my real name. That’ll keep me professional in all of my online comments.


Every single day I start out by creating a new text file with the following headings:





I write for a while in the NOTES section and gather my thoughts freely for about 20 minutes. Once the 20 minutes are up I look through the notes and group the action items into the DOING section. Then I take another 2 minutes to organize this list and prioritize it.

My entire day revolves around this list that I create in the morning. Hackers are lazy right? I wanted a way to automate the creation of this daily text file. So I wrote one up and tested it this weekend.



I was inspired to create this script when I installed ‘fortune’ on my computer. Fortune prints out a cool fortune to the command line. I collect quotes and I wanted to have a quick way to access these quotes.

I created a script that pulls a random quote from a quotes.txt file and prints it to the command line.


Hacker News

There’s a hacker meetup in the new room that I helped to design and create at the University of Hawaii at Manoa. I want to showcase these two scripts today.

I have a student assistant that I am working with. My goal is to have him post something on Hacker News by the end of this semester. We are working on a network map in our office.

Rather than have him post something to Hacker News without having done it myself, I decided to post these 2 utilities to HN to see how the process went. It was very easy. I did learn that HN has a limit on how many articles you can post at a time. I am currently waiting to post a link to Journal.