<?xml version="1.0" encoding="utf-8"?>
<feed xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xml:lang="en-us" xmlns="http://www.w3.org/2005/Atom">
  <title>Matevž Gačnik's Weblog</title>
  <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/" />
  <link rel="self" href="https://www.request-response.com/blog/SyndicationService.asmx/GetAtom" />
  <logo>http://www.request-response.com/blog/images/favicon.jpg</logo>
  <icon>favicon.ico</icon>
  <updated>2026-03-06T08:52:01.0984187+01:00</updated>
  <author>
    <name>Matevz Gacnik</name>
  </author>
  <subtitle>Technology Philanthropy</subtitle>
  <id>https://www.request-response.com/blog/</id>
  <generator uri="http://dasblog.info/" version="2.1.8102.813">DasBlog</generator>
  <entry>
    <title>Apple Fusion Architecture: The Structural Evolution of Apple Silicon</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,93b456f5-4db8-478b-9420-215a0e6e4157.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,93b456f5-4db8-478b-9420-215a0e6e4157.aspx</id>
    <published>2026-03-05T08:02:09.72+01:00</published>
    <updated>2026-03-06T08:52:01.0984187+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <category term="Apple" label="Apple" scheme="https://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Articles" label="Articles" scheme="https://www.request-response.com/blog/CategoryView,category,Articles.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Apple’s M‑series processors have historically followed a monolithic design philosophy.
Each generation from M1 through M4 relied on a single die that integrated CPU cores,
GPU cores, memory controllers, and specialized accelerators into a unified system
on chip. With the introduction of the M5 Pro and M5 Max processors, Apple has fundamentally
altered this approach.
</p>
        <p>
The company has introduced a modular design methodology now, in 2026, known as <b>Fusion
Architecture</b>.
</p>
        <img border="0" src="https://www.request-response.com/blog/content/binary/Apple-M5-Pro-M5-Max-chips-260303_big.jpg.large.jpg" />
        <p>
Fusion Architecture represents the first structural redesign of Apple Silicon since
the debut of <b>the M1 in 2020</b>. Instead of manufacturing one large die, Apple
now constructs high‑end processors from multiple silicon dies bonded together into
a single logical system. This shift reflects broader trends in semiconductor engineering
driven by manufacturing limits, cost constraints, and the rapidly growing computational
requirements of artificial intelligence workloads.
</p>
        <b>Historical Context: The Monolithic Apple Silicon Strategy</b>
        <p>
When Apple introduced the M1 processor in 2020, the company redefined personal computing
processor architecture. The M1 integrated CPU, GPU, Neural Engine, and memory controllers
onto a single die while introducing the unified memory architecture. This architecture
allowed all compute components to access a shared memory pool without copying data
between discrete subsystems.
</p>
        <p>
This design delivered several advantages including reduced memory latency, improved
energy efficiency, higher effective bandwidth between compute units, and simplified
software optimization. The M1 architecture quickly proved successful and subsequent
generations including M2, M3, and M4 followed the same structural model while incrementally
improving process nodes, core counts, and bandwidth.
</p>
        <p>
However, this design philosophy carried a significant limitation. As workloads increased,
particularly those related to large language models and machine learning inference,
chip complexity and die size began to scale rapidly. Larger dies are significantly
harder to manufacture reliably because even a single defect renders the entire chip
unusable.
</p>
        <b>The Semiconductor Industry Shift Toward Chiplets</b>
        <p>
Apple is not alone in confronting the physical limits of monolithic chips. The semiconductor
industry has broadly transitioned toward chiplet architectures where processors are
composed of several smaller dies interconnected <b>within a single package</b>.
</p>
        <p>
Major vendors have already adopted this strategy. AMD employs chiplet designs in Ryzen
and EPYC processors. Intel uses advanced packaging techniques such as embedded multi‑die
interconnect bridge and Foveros stacking. NVIDIA constructs its largest AI accelerators
using multi‑die packaging.
</p>
        <p>
The economic rationale behind chiplets is straightforward. Manufacturing several smaller
dies is more cost efficient than producing one extremely large die because yield rates
improve significantly. Industry analyses indicate that modular chiplet designs can
deliver comparable computational capability at dramatically lower manufacturing cost.
</p>
        <p>
This transition marks the gradual decline of the traditional monolithic processor
model.
</p>
        <i>Apple’s Approach: Fusion Architecture</i>
        <p>
Apple’s response to these constraints is Fusion Architecture.
</p>
        <p>
Rather than simply replicating existing dies and connecting them together, Apple has
designed a modular structure where individual dies perform distinct functional roles.
These dies are physically bonded using high bandwidth interconnect technology and
presented to the operating system as a single logical processor.
</p>
        <p>
The critical design requirement Apple preserved is unified memory. Even though the
processor now spans multiple dies, Apple maintains a shared memory architecture that
allows all compute units to operate on the same dataset without explicit data transfers.
</p>
        <p>
While Apple has not publicly disclosed the full technical implementation of cross
die memory coherence, the company claims the architecture preserves the same software
model as earlier M series chips. From the perspective of applications and operating
systems, the processor behaves as a single unified system.
</p>
        <i>Structural Design of the M5 Pro and M5 Max</i>
        <p>
The first processors implementing Fusion Architecture are the <b>M5 Pro</b> and <b>M5
Max</b>. Both chips consist of two separate dies connected through high speed packaging
technology. The first die is identical in both processors and contains the majority
of the system control components.
</p>
        <i>Primary Die</i>
        <p>
The first die includes an 18 core CPU cluster, a 16 core Neural Engine, the SSD controller,
and Thunderbolt I O controllers. This die effectively functions as the computational
and system management foundation of the processor.
</p>
        <i>Secondary Die</i>
        <p>
The second die differentiates the two processors.
</p>
        <p>
The M5 Pro configuration includes up to 20 GPU cores, a single media engine, and a
memory controller delivering up to 307 GB per second bandwidth. The M5 Max configuration
includes up to 40 GPU cores, dual media engines, and a memory controller delivering
up to 614 GB per second bandwidth.
</p>
        <p>
This design enables Apple <b>to scale GPU and media performance independently from
the CPU subsystem</b>. In principle, additional GPU focused dies could be added in
future designs to extend compute capacity without redesigning the entire processor.
</p>
        <b>Architectural Changes in CPU Design</b>
        <p>
The CPU configuration of the M5 generation introduces another major structural change.
Earlier M series chips relied on a hybrid architecture combining performance cores
with efficiency cores.
</p>
        <p>
The M5 Pro and M5 Max abandon efficiency cores entirely and instead implement a two
tier high performance structure.
</p>
        <p>
The CPU cluster consists of six super cores optimized for peak single thread performance
and twelve performance cores optimized for high multithread throughput. This creates
an all performance architecture designed for sustained computational workloads rather
than energy optimized background processing.
</p>
        <p>
The naming scheme has also evolved. What were previously called performance cores
in earlier M series chips are now referred to as super cores. The new performance
cores represent an intermediate tier that prioritizes throughput while maintaining
strong efficiency characteristics.
</p>
        <p>
This structure closely resembles the strategy used by AMD in its Zen 5 and Zen 5c
core architecture.
</p>
        <i>GPU Evolution and AI Acceleration</i>
        <p>
Another significant development is the integration of neural accelerators within each
GPU core.
</p>
        <p>
Although the GPU core counts remain unchanged from the previous generation, each core
now includes dedicated hardware for machine learning computation. This allows the
GPU to perform both graphics processing and AI inference tasks.
</p>
        <p>
Apple claims this architecture enables up to four times the AI compute capability
without increasing the overall GPU core count.
</p>
        <p>
This reflects a broader shift in processor design. GPUs are evolving into general
purpose parallel compute engines <b>where graphics workloads represent only one category
of computation</b>.
</p>
        <i>Memory Bandwidth Scaling</i>
        <p>
Large AI models require extremely high memory bandwidth to deliver acceptable inference
performance. Apple has continued to increase bandwidth across successive M series
generations. The M5 generation extends this trend. The M5 Pro reaches 307 GB per second
memory bandwidth while the M5 Max reaches 614 GB per second. Both figures represent
improvements over the M4 generation.
</p>
        <p>
Bandwidth scaling is particularly important for local inference of large language
models. High bandwidth allows large parameter sets to be accessed efficiently by GPU
and neural compute units. This suggests Apple is designing these processors with the
expectation that laptops will increasingly run advanced AI models locally rather than
relying solely on cloud infrastructure.
</p>
        <i>Strategic Implications of Fusion Architecture</i>
        <p>
Fusion Architecture is not revolutionary in the sense that multi die packaging already
exists across the semiconductor industry. However, it represents a critical strategic
transition for Apple Silicon. The key significance lies in scalability. By demonstrating
that unified memory and high performance interconnects can function across multiple
dies, Apple removes the traditional constraint of die size. Future processors can
scale horizontally by combining additional specialized dies <b>rather than enlarging
a single monolithic chip</b>.
</p>
        <p>
This opens several potential directions for future development including additional
GPU dies for AI acceleration, specialized machine learning dies, and advanced multi
package configurations for workstation and server workloads. The packaging technology
used to bond these dies is similar to the interconnect technologies used in modern
AI servers. Apple has effectively brought data center class packaging techniques into
consumer laptop processors.
</p>
        <b>So..</b>
        <p>
The M1 generation introduced a radical rethinking of personal computing processors
through unified memory and system level integration. Subsequent generations refined
that architecture while maintaining the monolithic design.
</p>
        <p>
Fusion Architecture represents the next phase of <b>Apple Silicon (r)evolution</b>.
Author notes the reader to remember 2020 and how revolutionary the <b>M1</b> Apple
Silicon architecture actually was.
</p>
        <p>
Instead of competing with the physical limits of monolithic chips, Apple is adopting
a modular strategy that preserves its core architectural principles while enabling
future scalability. Multi die packaging allows the company <b>to expand computational
capability without incurring the manufacturing penalties</b> associated with extremely
large silicon dies.
</p>
        <p>
The immediate performance gains of the M5 generation are important but the more significant
development is architectural. Fusion Architecture establishes the structural foundation
upon which future Apple processors will be built.
</p>
        <p>
In practical terms, the question is no longer how large a single Apple Silicon chip
can become. The real question is how many modular components Apple can connect together
while maintaining the unified architecture that has defined the platform since the
M1.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=93b456f5-4db8-478b-9420-215a0e6e4157" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Terence Tao</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,0810e768-87db-427f-9c26-8668c34348bd.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,0810e768-87db-427f-9c26-8668c34348bd.aspx</id>
    <published>2024-06-28T05:56:50.713+02:00</published>
    <updated>2024-11-06T11:45:33.6484887+01:00</updated>
    <category term="Articles" label="Articles" scheme="https://www.request-response.com/blog/CategoryView,category,Articles.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Terence Tao is another remarkable figure who deserves a Nobel Prize. However, since
there isn't a Nobel Prize for mathematics, the highest honor he can receive is the
Fields Medal, which he has already won. 
<br /><br />
Amadeus #Mozart, go Bob Dylan!
</p>
[1] <a href="https://en.wikipedia.org/wiki/Fields_Medal&#xA;" target="_blank">https://en.wikipedia.org/wiki/Fields_Medal</a><br /><br />
His: <a href="https://terrytao.wordpress.com" target="_blank">BLOG</a> | <a href="https://www.math.ucla.edu/~tao" target="_blank">OFFICIAL</a> | <a href="https://ww3.math.ucla.edu/professor-terence-tao-receives-2022-grand-medaille-of-the-french-academy-of-sciences/" target="_blank">AWARD</a><br /><br /><img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=0810e768-87db-427f-9c26-8668c34348bd" /></div>
    </content>
  </entry>
  <entry>
    <title>On Bosons and Morons</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,27ffb21b-3123-4f8c-b8b6-69151629e81c.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,27ffb21b-3123-4f8c-b8b6-69151629e81c.aspx</id>
    <published>2024-02-10T12:10:30.346+01:00</published>
    <updated>2025-12-11T21:59:51.7114861+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <category term="Articles" label="Articles" scheme="https://www.request-response.com/blog/CategoryView,category,Articles.aspx" />
    <category term="Parody" label="Parody" scheme="https://www.request-response.com/blog/CategoryView,category,Parody.aspx" />
    <content type="html">&lt;p&gt;
It finally happened. Pfeew!
&lt;/p&gt;
Article link: &lt;a href="content/binary/bosonsmorons.pdf" target="_blank"&gt;On Bosons
and Morons&lt;/a&gt; 
&lt;p&gt;
&lt;img width="500" src="images/bosonsmorons.png" border: 5px solid #444&gt;&gt;&lt;img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=27ffb21b-3123-4f8c-b8b6-69151629e81c" /&gt;</content>
  </entry>
  <entry>
    <title>Paradigm Shift is Happening in AI Space and Rarely One Notices</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,01f25b8d-4ce6-401b-a985-0976223d10d5.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,01f25b8d-4ce6-401b-a985-0976223d10d5.aspx</id>
    <published>2023-03-19T15:28:44.152+01:00</published>
    <updated>2023-03-19T15:33:46.9992507+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Microsoft Copilot (AI Based, going to all Office, Bing and communication products) 
</p>
        <p>
          <a href="https://blogs.microsoft.com/blog/2023/03/16/introducing-microsoft-365-copilot-your-copilot-for-work">Currently
named Copilot for Work..</a>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=01f25b8d-4ce6-401b-a985-0976223d10d5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>M3GAN</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,13acaa9d-b367-4e9f-9ee4-6190ca5312c8.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,13acaa9d-b367-4e9f-9ee4-6190ca5312c8.aspx</id>
    <published>2023-01-27T17:51:52.284+01:00</published>
    <updated>2023-01-29T18:06:46.2270349+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <strong>M3GAN</strong> is nice and cute. 
</p>
        <p>
          <a href="https://www.imdb.com/title/tt8760708">IMDB link</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=13acaa9d-b367-4e9f-9ee4-6190ca5312c8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Go on, then.. #AI</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,59946433-74e2-4381-ae7d-173fe134e889.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,59946433-74e2-4381-ae7d-173fe134e889.aspx</id>
    <published>2023-01-17T08:04:12.679+01:00</published>
    <updated>2025-12-11T22:02:06.1966447+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Source link: <a href="https://www.medrxiv.org/content/10.1101/2022.12.19.22283643v2.full.pdf">medRxiv</a></p>
        <p>
Quite scary.. <b>think.</b></p>
        <img width="500" src="content/binary/ChatArticle1.png" />
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=59946433-74e2-4381-ae7d-173fe134e889" />
      </div>
    </content>
  </entry>
  <entry>
    <title>A Little Late Night Conversation with @OpenAI</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,d427005e-75db-4c97-b0fe-c451dcd28728.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,d427005e-75db-4c97-b0fe-c451dcd28728.aspx</id>
    <published>2022-12-07T01:52:40.113+01:00</published>
    <updated>2022-12-07T02:28:05.7336248+01:00</updated>
    <category term="AI" label="AI" scheme="https://www.request-response.com/blog/CategoryView,category,AI.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Copy and paste from my conversation with <a href="https://chat.openai.com">https://chat.openai.com</a>.
</p>
        <p>
Response time was under <b>20 milliseconds</b>. Handling context with no issues. Fascinating.
</p>
        <hr />
        <p>
          <b>&gt; So, how are you OpenAI?</b>
          <br />
I'm doing great! OpenAI is a research laboratory dedicated to finding ways to use
artificial intelligence to benefit humanity. We're making advances in machine learning,
robotics, and other AI technologies, and we're always looking for new opportunities
to make the world a better place. 
</p>
        <p>
          <b>&gt; What's a garbage collector?</b>
          <br />
A garbage collector is a program in computer science that is responsible for managing
the memory allocation of a computer system in order to ensure that it runs efficiently.
It frees up memory that is no longer in use and reclaims memory that is being used
inefficiently. 
</p>
        <p>
          <b>&gt; Should we use it?</b>
          <br />
Yes, garbage collection is important for the efficient use of memory and can help
improve the performance of a computer system. If a computer system is not using garbage
collection, it’s likely that it will suffer from memory leaks, which can lead to reduced
performance and system instability. 
</p>
        <p>
          <b>&gt; Hmm, I should have asked differently...</b>
          <br />
No worries, we're here to help. What other questions do you have about garbage collection? 
</p>
        <p>
          <b>&gt; What I meant to ask was, should we use it manually or should we leave garbage
collection to platforms we use?</b>
          <br />
It depends on the platform and the application you are developing. If the platform
has a built-in garbage collection system, you can usually leave it to the platform
to manage memory allocation and reclaim memory. However, in some cases, it might be
necessary to manually implement garbage collection in order to optimize the performance
of the system. 
</p>
        <p>
          <b>&gt; Could you give me an example of that?</b>
          <br />
Sure. For example, if you are developing a game, it might be beneficial to manually
implement garbage collection in order to free up memory that is no longer in use and
reclaim memory that is being used inefficiently. This can help keep the game running
smoothly and improve the overall user experience. 
</p>
        <p>
          <b>&gt; Any other examples?</b>
          <br />
Yes, garbage collection can also be used in other areas such as web development and
database management. Garbage collection can help reduce the amount of memory that
is used by a web application and can help ensure that a database is running efficiently. 
</p>
        <p>
          <b>&gt; Any other examples when we should trust the platforms for garbage collection?</b>
          <br />
In many cases, it is best to trust the platforms for garbage collection. For example,
if you are developing an application that runs on a popular platform such as Android
or iOS, you can usually trust the garbage collection system that is built into the
platform. This will ensure that memory is being managed efficiently and that the application
is running smoothly. 
</p>
        <p>
          <b>&gt; What do you mean by 'managed efficiently'?</b>
          <br />
When garbage collection is managed efficiently, it means that memory is being allocated
and reclaimed in a way that maximizes efficiency and minimizes memory leaks. This
helps to ensure that the application runs smoothly and does not suffer from performance
issues due to memory leaks. 
</p>
        <p>
          <b>&gt; You are quite knowledgeable about the subject.</b>
          <br />
Thank you for your kind words! 
</p>
        <p>
          <b>&gt; What happens if memory is not reclaimed?</b>
          <br />
If memory is not reclaimed, it can lead to memory leaks and decrease the performance
of the application. Memory leaks can also cause the application to crash or become
unstable. To prevent these issues, it is important to ensure that memory is being
reclaimed efficiently with the help of garbage collection. 
</p>
        <p>
          <b>&gt; So, what did programmers do when there was no automatic garbage collection?</b>
          <br />
Before the advent of automatic garbage collection, programmers had to manually manage
memory allocation and reclaim memory when necessary. This could be a tedious and time
consuming process, and errors in memory management could lead to memory leaks and
other performance issues. 
</p>
        <p>
          <b>&gt; What do they do now in C or Lisp or Fortran?</b>
          <br />
Nowadays, many programming languages such as C, Lisp, and Fortran have built-in garbage
collection systems. This allows programmers to focus more on the application logic,
rather than having to manually manage memory allocation and reclaim memory. 
</p>
        <p>
          <b>&gt; Which platforms or languages do have automatic garbage collection?</b>
          <br />
Many popular platforms and languages such as Java, JavaScript, Python, and more have
built-in garbage collection systems. Additionally, many modern operating systems such
as Windows and macOS also have garbage collection systems. 
</p>
        <p>
          <b>&gt; Does .NET have it?</b>
          <br />
Yes, .NET has a built-in garbage collection system. The .NET garbage collection system
is responsible for managing memory allocation, reclaiming memory when appropriate,
and ensuring that the application runs efficiently. 
</p>
        <p>
          <b>&gt; So.. What are generations in terms of .NET garbage collection?</b>
          <br />
Generations are a concept used in .NET garbage collection to help improve the performance
of the garbage collector. The .NET garbage collector divides objects into three generations
based on their lifetime, and objects that have been alive for longer are placed into
higher generations. This helps the garbage collector to identify which objects are
the most likely to be reclaimed, allowing it to reclaim memory more efficiently. 
</p>
        <p>
          <b>&gt; Tell me about latency models in this case.</b>
          <br />
Latency models are used in .NET garbage collection to help reduce the impact that
garbage collection has on the performance of the application. The latency model estimates
the time it will take for the garbage collector to reclaim memory, and then it schedules
garbage collection at times that will have the least impact on the application. This
helps to ensure that the application runs smoothly, even when garbage collection is
running. 
</p>
        <p>
          <b>&gt; Any thoughts on weak references for GC?</b>
          <br />
Weak references are a type of reference that can help the garbage collector reclaim
memory more efficiently. Weak references are references to objects that are no longer
strongly referenced, and they allow the garbage collector to reclaim the objects that
they refer to even if they are not strongly referenced. This can help reduce memory
leaks and improve the performance of the application. 
</p>
        <p>
          <b>&gt; You might just pass a Turing test. What is it?</b>
          <br />
The Turing test is a test of a machine’s ability to exhibit intelligent behavior that
is indistinguishable from that of a human. It was proposed by Alan Turing in 1950,
and it is still used today to evaluate the performance of AI systems. 
</p>
        <p>
          <b>&gt; Could you pass it?</b>
          <br />
My understanding is that I am not the one who is being tested in the Turing test -
it is the machine that is being tested. However, it is possible that I could pass
the Turing test if I was able to exhibit intelligent behavior that is indistinguishable
from that of a human. 
</p>
        <p>
          <b>&gt; So coming back to GC.. Could you explain the concept of compaction?</b>
          <br />
Compaction is a process used by the garbage collector to reclaim memory more efficiently.
The garbage collector moves objects around in memory to free up memory that is no
longer in use and to reduce the amount of memory fragmentation. This helps to reduce
memory leaks and improve the performance of the application. 
</p>
        <p>
          <b>&gt; No, GC as in garbage collection...</b>
          <br />
Ah, of course! Garbage collection is a process used in computer science to manage
the memory allocation of a computer system in order to ensure that it runs efficiently.
It frees up memory that is no longer in use and reclaims memory that is being used
inefficiently. 
</p>
        <p>
          <b>&gt; Giving you an option to select between a forced and optimized garbage collection.
