Posts tagged LINQ
Silverlight and Windows Phone Workshop
1
On 13th I will have the pleasure to present a workshop at the University of Bonn. This workshop will introduce Microsoft Phone to students. The focus will be on mobile development, web services, Silverlight and introductory design in Blend. The participants will acquire the basic knowledge of these technologies, allowing them to have a good chance to further pursue on Microsoft career path.
Subject: Silverlight and Microsoft Phone
Start: 9:00 with 1 hour lunch break around 12-12:30
End: approx. 15:00 – 16:00
Location: Windows-CIP-Pool N222
Language: The talk will be given in English.
Silverlight VideoPlayer for RailsCasts
3I am and will be a Microsoft Developer. While working for convenience with other tools, I love strong type languages. I don’t want to ship products because I saved once and hit “s” one more time, so my product will be shipped with that small, human and yet unpardonable error in code.
How many times did you loose your time and effort with PHP in order to find a small mistake like this?
In my pursue on Microsoft tools path I started enjoying the Silverlight technology. Who might not know, Silverlight is a competitor to Flash. By now, on its 4th version, is way above Adobe Flash in almost all areas (I actually worked with Flex and Flash recently, so I really know what I’m talking about):
- Easy to develop : the C# language is a world class, easy to write in, with good compiler, a lot of resources and a VERY good IDE (try to write code and animations in same time in that Flash IDE and you’ll see what I mean)
- Supports Full HD (there are examples on the net with 2 or 3 full HD movies playing), while Flash just tries to get HD with lots of CPU used.
- The model of development is the same for in Browser and Out of Browser – you don’t need to change the tool from Flash to Flex in order to have same product for Desktop and Web.
Railscasts Silverlight video player
1This is my second shot to create a better player for Railcasts. As you can see, it goes better and better. Who knows what might be next?
- How and why I choose the Silverlight platform
- How to integrate your Silverlight content with your WordPress blog (and presumable all blog systems who allow you to add JavaScript)
Windows Phone 7 Coding Camp
2
Just joined Microsoft Students Partners for few days, and me and my colleagues in Team West were invited to a Code Camp for learn developing for Windows 7 Phone with XNA. The camp was established in the castle, in Freusburg. We traveled from Köln after my RIA Business Applications presentation in the Springboard conference.
This special event joined together five very known and respected Microsoft Evangelists: Frank Fischer, Oliver Scheer, Frank Prengel, Tom Wendel and Jan Schenk. They are experts and known figures in programming world, with expertise in Windows Phone 7, Silverlight and XNA.
In the landscape of the castle, with Towers and defensive walls, we’ve been Knights .. of Code, of course (in German is Code Ritter). The organization was purely German: perfect! We had a lot of fun, lots of presentations and access to the knowledge gathered along the years of all five Evangelists.
In the first evening (who was right our Team West own event), we had the Microsoft Phone introduction by Frank Prengel (also known as Dr. Mobile) , XNA presentation by Tom Wendel (The Ant Man) and Silverlight presentation by Oliver Scheer, known as “Mr. deep zoom”. After all presentation, a collective brainstorming revealed around 30(!) ideas for implementing next day, who were judged from usability, possibility of creation and interesting points of view by our 5 Evangelists. Finally, we created teams based on the projects appealing to us. We followed our instincts and smell the code inside each application promise.
Microsoft Student Partners
4Today I had the pleasure to make the first step in Microsoft Student Partners organization (West Germany branch).
It all started when I went to a very interesting workshop on Windows 7 VHD, presented by Daniel Neumann.
So I applied by sending to Microsoft Student Partners enrollment e-mail address a cover letter, my cv and a short description. After a while, I got a call from Anton Schweizer, Senior Student Partner, and I was invited to an interview.
I also had to prepare a presentation. It supposed to be a 10 minutes long presentation on a technical theme. Because I like very much Silverlight, I started preparing it as main subject.
The interview was very relaxed and I got the usual questions: why do I want to join Microsoft Student Partners, why Microsoft, how much time can I invest in this, where and when can I prepare workshops, discussions on Microsoft products.
Basically, I understood that the duties of a Student partners are very similar to ones of Microsoft Evangelist:
- create presentations for its colleagues in University
- prepare workshops and assist students while working on a certain theme
- involve itself in the students life and present Microsoft technologies to them
Very interesting .. I just wait to start! They said that I will get soon a response regarding my application.
Later edit:
I WAS ACCEPTED!
Adding events to LINQtoCSV library
0
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);
}
}
LINQ wonder world
0
I am sure that, if you are a developer, at some point in your career heard about and asked yourself: what is LINQ? If not, there’s no problem, you’ll find out now : LINQ comes from language-integrated query and it is a collection of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations. It helps developers by extending both C# and Visual Basic, adding native querying capabilities to these languages. It also comes with class libraries to get the full advantage out of these capabilities.
As we discussed in my previous article, Import CSV file and query it with LINQ, we are able to load and parse the file into a IQuerable collection, thus giving us the oportunity to do more and more SQL- like operations on it.
The C# 3.0 specification defines a so-called Query Expression Pattern along with translation rules from a LINQ expression to an expression in a subset of C# 3.0 without LINQ expressions. The translation thus defined is actually un-typed, which, in addition to lambda expressions being interpretable as either delegates or expression trees, allows for a great degree of flexibility for libraries wishing to expose parts of their interface as LINQ expression clauses. For example, LINQ to objects works on IEnumerable<T>s and with delegates, whereas LINQ to SQL makes use of the expression trees.
Import CSV file and query it with LINQ
0
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.
C# .Net using Post with HTTPWebRequest
0Just a reminder for posterity : posting with .Net its so easy! Check out the Cocoa touch framework to realize the difference!
public string Post(string url, string data) {
string strReturn = null;
try
{
//Encoding the post vars
byte[] buffer = Encoding.ASCII.GetBytes(data);
//Initialisation with provided url
HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(url);
//Set method to post, otherwise postvars will not be used
WebReq.Method = "POST";
WebReq.ContentType = "application/x-www-form-urlencoded";
WebReq.ContentLength = buffer.Length;
Stream PostData = WebReq.GetRequestStream();
PostData.Write(buffer, 0, buffer.Length);
//Closing is always important
PostData.Close();
//Get the response handle, we have no true response yet
HttpWebResponse WebResp = (HttpWebResponse)WebReq.GetResponse();
//information about the response
HTTPStatusCode status = WebResp.StatusCode;
string server = WebResp.Server;
//read the response
Stream WebResponse = WebResp.GetResponseStream();
StreamReader _response = new StreamReader(WebResponse);
strReturn = _response.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return strReturn.Trim();
}
Enjoy!
MIX09 Scott Hanselman’s FILE|New Project …
1Scott Hanselman had a presentation at Mix 09 conference – File | New Company: Creating NerdDinner.com with Microsoft ASP.NET MVC. This was in its unique style – fun, rich in content, tricks, advices but most of all was fun.
This year he managed to create a new type of presentation – without the actual presentation! No more constrained to some slides, just him, Visual Studio and the audience. Yes, the audience – who seemed to absorb any words spoken there, helping Scott with few advices in some key points.
