Tag | LINQ Posts

Below are the notes I made in the REST Architecture Session I helped kick off with Andrew. RSS, ATOM, and such needed for better discovery. i.e. there still is a need for some type of discovery. Difficult is modeling behaviors in a RESTful way. ?? Invoking some type of state against an object. For instance in the case of a POST vs. a GET. The GET is easy, comes back as is, but what about a POST, which often changes some state or something. Challenge is doing multiple workflows with stateful workflows. ...
One of my colleague and friend, Robin is playing and struggling with the ASP.NET MVC 2 on a project these days while I’m struggling with a annoying client. Since it’s his first time to use ASP.NET MVC he was meetings with a lot of problem and I was very happy to share my experience to him. Yesterday he asked me when he attempted to insert a <br /> element into his page he found that the page was rendered like this which is bad. He found his <br /> was shown as a part of the string rather ...
One of the things that might be surprising in the LINQ Distinct standard query operator is that it doesn’t automatically work properly on custom classes. There are reasons for this, which I’ll explain shortly. The example I’ll use in this post focuses on pulling a unique list of names to load into a drop-down list. I’ll explain the sample application, show you typical first shot at Distinct, explain why it won’t work as you expect, and then demonstrate a solution to make Distinct work with any custom ...
A Gentle .NET touch to Unix Touch The Unix world has an elegant utility called 'touch' which would modify the timestamp of the file whose path is being passed an argument to it. Unfortunately, we don't have a quick and direct such tool in Windows domain. However, just a few lines of code in C# can fill this gap to embrace and rejuvenate any file in the file system, subject to access ACL restrictions with the current timestamp. using System; using System.Collections.Generic; using System.Linq; using ...
I’m loving my expert F# book – today I thought I would give a post on using mutable records as covered in Chapter 4 of Expert F#. So as they explain the simplest mutable data structures in F# are mutable records. The whole concept of things by default being immutable is a new one for me from my C# background. Anyhow… lets look at some C# code first. using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MutableRecords { public class DiscreteEventCounter { ...
Recently, I started working on a new ASP.NET MVC 2 project and I wanted to reuse the data access (LINQ to SQL) and business logic methods (WCF RIA Services) that had been developed for a previous project that used Silverlight for the front-end. I figured that I would be able to instantiate the various DomainService classes from within my controller’s action methods, because after all, the code for those services didn’t look very complicated. WRONG! I didn’t realize at first that some of the functionality ...
Fellow Blog Readers: I figured I use my first blog post on GeeksWithBlogs to introduce myself. I recently relocated from Long Island, NY to South Florida where I joined a local company as Software Engineer specializing in technologies such as C#, ASP.Net 3.5, WCF, Silverlight, SQL Server 2008 and LINQ, to name a few. I am an MCP and MCTS ASP.Net 3.5, looking to get my .Net 4.0 certification soon. Having been in industry for a few years so far, I figured I would share with you my take on the importance ...
.Last time I showed you how to get started building extensions for Expression Blend. Lets build a useful extension this time and go a bit deeper into Blend. Source of project => here Compiled dll => here (extract into /extensions folder of Expression Blend) The Extension When working on large Xaml files in Blend it’s often hard to find a specific control in the "Objects and Timeline Pane”. An extension that searches the active document and presents all elements that satisfy the query would ...
Eager loading with EF To Do Eager loading use Projections (for e.g. : 1: var custWithAddresses = from c in context.Contacts 2: where c.LastName == "Gupta" 3: select new {c, c.Addresses} or use Include Query Builder Methods (Include(“Addresses”)) 1: from c in context.Contacts.Include("A... 2: select c; If there is multi-level hierarchical Data then to eager load all the relationships use Include Query Builder methods like customers.Include("Order.Or... to include Order and OrderDetail ...
I stole that from the back of a T-shirt I saw at the Orlando Code Camp 2010. This was my first code camp and my first time volunteering for an event like this as well. It was an awesome day. I cannot begin to count the “aaahh”, “I did-not-know I could do that”, in the crowds and for myself. I think it was a great day of learning for everyone at all levels. All of the presenters were different and provided great insights into the topics they were presenting. Here’s a list of the ones that I attended. ...
In this post, we are going to look into implementing lists into our twitter application and also about enhancing the data grid to display the status messages in a pleasing way with the profile images. Twitter lists are really cool feature that they recently added, I love them and I’ve quite a few lists setup one for DOTNET gurus, SQL Server gurus and one for a few celebrities. You can follow them here. Now let us move onto our tutorial. 1) Lists can be subscribed to in two ways, one can be user’s ...
In this post, we will look at implementing the following in our twitter client - displaying the profile picture in the home page after logging in. So to accomplish this, we will need to do the following steps. 1) First of all, let us create another field in our Global variable static class to hold the profile image url. So just create a static string field in that. public static string profileImage { get; set; } 2) In the Login.xaml.cs file, before the line where we redirect to the Home page if the ...
FredNUG is pleased to announce that we have an excellent speaker lined up for April. On April 20th, we’ll start with pizza and social networking at 6:30 PM. Then, starting at 7 PM, Dane Morgridge will present “Getting Started with Entity Framework 4” The scheduled agenda is: 6:30 PM - 7:00 PM - Pizza/Social Networking/Announcements 7:00 PM - 8:30 PM - Main Topic: Getting Started with Entity Framework 4 with Dane Morgridge Main Topic Description: Getting Started with Entity Framework 4 With .Net 3.5 ...
Time for another guest post (check out others in the series), this time bringing together the world of mocking with the world of Entity Framework. A big thanks to Moses for agreeing to do this. Unit Testing Entity Framework Dependent Code using TypeMock Isolator by Muhammad Mosa Introduction Unit testing data access code in my opinion is a challenging thing. Let us consider unit tests and integration tests. In integration tests you are allowed to have environmental dependencies such as a physical ...
Today, I released LINQ to Twitter v2.0.8. Besides normal maintenance, this release includes the Twitter Geo API and the Suggested Users API. LINQ to Twitter is hosted on CodePlex.com: http://linqtotwitter.codepl... In addition to new functionality, I've made much progress toward LINQ to Twitter documentation; primarily in the Making API Calls area: http://linqtotwitter.codepl... There's also a discussion forum where you can ...
An ex-colleague of mine used to call his SQL script generator "Super-Scriptmatic 2000". It impressed our then boss little, but was fun to say and use. We called every batch job and script "something 2000" from that day on. I'm tempted to call this one Menu-Matic 2000, except it's waaaay past 2000. Oh well. The problem: I'm developing a bunch of stuff in MVC. There's no PM to generate mounds of requirements and there's no Ux Architect to create wireframe. During development, things change. Specifically, ...
LinqPad as we all know has been a wonderful tool for running ad-hoc queries. With Azure Table storage in picture LinqPad was no longer in picture and we shifted focus to Cloud Storage Studio only to realize the limited and strange querying capabilities of CSS. With some tweaking to Linqpad we can get the comfortable old shoe of ad-hoc queries with LinqPad in the Azure Table storage. Steps: 1. Start LinqPad 2. Right Click in the query window and select “Query Properties” 3. In The Additional References ...
There are many ways to generate a PowerPoint presentation using Open XML. The first way is to build it by hand strictly using the SDK. Alternately you can modify a copy of a base presentation in place. The third approach to generate a presentation is to build a new presentation from the parts of an existing presentation by copying slides as needed. This post will focus on the third option. In order to make this solution a little more elegant I am going to create a VSTO add-in as I did in my previous ...
Employee Info Starter Kit is a ASP.NET based web application, which includes very simple user requirements, where we can create, read, update and delete (crud) the employee info of a company. Based on just a database table, it explores and solves most of the major problems in web development architectural space. This open source starter kit extensively uses major features available in latest Visual Studio, ASP.NET and Sql Server to make robust, scalable, secured and maintainable web applications ...
Here is the scenario: You have a Windows Form Application that calls a method via Invoke or BeginInvoke which throws exceptions. Now you want to find out where the error did occur and how the method has been called. Here is the output we do get when we call Begin/EndInvoke or simply Invoke The actual code that was executed was like this: private void cInvoke_Click(object sender, EventArgs e) { InvokingFunction(CallMode.I... } [MethodImpl(MethodImplOptio... void InvokingFunction(CallMode ...
Finally Silverlight 4 RC is released and also that Windows 7 Phone Series will rely heavily on Silverlight platform for apps platform. its a really good news for Silverlight developers and designers. More information on this here. You can use SL 4 RC with VS 2010. SL 4 RC does not come with VS 2010, you need to download it separately and install it. So for the next part, be ready with VS 2010 and SL4 RC, we will start using them and not betas. With this momentum, let us go to the next part of our ...
Coming from someone who loves the KISS method, I was surprised to find that I was making something entirely too complicated. I know, shocker right? Now I'm no unit testing ninja, and not really a WCF ninja either, but had a desire to test service calls without a) going to a database, or b) making sure that the entire WCF infrastructure was tip top. Who does? It's not the environment I want to test, just the logic I’ve written to ensure there aren't any side effects. So, for the K.I.S.S. method: Assuming ...
In my last post I created a very simple WCF service with the user registration functionality. I created an entity for the user data and a DataContext class which provides some methods for operating the entities such as add, delete, etc. And in the service method I utilized it to add a new entity into the table service. But I didn’t have any validation before registering which is not acceptable in a real project. So in this post I would firstly add some validation before perform the data creation ...
Next week (17th March 2010) I am presenting on EF4 at www.devweek.com in London (and Azure on the 18th). Today I wanted to get all the latest bits on my demo machine and also check if there are any cool new resources I can point people at. Whilst most of the new improvements in Entity Framework come with the Visual Studio 2010 RC (and the RTM), there are a couple of separate items you need to install if you want to explore all the features. To demo EF4 you need: Visual Studio 2010 RC Download and ...
Update (14-Mar-2010): Updated the Whiteboard Demo I must have tried reading through the various explanations and introductions to the new Reactive Extensions for .NET before the concepts finally started sinking in. The article that gave me the ah-ha moment was over on SilverlightShow.net and titled Using Reactive Extensions in Silverlight. The author did a good job comparing the "normal" way of handling events vs. the new "reactive" methods. Admittedly, I still have more to learn about the Rx Framework, ...
In my previous example I have demonstrated how to create a simple form that would allow users to insert data to the database using L2S. In this example I’m going to demonstrate how to fetch and filter data from database and fill the fields in the form using L2S. This example is basically a continuation of my previous example here. So I would suggest you to take a look at my previous example first before you proceed reading this example. STEP 1: Setting up the GUI To get started, add a new WebForm ...
Few months ago, I’ve created a simple demo about “Creating a Simple Registration Form using the ADO.NET way”. In this article, I'm going to demonstrate how to create a simple form that would allows users to insert data to the database using L2S. As an overview, LINQ to SQL is a technology that allow you to query sql server. LINQ to SQL is an O/RM (object relational mapping) implementation that ships in the .NET Framework "Orcas" release, and which allows you to model a relational database using .NET ...
LinqPad as we all know has been a wonderful tool for running ad-hoc queries. With Windows Azure Table storage in picture LinqPad was no longer in picture and we shifted focus to Cloud Storage Studio only to realize the limited and strange querying capabilities of CSS. With some tweaking to Linqpad we can get the comfortable old shoe of ad-hoc queries with LinqPad in the Windows Azure Table storage. Steps: 1. Start LinqPad 2. Right Click in the query window and select “Query Properties” 3. In The ...
In Windows Azure platform there are 3 storage we can use to save our data on the cloud. They are the Table, Blob and Queue. Before the Chinese New Year Microsoft announced that Azure SDK 1.1 had been released and it supports a new type of storage – Drive, which allows us to operate NTFS files on the cloud. I will cover it in the coming few posts but now I would like to talk a bit about the Table Storage. Concept of Table Storage Service The most common development scenario is to retrieve, create, ...
INTRODUCTION If you are a SharePoint developer you know that there are two basic ways to develop against SharePoint. 1) The object Model 2) Web services. SharePoint object model has the advantage of being quite rich. Anything you can do through the SharePoint UI as an administrator or end user, you can do through the object model. In fact everything that is done through the UI is done through the object model behind the scenes. The major disadvantage to getting at SharePoint this way is that the ...
Chunking a List As I mentioned last time, I'm knee deep in python these days. I come from a statically typed background so it's definitely a mental adjustment. List comprehensions is BIG in Python and having worked with a few of them I can see why. Let's say we need to chunk a list into sublists of a specified size. Here is how we'd do it in C# static class Extensions { public static IEnumerable<List<T>... Chunk<T>(this List<T> l, int chunkSize) { if (chunkSize <0) { throw ...
Quick Links Adding Volcanos and Options - Earthquake Locator, part 2 Live Demo Source Code The recent wave of earthquakes (no pun intended) being reported in the news got me wondering about the frequency and severity of earthquakes around the world. Since I’ve been doing a lot of Silverlight development lately, I decided to scratch my curiosity with a nice little Bing Maps application that will show the location and relative strength of recent seismic activity. Here is a list of technologies this ...
In this Issue: András Velvárt, felix corke, Colin Eberhardt, Christopher Bennage, Gergely Orosz, Entity Spaces Team Blog, Mike Taulty(-2-), Jit Ghosh, and Jesse Liberty. Shoutouts: Jeremy Likness expands on the Silverlight Team's post Vancouver Olympics - How'd We Do That? Gavin Wignall has a post up Creating a 360 photograph of an object with Silverlight Photosynth From SilverlightCream.com: Transforming an Ugly Duckling into a Graceful Swan With Expression Blend and Silverlight - Part 2 Intro Animation ...
We will create a few classes now to help us with storing and retrieving user credentials, so that we don't ask for it every time we want to speak with Twitter for getting some information. Now the class to sorting out the credentials. We will have this class as a static so as to ensure one instance of the same. This class is mainly going to include a getter setter for username and password, a method to check if the user if logged in and another one to log out the user. You can get the code here. ...
Before I noticed how many other people had blogged about this same thing, I wrote an implementation of a "times" (integer extension) method -- the kind you'd find when coding in Ruby that is passed a block of code that it executes (n) times. Consider the following (in Ruby): ###########################... # prints: # Ruby was here # Ruby was here 2.times { printf("Ruby was here\n") } ###########################... # prints: # Ruby was here 0 # Ruby was here 1 2.times {|i| printf("Ruby ...
So… I am a C# coder at heart, but F# is starting to fascinate me. Today I thought I would try and figure out the basics of getting the two languages to talk to each other. From what I could tell on Stack Overflow, at least for now there will not be any Windows Forms / WPF exposed to F# (it is possible, but I am lazy and like VS to do as much as possible). Which leaves me thinking, where will I use F#. I can immediately see a use for it in the Business Layer of my applications – which would mean that ...
Silverlight at Visual Studio 2010 sample for simple binding a data to DataGrid. This sample is also for the beginners only. We will create a Databinding for DataGrid in a simple way using WCF and Linq to SQL. For more details: http://docs.google.com/Doc?... ...
Last time we saw some interesting initialization constructs possible with LINQ. Hope some of you have tried it out. If not, it’s never too late. LinqPad is a good friend in need. This time around we’d take a look at two common looping scenarios. 1. Looking up an object by name: Object lookup is commonplace while dealing with collections. Let’s look for an object with a given name. Previously we’d run a for each and come up with something like. public MyObject FindByName(string value) { foreach (MyObject ...
Since I am looking to get more involved with the development community, what better way to get started than to start attending and participating in the local user groups here in the Houston area. It's been a while since I've attended one of these things, but I do remember the free pizza and prize give-aways. Oh yeah, the topics and conversations are always good too! D2SIG - www.d2sig.org Silverlight 4 - What's New? Tuesday, March 2nd, 6:00 - 8:00 PM HDNUG - www.hdnug.org CodeSmith featuring PLINQO, ...
One of my major points of interest as a software developer is in the various tools that are available to make a developer’s life easier (or at least more interesting…). This is also a very important aspect for me in professional terms, because one part of my job lies in recommending suitable tools to my customers, implementing them and make them part of a developer team’s workflow. Thus, a well organized link collection is an important part of my assets and has a considerable business value for me ...
I was bored thinking of what my first blog post should be about, so I decided to interview myself (especially since no one else knows about this place, yet!)... Q: Where have you been? A: Well, it's been over two years since I last blogged about anything interesting, but since that old server has long since been retired, I decided to resurrect myself on a popular blog site (this one). Q: What have you been doing in the mean time? A: I have been working with several of the latest offerings from Microsoft, ...
Technorati Tags: General Pluralsight is an online .NET Training library which provides online training materials for .NET developers. Example trainings available on demand: · .NET 3.5 · Agile Team Practices · ASP.NET 3.5 · ASP.NET AJAX · ASP.NET MVC · BizTalk 2006 · BizTalk Server 2006 R2 · BizTalk Server 2009 · iPhone ASP.NET · LINQ · Managed Services Engine · Silverlight 3 · SharePoint Services · SQL Server 2008 · VSTS · WCF · Windows Server AppFabric, formerly "Dublin" · Windows Workflow · WPF ...
Last week, I needed to call the SQL Reporting Services Web Service to export reports as Excel, PDF, and Word formats. I could have used the [Add Web Reference...] as the MSDN Documentation Accessing the Report Server Web Service Using Visual Basic or Visual C#, but I decided to use [Add Service Reference...]. If you are wondering what the difference is between Web Reference and Service Reference, please read this blog post by Andrew Tokeley. Goal Create a common library project which I could reuse ...
LINQ as we all know provides intrinsic data querying capabilities to the framework languages supporting LINQ. Going forward its an obvious way to code clean, and with growing number of LINQ providers (LINQ to SQL, LINQ to Entities, LINQ to XML, LINQ for Maps, and not to forget DryadLinq and pLinq for us Cloudy folks’ Parallel Computing needs, and so on) it looks to be the de facto standard for querying within dotnet framework languages. Let us get acquainted to LINQ by taking a close look at the ...
While my home development computer is fried I’m going to hack away at my backlog of non-code related posts. Today I’d like to discuss some of the advantages and disadvantages of using Microsoft MVC over WebForms. First of all, MVC is not the end all, magical platform that many people would like you to believe. In fact I wouldn’t even recommend it to beginner developers. However, if you have experience with .NET and you’re willing to put in the time to learn how MVC works, you will find that it offers ...
I would like to make one of these entries for every example I don't find on MSDN. I'm not sure if the intention is to ignore C++ or if this was just expected to be too hard, too easy or too ugly for developers to grasp. I have submitted this as Community Content on MSDN, also. http://msdn.microsoft.com/e... Here is the missing example for Enumerable::ToList(); #include "stdafx.h" using namespace System; using namespace System::Collections::Generic; using namespace System::Linq; ...
There is a great article about Data Access in Silverlight by Shawn Wildermuth came out yesterday. The basic story of how Data Services works is that it takes a context object from a LINQ provider and exposes all the IQueryable endpoints as REST resources that can be queried. This works well in creating a place to execute queries and post/put/delete changes. The Silverlight (and .NET) client library allows you to just issue LINQ queries to the data service. Ability to create tracked projections from ...
The main purpose of this post is to show what's required in the main 3 .net languages for filtering and sorting. I decided to put these two problems together because they presented themselves to me simultaneously . There are many instances where I need to Sort custom objects and many instances where I need to filter out duplicates from a list of custom objects. For filtering (Distinct), the effect happens with the framework finds unique values for the object. For the Sort, the default comparer will ...
Just getting a few interesting cloud links “down on paper”. I last did one of these on Azure in Dec 2009. Not everyone seems to know that Roger Jennings does a rocking job of collating links on Azure – e.g. Sunday Feb 14th. Recommended read - Using SQL Server Client APIs with SQL Azure Version 1.0 Q&A: Looking Ahead at Microsoft's Cloud Strategy Tim O'Brien, director of Microsoft's Platform Strategy Group, discusses the future of Windows Azure, Silverlight, and developing with .NET. Getting MySQL ...
One of my previous posts talked about the performance improvements in WF4. With the recent release of Visual Studio 2010 / .NET 4 RC1, I thought I would re-run my performance tests to see if there have been any further improvements with the most recent version. My test is simply timing how long it takes to invoke an empty workflow (an Sequence activity that does nothing) 2,000,000 times. This test gives us a good idea of the overhead of invoking a workflow. With .NET 4.0 RC1, I am able to invoke ...