Viadeo

jeudi 31 mars 2011

Ria Ritchie - Where did it all go wrong Tab : chords and lyrics

Ria Ritchie - Where did it all go wrong (Acoustic)


this complete tab by XavAve
LYRICS and CHORDS !
F# Bbm7
I‘ve been thinkin, thinking bout how we fell apart
Ebm7 Db7M
I‘ve been hoping, hopin one day that your heart
F# Bbm7 Ebm7
will start dreaming, dreaming of me
G#m7
but that sunshine ive been waiting for
Db
seems to be gone

F# Bbm7
I‘ve been sinkin, i've been sinking since you left
Ebm7 Db7M
and i've been tryin tryin so hard to forget
F# Bbm7 Ebm7
but im still dreaming, dreaming of you
G#m7
and it's all because coz you left me
Db
yeah you left me alone

Bmaj7
and is it so wrong
Bm
to wish that we'd get along
Ebmin7
you told me you'd hold me
Ebm7 (then Db bass)
then sold it all
Bmaj7
and its been so long
Bm F#
so tell me where did it all go wrong?

F# Bbm7
I’ve been thinking, thinking bout how we used to talk
Ebm7 Db7M
and I’ve been missing, missing all your little faults
F# Bbm7 Ebm7
so I’m still dreaming, dreaming of you
G#m7
but that sunshine I’m waiting on
Db
seems to be gone

F# Bbm7
so I’ve been lyin, i've been lying to myself
Ebm7 Db7M
coz I’ve been holdin, holdin
F# Bbm7 Ebm7
onto something that is broken, broken in two
G#m7
and it's all because coz you left me
Db
yeah you left me alone


Bmaj7
Is it so wrong
Bm
to wish that we'd get along
Ebmin7
you told me you'd hold me
Ebm7 (then Db bass)
then sold it all
Bmaj7
and i was so strong
Bm
back then when we'd get along
Ebmin7
you'd tell me that you love me
Ebm7 (then Db bass)
but sold me onnnnnn ohhh
G#m7 Bbm7
so tell where did it all go wrong?

G#m7
ohhh ohhhh ohhhhh
G#m7 Am7 A#m7
G#m7
ohhh ohhhh ohhhhh
F# F#
Bmaj7
and is it so wrong
Bm
to wish that we'd get along
Ebmin7
you told me you'd hold me
Ebm7
then sold it all
Bmaj7
and i was so strong
Bm
back then when we'd get along
Ebmin7
you'd tell me that you love me
Ebm7 (then Db bass)
but sold me onnnnnn ohhh
G#m7 F#
so tell where did it all go wrong?

mercredi 16 mars 2011

music break!

Master Data Services : Getting Errors out of a ModelMembersBulkUpdate/Merge with API


In fact, you can get the error codes on MDS website : in "Integration Management/Staging Batches" clicking on the batch you want and clicking on button "view details for selected batch"
in order to do the same thing with API (get error codes), you'll need to get back the batch after it is inserted. 


//get information related to a staging batch
 public Collection<StagingBatch> StagingGet(Collection<Identifier> stagingBatch, bool ReturnAllCriteria, bool ReturnMembers, bool ReturnAttributes, bool ReturnRelationShips, ref OperationResult or)
 {
 Collection<StagingUnbatchedInformation> colUnbatched = new Collection<StagingUnbatchedInformation>();
 Collection<StagingBatch> colBatches = new Collection<StagingBatch>();
 using (ServiceClient c = MDS_WSConnect.CreateMdsProxy())
 {
 or = new OperationResult();
 colBatches = c.StagingGet(new International(), true, new StagingResultCriteria() { All = ReturnAllCriteria, Attributes = ReturnAttributes, Members = ReturnMembers, Relationships = ReturnRelationShips },
 new StagingSearchCriteria() { StagingBatches = stagingBatch, StagingDataStatus= StagingDataStatus.All }, out or, out colUnbatched);
 List<string> lstErr = new List<string>();
//...do what you need with the error collection
foreach (<strong>StagingBatchError err in colBatches.First().Errors</strong>)
{
 lstErr.Add(err.ErrorCode + " - " + err.TargetCode);
 }

 return colBatches;
 }
 }
so, complete process would be:

DateTime dtBefore = DateTime.Now; 
OperationResult or = new OperationResult();
  //filling new staging batch with entityMembers
  Collection<Identifier> colStaging = ModelMembersBulkMerge(colEntMembers);
  //initiating the staging process (not sure I really need that here in fact)
  Collection<StagingBatch> colBatches = StagingGet(colStaging, true, true, true, false, ref or);
  //triggering staging
  ProcessUnbatchedStaging(pModelId, pVersionId);

  DateTime dtAfter = DateTime.Now;
  TimeSpan ts = dtAfter.Subtract(dtBefore);

  MessageBox.Show("members (bulk) inserted : " + colEntMembers.First().Members.Count() + "\r\n" + "time elapsed (seconds):" + ts.TotalSeconds.ToString());
  //get back the batch to see if any errors 
  
  colBatches = StagingGet(colStaging, true, true, true, false, ref or);
