Author: nrogoff

Finding missing indexes and quick optimising of SQL Azure

If you are looking for a quick way to improve your SQL Azure performance then you can check to see if SQL Azure has determined if any useful indexes are missing.

In SQL Server Management Studio (SSMS) run the following against your database

select * from sys.dm_db_missing_index_details

This will output something like (I have obscured some sensitive names)

 

For example, the above suggested I made the following indexes on AccessNoXRefs table.

For more information see http://msdn.microsoft.com/library/ms345434.aspx and http://msdn.microsoft.com/en-US/library/dn133166.aspx

Best app for analysing and visualising space usage on your hard drives. WinDirStat

I have been using this app for years and it’s still the best one out there.

WinDirStat (https://windirstat.info/) is a brilliant application that trawls through you files on a disk analysing their files types, location and size.

 

When it finishes analysing (which it does remarkably quickly, but may take a few minutes) you get presented with a great looking ‘TreeMap’. Select a folder or file type shown in the lists and the associated part of the map is highlighted. This gives you a very quick feel for what’s taking up all that space.

 

 

Proud to be Xamarin Certified

After looking at all the various methods and frameworks for cross-platform mobile development, I decided that Xamarin‘s approach and mature tech was the way to go.

I got a subscription and signed up for the Xamarin University training course. Many late nights doing excellent live training, a visit to the Xamarin Evolve 2014 conference in Atlanta and a tough 150 question 3 hour exam later…I am now officially a ‘Certified Xamarin Mobile Developer’

Oh…and it was not easy! 1 minute 12 secs per question and an 80% pass mark!!

 

Xamarin certification can be verified at https://university.xamarin.com/certification#verify and found in the Xamarin Certified Developers LinkedIn Group.

If you are wanting or thinking of developing mobile apps, then this is a brilliant technology for managing the whole process. Code shared across platforms can be as high as 95% when using Xamarin Forms. And it creates native apps…not horrid HTML/JavaScript things!

Entity Framework – Setting integer keys client side gets ‘Cannot insert the value NULL’

I have just been banging my head against a wall trying to get a simple database record added to a simple table using Entity Framework! My table has a primary key field of type INT, but is NOT set as an identity field (i.e. Not set to increment SQL server side). I wanted the ability to set the Id in code.

An example would be a model like:

public Contact
{
    [Key]
    public int Id { get; set; }
    public string Name { get; set; }
}

then you would normally expect the standard EF code like this to work

var myNewContact = new Contact
{
    Id = 123,
    Name = "John Smith"
}
DataContext.Contacts.Add(myNewContact);
DataContext.SaveChanges();

However it always came back with the a DbUpdateException stating

“Cannot insert the value NULL into column ‘Id’, table ‘MyDatabase.dbo.Contacts’; column does not allow nulls. INSERT fails.”

It turns out that Entity Framework assumes that an integer [Key] field will always be generated server side. Maybe I should have known this, but actually found it very hard to locate this bit of information.

Once you know this the fix is very straight forward. You just need to decorate your model object with

[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]

so the model above becomes:

public Contact
{
    [Key, DatabaseGenerated( DatabaseGeneratedOption.None )]
    public int Id { get; set; }
    public string Name { get; set; }
}

I hope this saves someone wasting as much time and loosing as much hair as I did on this simple issue!

One reason it took so long, is that I can’t get Entity Framework Profiler working with the Azure Emulator. If any has had any success with this, please let me know.

Bing Maps Preview has unbelievable 3D detail

 

I have been looking at the Bing Maps Preview Windows 8 App and checking out it’s 3d data. The image quality and model accuracy is breath taking. When I was developing GIS apps we would have killed for this kind of detailed LIDAR data. Have a check for free.

Here are a couple of images at 50% which should give you an idea.