<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Radu Poenaru &#187; 2009 &#8211; Fraunhofer FIT</title>
	<atom:link href="http://www.radupoenaru.com/category/my-work/fit/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.radupoenaru.com</link>
	<description>CTO, Software engineer and Team leader</description>
	<lastBuildDate>Mon, 26 Jul 2010 19:52:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Import CSV file and query it with LINQ</title>
		<link>http://www.radupoenaru.com/import-csv-file-and-query-it-with-linq/</link>
		<comments>http://www.radupoenaru.com/import-csv-file-and-query-it-with-linq/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 19:02:00 +0000</pubDate>
		<dc:creator>Radu Poenaru</dc:creator>
				<category><![CDATA[2009 - Fraunhofer FIT]]></category>
		<category><![CDATA[CSV Parsing]]></category>
		<category><![CDATA[Import CSV]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[LINQ Query]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.radupoenaru.com/?p=973</guid>
		<description><![CDATA[Assume that you have an plain text, old Comma Separated Values file filled with your precious export from a legacy system. How can you process it easily now? The first answer that is worth considering is parse it to LINQ, the language-integrated query, which is a collection of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations.<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/import-csv-file-and-query-it-with-linq/">Import CSV file and query it with LINQ</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img style="border-right-width: 0px; margin: 10px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="How to easily import CSV file and query it with LINQ" border="0" alt="How to easily import CSV file and query it with LINQ" align="left" src="http://www.radupoenaru.com/wp-content/uploads/2010/02/CsvDelimited.png" width="100" height="100" /> Assume that you have an plain text, old Comma Separated Values file filled with your precious export from a legacy system. How can you process it easily now? The first answer that comes to mind is to parse it and load it into a datatable and later process it by using DataTable.Select() method. But this approach has some limitations – like splitting data into several tables and then join them.</p>
<p>One would imagine that parsing CSV files is a straightforward and boring task, given that it is quite a while since CSV is around. Some of them are correct &#8211; in the sense that many implementations merely use some splitting method like <code>String.Split()</code>. Some don’t even offer the specification of the values splitting character – so your file wouldn’t be parsed correctly if instead of <strong>,</strong> you have <strong>; </strong>as separator – yet another thing to modify if you’re lucky enough to have the sources. Others will not handle properly field values with commas because the simple split method of the String class. But there are better implementations that take care about escaped quotes, trimming spaces before and after fields and other small and useful details, but very few that I found did it all as I liked it &#8211; and at least as importantly, in a <strong>fast</strong> and <strong>efficient</strong> manner.</p>
<p> <span id="more-973"></span>
</p>
<p>After trying several methods to parse the csv file, I endup using <b><a href="http://www.codeproject.com/Members/Matt-Perdeck">Matt Perdeck</a>’</b>s LINQ to CSV library presented in its article on <a href="http://www.codeproject.com/KB/linq/LINQtoCSV.aspx">The Code Project</a> website.</p>
<p>Among the feature that I used and liked very much I would mention (from the article):</p>
<ul>
<li>Follows the <a href="http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm">most common rules for CSV files</a>. Correctly handles data fields that contain commas and line breaks. </li>
<li>In addition to comma, most delimiting characters can be used, including tab for tab delimited fields. </li>
<li>Can be used with an <code>IEnumerable</code> of an anonymous class &#8211; which is often returned by a LINQ query. </li>
<li>Supports deferred reading. </li>
<li>Supports processing files with international date and number formats. </li>
<li>Supports different character encodings if you need them. </li>
<li>Recognizes a wide variety of date and number formats when reading files. </li>
<li>Provides fine control of date and number formats when writing files. </li>
<li>Robust error handling, allowing you to quickly find and fix problems in large input files. </li>
</ul>
<p>Using the library is straight-forward: after downloading the zip file from the <a href="http://www.codeproject.com/KB/linq/LINQtoCSV.aspx">The Code Project</a> (this required that you have an account there) you can start using it by including it as a referenced library in your project.</p>
<p>Next step is to define the layout of your csv file, in a manner that CSVtoLINQ to be able to map the data from file (which is pure text) to correct data types :</p>
<pre class="brush: csharp">using LINQtoCSV;
using System;

class Product
{
    [CsvColumn(Name = &quot;ProductName&quot;, FieldIndex = 1)]
    public string Name { get; set; }

    [CsvColumn(FieldIndex = 2, OutputFormat = &quot;dd MMM HH:mm:ss&quot;)]
    public DateTime LaunchDate { get; set; }

    [CsvColumn(FieldIndex = 3, CanBeNull = false, OutputFormat = &quot;C&quot;)]
    public decimal Price { get; set; }

    [CsvColumn(FieldIndex = 4)]
    public string Country { get; set; }

    [CsvColumn(FieldIndex = 5)]
    public string Description { get; set; }
}</pre>
<p>As you can see, there are lots of types that you can apply to your class.</p>
<p>Then you have to declare the using clause in your source file, where you want to use it:</p>
<pre>using LINQtoCSV;</pre>
<p>Then, all you need is to start using the library by adding this code</p>
<pre class="brush: csharp">private void btnLoad_Click(object sender, EventArgs e) {
  openFile.Filter = &quot;CSV Files|*.csv&quot;;
  openFile.Title = &quot;Open CSV File&quot;;

  if (openFile.ShowDialog() == DialogResult.OK) {
    textBox1.Text = openFile.FileName;

    CsvFileDescription inputFileDescription = new CsvFileDescription {
      // cool - I can specify my own separator!
      SeparatorChar = ';',
      FirstLineHasColumnNames = true
    };

    CsvContext cc = new CsvContext();

    bEvents =
      cc.Read<beventtype>(openFile.FileName, inputFileDescription);

    // elegantly parse the LINQ outputed by the parser
    var bALLEvents =
      from p in bEvents
      orderby p.EventID
      select new { p.EventID, p.EventName, p.SourceName, p.TargetName };

    // binding to DataGridView
    // Notice the conversion to a List of the bALLEvents collection
    dataGridView1.DataSource = bALLEvents.ToList();
  }
}</pre>
<p>That’s it, folks – Enjoy and share!</p>
<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/import-csv-file-and-query-it-with-linq/">Import CSV file and query it with LINQ</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.radupoenaru.com/import-csv-file-and-query-it-with-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to make a Print Screen on Microsoft Source using WPF</title>
		<link>http://www.radupoenaru.com/how-to-make-a-print-screen-on-microsoft-source-using-wpf/</link>
		<comments>http://www.radupoenaru.com/how-to-make-a-print-screen-on-microsoft-source-using-wpf/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 17:05:48 +0000</pubDate>
		<dc:creator>Radu Poenaru</dc:creator>
				<category><![CDATA[2009 - Fraunhofer FIT]]></category>
		<category><![CDATA[.Net 3.5]]></category>
		<category><![CDATA[.Net Framework]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft Surface]]></category>
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://www.radupoenaru.com/?p=941</guid>
		<description><![CDATA[For sure at some point in your Microsoft Surface application you'll need to do programatically some screenshots. This article explains how to do it in two simple steps.<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/how-to-make-a-print-screen-on-microsoft-source-using-wpf/">How to make a Print Screen on Microsoft Source using WPF</a></p>
]]></description>
			<content:encoded><![CDATA[<p><a class="cboxelement" title="Microsoft Surface - Programming with C# and using WCF / WPF and Silverlight" href="http://www.radupoenaru.com/wp-content/uploads/2009/08/ms_surfac.png" rel="lightbox[729]"><img style="border-right-width: 0px; margin: 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Making a Printscreen with WPF on Microsoft Surface - Programming with C# and using WCF / WPF and Silverlight" border="0" alt="Making a Printscreen with WPF on Microsoft Surface - Programming with C# and using WCF / WPF and Silverlight" align="left" src="http://www.radupoenaru.com/wp-content/uploads/2009/08/ms_surfac_thumb.png" width="240" height="87" /></a>
<p>After we <a href="http://www.radupoenaru.com/microsoft-surface-whats-inside/">took a look inside of Microsoft Surface</a>, let’s see how to take a later look on the surface, by creating printscreens of the application.</p>
<p>In some WPF applications you’ll need to take a quick screenshot of the user’s screen, allowing him (or them, in case of Multi User Surface) for later reviewing. Now, on Surface there can be only one full screen and active application. So it use the entire screen of the device.</p>
<p>Here are the steps in order to accomplish that:</p>
<p>First, we need to add to Visual Studio project the references to the libraries that we’ll use:</p>
<pre class="brush: csharp">using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;</pre>
<p>Then, we will add create the method that will do the actual saving to a specific file, with the format PNG: </p>
<pre class="brush: csharp">public void MakeScreenshot(String fileName)
{
    Bitmap bmpScreenshot;
    Graphics gfxScreenshot;

    //first, we create&amp;set a bitmap object to the size of the screen
    bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);

    //Using the bitmap, we create a graphics object
    gfxScreenshot = Graphics.FromImage(bmpScreenshot);

    //Copy the rectangle (the screen in our case) - from the upper left corner to the right bottom corner
    gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);

    // Do the saving, outputing a file by supplying the name and format it as PNG
    bmpScreenshot.Save(fileName, ImageFormat.Png);
}</pre>
<p>That’s all, folks &#8211; Use and enjoy!</p>
<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/how-to-make-a-print-screen-on-microsoft-source-using-wpf/">How to make a Print Screen on Microsoft Source using WPF</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.radupoenaru.com/how-to-make-a-print-screen-on-microsoft-source-using-wpf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Surface &#8211; What&#8217;s inside</title>
		<link>http://www.radupoenaru.com/microsoft-surface-whats-inside/</link>
		<comments>http://www.radupoenaru.com/microsoft-surface-whats-inside/#comments</comments>
		<pubDate>Sat, 01 Aug 2009 16:58:00 +0000</pubDate>
		<dc:creator>Radu Poenaru</dc:creator>
				<category><![CDATA[2009 - Fraunhofer FIT]]></category>
		<category><![CDATA[Microsoft Surface]]></category>
		<category><![CDATA[Surface SDK]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false">http://www.radupoenaru.com/microsoft-surface-whats-inside/</guid>
		<description><![CDATA[&#160; After starting the task, I started to be very curios about the technology that drives this device.I started looking over the internet and I found this picture. Very interesting, isn&#8217;t it? Basically contains a normal computer, linked to a projector and few infrared cameras. 1) Screen, the visual part of the device&#160; &#8211; Contains<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/microsoft-surface-whats-inside/">Microsoft Surface &#8211; What&#8217;s inside</a></p>
]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://www.radupoenaru.com/wp-content/uploads/microsoft-surface-diagram.jpg"><img width="220" vspace="10" hspace="30" height="169" border="0" align="left" alt="Microsoft Surface - What's inside" src="http://www.radupoenaru.com/wp-content/uploads/microsoft-surface-diagram.jpg" /></a>After starting the task, I started to be very curios about the technology that drives this device.I started looking over the internet and I found this picture. Very interesting, isn&#8217;t it? Basically contains a normal computer, linked to a projector and few infrared cameras.</p>
<p style="text-align: left;"><strong>1)	Screen, the visual part of the device&nbsp; &ndash;</strong> Contains a special diffuser which turns the Surface&rsquo;s acrylic tabletop into a big horizontal &ldquo;multitouch&rdquo; screen, capable of acquiring and processing multiple inputs from multiple users in the same time. The Surface is far more advanced than simple multitouch devices, being capable to be aware of different objects by recognizing their shape or by reading coded &ldquo;domino&rdquo; tags when placed on the table.</p>
<p><span id="more-700"></span></p>
<p style="text-align: left;"><strong>2)	Infrared, the &quot;eyes&quot;&ndash;</strong> Surface&rsquo;s &ldquo;machine vision&rdquo; is able to &quot;see&quot; in the near-infrared spectrum, using a 850-nanometer-wavelength LED light source pointed to the screen. When different shaped objects touch the table, the light is reflected back and is acquired by multiple infrared cameras with a resolution of 1280 x 960 points.</p>
<p style="text-align: left;"><strong>3)	CPU, the heart &ndash;</strong>  Surface uses a normal computer, composed by many components found in everyday desktop computers, neither extreme powerful nor extraordinary &mdash; a Core 2 Duo processor, 2GB of RAM and a 256MB graphics card. It has a wireless communication with devices on the surface using WiFi and Bluetooth antennas (maybe the next versions will incorporate advanced technologies like RFID or Near Field Communications). The operating system is a modified version of Microsoft Vista.</p>
<p style="text-align: left;"><strong>4)	Projector -</strong> Microsoft&rsquo;s Surface takes advantage of a normal DLP light engine which can be seen in many rear-projection HDTV&rsquo;s. Very reliable and easy to interconnect. The visible screen has a resolution of&nbsp; 1024 x 768 pixels, quite smaller compared with invisible overlapping infrared projection &#8211; allows better recognition at the edges of the screen, place where the most interesting menus are shown.</p>
<p style="text-align: left;">Apart from these, also has:</p>
<ol>
<li>normal USB ports for connecting devices,</li>
<li>a VGA-out for connecting an external monitor for development or for enhancing user experience &#8211; connecting a big Plasma or LCD Screen</li>
<li>power and reset switches</li>
</ol>
<p>Bottom up, this is a regular computer but where the genius intervene is that it is packed with a interesting top screen and infrared cameras and a custom framework to enable the ubiquitous experience.</p>
<p>Quite cool, after all, isn&#8217;t it?</p>
<p>&nbsp;</p>
<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/microsoft-surface-whats-inside/">Microsoft Surface &#8211; What&#8217;s inside</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.radupoenaru.com/microsoft-surface-whats-inside/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Microsoft Surface – new task and new challenges</title>
		<link>http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/</link>
		<comments>http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 16:44:34 +0000</pubDate>
		<dc:creator>Radu Poenaru</dc:creator>
				<category><![CDATA[2009 - Fraunhofer FIT]]></category>
		<category><![CDATA[Others]]></category>
		<category><![CDATA[Microsoft Surface]]></category>
		<category><![CDATA[Surface SDK]]></category>
		<category><![CDATA[Visual Studio 2008]]></category>

		<guid isPermaLink="false">http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/</guid>
		<description><![CDATA[New day, new task, new challenges &#8211; Today I started working on a social collaborative tool which will work on Surface, but extended eventually to Flex 3, Silverlight and iPhone. First impression: Visual Studio is an old friend. Still, bad news: Surface SDK is kept locked in a website, having access only those who bought<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/">Microsoft Surface – new task and new challenges</a></p>
]]></description>
			<content:encoded><![CDATA[<p><img align="left" src="http://www.radupoenaru.com/wp-content/uploads/Surface[3].png" alt="Microsoft Surface - new task new challenges" style="width: 196px; height: 150px;" />New day, new task, new challenges &ndash; Today I started working on a social  collaborative tool which will work on Surface, but extended eventually to Flex  3, Silverlight and iPhone.</p>
<p>First impression: Visual Studio is an old friend. Still, bad news: Surface  SDK is kept locked in a website, having access only those who bought a license.  Shame, Microsoft!</p>
<p>After installing the SDK I started running the examples, I noticed that many  events are new, a lot of new interaction techniques appeared ( the device can  track up to 50 different fingers) and also the trackers who can be identified  and corresponding menus, actions, interactions can be setup.</p>
<p>I&rsquo;m looking forward to this new style of programming and really hope to learn  it as fast as Objective-C.</p>
<p>Post from: <a href="http://www.radupoenaru.com">Radu Poenaru's Weblog</a><br/><br/><a href="http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/">Microsoft Surface – new task and new challenges</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.radupoenaru.com/microsoft-surface-%e2%80%93-new-task-and-new-challenges/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
