Friday, May 22, 2015

How to solve problem: System.IO.FileLoadException was unhandled by user code HResult=-2146234304?

Solution:
Make sure you get latest version WebGrease 1.6

Full error message:
System.IO.FileLoadException was unhandled by user code   HResult=-2146234304
  Message=Could not load file or assembly 'WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
  Source=System.Web.Optimization
  FileName=WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
  FusionLog==== Pre-bind state information ===
LOG: DisplayName = WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35
 (Fully-specified)



Reference:
Install-Package Microsoft.AspNet.Web.Optimization
Update-Package WebGrease
Uninstall-Package Microsoft.AspNet.Web.Optimization
Uninstall-Package WebGrease
Install-Package Microsoft.AspNet.Web.Optimization
Update-Package WebGrease
http://forums.asp.net/t/1939632.aspx?cannot+load+webgrease+due+to+mismatched+manifest

Wednesday, May 20, 2015

How to fix ASP.NET MVC Bundle not working (not rendering script files)

To my case, it is because System.Web.Optimization  is version 1.0.0
After getting the latest version (1.3), everything is fine

How to fix "The target GatherAllFilesToPublish does not exist"

By adding following section into Project file:

<Target Name="GatherAllFilesToPublish">
</Target>



Wednesday, May 13, 2015

How to apply i18n to support multiple languages in ASP.NET MVC?


For ASP.NET MVC part: Functions to switch language and get resource by culture:
http://www.codeproject.com/Articles/262917/i-n-globalization-with-gettext-and-asp-net-mvc
javascript -> cookie -> Base Controller/Razor view base page -> i18n lib functions

http://gnuwin32.sourceforge.net/packages/gettext.htm

How to edit PO files
#1 Online editor: edit, add, and delete etc.
https://localise.biz/free/poeditor
#2 Local open source app
http://sourceforge.net/projects/betterpoeditor/

Monday, May 11, 2015

C# Safe Navigation Operator ?.

Read code to understand:

var g1 = parent?.child?.child?.child;
if (g1 != null) // TODO


http://blogs.msdn.com/b/jerrynixon/archive/2014/02/26/at-last-c-is-getting-sometimes-called-the-safe-navigation-operator.aspx

Wednesday, May 6, 2015

How to solve problem "The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at"

To my case:
The password is wrong.

var client = new SmtpClient("smtp.gmail.com", 587)
            {
                Credentials = new NetworkCredential("myusername@gmail.com", "mypwd"),
                EnableSsl = true
            };
            client.Send("myusername@gmail.com", "myusername@gmail.com", "test", "testbody");

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required. Learn more at

Friday, May 1, 2015

SQLBolt, interactive lessons to learn SQL in browser

http://sqlbolt.com/
Welcome to SQLBolt, a series of interactive lessons and exercises designed to help you quickly learn SQL right in your browser