Year: 2010

FileMaker Custom Function for formating Date Separators

FileMaker Pro

I’ve finally created from scratch my own custom function for date formatting, I’ve appropriately called format.date (renaming my earlier format.date custom function to format.versions.date) as all it does is replace the date dividers or separators “.” and “-” with a standard “/”.

So here it is:

format.date (theDate)

Let (

_divider = “/”;

GetAsDate ( Substitute ( thedate; [“.”; _divider]; [“-“; _divider] ))

)

I use it on all my date fields with theDate replaced by the FileMaker Self Function and setup as a date field with an auto-enter calculation that replaces the content, so that I can make sure that I have all dates entered with the correct dividers.

I’ve also submitted it to Brian Dunning’s excellent online repository of custom functions so that I can share it with the world. My first act of giving back (hopefully the first of many).

Filed under: FilemakerTagged with: , , ,

How to Add Web & Email Links to Adobe InDesign CS3

Adobe InDesign CS3 File

Sometimes you want to achieve something that you think should be easy, but it turns out not to be as easy as you imagined and not because the task itself isn’t straightforward but because you can’t find the tools to achieve the task and the help isn’t say helpful.

So if like me you don’t use InDesign too frequently and you don’t want to puzzle around looking for the function to convert some text into either a web link or an email link then you’ve come to the right place.

How to add an web or email link to text in Adobe InDesign

1. Select the text you’re looking to convert.

Selected Text

2. Right Click on that text and you’ll see this menu:

InDesign Menu

3. You’ll want to select “Interactive” and you’ll get this menu:

Add Hyperlink

4. You’ll want to select the “New Hyperlink…” (I know who calls URLs Hyperlinks anymore?) And you’ll get this menu:

Add Hyperlink

6. Choose URL and if you’d like to link to website put it in this format: http://www.me.com or if you’d like to send to an email put this format: mailto:me@me.com

Add URL

7. And if you want to avoid the standard, ugly Adobe styling then make sure to select: Type and choose “Invisible Rectangle”:

Display Type

And that’s it. You’re done.

Filed under: HelpTagged with:

A Disappearing Word Scroll Bar

Mac Word 2008

So a customer called this afternoon with the strangest of problems: the scroll bar in her copy of Word 2008 for the Mac had disappeared.

It seemed a tad strange so I used logmein to remote navigate into the computer and this is what she was seeing:

Word 2008 without a Scroll Bar
Word 2008 without a Scroll Bar

As you can see there was no scroll bar.

This is what she was expecting to see:

Word 2008 with a Scroll Bar

As I’ve never seen this before I had to take a look about, but I figured it was probably a view setting that had killed the scroll bar. And true to my expectations it was.

Microsoft Word 2008 View Menu
Microsoft Word 2008 View Menu

So if you experience this problem you can correct it by going to the view menu (as seen above) and navigate to the “Full Screen” option, and make sure it is un-ticked.

Filed under: HelpTagged with: ,

Exporting to vCard from FileMaker

FileMaker Pro

FileMaker doesn’t offer the same level of system integration with OS X as it’s little brother Bento, although it offers more power. It is possible, however, with a little work to extract the data you want to use, in the format you need.

The advantage of being able to export a contact to a vCard is obvious. Once you have the vCard you can then import that vCard into Apple Address Book and from there into your iPhone or your Blackberry, pick your poison.

Oh and you can of course export either one contact record or all of the records.

So how do we do it?

A little googling led me to this post by Simon Page which provides an excellent guide on how to achieve this solution via a custom function, without any plugins.

Like Simon I stored the results in an un-stored calculation field and used the linked XSL stylesheet to facilitate the export. You can find a link to the standard stylesheet here.

My adjustments

I have adjusted his custom function, which I’ve named (following my conventions) export.vcard to add the following available fields in the vCard:

NICKNAME

This is simple enough to achieve:

Add the parameter:

AKA

Add this to the variables:

_Nickname = AKA;

Add this to the formatting for the vCard:

vnickname = _Nickname;

Add this to the final formatting:

“NICKNAME:” & vnickname & “¶” &

PHOTO

I’ve tried this with a series of combinations of the above, with images held in the file as well as stored with a reference to no effect. So I decided to take a look at a vCard from Apple Address Book with TextMate only to discover it’s encoded in base64. So for the moment I’m stuck, but I’ve a few leads, and I’ll update once I’ve found a solution.

BDAY

This is a little more complicated to achieve. You must export the date field in the right format. Here in the UK we format our dates as DD/MM/YYYY but for it to work with the vCard format it needs to be formatted as YYYY/MM/DD, so I created the following custom un-stored calculation field: c_Formatted_Date_of_Birth.

