colin

Mar 252014
 
php

Hopefully when WordPress 3.9 is available next month with the new editor the stripping of formatting from uploaded content will be a thing of the past. Until then the way I have overcome the problem is with a small piece of additional code in functions.php.

//Retain formatting in posts
//move wpautop filter to AFTER shortcode is processed
remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'wpautop' , 99);
add_filter( 'the_content', 'shortcode_unautop',100 );

Hopefully this will help someone else

 Posted by at 11:11 am
Mar 202014
 

Daniel LeFever 1838-1906I recently found out some more information about my 2x Great Grandfather Daniel Lefever (abt 1838 – 1906).  I found him in the 1851 and 1871 census’ at home in Bethnal Green but could not find him in the 1861 census. I eventually tracked him down as a sailor on-board HMS Queen berthed in Beyrout (sic) Syria. I knew that his wife Isabella McGowan was born in Ireland but could not find details of their marriage in England. I eventually traced the details of their marriage to Ireland in 1868 when Daniel was serving on-board HMS Trafalgar. I then started looking for more details about Daniel’s naval service. I tracked down a record of his service on the National Archives website.

The record was available as a digital download for £3.36. Great I thought, but what does it contain? There was no real clue see the search results, no indication of how many pages or further details so I decided to pay the money for the record by PayPal and promptly downloaded the PDF file. I opened it and to say I was disappointed is putting it mildly. It was 10 pages long. The first was the National archives cover, page 2 was his personal details, page 3 his service record which was blank, page 4 was a copy of page 2, page 5 his certificate of fitness to serve, page 6 blank, page 7 a copy of page 5, page 8 blank and finally pages 9 & 10 copies of page 3 a blank service record.

How someone can serve on the Royal Navy aboard at least three ships and not have any sort of service record I do not understand.

So for my £3.36 I got one page of useful information, his service number, his date of birth, his description, date of enlistment, period of service and his first ship. Not particularly good value for money in my opinion.

I emailed the National Archives to ask them to check the original record to ensure that I received everything I paid for and am still awaiting a response.

It would be nice if they could give some indication of what is in the document you are going to download or even thumbnails of the pages so that you can make an informed decision.

 Posted by at 10:09 am
Mar 142014
 
Family Historian

I use Family Historian V5 to record my research for both my personal genealogy and my one-name study. Family Historian is only available to run on a PC with XP or later operating systems, for me this was OK until I wanted to take my research with me as I use a MacBook Air as my laptop of choice for when I am away from my desktop.

To run Family Historian on my MacBook meant that I would have to use an emulator of some sort to allow it to run. There is a choice either to run Windows as a virtual operating system within the Mac environment using the free Virtual Box or similar. The disadvantage of this approach is that you must have a copy of Windows that you can run in the virtual machine. The other choice is to use an emulator that packages the Windows application to run under OSX. I chose this latter approach and used Crossover from Codeweavers to create a version of Family Historian that would run on my Mac.

The installation of Crossover on the MAC is straightforward and I won’t go into that here. The installation of Family Historian, however, requires a couple of tweaks to get it running properly and these are detailed here.

Installation

In Crossover create a new application ‘Bottle’ as usual.

To ensure that plug-ins work correctly a line needs to be added to the Family Historian bottle.

Open Crossover as usual in the Configure menu select Manage Bottles, select the Family Historian bottle, then in the dialog box that opens select Open C:drive. Finder will now open go up one level in finder and select the cxbottle.conf file and open it in a plain text editor. Scroll to the bottom of the file and you will find a section that starts after [EnvironmentVariables] at the bottom of this section add a new line:

“COMPUTERNAME”=”YOURNAME”

Replace YOURNAME with your computer name.

Ensure that the quotes are normal ones and NOT smart quotes.

Save the file.

Installation of Add-Ons for Family Historian

Before attempting to install any add-ons at all to Family Historian check the file associations in your browser. Ensure that the file extension .fh_lua is associated with Family Historian. All other associations should be fine but if you have any problems installing any downloaded add-ons check the file associations in your browser.

If you have any problems installing plug-ins as a web download just save the plug-in in your download folder. The in Family Historian go to Tools > Plug-ins > More > Import and browse to your download folder and import them.

If you have problems installing Fact Sets, Queries or Property Box Tabs then go to File > Import and select the appropriate file type there.

Plug-in known not to work

  • Backup and Restore Family Historian Settings – This plug-in cannot access the registry and therefore cannot save the Family Historian settings.

