Pages

November 17, 2010

Direct Edge stock exchange using .NET

Wow a major exchange, Direct Edge, is using .NET to run it's exchange.

http://blogs.technet.com/b/windowsserver/archive/2010/07/22/direct-edge-stock-exchange-launches-on-windows-server-sql-server.aspx

C++/CLI

Having spent a lot of time programming in C++ over the last few months, I have come to appreciate some of the features of the language, such as the powerful templating mechanism, which is quite a bit more powerful than the .NET generics. There are seem to be a few cases when one would have to resort to tricky reflection techniques in C#/VB.NET, which costs both in terms of runtime overhead and also in code mantainability.

I have only recently became more acutely aware of the C++/CLI. Seems like it has a number of cool features that a worth a look:
  1. template system similar to C++
  2. much cheaper mechanism to invoke native code (compared to PInvoke)
  3. possibility to mix and match managed and unmanaged memory pools for performance optimization.
There is a pretty solid article from a solid C++ guy about C++/CLI.

Here is an excerpt:

C++/CLI represents a tuple. C++ refers, of course, to the C++ programming language invented by Bjarne Stroustrup at Bell Laboratories. It supports a static object model that is optimized for the speed and size of its executables. However, it doesn't support run-time modification of the program other than heap allocation. It allows unlimited access to the underlying machine, but very little access to the types active in the running program and no real access to the associated infrastructure of that program. Herb Sutter, a former colleague of mine at Microsoft and the chief architect of C++/CLI, refers to C++ as a concrete language.


CLI refers to the Common Language Infrastructure, a multitiered architecture supporting a dynamic component programming model. In many ways, this represents a complete reversal of the C++ object model. A runtime software layer, the virtual execution system, runs between the program and the underlying operating system. Access to the underlying machine is fairly constrained. Access to the types active in the executing program and the associated program infrastructure—both as discovery and construction—is supported. The slash (/) represents a binding between C++ and the CLI. The details surrounding this binding make up the general topic of this column.


So, a first approximation of an answer to what is C++/CLI is that it is a binding of the static C++ object model to the dynamic component object model of the CLI. In short, it is how you do .NET programming using C++ rather than C# or Visual Basic®. Like C# and the CLI itself, C++/CLI is undergoing standardization under the European Computer Manufacturers Association (ECMA) and eventually under ISO.


The common language runtime (CLR) is the Microsoft version of the CLI that is specific to the Windows® operating system. Similarly, Visual C++® 2005 is the implementation of C++/CLI.


As a second approximation of an answer, I would say that C++/CLI integrates the .NET programming model within C++ in the same way as, back at Bell Laboratories, we integrated generic programming using templates within the then existing C++. In both of these cases your investment in an existing C++ codebase and in your existing C++ expertise are preserved. This was an essential baseline requirement of the design of C++/CLI.

Memory Tour De Force

What Every Programmer Should Know About Memory by Ulrich Drepper

Fascinating, enlightening, extremely useful (memory speeds have not kept up with progress in raw computing power in modern computers see, beware of cpu stalling!). Expect it to take a couple of weeks to get through it and really digest all of it, it's a self-contained mini-course in electrical engineering...

here is a diagram comparing memory access speed vs cpu speed evolution - notice the growing gap.
from another excellent read showing how proper memory access can dramatically speed up your program.

November 8, 2010

Earth Equatorial Radius == 1.0 * Length Of Amazon River

Creepy coincidence or as-designed by aliens?

Earth Equator Radius = Amazon River Length = 6400 km

Note, equator radius is not same as circumference (which is around 2*pi*r = 40,000 km)

November 2, 2010

And the best use of ASCII in a comment goes to ...

Undo Tree Package For Emacs.

The documentation comment is fantastic. One of the best uses of ascii I have seen in a while. http://www.dr-qubit.org/undo-tree/undo-tree.el

The package is actually of great use for people working with version control system allowing non-linear change history, such as the increasingly popular git and mercurial.

Here is a sample:


Rx Guidelines

Rx (Reactive Extensions for .NET) is very cool. However there is fairly limited documentation. Rx Team recently released a more structured effort to document the functionality (as opposed to trying to string together a complete picture of Rx functionality from many different blog entries). It is available here: http://blogs.msdn.com/b/rxteam/archive/2010/10/28/rx-design-guidelines.aspx