A Week In Slovenia

Until five minutes before we landed I want sure I would make it to Ljubljana at all. A massive thundercloud was stubbornly sat over the airfield and the pilots were talking about alternative airports. In the end, after a nervy landing, I made it to Slovenia about three hours later than expected.

I’d wanted to visit Slovenia after reading the book Feral, which featured an amazing chapter about the resurgence of Slovenia’s natural environment, so it was a great place to meet my girlfriend as she travelled round Europe.


Our first thee nights were in the capital, Ljubljana. After reuniting and leaving my things at the hotel we wandered down to the riverside to visit open kitchen. This is a weekly event on Friday nights throughout summer where local restaurants, food stands, and producers come together at a local market. After checking out the stands and sampling a couple of glasses of wine I picked a salmon burger which was excellent.

The next morning I had planned another food adventure. We met Iva from Ljubljanajam for a food walk around the city. I was really excited about this before I came and it wasn’t a disappointment. We started by exploring the local markets and trying some beautiful fresh produce. As well as showing us food Iva was also telling us more about the city and country. The markets had so much fresh produce from around the country, why can’t we have this at home!?

When I was arranging the food tour I also asked Iva for tips about local restaurants. She recommended Luda so I booked us a table. Hidden away from the main tourist streets this was a real gem, with fresh food creatively cooked. The menu changes weekly to highlight the best produce. I started with courgette with parmesan and walnuts, which, as a courgette fan, was spectacular. My main was prawns with porcini and nectarines, and for dessert I had figs with jasmine ice cream. Both were excellent. Including drinks, the meal was €70 for two, which was an absolute bargain for a real culinary experience.


After the meal we headed up to the castle via funicular. In summer evenings the castle courtyard turns into a cinema so we finished the day with a film.

For the rest of our time in Ljubljana we saw the sites, stopped at cafes and bars, and had more excellent food. We revisited an excellent gelateria from the food tour, and returned to the castle to take in the views. Ljubljana is small and relaxed for a capital city and it had a great vibe. It’s a perfect weekend destination from the UK.

Our next destination was Kobarid. A small town in the Alps, Kobarid sits in the valley of the Soca River, which is famous for it’s amazing blue colour, excellent water sports, and massive trout.


On our first evening we went on a quick hike to a viewpoint above the town. On the map this looked easy, but, this is the alps, it was actually pretty tough. It had started to rain, and afternoon rain showers turned out to be a regular feature of our time in the mountains.

Kobarid was the site of intense fighting in the first world war. The Italians fought a futile campaign against the Austro Hungarian Empire in the mountains. We walked the Kobarid Historical Trail which was a great way to spend a day discovering more of this history. The trail visits ancient settlements, the remains of the trench systems, and the Italian Charnel House where many of the bodies were brought after the war. It also visits a spectacular waterfall within a deep canyon. Being the Alps the scenery was typically incredible. It was hard to imagine intense suffering in such a beautiful and peaceful place.

On our last full day in the valley we got to experience the river close up with some whitewater rafting. The blue water looks so inviting but it’s actually freezing cold! I’d never rafted before, although I’ve used to kayak regularly. Once I got used to the lack of control I really enjoyed it. It was exciting without being too scary or physically demanding and a great new perspective on the local scenery.


On the previous days walk we had watching people jumping from a high rock into the river and I’d casually said ‘I could do that’, so when we stopped at a big rock and were asked if we wanted to jump I had to have a go. It was difficult to climb back down, so we were told if we went up we had to jump. From the water it didn’t look too high but from the top it was a long way down! I’m still not sure if it was the same rock?! After a couple of seconds to think about it I took the plunge!

From Kobarid we headed to Lake Bled via bus then train. This seemed like it was going to be stressful as the times to get from bus to train were very close but in fact it was fine; the train was waiting for the bus to arrive. We’d chosen to get the train journey as it was part of the route from Nova Gorica to Jessnice which was listed as one of the best train journeys you’ve never heard of. It was a nice ride, but I was a little disappointed. It was always pretty but never truly spectacular.