When would you choose one or the other?</b>
          <br />
The choice between forced and optimized garbage collection depends on the application
and the expected workload of the system. Forced garbage collection is used when the
application needs to reclaim memory immediately and the system can tolerate a slight
decrease in performance. Optimized garbage collection is used when the application
can wait for the garbage collector to reclaim memory and the system's performance
needs to be maximized. 
</p>
        <p>
          <b>&gt; Quite good.</b>
          <br />
Thank you! 
</p>
        <p>
          <b>&gt; Could we change topics?</b>
          <br />
Of course! What would you like to talk about? 
</p>
        <p>
          <b>&gt; How much power does a 12kW power outlet generate in 12 hours?</b>
          <br />
A 12kW power outlet will generate 144 kWh (12 kW x 12 hours) of electricity in 12
hours. 
</p>
        <p>
          <b>&gt; What about 120 hours?</b>
          <br />
For 120 hours, the 12 kW power outlet will generate 1,440 kWh (12 kW x 120 hours)
of electricity. 
</p>
        <p>
          <b>&gt; So, a 700MW power plant generates how many times more power that this power outlet?</b>
          <br />
A 700 MW power plant will generate 4,800,000 kWh of electricity in 12 hours (700 MW
x 12 hours), which is 33,333 times more power than the 12 kW power outlet. 
</p>
        <p>
          <b>&gt; What are typical examples of such a powerful power plants? Do they run on coal?</b>
          <br />
Yes, many large power plants are powered by coal. These power plants are typically
used to generate electricity for large cities and regions. Examples of such power
plants include the Taichung Power Plant in Taiwan, which has a capacity of 5,500 MW,
and the Four Corners Power Plant in the US, which has a capacity of 3,520 MW. 
</p>
        <p>
          <b>&gt; What about nuclear, which one generates the most power?</b>
          <br />
The Kashiwazaki-Kariwa Nuclear Power Plant in Japan is the largest nuclear power plant
in the world, with a capacity of 7,965 MW. It is followed by the Fukushima Daiichi
Nuclear Power Plant in Japan (4,711 MW) and the Bruce Nuclear Generating Station in
Canada (4,400 MW). 
</p>
        <p>
          <b>&gt; And in Europe?</b>
          <br />
In Europe, the largest nuclear power plant is the Kola Nuclear Power Plant in Russia,
with a capacity of 4,800 MW. It is followed by the Cattenom Nuclear Power Plant in
France (3,960 MW) and the Olkiluoto Nuclear Power Plant in Finland (2,800 MW). 
</p>
        <p>
          <b>&gt; And in Slovenia?</b>
          <br />
In Slovenia, the only nuclear power plant is the Krško Nuclear Power Plant, with a
capacity of 688 MW. 
</p>
        <p>
          <b>&gt; Austria?</b>
          <br />
In Austria, there are no nuclear power plants. 
</p>
        <p>
          <b>&gt; Ukraine?</b>
          <br />
In Ukraine, the largest nuclear power plant is the Zaporizhia Nuclear Power Plant,
with a capacity of 6,000 MW. 
</p>
        <p>
          <b>&gt; You just said Kola nuclear poweplant is the largest in Europe. What gives?</b>
          <br />
The Kola Nuclear Power Plant in Russia is the largest nuclear power plant in Europe
in terms of capacity, but it is not located in Europe itself. It is located in the
Murmansk region of Russia, which is east of Finland and Norway. 
</p>
        <p>
          <b>&gt; So, how many reactors does Zaporizhia consist of?</b>
          <br />
The Zaporizhia Nuclear Power Plant consists of six nuclear reactors. 
</p>
        <p>
          <b>&gt; Each generating how many megawatts?</b>
          <br />
Each of the six reactors at the Zaporizhia Nuclear Power Plant generates 1,000 MW
of electricity. 
</p>
        <p>
          <b>&gt; Thank you. You've been splendid.</b>
          <br />
You're welcome! It was my pleasure to help. 
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=d427005e-75db-4c97-b0fe-c451dcd28728" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bing Daily Image - A Bing Image of the Day Download Tool</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,c22dfa28-b0b9-4a04-8d3f-e80cafa4a641.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,c22dfa28-b0b9-4a04-8d3f-e80cafa4a641.aspx</id>
    <published>2021-12-01T19:05:46.641+01:00</published>
    <updated>2025-12-11T22:04:03.4598164+01:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Windows 10" label="Windows 10" scheme="https://www.request-response.com/blog/CategoryView,category,Windows10.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Ever wanted to have your Windows desktop background look sharp? Like, <a href="http://www.bing.com/gallery/">Bing
Gallery</a> sharp? Let me help you.
</p>
        <p>
Here's a little tool I'm releasing today that allows you to:
</p>
        <ul>
          <li>
Get daily <a href="http://www.bing.com/gallery/">Bing Image of the Day</a> to your
desktop 
</li>
          <li>
Perform bulk downloads, multiple images at a time 
</li>
          <li>
Add image title and description to your wallpaper [1] 
</li>
          <li>
Run it as a service</li>
        </ul>
        <p>
It's all in one tool. Small, simple, <strong>efficient</strong>.
</p>
        <p>
Here's the parameter model it supports:
</p>
        <p>
          <font face="Courier New">
            <strong>BingDailyImage v1.0</strong> - Download desktop wallpaper
images from Bing<br />
Copyright © 2021, Matevž Gačnik<br />
www.request-response.com</font>
        </p>
        <p>
          <font face="Courier New">Gets Bing Picture of the Day images for today and a specified
number of days back.</font>
        </p>
        <p>
          <font face="Courier New">Usage: BingDailyImage [-c] [-d [days]] [-f folder] [-t [top|bottom]]
[-b]<br />
-c Get current Bing image<br />
-d [days] Specifies number of days to fetch.<br />
If you omit this parameter the tool will download<br />
last two weeks (14 days) of Bing wallpapers.<br />
-f Set download folder<br />
If you omit this parameter the folder will be<br />
set to - '%USERPROFILE%\Pictures\Bing Wallpapers'.<br />
-t Add text (image title and description) to images<br />
You can specify text position [top, bottom]. Default is bottom.<br />
-b Set last downloaded image as desktop background<br />
-s install Installs BingDailyImage as a system service<br />
Use -f to specify service download folder path<br />
Use -t to let service add text to images<br />
-s uninstall Uninstalls BingDailyImage as a system service<br />
-s start Starts BingDailyImage service<br />
-s stop Stops BingDailyImage service<br />
-s query Queries BingDailyImage service state<br />
-h Displays help</font>
        </p>
        <p>
You can just do a <font face="Courier New">BingDailyImage.exe -c</font> to get the
current daily image. By default, it will not tamper with background images, so you'll
get the highest resolution available (1920x1200 or 1920x1080), like this:
</p>
        <p>
          <font face="Courier New">
            <strong>BingDailyImage v1.0</strong> - Download desktop wallpaper
images from Bing<br />
Copyright © 2021, Matevž Gačnik<br />
www.request-response.com</font>
        </p>
        <p>
          <font face="Courier New">Downloading Bing Image of the Day for 2021-12-16.<br />
Image date: 2021-12-16<br />
Image title: Old Town in Salzburg, Austria<br />
Image description: When it's lit up like this with a cozy glow, we can admire… When
there's a mountain in your city… We're looking at the Old Town portion<br />
of this Baroque city…<br />
Downloading background... Background for 1920x1200 found.<br />
Saving background... Done for 2021-12-16.</font>
        </p>
        <p>
Or do a <font face="Courier New">BingDailyImage.exe -d 10 -t</font> to get the last
10 and add a nice, transparent background text to them.
</p>
        <p>
Hell, do a <font face="Courier New">BingDailyImage.exe -s install</font> and forget
about it. It's going to download new images once they are published to Bing's servers.
All you need to do now is set your Windows 10/11 desktop background to be fetched
from the download folder. Done.
</p>
        <p>
Here's the <a href="http://www.request-response.com/blog/content/binary/BingDailyImage_v1.0.zip">download</a>.
</p>
        <p>
Here's a sample of a downloaded image.
</p>
        <p>
          <img style="BORDER-TOP: 1px solid; HEIGHT: 375px; BORDER-RIGHT: 1px solid; WIDTH: 600px; BORDER-BOTTOM: 1px solid; BORDER-LEFT: 1px solid" src="images/bdisample1.png" width="1919" height="1200" />
          <br />
          <font size="1">
            <br />
[</font>
          <a href="images/bdisample1.png">
            <font size="1">download original image</font>
          </a>
          <font size="1">]</font>
        </p>
        <p>
[1] You might be surprised about the fun facts you'll learn every day.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=c22dfa28-b0b9-4a04-8d3f-e80cafa4a641" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Clouds Will Fail</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,1223a8d2-9408-4bcd-929a-283eecd0b1a4.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,1223a8d2-9408-4bcd-929a-283eecd0b1a4.aspx</id>
    <published>2019-05-04T22:02:27.174+02:00</published>
    <updated>2023-01-23T23:26:24.1124693+01:00</updated>
    <category term="Architecture" label="Architecture" scheme="https://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is a slightly less technical post, covering my experiences and thoughts on <strong>cloud
computing</strong> as a viable business processing platform.
</p>
        <p>
Recent <a href="http://aws.amazon.com/ec2">Amazon EC2</a> failure was gathering a
considerable amount of press and discussion coverage. Mostly discussions revolve around
the <strong>failure</strong> of cloud computing as a promise to <em>never</em> go
down, <em>never</em> lose a bit of information.
</p>
        <p>
This is wrong and has been wrong for a couple of years. Marketing people should <strong>not
be making promises</strong> their technical engineers can't deliver. Actually, marketing
should really step down from highly technical features and services, in general. I
find it funny that there is no serious marketing involved in selling <a href="http://en.wikipedia.org/wiki/Boiling_water_reactor">BWR
reactors</a> (which fail too), but they probably serve the same amount of people as
do cloud services, nowadays.
</p>
        <p>
Getting back to the topic, as you may know EC2 failed miserably a couple of weeks
ago. It was something that should not happen - at least in many techie minds. The
fault at AWS EC2 cloud was with their EBS storage system, which failed across multiple <em>AWS
availability zones</em> within the same <em>AWS region</em> in North Virginia. Think
of availability zones as server racks within the same data center and regions as different
datacenters.
</p>
        <p>
Companies like Twitter, Reddit, Foursquare, Tekpub, Quora and others all deployed
their solutions to the same Amazon region - for example - North Virginia and were
thus susceptive to problems within <strong>that specific datacenter</strong>. They
could have replicated across different AWS regions, but did not.
</p>
        <p>
Thus, clouds <strong>will fail</strong>. It's only a matter of time. They will go
down. The main thing clouds deliver is a lower probability of failure, not its elimination.
Thinking that cloud computing will solve the industry's fears on losing data or deliver
100% uptime is downright imaginary.
</p>
        <p>
Take a look at <a href="http://aws.amazon.com/ec2-sla">EC2's SLA</a>. It says 99.95%
availability. Microsoft's <a href="http://www.microsoft.com/windowsazure/sla">Azure
SLA</a>? 99.9%. That's approximately +- 7 hours of downtime built in! And we didn't
even start to discuss how much junk marketing people will sell.
</p>
        <p>
We are still in <strong>IaaS</strong> world, although companies are really pushing <strong>PaaS</strong> and <strong>SaaS</strong> hard.
Having said that, <a href="http://www.microsoft.com/windowsazure">Windows Azure</a>'s
goal of 'forget about it, we will save you anyway' currently has a lot more merit
that other offerings. It is indeed trying to go the PaaS and SaaS route while abstracting
the physical machines, racks and local/private datacenters.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=1223a8d2-9408-4bcd-929a-283eecd0b1a4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>P != NP Proof Failing</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f.aspx</id>
    <published>2018-08-19T22:31:28.877+02:00</published>
    <updated>2025-12-11T22:06:06.4055153+01:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of the most important steps needed for computer science to get itself to the next
level seems to be fading away.
</p>
        <p>
          <img border="1" src="images/pnpproof.png" />
        </p>
        <p>
          <a href="http://en.wikipedia.org/wiki/P_versus_NP_problem">P vs NP</a>
        </p>
        <p>
Actually, its proof is playing <a href="http://rjlipton.wordpress.com/2010/08/15/the-p%e2%89%a0np-proof-is-one-week-old/">hard
to catch</a> again. This question (whether P = NP or P != NP) does not want to be
answered. It could be, that the problem of proving it is also <a href="http://en.wikipedia.org/wiki/NP-complete">NP-complete</a>.
</p>
        <p>
The (scientific) community <strike>wants</strike> needs closure. If P != NP would
be proven, a lot of orthodox legislature in PKI, cryptography and signature/timestamp
validity would probably become looser. If P=NP is true, well, s*!t hits the fan.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e30eb5c0-f98a-4f4e-ab41-0b7d431baf4f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Debugging Windows Azure DevFabric HTTP 500 Errors</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,efe64356-5657-4e26-b145-8abed9feb6aa.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,efe64356-5657-4e26-b145-8abed9feb6aa.aspx</id>
    <published>2017-04-10T16:04:49.18+02:00</published>
    <updated>2025-12-11T22:10:29.8723914+01:00</updated>
    <category term=".NET 4.0 - WCF" label=".NET 4.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET40WCF.aspx" />
    <category term="Windows Azure" label="Windows Azure" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsAzure.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
While developing with <a href="https://www.windowsazure.com/">Windows Azure</a> SDK
and local Azure development fabric, when things go wrong, they go really wrong.
</p>
        <p>
It could something as obscure as leaving an empty <font face="Courier New"><configSections /></font> element somewhere in <font face="Courier New">Web.config</font> or a certificate
issue.
</p>
        <p>
The problem is, that before Visual Studio attaches a debugger into a IIS worker process,
a lot of things can go wrong. What you get, it this:
</p>
        <p>
          <img border="0" src="content/binary/AzureDebugFail.png" />
        </p>
        <p>
There's no <strong>Event Log</strong> entry, nothing in a typical dev fabric temp
folder (always, check <font face="Courier New">'C:\Users\<useraccount>
\AppData\Local\Temp\Visual Studio Web Debugger.log'
</useraccount></font> first), nada.
</p>
        <p>
Poking deeper, what you need to do is allow IIS to respond properly. By default IIS
only displays complete error details for local addresses. So, to get a detailed report
you need to use a local address.
</p>
        <p>
You can get a local address by fiddling with the site binding with IIS Manager and
changing what Azure SDK does, so: 
</p>
        <ul>
          <li>
First, start IIS Management Console.</li>
          <li>
Then right click on your <font face="Courier New">deployment(*).*</font> and select <font face="Courier New"> Edit
Bindings</font>.</li>
          <li>
Select <font face="Courier New">All Unassigned</font></li>
        </ul>
        <p>
          <img border="0" src="content/binary/AzureDebugFail21.png" />
        </p>
        <p>
If you hit your web / service role using the new local address (could be something
like <font face="Courier New"><a href="http://127.0.0.1:82">http://127.0.0.1:82</a></font>),
you are most likely getting the full disclosure, like this:
</p>
        <p>
          <img border="0" src="content/binary/AzureDebugFail3.png" />
        </p>
        <p>
In this case, a service was dispatched into dev fabric, which had an empty <font face="Courier New"><configSections /></font> element somewhere in <font face="Courier New">Web.config</font>. The web role
was failing before Visual Studio could attach a debugger, and only <font face="Courier New">HTTP
500</font> was returned through normal means of communication.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=efe64356-5657-4e26-b145-8abed9feb6aa" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The Case of Lightweight Azure MMC Snap-In Not Installing on Azure SDK 1.6</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,5f21919f-1068-40ca-acf9-61352524b06b.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,5f21919f-1068-40ca-acf9-61352524b06b.aspx</id>
    <published>2016-03-26T11:36:53.349+01:00</published>
    <updated>2023-01-22T10:59:44.0184005+01:00</updated>
    <category term="Windows Azure" label="Windows Azure" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsAzure.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are a couple of Windows Azure management tools, scripts and PowerShell commandlets
available, but I find <a href="http://wapmmc.codeplex.com">Windows Azure Platform
Management Tool</a> (MMC snap-in) one of the easiest to install and use for different
Windows Azure subscriptions.
</p>
        <p>
The problem is the tool has not been updated for almost a year and is this failing
when you try to install it on the latest Windows Azure SDK (currently v1.6).
</p>
        <p>
          <a href="http://wapmmc.codeplex.com/workitem/7624">Here</a>'s the solution.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=5f21919f-1068-40ca-acf9-61352524b06b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The Case of Guest OS Versioning in Windows Azure</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,f0b41f3b-6c0f-430b-8a6e-043e48a5712b.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,f0b41f3b-6c0f-430b-8a6e-043e48a5712b.aspx</id>
    <published>2013-03-31T22:40:01.334+02:00</published>
    <updated>2025-12-11T23:17:06.5365034+01:00</updated>
    <category term="Windows Azure" label="Windows Azure" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsAzure.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There's a notion of Windows Guest OS versions in Windows Azure. Guest OS versions
can actually be (in Q1 2012) either a stripped down version of <strong>Windows Server
2008</strong> or a similiar version of <strong>Windows Server 2008 R2</strong>.
</p>
        <p>
You can upgrade your guest OS in <a href="http://windows.azure.com">Windows Azure
Management Portal</a>:
</p>
        <p align="left">
          <img border="1" src="content/binary/AzureGuestOSs.png" />
        </p>
        <p>
Not that it makes much difference, especially while developing .NET solutions, but
I like to be on the newest OS version all the time.
</p>
        <p>
The problem is that the defaults are stale. In 1.6 version of the Windows Azure SDK,
the default templates all specify the following:
</p>
        <p>
          <font face="Courier New">ServiceConfiguration serviceName="YourServiceName"<br />
xmlns="</font>
          <font face="Courier New">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"</font>
          <font face="Courier New">"<br /><strong>osFamily="1"</strong><br />
osVersion="*"&gt;<br />
...<br />
ServiceConfiguration </font>
        </p>
        <p>
The <font face="Courier New">osFamily</font> attribute defines OS version, with <font face="Courier New">1</font> being
Windows Server 2008 and <font face="Courier New">2</font> being Windows Server 2008
R2. If you omit the <font face="Courier New">osFamily</font> attribute, the default
is <font face="Courier New">1</font> too! Actually this attribute <em>should </em>probably
move to the <font face="Courier New">Role</font> element, since it defines the version
of the role's guest OS.
</p>
        <p>
          <font face="Courier New">ServiceConfiguration serviceName="YourServiceName"<br />
xmlns="</font>
          <font face="Courier New">http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration"</font>
          <font face="Courier New">osFamily="1" 
<br />
osVersion="*"&gt; 
<br /><strong>Role name="YourRoleName1"</strong><br />
instances count="2" 
<br />
... </font>
          <font face="Courier New">
            <br />
            <strong>Role</strong>
            <br />
Role name="YourRoleName2" 
<br />
Instances count="1" 
<br />
... 
<br />
Role 
<br />
ServiceConfiguration </font>
        </p>
        <p>
It doesn't make sense to have it normalized over all roles. Also, this schema makes
it impossible to leave it out in VM role instances, where it gets ignored.
</p>
        <p>
The <font face="Courier New">osVersion</font> attribute defines the version which
should be deployed for your guest OS. The format is <font face="Courier New">*</font> or <font face="Courier New">WA-GUEST-OS-M.m_YYYYMM-nn</font>.
You should <em>never </em>use the latter one. Asterisk, normally, means 'please upgrade
all my instances automatically'. Asterisk <em>is your friend</em>.
</p>
        <p>
If you <strong>want/need Windows Server 2008 R2</strong>, change it in your service
configuration XML.
</p>
        <p>
What this means is, that even if you publish and upgrade your guest OS version in
the <a href="http://windows.azure.com">Azure Management Portal</a>, you will get reverted
the next time you update your app from within Visual Studio.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=f0b41f3b-6c0f-430b-8a6e-043e48a5712b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bleeding Edge: Pub/Sub Broker Design</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,7af864af-2514-4b2e-861f-ec58fabb0df9.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,7af864af-2514-4b2e-861f-ec58fabb0df9.aspx</id>
    <published>2011-10-05T11:17:31.644+02:00</published>
    <updated>2025-12-11T22:06:42.8583236+01:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <category term=".NET 4.0 - WCF" label=".NET 4.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET40WCF.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is the content from my <a href="http://www.bleedingedge.si">Bleeding Edge</a> talk
on <strong>pub/sub broker</strong> design and implementation.
</p>
        <p align="left">
          <img src="images/be2011logo.png" />
        </p>
        <p>
Due to constraints of the project (European Commission, funded by EU) I cannot publicly
distribute the implementation code at this time. <strike>I plan to do it after the
review process is done.</strike> It has been advised, that this probably won't be
the case.
</p>
        <p>
Specifically, this is:
</p>
        <ul>
          <li>
A message based pub/sub broker 
</li>
          <li>
Can use typed messages 
</li>
          <li>
Can be extended 
</li>
          <li>
Can communicate with anyone 
</li>
          <li>
Supports push and pull models 
</li>
          <li>
Can call you back 
</li>
          <li>
Service based 
</li>
          <li>
Fast (in memory) 
</li>
          <li>
Is currently fed by the Twitter gardenhose stream, for your pleasure</li>
        </ul>
        <p>
Anyway, I can discuss the implementation and design decisions, so here's the PPT (in
slovene only).
</p>
        <p>
Downloads: <a href="http://downloads.request-response.com/be2011ppt.zip">Bleeding
Edge 2011, PPTs</a><br />
Demo front-end: <a href="http://pubsub.gama-system.com/reflex/client">Here</a></p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=7af864af-2514-4b2e-861f-ec58fabb0df9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>The Case of Empty OptionalFeatures.exe Dialog</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,37ac3935-a80f-4f57-b194-d830781002e1.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,37ac3935-a80f-4f57-b194-d830781002e1.aspx</id>
    <published>2011-06-07T08:57:17.147+02:00</published>
    <updated>2011-06-07T09:04:53.9068603+02:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Windows 7" label="Windows 7" scheme="https://www.request-response.com/blog/CategoryView,category,Windows7.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