Non-functional Issues

  • The in-built Family Historian PDF printer does not work. If you need a PDF printer that does work with Family Historian running on the MAC then use the free PDFWriter application. This installs at the MAC OS level and is available as a printer within Family Historian.
  • Reports from the Publish menu do not display correctly on screen, they only show multimedia items and not the text. However, if you print to a printer or PDFWriter then both text and images are displayed.

Examples of Family Historian screens on the MAC.

In a later post I will cover how to get Ancestral Sources, a popular companion application for Family Historian, running on a MAC too.

 Posted by at 9:40 am
Mar 122014
 
Gravity

I am currently developing a WordPress website for a genealogical organisation. One of the things they wanted was for any website visitor to be able to complete a contact form and for the content of the form to go direct to their member and not to the WordPress Admin email address.

The first thing to do was to create the contact form in Gravity Forms. This was just a simple form requiring first and last names, email address and message text. To this form I added a hidden field to store the email address that the form should be submitted to. I also created a custom notification to go along with this form. I called the notification ‘Profile Contact’. It does not matter which of the ‘Send To’ options you choose in this notification.

The next thing was a bit more complicated and it caused me to have an email exchange with Chris and Richard at Gravity forms support to get this up and running.

The page that accesses this contact form is based on a customised page template. This is the relevant piece of code that calls the contact form

<div class="cs_detail">		
<div class="cs_detail_header">Contact Details:</div><!--/cs_detail_header-->
<div class="cs_detail_content">
For more information please contact: 
<?php
$_SESSION['member'] = $study_member;
$contact = $wpdb->get_row("SELECT * FROM members WHERE number = '$study_member'");
$details = $contact->title." ".$contact->firstname." ".$contact->surname;								
echo " <b>". $details."</b>  ";
?>
<button class="eModal-1">Send Email</button>
</div><!--/cs_detail_content-->
</div><!--/cs_detail-->

This code needs a little explanation, the session variable is used to pass the result of another query on another custom table over to the custom Gravity Forms function.  The button is provided by the Easy Modal plugin that I use to display the contact form as a modal window over the page.

Two functions need to be added to the Themes functions.php file.

The first one is:

/** Set the email to address on the contact form **/
add_filter('gform_notification', 'change_autoresponder_email', 10, 3);
function change_autoresponder_email( $notification, $form, $entry ) {

    // There is no concept of user notifications anymore, so 
    // we will need to target notifications based on other 
    // criteria, such as name
    if($notification["name"] == "Profile Contact"){

        // toType can be routing or email
        $notification['toType'] = "email"; 
        // change the "to" email address
        $notification['to'] = $entry["4"];

    }

    return $notification;
}

The code is copied straight from the Gravity Forms documentation here. I used the code in Example 2 and just changed the value of the $entry to 4 as this was the field number of the  hidden field. I also changed the $notification to reflect the name of my custom notification form. (Don’t forget to delete the default notification or you will still get emails to the WordPress Admin account too).

The code for the second custom function is

// will populate a field in your form which has a parameter name of 'email_to'
add_filter("gform_field_value_email_to", "populate_email_address");
function populate_email_address($value){
	global $wpdb;
	$study_member = $_SESSION['member'];
	$contact = $wpdb->get_row("SELECT * FROM members WHERE number = '$study_member'");
	$email = $contact->studyalias1."@mydomain.org";
	return $email;
}

There is some explanation of this code required. As I am connecting to the WordPress database to get the email address from a custom table the global $wpdb variable needs to be added to the code. The membership number variable ($study_member) is populated from the session variable and then used in the query. The email address is constructed and then passed back to the Gravity Form in the hidden field. To prove this you can put it in a visible field on the form for testing purposes.

This works exactly as required by my organisation and shows the versatility of Gravity Forms.

Other useful links relevant to this post

Easy Modal plug-in.

Gravity Forms plug-in.

Gravity Forms documentation on the entry object.

 Posted by at 5:08 pm
Mar 102014
 
php

Rather than adding the bloat of one of the php plug-ins to your WordPress site you can just add a small piece of code to your functions.php.

 /** Execute PHP code in a standard text widget **/
 add_filter('widget_text','execute_php',100);
function execute_php($html){
     if(strpos($html,"<"."?php")!==false){
          ob_start();
          eval("?".">".$html);
          $html=ob_get_contents();
          ob_end_clean();
     }
     return $html;
}

You should really create a child theme and put this code in there rather than in your theme’s functions.php as if you upgrade your theme you will lose the custom code.

 Posted by at 2:43 pm