My first impressions of Lake Bled weren’t great. Sure it was scenic but it was also very touristy, with lots of coach tours and massive hotels. It felt like a theme park. The weather had turned and low clouds were blowing in which didn’t help my mood. We visited the castle, which I found underwhelming, and spent the rest of the day hiding from the rain with a few glasses of wine.


The next day the weather had improved and so had my mood. We took the day to walk around the lake – only 6km but with lots of places to stop. Away from the tourist end of the lake it was much nicer. As we made our way around we stopped to swim, then headed up to viewpoint which had been recommended to us.

As in Kobarid, this was’t just a gentle stroll, it was steep and exposed in places, and muddy from the recent rain. In the heavy woods I wondered if we would even be able to see anything when we reached the top.

There was nothing to worry about! A short scramble from the summit we found a truly spectacular view. This was the postcard image of Lake Bled, the church on it’s island, the castle on it’s hill, with the alps rising majestically behind. For me this was a highlight of Bled. There are actually 3 viewpoints, but the one at the very top was the best by far. This was the summit of Velika Osojnica, and can be found from paths at the west end of the lake.


After returning to the shores of the lake and a well deserved beer we got out on the water with stand up paddle boards. This was another first for me and it was surprisingly easy. We had the run of the lake so we paddled around the island along with the local plenta boats.

From Bled I had to return to the airport. Slovenia was everything I expected. Ljubljana is a great little city with excellent food and drink, perfect for a quick break. The alps are the alps, and it was good to see them in a less developed environment than in France. The week was a great mix between the city and the outdoors. This was my first time in Slovenia but it won’t be my last.

A Week In Slovenia

Xamarin Forms Custom Renderers

In Android Lollipop button text defaults to upper case. The default Button in Xamarin Forms will also appear in all caps. In this post I show how to use a custom renderer to make the text preserve its casing.

The code for this sample is available here. Here’s what it looks like running on Android and IOS.

Screen Shot 2016-05-09 at 21.54.08
Screen Shot 2016-05-09 at 21.50.34

The Custom Renderer lets us access the properties of the platform specific button – in this case the Android Button. To achieve this we need to subclass the button in the cross platform project. This doesn’t need to do anything, it just provides a class to use in the XAML which can be targeted by the platform specific renderer…

using System;
using Xamarin.Forms;

namespace ButtonCustomRenderer
	public class CustomButton : Button

… and the make the custom button available in the XAML by adding it’s namespace at the top…

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" 
		<StackLayout Padding="10, 20, 10, 10">
			<Button Text="This is a standard button" />
			<local:CustomButton Text="This is a custom button" />

Then we add create the renderer in the platform specific project…

using System;
using Xamarin.Forms.Platform.Android;
using Xamarin.Forms;
using ButtonCustomRenderer;
using ButtonCustomRenderer.Droid;

[assembly: ExportRendererAttribute (typeof(CustomButton), typeof(CustomButtonRenderer))]
namespace ButtonCustomRenderer.Droid
	public class CustomButtonRenderer : ButtonRenderer
		protected override void OnElementChanged(ElementChangedEventArgs&lt;Xamarin.Forms.Button&gt; e)

			if (Control != null)

The custom renderer subclasses ButtonRenderer, not CustomButton. All it has to do is override OnElementChanged and make the necessary changes to the Android Button object it provides. I just set all caps to false.

The ExportRendererAttribute is used to tie the renderer to the custom button in the cross platform project.

In this example the IOS button doesn’t need any changes. This means we don’t need a custom render in the IOS project – the app doesn’t need one to work either.

Xamarin Forms Custom Renderers

Using The Xamarin Forms AbsoluteLayout

I was struggling to get to grips with the Xamarin Forms AbsoluteLayout. To understand I made a demo app. This post is what I found. The sample code is available here. Here’s the app:

Screen Shot 2016-05-02 at 11.58.31
Default settings

At the top of the screen there is a dark blue BoxView within an AbsoluteLayout. The first table controls the position and bounds of the box The second table controls the AbsoluteLayoutFlags that are used.

