Got burgled, some thoughs regarding technology
Last week (sunday 8th of May) one of my friends broke his leg playing soccer, so we decided to go visit him, as we got home at about 10:00PM I noticed a rather strange looking stick outside our flat door.
As we opened the door to our flat my wife noticed that the curtain by the door is pulled back and pieces of glass all over the floor, a robber (probably one of the seven dwarfs, my guess is "Grumpy") broke a window (seen below) and managed to climb through the burglar bars.
The robber got away with two laptops, a tablet, external drives and some of my wifes jewelry - all of it worth around R 30 000 (about $ 4 300) along with all my hard earned intellectual property (incl backups). Incidently Jon Skeet also got burgled a few weeks before us (also lost some data)...
All of this misfortune made me think about revising my backup strategy, its obviously not very clever to have all your eggs in one basket (fire, theft, hardware failure etc), we can't afford having a single point of failure.
This makes a nice case for having your data somewhere on the server in the sky aka cloud, but this doesn't mean that you're immune against the odd cloud burst ;), even google won't guarantee nor take responsibility for your loss of data on their servers as seen in the following extract out of their terms of service:
15. LIMITATION OF LIABILITY
15.1 SUBJECT TO OVERALL PROVISION IN PARAGRAPH 14.1 ABOVE, YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS LICENSORS SHALL NOT BE LIABLE TO YOU FOR:
(A) ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL CONSEQUENTIAL OR EXEMPLARY DAMAGES WHICH MAY BE INCURRED BY YOU, HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY.. THIS SHALL INCLUDE, BUT NOT BE LIMITED TO, ANY LOSS OF PROFIT (WHETHER INCURRED DIRECTLY OR INDIRECTLY), ANY LOSS OF GOODWILL OR BUSINESS REPUTATION, ANY LOSS OF DATA SUFFERED, COST OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR OTHER INTANGIBLE LOSS;
Lets have a quick look at a few possible things to consider (consider I am no expert, just a few random thoughts).
-
Location, Location, Location
The biggest lesson I learned out of this experience is probably the physical location of my backups e.g. needed an offsite backup strategy as well.
We can get a dedicated server, or use one of the many online services like Rsync.
(Or keep backups using removable harddrives at your office and home)
-
Type of data
I also noticed the amount of time I needed to re-install my software, to get everything up and running again, service packs, patches etc (even now I am not even close to having my development environment fully back to normal).
What a waste of time! Time I could have rather spent developing software.
Now instead of simply/solely having backups of my work, it would have been nice if I had an ISO or something that contains everything I need to get up and running again - a simple restore there you go sir.
As for my email, it would have made a lot more sense if I used IMAP instead of POP.
-
Frequency
How often do we need to backup our data? Obviously critical/active data as often as possible.
Bandwidth (in context of offsite & frequency) is also something to consider (In my country bandwidth is currently quite expensive) when looking at the frequency of backup (using a cloud strategy).
-
Versioning
It would be ideal if we can revert back to a previous version of our data, if you or someone else stuffed up :).
-
Verification
We need to verify that our backups are indeed running and not failing and take it seriously, hehehe. We've got team foundation server at work, but I neglected to check everything in due to com failure.
Now I am just waiting for my insurance to process my claim, though I am not convinced that my insurance is worth the money I am paying for it - perhaps rather invest i something thats not looking for a reason not to pay out ;)
Posted by - Christoff Truter
Date - 2011-05-18 16:43:15
Comments - 0
Date - 2011-05-18 16:43:15
Comments - 0
Microsoft Dynamics CRM 2011 (5.0) : C# - Add file to an account
In one of my previous posts we had a look at how to add a file to a CRM 4.0 account using the webservices that ship with CRM - in this post we're going to look at how to accomplish this using CRM 2011.
In CRM 4.0 I used the webservice "/MSCRMServices/2007/CrmService.asmx", which is also available in CRM 2011 - which in theory should provide us with some compatibility, allowing us to still use our older code. (in my example I didn't use the CRM 4.0 SDK)
But unfortunately (at the moment I wrote this, perhaps Microsoft fixed it by the time you read this) this is not the case at all, if we attempt to add a file using the 2007 service provided by CRM 2011 you will get an exception that looks something like this:
If we look at the detail of our SoapException, we'll find a message looking something like this:
<error> <code>0x80040216</code> <description>Attribute objectidtypecode must have the same value as attribute objecttypecode</description> <type>Platform</type> </error>
Now this is obviously a new field added to CRM 2011, one thats not being exposed by the service - not sure if this is neglect or on purpose, but there is an easy workaround - try to avoid this workaround if possible (will show you a better alternative in this post).
Assuming you're using a web reference (not to be confused with the newer service reference WCF), you will need to find reference.cs in your web references folder, search for the annotation class and add the following property within the annotation class:
public EntityNameReference objectidtypecode { get { return this.objecttypecodeField; } set { this.objecttypecodeField = value; } }
If you're using a service reference (WCF), you will need to add something like this:
[System.Xml.Serialization.XmlElementAttribute(Order=24)] public EntityNameReference objecttypecode { get { return this.objecttypecodeField; } set { this.objecttypecodeField = value; this.RaisePropertyChanged("objecttypecode"); } }
Even though this will probably solve the problem, we must rather try to use the new webservice "/CSTruter/XRMServices/2011/Organization.svc", because how many other underlying issues will we have without knowing about them?
Instead of consuming the above mentioned webservice like we generally consume services, we can use the CRM service utility (located in the CRM 2011 SDK bin folder) which will generate us some early-bound entity classes via the following command:
crmsvcutil /url:"http://dionysis:5555/CSTruter/XRMServices/2011/Organization.svc" /out:Xrm.cs
Note: chances are that you might receive the following exception if you run this tool:
Exiting program with exception: Could not load file or assembly 'Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'
To make all of this work you'll need to include the generated code along with references to the following .NET 4.0 assemblies:
microsoft.xrm.sdk assembly (also located within the CRM 2011 SDK bin folder)
System.Runtime.Serialization
System.ServiceModel
In the following snippet we consume the webservice:
using System; using System.Linq; using System.IO; using Microsoft.Xrm.Sdk.Client; using System.ServiceModel.Description; class Program { static OrganizationServiceContext context; static void Main(string[] args) { ClientCredentials credentials = new ClientCredentials(); credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials; //credentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password", "domain"); Uri uri = new Uri("http://dionysis:5555/UIT/XRMServices/2011/Organization.svc"); OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null); proxy.EnableProxyTypes(); // enable support for early-bound entities context = new OrganizationServiceContext(proxy);
Notice classes OrganizationServiceProxy and OrganizationServiceContext:
In the snippet we're passing the proxy to the service context class, now we don't need to do this, we can use the proxy class directly and skip the use of the context class, but apparently the context class attempts to manage entity relationships etc.
We're going to attempt to add a file to the following CRM account:
To add the file to this account (or pretty much any entity for that matter) will look something like this:
static void AddDocument(string filename, Guid id, string logicalName) { Annotation annotation = new Annotation(); FileInfo fileInfo = new FileInfo(filename); annotation.FileName = fileInfo.Name; annotation.DocumentBody = Convert.ToBase64String(File.ReadAllBytes(filename)); annotation.IsDocument = true; // rather pass the actual type annotation.MimeType = "application/octet-stream"; annotation.ObjectId = new Microsoft.Xrm.Sdk.EntityReference(logicalName, id); context.AddObject(annotation); context.SaveChanges(); }
We need to pass a filename (full path), Guid (reference to the specific account to which we want to add the file) and the logicalName of the entity (which is "account" in this instance).
In order to retrieve the reference needed for the preceding snippet, you can write a simple LINQ query like seen in the following snippet:
Account account = (from p in context.CreateQuery<Account>() where p.Name == "test" select p).SingleOrDefault(); if (account != null) { AddDocument(@"c:\test.txt", account.Id, "account"); }
Posted by - Christoff Truter
Date - 2011-04-18 17:21:00
Comments - 1
Date - 2011-04-18 17:21:00
Comments - 1
First 1 2 3 4 5 6 7 8 9 10 Last / 65 Pages (129 Entries)