The following is a <strong>three day</strong> saga of empty 'Turn Windows Features
on or off' dialog.
</p>
        <p>
This dialog, as unimportant as it may seem, is the only orifice into Windows subsystem
installations without having to cramp up command line <font face="Courier New">msiexec.exe</font> wizardry
on obscure system installation folders that nobody wants to understand.
</p>
        <p>
Empty, it looks like this:
</p>
        <p>
          <img src="images/optfeatures.png" />
        </p>
        <p>
First thing anyone should do when it comes to something obscure like this is:
</p>
        <ol>
          <li>
Reinstall the OS (kidding, but would help) 
</li>
          <li>
In-place upgrade of the OS (kidding, but would help faster) 
</li>
          <li>
Clean reboot (really, but most probably won't help) 
</li>
          <li>
Run <font face="Courier New">chkdsk /f</font> and <font face="Courier New">sfc /scannow</font> (really) 
</li>
          <li>
If that does not help, proceed below</li>
        </ol>
        <p>
If you still can't control your MSMQ or IIS installation, then you need to find out
which of the servicing packages got corrupted somehow.
</p>
        <p>
Servicing packages are Windows Update MSIs, located in hell under <font face="Courier New">HKLM/Software/Microsoft/Windows/CurrentVersion/Component
Based Servicing/Packages</font>. I've got a <strong>couple thousand</strong> under
there, so the only question is how to get to rough one out of there.
</p>
        <p>
There's a tool, called <strong>System Update Readiness Tool</strong> [<a href="http://support.microsoft.com/kb/947821">here</a>]
that nobody uses. Its side effect is that it checks peculiarities like this. Run it,
then unleash <font face="Courier New">notepad.exe</font> on <font face="Courier New">C:\Windows\Logs\CBS\CheckSUR.log</font> and
find something like this:
</p>
        <p>
          <font face="Courier New">Checking Windows Servicing Packages</font>
        </p>
        <p style="MARGIN-RIGHT: 0px" dir="ltr">
          <font face="Courier New">Checking Package Manifests and Catalogs<br />
(f) CBS MUM Corrupt 0x800F0900 servicing\Packages\<br />
Package_4_for_KB2446710~31bf3856ad364e35~amd64~~6.1.1.3.mum  Line 1: 
<br /><br />
(f) CBS Catalog Corrupt 0x800B0100 servicing\Packages\<br />
Package_4_for_KB2446710~31bf3856ad364e35~amd64~~6.1.1.3.cat  <br /></font>
          <br />
Then find the package in registry,<em> take ownership of the node</em>, <em>set permissions</em> so
you can delete and <strong><em>delete it</em></strong>. Your <font face="Courier New">OptionalFeatures.exe</font> work
again and it took only 10 minutes.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=37ac3935-a80f-4f57-b194-d830781002e1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Twitter Handle</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,2a6cea4f-1588-4e60-ad2e-766bc439e9b2.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,2a6cea4f-1588-4e60-ad2e-766bc439e9b2.aspx</id>
    <published>2011-03-27T18:54:45.3052868+02:00</published>
    <updated>2011-03-27T18:54:45.3052868+02:00</updated>
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I am more active on <a href="http://www.twitter.com">Twitter</a> lately, finding it
amusing personally.
</p>
        <p>
Handle: <a href="http://twitter.com/matevzg">http://twitter.com/matevzg</a></p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=2a6cea4f-1588-4e60-ad2e-766bc439e9b2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Load Test Tool for Windows Server AppFabric Distributed Cache</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,ba7b66b1-e6c6-4f49-acc0-3a3f7c32cf81.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,ba7b66b1-e6c6-4f49-acc0-3a3f7c32cf81.aspx</id>
    <published>2010-12-09T14:07:25.775+01:00</published>
    <updated>2010-12-10T16:47:36.3471063+01:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <category term="Architecture" label="Architecture" scheme="https://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Microsoft" label="Microsoft" scheme="https://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
During exploration of <a href="http://msdn.microsoft.com/en-us/library/ee790974.aspx">high
availability</a> (HA) features of Windows Server AppFabric <a href="http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx">Distributed
Cache</a> I needed to generate enough load in a short timeframe. You know, to kill
a couple of servers.
</p>
        <p>
This is what came out of it.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/velocitytool.png" />
        </p>
        <p>
It's a simple command line tool, allowing you to:
</p>
        <ul>
          <li>
Add millions of objects of arbitrary size to the cache cluster (using <font face="Courier New">cache.Add()</font>) 
</li>
          <li>
Put objects of arbitraty size to cache cluster 
</li>
          <li>
Get objects back 
</li>
          <li>
Remove objects from cache 
</li>
          <li>
Has cluster support 
</li>
          <li>
Has local cache support 
</li>
          <li>
Will list configuration 
</li>
          <li>
Will max out you local processors (using .NET 4 <font face="Courier New">Parallel.For()</font>) 
</li>
          <li>
Will perform graceously, even in times of trouble</li>
        </ul>
        <p>
I talked about this at a recent <a href="http://slodug.si/blogs/system/archive/2010/12/03/zadnje-leto-nje-sre-anje-slodug-v-sredo-8-12.aspx">Users
Group</a> meeting, doing a live demo of cache clusters under load.
</p>
        <p>
Typical usage scenario is:
</p>
        <ol>
          <li>
Configure a HA cluster<br />
Remember, 3 nodes minimum, Windows Server 2008 (R2) Enterprise or DataCenter 
</li>
          <li>
Configure a HA cache 
</li>
          <li>
Edit <font face="Courier New">App.config</font>, list all available servers 
</li>
          <li>
Connect to cluster 
</li>
          <li>
Put a bunch of large objects (generate load)<br />
Since AppFabric currently supports only partitioned cache type, this will distribute
load among all cluster hosts. Thus, all hosts will store 1/N percent of objects. 
</li>
          <li>
Stop one node 
</li>
          <li>
Get all objects back<br />
Since cache is in HA mode, you will get all your objects back, even though a host
is down - cluster will redistribute all the missing cache regions to running nodes.</li>
        </ol>
        <p>
You can download the tool <a href="http://www.request-response.com/blog/content/binary/appfabriccachetool.zip">here</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ba7b66b1-e6c6-4f49-acc0-3a3f7c32cf81" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Visual Studio: Why this Lack of Pureness Again?</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,535c3bf1-3cd9-4dc8-b555-33cca28b2bd3.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,535c3bf1-3cd9-4dc8-b555-33cca28b2bd3.aspx</id>
    <published>2009-10-24T13:50:47.564+02:00</published>
    <updated>2023-01-24T19:22:10.0693507+01:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Developer pureness is what we should all strive for.
</p>
        <p>
This is not it:
</p>
        <p>
          <img border="1" src="http://www.request-response.com/blog/images/pureness1.png" />
        </p>
        <p>
Conflicting with this:
</p>
        <p>
          <font face="Courier New">[c:\NetFx4\versiontester\bin\debug]corflags VersionTester.exe<br />
Microsoft (R) .NET Framework CorFlags Conversion Tool. Version 3.5.21022.8<br />
Copyright (c) Microsoft Corporation. All rights reserved.</font>
        </p>
        <p>
          <font face="Courier New">
            <strong>
              <font color="#a52a2a">Version : v4.0.21006</font>
            </strong>
            <br />
CLR Header: 2.5<br />
PE : PE32<br />
CorFlags : 1<br />
ILONLY : 1<br />
32BIT : 0<br />
Signed : 0</font>
        </p>
        <p>
Visual Studio must display version number of <strong>4.0</strong> instead of <strong>4</strong> in
RTM. It needs to display major and minor number of the new framework coherently with
2.0, 3.0, 3.5.
</p>
        <p>
Otherwise my compulsive disorder kicks in.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=535c3bf1-3cd9-4dc8-b555-33cca28b2bd3" />
      </div>
    </content>
  </entry>
  <entry>
    <title>ServiceModel: Assembly Size in .NET 4.0</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,817da713-56e2-4595-9b39-ce74ff94537f.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,817da713-56e2-4595-9b39-ce74ff94537f.aspx</id>
    <published>2009-10-24T13:39:05.114+02:00</published>
    <updated>2009-10-25T19:44:29.191+01:00</updated>
    <category term=".NET 4.0 - General" label=".NET 4.0 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET40General.aspx" />
    <category term=".NET 4.0 - WCF" label=".NET 4.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET40WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm just poking around the new framework, dealing with corflags and CLR Header versions
(more on that later), but what I found is the following.
</p>
        <p>
Do a <font face="Courier New">dir *.dll /o:-s</font> in the framework directory. You
get this on .NET FX 4.0 beta 2 box:
</p>
        <p>
          <font face="Courier New">[c:\windows\microsoft.net\framework64\v4.0.21006]dir *.dll
/o:-s</font>
        </p>
        <p>
          <font face="Courier New"> Volume in drive C is 7  Serial number is 1ED5:8CA5<br />
 Directory of  C:\Windows\Microsoft.NET\Framework64\v4.0.21006\*.dll</font>
        </p>
        <p>
          <font face="Courier New"> 7.10.2009 3:44   9.833.784  clr.dll<br /><font color="#a52a2a"><strong> 7.10.2009 2:44   6.072.664  System.ServiceModel.dll</strong></font><br />
 7.10.2009 2:44   5.251.928  System.Windows.Forms.dll<br />
 7.10.2009 6:04   5.088.584  System.Web.dll<br />
 7.10.2009 5:31   5.086.024  System.Design.dll<br />
 7.10.2009 3:44   4.927.808  mscorlib.dll<br />
 7.10.2009 3:44   3.529.608  Microsoft.VB.Activities.Compiler.dll<br />
 7.10.2009 2:44   3.501.376  System.dll<br />
 7.10.2009 2:44   3.335.000  System.Data.Entity.dll<br />
 7.10.2009 3:44   3.244.360  System.Data.dll<br />
 7.10.2009 2:44   2.145.096  System.XML.dll<br />
 7.10.2009 5:31   1.784.664  System.Web.Extensions.dll<br />
 7.10.2009 2:44   1.711.488  System.Windows.Forms.DataVis.dll<br />
 7.10.2009 5:31   1.697.128  System.Web.DataVis.dll<br />
 7.10.2009 5:31   1.578.352  System.Workflow.ComponentModel.dll<br />
 7.10.2009 3:44   1.540.928  clrjit.dll<br />
 7.10.2009 3:44   1.511.752  mscordacwks.dll<br />
 7.10.2009 3:44   1.454.400  mscordbi.dll<br />
 7.10.2009 2:44   1.339.248  System.Activities.Presentation.dll<br />
 7.10.2009 5:31   1.277.776  Microsoft.Build.dll<br />
 7.10.2009 2:44   1.257.800  System.Core.dll<br />
 7.10.2009 2:44   1.178.448  System.Activities.dll<br />
 7.10.2009 5:31   1.071.464  System.Workflow.Activities.dll<br />
 7.10.2009 5:31   1.041.256  Microsoft.Build.Tasks.v4.0.dll<br />
 7.10.2009 2:44   1.026.920  System.Runtime.Serialization.dll</font>
        </p>
        <p>
Funny how many engineer dollars are/were spent on middle tier technologies I love.
</p>
        <p>
Proof: <font face="Courier New">System.ServiceModel.dll</font> is bigger then <font face="Courier New">System.dll</font>, <font face="Courier New">System.Windows.Forms.dll</font>, <font face="Courier New">mscorlib.dll</font>,
and <font face="Courier New">System.Data.dll</font>. 
</p>
        <p>
We only bow to <font face="Courier New">clr.dll</font>, a new .NET 4.0 Common
Language Runtime implementation.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=817da713-56e2-4595-9b39-ce74ff94537f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Talk at Interoperability Day 2009</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,ba451d69-fe26-4881-adf2-dbd802ac8845.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,ba451d69-fe26-4881-adf2-dbd802ac8845.aspx</id>
    <published>2009-06-03T15:23:45.224+02:00</published>
    <updated>2009-10-25T19:47:00.959+01:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Interoperability day is focused on, well, interoperability. Especially between major
vendors in government space.
</p>
        <p>
We talked about major issues in long term document preservation formats and the penetration
of Office serialization in real world...
</p>
        <p>
.. and the lack of support from legislature covering long term electronic document
formats and their use.
</p>
        <p>
Here's the <a href="http://www.request-response.com/blog/content/binary/interopday2009.pptx">PPT</a> [Slovenian].
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ba451d69-fe26-4881-adf2-dbd802ac8845" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Speaking at Document Interop Initiative</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,e75263af-f55d-4b9e-9e70-9c503ae86ce8.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,e75263af-f55d-4b9e-9e70-9c503ae86ce8.aspx</id>
    <published>2009-05-16T20:21:51.331+02:00</published>
    <updated>2009-05-18T12:02:40.905+02:00</updated>
    <category term="Microsoft" label="Microsoft" scheme="https://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
On Monday, 05/18/2009 I'm speaking at <a href="http://www.documentinteropinitiative.org/">Document
Interop Initiative</a> in London, England.
</p>
        <p>
Title of the talk is: <em>High Fidelity Programmatic Access to Document Content</em>,
which will cover the following topics:
</p>
        <ul>
          <li>
Importance of OOXML as a standards based format, especially in technical issues of
long term storage for document content preservation 
</li>
          <li>
Importance of legal long term storage for document formats 
</li>
          <li>
Signature and timestamp benefits of long term XML formats 
</li>
          <li>
Performance and actual cost analysis of using publicly-parsable formats 
</li>
          <li>
Benefits of having a high fidelity programmatic access to document content, backed
with standardization</li>
        </ul>
        <p>
The event is held at Microsoft Limited, Cardinal Place, 100 Victoria Street SW1E 5JL,
London.
</p>
        <p>
Update: Here's the <a href="http://www.request-response.com/blog/content/binary/london2009_may.zip">presentation</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e75263af-f55d-4b9e-9e70-9c503ae86ce8" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Designing Clean Object Models with SvcUtil.exe</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,e855a729-04c4-4504-b20d-037bd13f0ec2.aspx</id>
    <published>2009-04-10T23:06:43.37+02:00</published>
    <updated>2009-04-10T23:06:43.37+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There are a couple situations where one might use <font face="Courier New">svcutil.exe</font> in
command prompt vs. Add Service Reference in Visual Studio.
</p>
        <p>
At <em>least</em> a couple.
</p>
        <p>
I don't know who (or why) made a decision not to support namespace-less proxy generation
in  Visual Studio. It's a fact that if you make a service reference, you <strong>have
to specify a nested namespace</strong>.
</p>
        <p>
On the other end, there is an option to make the proxy class either public or internal,
which enables one to hide it from the outside world.
</p>
        <p>
That's a design flaw. There are numerous cases, where you would not want to create
another [1] namespace, because you are designing an object model that needs to be
clean.
</p>
        <p>
          <font size="1">[1] This is only limited to local type system namespace declarations
- it does not matter what you are sending over the wire.</font>
        </p>
        <p>
Consider the following namespace and class hierarchy that uses a service proxy (<font face="Courier New">MyNamespace.Service</font> class
uses it):
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace4.png" />
        </p>
        <p>
Suppose that the <font face="Courier New">Service</font> class uses a WCF service,
which synchronizes articles and comments with another system. If you use Add Web Reference,
there is no way to hide the generated service namespace. One would probably define <font face="Courier New">MyNamespace.MyServiceProxy</font> as
a namespace and declared a using statement in <font face="Courier New">MyNamespace.MyService</font> scope
with:
</p>
        <p>
          <font face="Courier New">using MyNamespace.MyServiceProxy;</font>
        </p>
        <p>
This results in a dirty object model - your clients will see your internals and that
shouldn't be an option.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace1.png" />
        </p>
        <p>
Your class hierarchy now has another namespace, called <font face="Courier New">MyNamespace.ServiceProxy</font>,
which is actually only used inside the <font face="Courier New">MyNamespace.Service</font> class.
</p>
        <p>
What one can do is insist that the generated classes are marked <font face="Courier New">internal</font>,
hiding the classes from the outside world, but still leaving an empty namespace visible
for instantiating assemblies.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace3.png" />
        </p>
        <p>
Leaving only the namespace visible, with no public classes in it is pure cowardness. 
</p>
        <p>
Not good.
</p>
        <p>
Since there is no <font face="Courier New">internal</font> namespace modifier in .NET,
you have no other way of hiding your namespace, even if you demand internal classes
to be generated by the Add Service Reference dialog.
</p>
        <p>
So, <font face="Courier New">svcutil.exe</font> to the rescue:
</p>
        <p>
          <font face="Courier New">svcutil.exe &lt;metadata endpoint&gt;<br />
   /namespace:*, MyNamespace<br />
   /internal 
<br />
   /out:ServiceProxyClass.cs</font>
        </p>
        <p>
The <font face="Courier New">/namespace</font> option allows you to map between XML
and CLR namespace declarations. The preceding examples maps all (therefore <font face="Courier New">*</font>)
existing XML namespaces in service metadata to <font face="Courier New">MyNamespace</font> CLR
namespace.
</p>
        <p>
The example will generate a service proxy class, mark it <font face="Courier New">internal</font> and
put it into the desired namespace.
</p>
        <p>
Your object model will look like this:
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/namespace2.png" />
        </p>
        <p>
Currently, this is the only way to hide the internals of service communication with
a proxy and still being able to keep your object model clean.
</p>
        <p>
Note that this is useful when you want to wrap an existing service proxy or hide a
certain already supported service implementation detail in your object model. Since
your client code does <em>not need</em> to have access to complete service proxy (or
you want to enhance it), it shouldn't be a problem to hide it completely.
</p>
        <p>
Considering options during proxy generation, per method access modifiers would be
beneficial too.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e855a729-04c4-4504-b20d-037bd13f0ec2" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bug in XmlSerializer, XmlSerializerNamespaces</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,d27d4672-92f5-4944-8fc9-1f7f098d36e9.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,d27d4672-92f5-4944-8fc9-1f7f098d36e9.aspx</id>
    <published>2009-04-06T14:22:33.315+02:00</published>
    <updated>2009-04-06T14:35:05.772+02:00</updated>
    <category term=".NET 3.5 - General" label=".NET 3.5 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET35General.aspx" />
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <font face="Courier New">XmlSerializer</font> is a great peace of technology. Combined
with <font face="Courier New">xsd.exe</font> and friends (<font face="Courier New">XmlSerializerNamespaces</font>,
et al.) it's a powerful tool for one to get around XML instance serialization/deserialization.
</p>
        <p>
But, there is a potentially serious bug present, even in 3.5 SP1 version of the .NET
Framework.
</p>
        <p>
Suppose we have the following XML structure:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header&gt;&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
This tells you that <font face="Courier New">Envelope</font>, and <font face="Courier New">Body</font> elements
are in the same namespace (namely <font face="Courier New">'NamespaceA'</font>), while <font face="Courier New">Header</font> is
qualified with <font face="Courier New">'NamespaceB'</font>.
</p>
        <p>
Now suppose we need to programmatically insert <font face="Courier New">&lt;B:Header&gt;</font> element
into an empty, <em>core</em>, document.
</p>
        <p>
Core document:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
Now do an <font face="Courier New">XmlNode.InsertNode()</font> of the following:
</p>
        <p>
          <font face="Courier New">&lt;B:Header&gt;...&lt;/B:Header&gt;</font>
        </p>
        <p>
We should get:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header&gt;...&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
To get the <em>to be inserted part</em> one would serialize (using <font face="Courier New">XmlSerializer</font>)
the following <font face="Courier New">Header</font> document:
</p>
        <p>
          <font face="Courier New">&lt;B: Header xmlns:B="NamespaceB"&gt;<br />
  ...<br />
&lt;/B:Header&gt;</font>
        </p>
        <p>
To do this, a simple <font face="Courier New">XmlSerializer</font> magic will do the
trick:
</p>
        <p>
          <font face="Courier New">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add("B", "NamespaceB");</font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer xSer = new XmlSerializer(typeof(Header));<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, h, xsn);</font>
        </p>
        <p>
          <font face="Courier New">ms.Seek(0, SeekOrigin.Begin);</font>
        </p>
        <p>
          <font face="Courier New">XmlDocument doc = new XmlDocument()<br />
doc.Load(ms);<br />
ms.Close();</font>
        </p>
        <p>
This would generate exactly what we wanted. A prefixed namespace based XML document,
with the <font face="Courier New">B</font> prefix bound to <font face="Courier New">'NamespaceB'</font>.
</p>
        <p>
Now, if we would import this document fragment into our core document using <font face="Courier New">XmlNode.ImportNode()</font>,
we would get:
</p>
        <p>
          <font face="Courier New">&lt;Envelope xmlns="NamespaceA" 
<br />
          xmlns:B="NamespaceB"&gt;<br />
  &lt;B:Header <font color="#ff0000">xmlns:B="NamespaceB"</font>&gt;...&lt;/B:Header&gt;<br />
  &lt;Body&gt;&lt;/Body&gt;<br />
&lt;/Envelope&gt;</font>
        </p>
        <p>
Which is valid and actually, from an XML Infoset view, an <em>isomorphic</em> document
to the original. So what if it's got the same namespace declared twice, right?
</p>
        <p>
Right - until you involve digital signatures. I have described a specific problem
with ambient namespaces in length in this blog entry: <a href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx">XmlSerializer,
Ambient XML Namespaces and Digital Signatures</a>.
</p>
        <p>
When importing a node from another context, <font face="Courier New">XmlNode</font> and
friends do a resolve against all namespace declarations in scope. So, when importing
such a header, <strong>we shouldn't get</strong> a duplicate namespace declaration.
</p>
        <p>
