Apps, Software Development, Xamarin

Setting up your Xamarin development environment in Visual Studio

I’ve been developing apps using C# in Xamarin for a number of years now, up until now as a side project but as Xamarin was bought by Microsoft earlier this year and the annual license is now free it seemed the right time to start focusing on Xamarin a little more.

In order to develop apps using Xamarin you have to decide whether to develop on a PC or a Mac primarily, and then get your overall system set up and running. My setup of choice was to do all my coding on my PC in Visual Studio 2015 and use my Mac Mini on the same network to run my IOS simulators on, and connect my IOS test devices to. It’s important that the installed SDK versions for Xamarin match on both the PC and the Mac or you can run into compilation or deployment problems down the line.

During the process of getting all of this setup, and up to date I ran into a number of issues which, from the Google searches I did, seems I’m not the only person to have these problems. I’ve collected a rough and ready list of some of the errors and their solutions to hopefully save others a bit of the time it took me to eventually get to a stable working system.

During this process you may need to know a couple of key things –

1. Find the IP address of your Mac on the network
2. View your Xamarin log files
3. Update the Xamarin and XCode installs on your Mac
4. Update the Xamarin and SDKs on your PC.

This post will help you do each of those, and if you still haven’t got up and running by the end of this post you can turn to both the Xamarin forums and Stack Exchange for help.


Find the IP address of your Mac on the network

In the top right hand corner of your Mac screen you’ll see the little Wifi symbol that shows your Mac is connected to a Wifi network – click on this symbol while holding down the Ctrl key on your Mac and you’ll see some extra info appear in the dropdown list, inlcuding the IP adress of your Mac on the network.

Xamarin setup process and common error messages

Typically at some point you’ll have a problem getting your PC to connect to your Mac – this wouldn’t be a problem in itself apart from the fact for some reason the useful error messages are hidden deep within the Xamarin log files. Incidentally it’s vital that your PC and Mac are on the same Wifi network…. I had issues at one point because my laptop had autoconnected to a BT Openzone Wifi network and the Mac was on the normal office one. Just a simple point that’s easily overlooked. Presuming it’s not that, you will need the log files! Using the instructions below to get to the log file you are likely to find a message like:

“The installed Xamarin.iOS (version 10.0) on the Mac macname.local (192.168.x.xx) is not compatible with the local Xamarin.iOS 10.2.”

Which is just telling you to update whichever systemis behind and then you will be able to connect to your Mac no problem..

1. Error occurred in the designer agent. Object reference not set to an instance of an object – designer won’t load. Can happen for a number of reasons, in my case when I went on to my Mac and opened XCode / Apple developer account there was a license agreement dialogue box that needed to be accepted by me. Once I’d done that everything worked fine.

2. Failed to create the a fat library. The solution to this was to go to the Mac and open Xcode. An update had been installed and it was waiting for me to accept a new user agreement. Once I’d done that and returned to Visual Studio on the PC I could build the project no problem.

Xamarin related updates

There’s a series of places that updates need to be ‘triggered’ when you’re using Xamarin – the PC, the Mac, and if you are debugging on a device, then the device environment itself.

Updates are located in Visual Studio on the PC. On the Mac there’s system updates which might include Xcode, that needs to be kept up to date. You’ll also have Xamarin Studio installed on your Mac, and that has an updater that will need to be run as well by clicking the File > Check for updates button.

On your device you need to go to follow the normal process for updating your version of IOS (I’m only developing on Apple devices at he moment until I’ve got more comfortable with the full development cycle).

Diagnosing problems and using the Xamarin log files

The log files can be located by going to Help > Xamarin > Open Logs in Visual Studio and then browsing to the relevant folder location as follows:

Mac – ~/Library/Logs/Xamarin-[MAJOR.MINOR]
Windows – %LOCALAPPDATA%\Xamarin\Logs (on Windows 10 this will be something like C:\Users\Bob\AppData\Local\Xamarin\Logs)

If you don’t see the folder you may have to tell File Explorer to show hidden files as they could be hidden by default.

Also in Visual Studio pay close attention to the output window. Top left of that window is a dropdown that says ‘Show output from ‘ and then there are several options:

