Tag | LINQ Posts

This weekend i was engaged with a rather uninteresting conversation with my wife. My wife is computer savvy but still is catching up on new technologies. Below is a brief snippet. I am hopeful that this will give you some idea on SAAS. Me: ok... Wife: What? you said something? me: Nothing. I was just talking aloud... its about SAAS. Wife: SAAS??? (for the less informed.. SAAS means mother-in-law in hindi !!!). Are you watching those hindi serials lately? me: Well, SAAS is a Acronym for Software As ...
One of my colleague remarked that LINQ is "VERY SIMILAR" to TSQL. However, he also cursed that why the LINQ guys have implemented it "reversely". What he meant that why the Select is reversed… SQL query will be 1: Select Name from Employee where sal > 80000 LINQ 1: var q = from emp in Employee 2: where emp.sal > 80000 3: Select emp; I cant help but giving him references to Korth & Sudarshan and mathematical Projections… That also reminded me of taking a quick tour of algebra which i am ...
Dependency properties is one concept which i always marvel. As programmer / developer i always like the concept, as by just introducing DP, so many stuff now is so easy(Read Template programming in XAML). DP is called a BEAST (in Silverlight and WPF) for reasons of complexity involved in understanding them. Also, of course, because they are so powerful language paradigm. I sometimes do think DP did not actually got their due. I mean, so many efforts is gone into explaining Lambda expressions, LINQ, ...
Well, here we are again. Last time, we talked about project structure and came up with the one we’ll use for this series. Next we’ll talk tools. We’ll talk tools like Tim Taylor talks tools: with lots of grunts for my favorites and only a little explanation about what the tools do.) This is mostly because there is LOTS of material on the interwebs about all of these tools. I tend to favor the tools that are the most widely used for two main reasons: they have been battle tested by the largest crowd ...
Just a quick tip that I found handy while doing some writing yesterday; chances are if you’ve played with LINQ you probably wrote something like this… var outputString = from s in inputString where s.Length > 1 select s; //Do some stuff with outputString in your method... Code like the above will work perfectly well if what you’re going to work with your implicit variable, outputString, within the body of the same method. But, as it stands, you can’t return outputString, or any implicit variable ...
Turing Project Page: [Novice: 9 | Advanced: 6 ] FAQ | Table of Contents | Definitions What is this and where do I start? [Reposted here while my primary blog is sorted out ] From Database to DataGrid The next step in Project Turing is to create a first iteration of the Silverlight application that will retrieve data from our database. Using our technology of choice: the Data Entity Framework coupled with .Net RIA Services. .Net RIA Services will allow us to create business logic on the server and ...
I was just reading a post on Donald Belchman's Blog today, as part of his series of "Development Project Archetypes", and one of them was on the "Ooo.... Shiny...." developer. An incestuous cousin to the Front of the Magazine Architect, this developer is easily distracted by any new technology. Not only will he want to talk about it endlessly, the ‘Oooo…Shiny!’ Developer will simply add the technology to the project without telling anyone. You will find, scattered through the code base, a number ...
Since most of the applications that I create are distributed accross a WAN that spans the country I am really big about minimizing the bandwidth usage of my applications. That typically means serializing and compressing the large chunks of data that go across the wire. My most recent application is using LINQ to SQL. However, its only using Stored Procedures since that was a requirement passed down "from above". Today I wanted to start minimizing that bandwidth footprint of my application and serialize ...
I had looked up the LoadControl(“”) method earlier today, and came upon a short website entry that quickly discussed how to load a web user control (.ascx) dynamically onto a page. The link is: http://www.codeproject.com/... It mentioned inside that a CMS (content management system) could be built using this method + a database table to track these controls. It got me intrigued, so I decided to pursue it. It’s pretty simple, and actually adds a lot of cool functionality ...
All thanks to Andrew for sharing for this idea, I just trimmed it down a bit: using System;using System.CodeDom;using System.Data.Linq.Mapping;using System.Web.Compilation;using System.Web.UI;using System.Text.RegularExpressi... LinqLength{ [ExpressionPrefix("LinqLenq... public class LinqLength : ExpressionBuilder { public override CodeExpression GetCodeExpression(BoundProp... entry, Object parsedData, ExpressionBuilderContext context) { return new CodePrimitiveExpression(Reg... ...
LINQPad... Simply Awesome, It is to databases what Kaxaml is to WPF. You have REALLY got to check this out. http://www.linqpad.net Amazing little application keep me quite organized and helps me remember those things that I find hard to remember. Evernote Here’s their tour video: ...

I needed to do a quick sort on a DropDownList Server Control and found a great way of doing it in just 4 lines of code.  Your project will need to be pointed to the .NET 3.5 Framework and will need a reference to System.Linq.

 

List<string> list = DropDownList.Items.Cast<ListItem>().Select(item => item.Text).ToList(); 
list.Sort((x, y) => string.Compare(x, y)); 
DropDownList.DataSource = list; 
DropDownList.DataBind();

I'm happy to announce that I've launched a new project examining the creation of a business application from design to implementation using Silverlight and such related technologies as Linq, Entity Framework, RIA Services and more. This project is being documented on two levels: Targeted at intermediate Silverlight programmers. Targeted at novice Silverlight programmers to accomplish this, the documentation has next and previous markers for each track, and I've created a Table of Contents for locating ...
This example shows the basic way on how to populate a data from database to a ListBox/DropDownList control using LINQ to SQL. Note that I used Northwind database here just for the simplicity of this example. To get started then let’s go ahead and add a new item in your website application in Visual Studio 2008 or VWD Express 2008. To do this, just right click on the web site -> select Add New Item -> and on the Templates select LINQ to SQL Classes as shown below and click ok: Now open up Server ...
In this Issue: CorrinaB, UXPassion, and Nikhil Kothari Shoutouts: Frank La Vigne cracked open the SketchFlow Feedback File Format using my favorite editor :) ... oh you just know we're going to see toys dealing with that! Walt Ritscher's Shazzam is getting some legs: Shazzam – as Seen in Silverlight 3 Programmers Reference ... congrats Walt! From SilverlightCream.com: Silverlight 3 Application Themes Unless you've not been around Silverlight, you know CorrinaB is the genius behind all the great themes, ...
Emad Ashi (@splashup on twitter) interviewed me in the 5th episode of his first Arabic podcast series DotNetArabi to talk about Object Relational Mapping in .NET in Arabic. Podcast Page: Mohamed Meligy Talking about ORMs (MP3 Direct Download) ?????? ????? ??????? ????? ??? ??????? ??? ???????.. ?????? ?? ???? ?? ??? ???? ?? ??? ???????? - ? ???? ??? ???? ?? ??? ???????? ????????? ?? ??? Object Relational Mappers – ORMs ???? ????? ?? “???? ?????” (splashup@ ??? ?????) ??? ???????? ?? ?? ???? “??? ...
I try to spend a little time every day brushing up on my developer skills. Some days I have more success than others. I might attempt to brush up on my skills by reading a tech book (currently working through "Working Effectively with Legacy Code" by Michael C. Feathers, I'm loving that book!), practicing some new language features (I'm still wrapping my head around lambda expressions and LINQ) or just browsing tech blogs and listening to tech podcasts. I do this partly because our industry changes ...
When working with WPF projects in Visual Studio, you can add WPF Windows, Pages, User Controls and Resource Dictionaries to a project by right clicking on the project and selecting Add > Window..., Add > Page..., Add > User Control... or Add > Resource Dictionary... menu options. The problem I run into is that these menu options are only available if you selected one of the WPF project templates when adding the project to your solution. How can we add WPF items to existing projects in ...
So this is one of those things that has slipped past me for all these months and now that I’ve discovered it, I can’t believe I went without it. I recently found out that I can access a business object in the ItemDataBound event of a ListView which makes it way easier to do some last minute control changing (such as binding labels or hyperlinks, etc.) In my example, I have a LINQ to SQL class called Question. My ListView hooks up to a datasource of IEnumerable<Question> and displays its properties—nothing ...
In this Issue: Paulio, Jesse Liberty, René Schulte, Pete Blois, Benjamin Roux, UXPassion, Pencho Popadiyn, Kris Meeusen, Scott Marlowe, and Matthias Shapiro Shoutouts: The UXConnection has this interesting Expression Design post up: [Mini-Tutorial] Working with Images in Expression Design I got a link sent to me for SilverBoom - Public Beta to Convert Adobe Flash files to Microsoft Silverlight/WPF From SilverlightCream.com: Using Blend to set the colour of the text in a button If you've tried to ...
On Tuesday night (August 25), I will be presenting “C# 3.0 Deep Dish with a slice of C# 4.0” at CapArea .NET User Group (but I have to give Brian Noyes credit for the catchy title). The primary content of the presentation will be a deep dive into the C# 3.0 language features. The latter part of the presentation will be an overview of the features coming in C# 4.0. Hope to see you there. Additionally, the next night (Wednesday, August 26), I’ll be at FredNUG presenting Linq to SQL ...
Create a rss or atom feed is very simple in asp.net mvc. In V1.0 there isn’t a build-in mechanism to work with feeds, however we can very quickly build our own. All we have to do is create a xml structure accordance with their specification and new ActionResult derived class to handle the result. But let’s start form beginning. The first of all, we need to create a new MVC project and call it e.g. RssFeed. The data for feeds will be taken from database, so we have to build model. Let’s create a new ...
Microsoft Interoperability team announced an release of the new project which is the bridge between PHP and.NET and erases bounds of technologies even more. This project allows developers on PHP even more easier to access and use all power of .NET services which based on ADO.NET Data Services. From the point of view of working out the scheme looks classically enough. By working out it is necessary to use utility PHPDataSvcUtil which is in PHP Toolkit for ADO.NET Data Services. This utility will generate ...
In this catching-up Issue: Brad Abrams, Matthias Shapiro, Jesse Liberty, Walt Ritscher, Erik Mork, Gavin Wignall, Tim Heuer, Rob Zelt, Jeff Prosise, and Dan Wahlin. Shoutouts: The Expression Blend and Design blog reports All Expression Blend Samples Posted to the Expression Gallery! Rob Zelt reminds us to Remember the Silverlight Toolkit! In case you missed this one, it's huge: Sunday Night Football - Powered by Silverlight congrats to all involved with that one!! From SilverlightCream.com: Business ...
During my project that is heavily centered around web services, I often found that before I could execute one overall integration, I would need about 3 or 4 web Service calls to collect all the parameters I needed to actually call the web service call I was really trying to execute. I came across an interesting situation where I need to retrieve the List from SharePoint. A web service call will send back an XMLElement with all the information available for a list. The problem is that the list needs ...
What is LINQ? LINQ == Language Integrated Query I been trying to learn more about LINQ and searching the Internet until I found this link Introduction to LINQ Also, this is a great link to LINQ Tutorial: http://dotnetslackers.com/a... ...
UPDATE dated August 17, 2009 Once I posted this entry, there is a lot of interest that has been shown and few queries as well. So I thought I need to update this post. This is only the first post in the series on ASP.NET 4.0 fetaures. There are lot of ground breaking things and other enhancements that are pretty exciting. To the folks who asked for "why MS changing dev platform once in 18 months" There is no change. there are a few enhancements. Post .NET 2.0 there have been a lot of additional APIs ...
I have looked at LINQ and still get this uneasy feeling that it is definitely a love/hate relationship, but I figure I would ask the community on their views on it. Here are my personal issues with it that is steering me away from it currently to be used as a main driving framework of a brand new project: LINQ is a framework in which I may not agree with how it handles all the "voodoo" behind the scenes which can lead to developers believing it is the next thing to sliced bread. I agree it does add ...
(this is a repost since the initial post had a few issues that couldn’t be corrected) I am playing with the ASP.NET 4.0 QueryExtender released as a part of the Visual Studio 2010 Beta 1. It provides endless opportunities for working with data without writing much code and when you combine it with a few Ajax features, gives a truly great user experience with very less effort. To begin with you need the Visual Studio 2010 Beta 1 and .NET Framework 4.0 Beta 1. You can install both from http://msdn.microsoft.com/h... ...
I pretty new to LINQ, and I’m keen to get more experience using it, so whenever an opportunity arises I like to try writing LINQ queries. I needed to write a method to extract a comma separated list of numbers from a config file, and return this as List<int>. I was looking at ways to do this using LINQ, but hit a problem. I wanted my LINQ query to filter out any values in the CSV string that could not be parsed as an int, without causing an exception. Using int.TryParse() seemed like a possible ...
I'd like to compare the java language to .net as I'm experiencing it. First of all, I'd like to point out that the differences are less than the similarities. Purely seen from a syntax point there really are no differences. Except of course if you're used to .net 3.5. This is irritating at first, but after a while you're just resigned to it. Take the simple properties we're so used to in .net Compare these two identical pieces of code: java: private int counter; public int getCounter(){ return counter; ...
Jestem programista .Net. I jestem programista wygodnym. Lubie poswiecac czas na szukanie narzedzi, które w przyszlosci pozwola mi oszczedzic czas. No i najwazniejszym pytaniem jest oczywiscie – czy to jest oplacalne? Czy wiecej czasu zaoszczedze uzywajac tych narzedzi/projektów/przydatnych kodów zródlowych, niz strace na ich wyszukiwanie? Do tego trzeba tez doliczyc obciazenie spowodowane przystosowaniem do nowych technologii i poswiecenie jednego projektu na pastwe losu (bo zawsze moze sie nie udac ...
A co-worker posed an interesting LINQ problem to me tonight so I figured I’d share. They had a collection of items and wanted an algorithm that would create a “collection of collections” where the first three items would be grouped together, second three items, on so on. For example, given a sequence like this: { “a”, “b”, “c”, “d”, “e”, “f”, “g”, “h” }, it would create a structure that contained 3 groups – the first element would be { “a”, “b”, “c” }, the second would be { “d”, “e”, “f” } and the ...
In this Issue: Michael Washington, Faisal, Jose Fajardo, IRhetoric, Brad Abrams(2), and Jonathan van de Veen. Shoutouts: Inspired by Tim Heuer, Jobi Joy has a demo of him using his HP Touch machine with an application he provides: Silverlight 3 Multi-Touch with Windows 7 and HP Touch Smart René Schulte has a follow-up to his very cool WriteableBitmap Performance program where he adds in 2 more tests: Silverlight 3 WriteableBitmap Performance Follow-Up Jonathan van de Veen has a patch up for his CodeEmbed4Web ...
As predicted, I came around to using some radio buttons. As you might guess by now, I didn't like the HTML or the implementation in the current MVC release. As you may expect, I wrote my own :-) The implementation is fairly simple and straightforward. It extends System.Web.MVC.ViewPage, takes a list of objects, allows for selection of one of the radio buttons, supports orientation and supports selection of both the value the radio button submits and the display string for that item independently. ...
Last weekend (August 1st and 2nd 2009) I went into London to attend the Alt.NET UK Conference or more specifically two separate but related days. This was my first ever Alt.NET conference and I absolutely loved it. It was exciting to be around so many enthusiastic and smart individuals discussing software development with an open mind and a desire to help those around them. No elitism, no stuffiness, just developers doing what they do best – talking about (and doing) development. It reminded me of ...
The need As certain as the sun rising tomorrow, there will come the point where you will want to display a list or grid with paging. While many solutions exist, and many component developers are coming in with robust solutions, a simple and satisfactory solution can be created fairly easily. Implementation Why create a pager from scratch? Several reasons: 1) You want to control the pager completely – display, style and all. 2) You don't like the idea of JavaScript paging, which will load your hundreds ...
In my last blog I talked about the new site around SharePoint 2010 and the sneak peak videos. I got a chace to watch them and here are my notes: SharePoint 2010 Feature Highlights: New User Interface including new Ribbon Web Edit Silverlight Web Part Rich Theming Browser support for Safari, Firefox and IE Visio Services SharePoint Designer enhancements Business Connectivity Services (BDC evolution) SharePoint Workspaces (formerly Groove) or offline libraries Richer Media Support SharePoint 2010 Admin ...
My general rule of thumb (which I actually read on some other site or blog, or maybe in a book or on the msdn?) is that if you plan on using a control once or twice, use a web user control. If, however, you want to use it all over your program, you should invest the time to make it a server control. They are much easier to use in the program (in the long-term), since they allow you to drag and drop them from the toolbox and you can pass them between programs easier as a DLL instead of a .ascx file. ...
Translation of original post by Scott Guthrie: / Tlumaczenie oryginalnego posta napisanego przez Scott’a Guthrie: http://weblogs.asp.net/scot... Zespól ASP.NET wlasnie opublikowal pierwszy preview nowej wersji ASP.NET MVC – MVC Version 2. Mozesz pobrac go tutaj. Preview 1 dziala w srodowisku .NET 3.5 SP1 i VS 2008, i moze byc zainstalowane równolegle z ASP.NET MVC 1.0 (co oznacza, iz nie pojawi sie miedzy nimi konflikt, a dotad dzialajace ...
Well on my last post, i talk about changes on controls in #Silverlight3, while i tried to use a demo about Navigation and Styles, Corrina and her team had developed 7 additional application templates, for the community to consume and they’ve put them up on the Expression Community Gallery for download: Aurora Frosted Cinnamon Toast Lime Shocker Pinky Retro Sky Line Subdued All templates are terrific and very easy to use only change the reference to the resource in the styles.xaml code file. But if ...
I’ve read a few tutorials online about paging with LINQ and an ObjectDataSource but there were always quirks that ended up slowing me down unnecessarily so I thought I’d put together my own easy to follow tutorial that should get someone up and running with paging in almost no time! Step 0: Things I will Assume about your Project I’ll assume that you have already created a DataContext and dropped in some tables from your database onto it. For my tutorial, I’ll again re-use the “Person” object that ...
The other day I required ordering a list of people first by the date they were created, and then by their last name. I spent forever trying to find out why my two OrderBy statements were conflicting with one another, until I remembered you use “ThenBy()” for any additional sorting you want to do. So the query looked something like this then: IEnumerable<Person> myPersons = myDataContext.Persons .OrderBy(m=>m.DateCreated) .ThenBy(m=>m.LastName); Just thought I’d share! It’s easy to forget ...
The next Frederick .NET User Group (FredNUG) meeting will be Wednesday, August 26th at the Urbana Regional Library. At the meeting, we’ll recap the previous meeting’s bot bash code challenge. Since the last meeting, several members have begun improving their bots. During the recap, we’ll provide and overview of the challenge for those folks who missed the July meeting and then see whose bot can accumulate the most wins. Following a break for pizza, a little bit of social networking and a demo from ...
So when I first started working with SQL Server 2008 and LINQ, I would pretty much just use the LinqDataSource because it was definitely the easiest to use. It’s pretty good for testing purposes, or really small projects, but if you’re doing anything that is going to grow / is large already, then you’ll probably not want all that logic embedded in your pages. As I became more comfortable with LINQ, I decided to take on the task of switching over to the ObjectDataSource to bind to my ListViews. Here’s ...
Introduction: In this post, I will explain you how can we get the countries name filled in any collection using .net without using any database. It is a regular task, which we all as developers did some past day but the difference is we used database table or xml file to hold the country names. But .net framework provide us with all the countries information in Globalization namespace. So, here is the code for that Dictionary<string,string... objDic = new Dictionary<string,string... foreach ...
C# 3.0 brought with it a plethora of great additions, such as LINQ, lambda expressions and anonymous types. With the inclusion of LINQ, Microsoft decided that it was often difficult to determine the return type from a LINQ expressions. As such, they opted to include the var keyword, which is used to implicitly define a type. The type is determined by the compiler at compile time, making it strongly typed, so it is not analogous to the Visual Basic variant type. While this has some value in aiding ...
In this Issue: Rabeeh Abla, Laurent Duveau, Jesse Liberty, Davide Zordan, Brad Abrams, Scott Marlowe, and Jafar Husain. Shoutouts: New today from Silverlight SDK: Expression Blend 3 released!. Go get your 60-day trial! Shawn Wildermuth posted his My Favorite Visual Studio Shortcuts and Snippets. Others have taken him up on the "what are yours" question, so this could become a good reference post. Corey Schuman followed his SketchFlow Controls screenshot up with a Silverlight 3 app: SketchFlow Control ...
Check out the new features in SharePoint 2010. Really cool stuff. I highly recommend watching the video here. The cools stuff I remember is LINQ for SharePoint !! how cool is that? no more CAML queries.. blur....anyway watch the presentations that show easy it is to deploy a WSP file into the dev SharePoint page. .. I love it.... For more info on how EMC Application Consulting Services can help you get ready for SharePoint Server 2010 please contact me through this blog Harish Pavithran. Developer ...
Let's say we neede to process a bunch of entities coming from an XML file, create EDM entites for each XML element and eventually persist them. Very trivial to accomplish using a little bit of LINQ. <Roles> <Role name="Admin"/> <Role name="Reader"/> <Role name="Writer"/> </Roles> var doc = XDocument.Load("Roles.xml"); var roles = doc.Element("Roles").Elemen... => new Role { RoleName = (string)x.Attribute("name") }); PermissionsAPIContext context = ...