Friday

c# binary deserialize unable to find assembly version=1.0.0.0, culture=neutral, publickeytoken=null

Got error with binary deserialisation : unable to find assembly xxx version=1.0.0.0, culture=neutral, publickeytoken=null 
It requires to have additional SerializationBinder class .
Here is whole workable storage class:

using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System;
using System.Runtime.Serialization;
using System.Reflection;

public static  class Storage {

    public const string ConfigurationName = "dev.settings";
    public static string SettingFileName
    {
        get
        {
            return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), ConfigurationName);
        }
    }

    public static  void Save(cProfile gh)
    {
        FileStream writeStream = new FileStream(SettingFileName, FileMode.Create);
        BinaryFormatter formatter = new BinaryFormatter();
        formatter.Serialize(writeStream, gh);
        writeStream.Close();
    }


    public static cProfile  Load() {
        cProfile ret= new cProfile();

        Manager.getInstance().RunSafe (delegate()
        {
            if (File.Exists(SettingFileName))
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Binder = new PreMergeToMergedDeserializationBinder();

                FileStream readStream = new FileStream(SettingFileName, FileMode.Open);
                ret = (cProfile)formatter.Deserialize(readStream);
                readStream.Close();
            }
        });
        return ret;


    }


    sealed class PreMergeToMergedDeserializationBinder : SerializationBinder
    {
        public override Type BindToType(string assemblyName, string typeName)
        {
            Type typeToDeserialize = null;

            // For each assemblyName/typeName that you want to deserialize to
            // a different type, set typeToDeserialize to the desired type.
            String exeAssembly = Assembly.GetExecutingAssembly().FullName;


            // The following line of code returns the type.
            typeToDeserialize = Type.GetType(String.Format("{0}, {1}",
                typeName, exeAssembly));

            return typeToDeserialize;
        }
    }
}





Thursday

"app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "az" (Azerbaijani), "be" (Belarusian), "bg" (Bulgarian), "bn" (Bengali), "bs" (Bosnian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "es-US" (Spanish: United States), "et" (Estonian), "eu" (Basque), "fa" (Persian), "fi" (Finnish), "fr" (French), "fr-CA" (French: Canada), "gl" (Galician), "gu" (Gujarati), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy" (Armenian), "in" (Indonesian), "is" (Icelandic), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka" (Georgian), "kk" (Kazakh), "km" (Khmer), "kn" (Kannada), "ko" (Korean), "ky" (Kyrgyz), "lo" (Lao), "lt" (Lithuanian), "lv" (Latvian), "mk" (Macedonian), "ml" (Malayalam), "mn" (Mongolian), "mr" (Marathi), "ms" (Malay), "my" (Burmese), "nb" (Norwegian Bokm?l), "ne" (Nepali), "nl" (Dutch), "pa" (Punjabi), "pl" (Polish), "pt-BR" (Portuguese: Brazil), "pt-PT" (Portuguese: Portugal), "ro" (Romanian), "ru" (Russian), "si" (Sinhala), "sk" (Slovak), "sl" (Slovenian), "sq" (Albanian), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "ta" (Tamil), "te" (Telugu), "th" (Thai), "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "ur" (Urdu), "uz" (Uzbek), "vi" (Vietnamese), "zh-CN" (Chinese: China), "zh-HK" (Chinese: Hong Kong SAR China), "zh-TW" (Chinese: Taiwan), "zu" (Zulu)

I was gettign this error after running build with apache cordova for visual studio : Severity Code
Severity Code Description Project File Line Suppression State
Error C:\Cordova\SpaceRiddle\SpaceRiddle\platforms\android\res\values\strings.xml:3: Error: "app_name" is not translated in "af" (Afrikaans), "am" (Amharic), "ar" (Arabic), "az" (Azerbaijani), "be" (Belarusian), "bg" (Bulgarian), "bn" (Bengali), "bs" (Bosnian), "ca" (Catalan), "cs" (Czech), "da" (Danish), "de" (German), "el" (Greek), "es" (Spanish), "es-US" (Spanish: United States), "et" (Estonian), "eu" (Basque), "fa" (Persian), "fi" (Finnish), "fr" (French), "fr-CA" (French: Canada), "gl" (Galician), "gu" (Gujarati), "hi" (Hindi), "hr" (Croatian), "hu" (Hungarian), "hy" (Armenian), "in" (Indonesian), "is" (Icelandic), "it" (Italian), "iw" (Hebrew), "ja" (Japanese), "ka" (Georgian), "kk" (Kazakh), "km" (Khmer), "kn" (Kannada), "ko" (Korean), "ky" (Kyrgyz), "lo" (Lao), "lt" (Lithuanian), "lv" (Latvian), "mk" (Macedonian), "ml" (Malayalam), "mn" (Mongolian), "mr" (Marathi), "ms" (Malay), "my" (Burmese), "nb" (Norwegian Bokm?l), "ne" (Nepali), "nl" (Dutch), "pa" (Punjabi), "pl" (Polish), "pt-BR" (Portuguese: Brazil), "pt-PT" (Portuguese: Portugal), "ro" (Romanian), "ru" (Russian), "si" (Sinhala), "sk" (Slovak), "sl" (Slovenian), "sq" (Albanian), "sr" (Serbian), "sv" (Swedish), "sw" (Swahili), "ta" (Tamil), "te" (Telugu), "th" (Thai), "tl" (Tagalog), "tr" (Turkish), "uk" (Ukrainian), "ur" (Urdu), "uz" (Uzbek), "vi" (Vietnamese), "zh-CN" (Chinese: China), "zh-HK" (Chinese: Hong Kong SAR China), "zh-TW" (Chinese: Taiwan), "zu" (Zulu) [MissingTranslation] SpaceRiddle 1



In order to resolve this error I had to update problem file : C:\Cordova\SpaceRiddle\SpaceRiddle\platforms\android\res\values\strings.xml 
with adding translatable="false" so final file looks like :

<?xml version='1.0' encoding='utf-8'?>
<resources>
    <string name="app_name" translatable="false">SpaceRiddle</string>
    <string name="launcher_name" translatable="false">@string/app_name</string>
    <string name="activity_name" translatable="false">@string/launcher_name</string>
</resources>

Monday

Configuring Web for ASP.NET 4.5 failed .

To resolve error:
Configuring Web for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly.”

I manually created pool for with 4.5, in order to create it I had to do following:
Because there is no v4.5 shown in the gui, and typically you don't need to manually specify v4.5 since it's an in-place update. However, you can set it explicitly with appcmd like this:
appcmd set apppool /apppool.name: [App Pool Name] /managedRuntimeVersion:v4.5
Appcmd is located in %windir%\System32\inetsrv. 
This helped me to fix an issue with Web Deploy, where it was throwing an ERROR_APPPOOL_VERSION_MISMATCH error after upgrading from v4.0 to v4.5



test smtp server with powershell

Send-MailMessage -SMTPServer smtp.domain.com -To [email protected] -From [email protected] -Subject "This is a test email" -Body ...