– Build
– Build order
– Debug
– Xamarin
– Diagnostics

You find different type of information in each and they are often worth trawling through if you are encountering problems.

My next Xamarin post will relate to some of the initial stumbling blocks I encountered when building my first Xamarin app.

brochure design Woking
Client Focus, Design

Traditional Marketing – leaflet design & print for a client

We recently were asked to design and print a double sided A5 leaflet for one of our long standing clients. As well as doing online marketing and SEO for them they wanted to do some traditional marketing too, so we designed this marketing brochure for them to deliver to their potential block management clients.

We then managed the print process for them and delivered the finished brochures to them this week.

styled baskerville ampersand
Design, News, Website Design, Wordpress

Google fonts with a beautiful ampersand – what’s up with Baskerville?

I spent some time recently working on a couple of website designs that could really use a little design flourish, and I thought styling the ampersand would be just enough. Looking back to an old bit of code I knew you could usee CSS to style your special ameprsands, render them in Baskerville styled in Italic and hey presto….. wait what? This doesn’t look so good anymore, what the heck is up with Baskerville.

After trawling the web for a while I *think* I have found the answer – Baskerville is now called ‘Libre Baskerville’ in the Google font library, so changing your css font-family reference from “Baskerville” to “Libre Baskerville” fixed it up. For a couple of great references on styling beautiful ampersands I’d recommend these resources.

https://johndjameson.com/blog/ampersands-and-google-fonts/

My Top 30 Fonts with the Sexiest Ampersands

Speed Up WordPress With Hosting & Caching Changes
News, Wordpress

Speed Up WordPress With Hosting & Caching Changes

I wrote an article last year about how to speed Woocommerce up. It’s turned out to be a pretty popular post, but as with everything online things have moved on and it feels like the right time for an update. WordPress is great but the number one complaint you hear is ‘WordPress is slow!’ – it doesn’t have to be, and here’s our advice on how to speed up WordPress making 2 simple changes – optimise your hosting and cache your content.

Change Your Hosting

You need to start by figuring out if your hosting is part of the problem. This website is hosted on a server managed by Names.co.uk. We have used WP Engine in the past for some clients who preferred that as a hosting option, and Dreamhost has also come highly recommended.

Use Google PageSpeed Insights to check a variety of issues on your website, including server response time. Server response time measures how long it takes to load the necessary HTML to begin rendering the page from your server, subtracting out the network latency between Google and your server.

If it looks like your server response time is slow then this is the single most important thing you can change to speed up your WordPress website.

If you find your hosting is lacking there’s plenty of good hosting companies out there that you can move your website to, and the market has changed a bit in recent years with the emergence of companies like WP Engine and Dreamhost. WP Engine provide hosting just for WordPress websites and aims to deliver super fast hosting whilst dealing with a lot of the configuration for you. They provide caching and a CDN and handle updates for you so if you’re a ‘not so techy’ WordPress website owner this could be the best solution for you to speed up your WordPress website. With plans starting from $29 (£18) per month and a 60 day money back guarantee you can’t really go wrong giving it a go! WordPress Hosting with WPEngine.com →

If you want a more ‘independent’ feel to your hosting I’d recommend Namesco. They host this very website and I’ve been a happy customer of theirs since 2008, using both a VPS (Virtual Private Server) and a dedicated server. There have been a few blips along the way but the uptime has been for the most part superb, their support has improved with a team who have been endlessly patient with me over the years. They provide plenty of hosting options, from shared hosting, through to fully managed dedicated servers and cloud hosting. Visit the Namesco Website →


SPEEDUP-250x250-v1
$50 off shared hosting

Caching Your Content – Pre-Making Your Sandwiches!

So what is caching? The simplest way I can think of describing it is this – Imagine walking into a cafe and ordering a sandwich, waiting for someone to slice the bread, and make the sandwich. Compare that to walking in to the same cafe, ordering the same sandwich but being handed it straight away, so you hand your money over and off you go. You’re already half way down the street while the other guy is still waiting for his bread to be buttered. Are you still with me?!

If you’re confused, what I’m saying is you need to pre-make your web pages.

