This is the Blog of Kjetil Kristoffer Solberg. Please feel free to comment on any blog article.
I created an application that tries out the monty hall problem, and I was able to get the result people claim with changing the door. The following screenshot shows a large run.
Back in 2004 I created a syndication library for consuming and creating RSS/RDF/ATOM feeds. This library has been lying around for many years and I finally decided to make it public by making it downloadable from my homepage
This blog post will show some code examples and explain a little about how to use the library.
The first thing to show is how to create an RSS feed. I will not show how to create RDF or ATOM feeds because they follow the same procedure albeit other classes, and if you understand RSS you will understand the creation of RDF and ATOM as well. Note however that RSS/RDF and ATOM lie in their own namespaces.
In the following example, note that we use namespace extensions to the RSS feed using the SyndicationModule and SyndicationModuleCollection objects.
Rss rss = new Rss();
rss.Channel.Cloud = new RssCloud("www.ikjetil.no", "80", "path", "registerProcedure", "soap");
rss.Channel.Copyright = "Copyright (c) Kjetil Kristoffer Solberg";
rss.Channel.Description = "Description here.";
rss.Channel.Generator = "ItSoftware.Syndication";
rss.Channel.Language = "English";
rss.Channel.PubDate = RssDateTime.ToString(DateTime.Now, new TimeSpan(1, 0, 0));
rss.Channel.Title = "Showcase RSS feed.";
rss.Channel.Description = "RSS Channel Description.";
rss.Channel.Link = "http://www.itsoftware.no";
RssItem item = new RssItem();
item.Title = "A blog about a C# LINQ Provider";
item.PubDate = new RssDateTime(DateTime.Now, new TimeSpan(1, 0, 0)).ToString();
item.Link = "http://www.mylinkdomain.domain/rss.aspx?T=123";
item.Description = "I've just created a C# linq provider...";
item.Author = "Kjetil Kristoffer Solberg";
item.Category = new RssCategoryCollection();
item.Comments = "http://www.mylinkdomain.domain/rss.aspx?T123#WhatDoYouThink";
item.GUID = new RssGuid(Guid.NewGuid().ToString(),"true");
item.Modules = new ItSoftware.Syndication.SyndicationModuleCollection();
SyndicationModule moduleCommentRss = item.Modules.Add( new SyndicationModule("wfw", "http://wellformedweb.org/CommentAPI/", SyndicationModuleNamespacePosition.DocumentElement));
SyndicationModuleElement moduleElementCommentRss = new SyndicationModuleElement("commentRss", "http://www.mydomain.domain/rss.aspx?T=123&C=1",
SyndicationModule moduleComments = item.Modules.Add( new SyndicationModule("slash", "http://purl.org/rss/1.0/modules/slash/", SyndicationModuleNamespacePosition.DocumentElement));
SyndicationModuleElement moduleElementComments = new SyndicationModuleElement("comments", "1", SyndicationModuleElementValueType.InnerText);
string rssXml = rss.Save(RssVersion.RSS_2_0_1, "utf-8").OuterXml;
To consume RSS/RDF and ATOM feeds you just do the following. Note that the uri could be a local file uri or http/ftp uri
SyndicationBase sb = Syndication.Load(new Uri("http://www.ikjetil.no/Home/RssFeed/1?type=rss"));
if (sb is Rss)
// We have a RSS feed. Consume rss object.
Rss rss = sb as Rss;
else if (sb is Rdf)
// We have a RDF feed. Consume rdf object.
Rdf rdf = sb as Rdf;
else if (sb is Atom)
// We have an ATOM feed. Consume ATOM object.
Atom atom = sb as Atom;
catch (System.Net.WebException )
// Invalid http/ftp uri
catch ( SyndicationFormatInvalidException )
// Invalid syndication format
The next sample shows a simple F# console application that retrieves the current weather and prints it to the console
module ModuleMain =
let main(args : string) =
let sb : SyndicationBase = Syndication.Load(new Uri(url))
let rss : Rss = sb :?> Rss
printf "\n\n## Today ##\n%s\n\n" rss.Channel.Items..Description
These three examples should be all that you need to understand how to create and consume syndication feeds.
Note that you could also load the syndication feed from a string using the Syndication.LoadSyndication method.
All too many of us live our lives inside this bubble of human made concepts, or virtual reality. At some point in time we came to the conclusion that reality wasn't good enough, and we started to think abstract thoughts about concepts like society, democracy, economy, rules, regulations, law and justice. We have all become part of something that is not reality, but virtual reality. A reality where our existence is based soly on our position within these concepts. Are we alive or are we robots parts of some runaway system of abstraction?
I want to wake up. Where is reality?
The last two weeks I have been working on a LINQ provider for Synergi. LINQ is a very nice and useful mechanism for extracting data from any type of data store. When creating a LINQ provider there are some hurdles to overcome. Once you get an understanding of IQueryProvider, IOrderedQueryable<T> and the ExpressionVisitor abstract class, things begin to fall into place.
The following example shows two queries. They both produce the same result, but the last one specifies the entire query using numbers, while the first one uses text representation. When using text representation the text is converted to a number before the search is performed.
SynergiQueryContext ctx = new SynergiQueryContext(ConfigurationInformation.FromAppSettings, new WebServicesParameters("extensive", "extensive",250,2));
var query = from c in ctx.QuerySynergi
where c.ImportDatabaseID == 2
&& c.CaseTypeD == "Audit p%"
&& c.StatusD == "Registered"
&& c.PersonInChargeD == "%extensive%"
&& c.UnitInChargeD == "Unit 0%"
orderby c.CaseNo ascending
foreach (var obj in query)
var query2 = from c in ctx.QuerySynergi
where c.ImportDatabaseID == 2
&& c.CaseType == 115
&& c.Status == 1
&& c.PersonInCharge == 3
&& c.UnitInCharge == 1
orderby c.CaseNo ascending
foreach (var obj in query2)
Both examples produce the same result.
The LINQ provider is not finished yet. There are still a lot more search parameters to add to it, but it is a good example of a LINQ prototype for Synergi.