piatok 13. decembra 2013

The backup set holds a backup of a database other than the existing 'DB_NAME' database.

I was trying to restore Sql server backup file for my database , but its throwing an error as follow


Solution:
Don't create an empty database and restore the .bak file on to it.
Use 'Restore Database' option and provide the database name while providing the source to restore.

sobota 7. decembra 2013

Android: taged unknown / adb devices unauthorized

While debugging  my Android phone in Eclipse  I ran into a little issue with adb.
In the column Targed was displayed : Unknow

So I wrote "adb devices" in console and found, my device is unauthorized

~ $ adb devices
List of devices attached 
00310d2453155029 unauthorized


The solution is:

1.) Disable USB Debugging mode
2.) Connect device with USB cable
3.) Enable USB Debugging mode
4.) Confirmation message will be displayed (Accepting RSA key from computer)


nedeľa 20. októbra 2013

Missing Toolbox in visual studio 2012

After successful installation of the Visual studio 2012 on a new computer I could't  find ToolBox. 

In Visual Studio 2010 and older versions it was simple View->ToolBox


In Visul Studio 2012 I got this:
So, where is ToolBox in the menu? I don't know..., but old keyboard shortcut is still working :  CTR + ALT + X



utorok 17. septembra 2013

This version of the rendering library is more recent than your version of ADT plug-in. Please update ADT plug-in




  1. Click Help > Install New Software.
  2. In the Work with field, enter: https://dl-ssl.google.com/android/eclipse/
  3. Select Developer Tools / Android Development Tools.
  4. Click Next and complete the wizard.



Unsupported template dependency : Android Support library

It's a big error in latest Android ADT:



"Latest Android SDK + ADT bundle available for downloading from developer.android.com does not allow to create new projects."

Reported as Issue  60149

The only solution for now is:

Simply manually extract and replace sdk - tools folder. This will use an earlier release until the issue is resolved. 

Linux
    http://dl.google.com/android/repository/tools_r22.0.5-linux.zip
    Size: 106MB
Windows
    http://dl.google.com/android/repository/tools_r22.0.5-windows.zip
    Size: 113MB

..\adt-bundle-windows-x86-20130911\sdk\tools
..\adt-bundle-windows-x86_64-20130729\sdk\tools\ 


Then you have to restart Eclipse and everything is working like a charm

štvrtok 22. augusta 2013

How to log-off from Windows Server 2012

Press Ctrl-Alt-Delete then select Sign Out (If you are connected via RDP)

}

Show My Computer Icon on Windows 2012 Server Desktop

This feature is not enabled by default ;-(


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
  1. {
  2.    static void Main(string[] args)
  3.    {
  4.  
  5. # if DEBUG
  6.      Console.WriteLine("Application starts in debug mode");
  7. # else
  8.     Console.WriteLine("Application starts NOT in debug mode");
  9. # endif
  10.  
  11.      SayHelloOnlyInDebug();
  12.  
  13.      Console.ReadLine();
  14. }
  15.  
  16.  [Conditional("DEBUG")]
  17.   private static void SayHelloOnlyInDebug()
  18.   {
  19.     Console.WriteLine("Hello!");
  20.   }
  21. }

       











































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. 
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;
            }
        }
    }
}