note: StagingDataStatus= StagingDataStatus.All --> get all including Errors

jeudi 10 mars 2011

SQL 2008 R2 Master Data Services : Bulk Data Insert with API

In this article, I will talk about Master Data Services.
You can find the source code of this example on my MDS project on Codeplex:
http://mdsmanager.codeplex.com  

Special thanks to Suzanne Selhorn at Microsoft for help and support and her new great book about Master Data Services that you can find on Amazon :
http://www.amazon.com/Microsoft-Server-2008-Master-Services/dp/007175623X

Update 30 april 2011
a part of a answer message from Tyler Graham about synchronous /asynchronous operations:
" I wanted to ensure you understood that EntityMembersCreate and its partners calls are synchronous calls that will return any and all errors founds in the MDS load. (More so in Denali where some problems have been fixed)  ModelMembersBulkMerge and any calls with the ‘Bulk’ keyword leverage staging and will return success no matter what the disposition of the records as the use of staging is asynchronous."


thanks to Tyler for this useful remark!


Note : 
__________________________________________________________________________________
EntityMembersCreate : only new member records with unique codes can be created with this operation. If a member code already exists, an error will be thrown in the returned error collection and the member will not be created or updated.

EntityMembersMerge : Many users have been confused by this operation and believe it has something to do with record survivorship or match merge functionality. This operation does nothing to look for possible matches or provide any survivorship functionality; it only allows users to create and update records simultaneously within MDS.
Information source : 
book: Master Data Services "Implementation and Administration" by Tyler Graham and Suzanne Selhorn
__________________________________________________________________________________
So, what's the point:

you want to insert a big number of members in a MDS entity, with API (MDS WebService)
first solution :


Second Solution :


___________________________________________________________________
So let's see the 2 solutions in details :


First solution  : (slow, not recommanded)
inserting each member with API method EntityMembersCreate

example:
 private void btTest_Click(object sender, EventArgs e)
        {
            if (lstModels.SelectedItem != null && lstVersions.SelectedItem != null)
            {
                string pEntityName = (ucManageEntities1.lstEntities.SelectedItem as CustomEntity).Name;
                string pModelName = (lstModels.SelectedItem as Identifier).Name;
                string pVersionName = (lstVersions.SelectedItem as CustomVersion).Name;
                List<CustomMember> lst = new List<CustomMember>();

                for (int i = 1; i <= 4000; i++)
                {
                    MemberIdentifier mi = new MemberIdentifier() { Code = "Code" + i.ToString(), Name = "Name" + i.ToString() };


                    Member m = new Member() { MemberId = mi };
                    m.Attributes = new Collection<Common.ServiceReference1.Attribute>();
                    Identifier attId = new Identifier() { Name = "myTestAtt" };
                    m.Attributes.Add(new Common.ServiceReference1.Attribute() { Identifier = attId, Value = "AttValue" + i.ToString() });

                    CustomMember cm = new CustomMember(m);

                    lst.Add(cm);
                }

                EntityMemberCreate(pEntityName, pModelName, pVersionName, lst, true);
            }
        }


        public EntityMembers EntityMemberCreate(string pEntityName, string pModelName, string pVersionName, List<CustomMember> pMdmMembers, bool bCreate)
        {

            International international = new International();


            EntityMembers entityMembers = new EntityMembers();
            System.Collections.ObjectModel.Collection<Member> members = new System.Collections.ObjectModel.Collection<Member>();
            entityMembers.Members = members;
            entityMembers.EntityId = new Identifier() { Name = pEntityName };
            entityMembers.ModelId = new Identifier() { Name = pModelName };
            entityMembers.VersionId = new Identifier() { Name = pVersionName };
            foreach (var mdmMember in pMdmMembers)
            {

                Member member = new Member();
                MemberIdentifier memberIdentifier = new MemberIdentifier();
                memberIdentifier.Code = mdmMember.Code;
                memberIdentifier.MemberType = MemberType.Leaf;
                memberIdentifier.Id = new Guid();
                memberIdentifier.Name = mdmMember.Name;
                member.MemberId = memberIdentifier;
                member.Attributes = new System.Collections.ObjectModel.Collection<Common.ServiceReference1.Attribute>();
                foreach (var myAttribute in mdmMember.mbr.Attributes)
                {
                    Common.ServiceReference1.Attribute attribute = new Common.ServiceReference1.Attribute();
                    attribute.Identifier = new Identifier() { Name = myAttribute.Identifier.Name };
                    attribute.Value = myAttribute.Value;
                    attribute.Type = AttributeValueType.String;
                    member.Attributes.Add(attribute);

                }

                members.Add(member);

            }
            if (bCreate)
            {
                using (ServiceClient c = MDS_WSConnect.CreateMdsProxy())
                {
                    DateTime dtBefore = DateTime.Now;
                    OperationResult or = c.EntityMembersMerge(international, entityMembers);
                    DateTime dtAfter = DateTime.Now;
                    TimeSpan ts = dtAfter.Subtract(dtBefore);

                    MessageBox.Show("members merged : " + entityMembers.Members.Count() + "\r\n" + "time elapsed (seconds):" + ts.TotalSeconds.ToString());

                }
            }
            return entityMembers;
        }

