lock (this) - For and against
Recently reviewing the code I have found the following construction:
lock (this) { // Do something }
To synchronize access to shared resource object is used, in which this construction occure.. Theoretically, this code is correct. What more, there was no problem with deadlock in the program..
Windows Phone Fast Application Switching
With the new version of Windows Phone – Mango the program management model has been changed. Until now there were only four states in which the application could be. At the time of restarting the application developers had to take care every time, that all data have been re-loaded. This idea was to ensure that mobile phone will be high-performance device and it will work long on batteries. The idea was and still is very correct, but has been slightly modified.
Hybrid WPF application with parameters
Hmmmmm...... What is a hybrid application WPF? I tried to find some other term for this problem, but unfortunately it seems to be most relevant. Concept of a hybrid application WPF I will call the application, that works and presents the results in the console, as well as in its own window. Additionally, the application should support passing parameters during the boot.
GPS - the distance between two points and the midpoint
Today I want to share with you with two functions related with GPS. The first of them calculates the distance between two points. The distance is given in meters.
Debugging Visual Studio
Today I will try to describe the technique used rarely to find bugs. It involves the use of second instance Visual Studio to find errors in the first. Looking at the last sentence, you can begin to think about how to look for errors in Visual Studio can help you find bugs in our program. It should be realized, that really Visual Studio incorporates our code. And our goal is to trace the activities of this code.
Assembly generation failed — Referenced assembly does not have a strong name
By creating programs, very often use various libraries created by others. As long as the code is created for its own, do not look at it as a library used was prepared. The first moment, when he begins to pay attention to it to decide to publish a solution for larger audience. At this point, begin to appear mean security code. The easiest way is to sign the resulting files. And here you may receive the first issue. It seams, that in order to compile the program receive the following message:
Assembly generation failed -- Referenced assembly 'Foo' does not have a strong name
Main method Zaginiona()?
When creating an application WPF sometimes you need to write your own methods Main(). When viewing files in the walkthrough you come across files *.xaml and linking them *.xaml.cs and code files *.cs. Unless you need to do something is often not a standard is not necessary, to delve into different types of mechanisms. Such a mechanism could be the start application WPF.
Recently I needed to add a custom method Main(). I thought, it will be simple - a new class and the code. Of course I checked earlier, whether this method has not been defined in the files walkthrough.
Application on two monitors
Currently, you can see more and more people working in offices on two or more monitors. Such work is more convenient and efficient. Sam, as a developer I would not be able to change back to one monitor. Therefore I see no contraindications, to write their own applications in a way, for working on multiple monitors. Of course this is not always feasible.
Verification of the signed XML document
Previous post move issues related to the signing of documents. This entry, however, did not close topic, because it does not show how to verify a signed document. This subject will try to move in this entry.
Signing XML documents
By creating different types of programs, sometimes there is a problem to ensure the authenticity of the file. This situation occurs, when these files are very important data, change which could lead to generate different types of losses. Such files can be license files, containing financial data, and medical data, etc. This problem can be solved very easily using XML files. Just, sign that the XML file and check the signature before re-use file. If it is correct then we will have confidence, that the file has not been any unauthorized modifications. In the event of any change, signature of the document will not respond to the information, which appear in the document.
Ping
Commands ping unless you do not have anyone present. It is used to diagnose network connectivity. With it you can check, Is there a connection between two hosts, what is the quality of this connection and the delays that occur. Additionally, if the host does not give the address in the form of address IP we can diagnose, whether the names are resolved correctly by the server DNS.
List of installed applications
Sometimes there is a need to find information about what software is installed on your computer. For example, we want to know, if anyone has already installed the program and where it is installed. This knowledge is needed, example, if you add a file to a directory with the program already installed. The simplest example is to write different kinds of plugins. The problem does not occur if the application has been installed in the default directory, we know, but this can no longer guarantee.
Snippety
Recently I discovered a new function to define your own code templates. This functionality is very often used by programmers, but can work wonders. In writing a business application always comes a time, that you need to write code to write data to the database, as well as their reading.
In this case, 90% code is the same. First, read the column number, which stores data in such. SQLDataReader. And then we build on the basis of data objects. When reading data from the database should be programmed as the situation where there is a null. And this usually works if the column is read is null. If this is substituted with a default. If there is no nulla value is read from the database.
SerializableDictionary
This day, I needed to use XML serialization for a class Dictionary. I was very surprised when I have discovered, that this class does not support this kind of serialization. It seems to be, that XML data format is already the standard today, but it turns out, that is not everywhere. I try to find some solution in Google. I was thinking that somebody has been struggling with the same issue and shared developed solution. I managed to find some examples of solutions to this problem, but each of them had a small errors, that caused, that dictionary did not work as expected.