WordPress stores all your page and post content in a database, and every visitor to your website that asks to see one of your pages is making the WordPress elves scurry off to find all the bits of data and assemble them into a page. Imagine 20 visitors ask for the same page this afternoon, if that’s a page you only update once a month then why would you do that? It would be much more sensible to have a pre-assembled version ready to show each of them wouldn’t it? ANd then if you made a change to that content you’d just rebuild that version and so on. Well, that’s caching your pages!

There are several well known caching plugins that have been around for a number of years and while they do a great job they are pretty complicated and awkward to set up and use. And then WP Rocket walked into my life a few months ago and all that changed. It’s not free, but you get what you pay for, remember! You download it, install and configure it in less time than it takes to put the kettle on. Seriously, just by activating the plugin you are caching your pages. It is amazing! Visit the WP Rocket website →

A review of weather apps for iphone
Apps

The Best Weather Apps For iPhone & iPad – That We Know Of!

With all this hot weather – and the possibility of a spanish plume and big thunderstorms forecast for the next few days – I thought I’d put together a review of what I think are the best weather apps for iPhone. Being a storm lover, and loving interesting weather of any kind there are a few weather apps I’ve found myself relying on a lot ever since I got my first iPhone.

So what are the best storm tracking apps? And what are the best general weather apps for iPhone or iPad? Note – I’m not reviewing Android weather apps because I don’t have an Android and believe they vary a fair bit from the iOS version.

1. Weather Pro App – FREE & £1.99 Pro Version

Weather app for iphone - Weather ProMy favourite, and certainly the weather app I use the most, has to be the Weather Pro app. This is my go to app for general weather. the free version is really good but I’d definitely recommend upgrading to the paid version to get detailed radar, 2 weeks forecasts and more extras. The app includes a live lightning tracker, rain / snow / hail forecasts, and the weather forecasts themselves are super accurate. I quite genuinely can’t imagine life before this app!

2. Home And Dry Weather App by MetDesk – £1.49

Best weather apps review - Home and Dry appThis has absolutely fantastic animated maps and a brilliant user interface. It feels slick and easy to use and combines real radar data with forecast rain data to give you an all in one animated weather map. It’s a useful app when there are heavy showers about and you want to know if you’re about to get wet or not!

3. Dark Sky Weather App – £2.49

iphone weather app dark skyOne of the two most expensive weather apps I’m recommending but this is a really fantastic piece of user interface design and a couple of unique features which make it a top pick. Notably it includes a customisable alert setting where you can ask the app to sound an alarm shortly before rain (or snow) is about to arrive at your location. You can even adjust it to only alert you when the rain is heavy, rather than moderate or light. I’d like to see this expanded to thunderstorm alerts. It also includes a mesmerising animated radar map – on a globe which you can rotate, and zoom in on.

4. Forecast.io – £0.79

forecast.io iapp weather app for iphoneA beautifully designed app, especially the elegant animated icons. But I’ve found the actual forecasts to not be quite as accurate as our other apps so I’d recommend having a look at this weather app but don’t rely on it for deciding whether to plan a BBQ this weekend! This one actually feels very similar to Dark Sky – if anyone has any info on if these are related I’d love to know.

5. BBC Weather App – FREE

Weather apps for iphone - BBC Weather AppThe BBC weather app feels BBC, looks BBC and delivers reliable BBC forecasts. Sometimes wonderfully detailed and accurate – sometimes a shade off the mark but a great one to rely on and after all it’s FREE! It’s missing two things for me, an animated radar, probably the most useful bit of any weather app, and weather warnings should be delivered as push notificatioons too. One other thing, I’d also love to see the weather symbols fall off the screen occasionally. Or am I showing my age saying that?!

6. Met Office Weather App – FREE

Met office app for iphoneThe Met Office weather app is appealing from the point of view it offers a unique interface compared to the other weather apps, includes localised weather alerts built in (as long as you have push notifications switched on) and is accurate, as you’d expect. From a personal point of view I don’t like the radar as much as our top two – it doesn’t feel as slick and zooming in feels awkward so when I’m trying to figure out if I should walk or drive to the park with the kids today I don’t rely on this app. I also don’t find the user interface quite as intuitive as some of the others. Defintely has it’s uses though and worth a look.

Website Design, Wordpress