Rather than perform the calculation in the field I heading over to Brian Dunning’s site again and picked out a suitable custom function to allow me to reformat the date I had in my Date_of_Birth field. I chose this one penned by Tim Anderson. And I was able to provide the date in the format I needed. Then I just needed to:

Add the parameter:

DOB

Add this to the variables:

_BDAY = DOB;

Add this to the formatting for the vCard:

vbday = _BDAY;

Add this to the final formatting:

“BDAY:” & vbday & “¶” &

Updates

I’ve not yet completed my final vCard export routine so I’ll update this blog post with more information as I build out the new database. So check back for more.

Filed under: FilemakerTagged with: , , , , , , ,

FileMaker Custom Function for Initials

FileMaker Pro

So in my last blog post you’ll of noticed that I used a custom function called format.initials. I used the function in my calculated field: c_Postal_Name so that I could extract the initials from a name.

Custom functions are a great way to reuse FileMaker code again and perform the same function on multiple fields. There are some great resources out there to help you get started with custom functions, my favourite of which is the custom function section on Brian Dunning’s site (see here).

Rather than re-invent the wheel it is often possible to take someone elses code and adapt it for your own use. In this instance I took a custom function by Ray Cologon of NightWing Enterprises, designed to calculate Acronyms.

Apart from renaming it to suit my naming convention (I name all custom functions by their function, so Ray’s Acronym Function became format.acronym) I just added

& “. “

to the function in each section of the loop and my format.initials custom function was born.

So here it is:

format.initials (name)

/*
Adapted from http://www.briandunning.com/cf/33
*/
If (
WordCount (name) > 1;
Upper ( Left (name; 1)) & “. ” &
format.initials ( RightWords ( name; WordCount (name) -1));
Upper ( Left ( name; 1 )) & “. “
)

You’ll also note that I’ve added a reference to the original custom function I’ve adapted so that it’s properly credited and if I need to reference the original again a few months down the line I can easily do so.

Oh and one note of caution here. If you want to make use of custom functions you’ll need FileMaker Pro Advanced.

Filed under: FilemakerTagged with: ,

The Perfect Calculated Name Field in Filemaker

FileMaker Pro

All database solutions have a basic challenge, which is to present data in the easiest possible format and account for all possible variables.

Once you move over to a database system for contact management as opposed to just the Apple Address Book or Outlook you can use some of this power to better deal with the complexity that contacts can present and thereby provide yourself or your customers with a more complete solution.

Properly formatting names is one of the first things that I dealt with whilst implementing my first Filemaker solution and so when it came to re-building my customer’s database I wanted to make sure that I had taken care of every eventuality.

So what can a name consist of?

1. Forename

2. Middle_Names

3. Surname (or Family Name for those countries that don’t follow the English naming conventions)

This is normally the basic for dealing with the visual display of names within a solution, however, if you want your solution to also take care of names for say printing envelopes (yes some people still send letters) you’ll have to consider:

4. Title

5. Suffix

Now this takes care of the basic fields that you’d need to create in your solution for the average Joe or Jane Bloggs, but there are also some other things to consider:

What if your contact is female and has been married but still uses her maiden name for business correspondence and that’s the context you’ll be contacting her in? You’ll need a field for that:

6. Maiden_Name

So for this contact you’d end up entering data for both her surname and her maiden name, but you’ll want the flexibility to decide whether or not you want that data, so you’ll need a field to capture that choice:

7. Use_Maiden_Name

And what if you need to know your contacts full legal name but in reality you actually refer to them by their nickname as it’s so much easier? You’ll want a field for that:

8. AKA_Name

And again you’ll want maximum flexibility so that you can choose how to display this information, so you’ll need a field to indicate if you want to use that nickname for display in your system:

9. Use_AKA

And that I think covers all the main variables you might have to deal with when considering names (though I’m conscious I’ve ignored titles of nobility, mainly because I haven’t decided how to deal with them yet – future blog post?) So what field types do you choose?

Field Types

All the fields except Use_Maiden_Name and Use_AKA_Name should be text fields. For these two exceptions I simply use a number field, which I use a checkbox in the interface to fill with a 1 if they are to be used, if they are not to be used (the default position) then they remain empty. This leaves the user with the maximum flexibility.

The Calculation

So for the calculation we are obviously going to use a calculated field, I prefer to use an un-stored calculation that minimises the amount of data stored in the database as it is recalculated each time it is needed based on the context of the record being displayed in the database.

The main problem you are going to have to deal with is spacing. A calculation in Filemaker is relatively simple. You take two fields: Forename and Surname and combine them using the following syntax:

Forename & Surname

