Press Ctrl-Alt-Delete then select Sign Out (If you are connected via RDP)
Software architecture and development in .NET, SharePoint, SQL Server, Windows Server, Best Practices
štvrtok 22. augusta 2013
Show My Computer Icon on Windows 2012 Server Desktop
This feature is not enabled by default ;-(
1. You must install ‘Desktop Experience’
After the restart you must be seeing the ‘Personalize’ from right click menu from desktop
See ya!
1. You must install ‘Desktop Experience’
You must restart the server after the installation.
After the restart you must be seeing the ‘Personalize’ from right click menu from desktop
See ya!
štvrtok 27. júna 2013
Preprocessor directives vs. Conditional Attributes
This is a simple example where you can see proprocessor directive and also Conditional Attribute.
Code Snippet
class Program
- {
- static void Main(string[] args)
- {
- # if DEBUG
- Console.WriteLine("Application starts in debug mode");
- # else
- Console.WriteLine("Application starts NOT in debug mode");
- # endif
- SayHelloOnlyInDebug();
- Console.ReadLine();
- }
- [Conditional("DEBUG")]
- private static void SayHelloOnlyInDebug()
- {
- Console.WriteLine("Hello!");
- }
- }
And what is different between proprocessor directive and Conditional Attribute?
Proprocessor directive - the statement in #if #else is compiled conditionally dependent upon thepresence of the DEBUG symbol.
Proprocessor directive - the statement in #if #else is compiled conditionally dependent upon thepresence of the DEBUG symbol.
Conditional Attribute - You might feel more comfortable with the Conditional attribute, which can be used to exclude entire methods, without needing to complicate the source with conditionals on the calling side.
streda 26. júna 2013
JSON string to object and vice versa
Simple example (you need .NET 3.5):
The main class is DataContractJsonSerializer
...
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
namespace JSonExample
{
[DataContract]
public class Person
{
[DataMember(Name = "Name")]
public string Name { get; set; }
[DataMember(Name = "Age")]
public int Age { get; set; }
}
class Program
{
static void Main(string[] args)
{
var customer = new Person {Age = 25, Name = "Albert"};
string jSon = JSONSerializer<Person>.Serialize(customer);
//{"Age":25,"Name":"Albert"}
var deserializedCustomr = JSONSerializer<Person>.DeSerialize(jSon);
}
}
public static class JSONSerializer<T> where T : class
{
/// <summary>
/// Serializes an object to JSON
/// </summary>
public static string Serialize(T instance)
{
var serializer = new DataContractJsonSerializer(typeof(T));
using (var stream = new MemoryStream())
{
serializer.WriteObject(stream,
instance);
return Encoding.Default.GetString(stream.ToArray());
}
}
/// <summary>
/// DeSerializes an object from JSON
/// </summary>
public static T DeSerialize(string json)
{
using (var stream = new MemoryStream(Encoding.Default.GetBytes(json)))
{
var serializer = new DataContractJsonSerializer(typeof(T));
return serializer.ReadObject(stream) as T;
}
}
}
}
Prihlásiť na odber:
Príspevky (Atom)












