Friday 29 June 2012

Isolated Applications: The Role of the Manifest FIle

To quote MSDN "An application is considered an isolated application if all of its components are SxS assemblies" (actually this applies to private assemblies too).

Concept One: Full versus Partial Isolation

Fully isolated applications rely solely on SxS assemblies. Partially isolated applications use a blend of SxS and "regular" assemblies.

Concept Two: Insuring against Breakages

The concept of isolated applications exists to prevent applications from breaking due to the installation and uninstallation of other applications using shared libraries.

Concept Three: The Role of the Manifest File

Manifests are XML files that go alongside SxS assemblies or isolated applications, containing information that has traditionally been stored in the registry e.g. COM classes and interfaces. SxS assemblies are not installed in the registry - dependencies are specified in manifest files.

C# Reflection - Dynamic Method Calls

The Type class is very important. It allows you to access METADATA relating to a type - this is very useful. For example, if you need a program to call a method, where the method name is called dynamically. Type is the root of the System.Reflection hierarchy.

That Good 'Ol String[] args!

OK, so you want to write a command-line program. It can't be a  very flexible / interesting program if it doesn't accept some command line parameters.

But how do you handle common issues (like optional arguments, for example). Is there an elegant way to process these in C#?

You could do separate cases e.g. if args.length ==2, 3 etc. do something different.

The Folly of Dictionary.Keys()

Keys is a property on the Generic Dictionary object. Trying to use it like a method will result in a "non-invokable member xxx cannot be used like a method". Other properties on Dictionary include Values (which interestingly returns a "ValueCollection") and Count (returns an int).

Wednesday 20 June 2012

Gaining a Strong, Technical Grasp of Web Services Concepts (aka Why Soap?)

One must know web services concepts if one claims to be a Windows programmer in this day and age. Here are the most popular concepts that any self-respecting Windows don would be able to define at the drop of the hat.

(I know we've been talking advanced stuff about WSDL etc in these blog posts but let's just do some CONCEPT CONSOLIDATION of web services now, just as a REFRESHER).

Q1. WHY is XML so important for web services?
XML is used as a data interchange format for web services. It is what the SOAP protocol is based on. It's human readability allows for easier diagnostics and human reading of web interfaces, or web exposed interfaces.

Q2. What is THE SOAP PROTOCOL. What makes it so SPECIAL in WEB SERVICE WORLD?
SOAP is mentioned everywhere in web services. SOAP is a protocol for exchanging TYPED information across the web. The phrased TYPED INFORMATION is most crucial. This is what enables us to define how to access SERVICES, OBJECTS and SERVERS in a platform-independent manner. That's the SECOND important point about the SOAP protocol, the PLATFORM INDEPENDENT nature. So, to recap, "TYPENESS" and "PLATFORM INDEPENDENCE". These are two key characteristics of SOAP protocol.

Q3. While we're on this topic. we might as well mention WSDL.
Used to declare the web service interfaces; return types and so forth. It's the XML grammar underlying these definitions.

Q4. What is UDDI?
Some kind of web services global registry concept.

Saturday 16 June 2012

Basic OpenGL Concepts for C# Programmers

Q. Ok, C# programmer, so you think you know OpenGL, do you? So, tell me, In what sense is OpenGL a "client-server system"? Hurry up, I haven't got all day!

A. OpenGL is a client-server system in the sense that your application is the "client" and the OpenGL implementation of your machine is the "server".

Q. What are these functions that begin with glut? e.g. glutInitDisplayMode?

A. Cross-platform functions from the utility toolkit.

Wednesday 6 June 2012

The Tao of Open GL in C#

Open GL'ing in C# can be done using the Tao Framework. It is recommended by game programmer Daniel Schuller in his book on C# Game Programming. An interesting alternative to Tao is OpenTK which is also a wrapper for OpenCL (Open Computing Language - created as a response to GPGPU) and OpenAL (a 3D audio library that complements OpenGL) - the three basic objects of which are Listener, Source and Buffer.

If you know C# and want to absorb only OpenGL knowledge, try the OpenGL Programming Guide (already in its Eight Edition) by Dave Shreiner et al.

Visual Studio Stinky Defaults (DFCP)

Explore the Stinky default Visual Studio project. It basically makes things (like namespaces) stop working.

Are Unit Tests in MSVS 2010 Ready for Prime-Time?

What happens when you create a new Visual Studio Test Project is TWO FILES get automatically generated. These are:
  • project.vsmdi
  • Local.testsettings
which appear under a "Solution Items" folder. The vsmdi is an XML metadata file which stores information about the tests list. Unit tests are stored in .cs files and web performance test files have the suffix .webtest, and .generictest for the "generic test" test type (kind of a "wrapper" for other tests). We'll focus our scrutiny on unit tests, giving scant attention to the so-called "generic tests".

FYI MSVS is a little rigid when it comes to unit testing. Whether you choose to use its features is something only you can decide. MS also have a product called MTM (Microsoft Test Manager) sold separately from Visual Studio main-line. Do you really want all that yarn or maybe just stick with nunit - the original TDD product for Dot net. To learn more about TDD, you may want to glance at the haphazard (but useful!) wiki entry on the same.