Tag | LINQ Posts

There aren’t many applications that are of value without having some for of data store. In Windows Phone development we have a few options. You can store text directly to isolated storage. You can also use a number of third party libraries to create or mimic databases in isolated storage. With Mango we gained the ability to have a native .NET database approach which uses LINQ to SQL. In this article I will try to bring together the components needed to implement this last type of data store and fill ...
Recently I was working with data from a generic List<T> and one of my objectives is to get the distinct values that is found in the List. Consider that we have this simple class that holds the following properties: public class Product { public string Make { get; set; } public string Model { get; set; } } Now in the page code behind we will create a list of product by doing the following: private List<Product> GetProducts() { List<Product> products = new List<Product>(); Product ...
This blog entry is intended to provide a narrow and brief look into a way to use the Select extension method that I had until recently overlooked. Every developer who is using IEnumerable extension methods to work with data has been exposed to the Select extension method, because it is a pretty critical piece of almost every query over a collection of objects. The method is defined on type IEnumerable and takes as its argument a function that accepts an item from the collection and returns an object ...
Eric Ligman, from Microsoft, posted a great blog post this week listing all of the SharePoint 2010 Virtual Labs that are available from Microsoft. His blog entry is here: http://blogs.msdn.com/b/mss... He also posted other resources as well. I’ve copied his Virtual Lab links here: SharePoint Server 2010 Virtual Labs MSDN Virtual Lab: SharePoint Server 2010: Introduction ...
If you're like a lot of people I've known, worked with, and been, you have a history of either installing Visual Studio (or getting a computer from IT with Visual Studio already installed), selecting a preset option from the "what kind of development work do you do?" menu, and coding away. I spent years occasionally hearing words like "CodeRush" and "Resharper" without really knowing what these things were or giving a second thought to how a productivity tool like them could help my work. A couple ...
Today's $10 book 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." Adam Freeman is an excellent author who is good at providing practical examples of code ...
The most recent release of LINQ to Twitter included support for Windows Phone. It’s important to note that only 7.1 is supported – the rationale being that 7.1 (Mango) introduced support for IQueryable, which LINQ to Twitter requires. This post will show you how to use LINQ to Twitter with Windows Phone. You’ll see a normal public query, how to log in with OAuth, and how to post a tweet. All of the code in this blog post is included with the LINQ to Twitter source code that you can download at http://linqtotwitter.codepl... ...
I have some basic rules when it comes to checked in code to TFS. The one at the top of the list of rules is that, any developer should get the latest code from TFS, deploy and have a working web part, workflow or any other customization in SharePoint. This means that all dependencies should be deployed with the customization. If the web part uses a custom list as a data source, then a developer should not have to manually create site columns with the ‘correct’ internal and display name, list instances ...
Few days ago I have received an invitation from Packt Publishing to review this book. I myself is a big fan of Generics and is very interested about it, so I've decided to give it a go. Thank you for letting me review this interesting book. .NET 4.0 Generics (Packt Publishing) is written by Sudipta Mukherjee. The book is primarily targeted to beginners and intermediate programmers who want to know what .NET Generics is all about and how it can help solved real world problems. The book covers the ...
I really love the LINQ language extension in dot net programming and I’m really glad it was added to a language I love (C#). My background, however, has a lot of C++ in it and I still do some coding in C++ – sometimes for fun and sometimes to put back into practice things I should have know for years, but are just now being recognized by my ever-widening eyes. A lot of that new vision comes from seeing C# and LINQ and, of course, practicing all forms of programming MOJO on programming forums, like ...
I ran across a unique scenario recently, and I’m not sure if I should be proud of the solution, or appalled at the Frankenstein result. Either way, I thought I’d post about it to possibly help others in the same situation. I was developing a website leveraging jQuery / AJAX to query views of data at runtime. The kicker? I didn’t know which views. The choice of database view was determined via configuration and user choice. I was leveraging jqGrid for the client-side grid presentation, sorting, filtering, ...
Lambda expressions are a powerful tool to writing quick, concise code. They can be used in numerous situations, most notably in conjuction with LINQ statements.A lambda expression is an anonymous function that can contain expressions and statements, and can be used to create delegates or expression tree types.All lambda expressions use the lambda operator =>, which is read as “goes to”. The left side of the lambda operator specifies the input parameters (if any) and the right side holds the expression ...
In my previous post, Using LINQ to Twitter in Windows 8 Metro Apps, I cheated a little (some might say a lot) on my UI architecture by using code-behind. In this post, I’ll make it all better by showing you how to separate the model and interaction logic from the UI design – proper separation of concerns. I’ll accomplish this with a pattern, named Model-View-ViewModel (MVVM), which is widely used for WPF, Silverlight, and (soon) Windows 8 Metro Apps. I’ll start by discussing what MVVM is, move to ...
While the title of this post suggests focus on LINQ to Twitter, it also indicates that I’ll be discussing how to build a Windows 8 Metro application. The application itself will display a list of tweets from Twitter’s public feed. In the sections that follow, you’ll read background information on pre-requisites to understanding the post, learn how to get LINQ to Twitter working with Visual Studio 11, and then see a step-by-step on how the application is built. Getting Started You can build Metro ...

Released LINQ to Twitter v2.0.23: http://bit.ly/AoKglP

@JoeMayo

I've been working on a little project recently and one of the requirements was to be able to identify someone's influence in the social media space. I happened to come across Klout which if you are not familiar is a service where people can connect all of their social networking accounts together and it will then analyze your public activity and workout how much Klout you have. Even if you have not joined Klout it still looks at public Twitter information and can rate users just based on their public ...
In a previous post I talked about using the JSON to LINQ features of JSON.NET. Thanks to Bil Simser I was able to do some testing of the deserialization capabilities of this library. The key was his hint to leverage the json2csharp web site. Below is the C# representation of the search results for a Twitter query created by putting an example of the search result into this site. public class Url{ public string url { get; set; } public string expanded_url { get; set; } public string display_url { ...
While adding a new feature to the LINQ to Twitter Search API, I made significant changes to the Search entity that will break existing code. The new feature is support for Tweet Entities, a recent addition to Twitter’s Search API. I’ll cover Tweet Entities support after explaining what has changed. Motivation for Change When Twitter implemented Tweet Entities for their Search API, they only supported JSON format. LINQ to Twitter used ATOM for Search API queries; so, I didn’t have a choice on data ...
This demo is a continuation of my previous article about "Creating a Simple Log-in Form". Basically in this post I'm going to demonstrate the basic on how to edit and update the form with ASP.NET MVC 3. Before you go any further, I'd suggest you to check out my previous article first about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" and "Creating a Simple Log-in Form". STEP 1: Creating the Model class Just for the simplicity of this demo, I'm just going to display the FirstName, LastName and ...
This demo is a continuation of my previous article about "ASP.NET MVC 3: Creating a Simple Sign-Up Form" which I wrote few months ago. Basically in this post I'm going to demonstrate how to create a simple LogOn form in which users can supply their username and password. And how to authenticate and validate users in ASP.NET MVC 3. I will not elaborate more in details about the model, view and controllers function so before you go any further, I'd suggest you to check my previous article first about ...
In the last installment I discussed delegates, which have been in C# since version 1. The problem with delegates in some cases is that having to create separate, named methods to describe the function to be performed can be a bit unwieldy in cases where the method being called is simple and will not be used other than by the delegate invocation. This brings us to a feature added in C# 2.0 – anonymous methods. Anonymous methods distilled down to their most simple explanation are methods that are defined ...
The main way that Twitter provides feeds is through JSON. Unfortunately the version of the .NET Framework that is on the phone does not include the System.Runtime.Serializatio... namespace. Rather than trying to brute force the JSON feed I have been looking into using the Newtonsoft JSON.NET library. The first thing that I ran into with JSON.NET is that the documentation is severely tilted to the serialization side with almost no mention of deserialization. This would have been my preferred approach ...
About a month ago'ish I read some very sad news. Microsoft announced that they were killing off the DryadLinq (or LINQ-to-HPC) project in favor of Hadoop. I was one of the first users of DryadLinq outside of Microsoft, back when it was a pre-alpha project inside Microsoft Research. My company had a running HPC cluster and my boss convinced me to install DryadLinq on it to see what I could make it do. I worked with it for a year, and being a big LINQ and PLINQ fan, really enjoyed how easy it was to ...
Having just help another developer with this issue, I thought I’d write a quick post about the cause of the ObjectDisposedException exception when working with Entity Framework. It is important to be aware of two things when working with Entity Framework 1) The data context must not be disposed of until all the data is fetched from the database. 2) A linq statement creates an IQueryable, which is not executed until you enumerate over it (e.g. use it in a for each loop) or convert it to a list or ...
v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} Normal 0 false false false false EN-US X-NONE X-NONE /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin-top:0in; mso-para-margin-right:0in; ...
In my previous post we started a discussion about concepts that are critical to really understanding LINQ. The next couple of posts will build on the same theme by introducing three very closely related (and somewhat evolutionary) pieces of the C# language – delegates, anonymous functions, and lambdas. My original intent had been to introduce them together in single post, but that would be a rather long post. Delegates are a language feature that have been in C# since version 1 of the language and ...
Daytona - Iterative MapReduce on Windows Azure Overview MapReduce is a framework for processing highly distributable problems across huge datasets using a large number of compute nodes. It is a generic mechanism that comprises 2 steps: Map step: The master node takes the input, partitions it up into smaller sub-problems, and distributes them to worker nodes. The worker node processes the smaller problem, and passes the answer back to its master node. Reduce step: The master node then collects the ...
I’ve been putting a lot of thought lately into how LINQ can be introduced to programmers whose C# skills range from being a fairly new programmer conversant in C# to a seasoned programmer who learned just what they needed to convert skills in another language to C# and the .Net platform and I think that a workable approach would be to introduce first some of the concepts and language features that I view as existing to enable LINQ and then tie them together. The first step we’ll take towards learning ...
Overview Windows HPC Server 2008 is infrastructure for high-end applications that require high performance computing clusters – i.e. for scaling out parallelizable across many compute nodes in a grid. These compute nodes can be coordinated by a head node , which in turn can be proxied via a service broker node that exposes a SOA WCF interface for job scheduling. Additional functionality includes the ability to coordinate between job processes running on nodes via MPI (message passing interface). ...
My friend in Zimbabwe sent me an email a day ago with the following contents suppose i have a table called week_days with only 3 fields i.e. SEQUENCE DAY SALES as follows: SEQUENCE DAY SALES 1 Sun 23 2 Mon 18 3 Tue 30 4 Wed 15 5 Thu 20 6 Fri 08 7 Sat 0 i need a query that converts DAY column to a header row and sort by SEQUENCE as follows: DAY Sun Mon Tue Wed Thu Fri Sat SALES 23 18 30 15 20 08 0 Pliz Help!!!!!!!! I was like’ this looks like a candidate for pivot, but it requires that the result ...
Threading was never so easy since .NET 4 with the TPL has been released. I know I am a bit late but there are so many nice things which might still be new to many of us. The IEnumerable interface has become famous with the introduction of LINQ but many of us have not yet realized that IEnumerable<T> and T[] or List<T> can be exchanged in many cases but there are cases where it is important to fall back to a pure IEnumerable<T> if you want to support lazy evaluation. .NET 4 has for ...
Using a simulated dialog window is a nice way to handle inline data editing. The jQuery UI has a UI widget for a dialog window that makes it easy to get up and running with it in your application. With the release of ASP.NET MVC 3, Microsoft included the jQuery UI scripts and files in the MVC 3 project templates for Visual Studio. With the release of the MVC 3 Tools Update, Microsoft implemented the inclusion of those with NuGet as packages. That means we can get up and running using the latest version ...
While I have always been a fan of libraries that improve coding efficiency and reduce code redundancy I have mostly been using ones that were in the public domain. As part of the Geeks With Blogs Influencers program a got my hands on ComponentOne’s Studio for Entity Framework. Below are my thought after working with the product for several weeks. My coding preference has always been maintainable code that is reusable across an enterprises protfolio. Because of this my focus in reviewing this product ...
Today I was looking for a solution to get finally the JScript/Javascript/jQuery Intellisense Featureworking with my ASP.Net Webform Project to work. I found some good articles: - JScript IntelliSense Overview- JScript IntelliSense: A Reference for the “Reference” Tag- Enabling JavaScript intellisense in VS.NET 2010 to work with SharePoint 2010- Rich IntelliSense for jQueryBUT, all of suggested solutions did not work right with my Master Page based Visual Studio 2010 Solution.Only with physical Javascript ...
Anonymous delegates are great, they elimiante the need for lots of small classes that just pass values around, however care needs to be taken when using them, as they are not automatically unhooked when the function you created them in returns. In fact after it returns there is no way to unhook them. Consider the following code. using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Diagnostics; namespace ConsoleApplication1 { class Program { static void ...
In this Issue: Michael Washington, Oliver Fuh, Jeremy Likness, Derik Whittaker, Jesse Liberty, Jeff Blankenburg(-2-), and Michael Crump. Above the Fold: Silverlight: "Handling Extremely Large Data Sets in Silverlight" Jeremy Likness WP7: "31 Days of Mango | Day #8: Contacts API" Jeff Blankenburg LightSwitch: "LightSwitch Chat Application Using A Data Source Extension" Michael Washington Shoutouts: Michael Palermo's latest Desert Mountain Developers is up Michael Washington's latest Visual Studio ...
So I was asked today how to do cross joins in SQL Azure using Linq. Well the simple answer is you cant do it. It is not supported but there are ways around that. The solution is actually very simple and easy to implement. So here is what I did and how I did it. I created two SQL Azure Databases. The first Database is called AccountDb and has a single table named Account, which has an ID, CompanyId and Name in it. The second database I called CompanyDb and it contains two tables. The first table I ...
© 2011 By: Dov Trietsch. All rights reserved Logging – A log blog In a another blog (Missing Fields and Defaults) I spoke about not doing a blog about log files, but then I looked at it again and realized that this is a nice opportunity to show a simple yet powerful tool and also deal with static variables and functions in C#. My log had to be able to answer a few simple logging rules: To log or not to log? That is the question – Always log! That is the answer Do we share a log? Even when a file ...
Developer’s Guide To Collections in Microsoft® .NET, by Calvin Janes, discusses the various collections available in the built-in NET libraries, as well as the advantages and disadvantages of using each type of collection. Other areas are also covered including how collections utilize memory, how to use LINQ with collections, using threading with collections, serializing collections, and how to bind collections to controls in Windows Forms, WPF and Silverlight. For developers looking for a simple ...
The latest version of the AppFabric ServiceBus now has support for queues and topics. Today I will show you a bit about using queues and also talk about some of the best practices in using them. If you are just getting started, you can check out this site for more info on Windows Azure. One of the 1st things I thought if when Azure was announced back when was how we handle fault tolerance. Web sites hosted in Azure are no much of an issue unless they are using SQL Azure and then you must account ...
I've got a bunch of technical books I'd like to get rid of. Some are more current than others. 3D Programming For Windows Introducing LINQ VB.NET Class Design Handbook ASP.NET MVC 1.0 ASP.NET MVC In Action FBML Essentials Test Driven Development in Microsoft .NET The Rational Guide To Building Technical User Communities Expression Web Step By Step Applications = Code + Markup I don't really feel like dealing with the hassle of ebay (or Amazon), and I'd hate to just throw them away. Craigslist / Freecycle ...
Here is a technique to bind a List (of objects) to a DataGridView so that the public Properties appear as columns. In this example, the columns are binded to the individual public property of the object. The column Random Number is binded to the public property RandomNumber while the column Square Root to the public property SqRt. Create a class that contains the public properties that appear as columns in the dataGridView 1: using System; 2: using System.Collections.Generic; 3: using System.Linq; ...
· For the last decade, the majority of my dev work has leveraged the .NET Framework for construction of information systems. However, my interest has lain in numerical computing. · Is it possible to have an increasingly higher level of abstraction and at the same time achieve underlying high performance computing? The prevailing winds say no: C# is aimed at productivity, and C++ is for performance. Garbage collection was great, but do we still need it with the availability of smart pointers? Would ...
Level: Beginner In working with the Silverlight 4 DataGrid control, I found that documentation and online examples tend to focus on validation either at the cell level, or row level. However, there could be a case where validation is required after all rows have been entered, and comparisons between rows may need to be made. One example I can think of is the case where a list of products, including SKU information, is entered by the user. The SKU code is not derived automatically, but must be unique ...
Today's $10 Deal of the day book from APress at http://www.apress.com/97814... is Introducing .NET 4.0 With Visual Studio 2010 "You may know what's happening in C#, but what about the Azure cloud? How is that going to affect your work? What are the limitations of the pLINQ syntax? Introducing .NET 4.0: with Visual Studio 2010 guides you through the innovations that matter and helps you to seize new opportunities confidently and quickly. " ...
Error: There is a temporary failure. Please retry later. (The request failed, because you exceeded quota limits for this hour. If you experience this often, upgrade your subscription to a higher one). Additional Information : Throttling due to resource : Connections." If you Google this issue, you only find different blogs and forums where geeks discussing this issue and giving suggestion to each other. Even when I counter this issue I also review my application architecture and I re-write the Azure ...
Hello Everyone, I thought I’d take a minute to update everyone on my upcoming talks and events that I will be attending. I have talks ranging from Kinect, Silverlight, HTML5 to OData! Wow, that’s a wide range of technology and I’m very passionate about everyone of them. Let’s get started. DevReach - October 17th through the 18th in Sofia, Bulgaria. I will not be speaking at this event only attending. I am very excited because this will be my first time visiting Bulgaria. I am looking forward to meeting ...
While the development server in Visual Studio 2010 is great for most work, it does have 1 shortcoming in that if you start adding content types that are not part of the base set of known Mime types built in, you won’t affect the proper header response that is emitted to the client/browser. For example MP4 files, out of the box the development web server emits application/octet-stream or something like that. What we really need is video/mp4. Now, with IIS Express, you can easily switch over to use ...
T'his blog post has moved:http://gruffcode.com/... ...

I have just published article about interesting way of decoratning generated classes with attributes. Here is a direct link: DIRECT LINK