Tag | LINQ Posts

© 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 ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders posts can be found here. Back in one of my three original “Little Wonders” Trilogy of posts, I had listed generic delegates as one of the Little Wonders of .NET. Later, someone posted a comment saying said that they would love more detail on the generic delegates and their uses, since ...
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. " ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders post can be found here. Two weeks ago I decided to stop my Little Wonders in the String class, but I recanted and decided to do one more before wrapping up String. So today we’ll look at ways to find a out if a given source String has a target String inside of it (and where). IndexOf() ...
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 ...
In a previous post I explored some of the issues that can arise when parsing date and time values provided by users from different cultures and regions of the world. Correctly parsing and formatting different date formats is a very common internationalization concern in most software projects, but in this post I want to explore another area where parsing and formatting can cause some headaches. Numbers Are The International Language, Right? If your application deals with quantities of any kind then ...

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

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 ...
Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can help improve your code by making it easier to write and maintain. The index of all my past little wonders post can be found here. Today we will look at five easy ways to aggregate sequences. Often times when we’re looking at a sequence of objects, we want to do perform some sort of aggregation across those sequences to find a calculated result from the sequence. The methods we will be looking ...
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 ...