Η MyWeb είναι επίσημος καταχωριστής ονομάτων .gr και σας προσφέρει την καταχώρηση του δικού σας .gr ονόματος με 
19 Ευρώ για 2 χρόνια


50 Mb χώρος
3 λογαριασμοί email,Web Mail, Στατιστικά, Access, MySQL, PHP, ASP,
ASP.NET 1.0,2.0,3.0,3.5 & 4.0

25 Ευρώ το χρόνο
Πέμπτη, 23 Φεβρουαρίου 2012

 

There has a been a lot of talking on a possible “big design flaw” in ASP.NET MVC: partial view path resolution was not cached and so a big performance issue. It all started with Rudi Benkovic’s presentation on ASP.NET MVC performances.

I also wrote a commentary on his presentation, but I was a bit skeptical about the fact that view path resolution was faster with a full url than with just the name of the view. I said:

This last one looks strange to me because the RenderPartial method should be caching the path resolution: maybe it’s a bug, or the test was performed with a pre-release version that didn’t cache the result.

But I didn’t have time to really test the behavior.

Then today another post came out: ASP.NET MVC: Hidden Performance Problem with HtmlHelper.RenderPartial functions.

He says that for each view rendered, all the search path are probed and, in order to understand whether a file exists or not, they throw an exception. This sounds silly to me, so this evening I decided to try it myself.

And I found the way to improve the performances without adding another layer of cache as someone was already planning to. Just don’t run in debug mode:

		<compilation debug="false">

Yes, it’s that simple.

Since ASP.NET MVC source code is public (actually it’s OpenSource) I had a look at it. And I found out the following line:

		protected VirtualPathProviderViewEngine() {
    if (HttpContext.Current == null || HttpContext.Current.IsDebuggingEnabled) {
        ViewLocationCache = DefaultViewLocationCache.Null;
    }
    else {
        ViewLocationCache = new DefaultViewLocationCache();
    }
}

This says: if you are in debug mode (or are not in a web environment, like in tests), don’t cache. Otherwise use the cache.

I also went a bit on, and added some logging inside the view path resolution, in order to run it in release mode and see with my eyes that the cache was being used. The code that follows is the GetPath method inside the VirtualPathProviderViewEngine.cs file (code truncated to enhance readability):

		private string GetPath( /* truncated */) {

     /* truncated */

      if (useCache) {
        string result = ViewLocationCache.GetViewLocation(
                                          controllerContext.HttpContext, cacheKey);
        if (result != null) {
            controllerContext.HttpContext.Response.Write(
                      String.Format("{0} lookup returned {1}\r\n", name, result));
            return result;
        }
    }

    controllerContext.HttpContext.Response.Write(
                String.Format("{0} lookup no cache\r\n", name));
    return (nameRepresentsPath) ?
        GetPathFromSpecificName(/* truncated */) :
        GetPathFromGeneralName(/* truncated */);
}

If you run in debug mode you will always see, when calling the RenderPartial on the LogOnUserControl, “LogOnUserControl lookup no cache”. But if you run it in release mode, you will get the no cache message the first time you run it, and later you’ll get “LogOnUserControl lookup returned ~/Views/Shared/LogOnUserControl.ascx”.

So, problem solved, no “big error” inside ASP.NET MVC 1.0, just someone that forgot the set the debug flag to false when doing its performance testing. And innocently spread the panic around that.

Actually finding that they decided to use no cache in debug mode was difficult to discover without looking at the code, but when you do tests, especially performance test, remember to run in release mode.

There are also other reasons why you don’t want to run production or performance testing code in debug mode. Read what Tess has to say about that: ASP.NET Memory: If your application is in production… then why is debug=true

 
Πέμπτη, 23 Φεβρουαρίου 2012

 

Alexa Alternatives PostI never really took Alexa very seriously because of how easily alexa ratings are skewed depending on the type of website you have.  It can be an indicator of what type of traffic you attract, but not necessarily an indicator that you attract a lot of traffic.

You may have a website that doesn't attract a user base that would typically have the Alexa toolbar installed. In theory, you could have a relatively decent traffic volume, but show an alexa rating around 3 million.  The lower your Alexa rating, the better your score (kinda like golf).  On one of my first eCommerce websites, I had a pretty decent Alexa rating which suggested to me that many of my shoppers had the alexa toolbar installed in their browsers.  I found that quite interesting.  With that said, my alexa rating on my AmazingCloaker site is a modest 466,617 as of the time of this writing.  AmazingCloaker.com is about 11 months old.  My handbag webstore was less than 3 months old when it's alexa rating was around 96,500.  Hmmm.  

