วันเสาร์ที่ 29 มิถุนายน พ.ศ. 2556

Create Private VPN with OpenVPN and Windows AZure (Ubuntu) or AWS EC 2 (Ubuntu)

(This Begin part for Azure or AWS EC2 is same the different is between connect with putty)
Azure use Username and password.
AWS EC2 need private key to connected.

After first part start your server is same on both 

Check version Ubuntu for 32 bit or 64 bit
uname -a

Download OpenVPN (Depend on your system is 32 or 64 bit u can check last software version at openvpn.org)
wget -c http://swupdate.openvpn.org/as/openvpn-as-1.8.5-Ubuntu12.amd_64.deb

Install OpenVPN
sudo dpkg -i openvpn-as-1.8.5-Ubuntu12.amd_64.deb

Change openvpn password for safety
sudo passwd openvpn


Command Add User
sudo adduser [username]

Command Update & Upgrade Ubuntu
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

วันพฤหัสบดีที่ 27 มิถุนายน พ.ศ. 2556

Install YAF (Yet Another .NET Forum) in subfolder of MVC

You will got error from the start but with this step will make you pass.
1. add <remove namespace="..."/> in yaf  web.config line 72 for not conflict with MVC
            <namespaces>
                <remove namespace="System.Web.Mvc.Html"/>
                <remove namespace="System.Web.Mvc"/>
                <remove namespace="System.Web.Optimization"/>
                <remove namespace="System.Web.Mvc.Ajax"/>
                <remove namespace="System.Web.Helpers"/>
                <add namespace="YAF.Core"/>
                <add namespace="YAF.Controls"/>
                <add namespace="YAF.Utils"/>
                <add namespace="YAF.Types.Interfaces"/>
                <add namespace="YAF.Types"/>
            </namespaces>
2. Go to folder u can install normally now.

วันจันทร์ที่ 10 มิถุนายน พ.ศ. 2556

EPPlus Format cell as text.

I need to type like 08x-xxx-xxxx but can't because General format will convert text to number and will be 8x-xxx-xxxx that not fit requirement.

fix this by
worksheet.Cells["A1"].Style.NumberFormat.Format="@"

this command will convert cell to Text Style.

วันพุธที่ 5 มิถุนายน พ.ศ. 2556

Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.MissingMethodException: Method not found: 'Void System.Data.Objects.ObjectContextOptions.set_UseConsistentNullReferenceBehavior(Boolean)'.



[InvalidOperationException: The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588]
   Mot_Inspector_Report.Filters.SimpleMembershipInitializer..ctor() +260
 
This error can happen when u try to publish .NET MVC (asp.net 4.00)
because u use Entity Framework 5 with .NET 4.0 instead of 4.5   

simple to fix this is uninstall Entity Framework 5 and re Install it.

use library package manager to do this

and after that may be u found this because u update plugin with "library package manager"

The "EnsureBindingRedirects" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Roxel.BuildTasks.EnsureBindingRedirects.MergeBindingRedirectsFromElements(IEnumerable`1 dependentAssemblies)
   at Roxel.BuildTasks.EnsureBindingRedirects.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()    Mot_Inspector_Report