By default the AbsoluteLayoutFlags.All is on which means that all coordinates are proportional. The box is half the size of its parent because it’s width and height are set to 0.5. The X and Y values are 0.5 as well which centres the box. X and Y values position the centre of the box, not the top left corner.

With proportional coords turned on X or Y values of 0 or 1 will put the child at the edge of it’s parent; you don’t need to do any calculations to work it out. For example 0 and 0 for the top left corner.

Screen Shot 2016-05-02 at 12.16.19
0,0 for top left

Values below 0 or above 1 will position the box outside of its parent. Similarly setting the width or height above 1 will cause it to overflow.

Screen Shot 2016-05-02 at 12.17.23
X = -0.5
Screen Shot 2016-05-02 at 12.18.06
Width -= 1.5

Using the flags you can set some or all of the coordinates to be proportional. With proportional coords turned off the position and size are specified in device units.

Screen Shot 2016-05-02 at 12.39.26
Device coords

Obviously you need to be careful with this as the positioning won’t be the same on different displays and screen sizes.

I’ve used a XAML view for the app, here’s the AbsoluteLayout.

<AbsoluteLayout HorizontalOptions="Fill"
     <BoxView Color="#051B38" AbsoluteLayout.LayoutFlags="All" AbsoluteLayout.LayoutBounds="0.5, 0.5, 0.5, 0.5" x:Name="BoundsBox"/>

Setting up app to update the bounds when the sliders changed was a little tricky. The flags and bounds properties of the box are readonly and can only be set via SetLayoutBounds – This needs to be called each time a value changes.

private void ViewModel_PropertyChanged(object sender, PropertyChangedEventArgs e)
    var viewModel = (DemoPageViewModel)sender;
    AbsoluteLayout.SetLayoutBounds(this.BoundsBox, new Rectangle(viewModel.X, viewModel.Y, viewModel.Width, viewModel.Height));
Using The Xamarin Forms AbsoluteLayout

The Repository Pattern with Xamarin Forms and SQLite

The official Xamarin Forms site explains how to use SQLite with a cross platform application. In this post we go a step further and use the repository pattern and dependency injection to allow for unit testing. Here’s the source code for the sample app.

The App

The example app is a simple screen which lists the months of the year. It looks like this…

…and here’s the code…

public class HomePage : ContentPage
public HomePage ()
// Set up the repository.
var sqlProvider = DependencyService.Get ();
var repo = new SQLRepository (sqlProvider);
repo.Init ();

// Set up the controller factory and controller.
var controllerFactory = new ControllerFactory (repo);
var controller = controllerFactory.GetDemoController ();

// Set up the list.
var listView = new ListView
RowHeight = 40

listView.ItemsSource = controller.GetFirstQuarter ();