But this is going to give you the following result: JoeBloggs

So you have to add the space to the calculation:

Forename & ” ” & Surname

Giving you: Joe Bloggs

Naturally you can see once you are dealing with all of these variables your calculation is going to get pretty complicated.

The Old Name Display Calculation

In the system I am replacing the calculation looked like this:

 

 

 

 

If(IsEmpty(Forename); “”; Trim(Forename) & ” “) &
If(IsEmpty(Surname); “”; Trim(Surname))
If(IsEmpty(Forename); “”; Trim(Forename) & ” “) &If(IsEmpty(Surname); “”; Trim(Surname))

And produced a correctly formatted Mr Joe Bloggs if all the fields were filled.

It uses the simple Filemaker If Statement that allows you say:

if something is true do this, otherwise do that.

It also uses the simple Filemaker IsEmpty Function that allows you to check if the field has any content.

Initial Replacement

Initially I just tried to replicate this function and came up with the following calculation:

Case (

not IsEmpty(Contacts::Use_AKA) and not IsEmpty(Contacts::Use_Maiden); Trim(Contacts::Title & ” ” & Contacts::AKA_Name & ” ” & Contacts::Maiden_Name);

IsEmpty(Contacts::Use_AKA) and not IsEmpty(Contacts::Use_Maiden); Trim(Contacts::Title & ” ” & Contacts::Forename & ” ” & Contacts::Maiden_Name);

not IsEmpty(Contacts::Use_AKA) and IsEmpty(Contacts::Use_Maiden); Trim(Contacts::Title & ” ” & Contacts::AKA_Name & ” ” & Contacts::Surname);

Trim(Contacts::Title & ” ” & Contacts::Forename & ” ” & Contacts::Surname)

)

The FileMaker Case Statement allows you to nest multiple Filemaker If Statements and thereby achieve something more complex and as you can see it’s pretty complicated and difficult to read.

You’ll also notice I used the FileMaker IsEmpty Function in a different way by adding the not in front of the function you’re able to reverse the function to assess when a field is filled rather than empty.

And although it worked in some instances I hadn’t taken account of all of the variables and I came to the conclusion that by using the FileMaker Case Statement I have to repeat each test to get the right result in every context and where to add or remove spaces was also becoming pretty complicated.

So after a little time googling, I came across this blog posting from Skelton Key which explained the power of the FileMaker Let Function. After a little fiddling around I came up with the following calculation:

The Improved Name Display Calculation

Let(

[

title = If( not IsEmpty (Contacts::Title); Trim(Contacts::Title) & ” “; “”);

forename =  If( not IsEmpty (Contacts::Forename); Trim(Contacts::Forename) & ” “; “”);

middlename = If( not IsEmpty (Contacts::Middle_Name); Trim(Contacts::Middle_Name) & ” “; “”);

aka = If( not IsEmpty (Contacts::AKA_Name); Trim(Contacts::AKA_Name) & ” “; “”);

whichname = If( not IsEmpty (Contacts::Use_AKA); aka; forename & middlename);

surname = If( not IsEmpty (Contacts::Use_Maiden); Trim(Contacts::Maiden_Name); Trim(Contacts::Surname));

suffix = If( not IsEmpty (Contacts::Suffix); ” ” & Trim(Contacts::Suffix) ; “”);

result = title & whichname & surname & suffix

];

result

)

As you can see by using the FileMaker Let Function I have been able to break down the calculation into it’s segment components and then put these components together in a more readable and efficient manner.

You’ll also notice that I’m using the FileMaker Trim Function which allows you to remove any extra spaces from a field before you use it to make sure you’re just getting the text you want.

So there it is. My perfect calculated name field for display:

c_Name_Display

Please feel free to copy and use it and if you have improvements you’d like to suggest please do so in the comments.

Oh and before I forget. My perfect calculated name field for post:

c_Name_Postal

The Improved Postal Name Calculation

 

Let(

[

title = If( not IsEmpty (Contacts::Title); Trim(Contacts::Title) & ” “; “”);
forename =  If( not IsEmpty (Contacts::Forename); format.initials(Contacts::Forename); “”);
middlename = If( not IsEmpty (Contacts::Use_Initials); format.initials(Contacts::Middle_Name); “”);
surname = If( not IsEmpty (Contacts::Use_Maiden); Trim(Contacts::Maiden_Name); Trim(Contacts::Surname));
suffix = If( not IsEmpty (Contacts::Suffix); ” ” & Trim(Contacts::Suffix) ; “”);
result = title & forename & middlename & surname & suffix

];

result

)
Again please feel free to copy and use it and if you have improvements you’d like to suggest please do so in the comments.

 