Second Solution : with API method ModelMembersBulkMerge (fast, recommanded)
example:

 private void btTest2_Click(object sender, EventArgs e)
        {
            if (lstModels.SelectedItem != null && lstVersions.SelectedItem != null)
            {
                string pEntityName = (ucManageEntities1.lstEntities.SelectedItem as CustomEntity).Name;
                Identifier pModelId = (lstModels.SelectedItem as Identifier);
                string pModelName = (lstModels.SelectedItem as Identifier).Name;
                Identifier pVersionId = (lstVersions.SelectedItem as CustomVersion).Identifier;
                string pVersionName = (lstVersions.SelectedItem as CustomVersion).Name;
                List<CustomMember> lst = new List<CustomMember>();

                for (int i = 1; i <= 4000; i++)
                {
                    MemberIdentifier mi = new MemberIdentifier() { Code = "Code" + i.ToString(), Name = "Name" + i.ToString() };


                    Member m = new Member() { MemberId = mi };
                    m.Attributes = new Collection<Common.ServiceReference1.Attribute>();
                    Identifier attId = new Identifier() { Name = "myTestAtt" };
                    m.Attributes.Add(new Common.ServiceReference1.Attribute() { Identifier = attId, Value = "myValue" + i.ToString() });

                    CustomMember cm = new CustomMember(m);

                    lst.Add(cm);
                }
                Collection<EntityMembers> colEntMembers = new Collection<EntityMembers>();
                colEntMembers.Add(EntityMemberCreate(pEntityName, pModelName, pVersionName, lst, false));

                DateTime dtBefore = DateTime.Now;

                //filling new staging batch with entityMembers
                Collection<Identifier> colStaging = ModelMembersBulkMerge(colEntMembers);
                //initiating the staging process
                Collection<StagingBatch> colBatches = StagingGet(colStaging, true, true, true, false);
                //triggering staging
                ProcessUnbatchedStaging(pModelId, pVersionId);

                DateTime dtAfter = DateTime.Now;
                TimeSpan ts = dtAfter.Subtract(dtBefore);

                MessageBox.Show("members (bulk) inserted  : " + colEntMembers.First().Members.Count() + "\r\n" + "time elapsed (seconds):" + ts.TotalSeconds.ToString());


            }



        }
        //triggering staging for a specific model and version
        public void ProcessUnbatchedStaging(Identifier modelId, Identifier versionId)
        {
            using (ServiceClient c = MDS_WSConnect.CreateMdsProxy())
            {
                OperationResult or = new OperationResult();
                c.StagingProcess(new International(), true, new StagingUnbatchedCriteria() { ModelId = modelId, VersionId = versionId }, out or);
            }
        }

        //get information related to a staging batch
        public Collection<StagingBatch> StagingGet(Collection<Identifier> stagingBatch, bool ReturnAllCriteria, bool ReturnMembers, bool ReturnAttributes, bool ReturnRelationShips)
        {
            Collection<StagingUnbatchedInformation> colUnbatched = new Collection<StagingUnbatchedInformation>();
            Collection<StagingBatch> colBatches = new Collection<StagingBatch>();
            using (ServiceClient c = MDS_WSConnect.CreateMdsProxy())
            {
                OperationResult or = new OperationResult();
                colBatches = c.StagingGet(new International(), false, new StagingResultCriteria() { All = ReturnAllCriteria, Attributes = ReturnAttributes, Members = ReturnMembers, Relationships = ReturnRelationShips }, new StagingSearchCriteria() { StagingBatches = stagingBatch }, out or, out colUnbatched);

                return colBatches;
            }
        }
        public Collection<Identifier> ModelMembersBulkMerge(Collection<EntityMembers> modelMembers)
        {

            Collection<Identifier> colBatches = new Collection<Identifier>();
            using (ServiceClient c = MDS_WSConnect.CreateMdsProxy())
            {

                OperationResult or = new OperationResult();
                or = c.ModelMembersBulkMerge(new International(), modelMembers, out colBatches);


            }
            return colBatches;
        }