<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'><id>tag:blogger.com,1999:blog-1444511670241661414</id><updated>2008-03-07T01:46:51.829+01:00</updated><title type='text'>Technoblog</title><link rel='alternate' type='text/html' href='http://www.lobotommy.com/technoblog/'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.lobotommy.com/technoblog/atom.xml'/><author><name>Lobotommy</name></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1444511670241661414.post-2871379378036107922</id><published>2008-03-07T00:20:00.012+01:00</published><updated>2008-03-07T01:46:51.860+01:00</updated><title type='text'>Linq and untyped DataSets</title><content type='html'>As a small update to the &lt;a href="http://www.lobotommy.com/technoblog/2008/03/reading-weather-data-from-wwwyrno.html"&gt;previous post&lt;/a&gt; - if you don't fancy looking through each table in an untyped dataset then linq is your friend. For instance to join information from two of the yr.no-service tables you can do this:&lt;br /&gt;&lt;br /&gt;// Join "time" and "temperature"-tables,&lt;br /&gt;// Get id, temperature, from time and to time&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            var query =&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                from time in ds.Tables["time"].AsEnumerable()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                join temp in ds.Tables["temperature"].AsEnumerable()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                on time.Field&lt;int&gt;&amp;lt;int&amp;gt;("time_id") equals&lt;/int&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    temp.Field&lt;int&gt;&amp;lt;int&amp;gt;("time_id")                &lt;/int&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                select new&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    TemperatureId = time.Field&amp;lt;int&amp;gt;&lt;int&gt;("time_id"),&lt;/int&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    Tempearature = temp.Field&amp;lt;string&amp;gt;&lt;string&gt;("value"),&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    FromTime = time.Field&lt;string&gt;&amp;lt;string&amp;gt;("from"),&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    ToTime = time.Field&amp;lt;string&amp;gt;&lt;string&gt;("to"),&lt;/string&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                };&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Simple output&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            foreach (var tempInfo in query)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                Console.WriteLine("{0} - {1}:\t{2}",&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    tempInfo.FromTime,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    tempInfo.ToTime,&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;                    tempInfo.Tempearature);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;For more information check this &lt;a href="http://msdn2.microsoft.com/en-us/library/bb399358.aspx"&gt;link on MSDN&lt;/a&gt;.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;</content><link rel='alternate' type='text/html' href='http://www.lobotommy.com/technoblog/2008/03/linq-and-untyped-datasets.html' title='Linq and untyped DataSets'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1444511670241661414&amp;postID=2871379378036107922' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.lobotommy.com/technoblog/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2871379378036107922'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2871379378036107922'/><author><name>Lobotommy</name></author></entry><entry><id>tag:blogger.com,1999:blog-1444511670241661414.post-2672225999068090566</id><published>2008-03-06T22:33:00.008+01:00</published><updated>2008-03-07T01:36:23.864+01:00</updated><title type='text'>Reading weather data from www.yr.no</title><content type='html'>Thanks to Sjur for the tip about the weather service at www.yr.no, which actually has a &lt;a href="http://www.yr.no/verdata/1.3316805"&gt;web service publishing pure xml data&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To access a weather service for your favourite location, look it up through the &lt;a href="http://www.yr.no/"&gt;yr.no&lt;/a&gt; search and add &lt;span style="font-style: italic;"&gt;"Varsel.xml"&lt;/span&gt; to the URL.&lt;br /&gt;&lt;br /&gt;Access from C# / .Net:&lt;br /&gt;&lt;br /&gt;// Load xml from URL&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            string feedURL = @"http://www.yr.no/sted/Norge/Oslo/Oslo/Oslo/Varsel.xml";&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;XmlDocument xDoc = new XmlDocument();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            xDoc.Load(feedURL);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;// Get forecast information&lt;br /&gt;XmlNodeList forecast = xDoc.GetElementsByTagName("forecast");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;// Read into dataset&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;            DataSet ds = new DataSet();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;StringReader readerStream&lt;/span&gt;&lt;span style="font-style: italic;"&gt; = new StringReader(forecast[0].OuterXml);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;ds.ReadXml(readerStream);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;And you have an untyped dataset full of weather information.&lt;br /&gt;&lt;br /&gt;Thank you yr.no.&lt;br /&gt;&lt;br /&gt;(check the &lt;a href="http://www.lobotommy.com/technoblog/2008/03/linq-and-untyped-datasets.html"&gt;next post&lt;/a&gt; for how to read the data with Linq)</content><link rel='alternate' type='text/html' href='http://www.lobotommy.com/technoblog/2008/03/reading-weather-data-from-wwwyrno.html' title='Reading weather data from www.yr.no'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1444511670241661414&amp;postID=2672225999068090566' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.lobotommy.com/technoblog/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2672225999068090566'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2672225999068090566'/><author><name>Lobotommy</name></author></entry><entry><id>tag:blogger.com,1999:blog-1444511670241661414.post-2573583339600658145</id><published>2008-01-04T19:43:00.000+01:00</published><updated>2008-01-05T14:00:25.474+01:00</updated><title type='text'>A new lobotommy.com</title><content type='html'>Stuff happened and the old lobotommy.com had to die. I decided to skip the good, old and stubborn DotNetNuke for something simpler. I didn't find many good alternatives and decided to start coding.&lt;br /&gt;&lt;br /&gt;There will be less features behind the new pages, definitely, but hopefully building something from scratch will help me learn some web stuff on the way.</content><link rel='alternate' type='text/html' href='http://www.lobotommy.com/technoblog/2008/01/lobotommycom-is-dead-long-live.html' title='A new lobotommy.com'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1444511670241661414&amp;postID=2573583339600658145' title='0 Comments'/><link rel='replies' type='application/atom+xml' href='http://www.lobotommy.com/technoblog/atom.xml' title='Post Comments'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2573583339600658145'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1444511670241661414/posts/default/2573583339600658145'/><author><name>Lobotommy</name></author></entry></feed>