Tag | LINQ Posts

In this Issue: Peter Kuhn, Scott Hanselman, David Anson, Kunal Chowdhury, Beth Massi, Rajat Jaiswal, MIke Ormond, WindowsPhoneGeek, Xianzhong Zhu, Jesse Liberty, Derik Whittaker, Morten Nielsen, Sumit Dutta, Asim Sajjad, and Dhananjay Kumar. Above the Fold: Silverlight: "How To Use DataTriggers In Silverlight DataGrid" Dhananjay Kumar WP7: "Windows Phone eBook 1st Edition Published" MIke Ormond LightSwitch: "Filtering Lookup Lists with Large Amounts of Data on Data Entry Screens" Beth Massi Windows ...
In this Issue: Shawn Wildermuth, Ollie Riches, Oscar Agreda, Samidip Basu, Dan Wahlin, Walt Ritscher, Laurent Bugnion(-2-), Andrej Tozon, András Velvárt, Vikram Pendse, Michael Crump, Andy Beaulieu(-2-), Michael Sync(-2-), Above the Fold: Silverlight: "The MVVM Dashboard" Oscar Agreda WP7: "SurfCube on Mango Part 4 – fighting with the ListPicker control" András Velvárt Windows 8: "Why I’m Excited About Windows 8" Dan Wahlin LightSwitch: "Creating LightSwitch Custom Controls" Michael Washington Shoutouts: ...
Skip to the bottom if want the quick answer ;-) Just a quick note on something I ran into today... I've taken to utilizing a View Model in which objects are created on a 1 to 1 basis to hold entities supplying data to the View/UI. As such, I modified my existing linq queries such that the View Model objects are created in the select portion of the query resulting in an enumerable list I can supply to the View. Below is an example: IQueryable<sessionfoo> fooquery = ((IEnumerable<sessionfoo... ...
We have a requirement for a list of itineraries with multple itinerary items show only single itinerary in the list with details of one of the items selected based on some custom sorting logic. So I needed to group by itinerary ID and sort by custom Comparison and select the first in each group. Below is a LinqPad file that I've used for testing: void Main() { // http://smehrozalam.wordpres... // http://stackoverflow.com/qu... ...
Programming for Metro Metro is the future http://zd.net/rnT9VZ .NET is for old apps. WinRT replaces WPF & WCF. XAML is big. There were no Silverlight sessions. HTML 5 and Javascript ( Blend for HTML) are back in fashion – I wont dwell on this because web apps are (inconsistently) simplistic in concept and over-complex in development. Yes, all those XAML skills are portable, Silverlight (RIP) apps can run as Metro apps with a bit of fidgeting with namespaces – you just need to know what controls ...
Today's $10 Deal from Apress at http://www.apress.com/97814... is Pro LINQ Language Integrated Query in C# 2010 "Most books show the simplest examples of how to use a method, but they so rarely show how to use the more complex prototypes. This book is different. Demonstrating the overwhelming majority of LINQ operators and prototypes, it is a veritable treasury of LINQ examples." ...
Download Demo - LINQpad Query In this blog post I’ll be showing you how to query TFS using LINQpad. 1. Download LINQpad Those who are familiar with LINQpad know its benefits and ease of use, i would urge others to try it. You can download LINQpad and read more about it from here => http://www.linqpad.net/ 2. Download TFS SDK I have a blog post on where and how to download the TFS SDK from => here 3. Querying TFS using LINQpad Open LINQpad Select Query Properties by selecting Query from menu ...
I've been working lately on web application that uses Asp.Net MVC, WordPress and MySQL database. To communicate from .NET code to MySQL database using Entity Framework we installed MySql .NET Connector. It worked fine out of the box on developer's workstations but once deployed to hosted web server application started to throw following error: [NotSupportedException: Unable to determine the provider name for connection of type 'MySql.Data.MySqlClient.MyS... System.Data.Entity.ModelCon... ...
Today, We deployed the “David Blaine” version of the TB Module for our EMR solution here at IDI (http://idi.mak.ac.ug). This was mainly for bug fixes and usability improvements based on the feedback that we received from users in the past few weeks. Some of the improvements were related to performance. We had to fine-tune some of our Linq statements in some places to enable better queries to be generated by our ORM. We also added some lookup dialogs that present certain information that would be ...
I've just opened a project on CodePlex - http://algonet.codeplex.com/ !!! This project will implement various algorithms related to artificial intelligence, numerical analysis, NLP, object recognition and quantitative finance. It will initially target C#, and eventually F#. First exercise - port Java AIMA 3 to C# from http://code.google.com/p/ai... AIMA3 so far I've ported the utils - helpers, data structures and basic linear algebra classes Matrix class - Implemented ICloneable, ISerializable.GetObjectData ...
Last week I needed to find an object from collection with maximum value of the property and wrote the following double maxHours = (from loc in locations select loc.TotalHours).Max(); var location = (from loc in locations where (loc.TotalHours == maxHours) select loc).FirstOrDefault(); but wasn’t happy and checked the internet. The answer in http://stackoverflow.com/qu... referred to http://code.google.com/p/mo... ...
A developer is asking how to pass data from a UserControl control to the main page. Basically, the scenario is that he has a user control which contains a GridView and wrap arround within asp Ajax UpdatePanel control. The UserControl will then be used at the page that is hosted within a master page. The page contains some TextBox in which it will be populated once the user selects a row from the GridView also on that page the Modalpop is defined. To achieve that, here's one solution I've provided ...
Introduction By now, most of you have heard that Windows Phone 7 – Mango release will support Local Databases (SQL CE) using Linq to SQL. But what you probably haven’t heard much about is how to extract the .SDF that is created in isolated storage to your local computer and view the contents. I find this extremely important for debugging application and making sure my database is setup exactly like I want it. So, that is what we are going to do today. Getting Started with a sample application: For ...
On August 19th 2011 I gave a presentation at devLINK titled, “Producing and Consuming OData in an Silverlight and Windows Phone 7 Application”. As promised, here is the Slides / Code / Resources to my talk. Slides – The query slide in this deck was taken from a slide in Mike Taulty’s talk. This is the first time that I used Prezi in a talk and it worked out wonderful! I want to apologize in advance for embedding a flash player in my blog. It is all that Prezi supports at this time. =( Producing and ...
Helper method for sorting generic lists with nested types using LINQ Cheers and happy coding K.Anantha rengan ...
In my previous posts I have shown how to get xml data from database and deserialize it. But sometimes we want to work with the xml and do some operations on it. To working with xml, in the .net framework there are two tools for it. One is to use the XmlDocument class and second is the linq to xml with the XDocument class. I personally prefer to work with linq to xml, so I must convert the XmlDocument object to XDocument which I have after I took the xml from database. To convert the XmlDocument to ...
If you've found this blog posting, you've probably been banging your head against a wall trying to get those errors generated from your web service to appear in your MVC web site. You may have already discovered that while you can see the messages display in Fiddler, getting them to appear in your project takes a little bit of work. First, l strongly recommend you check out the work already done on this subject by more dedicated bloggers than l: http://kenneththorman.blogs... ...
Everyone has a journey. You start off young & stupid, and 2 decades later, you're closer to understanding the nature of reality. That’s one of the main goals in life, to seek knowledge (justified, true beliefs – pick any 2 J ). I must have read 5000 books in my life. From some of my readings it could be construed that reality computes itself, It from Bit. From others, it can be concluded that Entropy is decreased by increased rates of computation, and in the short span of human civilization, ...
Further to comments on this post, I realised my HttpModule which gives a user a friendly error message if they upload a file which is too big only dealt with half of the problem. The maximum size a request can be is specified in the machine.config and web.config in the maximumRequestLength attribute on the httpRuntime element; if a user uploads a file which is larger than that, the part of the HttpModule which checks the request size is by-passed, and the user gets a not-very-friendly 'Maximum Request ...
No matter which ORM or data access technology you use, at some point you just need to do some CRUD, and you need to do it fast. In this post, I’m going to show you how to get your CRUD on with the latest version of Entity Framework in no time flat. In fact, I’d be surprised if the code to get your first CRUD operation done takes you more than a few minutes. The one thing the EF team did right with Code-First is make it really easy, but most of the “getting started” videos and documentation is packed ...
I’m going to start with a simple code snippet which sorts an array of strings using LINQ. 1 IEnumerable<string> line = new[] {"Z","A","Ä"}; 2 var result = line.OrderBy(letter => letter); 3 Console.WriteLine("{0}", string.Join(" ", result)); The result might look like this: A Ä Z … or not. It depends on the thread culture the sorting is running in. The string order is culture aware (unlike char order which is culture invariant), so if we switch for instance on one of the Norwegian cultures ...
Recently I stumbled across a question on stackowerflow.com about Edulinq. Its a series of blog posts turned at the end into a free eBook. Downloaded to my eBook reader and had a lot of fun in subway. There where not to much to discover inside of LINQ for me, but it could help a novice to understand the LINQ “magic” and use it efficiently. Another very important point for me was the test driven approach. You could take this book as a guide for test driven design and development. Reading this book ...
Download Source Code Challenge Just had the first chance to apply PLINQ (Parallel LINQ) to the real task. When I am playing around with some new technology everything works fine, the real understanding comes along with challenges in a real use case. Currently I am working on application which processes large amount of text data gathering statistics on word occurrences (see: Source Code Word Cloud). Here what the simplified core of my code is doing. Enumerate through all files with *.txt extension. ...
Motivation During playing with AOP framework PostSharp I thought about the technique to weave the logger instances inside the code by using the CompileTimeInitialize–method. Unfortunately my logging-stuff must be serializable. This is not given. So I must use the other weaving point and access my Loggers. Over an abstraction layer I use log4net in the background. So my question was: how expensive is access to loggers and log something. Testing-Setup My little testing project consists mostly of these ...
Technorati Tags: Scala,C# to Scala Introduction This post gives an overview of Scala from a C# developer’s perspective in light of efforts for a current .Net port coming closer to fruition. By closer I mean they have the compiler done but not the Visual Studio or SharpDevelop plug-in. From what I could find there is also no CLR based REPL available. You are also unable to call CLR code with generic signatures. While all of these issues are being worked on, to have a play I suggest using the JVM implementation ...
In this Issue: Mike Talbot, Michael Crump, Kunal Chowdhury, Cheryl Simmons, Joost van Schaik(-2-), Shantimohan Elchuri, Jesse Liberty(-2-), Peter Torr, Pete Vickers, Derik Whittaker, and Den Delimarsky. Above the Fold: Silverlight: "Wordle Like Tag Cloud for Silverlight" Mike Talbot WP7: "Speed and distance calculation extension methods for Windows Phone 7" Joost van Schaik Shoutouts: Check out Pete Brown's interview on .NET Rocks: My .NET Rocks Interview Koen Zwikstra announced a July update: Silverlight ...
Introduction I’m proud to announce my first eBook and update to my article series on OData for Silverlight and Windows Phone 7 is complete. I have worked very hard on this series and am pleased with the work. I may be a little biased, but I believe this is the best step-by-step guide ever created for OData and Silverlight/WP7 Mango. In the series, I walk you through every step with detailed screenshot and code snippets. From creating the OData data service to consuming it in an Silverlight application ...
Check out the Top Five most popular news at SilverlightShow for SilverlightShow Top 5 News for July 18 - 24, 2011. Here are the top 5 news on SilverlightShow for last week: Silverlight 5 for Line of Business Applications – Jeremy Likness 100+ articles in SilverlightShow new "Getting Ready for Microsoft Silverlight Exam 70-506" eBook Microsoft has 3 months to make or break Windows Phone – Part 1 Building Cross-Platform Mobile Applications with HTML5 and Mango LINQ Pad vs. Visual Studio for Learning ...
I have to admit that I’m a basic user when it comes to JSON serialization/deserialization. I’ve used JSON.NET and the DataContractJsonSerializer. I’ve read that JSON.NET is faster and more efficient than the built-in .NET serializer, but I haven’t had to build a system that is dependent on squeezing microseconds out of my serialization routines. That said, I do prefer JSON.NET because it is more flexible when it comes to using DataContractAttribute and DataMemberAttribute for customizing your JSON ...
I recently implemented Domain Events as a way of organising domain logic in our application. To summarise how they work: Every event in your application is modelled as a class which implements the empty IDomainEvent interface IDomainEvents are raised by a domain object calling a static DomainEvents.Raise<T>(T domainEvent) where T : IDomainEvent method The DomainEvents class passes raised IDomainEvent objects to the Handle<T>(T domainEvent) method of classes which implement the IDomainEventHandler<T> ...
Introduction One of the first things I wanted to do after installing the Azure AppFabric June CTP was to create an AppFabric application that used the Bing Map SOAP services. That was when I hit my first roadblock. There is currently no option in the AppFabric Application Designer to add a reference to an external service. After asking around in the forums I learned that I should build an external service to do this. There is currently very little documentation on creating external services for Azure ...
In the past few months, we at the West Palm Beach .Net User Group have been busy soliciting your feedback on topics you would like covered at our upcoming meetings. We have also been encouraging our members to step up and share on the projects they work on and the technologies they use. The result is the schedule below which we hope brings a good variety of today’s hottest topics. We look forward to seeing you at our meetings and to receiving your feedback as we continuously strive to improve the ...
MvcScaffolding is a tremendous productivity improvement for MVC developers. Earlier this year, Steve Sanderson posted the definitive 7-part series on MvcScaffolding which is a must-read for anyone serious about doing scaffolding. The best part about the scaffolding infrastructure is that MvcScaffolding is actually built on top of another package called T4Scaffolding. T4Scaffolding can be used as the basis for *any* scaffolding – not just MVC projects. To that end, we can enjoy the same power of MvcScaffolding ...
Yesterday I received an email from Jetbrains to notify me of the release of ReSharper 6. Highlights of ReSharper 6 include: Rich support for JavaScript, CSS, HTML, and ASP.NET MVC 3 (Razor) Bundled assembly decompiler New navigation actions and valuable additions to existing navigation features Code inspections and quick-fixes for code quality analysis in VB.NET code Multiple new code inspections and quick-fixes for C# Improved refactorings and context actions, including those helping convert LINQ ...
I’ve been looking through the temp directories on my production machines and had realized some overlooked design points in a number of programs; namely the deletion of certain temp files. One situation that particularly caught my attention was some email attachments that should have been deleted. Even though the code was actively calling File.Delete() on some email attachments, they were not being deleted. An error log showed the program was throwing an exception when attempting to delete the files. ...
Giovanni Bassi published the original NuGet package for LINQ to Twitter (L2T), which I'm appreciative of. Since then, I have yet to do a release myself, but that is changing now. The current version of LINQ to Twitter is stable enough for a release, so the time is right. I think there are a few aspects of a LINQ to Twitter NuGet package that aren't as simple as point at a project and your done, so I'll document my process here in case anyone else is interested. Getting Started I had played around ...
At http://peterkellner.net/200... there is a very useful article by my fellow MVP Peter Kellner. This shows that ADO.NET is very much faster than LINQ to SQL unless the latter is compiled. Whilst there may be some cases where Linq to SQL offers genuine benefits, however we should proceed with caution in using Linq unless it a some single use form of query. I suggest after reading Peter's post you leave a note of appreciation for ...
What’s the problem? Given a DB table with an Identity key in SQL Server, that field could not be repeated. Well, if you delete a row, the value would be lost. We are trying to reuse these values. Solution LINQ is something that I love, by that I will use it to solve the problem. To sumup the post, we are going to use a list of integer that will replace our entityset, with the following keys: 1,2,3,5,6,7,9,10,11,15. Well, how to get a jump in the list: 1: var query = from n in listado 2: where (n ...
One thing that’s really got me pumped about the Mango OS update is the inclusion of SQL Compact baked right in. We don’t need to include extra assemblies to get database functionality for our apps, as SQL Compact is a native component in Mango! Before we get all excited thinking we’ll have a full on visual designer experience when developing our apps, realize that this is still an isolate storage based data file that you’ll be using LINQ to SQL to access. There’s no visual designer (yet), which means ...
After reading DLinq (Linq to SQL) Performance and in particular Part 4 I had a few questions. If CompiledQuery.Compile gives so much benefits, why not to do it for all Linq To Sql queries? Is any essential disadvantages of compiling all select queries? What are conditions, when compiling makes whose performance, for how much percentage? World be good to have default on application config level or on DBML level to specify are all select queries to be compiled? And the same questions about Entity Framework ...
I was at the Jazoon 2011 in Zurich (Switzerland). It was a really cool event and it had many top notch speaker not only from the Microsoft universe. One of the most interesting talks was from Don Syme with the title: F# Today/F# Tomorrow. He did show how to use F# scripting to browse through open databases/, OData Web Services, Sharepoint, …interactively. It looked really easy with the help of F# Type Providers which is the next big language feature in a future F# version. The object returned by ...
I have seen the rx demos by Bart De Smet and was blown away by the potential that I think they hold – however I just haven’t had time up till now to have a look at them in any depth. Today I finally set some time aside and got a 10 000 foot view of them. So my plan is for the next few days to develop an application in WPF that makes use of reactive extensions as a dummy project… Today I just wanted to get the basics working, and after going through an very good lab on rx was able to get a very basic ...
In this Issue: Vikram Pendse(-2-), Christian Schormann, Pete Brown, Kunal Chowdhury, Andrea Boschin, SLMPerf, WindowsPhoneGeek, Jesse Liberty(-2-), and Michael Washington. Above the Fold: Silverlight: "Silverlight 5: Vector and Bitmap Printing for Reports and more" Pete Brown WP7: "New SketchFlow Template for WP7" Christian Schormann LightSwitch: "Integrating Visual Studio LightSwitch Application Into An Existing Website using IFrames" Michael Washington Shoutouts: Laurent Duveau presented on LightSwitch ...
Our database has a few lookup tables that uses similar approach to implemented by .Net Framework for localized resources: At run time, ASP.NET uses the resource file that is the best match for the setting of the CurrentUICulture property. If there is no match for the current UI culture, ASP.NET uses resource fallback. It starts by searching for resources for a specific culture. If those are not available, it searches for the resources for a neutral culture. If these are not found, ASP.NET loads the ...
One of of my colleagues wrote a LINQ query similar to the following: var q=from i in keys select GetTuplesOrPossibleNull(i) into kvp orderby kvp.Item2 select kvp; I’ve noticed, that for some data it throws null exception on kvp.Item2 in orderby statement. It was found that calling function sometimes return null instead of expected key-value pair. I thought where I should insert check for null and my first idea was to add check in where statement before select function call, something like the following ...
In this Issue: Rudi Grobler, Roy Dallal, Chris Rouw, Sean Nolan, Peter Kuhn, WindowsPhoneGeek(-2-), Jesse Liberty(-2-), Mike Taulty, Paul Sheriff, Xpert360, and Vikram Pendse. Above the Fold: Silverlight: "Storing Files in SQL Server using WCF RIA Services and Silverlight – Part 1" Chris Rouw WP7: "XNA for Silverlight developers: Part 12 - Mango (1)" Peter Kuhn From SilverlightCream.com: Slide-out keyboard support on Windows Phone Rudi Grobler has a quick post up discussing the slide-out keyboard ...

Here's a blog post by DataSprings on how to use LINQ to Twitter: http://bit.ly/jjmLZY.  It demonstrates how to authenticate with OAuth and how to use several of the APIs.

Joe

Media Type Formatters in the WCF Web API provide a way for the consumer of your service to not only specify the format they want for their response, but also specify the format they are using on their request. Typically the desired response format is specified in the “Accept” request header and the request body format is specified in the “Content-Type” request header. Media types are central to building any RESTful service. Two of the most common media types are “application/xml” and “application/json”. ...
As promised, here is a link to all of the applications from my session at CodeStock 2011: Entity Framework Profiler Studio Styles Reflector Telerik JustDecompile Beta dotfuscator CodePaste.NET Silverlight Spy WP7 Desktop Marketplace LINQPad Snippet Manager Browser Shots Snagit 10 7-Zip File Manager Code Converter CPU-Z Notepad2 SSDlife Free Regular Expression Library DLL-files.com Microsoft Web Platform Installer Visual Studio Gallery Search Everything Fiddler2 Paint.NET Microsoft Expression Blend ...
In this Issue: Kunal Chowdhury, Roy Dallal, Jim Wightman, Kevin Hoffman, Levente Mihály, Peter Kuhn(-2-, -3-), René Schulte, WindowsPhoneGeek, Jesse Liberty(-2-), John Papa. Above the Fold: Silverlight: "Reactive Extensions–FromAsync" Jesse Liberty WP7: "Windows Phone 7 Mango - Sockets" Peter Kuhn Shoutouts: Kunal Chowdhury has a list up of all the Windows Phone 7.1 (Mango) Features From SilverlightCream.com: Windows Phone 7 Jump Start with Mango - 1 - Creating a Hello World Application Kunal Chowdhury ...