2009 – Fraunhofer FIT
Top 10 European institute of research. The branch in which I work focuses more on Communication and Cooperation, Artificial Intelligence and Virtual Reality.
Adding events to LINQtoCSV library
Feb 6th
The User Experience that a library provides must be at least equal with is quality and speed. And frankly, CSVtoLINQ rocks on latest two, as I presented in previous articles Import CSV file and query it with LINQ and continuing in LINQ wonder world, but lacks a little on the User Experience(in our case Developer Experience) by not having some events of starting, progress and ending of the parsing.
Especially important, while parsing huge files, is a confirmation for the user that something happens and (ideally) the point in which the processing is. That is why, thanks to Matt Perdeck for sharing the entire source of the library, I was able to improve it by adding events.
So, let’s see some code!
Modifications into LINQtoCSV library – CSVContext.cs
Important: All modifications will be made in the CsvContext class from LINQtoCSV namespace – the CSVContext.cs file.
First we’ll add the ReadStarted event to the library – it will fire when the reading of the CSV file has started.
// defining the delegate
public delegate void ReadStartedHandler(object sender, EventArgs e);
// here we define the event
public event ReadStartedHandler ReadStarted;
// the call of the event processing
protected virtual void OnReadStarted() {
if (ReadStarted != null) {
// we use empty eventargs because nothing is needed on readstarted event, just the confirmation of parsing started
ReadStarted(this, EventArgs.Empty);
}
}
Import CSV file and query it with LINQ
Feb 4th
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.
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 – in the sense that many implementations merely use some splitting method like String.Split(). Some don’t even offer the specification of the values splitting character – so your file wouldn’t be parsed correctly if instead of , you have ; 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 – and at least as importantly, in a fast and efficient manner.
Change screen orientation of a Microsoft Surface application
Nov 3rd
Microsoft Surface is designed to allow MultiUser and MultiTouch interaction.While MultiTouch is easy to acknowledge, the MultiUser and designing a smart changing of Surface’s screen orientation is a little difficult coming from desktop computing, where the monitor’s down will be the same always.
In order to understand the need of changing the screen orientation on a Microsoft Surface, you might want to think about it’s normal usage: Collaboration and User experience. In the implementation for a group of 4-8 people, sitting around the Surface, their need for rotating the environment is almost zero or otherwise they will experience dizziness and losing their focus while rotating the environment for one of them.
While for the situation in which you have casual visitors(as in BMW implementation in their showrooms), who sit in pairs working on one Surface, you might considering rotating the window such that the ’Down’ of the application would be the nearest edge to them.
How to make a Print Screen on Microsoft Source using WPF
Nov 1st
After we took a look inside of Microsoft Surface, let’s see how to take a later look on the surface, by creating printscreens of the application.
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.
Here are the steps in order to accomplish that:
First, we need to add to Visual Studio project the references to the libraries that we’ll use:
using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms;
Then, we will add create the method that will do the actual saving to a specific file, with the format PNG:
public void MakeScreenshot(String fileName)
{
Bitmap bmpScreenshot;
Graphics gfxScreenshot;
//first, we create&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);
}
That’s all, folks – Use and enjoy!
Handle XML with namespaces
Sep 5th
I faced an issue while working with an xml file in Flash. I was unable to parse the xml data using the normal E4X syntax such as xml.node1.node2. It would give an error. The only thing different about this particular xml is that it has a lot of namespaces declared in it. After going through the documentation I found out a way to handle this issue. Let’s consider the following code:
var xml:XML = <Workbook xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:x="urn:schemas-microsoft-com:office:excel">
<ss:Worksheet ss:Name="Sheet1">
<Table ss:StyleID="ta1">
<Row ss:AutoFitHeight="0" ss:Height="13.4064">
<Cell>
<Data ss:Type="String">Preview</Data>
</Cell>
<Cell>
<Data ss:Type="String">unicode</Data>
</Cell>
<Cell>
<Data ss:Type="String">htmlcode</Data>
</Cell>
<Cell>
<Data ss:Type="String">htmlalt</Data>
</Cell>
<Cell>
<Data ss:Type="String">utfcode</Data>
</Cell>
<Cell>
<Data ss:Type="String">utfalt</Data>
</Cell>
</Row>
</Table>
</ss:Worksheet>
</Workbook>
Microsoft Surface – What’s inside
Aug 1st
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’t it? Basically contains a normal computer, linked to a projector and few infrared cameras.
1) Screen, the visual part of the device – Contains a special diffuser which turns the Surface’s acrylic tabletop into a big horizontal “multitouch” 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 “domino” tags when placed on the table.
Microsoft Surface – new task and new challenges
Jul 29th
New day, new task, new challenges – 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 a license. Shame, Microsoft!
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.
I’m looking forward to this new style of programming and really hope to learn it as fast as Objective-C.
Interconnecting Flex modules
May 5th
Adobe Flex 3 has a very interesting component : LocalConnection. The idea behind is that the modules (which runs on client side) might change some data. The exchanged data is not limited at all to simple forms, but can be from a simple String to a XML or Arrays.
Few things must be known from the start, but as any technology, only after you learn it everything becomes easy.
- First of all, the communication can be restrained to a certain domain, let’s say by example www.radupoenaru.com .
- You can’t have bidirectional communication from a single LocalConnection. One module acts as a server and another one as a client.
- Server module opens a connection to which client connects. If the client loads but the server don’t, then an error occurs in client module.
- Be very careful to the name of the procedure called by server – should be the same in server as in client module. More >
Flex 3 debugging && Nod32 != Love
Apr 12th
While working at Fraunhofer FIT, I had few small projects to develop internal modules for extending the interaction between researchers. The technologies were set from the start to Flex 3 and ActionScript.
As starter in Flex, but not ActionScript, I was quite anxious to begin coding in this interesting tool. But after I created my new Workspace (seems that now everyone creates its own paradigm for Project) and wrote some code, I hit a wall: the Flex IDE debugger interface raised an error that he couldn’t connect to the Flash debugger:
Working in Fraunhofer Institute of Technology
Mar 2nd
Starting today, I work as a Student Helper in Fraunhofer Institute for Applied Information Technology. The branch from Sankt Augustin, which I joined, is focused on the research of human-centered computing in a process context. I will activate in the Cooperation and Community Support department, which deals with the research and development of community portals, (mobile) communities and cooperation, Internet-based groupware, cooperative knowledge management, application service providing for cooperative work and virtual teams, rating and recommender systems and cooperative learning environments.
The head of the department is Prof. Wolfgang Prinz, PhD and I will work closely with Mr. Nils Jeners, researcher in FIT. I had the pleasure of attending Mr. Prinz course, CSCW and Groupware, while being student in the Media Informatics Master, held by RWTH Aachen University. CSCW stands for Computer Supported Collaborative Work.
My first task is to study the Twitter community, applications based on it and the actual phenomena. My work should help in better understanding the aspects of human behavior, social interaction between humans and in particular the tools and services used for microblogging. This will allow also to discover ways to extract patterns in the context of this technology, who is changing the ways that people interact and socialize over the Internet.
