Tag | LINQ Posts

In this Issue: András Velvárt, WIndowsPhoneGeek(-2-), Jesse Liberty(-2-), Victor Gaudioso, Kunal Chowdhury, Jeremy Likness, Michael Crump, and Dhananjay Kumar. Above the Fold: Silverlight: "Application Library Caching in Silverlight 4" Kunal Chowdhury WP7: "Handling WP7 orientation changes via Visual States" András Velvárt Shoutouts: Joe McBride gave a MEF Head User Group presentation and has posted How to Become a MEF Head – Slides & Code From SilverlightCream.com: Handling WP7 orientation changes ...
Ever wanted to have a simple jQuery menu bound with ASP.NET web site map file? Ever wanted to have cool css design stuffs implemented on your ASP.NET data bound controls? Ever wanted to let Visual Studio generate logical layers for you, which can be easily tested, customized and bound with ASP.NET data controls? If your answers with respect to above questions are ‘yes’, then you will probably happy to try out latest release (v5.0) of Employee Starter Kit, which is intended to address different types ...
Yesterday I told Wang Tao, an annoying colleague sitting beside me, about how to make the static content enable the CDN in his website which had just been published on Windows Azure. The approach would be Move the static content, the images, CSS files, etc. into the blob storage. Enable the CDN on his storage account. Change the URL of those static files to the CDN URL. I think these are the very common steps when using CDN. But this morning I found that the new Windows Azure SDK 1.4 and new Windows ...

I released LINQ to Twitter Beta v2.0.20: http://goo.gl/1i97X.  Most of the items were bug fixes.  A couple items were new: Geo Search and I finished adding Asynch support for non-Silverlight APIs.

Joe

What does this code print and why? HashSet<int> set = new HashSet<int>(); int[] data = new int[] { 1, 2, 1, 2 }; var unique = from i in data where set.Add(i) select i; // Compiles to: var unique = Enumerable.Where(data, (i) => set.Add(i)); foreach (var i in unique) { Console.WriteLine("First: {0}", i); } foreach (var i in unique) { Console.WriteLine("Second: {0}", i); } The output is: First: 1 First: 2 Why is there no output of the second loop? The reason is that LINQ does not cache ...
I wanted to try to use T4 to read a web.config and generate all of the appSettings and connectionStrings as properties of a class. I elected in this template only to output appSettings and connectionStrings but you can see it would be easily adapted for app specific settings, bindings etc. This allows for quick access to config values as well as removing the potential for typo's when accessing values from the ConfigurationManager. One caveat: a developer would need to remember to run the .tt file ...
LINQPad is a popular utility for .NET developers who use LINQ a lot. In addition to standard SQL queries, LINQPad also supports other types of LINQ providers, including LINQ to Twitter. The following sections explain how to set up LINQPad for making queries with LINQ to Twitter. LINQPad comes in a couple versions and this example uses LINQPad4, which runs on the .NET Framework 4.0. 1. The first thing you'll need to do is set up a reference to the LinqToTwitter.dll. From the Query menu, select query ...
In this Issue: Robby Ingebretsen, Victor Gaudioso, Andrea Boschin(-2-), Rudi Grobler(-2-), Michael Crump, Deborah Kurata, Dennis Delimarsky, Pete Vickers, Yochay Kiriaty, Peter Kuhn, WindowsPhoneGeek, and Jesse Liberty(-2-). Above the Fold: Silverlight: "Silverlight Simple MVVM Printing" Deborah Kurata WP7: "Creating theme friendly UI in WP7 using OpacityMask" WindowsPhoneGeek Tools: "KAXAML v1.8" Robby Ingebretsen Shoutouts: Peter Foot posted Silverlight for Windows Phone Toolkit–Feb 2011 Rudi Grobler ...
In this Issue: Rob Eisenberg(-2-), Gill Cleeren, Colin Eberhardt, Alex van Beek, Ishai Hachlili, Ollie Riches, Kevin Dockx, WindowsPhoneGeek(-2-), Jesse Liberty(-2-), and John Papa. Above the Fold: Silverlight: "Silverlight 4: Creating useful base classes for your views and viewmodels with PRISM 4" Alex van Beek WP7: "Google Sky on Windows Phone 7" Colin Eberhardt Shoutouts: My friends at SilverlightShow have their top 5 for last week posted: SilverlightShow for Feb 14 - 20, 2011 From SilverlightCream.com: ...
Hi and welcome! I'm a software developer and this is my geeks blog. I have 20 years Visual Studio mainly C++, MFC, ATL and now, thankfully, C# and I am embarking on the new world (well new to me) of WPF, so I thought I would try and capture my successful...and not so successful...WPF experiences with the geek world. So where to start? WPF? What I know so far... From wiki..."Windows Presentation Foundation (or WPF) is a graphical subsystem for rendering user interfaces in Windows-based applications." ...

