Category Archives: Uncategorized

First go game on DGS

First game on Dragon Go Server , was pretty short and sweet. But still exciting at the end with a large capture.

Also an opportunity to test the new Glift plugin for WordPress. Looks great!

I am black in this game.

 

Download SGF

 

Drupal: Pass arguments to a Views block

In Drupal, it is possible to pass arguments to a Views block. You need to use the “Contextual Filters” option in the View. See screenshot.

Pass arguments to a Views block
Pass arguments to a Views block

Here are some other ways but these are possibly outdated (from 2011): http://drupal.stackexchange.com/questions/17900/how-do-i-pass-some-parameters-to-a-block

Installing Drupal 7’s Coder and PHP Codesniffer on MAMP

If you need to check coding standards for your Drupal 7 custom module, there is no better way than using the Coder module with PHP CodeSniffer. Unfortunately if you are using MAMP, and using the PHP executable provided by MAMP, the installation becomes a little more complicated.

Here’s how to install the required modules.

Install Coder

Coder module should be installed in the global Drush directory, rather than in a website’s directory. The Drush directory should be  ~/.drush .

$ cd ~/.drush
$ drush dl coder
$ # Refresh Drush cache to access new commands.
$ drush cc drush

Use MAMP’s PHP for Drush

Assume you are running MAMP’s PHP for Drush. This is done by setting the environment variable DRUSH_PHP to MAMP’s PHP executable with the correct version. This is done by adding in ~/.bashrc or ~/.bash_profile :

# In ~/.bashrc
# Use the path leading to the version of PHP you want to use in MAMP.
export DRUSH_PHP=/Applications/MAMP/bin/php/php5.6.7/bin/php

Installing PHP CodeSniffer

PHP CodeSniffer is a PEAR module.

Go to MAMP’s PHP directory and run the pear executable there, for example:

$ cd /Applications/MAMP/bin/php/php5.6.7/bin
$ # Coder 7.x is only compatible with PHP CodeSniffer 1.x and not the latest PHP CodeSniffer 2.x
$ # See https://www.drupal.org/node/2342611
$ # Install the latest 1.x version of PHP CodeSniffer.
$ ./pear install PHP_CodeSniffer-1.5.6

Then add Drupal coding standards to the PHP CodeSniffer directory:

$ cd /Applications/MAMP/bin/php/php5.6.7/lib/php/PHP/CodeSniffer/Standards
$ # Symlink to Drupal coding standards provided by Coder.
$ ln -s ~/.drush/coder/coder_sniffer/Drupal Drupal

Set up phpcs command

Coder makes use of the phpcs command to use PHP CodeSniffer. Make sure you can run phpcs on the command line, by setting an alias in ~/.bashrc or ~/.bash_profile .

# In ~/.bashrc
# alias phpcs=/Applications/MAMP/bin/php/php5.6.7/bin/phpcs

Test the installation

Test it by using the drush drupalcs command on a PHP file or a module file, for example:

$ # Check code standards for test PHP file.
$ drush drupalcs /Applications/MAMP/htdocs/test.php
$ # Check code standards for a custom module.
$ drush drupalcs /Applications/MAMP/htdocs/public_html/sites/all/modules/custom/mymodule/mymodule.php

All done!

See also: Other methods of installation

There are other ways to install PHP CodeSniffer but they may not work for this configuration which uses MAMP’s PHP.

In particular, the command drush install-php-code-sniffer may not work for you even if you installed Coder through Drush.

The code for this command is in the function drush_coder_review_install_php_code_sniffer() in the file ~/.drush/coder/coder_review/coder_review.drush.inc .

Add Plex to NOW TV Smart TV Box and stream movies from laptop

How to add the Plex app to your NOW TV Smart TV box, and stream movies from your laptop to your (non-smart) TV.

See here: https://www.youtube.com/watch?v=lmQBcbVLWZc

Enter developer mode in the NOW Smart Box

First go to your NOW Smart Box, and enter developer mode. At the channel selection screen, press the following sequence of buttons.

Home x 3, Up x 2, right, left, right, left, right. You have to do this fairly quickly but when you get to this screen you have succeeded.

Press the ok button to enable developer mode. Note the Smart Box IP, username and password.

At that point the Now TV will reboot.

Install Plex for Roku app

Get the Plex for Roku app (the NOW Smart Box is just a restricted version of the Roku box). Get the official one from the GitHub repo: https://github.com/plexinc/roku-client-public , or download the ZIP file: https://github.com/downloads/plexinc/roku-client-public/Plex.zip

Go to the Smart Box IP in your laptop browser, and login. Upload the Plex ZIP file to install it.

Plex will now be found in your channels.

Install Plex Media Server

Get the media server app for your laptop/desktop, from plex.tv, and install it.

Configure it to connect to your Plex app on your NOW Smart Box, and now you can stream!

 

Create a Facebook App and add it as a Page tab

Refer to the guide from Facebook:

Steps in a nutshell

  1. Create your Facebook App.
  2. Make sure you’re the admin of the App and the Page
  3. Add Your App to your Facebook Page.

Adding your App to a Page

This step can be a bit tricky, so read carefully. In order to install your new page tab on your business page, you need to visit a link with several custom URL parameters. The link is:

https://www.facebook.com/dialog/pagetab?app_id=YOUR_APP_ID&redirect_uri=YOUR_URL

You’ll need to replace the parts I’ve bolded in the URL above — “YOUR_APP_ID” and “YOUR_URL” with some information that Facebook provides for your app, your “App ID/API Key” and your “Site URL.”

Facebook App settings
Facebook App settings – get the App ID and URL

After using the URL, you will see a dialog box asking you to choose which Page you want to add the App to. Select the Page and click Save.