06/06/09
jQuery Control Toolkit
Hello everyone,
It's been a long time since I posted something on my blog. I was a little busy with my work. But this work enables now me to introduce you a new codeplex project : jQuery Control Toolkit. The aim of the project is to be able to use jQuery trough extenders in ASP.NET, but more globally, it adds new functionalities as jQuery plugins. The project is not so detailed yet, but if you can't wait for a description of each functionality, just have a look at the source code, there is a web application project which uses each (main) functionality. There are also more functionalities in the javascript source file jQuery.ACT.js, but, it is not documented at all (yet).
Have fun,
2009-03-23
Powershell for Visual Studio
Hello,
Here is my new project : Powershell for Visual Studio. There is already syntax coloration, and basic intellisense (available cmdlets, with their help). Currently, it seems that the VS2008 SDK is needed to make it work. This will be solved in the next release...
Have fun !
Powershell for Visual Studio
2009-02-24
XNA Designer 0.1
Hello everyone,
I've updated my XNA codeplex project. Now, the designer works, is (more or less) beautiful. Moreover, you may also download a component library containing game components : cameras, model viewer, cube, stairs, wall, ...
You can have a look at this designer on the wiki home page of the project.
You want to try it by yourself, go to the release.
2009-02-07
Bonjour MEF
Hello everyone,
Do you know MEF (Managed Extensibility Framework) ? It is a new library in .NET that enables greater reuse of applications and components. Using MEF, .NET applications can make the shift from being statically compiled to dynamically composed. I let you go to codeplex to get more information.
MEF is based on catalogs. There are a DirectoryCatalog, an AssemblyCatalog, ... Well, I am proud to introduce you to a BonjourCatalog.
For this, still the same address : http://www.codeplex.com/zeroconf.
"What is the aim, you may ask ?" It simply enables to detect bonjour services using MEF.
I have not published any release regarding this BonjourCatalog yet, but it wont last.
01/14/09
Concrete Singleton pattern implementation in .NET
Hello everybody,
A pattern we regularly find is the singleton pattern. What I suggest you is a .NET implementation. This one deals with a singleton context dependent (singleton by ASP.NET context, by WCF context, by thread, for the whole application)
public class Singleton<T>
{
private Singleton()
{
if (CreatingInstance != null)
CreatingInstance(this, EventArgs.Empty);
}
private static T instance;
[ThreadStatic]
private static T threadInstance;
private static object instanceLock = new object();
public static T Instance
{
get
{
//ASP.NET case
T instance;
if (HttpContext.Current != null)
{
if (UseContextInstance)
instance = (T)HttpContext.Current.Items[typeof(T).AssemblyQualifiedName];
else
instance = (T)HttpContext.Current.Application[typeof(T).AssemblyQualifiedName];
if (instance == null)
{
instance = new Singleton<T>().SingletonInstance;
if (UseContextInstance)
HttpContext.Current.Items[typeof(T).AssemblyQualifiedName] = instance;
else
HttpContext.Current.Application[typeof(T).AssemblyQualifiedName] = instance;
}
return instance;
}
if (OperationContext.Current != null)
{
throw new NotImplementedException();
if (instance == null)
{
HttpContext.Current.Items[typeof(T).AssemblyQualifiedName] = new Singleton<T>().SingletonInstance;
}
return instance;
}
//In case of no HttpContext nor OperationContext
if (UseContextInstance)
{
if (Singleton<T>.threadInstance == null)
Singleton<T>.threadInstance = new Singleton<T>().SingletonInstance;
}
else
{
if (Singleton<T>.instance == null)
{
lock (instanceLock)
{
if (Singleton<T>.instance == null)
Singleton<T>.instance = new Singleton<T>().SingletonInstance;
if (Singleton<T>.instance == null)
TryActivate(out Singleton<T>.instance);
}
}
}
return Singleton<T>.instance;
}
}
private static void TryActivate(out T p)
{
try
{
p = Activator.CreateInstance<T>();
}
catch (MissingMethodException) { p = default(T); }
}
public T SingletonInstance { get; set; }
public static event EventHandler CreatingInstance;
/// <summary>
/// Set this property to <see cref="true" /> to have your singleton dependant on your context :
/// - one per thread in Windows Forms/WPF
/// - one per Context in ASP.NET
/// </summary>
public static bool UseContextInstance { get; set; }
}
2009-01-07
Last codeplex project address change
Hello,
I've changed my last codeplex project address. Why ? only because I'm adding this uPnP implementation, and is totally different from the bonjour protocol.
Here is the new address :
http://www.codeplex.com/zeroconf
See you
2009-01-02
Bonjour and DNS .NET implementation
Hello,
I've recently published on codeplex a partial object DNS protocol implementation and an implementation of Apple's Bonjour protocol. You may ask me why implement this DNS protocol whilst a .NET Dns class exists. First of all, because the Dns class is based on Win32 API, which, I don't want. Secondly, because my DNS implementation is mDNS (multicast DNS) compliant, and Bonjour relies on this protocol. At last, and not the least, for fun !
Let's stop talking and discover it...
Posts en français
Bonjour à tous,
Pour les anglophobes, ou ceux qui ne veulent pas se fatiguer à lire l'anglais, sachez qu'à partir de maintenant, vous pourrez consulter un blog en français à cette adresse : http://blog.dragon-angel.fr
28.09.08
Assemblies EmbeddedResources with .NET 3.5 SP1
Hello everyone,
It's been a long time since posting. I've just installed the new SP1 for VS2008, and .NET 3.5 SP1. Then, I've been struggling with assemblies and embedded resources. Before installing it, if I had an assymbly with the default namespace Products.Repositories, and a file named Domain.Mapping.xml, it used to generate a manifest with a name like that : Products.Repositories.Resources.Domain_mapping. Now, it generated a manifest with the following name : Products.Repositories.Domain.Mapping.xml. I personnally find it more logical since in it does not alter the file name or nor it adds a Resources in the namespace. But, it would have also been great to be aware of that change... Now, you are
2008-06-27
Generic Visitor Implementation thanks to C# 3.0
Hi,
I've finally achieve my dream : Having a generic visitor ! How did I do that, really simple : I used extension methods. I let you see the class you may understand better if I don't explain ![]()
public static class VisitorHelper { public static void Accept<T, V>(this T visitable, V visitor, VisitorContext context) where V : IVisitor<T> { visitor.Visit(visitable, context); } }
My main worry was to know if it would pass a unit test with inheritance matter, and it does !!! The visitor context is an abstract class which has some information needed for the visitor. It has nothing really important to do here.
[EDIT] After reading my previous post, you may have guessed that you can use this visitor without specifying type and using compiler type inference.
myObject.Accept(visitor,new MyVisitorContext());
06/02/08
Article on Tech Head Brothers
An article I've written has been posted on Tech Head Brothers. For the ones of you who read french, you may read it here.
06/01/08
Generics in C#
Generics in C#
Have you already used generics in C# ? Yes ? Then you may already have struggled with the issues I'm going to talk about.
When you are in a generic method, you may want to cast your generic object into another type to do some specific treatment :
class Program
{
static void Main(string[] args)
{
GenericMethod<Class1>(new Class1());
}
static T GenericMethod<T>(T item)
{
Class1 c1 = ((Class1)item);
return item;
}
}
However when you do this, you have the compiler that says you "cannot convert type 'T' to 'Class1'". The tip is to use the as keyword, and the compiler wont bore you anymore :
class Program
{
static void Main(string[] args)
{
GenericMethod<Class1>(new Class1());
}
static T GenericMethod<T>(T item)
{
Class1 c1 = item as Class1;
return item;
}
}
One more thing really useful : when you want to use generic methods, you do not necessarly need to specify the generic type. If the method expect this generic type as parameter, the compiler can infer it :
class Program { static void Main(string[] args) { GenericMethod(new Class1()); }static T GenericMethod<T>(T item) { Class1 c1 = item as Class1; return item; } }
Hope it was useful. Have fun, and keep your little fingers brawny.
04/30/08
Php for Visual Studio (Php4VS)
Morning everyone,
Some days ago, I've published a project on codeplex : php4vs. Currently, it provides basic functions, but I intend to implement intellisense. Though, we could have a great php IDE, but it would also have made me understand a bit more how to implement Language Service in VS, and how to work with MPF (Managed Package Framework). Once intellisense works, I will publish a post to let you know, how I made it work.
04/24/08
Lucene Persistence Engine Sample
Due to my preceding post, I had to publish a sample on how to use this Lucene Persistence Engine. And since a picture is worth a thousand words, I let try it. The sample is a small application that looks for content in an articles library.
You may find the sample here.
04/20/08
Lucene Persistence Engine for Euss
I have been working with EUSS for some time now. For the one who don't know it yet, I would suggest you to have a look at it. During my free time, I've developed a Persistence Engine based on Lucene. If you know EUSS or have taken some time to read the overview, you know that to request objects to EUSS, you use the OPath language, or with the .NET framework 3.5, you can use Linq. My persistence engine enables you use these languages with Lucene. Imagine the power of Linq combined with the Lucene ! I know, a LinqToLucene already exists, but my persistence engine goes further, since it enables to use aggregate functions (not in constraints). For instance, you may get the number of objects satisfying a condition with one single query. For those who have been reading so far, I guess you're impatient to test it, then here is the dlls to use, and there an example of an app.config/web.config :
<configuration> <configSections> <section name="euss" type="Evaluant.Uss.Configuration.EussConfiguration, Evaluant.Uss"/> </configSections> <connectionStrings> <add name="MsSQL" connectionString="Data Source=.;Initial Catalog=EUSS;Integrated Security=true"/> </connectionStrings> <system.diagnostics> <switches> <add name="Evaluant.Uss.SqlMapper.Sql" value="1"/> <add name="Evaluant.Uss.Lucene" value="1"/> </switches> </system.diagnostics> <euss> <engines defaultEngine="myIndexer"> <engine name="myIndexer" factory="Evaluant.Uss.Lucene.IndexerProvider, Evaluant.Uss.Lucene"> <add name="delegator" value="Lucene,SqlMapper" /> <add name="DefaultEngineIndex" value="1" /> <add name="IndexerDefaultIndex" value="0"/> </engine> <engine name="SqlMapper" factory="Evaluant.Uss.SqlMapper.SqlMapperProvider" connectionStringName="MsSQL"> <add name="Dialect" value="Evaluant.Uss.SqlMapper.MsSqlDialect" /> <add name="Driver" value="Evaluant.Uss.SqlMapper.MsSqlDriver" /> <add name="MappingFileName" value="~/mapping.xml" /> <metadata> <add type="assembly" value="LucenePersistenceEngineSample.Domain" /> </metadata> </engine> <engine name="Lucene" factory="Evaluant.Uss.Lucene.LuceneProvider, Evaluant.Uss.Lucene"> <add name="Path" value="Index" /> <add name="StoreAttributes" value="True" /> <metadata> <add type="assembly" value="LucenePersistenceEngineSample.Domain" /> </metadata> </engine> </engines> </euss> </configuration>
:: Next Page >>