Filed under: FilemakerTagged with: , , , , , , ,

Designing Filemaker Databases

FileMaker Pro

I’ve been using Filemaker to design databases for the better part of a decade. I’m by no means a professional database developer, but I’ve been able to easily turn my hand to using Filemaker.

Like most of my skills I’ve picked it up whilst working as a consultant it was mostly due to necessity. It started with a small database to help us track clients and candidates for a recruitment company and grew beyond that to something more complex and helpful.

Now after eight years of using the system I designed the customer has asked me to rebuild it from the ground up. So over the next few weeks I’ll be blogging my way through the redesign, with the type of descriptions I’d of found helpful when I first started developing with FileMaker.

Filed under: FilemakerTagged with: , ,

Damn McAfee

McAfee

So I spent a glorious Sunday afternoon puzzling, amongst other things, over a friends broken laptop. It could connect to the internet when plugged in by cable, but not by the WiFi connection.

After a couple of minutes getting connected to her laptop by the ineffable logmein (using it from my iPad now!) and began exploring the problem.

First I updated her entire system, which including the delights of Sony Viao updater took a good long while, for good measure I also added Google Pack so she would stay updated with the essentials.

Then I got down to examining which setting might be wrong. Breezed through the Control Panel Network Settings, all seemed right; ran the Diagnose and Repair Wizard, all seemed right.

Then just as Google Updater was finishing installing the free anti-virus software it ships with, it occurred to me it might be McAfee. Shipped free with her Sony Viao and pestering her to renew via text message (how it got her number she still doesn’t know). So I thought what the hell it’s got to go.

One reboot later and low and behold it could connect to the internet via WiFi again! Now I don’t know if it was just this, or the repairs I ran, changes to the registry or Sony Viao updates, but I suspect it was McAfee.

When will PC manufacturers stop loading their laptops with such s**t? Soon I hope, because I’d like to stop having to uninstall it.

Filed under: GeneralTagged with: , , , , , ,

How to resolve iOS4 problems on an iPhone 3G

Since updating to iOS4 on my iPhone 3G I have experienced no end of problems with my iPhone 3G it has in short become sluggish at best and frankly unusable at worst, which has made my waiting for @o2’s stock of iPhone 4s to become plentiful enough for me to be able to drive to a store a purchase one seem like quite a challenge.

I have however stumbled across a solution that has certainly eased my problems, if not fixed them outright. Thanks to the wonderful Dan Dilger over at Roughly Drafted for this solution:

In order to force the iOS to rebuild (a step that seems to optimize a variety of things), you have to press and hold the Sleep/Wake button along with the Home button for about ten seconds, which will kill the phone and initiate a reboot.

After doing this twice I have found my iPhone 3G has largely returned to it’s wonderful self and though it is still not without problems it is largely much better.

Check out the full post at Roughly Drafted and comments over at the Apple Support Thread if this doesn’t work for you.

Filed under: HelpTagged with: , , , ,

How to fix: “Unable to create directory” Error for Media Uploads on WordPress 3.0?

Wordpress Logo

So. I had a problem with one of my customers wordpress sites this evening: when uploading content I kept on getting this error:

Unable to create directory /home/username/public_html/wp-content/uploads/2010/07. Is its parent directory writable by the server?

As I hadn’t changed anything and had been able to upload images easily enough before so I was a tad perplexed. After a little googling I thought it might be a permissions problem.

The permissions on my wp-content/uploads directory were set to the default setting of 755 but I read that occassionally it might be helpful to change this to 777 to correct such a problem.

755 File Permssions

Logging in via FTP I changed the permissions to 777 but to no avail + later googling led me to suspect this might not be too good an idea. See here for more info.

So it was back to google and I stumbled across this excellent article, which gave me a few other ideas. It was point three:

3. If this doesn’t work. Check the upload path in the admin – Settings – Miscellaneous and make sure it is wp-content/uploads sometimes the upgrade or server move changes it to the absolute path.

that worked for me too.

But it wasn’t so easy to find the Miscellaneous Settings as they have moved since the upgrade to WordPress 3.0. And WordPress doesn’t make it easy to find. Oh no. But a couple of pages into their help files, I stumbled across this page and found the answer.

The Miscellaneous Settings controlling the upload of Media files are now stored, perhaps more sensibly, under Settings > Media. Just make sure that your setting for the upload path is set to: wp-content/uploads and you’ll be just fine.

Media Settings

This has happened on all my WordPress 3.0 blog upgrades on Dreamhost so I hope this helps anyone in the same position.

Thanks to Paulo Orquillo and Tips & Tricks HQ for pointing me in the right direction.

Filed under: wordpressTagged with: , ,