Monday, June 15, 2015
Long sentence
http://yarchive.net/blog/long_sentences.html
Long sentence =>
complicated sentence =>
- Need to remember context
- Not to extend and repeat previsoue idea
Thursday, June 11, 2015
Binary tree search logic in pseudo code
node search (node, key) {
if node is null then return null;
if node.key = key then
return node
if key < node then
return search (node.left, key);
else
return search (node.right, key);
Reference:
http://www.codeproject.com/Articles/18976/A-simple-Binary-Search-Tree-written-in-C
if node is null then return null;
if node.key = key then
return node
if key < node then
return search (node.left, key);
else
return search (node.right, key);
Reference:
http://www.codeproject.com/Articles/18976/A-simple-Binary-Search-Tree-written-in-C
Wednesday, June 10, 2015
How to solve problem "Inheritance security rules violated by type: 'System.Web.WebPages.Razor.WebPageRazorHost'. Derived types must either match the security accessibility of the base type or be less accessible."
How to solve problem "Inheritance security rules violated by type: 'System.Web.WebPages.Razor.WebPageRazorHost'. Derived types must either match the security accessibility of the base type or be less accessible."
This error happens after add Razor engine into ASP.NET MVC 4 project by nuget package.
https://github.com/Antaris/RazorEngine
I fixed this problem by remove following part from web.config
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
Reason:
Default ASP.NET MVC 4 razor engine is version 2, and nuget for RazorEngine project is version 3.
This error happens after add Razor engine into ASP.NET MVC 4 project by nuget package.
https://github.com/Antaris/RazorEngine
I fixed this problem by remove following part from web.config
<dependentAssembly>
<assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
Reason:
Default ASP.NET MVC 4 razor engine is version 2, and nuget for RazorEngine project is version 3.
Tuesday, June 9, 2015
Monday, June 8, 2015
Make hard coding your default choice
http://enterprisecraftsmanship.com/2015/06/08/make-hard-coding-your-default-choice/
To my experiences, I divide this kind of "magic number" into three categories:
#1 Very small chance to change: Hard coding
#2 Good chance to change in the future:
Hard coding with default value but checking config file first
string ConfigSetting_SMTP_host = ConfigurationManager.AppSettings["SMTP_host"] ?? "google.com";
#3 For sure change (such as dev vs product environment): read from config file directly
To my experiences, I divide this kind of "magic number" into three categories:
#1 Very small chance to change: Hard coding
#2 Good chance to change in the future:
Hard coding with default value but checking config file first
string ConfigSetting_SMTP_host = ConfigurationManager.AppSettings["SMTP_host"] ?? "google.com";
#3 For sure change (such as dev vs product environment): read from config file directly
Tuesday, June 2, 2015
How to solve Access is denied problem for a ASP.NET MVC 4 Windows Authentication project
Create a ASP.NET MVC 4 intranet project, and run, get following error:
Access is denied
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you
supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.
Solution:
Press F4 to get project property windows:
Change Anonymous to Disabled
Change Windows Authentication to Enabled.
(Why just publish a correct project template for Windows Authentication in the first place?)
Subscribe to:
Posts (Atom)