I am evaluating Linq to SQLProfiler.  I have found better ways to do things within minutes.  It helps you optmize you Linq.  You will not regret investing the time to learn the tool, which is easy BTW.

 

In my previous post, I introduced my problem, but I didn’t explain the problem with Entity Framework When you try the solution indicated you will take the following error: LINQ to Entities don’t recognize the method 'System.String Join(System.String, System.Collections.Generic.... of the method, and this method can’t be translated into a stored expression. The query that produces that error was: 1: var consulta = (from TCabecera cab in 2: contexto_local.TCabecera 3: let ...
PROBLEM Firstly, I am working on a project based on LINQ, EF, and C# with VS2010. The following Table shows what I have and what I want to show. Header C1 C2 C3 1 P1 01/01/2011 2 P2 01/02/2011 Details 1 1 D1 2 1 D2 3 1 D3 4 2 D1 5 2 D4 Expected Results 1 P1 01/01/2011 D1, D2, D3 2 P2 01/02/2011 D1,D4 IDEAS At the begin I got 3 possible ways: - Doing inside the DB: It could be achieved from DB with a CURSOR in a Stored Procedure. - Doing from .NET with LOOPS. - Doing with LINQ (I love it!!) FIRST ...

I would like to thank Dave Noderer and Rainer Habermann and the rest of the team for a successful code camp!  Thanks to the attendees of my Linqq to SQL class as well.  I will be sending out the emails tonight with the information I promised.

Ed

In this Issue: Mark Monster, Jaime Rodriguez, Mark Hopkins, WindowsPhoneGeek, David Anson, Jesse Liberty, Jeremy Likness, Martin Krüger(-2-), Beth Massi, Joost van Schaik, Laurent Bugnion, and Arik Poznanski. Above the Fold: Silverlight: "Parsing the Visual Tree with LINQ" Jeremy Likness WP7: "Silverlight-ready PNG encoder implementation shows one way to use .NET IEnumerables effectively" David Anson Lightswitch: "How to Send Automated Appointments from a LightSwitch Application" Beth Massi Shoutouts: ...

Having read through the ".Net Class Library" and onto the section on LINQ I continue to be favourbly impressed by this book.

One important point about this book, you can just dip into sections rather than just read from start to finish.

I was impressed by the write up on the various collections. After reading the chapters on LINQ, I am looking forward to getting Adam Freeman's book on LINQ.