WordPress, Woocommerce Speed & How To Make Them Faster

I’ve been building a website using Woocommerce for the first time recently. It started off with less than 100 items and expanded to over 500 by the time we had finished. That’s still not many products at all but I began to notice some speed issues after a while and if they were bugging me they were definitely going to bug the customer once the site was live. {There is now an updated post on speeding up a WordPress site here.}

I started researching WordPress speed in general as I suspected it was an issue with the framework itself rather than Woocommerce, although more likely a combination of the two, and along the way I found some useful articles and tips which I thought I’d share.

To make your WordPress / Woocommerce site work faster you need to tackle 3 areas, in no particular order :

  1. Optimise your database
  2. Check your theme & code
  3. Check your plugins

Note – it goes without saying that you should backup everything before you start. If you don’t already have a WordPress back up solution then I’d recommend looking at either Backup Buddy or Updraft, both of which are really great, I’d say it’s just down to personal preference which one you choose.

1. Optimise Your Database

I found 2 really useful plugins for this. The first is called DB Optimise Plugin – http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin. It removes all redundant data from your database. Coupled with switching off WordPress revisions I noticed quite a speed improvement with this. If you want to switch off WordPress post revisions then add this line to your wp-config.php file:

define('WP_POST_REVISIONS',FALSE);

If you want to get more information on what this does please read more in the WordPress Codex.

The second plugin is called SQL Profiler – http://wordpress.org/extend/plugins/mysql-profiler/. Once installed and activated it will show you a list at the bottom of your page for every single database request made on that page, how long each query took and the total time. Crucially it also shows you where the request came from. In my case I discovered one of the Woocommerce plugins was taking a terribly long time to run a request that I didn’t even need.

2. Check your theme and code

Validate your code at http://validator.w3.org/ to get rid of any silly errors. Then really dig deep if you are using a third party theme and third party plugins. You may have paid good money for those but that does not mean they have been written well. A good tool here is Pingdom which tests the loading speed of your website and can often pinpoint a particular bottleneck. It shows you every external file the page has to load, for example javascript files, css stylesheets and images and tells you how long each took to load. It even breaks the information down further enabling you to figure out if your server is what’s slowing everything down.

My initial tests on the homepage of the site I was analysing gave me a loading speed of 6 seconds, which is way too slow. This led me to making a few changes as follows:

  • I merged as many css files as was comfortable
  • I removed all calls for unecessary css and js files from the functions.php file

3. Check Your Plugins

Make sure they are all up to date, it’s a simple step but if a plugin developer has found a bug they may well have released an uodate that fixes it and makes it work better.

4. Change your host

Check your site using Google PageSpeed Insights, if it shows server response time as one of your issues then you may want to look at changing your host. Try WPengine for managed scalable super fast hosting for WordPress websites.

So, Did It Work?

Yes. I’ve only gone through a few steps so far but I have reduced the page load time from 6 Seconds down to 3.5 Seconds. Still not good enough but I’m pretty happy with the progress so far, especially as I know there are quite a number of things I could still improve on that will bring the speed down much further. I will update this when I’ve completed the next stage.

This was a really useful article, he goes into more detail than I have – http://www.sdavismedia.com/page-speed/

Hacking M.E.D.I.C With The Wellcome Trust & Open Data
News, Website Design

Hacking M.E.D.I.C With The Wellcome Trust & Open Data

Last weekend I was lucky enough to join a great group of people at a Rewired State hack event for the Wellcome Trust. On a beautiful morning in London we were given access to a tonne of open science data and asked to show the Wellcome Trust what could be done with it.

Pretty quickly our team joined together with the idea to build a monitoring system for Intensive Care. Currently the existing monitoring equipment is plugged into a network and the data is saved (not everywhere, but increasingly so). We asked ourselves the question “what could we do if we centralised all that data?”. Our team included a couple of data analysts and they started discussing the possibility of finding ‘usefulness’ within the data. “Would we find any patterns in terms of vital statistic changes and mortality rates?”.mockup

Having access to this data is AMAZING not only because we can learn so much from it, but because we can DO so much with it.

So we set to it, the devs building the frontend and the framework, and the ‘data guys’ crunched numbers. It was so exciting when they started to realise that they had found some potential clues in the data – certain numbers changing in a certain direction seemed to point towards higher probability that the patient would die.