The problem is, we don't get a duplicate namespace declaration, since <font face="Courier New">XmlSerializer</font> actually
inserts a normal XML attribute into the <font face="Courier New">Header</font> element.
That's why we <strong>seem to get</strong> another namespace declaration. It's actually
not a declaration but a plain old attribute. It's even visible (in this
case in <font face="Courier New">XmlElement.Attributes</font>), and it definitely
shouldn't be there.
</p>
        <p>
So if you hit this special case, remove all attributes before importing the node into
your core document. Like this:
</p>
        <p>
          <font face="Courier New">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add("B", "NamespaceB");</font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer xSer = new XmlSerializer(typeof(Header));<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, h, xsn);</font>
        </p>
        <p>
          <font face="Courier New">ms.Seek(0, SeekOrigin.Begin);</font>
        </p>
        <p>
          <font face="Courier New">XmlDocument doc = new XmlDocument()<br />
doc.Load(ms);<br />
ms.Close();<br /><font color="#ff0000">doc.DocumentElement.Attributes.RemoveAll();</font></font>
        </p>
        <p>
Note that the <strong>serialized document representation will not change</strong>,
since an ambient namespace declaration (B linked to 'NamespaceB') still exists in
the XML Infoset of <font face="Courier New">doc</font> XML document.<br /></p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=d27d4672-92f5-4944-8fc9-1f7f098d36e9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>DOW(n)</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,98b65bd1-31fc-4a88-88d4-b8276d119ea1.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,98b65bd1-31fc-4a88-88d4-b8276d119ea1.aspx</id>
    <published>2008-10-09T22:29:37.728+02:00</published>
    <updated>2008-10-09T22:30:13.656+02:00</updated>
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://en.wikipedia.org/wiki/Dow_Jones_Industrial_Average">DOW</a> is down
almost 700, again. And...
</p>
        <p>
... I just have to post this. Especially when almost everything (besides devaluation
of <em>the safe currency</em>) has already been done.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>If you had bought $1,000.00 of </em>
            <a href="http://nortel.com/" target="beer">
              <em>Nortel</em>
            </a>
            <em> stock
one year ago, it would now be worth $49.00.<br /><br />
With </em>
            <a href="http://www.enron.com/" target="beer">
              <em>Enron</em>
            </a>
            <em>, you
would have $16.50 of the original $1,000.00.<br /><br />
With </em>
            <a href="http://www.mci.com/" target="beer">
              <em>MCI/Worldcom</em>
            </a>
            <em>,
you would have less than $5.00 left.<br /><br />
If you had bought $1,000.00 worth of </em>
            <a href="http://www.mgd.com/" target="beer">
              <em>Miller
Genuine Draft</em>
            </a>
            <em> (the beer, not the stock) one year ago, drunk all the beer
then turned in the cans for the 10-cent deposit, you would have $214.00.<br /><br />
Based on the above, 401KegPlan.com's current investment advice is to take that $5.00
you have left over and </em>
            <a href="http://www.sotallytober.com/beer/" target="morebeer">
              <em>drink
lots and lots of beer</em>
            </a>
            <em> and recycle.</em>
          </p>
          <p>
            <em>
              <font color="#808080" size="1">Via: </font>
              <a href="http://401kegplan.com/keg/">
                <font color="#808080" size="1">http://401kegplan.com/keg/</font>
              </a>
            </em>
          </p>
        </blockquote>
        <p>
We are going over the edge. <em>We</em> as a world economy.
</p>
        <p>
And yea, I opened a keg of Guinness.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=98b65bd1-31fc-4a88-88d4-b8276d119ea1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bleeding Edge 2008: Postback</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,3e45c176-f86b-4b60-b0a5-9425631e2438.aspx</id>
    <published>2008-10-09T21:42:02.568+02:00</published>
    <updated>2008-10-09T21:42:02.568+02:00</updated>
    <category term="CLR" label="CLR" scheme="https://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="Conferences" label="Conferences" scheme="https://www.request-response.com/blog/CategoryView,category,Conferences.aspx" />
    <category term="Microsoft" label="Microsoft" scheme="https://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm sorry it took a week, but here we go.
</p>
        <p>
This is my exit content from <a href="http://www.bleedingedge.si/">Bleeding Edge 2008</a>.
I'm also posting complete conference contents, just in case.
</p>
        <p>
          <img src="http://www.request-response.com/blog/content/binary/be2008.jpg" />
        </p>
        <p>
Thanks go out to <a href="http://blogs.solidq.com/EN/dzupancic/default.aspx">Dušan</a>, <a href="http://blogs.solidq.com/EN/dsarka/default.aspx">Dejan</a>, <a href="http://www.mihavalencic.com/?p=124">Miha</a>, <a href="http://cs.rthand.com/blogs/blog_with_righthand/archive/2008/10/03/Material-from-my-_2200_Make-ORM-applications-more-secure_2F00_Naredimo-ORM-aplikacije-varnej_6101_e_2200_-presentation.aspx">Miha</a> and <a href="http://www.krneki.net/blog/">Miha</a>.
</p>
        <p>
Downloads:
</p>
        <ul>
          <li>
Middle Tier Design Unleashed: <a href="http://downloads.request-response.com/BleedingEdge2008_MiddleTier.zip">PPT
&amp; Code</a></li>
          <li>
Complete Conference: <a href="http://downloads.request-response.com/BleedingEdge2008.zip">PPT
&amp; Code</a></li>
        </ul>
        <p>
          <font color="#808080" size="1">Remark: PPT in Slovene only. Code international.</font>
        </p>
        <p>
Thank you for attending. Hope to see you next year!
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3e45c176-f86b-4b60-b0a5-9425631e2438" />
      </div>
    </content>
  </entry>
  <entry>
    <title>XmlSerializer: Serialized Syntax and How to Override It</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,efa4e231-ddf1-48f4-9a26-54363e799d42.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,efa4e231-ddf1-48f4-9a26-54363e799d42.aspx</id>
    <published>2008-08-29T20:38:07.673+02:00</published>
    <updated>2008-08-29T21:03:06.694+02:00</updated>
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Recently I needed to specify exactly how I would like a <em>specific class</em> serialized.
Suppose we have the following simple schema:
</p>
        <p>
          <font face="Courier New">&lt;xs:schema targetNamespace="</font>
          <font face="Courier New">http://my.favourite.ns/person.xsd</font>
          <font face="Courier New">"<br />
   elementFormDefault="qualified"<br />
   xmlns:xs="</font>
          <font face="Courier New">http://www.w3.org/2001/XMLSchema</font>
          <font face="Courier New">"<br />
   </font>
          <font face="Courier New">xmlns="</font>
          <font face="Courier New">http://my.favourite.ns/person.xsd"</font>
          <font face="Courier New">&gt;<br /><strong>  &lt;xs:complexType name="Person"&gt;</strong><br />
    &lt;xs:sequence&gt;<br />
      &lt;xs:element name="Name" type="xs:string" /&gt;<br />
      &lt;xs:element name="Surname" type="xs:string" /&gt;<br />
      &lt;xs:element name="Age" type="xs:int" minOccurs="0"
/&gt;<br />
    &lt;/xs:sequence&gt;<br /><strong>  &lt;/xs:complexType&gt;<br /></strong>&lt;/xs:schema&gt;</font>
        </p>
        <p>
Let's call this schema <font face="Courier New">President.xsd</font>.
</p>
        <p>
A valid XML instance against this schema would be, for example:
</p>
        <p>
          <font face="Courier New">&lt;Person xmlns="http://my.favourite.ns/person.xsd"&gt;<br />
   &lt;Name&gt;Barrack&lt;/Name&gt;<br />
   &lt;Surname&gt;Obama&lt;/Surname&gt;<br />
   &lt;Age&gt;47&lt;/Age&gt;<br />
&lt;/Person&gt;</font>
        </p>
        <p>
Since we are serializing against a specific <a href="http://www.w3.org/XML/Schema">XML
schema</a> (XSD), we have an option of schema compilation:
</p>
        <p>
          <font face="Courier New">xsd /c President.xsd</font>
        </p>
        <p>
This, obviously, yields a programmatic type system result in a form of a C# class.
All well and done.
</p>
        <p>
Now.
</p>
        <p>
If we serialize the filled up class instance back to XML, we get a valid XML instance.
It's valid against <font face="Courier New">President.xsd</font>.
</p>
        <p>
There is a case where your schema changes ever so slightly - read, the namespaces
change, and you don't want to recompile the entire solution to support this, but you
still want to use XML serialization. Who doesn't - what do you do?
</p>
        <p>
Suppose we want to get <strong>the following back</strong>, when serializing:
</p>
        <p>
          <font face="Courier New">&lt;PresidentPerson xmlns="</font>
          <font face="Courier New">http://schemas.gama-system.com/<br />
      president.xsd"</font>
          <font face="Courier New">&gt;<br />
   &lt;Name&gt;Barrack&lt;/Name&gt;<br />
   &lt;Surname&gt;Obama&lt;/Surname&gt;<br />
   &lt;Age&gt;47&lt;/Age&gt;<br />
&lt;/PresidentPerson&gt;</font>
        </p>
        <p>
There is an option to override the default serialization technique of <font face="Courier New">XmlSerializer</font>.
Enter  the world of <font face="Courier New">XmlAttributes</font> and <font face="Courier New">XmlAttributeOverrides</font>:
</p>
        <p>
          <font face="Courier New">private XmlSerializer GetOverridedSerializer()<br />
{<br />
   // set overrides for person element<br />
   XmlAttributes attrsPerson = new XmlAttributes();<br />
   XmlRootAttribute rootPerson = 
<br />
      new XmlRootAttribute("<strong>PresidentPerson</strong>");<br />
   rootPerson.Namespace = "</font>
          <font face="Courier New">
            <strong>http://schemas.gama-system.com/<br />
      president.xsd</strong>
          </font>
          <font face="Courier New">";<br />
   attrsPerson.XmlRoot = rootPerson;</font>
        </p>
        <p>
          <font face="Courier New">   // create overrider<br />
   XmlAttributeOverrides xOver = new XmlAttributeOverrides();<br />
   xOver.Add(typeof(Person), attrsPerson);</font>
        </p>
        <p>
          <font face="Courier New">   XmlSerializer xSer = new XmlSerializer(typeof(Person),
xOver);<br />
   return xSer;<br />
}</font>
        </p>
        <p>
Now serialize normally:
</p>
        <p>
          <font face="Courier New">Stream ms = new MemoryStream();<br />
XmlTextWriter tw = new XmlTextWriter(ms, null);<br />
xSer.Serialize(tw, person);</font>
        </p>
        <p>
This will work even if you only have a compiled version of your object graph, and
you don't have any sources. <font face="Courier New">System.Xml.Serialization.XmlAttributeOverrides</font> class
allows you to adorn any XML serializable class with your own XML syntax - element
names, attribute names, namespaces and types.
</p>
        <p>
Remember - you can override them all and <em>still</em> serialize <em>your</em> angle
brackets.<br /></p>
        <br />
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=efa4e231-ddf1-48f4-9a26-54363e799d42" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Bleeding Edge 2008</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,b6565ebe-4d35-4676-a09e-08b84b6554b1.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,b6565ebe-4d35-4676-a09e-08b84b6554b1.aspx</id>
    <published>2008-07-17T15:50:06.688+02:00</published>
    <updated>2008-07-28T19:37:27.603+02:00</updated>
    <category term="Architecture" label="Architecture" scheme="https://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Conferences" label="Conferences" scheme="https://www.request-response.com/blog/CategoryView,category,Conferences.aspx" />
    <category term="MVP" label="MVP" scheme="https://www.request-response.com/blog/CategoryView,category,MVP.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm happy to announce <a href="http://blogs.solidq.com/EN/dsarka/Lists/Posts/Post.aspx?ID=119">our</a> organization
work is coming to fruition.
</p>
        <p>
          <a href="http://www.bleedingedge.si">Bleeding Edge 2008</a> is taking the stage for
the autumn season.
</p>
        <p>
          <strong>
            <img src="http://www.request-response.com/blog/content/binary/be2008.jpg" />
            <br />
          </strong>
          <strong>Portorož, Slovenia, October 1<sup>st</sup>, 9:00</strong>
        </p>
        <p>
          <a href="http://www.bleedingedge.si">Official site</a>, <a href="http://www.bleedingedge.si/prijava.html">Registration</a>, <a href="http://www.bleedingedge.si/sponzorji.html">Sponsors</a></p>
        <p>
Go for the early bird registration (till September 12<sup>th</sup>). The time is now.
</p>
        <p>
Potential sponsor? <a href="http://www.bleedingedge.si/sponzorji.html">Here</a>'s
the offering.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b6565ebe-4d35-4676-a09e-08b84b6554b1" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Accreditus: Gama System eArchive</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0.aspx</id>
    <published>2008-07-05T14:18:06.428+02:00</published>
    <updated>2008-07-07T10:40:20.4687479+02:00</updated>
    <category term=".NET 3.0 - General" label=".NET 3.0 - General" scheme="https://www.request-response.com/blog/CategoryView,category,NET30General.aspx" />
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
One of our core products, <a href="http://gama-system.com/Content.aspx?id=20050200">Gama
System eArchive</a> was <a href="http://www.merriam-webster.com/dictionary/accredit">accredited</a> last
week.
</p>
        <p>
This is <strong>the first accreditation</strong> of a domestic product and <strong>the
first one</strong> covering long term electronic document storage in a SOA based system.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>Every document stored inside the Gama System eArchive product is now legally legal.
No questions asked.</em>
          </p>
        </blockquote>
        <p>
Accreditation is done by a <a href="http://www.arhiv.gov.si/en/">national body</a> and
represents the last step in a formal acknowledgement to holiness.
</p>
        <p align="center">
          <img src="http://www.request-response.com/blog/content/binary/archive1.jpg" />
        </p>
        <p>
That means a lot to me, even more to <a href="http://www.gama-system.si">our company</a>.
</p>
        <p>
The following blog entries were (in)directly inspired by the development of this product:
</p>
        <ul>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx">Laws
and Digital Signatures</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx">Reliable
Messaging and Retry Timeouts</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx">Approaches
to Document Style Parameter Models</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx">XmlSerializer,
Ambient XML Namespaces and Digital Signatures</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,f731e5cc-9490-4f1e-bc7d-efb91f357cd1.aspx">Security
Sessions and Service Throttling</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,a6cb59e6-cbc2-4ce3-92b2-ea40bc5929f6.aspx">Reliable
Message Delivery</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,aa617aa7-1073-422c-86f5-deaaa0758e7d.aspx">Reliable
Message Delivery Continued</a>
          </li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,03fb0e40-b446-42b5-ad90-3be9b0260cb5.aspx">Durable
Reliable Messaging</a>
          </li>
        </ul>
        <p>
We've made <strong>a lot of effort</strong> to get this thing developed and accredited.
The certificate is <a href="http://www.request-response.com/blog/content/binary/e_ars_2007_003.pdf">here</a>.
</p>
        <p>
          <a href="http://www.arhiv.gov.si/si/e_hramba_dokumentarnega_gradiva/akreditacija/register_akreditirane_opreme_in_storitev">This</a>, <a href="http://www.posta.si/Namizje.aspx?tabid=746">this</a>, <a href="http://www.agencijanet.si/gama-system-e-arhiv-inovacija-leta-med-malimi-in-srednjimi-podjetji/">this</a>, <a href="http://finance.si/214263">this</a>, <a href="http://www.mojmikro.si/mreza/po_slovensko/ucinkovito_upravljanje_dokumentov_in_varna_e-hramba_podatkov">this</a>, <a href="http://mladipodjetnik.si/arhiv/novice/clani-tehnoloskega-parka-ljubljana-izbrani-med-10-najbolj-inovativnih-podjetij-v-sloveniji">this</a>, <a href="http://www.mojmikro.si/news/gama_system_pricakuje_preboj_med_svetovno_elito">this</a>, <a href="http://www.imix.ba/">this</a>, <a href="http://www.ashrafcom.com/edoc.htm">this</a> and <a href="http://www.si21.com/news.php?id=62696">t</a><a href="http://download.microsoft.com/download/7/D/E/7DE50907-87DD-4FFB-B10F-44A891EB49EC/cs_posta-slovenije-arhiviranje.doc">h</a><a href="http://www.agencijanet.si/slovenska-podjetja-na-cebit-u-2008/">o</a><a href="http://download.microsoft.com/download/F/2/4/F248F674-5D6E-430D-9C31-76546D57C2A3/CS%20Posta%20CEP.DOC">s</a><a href="http://www.agencijanet.si/matevzu-gacniku-ze-tretjic-mandat-microsoftovega-regionalnega-direktorja/">e</a> are
direct approvals of our correct decisions.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=dc2c17a8-a37b-4aa5-9e73-b0c55efe22f0" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Sysinternals Live</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,40794232-f39b-4068-a536-23c5b56a9216.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,40794232-f39b-4068-a536-23c5b56a9216.aspx</id>
    <published>2008-06-19T19:52:52.954+02:00</published>
    <updated>2008-06-19T19:56:17.398+02:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is <strong>brilliant</strong>.
</p>
        <p>
          <a href="http://technet.microsoft.com/en-us/sysinternals">Sysinternals</a> tools are
now (actually were already when I left for vacation) available live via a web (http
and <strong>WebDAV</strong>) based resource on <font face="Courier New"><a href="http://live.sysinternals.com">http://live.sysinternals.com</a></font><font face="Verdana">and </font><font face="Courier New">\\live.sysinternals.com</font>.
</p>
        <p>
This means I can do the following:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <font face="Courier New">[c:\]dir </font>
            <font face="Courier New">\\live.sysinternals.com\tools</font>
          </p>
          <p>
            <font face="Courier New"> Directory of  </font>
            <font face="Courier New">\\live.sysinternals.com\tools\</font>
            <font face="Courier New">*</font>
          </p>
          <p>
            <font face="Courier New"> 2.06.2008   1:16        
&lt;DIR&gt;    .<br />
 2.06.2008   1:16         &lt;DIR&gt;   
..<br />
 2.06.2008   1:16         &lt;DIR&gt;   
WindowsInternals<br />
30.05.2008  17:55            
668  About_This_Site.txt<br />
13.05.2008  19:00         225.320 
accesschk.exe<br />
 1.11.2006  15:06         174.968 
AccessEnum.exe<br />
 1.11.2006  23:05         121.712 
accvio.EXE<br />
12.07.2007   7:26         
50.379  AdExplorer.chm<br />
26.11.2007  14:21         422.952 
ADExplorer.exe<br />
 7.11.2007  11:13         401.616 
ADInsight.chm<br />
20.11.2007  14:25       1.049.640  ADInsight.exe<br />
 1.11.2006  15:05         150.328 
adrestore.exe<br />
 1.11.2006  15:06         154.424 
Autologon.exe<br />
 8.05.2008  10:20         
48.476  autoruns.chm<br />
12.05.2008  17:31         622.632 
autoruns.exe 1.11.2006  <br />
...<br />
 1.11.2006  15:06         207.672 
Winobj.exe<br />
30.12.1999  12:26          
7.653  WINOBJ.HLP<br />
27.05.2008  16:21         142.376 
ZoomIt.exe<br />
     24.185.901 bytes in 103 files and 3 dirs<br />
109.442.727.936 bytes free</font>
          </p>
        </blockquote>
        <p dir="ltr">
Or, I can fire up a Windows Explorer window (or <strong>press the start key</strong>,
then type) and just type: <font face="Courier New">\\live.sysinternals.com\tools</font>.
</p>
        <p dir="ltr">
Or:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p dir="ltr">
            <font face="Courier New">[c:\]copy </font>
            <font face="Courier New">\\live.sysinternals.com\tools\Procmon.exe</font>
            <font face="Courier New">
              <br />
        C:\Windows\System32<br /></font>
            <font face="Courier New">\\live.sysinternals.com\tools\Procmon.exe</font>
            <font face="Courier New"> =&gt; 
<br />
        C:\Windows\System32\Procmon.exe<br />
     1 file copied</font>
          </p>
        </blockquote>
        <p dir="ltr">
Brilliant and useful.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=40794232-f39b-4068-a536-23c5b56a9216" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Demos from the NT Conference 2008</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95.aspx</id>
    <published>2008-05-15T17:24:19.828+02:00</published>
    <updated>2008-05-21T17:08:27.3461229+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Transactions" label="Transactions" scheme="https://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
As promised, here are the sources from my <a href="http://www.ntk.si">NTK 2008</a> sessions <font size="1">[1]</font>.
</p>
        <p>
          <strong>Talk: Document Style Service Interfaces</strong>
        </p>
        <p>
Read the following <a href="http://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx">blog
entry</a>, I tried to describe the concept in detail. Also, this <a href="http://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx">blog post</a> discusses
issues when using large document parameters with reliable transport  (WS-RM)
channels.
</p>
        <p>
Demo: Document Style Service Interfaces [<a href="http://www.request-response.com/blog/content/binary/NTK2008DocStyleParamModels.zip">Download</a>]
</p>
        <p>
This demo defines a service interface with the document parameter model, ie. <font face="Courier New">Guid
CreatePerson(XmlDocument person)</font>. It shows three different approaches to creation
of the passed document:
</p>
        <ol>
          <li>
Raw XML creation 
</li>
          <li>
XML Serialization of the (attribute annotated) object graph 
</li>
          <li>
XML Serialization using the <em>client object model</em></li>
        </ol>
        <p>
Also, versioned schemas for the <font face="Courier New">Person</font> document are
shown, including the support for document validation and version independence.
</p>
        <p>
          <strong>Talk: Windows Server 2008 and Transactional NTFS</strong>
        </p>
        <p>
This <a href="http://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx">blog
entry</a> describes the concept.
</p>
        <p>
