Sharing MAMP between Two Computers

I use MAMP (mamp.info) as a local server setup on my Mac for developing web apps. My primary setup is a Mac Mini, but I also use a Macbook Pro for when I’m in a client’s office or working remotely. To keep the two in sync, I use Dropbox. This is straight-forward for documents and html/php files, but a bit more complicated for syncing databases between the two machines.

To sync the web files, I simply moved the htdocs folder from the MAMP folder to the Dropbox folder. In the MAMP app preferences, I changed the Document Root for the web server to point to the folder in Dropbox.

To sync the database files, I moved the ‘db’ folder to the Dropbox folder. I then created a Symbolic Link from the folder in Dropbox to the original location in the MAMP folder. This is done using the ‘ln’ command at the command prompt. In my case, the following command did the job:

ln -s /Users/stuart/Dropbox/MAMP/db/ /Applications/MAMP/

You should be able to edit this to suit your setup.

ShowFit Plugin Updated

Time:
05-Sep-20 10:36 am
Duration:
01:42:53
Distance:
23.64 km

I’ve just updated our WordPress Plugin for embedding Garmin .fit data files in your blog. The latest update improves the speed of rendering the maps and reduces the amount of data your blog downloads from external sites.

The latest version of the plugin can be downloaded from http://yellowfield.co.uk/downloads/showfit.zip, or from our GitHub repository https://github.com/tevendale/ShowFitFile

For details of the plugin, see our original blog post

If you’ve got any questions about this plugin or about getting your own plugin developed, please get in touch.

Cross-Platform Images in Core Data

In an upcoming-release of iSMARTtrain, I’ve added a profile picture for the user settings. To support the iOS version of iSMARTtrain (coming soon), this needed to work cross-platform in a Core Data document.

Transferring images between the two platforms in a common format seems rather complicated, as there’s no common image format that can be easily extracted from both NSImage and UIImage. In the end, I ended up saving the images on the Mac side as PNG files, which can be handled natively by UIImage on the iOS side.

Self‘ in these cases is a Core Data NSManagedObject

On the Mac Side:

Save the image:

- (void)saveProfileImage:(NSImage *)profile {
      NSData *imageData = [profile TIFFRepresentation];
      NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData];
      NSDictionary *imageProps = [NSDictionary dictionaryWithObject:[NSNumber numberWithFloat:1.0] forKey:NSImageCompressionFactor];
      NSData *imagePNGData = [imageRep representationUsingType:NSBitmapImageFileTypePNG properties:imageProps];
      self.image = imagePNGData;
  }

Retrieve the image

- (NSImage *)profileImage {
      if (self.image) {
            NSData *imageData = self.image;
           NSImage *newImage = [[NSImage alloc] initWithData:imageData];
           return newImage;
       }
       return nil;
 }

On the iOS Side:

Save the image:

- (void)saveProfileImage:(UIImage *)profile {
       self.image = UIImagePNGRepresentation(profile);
}

Retrieve the image:

- (UIImage *)profileImage {
      if (self.image) {
            NSData *imageData = self.image;
            UIImage *newImage = [[UIImage alloc] initWithData:imageData];
            return newImage;
      }
       return nil;
 }

WordPress Plugin to show .fit files

I’ve recently finished writing a WordPress plugin to display .fit (Flexible and Interoperable Data Transfer) files. These are files from fitness devices, such as Garmin watches & bike computers. This is a personal project that I’ve wanted for quite a while. I’ve often posted in my personal blog (stuarttevendale.com) about the cycling, running & triathlon events I’ve taken part in, but including data from the event wasn’t straight-forward. While other plugins have existed to display routes from .gps file or other formats, this meant the additional hassle of converting the files. The data from the files also had to be entered manually.

For this plug-in, simply upload the .fit file to the media library in WordPress and add single shortcode to your post. The plugin has various options to set the colour of the route line, units (imperial or metric), and to determine in the map can be zoomed or not. The plugin also shows a summary of the event; start time, distance and time taken.

Download from: http://yellowfield.co.uk/downloads/showfit.zip

If you’re interested in using Yellow Field Technologies for developing your next WordPress plugin, please get in touch.

The plugin is based on LeafletJS maps and uses phpFITFileAnalysis from https://github.com/adriangibbons/phpFITFileAnalysis, php-geometry from https://github.com/gregallensworth/PHP-Geometry and https://github.com/pointhi/leaflet-color-markers.

Some Examples:

The Methlick Cycle Challengehttps://stuarttevendale.com/2019/07/19/methlick-cycle-challenge/

Show the basic route map + summary data using plugin defaults:

[showfitfile file = "2019-07-14-10-32-10.fit"]

Time:
14-Jul-19 10:32 am
Duration:
03:37:44
Distance:
63.14 km

Loch Ness Marathonhttps://stuarttevendale.com/2017/10/26/loch-ness-marathon/

Shows the route on an interactive map, with a blue route line & the session details in miles.

[showfitfile file = "Loch-Ness-Marathon.fit" interactive="yes" colour="blue" units="imperial"]

Time:
24-Sep-17 10:03 am
Duration:
05:17:03
Distance:
26.28 miles

NSScotland 2014

nsscotland-logoThis past weekend, I attended NSScotland in Edinburgh. The conference, in its 3rd year, is organised by Alan Francis and Paul Wilson, who also organised the Scottish Ruby conference. The venue for the conference was on the south side of Edinburgh in the Pollock Halls.

Spread over two days, the conference covered a good mix of technical and non-technical subjects, including iOS app testing at Facebook (Graham Lee), Computing’s Hidden Heroes (Emily Toop), and, the personal highlight for me, Eric Knapp’s talk on Helping Blind Musicians with an iOS App. Between talks, there was plenty of time for socialising and catching up with other developers.

On Saturday night, we were treated to chilli for dinner, cooked by Illegal Jacks, in a near-by Church Hall. As there was no connectivity in the hall, people were forced to talk to each other, rather than huddling over laptops!

On the Monday following the conference, Alan had organised a Swift tutorial, taught by Daniel Steinberg. The tutorial covered the basics of swift from the very beginning and progressed at a nice pace up to the more complicating features. Personally, some of the subjects covered in the final part of the tutorial made my head spin a bit, but this was due to my lack of computer science knowledge, rather than the instructor. At the end of the tutorial I was left with a good understanding of Swift, having never touched it before.

A big thank you to Alan and Paul for organising the conference, Daniel Steinberg for teaching the tutorial and Zonal and Karelia Software for their sponsorship. I’m already looking forward to next year!

Project ANT – Live ANT+ Data on Your Mac

Project ANT is our new product from Yellow Field Technologies. It’s an application to enhance your turbo training or treadmill sessions. For use with any ANT+ Sport compatible power meter, heart rate monitor belt, speed or cadence sensor, it displays your data on your desktop or laptop Mac with a graph or video.

Screenshot

The data displayed in each field can be selected from a number of options, including average power and Phil Skiba’s xPower, RI and BikeScore™ metrics.

Displayoptions

Project ANT uses Garmin’s ANT+ USB stick to communicate with the ANT sensors.

The application is currently in the late stages of development, and the latest Beta can be downloaded from http://www.yellowfield.co.uk/projectant/. You can also join our mailing list at this page.

There are still a few features to be added to the application before final launch, including data export to tcx, csv and pwx formats, and session analysis.

Video image above, © Sufferfest.