Content = new StackLayout {
VerticalOptions = LayoutOptions.FillAndExpand,
Children = { listView }

This is simple. We use the DependencyService to get a reference to the SQLite provider (which supplies the platform specific SQLite connection). We initialise the repository. The repository is passed to the controller factory which supplies a controller. Finally we setup the page.

Platform Specific Code

Each platform needs to implement it’s own ISQLProvider. This sets up and opens a SQLite connection. Here’s the Android version…
public class SQLite_Android : ISQLProvider {
public SQLite_Android () {}
public SQLite.SQLiteConnection GetConnection () {
var sqliteFilename = "DemoSQLite.db3";
string documentsPath = System.Environment.GetFolderPath (System.Environment.SpecialFolder.Personal); // Documents folder
var path = Path.Combine(documentsPath, sqliteFilename);

File.Delete (path);

// Create the connection
var conn = new SQLite.SQLiteConnection(path);
// Return the database connection
return conn;

The Core Project and Dependency Injection

The core project is where the code to control the app lives. It’s separated out from the UI layer which means we can unit test it. The key classes here are…
private StandardKernel kernel;

public ControllerFactory (IRepository repository)
kernel = new StandardKernel ();
kernel.Bind ().ToConstant (repository);

public DemoController GetDemoController()
return kernel.Get ();
…the ControllerFactory – Responsible for building the controllers for the app. In the demo we are using dependency injection with Ninject to supply the repository to the controller. 
public class SQLRepository : IRepository
SQLiteConnection connection;

public SQLRepository (ISQLProvider provider)
this.connection = provider.GetConnection();

public void Init()
this.connection.CreateTable ();
this.connection.Insert(new Month(12, "December"));
this.connection.Insert(new Month(11, "November"));
this.connection.Insert(new Month(10, "October"));
this.connection.Insert(new Month(9, "September"));
this.connection.Insert(new Month(8, "August"));
this.connection.Insert(new Month(7, "July"));
this.connection.Insert(new Month(6, "June"));
this.connection.Insert(new Month(5, "May"));
this.connection.Insert(new Month(4, "April"));
this.connection.Insert(new Month(3, "March"));
this.connection.Insert(new Month(2, "February"));
this.connection.Insert(new Month(1, "January"));

public List GetMonths ()
return this.connection.Table ().ToList ();

…the SQLRepository – This is a simple demo so all the repository does is provide a list of months. Months are set up when the repository initialises.

public class DemoController
private IRepository repo;

public DemoController (IRepository repo)
this.repo = repo;

public List GetFirstQuarter()
return this.repo.GetMonths ().Where (x => x.Number <= 3).ToList ();
…the DemoController – Again this is very simple in the demo app. It sorts the list from the repository and passes it back.

The Unit Test Project

The unit test project doesn’t use SQLite. Instead it has its own repository which uses an in memory list. We just have one sample test here.
public class DemoController
[TestFixture ()]
public class Test
[Test ()]
public void TestCase ()
var repository = new TestRepository ();
repository.Months.Add (new Month (12, "December"));
repository.Months.Add (new Month (11, "November"));
repository.Months.Add (new Month (10, "October"));
repository.Months.Add (new Month (9, "September"));
repository.Months.Add (new Month (8, "August"));
repository.Months.Add (new Month (7, "July"));
repository.Months.Add (new Month (6, "June"));
repository.Months.Add (new Month (5, "May"));
repository.Months.Add (new Month (4, "April"));
repository.Months.Add (new Month (3, "March"));
repository.Months.Add (new Month (2, "February"));
repository.Months.Add (new Month (1, "January"));

var controllerFactory = new ControllerFactory (repository);
var controller = controllerFactory.GetDemoController ();
var months = controller.GetFirstQuarter ();

Assert.AreEqual ("February", months [1].Name);

Project Setup & Package References

To clarify the project structure and required references we have…

The Xamarin Forms project – This provides the UI. It has to reference the sqlite.net pcl so it can pass the connection from the platform specific project to the core project.

The platform specific projects – these need to reference Ninject and sqlite.net. The platform specific versions are provided by the package dependency.

The core project – again this needs to reference Ninject and sqlite.net but this time it will use the cross compatible versions.

The unit test project – This one just needs the Ninject reference as it doesn’t use sqlite.net.

The key thing to remember with all these package references is that the platform specific version will be provided; A reference to sqlite-net-pcl in an IOS project will provide the IOS version, in Android it will provide the Android version.

If you are missing the reference to Ninject in the platform specific project you will get a ‘System.NotImplemented’ exception.

If you are missing the SQLite reference in the platform specific project you will get the error ‘Something went wrong in the build configuration.  This is the bait assembly, which is for referencing by portable libraries, and should never end up part of the app.  Reference the appropriate platform assembly instead.’

If you are getting either error with the packages in place try cleaning the solution or uninstalling the app from your device.

The Repository Pattern with Xamarin Forms and SQLite

Intrepid South Morocco Discovery – December 2015

 At the end of 2015 I spent a few days in Morocco on the Intrepid South Morocco Discovery Tour. I was looking for somewhere warm, exotic and cheapish for a break at the end of the year so Morocco was ideal. I had a great time and really enjoyed the trip. Morocco is a fascinating country with stunning scenery, the itinerary was well planned, and our guide Abd was friendly, interesting, and funny. Here are some of my thoughts…

Highlights – The High Atlas

On the first full day of the trip we drove from Marrakech into the High Atlas mountains. We travelled past the golf courses and olive groves on the edge of the city and then turned from the main highway into a valley on the way to the mountain town of Imlil. The drive was fairly short and we had a few photo and coffee stops on the way (Pro Tip – the best views are on the left hand side). Imlil is a proper mountain town and it’s where most climbers start the ascent of Mount Toubkal, the highest peak in North Africa. We left the van and started walking uphill. The mountains around us were dry and barren like I expected but the valley itself was surprisingly green, there was even grass! In fact in places it was like a warm autumn day at home. The path climbed quickly but the walking wasn’t hard. There were a few villagers about on the way but they didn’t want to be in photos, apparently not for any deep reason but because if they end up on a postcard their friends will laugh at them! At then end of the walk we arrived at our gite in the tiny village of Aroumd. We were welcomed on the roof terrace with a great lunch.

Above Imlil

In the afternoon we met our mountain guide and carried on walking uphill for a couple of hours to visit a local shrine, and then returned to the gite via a different route which took us through the orchards on the edge of the village. I love being in the mountains so I really enjoyed the whole day, the mountains were stunning. As the sun started to go down it started to get cool but a log fire was burning back at the gite. We had a dinner of beef tagine and spent the evening chatting, it was the first night we had together as a group. The night was cold but gite was cosy and we had plenty of blankets to keep us warm. In the morning the mountains and village were silent and the sun was starting to shine on the high peaks. We had breakfast, then walked back down the mountain to the van, although we were retracing our steps it felt much different. A great start to the trip.

Morning in the High Atlas

Highlights – Tizi n Tichka & Ait Benhaddou

We needed to cross the Atlas mountains for the next part of out trip, which meant a lot of driving. Fortunately there was plenty to do and see on the way. After leaving Imlil we drove back towards Marrakech, then skirted the foot of the mountain range. We stopped at a town on market day where you could buy pretty much anything, and even visit the dentist or chiropractor! This was an eye opener for me and I guess it’s how a market day in Britain would have been two hundred years ago – everyone from the vicinity was out doing their shopping and it was really busy.

After that stop we headed back into the mountains and the Tizi N’Tichka pass – this is the main route between the Marrakech plains and the edge of the sahara desert and it’s a busy road. The scenery was incredible throughout the drive – the landscapes throughout Morocco were vast, much bigger and more varied than I expected. The views changed constantly on the drive. Also as we drove through the towns and villages we got a fascinating, albeit brief, glimpse of the local lifestyle.

Tizi N’Tichka

As we headed out of the mountains the landscape became much flatter, we were approaching the edge of the Sahara. We finished the drive at Ait Benhaddou, an ancient casbah – obviously we had the Clash playing as we approached. Ait Benhaddou is a UNESCO world heritage site and also appears in Gladiator, Game of Thrones, and lots of other films. We arrived late in the afternoon and walked up through the streets to watch the sunset from the top of the village. Although there was a lot of driving the day was really interesting and sunset at Ait Benhaddou was a great finale.

Rooftops at Ait Benhaddou

Highlights – The Sahara

The Sahara Desert was the absolute highlight of the trip and a day and night that I’ll remember forever. We did so much in the day! First we stopped at a local town to pick up a picnic lunch, then visited an Islamic library with hundreds of books dating back to 1066 and some beautiful tiling. We also visited a pottery and had the chance to pick up some souvenirs. All this was early in the day, in the afternoon we were headed to the Sahara.

Tiles at Tamegroute library

After a short drive we arrived at a little town and left the van behind. We stopped for lunch, then climbed onto camels for a quick trek. In reality we only went to the edge of the town to have our photos taken next to a sand dune but it was really good fun. I’d brought a headscarf the previous day so I was in full desert explorer mode and taking lots of selfies. I was a bit worried about riding camels – I don’t think I’ve ever ridden on the back of an animal before, but it was easy and surprisingly comfortable. After the camels we switched to the modern form of desert transport – 4x4s! I was expecting a short drive to our camp but I was totally wrong – we were driving for a couple of hours through incredible landscapes that changed a lot; it wasn’t just sand dunes, there were rocky plains, areas of scrub, and even rocket growing wild in the desert (who knew!). The drive was great fun, and you could tell that the drivers enjoyed their jobs.


 We finished our drive at a desert campsite. This was right on the edge of the dunes and after a quick stop for mint tea we headed to the top of the largest dune to watch the sunset. Their were dunes as far as the eye could see and it felt incredibly remote. I don’t really have words to describe the rest of the day. We watched the sunset, took hundreds of photos, and walked the dunes. Even now I have so many photos that I can’t delete. It was utterly unlike anywhere I have been before. As it got dark we headed back to the main tent for dinner. By now it was pitch dark and getting cold, but out hosts had built a campfire so we headed back out into the night. The stars were so clear! I’ve never seen so many, the milky way was obvious and occasionally a shooting star fell from the sky. No photograph could do justice to how beautiful they were, all I can say is that a sky full of stars is one of the most incredible things I’ve seen. We sat out by the campfire talking, I could hardly take my eyes of the sky. A couple of the group had come up with a plan to make mulled wine in the desert as it was christmas. I hate mulled wine so I’m glad to say the plan was a failure.

In the morning I got up early to watch the sunrise, there were tracks in the dunes so there must have been some animals around in the night, although we hadn’t seen any. After breakfast we got back into the 4x4s for some more driving. Again this was so good. Abd our guide had told us we would have a chance to look for fossils on the way out of the desert and we stopped in a place surrounded by rocks – there were fossils everywhere! This was a complete surprise and a great finish to our time in the desert.

 Dunes at sunset

Highlights – Essaouira

Essaouria is a fishing port on the Atlantic close. We a couple of nights there at the end of the trip and it made for a great ending. It was much more touristy than the places we had been before and it was a nice time to unwind after a lot of travelling. We stayed in a beautiful riad – my favourite accommodation of the trip. We had an interesting tour of the town, ate barbecued fish that we brought straight of the dock, had too much gelato and generally enjoyed ourselves. It was a good chance to do some shopping, there were loads of things to buy – leather goods, woodwork, we found a herbal shop down a backstreet which had herbs spilling from the walls, hundreds of jars of products, and a floor lined with the husks of argan nuts. On the first evening a few of us had beers on a rooftop terrace, then listened to a great local band with some Moroccan film stars. Basically it felt like being on holiday and was a nice way to finish. Essaouira is so photogenic, and I came home with some great pictures.

Essaouira streets


Travelling to Morocco in December means that you need to be prepared for a variety of weather; it’s warm in the daytime but can be very cold at night. That said, it was never uncomfortable cold, and although I’d brought my own sleeping bag I didn’t need it. Unless you really feel the cold you won’t either. Our guide told us a saying about Morocco – “The cold country with the hot sun” – and this is very true, even in December the sun was very warm but when it got dark it got cold very quickly. It didn’t rain at all and it was never really cloudy either. One thing I would say is that it was often cold in the hotels at night – in warmer weather it would be nice to sit outside or go for a swim in the evenings. In December it wasn’t warm enough to do either which was a shame.


The accommodation throughout the trip was good. The hotel in Marrakech (El Caspien) had the best facilities but it was also the most expensive. The desert camp in the Sahara was obviously pretty basic but the beds were comfortable and their were plenty of sheets. The riad in Imlil was also basic and the showers weren’t exactly warm, but again it was perfectly comfortable. Apart from those two nights we stayed in hotels, my favourite of which was the riad in Essaouira which had a peaceful roof terrace. I also have to mention Riad Hida in Oulad Berhil which used to be a palace. It had beautiful grounds with peacocks in the gardens, and the restaurant was stunning. We had wifi every night except in the desert which was a nice surprise.


For most of the trip the food was quite similar. For breakfast we had bread, preserves, and maybe some pancakes or pastries. Simple, but tasty and filling. For lunch and dinner most places had a choice of tagine, cous cous, or chicken skewers and fries. The tagines and cous cous were more delicately spiced than I was expecting they were nice but not massively exciting. Also I’m not a big fan of red meat, or chicken on the bone, which didn’t help. There was normally a vegetarian option of vegetable (legume in French) tagine but all the tagine dishes also had plenty of veggies. The other dish that would appear regularly was berber omelette (an omelette with tomatoes and spices). I mostly chose chicken skewers and fries – I don’t eat chips at home but I was on holiday so I had an excuse! There was always plenty of tasty bread and olives alongside the meals so I never went hungry.

Essaouira is a fishing port so obviously there’s some great seafood available. On the first night in town I had delicious dish of monkfish cooked in a ginger sauce and the next day we brought fish straight from the harbour and had it cooked on the dock. It was so cheap – I had sardines which cost pennies but even monkfish or tuna only cost a few dirhams. After buying the fish you had to pay someone to gut it, then take it to the barbecue and pay again to have it cooked (again both a really cheap). It’s cooked very simply but is absolutely delicious. We had our guide to help us with this – if I was travelling alone I would have gone to one of the stands in a square near the harbour which have the fish ready to cook for a set price. There’s also a great gelato shop in the same square which is a  chance to work on your flavour combinations. The same shop also sells special hot chocolate.

In terms of drinks we got though a lot of coffee; mostly I had nos nos which is half espresso and half milk, the other choice being cafe noir. We also had a lot of mint tea – green tea with fresh mint leaves served in a teapot. There’s a technique to pouring it and you have to lift the pot as far above the cup as you can. I really enjoyed the mint tea – I much prefer it to straight green tea I’m going to start having it at home once I’ve grown some mint. Being a Muslim country alcohol isn’t widely available, a couple of the hotels served alcohol and there was the odd shop but you would need to be organised if you wanted to drink every day. Personally I found it was a nice change to not drink while on holiday. Until the last night that is, when I turned into a wine monster, but hey, it was our last night and I was in the mood.


For most of the trip we were in our own minibus and as there were only seven of us there was plenty of space. It was nice to have our own vehicle and meant we weren’t constantly worrying about out luggage. As I’ve said the 4x4s in the desert were great fun. I hadn’t realised that we would take a ‘chicken bus’ from Essaouira back to Marrakech – this actually turned out to be a nice coach with air conditioning. There were a couple of times where we left our main bags behind and took an overnight bag to our accommodation. This was a bit of an annoyance but I think that says more about my packing skills than anything else. There were a couple of long travel days which wasn’t ideal but the things we got to see and do made them worth it.

Intrepid South Morocco Discovery – December 2015

Fast Restores with Sql Server Snapshots

Using Backup/Restore to reset you data is ok but it can take a while. Snapshots are a much faster alternative. On my system a 20Gb snapshot restores in less than 10 seconds.

What are snapshots
A database snapshot is a readonly view of a database at the time the snapshot was created. The exist as a database on the server – you can find them in ‘Database Snapshots’ in the Sql Managment Studio object explorer. You can use them for reporting but here we are creating them, then restoring them over the main database.

Creating snapshots
Here’s the script to create a snapshot. It doesn’t need much explanation…

If db_id('DemoSnapshot') is Not Null
    Drop Database DemoSnapshot

CREATE DATABASE DemoSnapshot ON ( NAME = DemoDatabase, FILENAME = 'E:\TempBackups\Demo.ss') As Snapshot of DemoDatabase

If your database filename doesn’t match the database name you might get an error that says all files must be specified. In that case you need to pass the file name to the Name parameter.

Restoring snapshots
The script to restore the snapshot is simple as well. It closes existing connections by putting the database into single user mode, restores the snapshot, then puts the database back into multi user mode.

RESTORE DATABASE DemoData From Database_Snapshot = 'DemoSnapshot'


That’s it, run the restore script whenever you want to put the database back to the saved state.

Fast Restores with Sql Server Snapshots

Quick Fix: Android Emulator is offscreen

I’ve been having an annoying problem when the title bar for my Android emulator is off the top of the screen in Windows so I can’t move it around. I’ve found a couple of fixes…
1 – Hove over the icon on the TaskBar until a preview appears. Right click on the preview and select move. Then you can move the emulator with the cursor keys.
2 – Try using a different skin. I’ve found switching to no skin will bring the emulator back on screen and then I can switch it back to my normal skin with no problems.

Quick Fix: Android Emulator is offscreen