Demo 1: Logging using CLFS (Common Log File System) [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFCLFS.zip">Download</a>]<br />
Demo 2: NTFS Transactions using the File System, SQL, WCF [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFFSSQLWCF.zip">Download</a>]<br />
Demo 3: NTFS Transactions using the WCF, MTOM Transport [<a href="http://www.request-response.com/blog/content/binary/NTK2008TxFWCFMTOM.zip">Download</a>] <font size="1">[2]</font></p>
        <p>
          <font size="1">[1] All sources are in VS 2008 solution file format.<br />
[2] This transaction spans from the client, through the service boundary, to the server.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a6f0a54f-31ae-4ccd-ad90-fdfbabba5d95" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Laws and Digital Signatures</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,f37eda08-845c-4b0a-a66c-ea9cec03c06b.aspx</id>
    <published>2008-04-16T19:32:29.84+02:00</published>
    <updated>2008-04-16T19:55:33.058875+02:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Suppose we have a document like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;root xmlns="urn-foo-bar"&gt;<br />
  &lt;subroot&gt;<br />
    &lt;value1&gt;value1&lt;/value1&gt;<br />
    &lt;value2&gt;value2&lt;/value2&gt;<br />
  &lt;/subroot&gt;<br />
  &lt;Signature xmlns="h</font>
          <font face="Courier New">ttp://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    &lt;SignedInfo&gt;<br />
      &lt;CanonicalizationMethod 
<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;SignatureMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#rsa-sha1</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;Reference URI=""&gt;<br />
        &lt;Transforms&gt;<br />
          &lt;Transform <br />
            Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/<br />
              xmldsig#enveloped-signature</font>
          <font face="Courier New">"/&gt;<br />
        &lt;/Transforms&gt;<br />
        &lt;DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1</font>
          <font face="Courier New">"
/&gt;<br />
        &lt;DigestValue&gt;1Xp...EOko=&lt;/DigestValue&gt;<br />
      &lt;/Reference&gt;<br />
    &lt;/SignedInfo&gt;<br />
    &lt;SignatureValue&gt;nls...cH0k=&lt;/SignatureValue&gt;<br />
    &lt;KeyInfo&gt;<br />
      &lt;KeyValue&gt;<br />
        &lt;RSAKeyValue&gt;<br />
          &lt;Modulus&gt;9f3W...fxG0E=&lt;/Modulus&gt;<br />
          &lt;Exponent&gt;AQAB&lt;/Exponent&gt;<br />
        &lt;/RSAKeyValue&gt;<br />
      &lt;/KeyValue&gt;<br />
      &lt;X509Data&gt;<br />
        &lt;X509Certificate&gt;MIIEi...ktYgN&lt;/X509Certificate&gt;<br />
      &lt;/X509Data&gt;<br />
    &lt;/KeyInfo&gt;<br />
  &lt;/Signature&gt;<br />
&lt;/root&gt;</font>
        </p>
        <p>
This document represents data and an <em>enveloped digital signature</em> over the
complete XML document. The <em>digital signature completeness</em> is defined in the <font face="Courier New">Reference</font> element,
which has <font face="Courier New">URI</font> attribute set to empty string (<font face="Courier New">Reference
Uri=""</font>).
</p>
        <p>
          <strong>Checking the Signature</strong>
        </p>
        <p>
The following should always be applied during signature validation:
</p>
        <ol>
          <li>
Validating the digital signature 
</li>
          <li>
Validating the certificate(s) used to create the signature 
</li>
          <li>
Validating the certificate(s) chain(s)</li>
        </ol>
        <p>
          <strong>
            <em>Note:</em>
          </strong> In most situations this is the optimal validation
sequence. Why? Signatures are broken far more frequently then certificates are revoked/expired.
And certificates are revoked/expired far more frequently then their chains.
</p>
        <p>
          <em>1. Validating the digital signature</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
First, get it out of there:
</p>
          <p>
            <font face="Courier New">XmlNamespaceManager xmlns = new XmlNamespaceManager(xdkDocument.NameTable);
[1]<br />
xmlns.AddNamespace("ds", "</font>
            <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
            <font face="Courier New">#");<br />
XmlNodeList nodeList = xdkDocument.SelectNodes("//ds:Signature", xmlns);<br /></font> <br /><font size="1">[1] <font face="Courier New">xdkDocument </font>should be an <font face="Courier New">XmlDocument</font> instance
representing your document.</font></p>
          <p>
Second, construct a <font face="Courier New">SignedXml</font> instance:
</p>
          <p>
            <font face="Courier New">foreach (XmlNode xmlNode in nodeList)<br />
{<br />
  // create signed xml object<br />
  SignedXml signedXml = new SignedXml(xdkDocument); [2]</font>
          </p>
          <p>
            <font face="Courier New">  // verify signature<br />
  signedXml.LoadXml((XmlElement)xmlNode);<br />
}</font>
          </p>
          <p>
            <font size="1">[2] Note that we are constructing the <font face="Courier New">SignedXml</font> instance
from a complete document, not only the signature. Read this.</font>
          </p>
          <p>
Third, validate:
</p>
          <p>
            <font face="Courier New">bool booSigValid = signedXml.CheckSignature();</font>
          </p>
          <p>
If <font face="Courier New">booSigValid</font> is <font face="Courier New">true</font>,
proceed.
</p>
        </blockquote>
        <p>
          <em>2. Validating the certificate(s) used to create the signature</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
First, get it out of there:
</p>
          <p>
            <font face="Courier New">XmlNode xndCert = xmlNode.SelectSingleNode(".//ds:X509Certificate",
xmlns); [3]</font>
          </p>
          <p>
            <font size="1">[3] There can be multiple <font face="Courier New">X509Certificate</font> elements
qualified with <font face="Courier New">h</font></font>
            <font face="Courier New" size="1">ttp://www.w3.org/2000/09/xmldsig</font>
            <font size="1">
              <font face="Courier New">#</font> namespace
in there. Xml Digital Signature specification is allowing the serialization of a complete
certificate chain of the certificate used to sign the document. Normally, the signing
certificate should be the first to be serialized.</font>
          </p>
          <p>
Second, get the <font face="Courier New">X509Certificate2</font> instance:
</p>
          <p>
            <font face="Courier New">byte[] bytCert = Convert.FromBase64String(xndCert.InnerText);<br />
X509Certificate2 x509cert = new X509Certificate2(bytCert);</font>
          </p>
          <p>
Third, validate:
</p>
          <p>
            <font face="Courier New">bool booCertValid = x509cert.Verify();</font>
          </p>
          <p>
If <font face="Courier New">booCertValid</font> is <font face="Courier New">true</font>,
proceed.
</p>
        </blockquote>
        <p>
          <em>3. Validating the certificate(s) chain(s)</em>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
Building and validating the chain:
</p>
          <p>
            <font face="Courier New">X509Chain certChain = new X509Chain();<br />
bool booChainValid = certChain.Build(x509cert);<br />
int intChainLength = certChain.ChainElements.Count; [4]</font>
          </p>
          <p>
If <font face="Courier New">booChainValid</font> is <font face="Courier New">true</font>,
your signature is <strong>valid</strong>.
</p>
        </blockquote>
        <p dir="ltr">
          <strong>Some Rules and Some Laws</strong>
        </p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
We have three booleans:
</p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
        </p>
        <ul>
          <li>
            <font face="Courier New">booSigValid</font> - signature validity 
</li>
          <li>
            <font face="Courier New">booCertValid</font> - certificate validity 
</li>
          <li>
            <font face="Courier New">booChainValid</font> - certificate's chain validity</li>
        </ul>
        <p>
        </p>
        <p>
If <font face="Courier New">booSigValid</font> evaluates to <font face="Courier New">false</font>,
there is no discussion. Someone <strong>changed the document</strong>.
</p>
        <p>
What happens if one of the following two expressions evaluates to <font face="Courier New">true</font>:
</p>
        <p>
1. <font face="Courier New">((booSigValid) &amp;&amp; (!booCertValid) &amp;&amp; (!booChainValid))<br /></font>2. <font face="Courier New">((booSigValid) &amp;&amp; (booCertValid) &amp;&amp;
(!booChainValid))</font></p>
        <p>
This normally means that either the certificate is not valid (CRLed or expired) [4],
or one of the chain's certificate is not valid/expired.
</p>
        <p>
          <font size="1">[4] The premise is that one checked the signature according to 1, 2,
3 schema described above.</font>
        </p>
        <p>
          <strong>The Question</strong>
        </p>
        <p>
Is digital signature valid even if CA revoked the certificate after the
signature has already been done? Is it valid even after the certificate expires? If
signature is valid and certificate has been revoked, what is the legal validity of
the signature?
</p>
        <p>
In legal terms, the signature would be <strong>invalid</strong> on both upper assertions,
1 and 2. 
</p>
        <p>
This means, that once the generator of the signature is dead, or one of his predecessors
is dead, all his children die too.
</p>
        <p>
          <strong>Timestamps to the Rescue</strong>
        </p>
        <p>
According to most country's digital signature laws the signature is valid only during
the validity of the signing certificate and validity of the signing certificate's
chain, both being checked for revocation and expiry date ... if you don't timestamp
it.
</p>
        <p>
If the source document has <em>another signature</em> from a trusted authority, and
that authority is a timestamp authority, it would look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;root xmlns="urn-foo-bar"&gt;<br />
  &lt;subroot&gt;<br />
    &lt;value1&gt;value1&lt;/value1&gt;<br />
    &lt;value2&gt;value2&lt;/value2&gt;<br />
  &lt;/subroot&gt;<br />
  &lt;Signature xmlns="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    ...<br />
  &lt;/Signature&gt;<br />
  &lt;dsig:Signature Id="TimeStampToken"<br />
    </font>
          <font face="Courier New">xmlns:dsig="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
    &lt;dsig:SignedInfo&gt;<br />
      &lt;dsig:CanonicalizationMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/TR/2001/REC-xml-c14n-20010315</font>
          <font face="Courier New">"
/&gt;<br />
      &lt;dsig:SignatureMethod<br />
        Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#rsa-sha1"</font>
          <font face="Courier New"> /&gt;<br />
      &lt;dsig:Reference<br />
        URI="#TimeStampInfo-113D2EEB158BBB2D7CC000000000004DF65"&gt;<br />
        &lt;dsig:DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
          &lt;dsig:DigestValue&gt;y+xw...scKg=&lt;/dsig:DigestValue&gt;<br />
      &lt;/dsig:Reference&gt;<br />
      &lt;dsig:Reference URI="#TimeStampAuthority"&gt;<br />
        &lt;dsig:DigestMethod<br />
          Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
        &lt;dsig:DigestValue&gt;KhFIr...Sv4=&lt;/dsig:DigestValue&gt;<br />
      &lt;dsig:/Reference&gt;<br />
    &lt;/dsig:SignedInfo&gt;<br />
    &lt;dsig:SignatureValue&gt;R4m...k3aQ==&lt;/dsig:SignatureValue&gt;<br />
    &lt;dsig:KeyInfo Id="TimeStampAuthority"&gt;<br />
      &lt;dsig:X509Data&gt;<br />
        &lt;dsig:X509Certificate&gt;MII...Osmg==&lt;/dsig:X509Certificate&gt;<br />
      &lt;/dsig:X509Data&gt;<br />
    &lt;/dsig:KeyInfo&gt;<br />
    &lt;dsig:Object<br />
      Id="TimeStampInfo-113D2EEB158BBB2D7CC000000000004DF65"&gt;<br />
      &lt;ts:TimeStampInfo<br />
         xmlns:ts="</font>
          <font face="Courier New">http://www.provider.com/schemas<font color="#003300"><br />
           </font>/timestamp-protocol-20020207</font>
          <font face="Courier New">"<br />
         xmlns:ds="</font>
          <font face="Courier New">http://www.w3.org/2000/09/xmldsig</font>
          <font face="Courier New">#"&gt;<br />
        &lt;ts:Policy id="</font>
          <font face="Courier New">http://provider.tsa.com/documents"</font>
          <font face="Courier New"> /&gt;<br />
          &lt;ts:Digest&gt;<br />
            &lt;ds:DigestMethod
Algorithm="</font>
          <font face="Courier New">http://www.w3.org/2000/<br />
              09/xmldsig#sha1"</font>
          <font face="Courier New"> /&gt;<br />
            &lt;ds:DigestValue&gt;V7+bH...Kmsec=&lt;/ds:DigestValue&gt;<br />
          &lt;/ts:Digest&gt;<br />
          &lt;ts:SerialNumber&gt;938...045&lt;/ts:SerialNumber&gt;<br />
          &lt;ts:CreationTime&gt;2008-04-13T11:31:42.004Z&lt;/ts:CreationTime&gt;<br />
          &lt;ts:Nonce&gt;121...780&lt;/ts:Nonce&gt;<br />
      &lt;/ts:TimeStampInfo&gt;<br />
    &lt;/dsig:Object&gt;<br />
  &lt;/dsig:Signature&gt;<br />
&lt;/root&gt;</font>
        </p>
        <p>
The second signature would be performed by an out-of-band authority, normally a <strong>TSA
authority</strong>. It would only sign a <em>hash value</em> (in this case SHA1 hash)
which was constructed by hashing the original document and the included digital signature.
</p>
        <p>
This (second) signature should be checked using the same 1, 2, 3 steps. For the purpose
of this mind experiment, let's say it would generate a <font face="Courier New">booTimestampValid</font> boolean.
</p>
        <p>
Now, let's reexamine the booleans:
</p>
        <ol>
          <li>
            <font face="Courier New">((booSigValid) &amp;&amp; (!booCertValid) &amp;&amp; (!booChainValid)
&amp;&amp; (booTimestampValid))</font>
          </li>
          <li>
            <font face="Courier New">((booSigValid) &amp;&amp; (booCertValid) &amp;&amp; (!booChainValid)
&amp;&amp; (booTimestampValid))</font>
          </li>
        </ol>
        <p>
In this case, <em>even though the signature's certificate (or its chain) is invalid,
the signature would pass legal validity</em> if the timesamp's signature is valid,
together with its certificate and certificate chain. Note that the TSA signature is
generated with a different set of keys than the original digital signature.
</p>
        <p>
Actually <font face="Courier New">booTimestampValid</font> is defined as <font face="Courier New">((booSigValid)
&amp;&amp; (booCertValid) &amp;&amp; (booChainValid))</font> for the timestamp signature/certificate/certificate
chain [5].
</p>
        <p>
          <font size="1">[5] Legal validity is guaranteed only in cases where 1 or 2 are true.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=f37eda08-845c-4b0a-a66c-ea9cec03c06b" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF: Reliable Messaging and Retry Timeouts</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,a510f1dc-23bb-42aa-b683-a70c4740bfe5.aspx</id>
    <published>2008-04-09T00:33:13.159+02:00</published>
    <updated>2008-04-16T17:20:00.887+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is a <em>serious limitation</em> present in the RTM version of WCF 3.0/3.5 regarding
control of WS-RM retry messages during a <strong>reliable session</strong> saga.
</p>
        <p>
Let me try to explain the concept.
</p>
        <p>
We have a sender (communication initiator) and a receiver (service). When a reliable
session is constructed between the two, every message needs to come to the other side.
In a request-reply world, the sender would be a client during the request phase. Then
roles would switch during the response phase.
</p>
        <p>
The problem arises when one of the sides <strong>does not get</strong> the message
acknowledgement in time. WCF reliable messaging implementation retries the sending
process and hopes for the acknowledgement. All is well.
</p>
        <p>
The problem is that there is <em>no way </em>for the sending application to specify <em>how
long the retry timeout should be</em>. There is a way to specify channel opening and
closing timeouts, acknowledgement interval and more, but nothing will define how long
should the initiator wait for message acks.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/wcfreplytimeout1.gif" />
        </p>
        <p>
Let's talk about how WCF acknowledges messages.
</p>
        <p>
During a request-reply exchange every request message is acknowledged <em>in a response
message</em>. WS-RM SOAP headers regarding sequence definition (request) and acknowledgements
(response) look like this:
</p>
        <p>
          <font face="Courier New">a1 &lt;r:Sequence s:mustUnderstand="1" u:Id="_2"&gt;<br />
a2    &lt;r:Identifier&gt;urn:uuid:6c9d...ca90&lt;/r:Identifier&gt;<br />
a3    <strong>&lt;r:MessageNumber&gt;1&lt;/r:MessageNumber&gt;<br /></strong>a4 &lt;/r:Sequence&gt;</font>
        </p>
        <p>
          <font face="Courier New">b1 &lt;r:SequenceAcknowledgement u:Id="_3"&gt;<br />
b2    &lt;r:Identifier&gt;urn:uuid:6c99...ca290&lt;/r:Identifier&gt;<br />
b3    <strong>&lt;r:AcknowledgementRange Lower="1" Upper="1"/&gt;<br />
b4    &lt;netrm:BufferRemaining 
<br />
b5       xmlns:netrm="</strong></font>
          <font face="Courier New">
            <strong>http://schemas.microsoft.com/ws/2006/05/rm"</strong>
          </font>
          <font face="Courier New">
            <strong>&gt;<br />
b6    &lt;/netrm:BufferRemaining&gt;<br /></strong>b7 &lt;/r:SequenceAcknowledgement&gt;</font>
        </p>
        <p>
Request phase defines a sequence and sends the first message (<font face="Courier New">a3</font>).
In response, there is the appropriate acknowledgement present, which acks the first
message (<font face="Courier New">b3</font>) with <font face="Courier New">Lower</font> and <font face="Courier New">Upper</font> attributes.
Lines <font face="Courier New">b4-b6</font> define a benign and super useful WCF implementation
of <em>flow control</em>, which allows the sender to limit the rate of sent messages
if service side <strong>becomes congested</strong>.
</p>
        <p>
When the session is setup, WCF will have a really small time waiting window for acks.
Therefore, if ack is not received during this period, the infrastructure <em>will
retry the message</em>.
</p>
        <p>
Duplex contracts work slightly differently. There, the acknowledgement interval can
be set. This configuration option (config attribute is called <font face="Courier New">acknowledgementInterval</font>)
is named inappropriately, since it controls the service and not the client side.
</p>
        <p>
It does not define the time limit on <em>received acknowledgements</em>, but the necessary
time to <em>send the acknowledgments back</em>. It allows grouping of sent acks, so
that multiple incoming messages can be acked together. Also, the infrastructure will
not necessarily honor the specified value.
</p>
        <p>
Now consider the following scenario:
</p>
        <ol>
          <li>
The client is on a reliable network 
</li>
          <li>
Network bandwidth is so thin that the sending message takes 20s to come through <font face="Courier New">[1]</font></li>
          <li>
            <a href="http://www.request-response.com/blog/PermaLink,guid,48b65a92-4015-45f2-8fee-78ae5c0e48b8.aspx">Service
instancing</a> is set to <font face="Courier New">Multiple</font></li>
          <li>
The solution uses a request-reply semantics</li>
        </ol>
        <p>
          <font size="1">
            <font face="Courier New">[1]</font> It does not matter whether the
initiator is on a dial up, or the message is huge.</font>
        </p>
        <p>
          <strong>What happens?</strong>
        </p>
        <p>
Service initiator sets up a reliable session, then:
</p>
        <ol>
          <li>
First message is being sent 
</li>
          <li>
Since the retry interval is really small <font face="Courier New">[2]</font>, the
message will not get to the other end and the acknowledgement will not bounce
back in time 
</li>
          <li>
First message is retried, now two messages are being transported 
</li>
          <li>
No acks received yet 
</li>
          <li>
First message is retried again 
</li>
          <li>
Network bandwidth is even thinner 
</li>
          <li>
First message is acknowledged 
</li>
          <li>
First message retry is discarded on the service side 
</li>
          <li>
Second message retry is discarded on the service side</li>
        </ol>
        <p>
          <font size="1">
            <font face="Courier New">[2]</font> Under 3s.</font>
        </p>
        <p>
The number of retry messages depends on the <em>bandwidth</em> and <em>message size</em>.
It can happen that tens of messages will be sent before first acknowledgement will
be received.
</p>
        <p>
          <strong>Adaptability algorithms</strong>
        </p>
        <p>
A good thing is that there are undocumented algorithms implemented for retry timeout.
The implementation increases the reply timeout <em>exponentially</em> when the infrastructure
detects that the network conditions demand more time (slow throughput) and allows
reliable delivery (no losses). If loses are present the reply timeout decreases.
</p>
        <p>
Retry timeout is actually calculated when establishing an RM session. It
is based on the roundtrip time and is bigger if the roundtrip time is long.
</p>
        <p>
So, when first messages in a session are exchanged, don't be too surprised to see
a couple of message retries.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=a510f1dc-23bb-42aa-b683-a70c4740bfe5" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Calculating Outsourcing Project Cost</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,fff35773-9d2b-4ffc-9795-4e2b62fc61a4.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,fff35773-9d2b-4ffc-9795-4e2b62fc61a4.aspx</id>
    <published>2008-02-18T23:01:39.53125+01:00</published>
    <updated>2008-02-18T23:01:39.53125+01:00</updated>
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Wow, <a href="http://www.stephenforte.net/PermaLink,guid,48917fe9-ab8a-4d98-8d49-c70cb53a82ef.aspx">Stephen</a>. 
</p>
        <p>
This is one of the best ideas I've heard of hedging against the dollar in terms if
IT outsourcing cost. And I mean it.
</p>
        <p>
I'm not in a position of valueing the description made, but I am willing to take the
pill, no matter what.
</p>
        <p>
What everybody needs is only to get to one million sterling project,
taking half a year. 
</p>
        <p>
That's it, hedging done or not.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=fff35773-9d2b-4ffc-9795-4e2b62fc61a4" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Happy Birthday XML</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,b8fa5b93-1d54-4cdb-a353-5febb4232890.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,b8fa5b93-1d54-4cdb-a353-5febb4232890.aspx</id>
    <published>2008-02-13T20:36:09.046875+01:00</published>
    <updated>2008-02-13T20:36:09.046875+01:00</updated>
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This week XML is <a href="http://www.tbray.org/ongoing/When/200x/2008/02/10/XML-People">ten
years old</a>. The core XML 1.0 specification was released in February 1998. 
</p>
        <p>
It's a nice anniversary to have.
</p>
        <p>
The XML + Namespaces specification has a built in namespace declaration of <font face="Courier New">http://www.w3.org/XML/1998/namespace</font>.
That's an implicit namespace declaration, a special one, governing all other. One
namespace declaration to rule them all. Bound to <font face="Courier New"><a href="http://www.w3.org/XML/1998/namespace">xml:</a></font> prefix.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/originalxmlnamespace.jpg" />
        </p>
        <p>
XML was born and published as a W3C Recommendation on 10<sup>th</sup> of February
1998.
</p>
        <p>
So, well done XML. You did <strong>a lot</strong> for IT industry in the past decade.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b8fa5b93-1d54-4cdb-a353-5febb4232890" />
      </div>
    </content>
  </entry>
  <entry>
    <title>European Silverlight Challenge</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,3990a494-ac6f-4314-978b-39a459c36759.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,3990a494-ac6f-4314-978b-39a459c36759.aspx</id>
    <published>2008-01-04T10:33:22.60225+01:00</published>
    <updated>2008-01-04T10:33:22.60225+01:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Silverlight" label="Silverlight" scheme="https://www.request-response.com/blog/CategoryView,category,Silverlight.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you're into <a href="http://silverlight.net/Default.aspx">Silverlight</a>, and
you should be, check out <a href="http://www.silverlightchallenge.eu">http://www.silverlightchallenge.eu</a>,
and especially sign up on <a href="http://slovenia.silverlightchallenge.eu">http://slovenia.silverlightchallenge.eu</a> and
join one of our many developers who will participate in this competition.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/silverlightchallenge2008.jpg" />
        </p>
        <p>
More <a href="http://www.slodug.si/blogs/system/archive/2007/12/20/1.-evropski-nate_0D01_aj-Silverlight.aspx">here</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3990a494-ac6f-4314-978b-39a459c36759" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Mr. Larry Lessig</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,3b183ab0-9506-470b-807a-e9f39a40aa12.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,3b183ab0-9506-470b-807a-e9f39a40aa12.aspx</id>
    <published>2007-11-09T23:59:24.083+01:00</published>
    <updated>2007-11-09T23:59:24.083+01:00</updated>
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Mr. <a href="http://www.lessig.org/blog/">Lawrence Lessig</a> is a founder of <a href="http://cyberlaw.stanford.edu/">Stanford
Center for Internet and Society</a>. He's also a chairman for the <a href="http://creativecommons.org/">Creative
Commons</a> organization.
</p>
        <p>
Lessig is one of the most effective speakers in the world, a professor at
Stanford, who tries to make this world a better place from a standpoint of stupidity
in terms of the copyright law.
</p>
        <p>
The following is published on the <a href="http://creativecommons.org/">CC</a>'s site:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>We use <strong>private rights</strong> to create <strong>public goods</strong>:
creative works set free for certain uses. ... We work to offer creators a best-of-both-worlds
way to protect their works while encouraging certain uses of them — to declare <strong>“some
rights reserved.”</strong></em>
          </p>
        </blockquote>
        <p>
Therefore Creative Commons stands for the mantra of <em>some rights reserved</em> and
not <em>all rights reserved</em> in terms of meaningful usage of digital technology.
</p>
        <p>
Being a <a href="http://en.wikipedia.org/wiki/Libertarianism">libertarian</a> myself,
I cannot oppose these stands. <em>Balance</em> and <em>compromise </em>are good things for
content and intellectual products, such as software.
</p>
        <p>
Watch <a href="http://www.ted.com/index.php/talks/view/id/187">his masterpiece</a>,
delivered at <a href="http://www.ted.com">TED</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3b183ab0-9506-470b-807a-e9f39a40aa12" />
      </div>
    </content>
  </entry>
  <entry>
    <title>On Instance and Static Method Signatures</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,634a58b1-13e5-4b7a-b2ac-010965235bcb.aspx</id>
    <published>2007-11-03T22:04:38.531+01:00</published>
    <updated>2007-11-04T09:03:14.390625+01:00</updated>
    <category term="CLR" label="CLR" scheme="https://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
We talked today, with <a href="http://cs.rthand.com/blogs/blog_with_righthand/">Miha</a>,
a C# <a href="http://en.wikipedia.org/wiki/Yoda">Yoda</a>. Via IM, everything seemed
pointless. Couldn't find a good case for the cause of the following mind experiment:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  public static void Test() {}<br />
  private void Test() {} <br />
}<br /></font>
          <font size="1">
            <br />
Note: I'm using Miha's syntax in this post.</font>
        </p>
        <p>
We have a <strong>static method</strong> called <font face="Courier New">Test</font> and
an <strong>instance method</strong>, also called <font face="Courier New">Test</font>.
Parameter models of both methods are the same, <em>empty</em>.
</p>
        <p>
Would this compile?
</p>
        <p>
          <em>It does not.</em>
        </p>
        <p>
The question is why and who/what causes this. There is actually <strong>no rationale </strong>behind
not allowing this thing to compile since both, the compiler and the runtime know the
method info upfront.
</p>
        <p>
Since the runtime has all the information it needs, it is strange that this would
not be allowed at compile time. However, a (C#) compiler has to determine whether
you, <strong>the programmer </strong>meant to access a <em>static</em> or an <em>instance</em> method.
</p>
        <p>
          <em>Here lie the dragons.</em>
        </p>
        <p>
It is illegal in most virtual machine based languages to have the same method name
and signature for a static/instance method.
</p>
        <p>
The following is an excerpt from a <a href="http://java.sun.com/docs/books/jls/third_edition/html/classes.html#8.4.2">Java
specification</a>:
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
            <em>8.4.2 Method Signature</em>
          </p>
        </blockquote>
        <blockquote>
          <p>
            <em>Two methods have the <strong>same signature</strong> if they have the same name
and argument types.</em>
          </p>
          <p>
            <em>Two method or constructor declarations M and N have the same argument types if
all of the following conditions hold: </em>
          </p>
          <p>
            <em>
            </em>
          </p>
          <ul>
            <a name="299803">
            </a>
            <li>
              <em>They have the same number of formal parameters (possibly zero) </em>
              <a name="299804">
              </a>
            </li>
            <li>
              <em>They have the same number of type parameters (possibly zero) </em>
              <a name="324473">
              </a>
            </li>
            <li>
              <em>Let &lt;A<sub>1</sub>,...,A<sub>n</sub>&gt; be the formal type parameters of M
and let &lt;B<sub>1</sub>,...,B<sub>n</sub>&gt; be the formal type parameters of N.
After renaming each occurrence of a B<sub>i</sub> in N's type to A<sub>i</sub> the
bounds of corresponding type variables and the argument types of M and N are the same. </em>
            </li>
          </ul>
        </blockquote>
        <p>
Java (and also C#) does not allow two methods with the same name and parameter model
no matter what the access modifier is (public, private, internal, protected ...) and
whether the method is static or instance based.
</p>
        <p>
          <em>Why?</em>
        </p>
        <p>
Simple. <strong>Programmer ambiguity.</strong> There is no technical reason not to
allow it.
</p>
        <p>
Consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{ 
<br />
  public static void Test(); 
<br />
  private void Test(); 
<br />
  public void AmbiguousCaller() { Test(); } 
<br />
}</font>
        </p>
        <p>
What would method <font face="Courier New">AmbiguousCaller</font> call? A static <font face="Courier New">Test</font> or
instance <font face="Courier New">Test</font> method? 
</p>
        <p>
          <em>Can't decide? </em>
        </p>
        <p>
That's why this is not allowed. 
</p>
        <p>
And yes, it would call the instance method if this would be allowed, since statics
in C# <em>should</em> be called using a class name, as in <font face="Courier New">Test.Test()</font>.
Note that the preceding example <em>does not compile</em>. Also note, that
it <em>is legal</em> to have a <font face="Courier New">AmbiguousCaller</font> body
as <font face="Courier New">Test()</font> or <font face="Courier New">Tubo.Test()</font>.
</p>
        <p>
There is another ambiguous reason. Local variables in C# <strong>cannot</strong> be
named <em>the same as the enclosing class</em>. Therefore, this is illegal:
</p>
        <p>
          <font face="Courier New">using System;<br />
class Tubo<br />
{<br />
  private int Tubo;<br />
}</font>
        </p>
        <p>
It is. Do a <font face="Courier New">csc /t:library</font> on it.
</p>
        <p>
Since you confirmed this fact, consider the following:
</p>
        <p>
          <font face="Courier New">using System;<br />
public class Tubo<br />
{ 
<br />
  public static void StaticMethod() {} 
<br />
  public void InstanceMethod() {} 
<br />
}</font>
        </p>
        <p>
          <font face="Courier New">public class RunMe<br />
{<br />
  public static void Main()<br />
  { 
<br />
    Tubo Tubo = new Tubo();<br />
    Tubo.InstanceMethod();<br />
    Tubo.StaticMethod();<br />
  }<br />
}</font>
        </p>
        <p>
Focus on the <font face="Courier New">Main</font> method <em>body</em>. In <font face="Courier New">Tubo.InstanceMethod()</font> an
instance method is called and a reference (namely <font face="Courier New">Tubo</font>)
is used. In <font face="Courier New">Tubo.StaticMethod()</font> a static method is
called and <font face="Courier New">Tubo</font> is not an instance reference, but
class name.
</p>
        <p>
It all comes down to <em>programmer ambiguity</em>. Given a chance, I would support
this design decision too.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=634a58b1-13e5-4b7a-b2ac-010965235bcb" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WCF: Passing Collections Through Service Boundaries, Why and How</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,ff5fab81-affb-4b2b-aa67-c80bdfc86cbd.aspx</id>
    <published>2007-09-27T23:04:47.328+02:00</published>
    <updated>2007-09-27T23:28:02.546875+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
In WCF, collection data that is passed through the service boundary goes through a <em>type
filter </em>- meaning you will not necessarily get the <em>intrinsic service side
type</em> on the client, even if you're <strong>expecting it</strong>.
</p>
        <p>
No matter if you throw back an <font face="Courier New">int[]</font> or <font face="Courier New">List&lt;int&gt;,</font> you
will get the <font face="Courier New">int[]</font> by default on the client.
</p>
        <p>
The main reason is that there is no representation for <font face="Courier New">System.Collections.Generic.List</font> or <font face="Courier New">System.Collection.Generic.LinkedList</font> in
service metadata. The concept of <font face="Courier New">System.Collection.Generic.List&lt;int&gt;</font> for
example, actually does not have a different semantic meaning from an <em>integer array</em> -
it's still a list of <em>ints</em> - but will allow you to program against it with
ease.
</p>
        <p>
Though, if one asks nicely, <strong>it is possible</strong> to guarantee the preferred
collection type on the client proxy in certain scenarios.
</p>
        <p>
Unidimensional collections, like <font face="Courier New">List&lt;T&gt;</font>, <font face="Courier New">LinkedList&lt;T&gt;</font> or <font face="Courier New">SortedList&lt;T&gt;</font> are
always exposed as <font face="Courier New">T</font> arrays in the client proxy. <font face="Courier New">Dictionary&lt;K,
V&gt;</font>, though, is regened on the client via an annotation hint in WSDL (XSD
if we are precise). More on that later.
</p>
        <p>
Let's look into it.
</p>
        <p>
WCF infrastructure bends over backwards to simplify client development. If the service
side contains a really serializable collection (marked with <font face="Courier New">[Serializable]</font>,
not <font face="Courier New">[DataContract]</font>) that is also concrete (not an
interface), and has an <font face="Courier New">Add</font> method with the following
signatures...
</p>
        <p>
          <font face="Courier New">public void Add(object obj);<br />
public void Add(T item); </font>
        </p>
        <p>
... then WCF will serialize the data to an array of the collections type.
</p>
        <p>
Too complicated? Consider the following:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
   [OperationContract]<br />
   public void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">   [OperationContract]<br />
   public List&lt;Coin&gt; GetCoins();<br />
}</font>
        </p>
        <p>
Since the <font face="Courier New">List&lt;T&gt;</font> supports a <font face="Courier New">void
Add&lt;T&gt;</font> method and is marked with <font face="Courier New">[Serializable]</font>,
the following wire representation will be passed to the client:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
  [OperationContract]<br />
  void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">  [OperationContract]<br />
  Coin[] GetCoins();<br />
}<br /></font>
          <font size="1">
            <br />
Note: <font face="Courier New">Coin</font> class should be marked either with a <font face="Courier New">[DataContract]</font> or <font face="Courier New">[Serializable]</font> in
this case.</font>
        </p>
        <p>
So what happens if one wants the same contract <em>on the client proxy and the service</em>?
There is an option in the WCF proxy generator, <font face="Courier New">svcutil.exe</font> to
force generation of class definitions with a specific collection type.
</p>
        <p>
Use the following for <font face="Courier New">List&lt;T&gt;</font>:
</p>
        <p>
          <font face="Courier New">svcutil.exe http://service/metadata/address<br />
  /collectionType:System.Collections.Generic.List`1<br /><br /></font>
          <font size="1">Note: <font face="Courier New">List`1</font> uses back quote,
not normal single quote character.</font>
        </p>
        <p>
What the <font face="Courier New">/collectionType</font> (short <font face="Courier New">/ct</font>)
does, is forces generation of strongly typed collection types. It will generate the
holy grail on the client:
</p>
        <p>
          <font face="Courier New">[ServiceContract]<br />
interface ICollect<br />
{<br />
  [OperationContract]<br />
  void AddCoin(Coin coin);</font>
        </p>
        <p>
          <font face="Courier New">  [OperationContract]<br />
  List&lt;Coin&gt; GetCoins();<br />
}</font>
        </p>
        <p>
In Visual Studio 2008, you will even have an option to specify which types you want
to use as <em>collection types</em> and <em>dictionary collection types</em>, as in
the following picture:
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/vs2008servicereference.jpg" />
        </p>
        <p>
On the other hand, dictionary collections, as in <font face="Courier New">System.Collections.Generic.Dictionary&lt;K,
V&gt;</font> collections, will go through to the client no matter what you specify
as a <font face="Courier New">/ct</font> parameter (or don't at all).
</p>
        <p>
If you define the following on the service side...
</p>
        <p>
          <font face="Courier New">[OperationContract]<br />
Dictionary&lt;string, int&gt; GetFoo();</font>
        </p>
        <p>
... this will get generated on the client:
</p>
        <p>
          <font face="Courier New">[OperationContract]<br />
Dictionary&lt;string, int&gt; GetFoo();</font>
        </p>
        <p>
          <strong>Why?</strong>
        </p>
        <p>
Because using <font face="Courier New">System.Collections.Generic.Dictionary</font> probably
means <strong>you</strong> know there is no guarantee that client side representation
will be possible if you are using an alternative platform. There is no way to meaningfully
convey the semantics of a .NET dictionary class using WSDL/XSD. 
</p>
        <p>
          <strong>So, how does the client know?</strong>
        </p>
        <p>
In fact, the values are serialized as <strong>joined name value pair elements</strong> as
the following schema says:
</p>
        <p>
          <font face="Courier New">&lt;xs:complexType name="ArrayOfKeyValueOfstringint"&gt;<br /><font color="#a52a2a">  &lt;xs:annotation&gt;<br />
    &lt;xs:appinfo&gt;<br />
      &lt;IsDictionary<br />
        xmlns="</font></font>
          <font face="Courier New" color="#a52a2a">http://schemas.microsoft.com/2003/10/Serialization/</font>
          <font face="Courier New">
            <font color="#a52a2a">"&gt;<br />
        true<br />
      &lt;/IsDictionary&gt; 
<br />
    &lt;/xs:appinfo&gt;<br />
  &lt;/xs:annotation&gt;<br /></font>  &lt;xs:sequence&gt;<br />
    &lt;xs:element minOccurs="0" maxOccurs="unbounded"<br />
      name="KeyValueOfstringint"&gt;<br />
      &lt;xs:complexType&gt;<br />
        &lt;xs:sequence&gt;<br />
          &lt;xs:element name="Key" nillable="true"
type="xs:string" /&gt; 
<br />
          &lt;xs:element name="Value"
type="xs:int" /&gt; 
<br />
        &lt;/xs:sequence&gt;<br />
      &lt;/xs:complexType&gt;<br />
    &lt;/xs:element&gt;<br />
  &lt;/xs:sequence&gt;<br />
&lt;/xs:complexType&gt;<br />
&lt;xs:element name="ArrayOfKeyValueOfstringint"<br />
  nillable="true" type="tns:ArrayOfKeyValueOfstringint" /&gt;<br /><br /></font>
          <font size="1">Note: You can find this schema under <font face="Courier New">types</font> definition
of the metadata endpoint. Usually <font face="Courier New">?xsd=xsd2</font>, instead
of <font face="Courier New">?wsdl</font> will suffice.</font>
        </p>
        <p>
As in:
</p>
        <p>
          <font face="Courier New">&lt;GetFooResponse&gt;<br />
  &lt;KeyValueOfstringint&gt;<br />
    &lt;Key&gt;one&lt;/Key&gt;<br />
    &lt;Value&gt;1&lt;/Value&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;Key&gt;two&lt;/Key&gt;<br />
    &lt;Value&gt;2&lt;/Value&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;!-- ... --&gt;</font>
        </p>
        <p>
          <font face="Courier New">    &lt;Key&gt;N&lt;/Key&gt;<br />
    &lt;Value&gt;N&lt;/Value&gt;<br />
  &lt;/KeyValueOfstringint&gt;<br />
&lt;GetFooResponse&gt;</font>
        </p>
        <p>
The meaningful part of type service-to-client-transportation resides in <font face="Courier New">&lt;xs:annotation&gt;</font> element,
specifically in <font face="Courier New">/xs:annotation/xs:appinfo/IsDictionary</font> element,
which defines that this complex type represents a <font face="Courier New">System.Collections.Generic.Dictionary</font> class. <a href="http://www.w3.org/TR/xmlschema-0/#CommVers">Annotation</a> elements
in XML Schema are parser specific and do not convey any structure/data type semantics,
but are there <em>for the receiver to interpret</em>.
</p>
        <p>
This must be one of the <strong>most excellent school cases</strong> of using XML
Schema <a href="http://www.w3.org/TR/xmlschema-0/#CommVers">annotations</a>. It allows
the well-informed client (as in .NET client, VS 2008 or <font face="Courier New">svcutil.exe</font>)
to utilize the semantic meaning if it understands it. If not, no harm is done since
the best possible representation, in a form of joined name value pairs still goes
through to the client.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ff5fab81-affb-4b2b-aa67-c80bdfc86cbd" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Approaches to Document Style Parameter Models</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,ab874bc2-1546-48d1-a8aa-46f0bf876d93.aspx</id>
    <published>2007-09-24T12:19:10.09375+02:00</published>
    <updated>2007-09-24T12:19:10.09375+02:00</updated>
    <category term=".NET 3.0 - WCF" label=".NET 3.0 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET30WCF.aspx" />
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Architecture" label="Architecture" scheme="https://www.request-response.com/blog/CategoryView,category,Architecture.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I'm a huge fan of document style parameter models when implementing a public, programmatic <a href="http://en.wikipedia.org/wiki/Facade_pattern">façade</a> to
a business functionality that often changes.
</p>
        <p>
          <font face="Courier New">public interface IDocumentParameterModel<br />
{<br />
   [OperationContract]<br />
   [FaultContract(typeof(XmlInvalidException))]<br />
   XmlDocument Process(XmlDocument doc);<br />
}</font>
        </p>
        <p>
This contract defines a simple method, called <font face="Courier New">Process</font>,
which processes the input document. The idea is to define the <a href="http://www.w3.org/TR/xmlschema-1/">document
schema</a> and validate inbound XML documents, while throwing exceptions on <em>validation
errors</em>. The processing semantics is arbitrary and can support any kind of action,
depending on the defined <em>invoke document </em>schema.
</p>
        <p>
A simple instance document which validates against a version 1.0 <em>processing schema</em> could
look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0?&gt;<br />
&lt;Process xmlns="http://www.gama-system.com/process10.xsd" version="1.0"&gt;<br />
   &lt;Instruction&gt;Add&lt;/Instruction&gt;<br />
   &lt;Parameter1&gt;10&lt;/Parameter1&gt;<br />
   &lt;Parameter2&gt;21&lt;/Parameter2&gt;<br />
&lt;/Process&gt;</font>
        </p>
        <p>
Another processing instruction, supported in version 1.1 of the <em>processing schema</em>,
with different semantics could be:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0?&gt;<br />
&lt;Process xmlns="http://www.gama-system.com/process11.xsd" version="1.1"&gt;<br />
   &lt;Instruction&gt;Store&lt;/Instruction&gt;<br />
   &lt;Content&gt;77u/PEFwcGxpY2F0aW9uIHhtbG5zPSJod...mdVcCI&lt;/Content&gt;<br />
&lt;/Process&gt;</font>
        </p>
        <p>
Note that the default XML namespace changed, but that is <strong>not a norm</strong>.
It only allows you to automate schema retrieval using the schema repository (think <font face="Courier New">System.Xml.Schema.XmlSchemaSet</font>),
load all supported schemas and validate automatically.
</p>
        <p>
          <font face="Courier New">public class ProcessService : IDocumentParameterModel<br />
{<br />
   public XmlDocument Process(XmlDocument doc)<br />
   {<br />
      XmlReaderSettings sett = new XmlReaderSettings();</font>
        </p>
        <p>
          <font face="Courier New">
            <strong>      sett.Schemas.Add(&lt;document
namespace 1&gt;, &lt;schema uri 1&gt;);<br />
      ...<br />
      sett.Schemas.Add(&lt;document namespace n&gt;, &lt;schema
uri n&gt;);</strong>
          </font>
        </p>
        <p>
          <font face="Courier New">      sett.ValidationType = ValidationType.Schema;<br />
      sett.ValidationEventHandler += new 
<br />
         ValidationEventHandler(XmlInvalidHandler);<br /></font>
          <font face="Courier New">      XmlReader books = XmlReader.Create(doc.OuterXml,
sett);<br /></font>
          <font face="Courier New">      while (books.Read())
{ }</font>
        </p>
        <p>
          <font face="Courier New">      // processing goes here<br />
      ...<br />
   }</font>
        </p>
        <p>
          <font face="Courier New">   static void XmlInvalidHandler(object sender,
ValidationEventArgs e)<br />
   {<br />
      if (e.Severity == XmlSeverityType.Error)<br />
         throw new XmlInvalidException(e.Message);<br />
   }<br />
}</font>
        </p>
        <p>
The main benefit of this approach is <em>decoupling</em> the parameter model and method
processing version from the <em>communication contract</em>. A service maintainer
has an option to change the terms of processing over time, while supporting older
version-aware document instances.
</p>
        <p>
This notion is of course most beneficial in situations where your processing syntax <strong>changes
frequently</strong> and has complex validation schemas. A simple case presented here
is informational only.
</p>
        <p>
So, how do we validate?
</p>
        <ul>
          <li>
We need to check the instance document version first. This is especially true in cases
where the document is <em>not qualified with a different namespace</em> when the version
changes.</li>
          <li>
We grab the appropriate schema or schema set</li>
          <li>
We validate the inbound XML document, throw a typed <font face="Courier New">XmlInvalidException</font> if
invalid</li>
          <li>
We process the call</li>
        </ul>
        <p>
The service side is quite straightforward.
</p>
        <p>
Let's look at the <strong>client</strong> and what are the options for painless generation
of service calls using this mechanism.
</p>
        <p>
Generally, one can always produce an instance <em>invoke document</em> by hand on
the client. <em>By hand</em> meaning using <font face="Courier New">System.Xml</font> classes
and DOM concepts. Since this is higly error prone and gets tedious with increasing
complexity, there is a notion of a schema compiler, which automatically translates
your XML Schema into the CLR type system. <font face="Courier New">Xsd.exe</font> and <font face="Courier New">XmlSerializer</font> are
your friends. 
</p>
        <p>
If your schema requires parts of the instance document to be digitally signed or encrypted,
you will need to adorn the serializer output with some manual DOM work. This might
also be a reason to use the third option.
</p>
        <p>
The third, and easiest option for the general developer, is to provide a <strong>local
object model</strong>, which serializes the requests on the client. This is an example:
</p>
        <p>
          <font face="Courier New">ProcessInstruction pi = new ProcessInstruction();<br />
pi.Instruction = "Add";<br />
pi.Parameter1 = 10;<br />
pi.Parameter2 = 21;<br />
pi.Sign(cert); // pi.Encrypt(cert);<br />
pi.Serialize();<br />
proxy.Process(pi.SerializedForm);</font>
        </p>
        <p>
The main benefit of this approach comes down to having an option on the server and
the client. Client developers have three different levels of complexity for generating
service calls. The model allows them to be as close to the wire as they see fit. Or
they can be abstracted completely from the wire representation if you provide a local
object model to access your services.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=ab874bc2-1546-48d1-a8aa-46f0bf876d93" />
      </div>
    </content>
  </entry>
  <entry>
    <title>XmlSerializer, Ambient XML Namespaces and Digital Signatures</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,26149053-63bc-495e-bab0-8d14e7e46190.aspx</id>
    <published>2007-09-19T22:57:57.468+02:00</published>
    <updated>2007-09-20T09:57:43.3125+02:00</updated>
    <category term="CLR" label="CLR" scheme="https://www.request-response.com/blog/CategoryView,category,CLR.aspx" />
    <category term="XML" label="XML" scheme="https://www.request-response.com/blog/CategoryView,category,XML.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you use <font face="Courier New">XmlSerializer</font> type to perform serialization
of documents which are digitally signed later on, you should be <strong>careful</strong>.
</p>
        <p>
XML namespaces which are included in the serialized form could cause trouble for anyone
signing the document after serialization, especially in the case of normalized signature
checks.
</p>
        <p>
Let's go step by step.
</p>
        <p>
Suppose we have this simple schema, let's call it <font face="Courier New">problem.xsd</font>:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0" encoding="utf-8"?&gt;<br />
&lt;xs:schema targetNamespace="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">" 
<br />
           elementFormDefault="qualified"<br />
           xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"<br />
           xmlns:xs="</font>
          <font face="Courier New">http://www.w3.org/2001/XMLSchema</font>
          <font face="Courier New">"&gt;<br />
  &lt;xs:element name="Problem" type="ProblemType"/&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">ProblemType</font>"&gt;<br />
    &lt;xs:sequence&gt;<br />
      &lt;xs:element name="Name" type="xs:string" /&gt;<br />
      &lt;xs:element name="Severity" type="xs:int" /&gt;<br />
      &lt;xs:element name="Definition" type="DefinitionType"/&gt;<br />
      &lt;xs:element name="Description" type="xs:string"
/&gt;<br />
    &lt;/xs:sequence&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:complexType name="<font color="#a52a2a">DefinitionType</font>"&gt;<br />
    &lt;xs:simpleContent&gt;<br />
      &lt;xs:extension base="xs:base64Binary"&gt;<br />
        &lt;xs:attribute name="Id" type="GUIDType"
use="required"/&gt;<br />
      &lt;/xs:extension&gt;<br />
    &lt;/xs:simpleContent&gt;<br />
  &lt;/xs:complexType&gt;<br />
  &lt;xs:simpleType name="<font color="#a52a2a">GUIDType</font>"&gt;<br />
    &lt;xs:restriction base="xs:string"&gt;<br />
      &lt;xs:pattern value="Id-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-<br />
                        
[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"/&gt;<br />
    &lt;/xs:restriction&gt;<br />
  &lt;/xs:simpleType&gt;<br />
&lt;/xs:schema&gt;</font>
        </p>
        <p>
This schema describes <em>a problem</em>, which is defined by a <strong>name</strong> (typed
as <font face="Courier New">string</font>), <strong>severity</strong> (typed as <font face="Courier New">integer</font>), <strong>definition</strong> (typed
as <font face="Courier New">byte array</font>) and <strong>description</strong> (typed
as <font face="Courier New">string</font>). The schema also says that the definition
of a problem has an <font face="Courier New">Id</font> attribute, which we will use
when digitally signing a specific problem definition. This <font face="Courier New">Id</font> attribute
is defined as GUID, as the simple type <font face="Courier New">GUIDType</font> defines.
</p>
        <p>
Instance documents validating against this schema would look like this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="</font>
          <font face="Courier New">http://www.gama-system.com/problems.xsd</font>
          <font face="Courier New">"&gt;<br />
  &lt;Name&gt;Specific problem&lt;/Name&gt;<br />
  &lt;Severity&gt;4&lt;/Severity&gt;<br />
  &lt;Definition Id="c31dd112-dd42-41da-c11d-33ff7d2112s2"&gt;MD1sDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;This is a specific problem.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Or this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit A</strong>.
</p>
        <p>
Only a few of you out there are still generating XML documents by hand, since there
exists a notion of schema compilers. In the .NET Framework world, there is <font face="Courier New">xsd.exe</font>,
which bridges the gap between the XML type system and the CLR type system.
</p>
        <p>
          <font face="Courier New">xsd.exe /c problem.xsd</font>
        </p>
        <p>
The tool compiles <font face="Courier New">problem.xsd</font> schema into the CLR
type system. This allows you to use in-schema defined classes and serialize them later
on with the <font face="Courier New">XmlSerializer</font> class. The second instance
document (exhibit A) serialization program would look like this:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br />
XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem);<br />
stream.Close();<br /></font>            
<br />
Here <strong>lie </strong>the dragons.
</p>
        <p>
          <font face="Courier New">XmlSerializer</font> class default serialization mechanism
would output this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br />
&lt;/Problem&gt;</font>
        </p>
        <p>
Mark this one as <strong>exhibit B</strong>.
</p>
        <p>
If you look closely, you will notice two additional prefix namespace declarations
in exhibit B bound to <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font> prefixes,
against exhibit A.
</p>
        <p>
The fact is, that both documents (exhibit B, and exhibit A) are valid against the <font face="Courier New">problem.xsd</font> schema.
</p>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p dir="ltr" style="MARGIN-RIGHT: 0px">
Prefixed namespaces are part of the <a href="http://www.w3.org/TR/xml-infoset/">XML
Infoset</a>. All XML processing is done on XML Infoset level. Since only declarations
(look at prefixes <font face="Courier New">xsi</font> and <font face="Courier New">xsd</font>)
are made in exhibit B, the document itself is not semantically different from exhibit
A. That stated, instance documents are equivalent and should validate against the
same schema.
</p>
        </blockquote>
        <p dir="ltr" style="MARGIN-RIGHT: 0px">
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
What happens if we sign the <font face="Courier New">Definition</font> element of
exhibit B (<font face="Courier New">XmlSerializer</font> generated, prefixed namespaces
present)?
</p>
        <p>
We get this:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem <font color="#a52a2a">xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"</font><br />
         <font color="#a52a2a">xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br /></font><font color="#000000">         xmlns="http://www.gama-system.com/problems.xsd"&gt;</font><br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <font color="#a52a2a"><strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"</strong></font>&gt;CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><font color="#000000"><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    &lt;SignedInfo&gt;<br />
      &lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/...20010315"
/&gt;<br />
      &lt;SignatureMethod Algorithm="http://www.w3.org/...rsa-sha1"
/&gt;<br />
      &lt;Reference <font color="#a52a2a">URI="#Id-b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</font><br />
        &lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/&gt;<br />
        &lt;DigestValue&gt;k3gbdFVJEpv4LWJAvvHUZZo/VUQ=&lt;/DigestValue&gt;<br />
      &lt;/Reference&gt;<br />
    &lt;/SignedInfo&gt;<br />
    &lt;SignatureValue&gt;K8f...p14=&lt;/SignatureValue&gt;<br />
    &lt;KeyInfo&gt;<br />
      &lt;KeyValue&gt;<br />
        &lt;RSAKeyValue&gt;<br />
          &lt;Modulus&gt;eVs...rL4=&lt;/Modulus&gt;<br />
          &lt;Exponent&gt;AQAB&lt;/Exponent&gt;<br />
        &lt;/RSAKeyValue&gt;<br />
      &lt;/KeyValue&gt;<br />
      &lt;X509Data&gt;<br />
        &lt;X509Certificate&gt;MIIF...Bw==&lt;/X509Certificate&gt;<br />
      &lt;/X509Data&gt;<br />
    &lt;/KeyInfo&gt;<br />
  &lt;/Signature&gt;</strong><br /></font>&lt;/Problem&gt;</font>
        </p>
        <p>
Let's call this document <strong>exhibit D</strong>.
</p>
        <p>
This document is the same as exhibit B, but has the <font face="Courier New">Definition</font> element
digitally signed. Note the <font face="Courier New">/Problem/Signature/SingedInfo/Reference[@URI]</font> value.
Digital signature is performed only on the <font face="Courier New">Definition</font> element
and not the complete document.
</p>
        <p>
Now, if one would validate the same document without the prefixed namespace declarations,
as in:
</p>
        <p>
          <font face="Courier New">&lt;?xml version="1.0"?&gt;<br />
&lt;Problem xmlns="http://www.gama-system.com/problems.xsd"&gt;<br />
  &lt;Name&gt;XML DigSig Problem&lt;/Name&gt;<br />
  &lt;Severity&gt;5&lt;/Severity&gt;<br />
  &lt;Definition <strong>Id="b01cb152-cf93-48df-b07e-97ea7f2ec2e9"&gt;</strong>CgsMDQ8=&lt;/Definition&gt;<br />
  &lt;Description&gt;Ambient namespaces break digsigs.&lt;/Description&gt;<br /><strong>  &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;<br />
    ...<br />
  &lt;/Signature&gt;</strong><br />
&lt;/Problem&gt;</font>
        </p>
        <p>
... the signature verification <strong>would fail</strong>. Let's call this document <strong>exhibit
C</strong>.
</p>
        <p>
          <font face="Courier New">&lt;theory&gt;</font>
        </p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <p>
As said earlier, all XML processing is done on the XML Infoset level. Since ambient
prefixed namespace declarations are visible in all child elements of the declaring
element, exhibits C and D are different. Explicitly, element contexts are different
for element <font face="Courier New">Definition</font>, since exhibit C does not have
ambient declarations present and exhibit D does. The signature verification <strong>fails</strong>.
</p>
        </blockquote>
        <p>
          <font face="Courier New">&lt;/theory&gt;</font>
        </p>
        <p>
Solution?
</p>
        <p>
Much simpler than what's written above. Force <font face="Courier New">XmlSerializer</font> class
to serialize what should be serialized in the first place. We need to declare the
namespace definition of the serialized document and prevent <font face="Courier New">XmlSerializer</font> to
be too smart. The .NET Framework serialization mechanism contains a <font face="Courier New">XmlSerializerNamespaces</font> class
which can be specified during serialization process.
</p>
        <p>
Since we know the only (and by the way, default) namespace of the serialized document,
this makes things work out OK:
</p>
        <p>
          <font face="Courier New">// generate problem<br />
ProblemType problem = new ProblemType();<br />
problem.Name = "XML DigSig Problem";<br />
problem.Severity = 5;<br />
DefinitionType dt = new DefinitionType();<br />
dt.Id = Guid.NewGuid().ToString();<br />
dt.Value = new byte[] { 0xa, 0xb, 0xc, 0xd, 0xf };<br />
problem.Definition = dt;<br />
problem.Description = "Ambient namespaces break digsigs.";</font>
        </p>
        <p>
          <font face="Courier New">// serialize problem<br /><strong><font color="#a52a2a">XmlSerializerNamespaces xsn = new XmlSerializerNamespaces();<br />
xsn.Add(String.Empty, "http://www.gama-system.com/problem.xsd");</font></strong></font>
        </p>
        <p>
          <font face="Courier New">XmlSerializer ser = new XmlSerializer(typeof(ProblemType));<br />
FileStream stream = new FileStream("Problem.xml", FileMode.Create, FileAccess.Write);<br />
ser.Serialize(stream, problem, <strong><font color="#a52a2a">xsn</font></strong>);<br />
stream.Close();</font>
        </p>
        <p>
This will force <font face="Courier New">XmlSerializer</font> to produce a valid document
- with valid XML element contexts, without any ambient namespaces.
</p>
        <p>
The question is, why does <font face="Courier New">XmlSerialzer</font> produce this
namespaces by default? That should be a topic for another post.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=26149053-63bc-495e-bab0-8d14e7e46190" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Oh my God: 1.1</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,d66f26c7-eb42-46f7-bd99-29b9a1062c9c.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,d66f26c7-eb42-46f7-bd99-29b9a1062c9c.aspx</id>
    <published>2007-08-29T18:40:16.15625+02:00</published>
    <updated>2007-08-29T18:40:16.15625+02:00</updated>
    <category term="Apple" label="Apple" scheme="https://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Shame? Nokia?
</p>
        <p>
Same sentence, as in <a href="http://www.engadget.com/2007/08/29/nokias-iphone-no-seriously/">Shame and
Nokia</a>?
</p>
        <p>
There is just no pride in IT anymore. Backbones are long gone too.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=d66f26c7-eb42-46f7-bd99-29b9a1062c9c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Oh my God: 1.0</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,b01fbfe1-6db1-45ad-bf57-0c4dce869053.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,b01fbfe1-6db1-45ad-bf57-0c4dce869053.aspx</id>
    <published>2007-08-29T18:35:38.90625+02:00</published>
    <updated>2007-08-29T18:35:38.90625+02:00</updated>
    <category term="Other" label="Other" scheme="https://www.request-response.com/blog/CategoryView,category,Other.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This <a href="http://vidmar.net/weblog/archive/2007/08/29/what-you-dont-want-to-see-when-you-open-your.aspx">post</a> puts
shame to a new level.
</p>
        <p>
There is no excuse for having Microsoft Access database serving <strong>any </strong>kind
of content in an online banking solution.
</p>
        <p>
The funny thing is, that even the comment excuses seem fragile. They obviously just
don't get it. The bank should not defend their position, but focus on changing it
immediately.
</p>
        <p>
So, they should fix this ASAP, then fire PR, then apologize.
</p>
        <p>
Well-done David, for exposing what should never reach a production environment. 
</p>
        <p>
Never. Ever.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=b01fbfe1-6db1-45ad-bf57-0c4dce869053" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Apple vs. Dell</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,3bda30c6-654b-4d98-8788-d2eeeafe4943.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,3bda30c6-654b-4d98-8788-d2eeeafe4943.aspx</id>
    <published>2007-08-08T20:37:18.97+02:00</published>
    <updated>2007-08-08T20:40:54.627+02:00</updated>
    <category term="Apple" label="Apple" scheme="https://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
This is why one should buy best of both worlds. Mac <strong>rules</strong> on a client.
Dell is quite competitive on the (home) server market.
</p>
        <p>
We don't care about cables around servers. Yet.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/applevsdell.jpg" />
        </p>
        <p>
So? <a href="http://www.apple.com/imac">'nuff said</a>.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3bda30c6-654b-4d98-8788-d2eeeafe4943" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Windows Vista Performance and Reliability Updates</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,3bb7bfca-61a4-40de-863f-5e8114cd8f9f.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,3bb7bfca-61a4-40de-863f-5e8114cd8f9f.aspx</id>
    <published>2007-08-08T08:13:20.455+02:00</published>
    <updated>2007-08-08T08:22:14.97075+02:00</updated>
    <category term="Windows Vista" label="Windows Vista" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
These have been brewing for a couple of months. They're out today.
</p>
        <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
          <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
            <blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
              <p>
                <img src="http://www.request-response.com/blog/images/vista_logo_small_fixed.jpg" />
              </p>
            </blockquote>
          </blockquote>
        </blockquote>
        <p>
They contain a number of patches that <strike>improve</strike> fix Vista. You
can get them here:
</p>
        <p>
          <a href="http://support.microsoft.com/?kbid=938979" target="_blank">Windows Vista
Performance Update</a>:
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=3FB80BB9-D832-425B-B42C-D3EB2071BBEC" target="_blank">x86
Download</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=24EAD3A0-77F6-4196-8A3F-78C1470AC18E" target="_blank">x64
Download</a>
          </li>
        </ul>
        <p>
          <a href="http://support.microsoft.com/?kbid=938194" target="_blank">Windows Vista
Reliability Update</a>:
</p>
        <ul>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AE2F819D-C33D-48DB-A7E3-62EEF7C1F7C2" target="_blank">x86
Download</a>
          </li>
          <li>
            <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=5B7F1544-FEF3-4C80-AF1A-8B732DCB2756" target="_blank">x64
Download</a>
          </li>
        </ul>
        <p>
Go get them. Now.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=3bb7bfca-61a4-40de-863f-5e8114cd8f9f" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Midyear Reader Profile</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,0f69303d-0a93-4d04-a7de-d76208f4b77c.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,0f69303d-0a93-4d04-a7de-d76208f4b77c.aspx</id>
    <published>2007-07-26T22:58:25.203125+02:00</published>
    <updated>2007-07-26T22:58:25.203125+02:00</updated>
    <category term="Blogging" label="Blogging" scheme="https://www.request-response.com/blog/CategoryView,category,Blogging.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Since it's summer here in Europe, and thus roughly middle of the year, here comes
your, Dear Reader, profile. 
</p>
        <p>
Mind you, only last years data (June 2006 - June 2007) is included, according to <a href="http://www.google.com/analytics">Google
Analytics</a>.
</p>
        <p>
          <strong>Browser Versions:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_1.jpg" />
        </p>
        <p>
          <strong>Operating Systems:<br /></strong>
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_2.jpg" />
        </p>
        <p>
          <strong>Browser Versions and Operating Systems:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_3.jpg" />
        </p>
        <p>
          <strong>Screen Resolutions:<br /><br /><img src="http://www.request-response.com/blog/images/readerprofile2007_4.jpg" /></strong>
        </p>
        <p>
          <strong>Adobe Flash Support:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_5.jpg" />
        </p>
        <p>
          <strong>And finally, most strangely, Java Support:</strong>
          <br />
          <br />
          <img src="http://www.request-response.com/blog/images/readerprofile2007_6.jpg" />
        </p>
        <p>
The last one surprised me.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=0f69303d-0a93-4d04-a7de-d76208f4b77c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Managed TxF: Distributed Transactions and Transactional NTFS</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,bca19fa8-7ba8-43d8-873e-3a8cf03335cb.aspx</id>
    <published>2007-07-23T22:54:13.156+02:00</published>
    <updated>2007-07-24T09:21:23.75+02:00</updated>
    <category term=".NET 3.5 - WCF" label=".NET 3.5 - WCF" scheme="https://www.request-response.com/blog/CategoryView,category,NET35WCF.aspx" />
    <category term="Transactions" label="Transactions" scheme="https://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
Based on my <a href="http://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx">previous
post</a>, I managed to get <strong>distributed transaction</strong> scenario
working using <a href="http://wcf.netfx3.com/">WCF</a>, <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a> and <a href="http://www.ibm.com/developerworks/library/specification/ws-tx/">WS-AtomicTransactions</a>.
</p>
        <p>
This means that you have the option to transport <em>arbitrary files</em>, using transactional <strong>ACID</strong> semantics,
from the client, over HTTP and MTOM.
</p>
        <p>
The idea is to integrate a distributed transaction with <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a>,
or NTFS file system transaction. This only works on Windows Server 2008 (Longhorn
Server) and Windows Vista. 
</p>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">Sample
code</a></p>
        <p>
If the client starts a transaction then <em>all files</em> within it should be stored
on the server. If something fails or client does not commit, <em>no harm is done</em>.
The beauty of this is that it's all seamlessly integrated into the current communication/OS
stack.
</p>
        <p>
This is <strong>shipping technology</strong>; you just have to dive a little deeper
to use it.
</p>
        <p>
Here's the scenario:<br /><br /><img src="http://www.request-response.com/blog/images/txf_wcf1.jpg" /></p>
        <p>
There are a couple of issues that need to be addressed before we move to the implementation:
</p>
        <ul>
          <li>
            <strong>You should use the managed wrapper included <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">here</a><br /></strong>There is support for <font face="Courier New">TransactedFile</font> and <font face="Courier New">TransactedDirectory</font> built
it. Next version of <a href="http://msdn2.microsoft.com/en-us/library/ms756482.aspx">VistaBridge</a> samples
will include an updated version of this wrapper.<br /><br /></li>
          <li>
            <strong>Limited distributed transactions support on a system drive<br /></strong>There is no way to get DTC a superior access coordinator<em></em>role for <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a> on
the system drive (think <font face="Courier New">c:\</font> system drive). This is
a major downside in the current implementation of <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a>,
since I would prefer that system/boot files would be transaction-locked anyway. You
have two options if you want to run the <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">following
sample</a>:<br /><br /><ul><li><strong>Define secondary resource manager for your directory</strong><br />
This allows system drive resource manager to still protect system files, but creates
a secondary resource manager for the specified directory. Do this: 
<ul><li><font face="Courier New">fsutil resource create c:\txf</font></li><li><font face="Courier New">fsutil resource start c:\txf<br /></font>You can query your new secondary resource manager by <font face="Courier New">fsutil
resource info c:\txf</font>.<br /><br /></li></ul></li><li><strong>Use another partition<br /></strong>Any partition outside the system partition is ok. You cannot use network
shares, but <em>USB keys will work</em>. Plug it in and change the paths as defined
at the end of this post.</li></ul></li>
        </ul>
        <p>
OK, here we go.
</p>
        <p>
Here's the service contract:
</p>
        <p>
          <font face="Courier New">[ServiceContract(SessionMode = SessionMode.Allowed)]<br />
interface ITransportFiles<br />
{<br />
   [OperationContract]<br />
   [TransactionFlow(TransactionFlowOption.Allowed)]<br />
   byte[] GetFile(string name);</font>
        </p>
        <p>
          <font face="Courier New">   [OperationContract]<br />
   [TransactionFlow(TransactionFlowOption.Allowed)]<br />
   void PutFile(byte[] data, string name);<br />
} </font>
        </p>
        <p>
We allow the sessionful binding (it's not <em>required</em>, though) and allow transactions
to flow from the client side. Again, transactions are not <em>mandatory</em>, since
client may opt-out of using them and just transport files without a transaction.
</p>
        <p>
The provided transport mechanism uses <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a>,
since the contract's parameter model is appropriate for it and because it's much more
effective transferring binary data.
</p>
        <p>
So here's the service config:
</p>
        <p>
          <font face="Courier New">&lt;system.serviceModel&gt;<br />
  &lt;bindings&gt;<br />
    &lt;wsHttpBinding&gt;<br /><strong>      &lt;binding name="MTOMBinding"<br />
          transactionFlow="true"<br />
          messageEncoding="Mtom"<br />
          maxReceivedMessageSize="10485760"&gt;<br />
        &lt;readerQuotas maxArrayLength="10485760"/&gt;</strong><br />
      &lt;/binding&gt;<br />
    &lt;/wsHttpBinding&gt;<br />
  &lt;/bindings&gt;<br />
  &lt;services&gt;<br />
    &lt;service name="WCFService.TransportService"&gt;<br />
      &lt;host&gt;<br />
        &lt;baseAddresses&gt;<br />
          &lt;add baseAddress="</font>
          <font face="Courier New">http://localhost:555/transportservice"</font>
          <font face="Courier New">&gt;<br />
        &lt;/baseAddresses&gt;<br />
      &lt;/host&gt;<br />
      &lt;endpoint address=""<br />
          binding="wsHttpBinding"<br /><strong>          bindingConfiguration="MTOMBinding"<br /></strong>          contract="WCFService.ITransportFiles"/&gt;<br />
    &lt;/service&gt;<br />
  &lt;/services&gt;<br />
&lt;/system.serviceModel&gt;</font>
        </p>
        <p>
Here, <font face="Courier New">MTOMBinding</font> is being used to specify <a href="http://www.w3.org/TR/soap12-mtom/">MTOM</a> wire
encoding. Also, quotas and <font face="Courier New">maxReceivedMessageSize</font> attribute
is being adjusted to 10 MB, since we are probably transferring larger binary files.
</p>
        <p>
Service implementation is straight forward:
</p>
        <p>
          <font face="Courier New">[ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]<br />
class TransportService : ITransportFiles<br />
{<br />
    [OperationBehavior(TransactionScopeRequired = true)]<br /><strong>    public byte[] GetFile(string name)<br /></strong>    {<br />
        Console.WriteLine("GetFile: {0}", name);<br />
        Console.WriteLine("Distributed Tx ID: {0}",<br />
          Transaction.Current.TransactionInformation.DistributedIdentifier);<br />
        return ReadFully(TransactedFile.Open(@"C:\TxF\Service\"
+ name,<br />
          FileMode.Open, FileAccess.Read,
FileShare.Read), 0);<br />
    }</font>
        </p>
        <p>
          <font face="Courier New">    [OperationBehavior(TransactionScopeRequired
= true)]<br /><strong>    public void PutFile(byte[] data, string filename)<br /></strong>    {<br />
        Console.WriteLine("PutFile: {0}", filename);<br />
        Console.WriteLine("Distributed Tx ID: {0}",<br />
          Transaction.Current.TransactionInformation.DistributedIdentifier);</font>
        </p>
        <p>
          <font face="Courier New">        using (BinaryWriter
bw = new BinaryWriter(<br />
            TransactedFile.Open(@"C:\TxF\Service\"
+ filename,<br />
              FileMode.Create,
FileAccess.Write, FileShare.Write)))<br />
        {<br />
            bw.Write(data,
0, data.Length);<br />
            
<br />
            // clean up<br />
            bw.Flush();<br />
        }<br />
    }<br />
}</font>
        </p>
        <p>
Client does four things:
</p>
        <ol>
          <li>
Sends three files (client - server) - no transaction 
</li>
          <li>
Gets three files (server - client) - no transaction 
</li>
          <li>
Sends three files (client - server) - distributed transaction, all or nothing 
</li>
          <li>
Gets three files (server - client) - distributed transaction, all or nothing</li>
        </ol>
        <p>
Before you run:
</p>
        <ul>
          <li>
Decide on the secondary resource manager option (system drive, enable it using <font face="Courier New">fsutil.exe</font>)
or use another partition (USB key) 
</li>
          <li>
Change the paths to your scenario. The sample uses <font face="Courier New">C:\TxF</font>, <font face="Courier New">C:\TxF\Service</font> and <font face="Courier New">C:\TxF\Client</font> and
a secondary resource manager. Create these directories before running the sample.</li>
        </ul>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/txf_wcf.zip">Sample
code</a></p>
        <p>
          <font color="#a9a9a9" size="1">This sample is provided without any warranty. It's
a sample, so don't use it in production environments.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=bca19fa8-7ba8-43d8-873e-3a8cf03335cb" />
      </div>
    </content>
  </entry>
  <entry>
    <title>WS-Management: Windows Vista and Windows Server 2008</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c.aspx</id>
    <published>2007-07-22T20:48:22.421+02:00</published>
    <updated>2007-07-22T21:01:09.078125+02:00</updated>
    <category term="Web Services" label="Web Services" scheme="https://www.request-response.com/blog/CategoryView,category,WebServices.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
I dived into <a href="http://specs.xmlsoap.org/ws/2005/06/management/ws-management.pdf">WS-Management</a> support
in Vista / <strike>Longhorn Server</strike> Windows Server 2008 this weekend. There
are a couple of caveats if you want to enable remote WS-Management based access to
these machines. Support for remote management is also built into Windows Server 2003 <strong>R2</strong>.
</p>
        <p>
WS-Management specification allows remote access to any resource that implements the
specification. Everything accessed in a WS-Management world is a resource, which is
identifiable by a URI. The spec uses WS-Eventing, WS-Enumeration, WS-Transfer and
SOAP 1.2 via HTTP.
</p>
        <p>
Since remote management implementation in Windows acknowledges all the work done in
the <a href="http://www.microsoft.com/whdc/system/pnppwr/wmi/default.mspx">WMI</a> space,
you can simply issue commands in terms of URIs that incorporate WMI namespaces.
</p>
        <p>
          <img src="http://www.request-response.com/blog/images/ws-management1.jpg" />
        </p>
        <p>
For example, the WMI class or action (method) is identified by a URI, just as any
other WS-Management based resource. You can construct access to any WMI class / action
using the following semantics:
</p>
        <ul>
          <li>
            <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi</font> denotes
a <strong>default WMI namespace</strong> accessible via WS-Management 
</li>
          <li>
            <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/default</font> denotes
access to <font face="Courier New"><strong>root/default</strong></font> namespace</li>
        </ul>
        <p>
Since the majority of WMI classes are in <font face="Courier New">root/cimv2</font> namespace,
you should use the following URI to access those:
</p>
        <p>
          <font face="Courier New">http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2</font>
        </p>
        <p>
OK, back to WS-Management and its implementation in Vista / Windows Server 2008.
</p>
        <p>
First, Windows Server 2008 has the <strong>Windows Remote Management</strong> service
started up by default. Vista doesn't. So <em>start it up</em>, if you're on a Vista
box.
</p>
        <p>
Second, depending on your network configuration, if you're in a workgroup environment
(not joined to a domain) you should tell your client to <em>trust the server side</em>.
</p>
        <p>
Trusting the server side involves executing a command on a client. Remote management
tools included in Windows Server 2008 / Windows Vista are capable of configuring the
local machine and issuing commands to remote machine. There are basically two
tools which allow you to setup the infrastructure and issue remote commands to the
destination. They are:
</p>
        <ul>
          <li>
            <font face="Courier New">winrm.cmd</font> (uses <font face="Courier New">winrm.vbs</font>),
defines configuration of local machine 
</li>
          <li>
            <font face="Courier New">winrs.exe</font> (<font face="Courier New">winrscmd.dll</font> and
friends), Windows Remote Shell client, issues commands to a remote machine</li>
        </ul>
        <p>
As said, WS-Management support is enabled by default in Windows Server 2008. This
means that the appropriate service is running, but one should still define basic configuration
on it. Nothing is enabled by default; you have to <strong>opt-in</strong>. 
</p>
        <p>
Since Microsoft is progressing to a more admin friendly environment, this is done
by issuing the following command (server command):
</p>
        <p>
          <font face="Courier New">winrm quickconfig</font>
          <font face="Verdana"> (or <font face="Courier New">winrm
qc</font>)</font>
        </p>
        <p>
This enables the obvious:
</p>
        <ul>
          <li>
Starts the <strong>Windows Remote Management</strong> service (if not stared; in Windows
Vista case) 
</li>
          <li>
Enables <strong>autostart</strong> on the Windows Remote Management service 
</li>
          <li>
Starts up a <strong>listener</strong> for all machine's IP addresses 
</li>
          <li>
Configures appropriate <strong>firewall</strong> exceptions</li>
        </ul>
        <p>
You should get the following output:
</p>
        <p>
          <font face="Courier New">[c:\windows\system32]winrm quickconfig<br /></font>
          <font face="Courier New">
            <br />
WinRM is not set up to allow remote access to this machine for management.<br />
The following changes must be made:</font>
        </p>
        <p>
          <font face="Courier New">Create a WinRM listener on HTTP://* to accept WS-Man requests
to any IP on this machine.<br />
Enable the WinRM firewall exception.</font>
        </p>
        <p>
          <font face="Courier New">Make these changes [y/n]? y</font>
        </p>
        <p>
          <font face="Courier New">WinRM has been updated for remote management.<br /></font>
          <font face="Courier New">Created a WinRM listener on HTTP://* to accept WS-Man
requests to any IP on this machine.<br />
WinRM firewall exception enabled.</font>
        </p>
        <p>
There are options in <font face="Courier New">winrm.cmd</font> to fine tune anything,
including the listening ports and / or SSL (HTTPS) support. In a trusted environment
you probably don't want to issue commands using HTTP based mechanism, since you are
located behind the trust boundary and have complete control over available (allowed)
TCP ports.
</p>
        <p>
You can now issue remote management commands against the configured server, but only
if the communication <strong>is trusted</strong>. So in case you are in a workgroup
environment (client and server in a workgroup), this should get you started (client
command):
</p>
        <p>
          <font face="Courier New">winrm set winrm/config/client @{TrustedHosts="&lt;server
ip or hostname&gt;"}</font>
        </p>
        <p>
You can specify multiple trusted servers using a comma:
</p>
        <p>
          <font face="Courier New">winrm set winrm/config/client @{TrustedHosts="10.10.10.108,
10.10.10.109"}</font>
        </p>
        <p>
This trusts the server(s) no matter what. Even over HTTP only.
</p>
        <p>
Enumerating the configured listeners - remember, listener is located on the destination
side - is done via: 
</p>
        <p>
          <font face="Courier New">winrm enumerate winrm/config/listener</font>
        </p>
        <p>
OK, now we're able to issue commands to the remote side using WS-Management infrastructure.
You can, for example, try this (client command):
</p>
        <p>
          <font face="Courier New">winrs -r:http://&lt;server ip&gt; -u:&lt;username&gt; -p:&lt;password&gt;
&lt;shell command&gt;<font face="Verdana">, ie.<br /></font>winrs -r:http://10.10.10.108 -u:administrator -p:p$38E0jjW! dir -s</font>
        </p>
        <p>
or
</p>
        <p>
          <font face="Courier New">winrs -r:http://10.10.10.108 -u:administrator -p:p$38E0jjW!
hostname</font>
        </p>
        <p>
You can even explose HTTP based approach through your firewall if you're crazy enough.
But using HTTPS would be the smart way out. What you need is a valid certificate with
server authentication capability and a matching CN. Self-signed certs won't work.
</p>
        <p>
Simple and effective.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=e4ad0d8c-6fb6-40b8-9b52-7ab9092ccc7c" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Managed TxF: Support in Windows Vista and Windows Server 2008</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00.aspx</id>
    <published>2007-07-20T16:59:16.281+02:00</published>
    <updated>2007-07-23T20:35:56.625+02:00</updated>
    <category term="Transactions" label="Transactions" scheme="https://www.request-response.com/blog/CategoryView,category,Transactions.aspx" />
    <category term="Windows Vista" label="Windows Vista" scheme="https://www.request-response.com/blog/CategoryView,category,WindowsVista.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
If you happen to be on a Windows Vista or Windows Server 2008 box, there is some goodness
going your way.
</p>
        <p>
There is a basic managed <a href="http://msdn2.microsoft.com/En-US/library/aa365456.aspx">TxF</a> (Transactional
NTFS) wrapper available (unveiled by <a href="http://geekswithblogs.net/jolson/Default.aspx">Jason
Olson</a>).
</p>
        <p>
What this thing gives you is this:
</p>
        <p>
          <font face="Courier New">try<br />
{<br />
   using (TransactionScope tsFiles = new TransactionScope<br />
      </font>
          <font face="Courier New">TransactionScopeOption.RequiresNew))<br />
   {<br />
      WriteFile("TxFile1.txt");<br />
      <strong>throw new FileNotFoundException();<br /></strong>      WriteFile("TxFile2.txt");<br />
      tsFiles.Complete();<br />
   }<br />
}<br />
catch (Exception ex)<br />
{<br />
   Console.WriteLine(ex.Message);<br />
}</font>
        </p>
        <p>
          <font face="Courier New">WriteFile</font> method that does, well, file writing, is
here:
</p>
        <p>
          <font face="Courier New">using (TransactionScope tsFile = new TransactionScope<br />
      (TransactionScopeOption.Required))<br />
{<br />
   Console.WriteLine("Creating transacted file '{0}'.", filename);</font>
        </p>
        <p>
          <font face="Courier New">   using (StreamWriter tFile = new StreamWriter(TransactedFile.Open(filename, <br />
          FileMode.Create, 
<br />
          FileAccess.Write, 
<br />
          </font>
          <font face="Courier New">FileShare.None)))<br />
   {<br />
      tFile.Write(String.Format("Random data. My filename
is '{0}'.", 
<br />
          filename));<br />
   }</font>
        </p>
        <p>
          <font face="Courier New">   tsFile.Complete();<br />
   Console.WriteLine("File '{0}' written.", filename);<br />
}</font>
        </p>
        <p>
So we have a nested <font face="Courier New"><a href="http://msdn2.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">TransactionScope</a></font> with
a curious type - <font face="Courier New">TransactedFile</font>. Mind you, there is
support for <font face="Courier New">TransactedDirectory</font> built in.
</p>
        <p>
What's happening underneath is awesome. The wrapper talks to unmanaged implementation
of TxF, which is built in on every Vista / Longhorn Server box. 
</p>
        <p>
What you get is transactional file system support with <a href="http://msdn2.microsoft.com/en-us/library/system.transactions.aspx">System.Transactions</a>.
And it's going to go far beyond that.
</p>
        <p>
I wrote some sample code, go get it. Oh, BTW, remove the exception line to see the
real benefit.
</p>
        <p>
Download: <a href="http://www.request-response.com/blog/content/binary/TxF_TransactedFile.zip">Sample
code</a></p>
        <p>
          <font color="#a9a9a9" size="1">This sample is provided without any warranty. It's
a sample, so don't use it in production environments.</font>
        </p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=c421ff72-d5bc-4b5f-8c52-ed5e73e8dd00" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Problem: Adding custom properties to document text in Word 2007</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,839bd119-ae37-45d1-9652-a02006342aa9.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,839bd119-ae37-45d1-9652-a02006342aa9.aspx</id>
    <published>2007-07-09T22:44:50.53125+02:00</published>
    <updated>2007-07-09T22:44:50.53125+02:00</updated>
    <category term="Microsoft" label="Microsoft" scheme="https://www.request-response.com/blog/CategoryView,category,Microsoft.aspx" />
    <category term="Personal" label="Personal" scheme="https://www.request-response.com/blog/CategoryView,category,Personal.aspx" />
    <category term="Work" label="Work" scheme="https://www.request-response.com/blog/CategoryView,category,Work.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is some serious pain going on when you need to add a simple <em>custom document
property</em> into multiple Word 2007 text areas.
</p>
        <p>
Say you have a <strong>version property</strong> that you would need to update using
the document property mechanics. And say you use it in four different locations inside
your document.
</p>
        <ul>
          <li>
There is no <em>ribbon command</em> for it. There was a menu option in Word 2003 days.</li>
          <li>
There is no simple way of adding to <em>The Ribbon</em>. You have to customize
the Quick Access Toolbar and stick with ugly, limited use icons forever or so.</li>
          <ul>
            <li>
You need to choose <font face="Courier New">All commands</font> in <font face="Courier New">Customize
Quick Access Toolbar</font> to find <font face="Courier New">Insert Field</font> option.</li>
          </ul>
          <li>
This is not the only limiting option for a power user. The number of simplifications
for the casual user is equal to the number of limitations for the power user. And
yes, I know, casual users win the number battle.</li>
        </ul>
        <p>
          <img src="http://www.request-response.com/blog/images/wordinsertfield.jpg" />
        </p>
        <p>
So:
</p>
        <ol>
          <li>
Right click <em>The Ribbon</em> and select <font face="Courier New">Customize Quick
Access Toolbar</font></li>
          <li>
Select <font face="Courier New">All Commands</font> and <font face="Courier New">Insert
Field</font></li>
          <li>
Add it to <font face="Courier New">Custom Quick Access Toolbar</font></li>
          <li>
Click the new icon</li>
          <li>
In <font face="Courier New">Field names</font> select <font face="Courier New">DocProperty</font></li>
          <li>
Select your value, in this example <font face="Courier New">Version</font></li>
        </ol>
        <p>
Yes. <strong>Ease of use.</strong></p>
        <p>
Please, give me an option to get my menus and keyboard shortcuts back.
</p>
        <p>
Pretty please.
</p>
        <p>
 
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=839bd119-ae37-45d1-9652-a02006342aa9" />
      </div>
    </content>
  </entry>
  <entry>
    <title>Apple iPhone Hacking</title>
    <link rel="alternate" type="text/html" href="https://www.request-response.com/blog/PermaLink,guid,1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2.aspx" />
    <id>https://www.request-response.com/blog/PermaLink,guid,1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2.aspx</id>
    <published>2007-07-08T15:20:10.953+02:00</published>
    <updated>2007-07-08T15:24:07.234375+02:00</updated>
    <category term="Apple" label="Apple" scheme="https://www.request-response.com/blog/CategoryView,category,Apple.aspx" />
    <content type="xhtml">
      <div xmlns="http://www.w3.org/1999/xhtml">
        <p>
There's some serious <a href="http://www.apple.com/iphone">iPhone</a> hacking going
on during the last week or so.
</p>
        <p>
          <a href="http://iphone.fiveforty.net/wiki/index.php/Main_Page">Here</a>'s the wiki
page, that has lots of information on the project. Main devs, working on the unlock
problem are from US and Hungary as it seems.
</p>
        <p>
The forum is <a href="http://hackint0sh.org/forum/forumdisplay.php?f=123">here</a>.
Deliverables <a href="http://iphonesvn.halifrag.com/svn/iPhone">here</a>.
</p>
        <p>
The progress is steady. There is a <a href="http://iphone.fiveforty.net/wiki/index.php/Latest_Progress_Report">now
a way</a> to issue commands to the system, including moving of files, activation (which
was achieved in three days) and directory listing inside the sandboxed filesystem.
</p>
        <p>
I'm following the progress (with <a href="http://hana.request-response.com">Hana</a> -
she's cheering along), because it's fun to know the internals of a locked down Apple
device.
</p>
        <img width="0" height="0" src="https://www.request-response.com/blog/aggbug.ashx?id=1a5a6211-f6bd-4b5a-89d5-2ac6abbff7f2" />
      </div>
    </content>
  </entry>
</feed>