Skip to main content

Posts

Showing posts with the label store

Payload Replication - Temporary and Master of data

There are moments in time when you focus on small things and you might miss bigger and more important things. Working on a solution that is distributed in multiple Azure Regions across the world we had to replicated binary content (files) in all data centers where our solution runs. The system that push this content is an on-premises system. In this context we decided to use a temporary location where the content is copied first and from where we replicate the content in other regions. As we can see, the Temp location is used to replicate the content all around the glob. The system is smart enough to balance the load and if multiple replicas are needed in the same Azure Regions, only one copy will be done from the Temp location. Once the replication is done, the binary content from the Temp location is removed automatically. Nothing special until this, until in the moment when you ask yourself what is happening if one of the Replicas is corrupted or something happens and you ...

XXX takes a dependency on Microsoft.VCLibs.110 framework but is missing the framework dependency declaration in the manifes.

In cazul in care incercati sa validati aplicatie Metro style App pentru Windows 8 si va treziti cu urmatoarea eroare: XXX takes a dependency on Microsoft.VCLibs.110 framework but is missing the framework dependency declaration in the manifes. o sa fie destul de ciudat de rezolvat si gasit cauza daca proiectul vostru este un proiect XAML cu C# sau HTML 5 cu JavaScript. By default voi nu aveti nici o referinta la nici un proiect C++ care sa va genereze aceasta dependinta. In cazul in care ati folosit librarii externe precum cele pentru Bing Maps, in mod indirect o sa aveti o dependinta spre aceasta librarie. Daca am fi fost intr-un proiect de C++ si nu C# aceasta dependinta ar fi fost adaugata automat. Adaugarea acestei dependinte trebuie sa fie facuta din fisierul "Package.manifest". Din pacate nu se poate face dintr-o interfata grafica prietenoasa. O sa fie nevoie sa deschideti acest fisier dintr-un editor XML sau test si sa adaugati sub nodul "Package" urmatorul c...

How to store an array of booleans in a int

Uneori ajungem sa ne dorim sa stocam intr-un int mai multe valori booleene( de obicei de dragul artei) pentru a salva a avea mesajele care se trimit pe tiava cat mai mici. O solutie pe care o propun este sa folosim BitArray. Acesta ne permite sa lucram cu biti. Pentru a initializa si seta valoriile unui BitArray trebuie sa scriem urmatorul cod:   BitArray bits = new BitArray(32); // 32 - numarul de biti pe care il ocupa un int  bits[0] = true; ... bits[31] = false;   Urmatorul pas este sa convertim un BitArray in int. Acest lucru se face destul de usor cu metoda CopyTo:   int[] valueConverted = new int[1]; bits.CopyTo(valueConverted,0); // 0 - reprezinta indexul de inceput  int result = valueConverted[0];   In result am obtinut int-ul care contine BitArrat-ul nostru.Pentru a executa procesul invers, sa obtinem un BitArray dintr-un int este nevoie sa apelam metoda statica GetBytes a clasei BitConverter.   BitArray bits = BitConve...