An open source library and full product have been developed for transparently splitting large tables across several databases for performance, similar to database table partitioning. It is all handled along with the Linq to SQL framework, and looks pretty slick, I will be reviewing the product shortly. It looks mostly transparent to the developer! There are other capabilites worth a look. This looks like it works for azure as well. Here are some links: http://enzosqlshard.codeple... http://enzosqlbaseline.com ...
I’ve had to look this up a couple of times, and there’s not much out there, so I end up guessing the same answer over and over. When using MethodBase.GetParameters() to get an array of ParameterInfo object, I often want to get a count of the number of parameters that are out, optional, params, etc. For out and optional, you can simply check ParameterInfo.IsOut or ParameterInfo.IsOptional or any number of other “Attributes”. However, for params, there isn’t a property on ParameterInfo. Instead, you ...
In this Issue: Max Paulousky, Renuka Prasad, Ollie Riches, Jesse Liberty(-2-, -3-, -4-, -5-), Medusa M, John Papa, Beth Massi, and Joost van Schaik. Above the Fold: Silverlight: "Stop What You Are Doing And Learn About Reactive Programming" Jesse Liberty WP7: "Windows Phone Looping Selector for Digits " Max Paulousky Lightswitch: "How To Send HTML Email from a LightSwitch Application" Beth Massi Shoutouts: Shawn Wildermuch has niether GooNews for users of his cool WP7 app or or for the WP7 Marketplace ...
A few months ago I blogged about using Model metadata to render a dynamic UI in MVC 2. The scenario in the post was that we might have a view model where the questions are conditionally displayed and therefore a dynamic UI is needed. To recap the previous post, the solution was to use a custom attribute called [QuestionId] in conjunction with an “ApplicableQuestions” collection to identify whether each question should be displayed. This allowed me to have a view model that looked like this: 1: [UIHint("ScalarQuestion")] ...
The build process template and custom activity described in this post is available here: http://cid-ee034c9f620cd58d... Running code metrics has been available since VS 2008, but only from inside the IDE. Yesterday Microsoft finally released Visual Studio Code Metrics Power Tool 10.0, a command line tool that lets you run code metrics on your applications. This means that it is now possible to perform code metrics analysis on the ...
Fear, it’s what turns maintaining applications into a nightmare. Technology moves on, teams move on, someone is left to operate the application, what was green is now perceived brown. Eventually the business will evolve and changes will need to be made. The approach to those changes often dictates the long term viability of the application. Fear of change, lack of passion and a lack of interest in understanding the domain often leads to a paranoia to do anything that doesn’t involve duct tape and ...
From Feb 7th-9th I’ll be presenting two sessions at SPTechCon San Francisco 2011. My first presentation is a new session called “The Expanding Developer Toolbox for SharePoint 2010” which covers many of the new tools and functionality available to SharePoint 2010 developers. My second sessions is called “Real World Deployment of SharePoint 2007 Solutions” (presented at last SPTech Con Boston) which covers tips, tricks, and advice on deploying SharePoint 2007 solutions. If you hurry you may still ...
Adding Cache Dependency Support This second part of my article on adding cache support to applications will extend the sample application developed in part one to add support for cache dependencies such as the SqlCacheDependency. Part One of this article is at: http://geekswithblogs.net/R... ICacheDependency Interface We will need to pass cache dependencies to the Cache Provider implementation, so the first step is to create ...
In brief…. take 1 minute to register today if you are UK based and work for a company that creates software products and want to dig into SharePoint 2010 development for FREE with a great UK based SME (subject matter expert). And… if you want to understand the background, read on :-) Microsoft Platform Ready is where we are aggregating resources to help companies who develop software products explore and adopt the latest technologies from Microsoft. There are many benefits to signing up (e.g. the ...
Last time I posted something about getting all the host between a given IP Range. Part of the routine is to convert the IpAddress to its DecimalEquivalent. Tip: Asside from using the URL of a web site, you can use the Decimal version of the Ip address of the Host Name. Sample Google.com --> 74.125.71.105 you can use http://1249724265 Solution Version 1 public abstract class IpMath { public static Int64 ConvertToDecimal(string IpAddress) { Int64[] tmpIpAddress = SplitIpAddress(IpAddress); Int64 ...
I have been working on a Silverlight Navigation application which uses LINQ to query an XML data source and has been working without a hitch until I added a control to the landing page. All other pages which worked fine were loaded from the navigation service Once I added the control I got a page not found error! (The page is there) and If navigated to, it works as expected. What happens, it that I closed the error Modal dialog and then clicked on another page, then navigate back to the landing page ...
Recently UppercuT (UC) quietly released version 1 (in August). I’m pretty happy with where we are, although I think it’s a few months later than I originally planned. I’m glad I held it back, it gave me some more time to think about some things a little more and also the opportunity to receive a patch for running builds with UC on Linux. We also released v1.1 very recently (December). UppercuT v1 Builds On Linux Perhaps the most significant changes to UC going v1 is that it now supports builds on ...
I have been working to get a SharePoint development course delivered online in February and March – online means lots of opportunities to ask questions. The first dates are now in place. The training is being delivered as a benefit for companies signed up to Microsoft Platform Ready. It is intended for UK based companies who develop software products* Agenda: Day 1 (Live Meeting 3 hours) 1:30 - 4:30 • Getting Started with SharePoint: Understand why and how to start developing for SharePoint 2010 ...
ASP.NET applications can make use of the System.Web.Caching.Cache object to cache data and prevent repeated expensive calls to a database or other store. However, ideally an application should make use of caching at the point where data is retrieved from the database, which typically is inside a Business Objects or Model layer. One of the key features of using a UI pattern such as Model-View-Presenter (MVP) or Model-View-Controller (MVC) is that the Model and Presenter (or Controller) layers are ...
If we have to get data from the SQL database, the standard way is to use a receive port with SQL adapter. SQL receive adapter is a solicit-response adapter. It periodically polls the SQL database with queries. That’s only way it can work. Sometimes it is undesirable. With new WCF-SQL adapter we can use the lightweight approach but still with the same principle, the WCF-SQL adapter periodically solicits the database with queries to check for the new records. Imagine the situation when the new records ...
It seems that the Snippet Compiler is not maintained anymore. So I need an alternative – also for getting syntax highlighting for code in publications. Preferable with the possibility to conserve this highlighting by copying selections to clipboard. Snippet Compiler does not allows this for selections – only by exporting the whole file content to clipboard with HTML- or RTF-formatting (File > Export > HTML to clipboard respectively RTF to clipboard). Today I switched to LINQPad. This application ...
XML has been a pervasive tool in software development for over a decade. It provides a way to communicate data in a manner that is simple to understand and free of platform dependencies. Also pervasive in software development is what I consider to be the anti-pattern of using string manipulation to create XML. This usually starts with a “quick and dirty” approach because you need an XML document and looks like (for all of the examples here, we’ll assume we’re writing the body of a method intended ...
Introduction The way I previously created messages to send to the GovTalk service I used the XMLDocument to create the request. While this worked it left a number of problems; not least that for every message a special function would need to created. This is OK for the short term but the biggest cost in any software project is maintenance and this would be a headache to maintain. So the following is a somewhat better way of achieving the same thing. For the purposes of this article I am going to ...
Today, I'm going to talk about a touchy subject: the notion of working in a company that doesn't use the prescribed "best practices" in its software development endeavours. Over the years I have, using a variety of pseudonyms, asked this question on popular programming forums. Although I always add in some minor variation of the story to avoid suspicion that it's the same person posting, the crux of the tale remains the same: A Programmer’s Tale A junior software developer has just started a new ...
I feel compelled to post this blog because I find I’m repeatedly posting this same code in silverlight and windows-phone-7 answers in Stackoverflow. One common task that we feel we need to do is burrow into the visual tree in a Silverlight or Windows Phone 7 application (actually more recently I found myself doing this in WPF as well). This allows access to details that aren’t exposed directly by some controls. A good example of this sort of requirement is found in the “Restoring exact scroll position ...
In this Issue: John Papa, Tim Heuer, Jeff Blankenburg(-2-, -3-), Jesse Liberty, Jay Kimble, Wei-Meng Lee, Paul Sheriff, Mike Snow(-2-, -3-), Samuel Jack, James Ashley, and Peter Kuhn. Above the Fold: Silverlight: "Animation Texture Creator" Peter Kuhn WP7: "dows Phone from Scratch #13 — Custom Behaviors Part II: ActionTrigger" Jesse Liberty Shoutouts: Awesome blog post by Jesse Liberty about writing in general: Ten Requirements For Tutorials, Videos, Demos and White Papers That Don’t Suck From SilverlightCream.com: ...
In 2009 Microsoft released a case study about a project that we had done using the OOXML SDK 1.0 for Research Directors Inc. Since that time Microsoft has released version 2.0 of the SDK and PSC has done significant development with it. Below are some of the mile stones we have reached since the original case study. At the time of the original case study two report types had been automated to output as PowerPoint presentations. Now that the all the main products have been delivered we have added ...
.NETTER Code Starter Pack contains a gallery of Visual Studio 2010 solutions leveraging latest and new technologies released by Microsoft. Each Visual Studio solution included here is focused to provide a very simple starting point for cutting edge development technologies and framework, using well known Northwind database. The current release of this project includes starter samples for the following technologies: ASP.NET Dynamic Data QuickStart (TBD) Azure Service Platform Windows Azure Hello World ...
MapReduce See http://en.wikipedia.org/wik... The MapReduce pattern aims to handle large-scale computations across a cluster of servers, often involving massive amounts of data. "The computation takes a set of input key/value pairs, and produces a set of output key/value pairs. The developer expresses the computation as two Func delegates: Map and Reduce. Map - takes a single input pair and produces a set of intermediate key/value pairs. The MapReduce function groups results by key and passes ...
What is ULS in SharePoint 2010? ULS stands for Unified Logging Service which captures and writes Exceptions/Logs in Log File(A Plain Text File with .log extension). SharePoint logs Each and every exceptions with ULS. SharePoint Administrators should know ULS and it's very useful when anything goes wrong. but when you ask any SharePoint 2007 Administrator to check log file then most of them will Kill you. Because read and understand the log file is not so easy. Imagine open a plain text file of 20 ...
Part 1 - Listing Data from Database: Let us now learn ASP.NET MVC 2 from Scratch by actually developing a front end website for the Chinook database, which is an alternative to the traditional Northwind database. You can get the Chinook database from here. As always the best way to learn something is by working on it and doing something. The Chinook database has the following schema, a quick look will help us implementing the application in a efficient way. Let us first implement a grid view table ...
In this Issue: András Velvárt, Kunal Chowdhury(-2-), AvraShow, Gill Cleeren, Ian T. Lackey, Richard Waddell, Joe McBride, Michael Crump, Xpert360, keyboardP, and Pete Vickers(-2-). Above the Fold: Silverlight: "Grouping Records in Silverlight DataGrid using PagedCollectionView" Kunal Chowdhury WP7: "Phone 7 Back Button and the ListPicker control" Ian T. Lackey Shoutouts: Colin Eberhardt has some Silverlight 5 Adoption Predictions you may want to check out. Michael Crump has a post up showing lots ...
Let’s say that you have a list of objects that contains duplicate items and you want to extract a subset of distinct items. This is pretty straight forward in the trivial case where the duplicate objects are considered the same such as in the following example: List<int> ages = new List<int> { 21, 46, 46, 55, 17, 21, 55, 55 }; IEnumerable<int> distinctAges = ages.Distinct(); Console.WriteLine("Distinct ages:"); foreach (int age in distinctAges) { Console.WriteLine(age); } /* This ...
This post is about VS 2010, go here for the VS/TFS 11 extensions. UPDATED Apr 9th 2012: VersionInfo, NuGet, Code Contracts UPDATED Oct 7th 2012: New Visual Studio GDR UPDATED Aug 31th 2012: New versions updated of ReSharper, NDepend, Web Essentials, Community Build Manager, Code Contracts (March 2012), NuGet, ILSpy, DotPeek, Just Decompile, tangible T4 editor, LinqPad. Added the VersionInfo tool, so you know you have the latest update of VS 2010 UPDATED April 20th 2012: New version of NuGet manager. ...
So Silverlight Firestarter is over and your sitting on your couch thinking… what now? Well its time to So how exactly can you pimp the Silverlight Firestarter? Well read below and you will find out: 1) Pimp the videos: First we are going to use a program named Juice to download all of the Silverlight Firestarter videos. Go ahead and point your browser to http://juicereceiver.source... and download the application. It works on Mac, Linux and PC. After it is downloaded you are going to want ...
If you haven’t already signed up, there is a Silverlight Firestarter event happening today and kicks off in a little under an hour! Sign up here!!!!! ScottGu starts of with a keynote entitled “The Future of Silverlight”. Sounds like a good thing. Here is the rest of the agenda(All Times PST): 9:00 am Scott Guthrie The Future of Silverlight 10:45 am Jesse Liberty Data Binding Strategies with Silverlight and WP7 11:30 am Yavor Georgiev Building Compelling Apps with WCF using REST and LINQ 12:15 pm ...
All-In-One Data Platform Code Samples Introduction Download Data Platform code samples Request Data Platform code samples Introduction The All-In-One Data Platform code samples demonstrate the typical programming topics about ADO.NET, Entity Framework, WCF Data Services, ADO, and other Data Platform technologies. These topics are either frequently asked in MSDN forums and Microsoft Support, or are requested by many developers via our code sample request function. We want to alleviate the frustration ...
Another nifty little feature in C# is anonymous types. Anonymous types allow a “short cut” in creating an object with a set of properties. They seem to be used mainly in LINQ, however we will make up a scenario here. Assume you have a situation where you want to group a whole bunch of information, but you don’t want to go to the effort of defining a class or a structure. You can get around this by declaring an anonymous type. Lets have a look at some code… var person = new { Name = "Mark", Surname ...
This evening I thought I would look into something that I have been meaning to look into for a while, but just haven’t given the time of day. Initially I wanted to brush up on some LINQ, but after going over the definition of LINQ, I stumbled across extension methods… I have heard of them quite a bit – but never really bothered to see what they are… So the official MSDN explanation says the following… “Extension methods enable you to "add" methods to existing types without creating a new derived ...