Sunday, September 19, 2010

How To Fix A Jammed Dvd In Town & Country

Basic configurations - configuration files in Asp.net MVC

Today I want to show resolve the problem with the way the storage of basic information about the forum, eg, name, keywords.

While I was thinking the easiest solution is simply the idea of \u200b\u200bstoring it in a database. After deep thoughts stated that for basic information does not make sense also tie a database so I decided to use the configuration files that are not available on the platform. Given that, and so they are used when creating the site so it does not cause any zwieszonego burden of reading the data.

configuration files
As most of you know the configuration files are divided into sections. At the beginning create a forum for our basic sections which will hold the simplest information. It looks like this:
 \u0026lt;mForum Sitetitle = "mForum" 
MetaKeywords = "Forum, Board, Project,. Net
MetaDescription =" mForum is going to be Fully Implemented forum featured in C # on. NET platform "
MinPasswordLength = "5">
\u0026lt;/ mForum>
But not too much so I decided to mix configurations on the board to move to a separate configuration file. To our team knew about the main web.configu need to insert this line:
 \u0026lt;mForum configSource = "mForum.config" /> 

Settings
Class This class will store information about all the board settings. Nothing special in this class. Variables and objects that will contain data from the configuration file.
 public class Settings {

public Settings (Sitetitle string, string metaKeywords, metaDescription string, int minPasswordLength)
{
Check.Argument.IsNotEmpty (Sitetitle, "Sitetitle");
Check.Argument.IsNotEmpty (metaKeywords, "metaKeywords ");
Check.Argument.IsNotEmpty (metaDescription," metaDescription ");
Check.Argument.IsNotNull (minPasswordLength, "minPasswordLength");
Check.Argument.IsNotNegativeOrZero (minPasswordLength, "minPasswordLength");

Sitetitle = Sitetitle;
MetaKeywords = metaKeywords;
MetaDescription = metaDescription;
} public string

Sitetitle

{get;
internal set;}


...

}
Class SettingsConfigurationSection
Here we have the facility to be used in direct pulling data from configuration files. Data from the section are binded to this object. The object itself inherits from the class ConfigurationSection. It looks like this: public class
 SettingsConfigurationSection: ConfigurationSection 
{private static string
_sectionName = "mForum"

public static string SectionName
{
[DebuggerStepThrough]

get {return
_sectionName;
}

[DebuggerStepThrough]
set {
Check.Argument.IsNotEmpty
(value, "value");

_sectionName = value;}

}


[ConfigurationProperty (Sitetitle ", DefaultValue = "mForum")]
public string SiteTitle
{
[DebuggerStepThrough]
get
{
return (string)this["SiteTitle"];
}

[DebuggerStepThrough]
set
{
this["SiteTitle"] = value;
}
}

[ConfigurationProperty("MetaKeywords", DefaultValue = "")]
public string MetaKeywords
{
[DebuggerStepThrough]
get
{
return (string)this["MetaKeywords"];
}

[DebuggerStepThrough]
set

{this ["MetaKeywords"] = value;}

}

...
}
It consists of static variables that directly pull data from the section. In addition, there is one variable that is set on a permanent basis. This is the section name. Initializing Settings
class takes place during the registration IoC container as all other objects. There is nothing complicated. Feel free to source the exact implementation.

Thursday, September 16, 2010

Using Wood Boiler To Supplement Oil Burner

Reloaded HipHopRandki.pl

From August on the site hiphoprandki.pl ongoing modifications. Dating service in a climate of Hip Hop and gently went in the direction of social networking site. Introduced the 'Friends', where of course you can invite, search, delete, and most importantly, track your entries friends.

entries - that is totally a mini blog, a bit inspired by a Facebook Wall's, lets you post entries, thoughts, information and events on your profile. In addition, entries are visible in the panel at a friend.

was also totally changed the process of adding images, manage, and display. Limit has been changed, both the quantity and size of images - all of course in favor of the user:)

new algorithm and search interface, and the changing structure of a page and new graphics, the most noticeable changes naked eye. Besides

visible, naked and not naked eye, changes are also plenty of smaller, less noticeable, but significant in the comfort of use.

Is the key to success may be Web 2.0 and Features ajax'owe?
- so far, statistics indicate that

Monday, September 13, 2010

Gum Healing Extraction

communication between the services and controller ... Global

Hello today I would like to raise another problem which I encountered during the development of the project. The problem concerns the transmission of data between the controller and the services (service). Take a simple example. We have functions that the downloaded data from a user creates a topic and post on the forum then returns the id of both the subject and post. And here there is a problem when we need to ask a lot of data with the function of the service.

my thoughts when I decided to refer to the request and response mechanism, which is usually used in WCF services. We obviously do not use them but thanks to our project will be prepared for such an eventuality.

communication between the service and the controller
Communication between the service and the controller looks fairly straight. How might initially seem a mechanism that applies only needlessly obscures the code but as the project develops standardized communication will help to receive and develop the project. I distinguish two types of messages: Request (request) and Reply (response). Correspond to their appropriate types: BaseRequestMessage and BaseResponseMessage. Both types inherit from BaseMessage. Example request and response: public class
 LogOnRequest: BasicRequestMessage 
{public
LogOnDTO LogOnDTO {get; set;}}

And here we have the answer: Public class
 LogOnResponse: BasicResponseMessage 
{public bool
isValidated {get; set;}}


With this communication mechanism, and it looks pretty clearly and we are able to receive data from multiple services. Of course, the appropriate services and tests have modified to work with our new mechanism. But this I will not describe just invite you to browse the sources.

Thursday, September 9, 2010

Contraceptive Pill Microgynon 30 Diarrhea

filters and injecting dependencies ...

Hello today I would like a bit closer MvcExtensions global filters and one of the applications that will be with me in the system has by this mechanism.

simple problem: We easily be able to keep up information about the last time the user viewed the page or record made by his actions. When I first approached this problem came to me two solutions:
-First: Create BaseController from which all others inherit a method that will have to be carried out whenever execute a controller action.
-Second: Use filters to be imposed on the controller.

first solution seems quite fun but is at odds with the principle of the controller should not have in the logic. Moreover, it is difficult testable by such treatment. So I decided to take advantage of the second. As it turned out the problem associated with the attributes needed to inject dependencies is to perform a particular activity. PoszperaƂem a little bit and I found MvcExtension mechanism called global filters. By the way it is implemented in version 3 of the MVC framework.

UpdateUserLastActivityFilter
As I said before the first simple filter that I used is updating the last activity user. Same attribute is simple. If a user is logged on to the class calls the UserService that updates its activity. The attribute looks like this:
 [AttributeUsage (AttributeTargets.Method  
{get;
private set;}


public void OnResultExecuting (ResultExecutingContext filterContext)


{} public void

OnResultExecuted (ResultExecutedContext filterContext)
{
Check.Argument.IsNotNull (filterContext, "filterContext");

string username = filterContext.HttpContext.User.Identity.IsAuthenticated? filterContext.HttpContext.User.Identity.Name: null;

if (string.IsNullOrEmpty (username)) {

UserService.UpdateLastActivity (username);

}}}


We already have attribute now must find a way to inject UserService to this attribute. The library is defined MvcExtension special interface which helps us in this task. Called ConfigureFilterBase. We will implement it as Bootstrapper task. It looks like this: public class

RegisterGlobalFilters: ConfigureFiltersBase

{protected override void Configure (IFilterRegistry registry) {
registry.Register
\u0026lt;AccountController, UpdateUserLastActivityAttribute> ()
. \u0026lt;HomeController, UpdateUserLastActivityAttribute> Register ; ();}

}
As you can see records filters are similar to types in the IoC container. It looks like this that serve as the first type of the controller and another the following are the filters which attaches to it. Such a procedure enable injection of the necessary interfaces to the attributes. In addition, we no longer hand controller decorate this action.
 So much in terms of global filters. As you can see MvcExtension has many interesting solutions. Many of them will be available in future versions of Asp.net MVC.