JohnGo wrote an interesting blog post which details his findings with several other alexa alternatives.  The alexa alternative that I personally am most familiar with is Compete. As Richard points out, they claim to use an actual scientific formula.  With a combination of ISP logs, Toolbars, ASPs and Opt-in panels, they claim much more accurate results as opposed to Alexa which only uses data from the Alexa tool bar.

Alexa by comparison would give me skewed traffic results on my eCommerce site vs. my AmazingCloaker site.  If both averaged 1000 visitors a day, for example, and 600 of the eCommerce visitors had the Alexa toolbar, but only 200 visitors to my URL Cloaking website had the toolbar, then the Alexa rating would be vastly different even though the hits per day were the same.

Surprisingly enough, however, as your Alexa rating reaches the upper percentages (say 45,000 & below) your accuracy is also increased.  Because of the shear numbers of visitors, the ratio of tool-bared visitors will equal out to more accurate results regarding superior traffic over say a site with a 100k+ Alexa rating.  I believe that this "ratio factor" in high volume is what ultimately equals it out.  Alexa & Compete are the two that I pay most attention to.  I would agree that overall they offer the best indicators of how you are doing in the traffic scene.  I also have the Google page rank indicator installed on my Firefox browser which I like to monitor as well.  

I think that checking out alternatives in anything is normally a good thing, but for now I think that I will just stick with Alexa & Compete.  

 

How To Increase Alexa Rank

Alexa Rank is measured by the level of traffic your web site receives from the number of people who visit with the Alexa toolbar installed. It is important for you to increase your Alexa rank because advertisers and advertising services like Text Link Ads and ReviewMe use your site’s Alexa rank as a way to determine the worth of a link on your web site.

You can sell links on your site at a high price if you have a high Alexa Rank, so it is important to increase your Alexa Rank.

 

Around June last year I placed the Alexa Traffic Rank Button on this site and my Alexa Rank continually increased from around 90,000 to 20,000 until I removed the Alexa Traffic Rank Button after a redesign.

Only recently I noticed that my Alexa rank was decreasing slowly (around 26,000) and I decided to try out some of the tips suggested on Dosh Dosh.

I just tried two out of the 20 tips provided and my Alexa Rank has improved slowly from around 26,000 to 25,576 in about 2 weeks.

Alexa Graph

The two things I tried to improve my Alexa Ranking were:

  • Install the Alexa toolbar or Firefox’s SearchStatus extension
  • Put up an Alexa rank widget on your website
 
Πέμπτη, 23 Φεβρουαρίου 2012

An experimental project to create ASP.NET MVC webform view pages to Razor view pages.

This project is no longer developed. I conceived this project to meet the needs of developers that need to convert webform to razor. Since then, an independent software vendor, Telerik, has released a version of aspx2Razor converter. So I would rather focus my limited sparetime on something else that meet the need of the community. 

The following is the old project description:

This project is still in early stage and thus does not have any binary release. You might download the source code. You need VS2010 to compile it.

Usage:

Aspx2Razor path

where path is file path or directory path

 
Πέμπτη, 23 Φεβρουαρίου 2012

 

var grouped = (from p in posts 
  group p by new { month = p.Create.Month,year= p.Create.Year } into d 
  select new { dt = string.Format("{0}/{1}",d.Key.month,d.Key.year), count = d.Count()}).OrderByDescending (g => g.dt)

source: http://stackoverflow.com/questions/762899/linq-group-by-month-and-year-within-a-datetime-field

 

 

 

 
Πέμπτη, 23 Φεβρουαρίου 2012

 

  • Get HTML syntax coloring with Tools/Options/Text Editor/File Extension, then add ‘cshtml’ with the ‘HTML Editor’. Found this here.
  • Get jQuery Intellisense by adding this to a page (inferred from this post):
    @if(false)
    {
       
 
Πέμπτη, 23 Φεβρουαρίου 2012

 

http://msdn.microsoft.com/en-us/data/ee712907

These videos demonstrate how to create applications using the new functionality in Entity Framework 4.1.

Building an MVC 3 App with Code First and Entity Framework 4.1

Building an MVC 3 App with 
Code First and Entity Framework 4.1

(Level: 200-300; 11:03)

 

Building an MVC 3 App with Database First and Entity Framework 4.1

Building an MVC 3 App with 
Database First and Entity Framework 4.1

(Level: 200-300; 9:40)

 

Building an MVC 3 App with Model First and Entity Framework 4.1

Building an MVC 3 App with 
Model First and Entity Framework 4.1