Florent Clairambault

Technology brotherhoods

I often hear people talking about which technology is better between C / C++ / C# .Net / java. Most of the time, it’s more a political/brotherhood/community thing (like football, even thought frenchies like me aren’t so proud of their team now) than a technical talk. I find it absurd. Computer science is about efficiency and making more money. You can take into account the pleasure you have to work on a technology (as you will be more likely to be more efficient with it), but it should still remain about efficiency.

Recycling .net objects to improve performances

C# .Net allocation and freeing system is quite efficient but when you need to create a huge number of objects, it’s just not fast enough. So what you can do is try to recycle each object to avoid to recreate them. You will then just need to set their property. In my tests, this class reduced the allocation time from 12 to 15 times: public sealed class Heap<T> where T:class, new() { private readonly Stack<T> _stack = new Stack<T>(); private int _count; public T Allocate() { if ( _count == ) { return new T(); } else { --_count; return _stack.

Google PowerMeter and sample C# .Net API usage

Update 2011-06-25 A lot of people still contact me about this project. I received this mail today, just in case you’re getting interested by the project, you should know that it will die pretty soon: Dear PowerMeter User, We first launched Google PowerMeter as a Google.org project to raise awareness about the importance of giving people access to their energy information. Since our launch, there’s been more attention brought to this issue, and we’re excited that PowerMeter has helped demonstrate the importance of access to energy data.

Stupid C++ vs C# performance comparison

I found out that there is real test than the little one i did here. In fact the main interest of the post is this spreadsheet : I recently did a simple and stupid comparison test between C++ (g++) and C# .Net (mono). My point here is that C# can actually be considered as a very fast language. It allows automatic hardware-specific optimization. The only real drawback you have in the .

D language

This is just a very short post about this language I recently discovered : the D language. As described on its little website : “D is a systems programming language. Its focus is on combining the power and high performance of C and C++ with the programmer productivity of modern languages like Ruby and Python. Special attention is given to the needs of quality assurance, documentation, management, portability and reliability.”.

SPSecurity.RunWithElevatedPrivileges

If like me you’re wondering what exactly does SPSecurity.RunWithElevatedPrivileges, this is what I understand of it : SPSecurity.RunWithElevatedPrivileges( () => { using( var newSite = new SPSite( site.Url ) ) { // your stuff } }); Is equivalent to : using( var newSite = new SPSite( site.Url, site.SystemAccount.Token ) ) { // your stuff } So if this is just to open an elevated privilege SPSite, it will be equivalent.

C# .Net : How works automatic assembly versioning

When you choose to automatically generate a new version of your assembly at compilation, you have to set in the AssemblyInfo.cs file, this line : // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.

Loading plugins assemblies in .Net

This might seem like a quite complex thing to do, but it’s in fact very simple. Thank you .Net for being so well built. Note: With .Net 3.5, there is a much more advanced method called Add-In. But it’s also much more complex. You should use it on long-term projects with some evolutions of the plugins API (and no possibility to change the plugins). I’ve used it for a project and that really made us lose a lot of time.

NDepend

Patrick Smacchia gave me a professional license of NDepend v2.12 so that I could write some stuff about it if I liked it. As it was a gift (yes it is), I decided to force myself to look into this software. And after having looked much of its functionalities, I kind of like it. It’s not THE ultimate tool you have to use, but it’s a little bit like the other (resharper, reflector, etc.

.Net, Flex and WebORB.Net

I’ve been working on a project where we had to use Flex on a .Net environment and it had to be realtime. I was a little worried at first that it could be tricky to set up. But with WebORB.Net it’s pretty easy. We used the integrated RTMP (Real Time Messaging Protocol) messaging server. It’s almost like using WCF. The most important differences are that, by default, objects are transmitted as Hashtable and calls can’t be synchronous.