By combining the two ideas we came up with MEDIC – Monitoring & Early Detection in Intensive Care. We would pipe all of that live data into a central database and show a live representation of that patient on a screen so all their vital stats are instantly visible and instead of a zillion alarms going off if something does start to go wrong there would be one centralised alarm. This would reduce the possibility of alarm saturation, the phenomenon where so many alarms go off in the intensive care unit that they start to lose their significance.

By tying that together with the results of the data analysis, an algorithm, we could change the status of any of those patients to ‘warning’ should their stats be showing signs that from the historical data suggest their condition is likely to worsen soon.

A summary of the project can be found here – we were very proud to be awarded the Open Research prize.

I have to say we were really excited by the possibilities of this, having access to this data is AMAZING not only because we can learn so much from it, but because we can DO so much with it. Thank you fellow team members (Allen Lin, Ben Webb, Emily Christy, Florian Rathgeber, John Sandall, Matt Shawkat, Tom Pollard), thank you Rewired State and thank you Wellcome Trust. What a great weekend.

Wordpress

Fixing The Navigation Sorting For WordPress Custom Posts

While building Lightstorm, my soon to be released custom WordPress theme, I added next and previous links to the bottom of each individual custom post item. In this case I wanted to build a portfolio and to enable the user to click backwards or forwards through the entire portfolio. I added the WordPress next and previous links code thinking it was a nice easy job and then realised that the links were not taking our portfolio custom sorting into account. Oh.

Having googled the problem I couldn’t find exactly what I was looking for so I set about writing some of my own code to fix this and here it is for you to use to.


<?php 
	global $post;
	$prev_title = "";
	$next_title = "";
	
	$args = array(
    'orderby'         => 'menu_order',
    'order'           => 'ASC',
    'post_type'       => 'portfolio',
    'post_status'     => 'publish' ); 
    
	
    $myposts = get_posts( $args );
	$arr = array();
	
	foreach( $myposts as $post ) :	setup_postdata($post); 
		//build array of posts
		$arr[] += $post->ID;		
	endforeach;

	wp_reset_query();

	//find index of current post id in the array
	$currentIndex = array_search($post->ID, $arr);
	$prevIndex = $currentIndex-1;
	$nextIndex = $currentIndex+1;
	$maxNumber = count($arr) - 1;
	
	//show the links
	if($currentIndex != 0){
		$prevID = $arr[$prevIndex];
		$prev_title= "«« ".get_the_title($prevID);
		$prev_permalink = get_permalink($prevID);
	}


	if($currentIndex != $maxNumber){
		$nextID = $arr[$nextIndex];
		$next_title= get_the_title($nextID)." »»";
		$next_permalink = get_permalink($nextID);
	}
	
	echo "<div class='navigation'>";
	echo "<div class='five columns alpha'>";
	echo "<a href='".$prev_permalink."'>".$prev_title."</a>";
	echo "</div>";
	echo "<div class='five columns omega'>";
	echo "<a href='".$next_permalink."'>".$next_title."</a>";
	echo "</div>";
	echo "</div>";
?>

If there is a better way of doing this we’d love to know.

Using Freshbooks – Freelance Invoice Software & Expenses
Business

Using Freshbooks – Freelance Invoice Software & Expenses

It took me a while to get up and running with my accounts as a freelancer. Starting ‘the right way’ and keeping good records for both income and expenditure from the off avoids the horrible ‘oh my god my tax return is due in 1 day’ annual panic. I started researching freelance invoice software – I wish so much that I had found Freshbooks back when I started because it would have saved me a lot of grief.

Freshbooks is an online accounting system / recurring invoice system, is easy to use and very low monthly charges. Actually it’s free to start but presuming you have more than 2 clients you’ll be a paying customer. You set up your clients, set up your invoiceable items, and creating invoices is incredibly quick.

FreshBooks

You can also use it to keep track of your business expenses and can upload a scan of a receipt to attach to the expense. Because it has a record of your income and expenditure it also can produce a variety of accounts for you at the click of a button – instant profit and loss reports, yay!

On top of all of that you can use it for time tracking per project.