Apr 042012
 

Photo from Glyn Dewis

Have you ever wanted to achieve the look above demonstrated in this photo by Glyn Dewis?

If so please read about his technique on his blog here.

 Posted by at 1:23 pm
Apr 032012
 

I have a camera mount that I bought cheaply of eBay some while ago for the mounting of a camera (still or video providing it has a standard tripod mount thread) on a motorbike or bicycle. It doesn’t have quite enough range of movement to suit my current motorcycle, a Honda Valkyrie, with all the other things that I have mounted on the handlebars.

Existing mount

Existing mount

I therefore went looking for a now one with more range of movement. I found one that had much more movement and looked very flexible as it would fit onto tubes of up to 40mm in diameter and so would be suitable for mounting on handlebars, risers or engine bars.

New mount

I mounted it onto the risers to get a lower view of the road ahead and it looked great, locked on easily and didn’t mark the chrome.

Video camera mounted right side

Video camera from rear

 

Unfortunately this mounting was not very successful as it was too flexible in one of the joints and it did not keep the camera still. The joint in question is shown in the photo below, there is no way to tighten this joint as it is spring loaded and the spring tension is too light to dampen any vibrations.

Joint highlighted

This is an example of the video shot with this mount (it is low quality on purpose) and it has had YouTubes’ image stabiliser setting applied.  I hope that it doesn’t make you feel too queasy watching it.

This is an example of a video shot with the old mount.

I have not singled out the eBay supplier of this new mount as I don’t think that it is fair as there are many suppliers on eBay offering this mount.  My advice would be not to buy this type of mount for a video camera if you want to mount it on a motorcycle. It may be suitable for mounting on a car or bicycle but I haven’t tested it.

 Posted by at 12:11 pm
Mar 012012
 

580EX-IIHere is a free video that I can recommend that you watch if you are interested in taking photographs using Canon Speedlites.

Syl Arena the author of the Speedliters Handbook recently ran a tutorial session at  B&H Photo‘s event space in New York. The event was videoed and B&H have made the entire 1 hour 43 minute presentation available to watch online for free.  You can watch it below.

 Posted by at 1:11 pm
Nov 102011
 

What focal length lens to use for a flattering portrait shot?

The conventional wisdom seems to suggest that 50mm is ideal on a full frame camera. Personally I prefer somewhere between 70mm and 100mm. I recently came across a comparison done across a wide range of focal lengths on Stephen Eastwood’s website. I won’t plagiarise his page here but encourage you to look at the photo below and to read the article on his website.

Focal length comparisons

I hope this gives you something to think about and to try next time that you have to take a portrait shot.

Whilst you are at it have a look at Stephen’s main website he is an excellent portrait photographer in my opinion

 Posted by at 12:00 pm
Nov 062011
 

This post is about getting photos onto the iPad.

The easiest way is to take a photo with either of the cameras already present in the iPad but the quality of these leaves much to be desired. The second way is by uploading them to the iPad from iTunes from your computer. It is the third method that I am going to write about, that is the use of a camera connection kit and uploading the photos direct from your camera to the iPad.

The official Apple iPad Camera connection kit costs £25 and is available direct from Apple here. You get two adapters one with a USB connector on to plug your camera cable in to and the second has an SD card slot in it. Alternatively you can purchase a camera kit made in China from eBay such as this one for around £4. One of the advantages of the eBay one is that it is slightly larger and it has both USB and SD card slots in the same adapter , there is a small slide switch on the side to select which input to use.

Apple connectors

eBay adapter

The adapter just plugs into the port at the bottom of the iPad. It is then just a matter of putting in your SD card or connecting your camera to the USB interface.

Once you have connected to the iPad you will see a screen like this

Import screen

As you can see the iPad recognises and imports both RAW (it knows my Canon 40D RAW files anyway) and JPG files. You now just select the Import All button on the iPad and your images will be imported.

On Import

You get the option to delete the files from your camera / memory card if you want to. Your images are stored in the ‘All Imported’ folder on the iPad.

Album screen

Finally you can view both the RAW and JPG images on your iPad.

Image display

When you get back to your computer you can then import the photos as you normally would through your file browser interface.

This is an easy method of getting your photos onto your iPad and displaying them immediately on a 1024 by 768 screen and of course you can zoom into them as normal on the iPad. I found this a really good £4 investment and even the official Apple one at £25 is not too bad either.

 Posted by at 12:16 pm