Latest comments
In response to: Powershell for Visual Studio
internet bingo [Visitor] · http://www.mallbingo.com/category/uncategorized
Fastidious response in return of this query with solid arguments
and explaining everything regarding that.
and explaining everything regarding that.
In response to: How to make an HTTP proxy
Test von toaster [Visitor] · http://www.toaster-test.eu/
Asking questions are truly good thing if you are not understanding something entirely, but this
piece of writing provides pleasant understanding even.
piece of writing provides pleasant understanding even.
In response to: Powershell for Visual Studio
site [Visitor] · http://bingo-halls-directory.com
Unknown: "Talent does what it can genius does what it must."
In response to: Php for Visual Studio (Php4VS)
internet banking [Visitor] · http://www.cetnv.com/citizens-bank-online
Wow, that’s what I was exploring for, what a data!
existing here at this website, thanks admin of this web site.
existing here at this website, thanks admin of this web site.
In response to: Powershell for Visual Studio
Dirt Bike Games [Visitor] · http://www.airplaynetwork.com
Thank you a lot for sharing this with all of us you really recognise what you're talking approximately! Bookmarked. Please also talk over with my site =). We could have a hyperlink exchange agreement between us
In response to: Powershell for Visual Studio
mission tx apartments [Visitor] · http://www.rentrgv.com
Awesome post! I'll be checking back for other great reads!
In response to: Asynchronous EUSS !
Nicolas Penin [Member] · http://dragon-angel.fr
You can have it on http://euss.codeplex.com
In response to: Asynchronous EUSS !
springmin [Visitor]
Where have EUSS Last Source ? please Send the SVN Address me . I will Join the project
In response to: How to improve your intranet ASP.NET web application performance ?
Nicolas Penin [Member] · http://dragon-angel.fr
Hi Bertrand,
I was actually thinking about an intranet which needs authentication from the very first page. For example, I am making an intranet portal for a client, and I need to know who this person is to give him/her his/her own information. So I have no other way to make it specific to axd handlers... or I don't know it. ;)
I was actually thinking about an intranet which needs authentication from the very first page. For example, I am making an intranet portal for a client, and I need to know who this person is to give him/her his/her own information. So I have no other way to make it specific to axd handlers... or I don't know it. ;)
In response to: How to improve your intranet ASP.NET web application performance ?
Bertrand Le Roy [Visitor] · http://weblogs.asp.net/bleroy
The .axd handlers are probably not the only files you should take out of the authentication, so a good practice may be to not protect the root of the application but only a subdirectory of it. That gives you full latitude of deciding what goes through authentication or not with minimum effort. And you don't have to special case the axd.
In response to: Bonjour and DNS .NET implementation
brian dunnington [Visitor] · http://www.growlforwindows.com
first, let me thank you for the great project - it is just what i was looking for.
after struggling with bugs trying to P/Invoke the dnssd.dll (Apple's Bonjour), i decided i needed to change course. your library is just the ticket and was easy to implement.
the only question i have so far is how to actively unpublish a server. i set up my Service and call .Publish() when my app starts, and when the app shuts down, i call .Stop(). but in another apps that uses your library as a BonjourServiceBrowser, the ServiceRemoved event is never fired, so the browsing app still things the service is availalbe after it shuts down. got any advice?
after struggling with bugs trying to P/Invoke the dnssd.dll (Apple's Bonjour), i decided i needed to change course. your library is just the ticket and was easy to implement.
the only question i have so far is how to actively unpublish a server. i set up my Service and call .Publish() when my app starts, and when the app shuts down, i call .Stop(). but in another apps that uses your library as a BonjourServiceBrowser, the ServiceRemoved event is never fired, so the browsing app still things the service is availalbe after it shuts down. got any advice?
In response to: Reusable singleton in ASP.NET Context
Bjarte Skogøy [Visitor] · http://pan.mylabora.com/bjarte
A good and straight forward solution!
In response to: Generic Visitor Implementation thanks to C# 3.0
Trent Kerin [Visitor]
OK, so if the visitable objects are going to implement their own Accept methods, then it seems the extension method Accept doesn't serve any purpose. Correct?
If so: Your post doesn't currently implement the visitor pattern. To change it so it does implement the visitor pattern would obsolete the extension method Accept, and thereby remove C# 3.0 features.
It seems like your post needs to be edited so that inexperienced readers don't get misled into thinking they can do something which they actually can't. Equally bad, an inexperienced reader might become confused about what the visitor pattern is actually for. I highly recommend a concrete example, rather than just a snippet of code and some optimistic words.
Barring some amazing discovery, the most reasonable implementation of the visitor pattern has remained unchanged since C# 1.0. Following is a post that shows some real progress on the visitor, in C# 4.0:
http://www.paulbatum.com/2008/11/no-visitors.html
If so: Your post doesn't currently implement the visitor pattern. To change it so it does implement the visitor pattern would obsolete the extension method Accept, and thereby remove C# 3.0 features.
It seems like your post needs to be edited so that inexperienced readers don't get misled into thinking they can do something which they actually can't. Equally bad, an inexperienced reader might become confused about what the visitor pattern is actually for. I highly recommend a concrete example, rather than just a snippet of code and some optimistic words.
Barring some amazing discovery, the most reasonable implementation of the visitor pattern has remained unchanged since C# 1.0. Following is a post that shows some real progress on the visitor, in C# 4.0:
http://www.paulbatum.com/2008/11/no-visitors.html
In response to: Generic Visitor Implementation thanks to C# 3.0
Nicolas Penin [Member] · http://dragon-angel.fr
Hello,
You're entirely right. What I forgot, is that I used this visitor system for a Linq provider which has to deal with an ExpressionType which is an enum. What you could do is implementing an IVisitable interface on your subclasses. Thus, you would have the Accept method implemented directly in your class. An implemented method having a higher priority than an extension method it should work. But I agree with you, the best thing would be to have type inference working directly...
You're entirely right. What I forgot, is that I used this visitor system for a Linq provider which has to deal with an ExpressionType which is an enum. What you could do is implementing an IVisitable interface on your subclasses. Thus, you would have the Accept method implemented directly in your class. An implemented method having a higher priority than an extension method it should work. But I agree with you, the best thing would be to have type inference working directly...
In response to: Generic Visitor Implementation thanks to C# 3.0
Trent Kerin [Visitor]
Hi Nicolas
Thanks for the quick reply. I've still got a few issues:
1) Sorry, the extension method I implemented was actually generic, but the comment system stripped the generic T,V parameters from the Accept method. Could you point out exactly what I'd need to change in my code above to make it an appropriate concrete example of the functionality your post is describing?
2) Type inference is only helpful when we're passing an argument cast to its most-specific runtime type. The visitor pattern is for the situation where our argument is cast as a base-type, and we want to deal with it as its specific type (without having some if-then-else or switch block).
3) I'm not sure how polymorphism helps either. Extension methods are static and static methods can't be polymorphic since you call them on the declaring type (or via some syntactic sugar in the case of extension methods). So which other thing are you saying is being dealt with polymorphically? The visitable object? The visitor?
-Trent
Thanks for the quick reply. I've still got a few issues:
1) Sorry, the extension method I implemented was actually generic, but the comment system stripped the generic T,V parameters from the Accept method. Could you point out exactly what I'd need to change in my code above to make it an appropriate concrete example of the functionality your post is describing?
2) Type inference is only helpful when we're passing an argument cast to its most-specific runtime type. The visitor pattern is for the situation where our argument is cast as a base-type, and we want to deal with it as its specific type (without having some if-then-else or switch block).
3) I'm not sure how polymorphism helps either. Extension methods are static and static methods can't be polymorphic since you call them on the declaring type (or via some syntactic sugar in the case of extension methods). So which other thing are you saying is being dealt with polymorphically? The visitable object? The visitor?
-Trent
In response to: Generic Visitor Implementation thanks to C# 3.0
Nicolas Penin [Member] · http://dragon-angel.fr
Hello Trent,
thanks for paying attention to my post. What you missed is the IVisitor which says : "I can visit this type", therefore, the choose of the right method is made thanks to type inference and polymorphism. You need this Accept method to be generic and your visitor to have all implementations for each Visit(T item) you need (even the subclasses).
Hope this helps.
Nicolas
thanks for paying attention to my post. What you missed is the IVisitor which says : "I can visit this type", therefore, the choose of the right method is made thanks to type inference and polymorphism. You need this Accept method to be generic and your visitor to have all implementations for each Visit(T item) you need (even the subclasses).
Hope this helps.
Nicolas
In response to: Generic Visitor Implementation thanks to C# 3.0
Trent Kerin [Visitor]
Hi there
I'm not entirely sure how the generic visitor works.
As I understand it, the visitor pattern is used when code needs to behave differently based on the specific type of a method argument, but only the base type is known at compile time.
If the compiler is able to use type inference to determine the specific type of an argument and call the appropriately-typed generic extension method then the programmer also knows it and therefore doesn't need the visitor pattern.
If the compiler only knows the base type, then so will the extension method, and it will only call the base type version of the Visit method, and the visitor has failed.
I made a quick implementation of the above and found my concerns verified, but it's entirely possible I screwed something up. Could you please correct my code below if that's the case; it'd be great to have a generic visitor :>
To use the visitor:
And here's the visitor code itself:
Thoughts?
-Trent
I'm not entirely sure how the generic visitor works.
As I understand it, the visitor pattern is used when code needs to behave differently based on the specific type of a method argument, but only the base type is known at compile time.
If the compiler is able to use type inference to determine the specific type of an argument and call the appropriately-typed generic extension method then the programmer also knows it and therefore doesn't need the visitor pattern.
If the compiler only knows the base type, then so will the extension method, and it will only call the base type version of the Visit method, and the visitor has failed.
I made a quick implementation of the above and found my concerns verified, but it's entirely possible I screwed something up. Could you please correct my code below if that's the case; it'd be great to have a generic visitor :>
To use the visitor:
SomeVisitor visitor = new SomeVisitor();
SomeBaseClass visitable = new SubClassOne();
visitable.Accept(visitor);
And here's the visitor code itself:
public class SomeBaseClass
{
}
public class SubClassOne : SomeBaseClass
{
}
public static class ExtensionClass
{
public static void Accept(this T visitable, V visitor)
where V : IVisitor
{
visitor.Visit(visitable);
}
}
public class SomeVisitor : IVisitor
{
public void Visit(SomeBaseClass visitable)
{
throw new Exception("The visitor didn't work!");
}
public void Visit(SubClassOne visitable)
{
throw new Exception("The visitor did work. Hooray!");
}
}
public interface IVisitor
{
void Visit(T visitable);
}
Thoughts?
-Trent
In response to: Generic Visitor Implementation thanks to C# 3.0
Nicolas Penin [Member] · http://dragon-angel.fr
Hello,
Because I did not know this web site ;)
Will do it as soon as I have time.
Thanks for the idea
Nicolas
Because I did not know this web site ;)
Will do it as soon as I have time.
Thanks for the idea
Nicolas
In response to: Generic Visitor Implementation thanks to C# 3.0
Jonathan [Visitor] · http://www.jonathancrossland.com
Hi
Nice idea.
Why not add it to http://www.extensionmethod.net/
Best Wishes
Jonathan
Nice idea.
Why not add it to http://www.extensionmethod.net/
Best Wishes
Jonathan
In response to: Bonjour and DNS .NET implementation
Thomas Salvisberg [Visitor]
Thank you a thousand times!
I've been looking for this for some time and knew that I don't have the brains to implement it myself.. ;)
I've been looking for this for some time and knew that I don't have the brains to implement it myself.. ;)