Tag | Csharp Posts

In this Issue: Jeremy Likness, Justin Angel, Pete Blois, Adam Kinney, and Victor Gaudioso. From SilverlightCream.com: Auto-Discoverable Views using Fluent PRISM in Silverlight Jeremy Likness has a follow-on to his Fluent Prism in Silverlight posts and is auto-discovering Views and tagging them so they appear in a target region. Silverlight Weblog Features Overview Leave it to Justin Angel to write his own Blog... but bonus for us, it's in Silverlight, MVVM, WCF RIA Services, Prism, etc. and etc. ...
Common questions when learning LINQ to SQL revolve around many-to-many relationships. This post will describe a scenario that needs queries across many-to-many relationships, show the data and the LINQ to SQL representation of that data, explain the query, and finally output the results. As you know, the design for many-to-many involves a join table. The following figure illustrates a many-to-many relationship between Tags and Tasks with a TasksTags join table: A scenario for working with this data ...
A while back I blogged about creating an MVC Delete Link with the AjaxHelper. This was based on another blog post from Stephen Walther where he explained the drawbacks of using hyperlinks for delete scenarios. HTTP and REST best practices state that GET requests should never modify a resource. The most “RESTful” implementation is is use a DELETE verb. In Walther’s post he shows two primary examples: 1) using AJAX to issue a true “DELETE” request, and 2) using individual forms to do the delete operations. ...
I'm currently reading the second edition of _Code Complete_ from cover-to-cover. More on that later, I'm sure - but for now I'll just say that you should read this right now if you haven't read it already. This is one of those books that you should really just leave by your dev machine. In any case, Steve McConnell mentions the importance of making code readable throughout the book. This is far from profound, yet in practice I don't see it done very much. Frankly, if you examine your coding practices ...
In this Issue: Jeremy Likness, Bob Bartholomay, Richard Waddell, Damian Schenkelman, and Shawn Wildermuth(2). Shoutouts: Jesse Liberty announced Silverlight HVP Proof Of Concept Released! ... on schedule and exceeds the promise. Jesse also posted a great picture Worth A Thousand Words to clarify the recent HVP posts. Be sure to click on the image to get it full-size. Shawn Wildermuth is asking you to Vote for My Sessions at MIX '10... you may want to check out the other sessions while you're voting ...
In this Issue: Jeremy Likness, René Schulte, Mike Taulty(2), Kirupa, David Kelley(2), and Jeff Blankenburg(2, 3, 4). Shoutout: Alex Golesh posted his material for Silverlight 4 Tutorial @SDP From SilverlightCream.com: PRISM, MEF, and MVVM Part 2 of 3: Making PRISM MEF Friendly Jeremy Likness has Part 2 of his sequence on making Prism friendly with MEF, and we're talking Silverlight 3 here. Ye Olde Kamera - Silverlight 4 Webcam & Old Movie Shader René Schulte wasn't satisfied to just use the webcam ...
Part III - Create the Java Web Service consumed by a .NET client This article is the third in a three part series demonstrating the interoperability between .NET WCF services and Java Web Services. NOTE: If you haven't read Part I or Part II, you should review them before continuing on. In Part I we reviewed the class diagram of the Team class and in Part II we covered creating a WCF service that exposed that class and consumed it with a Java client. Now we will be creating the JWS and consume it ...
Recently I had an interesting task to consume a particular XML document and populate a C# object from it. The structure of the XML document looked roughly like this: 1: <root xmlns="http://www.w3.org/20... 2: <entry> 3: <id>1</id> 4: <title>abc</title> 5: <content> 6: <div xmlns="http://www.w3.org/19... 7: <table> 8: <tr> 9: <td>Item1</td> 10: <td>111</td> 11: </tr> 12: <tr> 13: <td>Item2</td> ...
Part II - Create the WCF "Team" service consumed by a Java client This article is the second in a three part series demonstrating the interoperability between .NET WCF services and Java Web Services. NOTE: If you haven't read Part I you should review that article before continuing on. In Part I we reviewed the class diagram of the Team class, so our first step is to create the .NET classes in support of that model. We will start by creating the Player class: 1: [DataContractAttribute(Name = "Player", ...
In this Issue: Damian Schenkelman, Alexey Zakharov, Jeremy Likness, John Bruin, Andrej Tozon, Fons Sonnemans, Adam Kinney, Andrea Boschin, Al Pascual, Giorgetti Alessandro, Rob Eisenberg, Gill Cleeren, and Jeff Blankenburg. Shoutouts: Gavin Wignall has announced the Launch of the MSUK Partner Festive Game If you're in the UK, Tesco has this technology working: Silverlight-powered Virtual DVD now available from Tesco András Velvárt announced an interview by Karen Young when he was in Berlin: Another ...
Now that we have some basics for LINQ for XML. Lets get deep into some using LINQ against Relational databases, aggregate functions, like group by and sort. The database we will be using is books, this can be obtained from this page. Once you download the database, mount it in SQL Server by attaching this mdf file. Once the mdf file is mounted, we can start with the following steps to do our first LINQ to SQL console program. 1) First of all we need to add a new DB by selecting Tools > Connect ...
Now that we’ve got some basics of LINQ for XML. I think we should also look into group by queries in LINQ for XML. My motivation here would be to find the total price of books for each of the genre. For this, I should write LINQ something similar to this below: var query3 = from p2 in query_1 group p2 by p2.Element("genre").Value into b1 select new { Value = b1.Key, Price = b1 }; We group by particular node value using group p2 by p2.Element("genre").Value into b1, here b1.Key will give you the distinct ...
In this Issue: Richard Waddell(2), Jeremy Likness, AfricanGeek, Michael Washington, Colin Eberhardt, clearbreeze(2), Tim Heuer, Allan Muller, Shawn Wildermuth, Jesse Liberty, Brad Abrams, and Gill Cleeren(2). Shoutouts: I'm sure you all aggregate Scott Guthrie, but just in case: Search Engine Optimization (SEO) Toolkit Shawn Wildermuth posted links to his XBoxGames Databases for SQL Server 2005 and 2008 Fons Sonnemans posted his Silverlight Christmas Card... using behaviors he already discussed... ...
Previously I wrote an article regarding Unit Testing WCF with Unity. Unit testing allows you to test a single component of your application, completely independent of any other components or systems. Once you have successfully created your unit tests, the logical next step is to see how your service works when connected to other components. These integration tests allow you, for example, to run tests against your service and see how it behaves when writing to a database or consuming another service. ...
You can upload this example from here (I had made some small modification to the original code but it should be easy to understand. This solution uses just HTML and jQuery): http://cid-4fb5a48846336376... I needed a very simple solution that allows me to show centered modal div. ASP.NET Ajax Control Toolkit has modal popup (http://www.asp.net/AJAX/Aj... And also there are many of jQuery examples. But ...
One of the MVVM Light Toolkit’s user requested that I add the possibility to pass the EventArgs of an event to the ICommand that it is bound to through the EventToCommand trigger. At first I was a bit reluctant because it seems like a transgression of the rule that says you should avoid to have too much knowledge about the UI layer in the ViewModel. For example, if you have a RelayCommand in the ViewModel that expects a MouseEventArgs, it kinds of binds you to a certain kind of UI element, which ...
The next version of Entity Framework has many new features, many of which are enabling it to catch up with features previously available in other frameworks like LINQ to SQL. One of these new features is the updated stored procedure support. In previous versions of EF, working with stored procedures was quite limited and really only usable with CRUD operations that were mapped to already defined entities. With EF 4, you can start with your stored procedure and have the designer automatically generate ...
I want to put in this post some the jQuery methods that I found myself searching the web every other time i need them for the future reference. Check if element exists: if ($('#elementID').length > 0) { // do somehting } Disable/enable element $('#elementID').attr('disab... 'disabled'); $('#elementID').removeAttr(... Clear DropdownList or ListBox $('#ddl_ID >option').remove(); Add entry in the DropDownList or ListBox $('#ddl_ID').append($('<... ...
In this Issue: Andrej Tozon, nmarun, AmazedSaint, Shawn Wildermuth, Fredrik Normén, Damon Payne, Victor Gaudioso, Jeremy Likness(2), Alan Mendelevich, Dan Wahlin, Lee(2), Expression Blog, Andy Beaulieu, and Gill Cleeren. Shoutouts: Scott Guthrie Tweeted about Template Monster now having Silverlight Intro Templates and Silverlight Templates Einar Ingebrigtsen announced Balder 0.8.8.5 Release is out Victor Gaudioso has a list of all his videos: All of my Silverlight Video Tutorials in One Place: (Revisited) ...
In this Issue: Jeremy Likness, Rudi Grobler, Nick Kramer, Fredrik Normén, Mike Taulty, Deborah Kurata, Shayne Burgess, Glenn Block(2), and Gill Cleeren(2). Shoutout: Did you know MIX10 registration was open? Register by Jan 15th and get in for $795!! MIX10 From SilverlightCream.com: Unit Tests for ViewModels AND Views in Silverlight Confused about Unit Testing Silverlight apps in MVVM? Jeremy Likness isn't... and he shows us how! Blend 3 Tip: Filter resources by selected element Rudi Grobler has ...
So you're familiar with TDD (test-driven development)... Failing your tests first, then building up your classes to satisfy your tests so they're all "Green"... This is a typical scenario and is pretty straightfoward with .NET. Well now you have to create a WCF service and implement unit testing to ensure you don't break your service when you build out a new version. This is a bit more challenging but you do have some different options: Separate out your service code into a library and run your tests ...
Technorati Tags: Application Architecture and Design Strategies ASP.NET design patterns. Design patterns are set of useful approaches for solving repeating problems that appears many times during developing software. By using design patterns we are not reinventing the wheel again and again. The most sommon patters are: Creational Patterns Abstract Factory Creates an instance of several families of classes Singleton A class of which only a single instance can exist Structural Patterns Adapter Match ...
As a consultant, I frequently move my laptop between networks. Most of the time leaving everything set to ‘automatic’ e.g. using DHCP to configure all of my lan settings at boot, works fine. However at home I use OpenDNS to control my children's access to the web, and to help filter out known malicious sites etc. (If you have children, or less than savvy users of any age at home I would encourage you to have a look at OpenDNS. The free account should be sufficient for most home users.) Because I ...
This post aims to dissect the power that exists in the Aggregate LINQ operator. I have realized that most programmers use it sparingly and have decided to put a couple of examples to clarify how you can use the Aggregate operator to perform a few tricks. The screenshot below relates to the small examples that follow. The aggregate operator is interesting in that it enables accumulation of items to form some result. This comes in handy when we need to create new data items from others. In my examples ...
In this Issue: Gill Cleeren, Chris Klug, Expression Blog, James, nmarun, Deborah Kurata, cherylws, Jeremy Likness, David Kelley, Lee, and Fredrik Normén. Shoutouts: Jonathan van de Veen's latest post is on time management and setting goals: Adventures while building a Silverlight Enterprise application part #30 ChristophDotNet reports on a Silverlight 3 / Expression Lab Posted From SilverlightCream.com: Silverlight Advent Calendar: December 9th: Element-to-element bindings in Silverlight 3 Gill Cleeren's ...
In this Issue: Damian Schenkelman, Zoltan Arvai, Deborah Kurata, David Poll, Fredrik Normén, Victor Gaudioso(2), Adam Kinney(2, 3), Karl Shifflett, and Gill Cleeren(2). Shoutout: Jeremy Likness has a great post describing how to Host WCF as Windows Service without Installing Bea Stollnitz announced her new site/venture: Zag Studio’s web site... good luck Bea, and I hope you keep blogging good stuff! From SilverlightCream.com: Will Silverlight 4 ICommand support simplify using commands in Prism? Damian ...
In this Issue: Jeremy Likness, CLR Team Blog, Deborah Kurata, Tim Heuer, Ning Zhang, Jeff Prosise, Fredrik Normén, Antoni Dol, Adam Kinney, Jordan Knight, Andy Beaulieu, Kevin Dockx, and Al Pascual. Shoutouts: Jonathan van de Veen discusses the problems of upgrading to the beta in Adventures while building a Silverlight Enterprise application part #29 Victor Gaudioso has the materials up from My Silverlight 4 Presentation at LA C# Usergroup in Manhatten Beach, CA (12.01.09) including a Drop Demo ...
It looked like we should look a bit about LINQ fundamentals before we actually get into the core programming for our Silverlight twitter application. So we’ll look into LINQ for a few more posts, then we will proceed with our usual Silverlight stuff. Line INtegrated Query allows us to use Query language to select data from almost any type of data sources like XML, SQL, Objects, etc.... For more information about LINQ, visit this page, I don’t want to get deep into the details. You can get the sample ...
Just a small bit of code, I've been playing around with converting some Xml* code to Linq to Xml code, and pretty successfully achieved everything I wanted, one thing missing was the ability to retrieve an XElement ignoring case. First - I'd like mention that yes I know Xml is case sensitive - and this is a bad thing to do - but I needed to do it due to some wierdness in the input xml... Anyhews, below is the extension method I wrote to deal with this.. public static class XElementExtensions { /// ...
Was doing my daily research today and learned a couple of new and interesting things. A while back, I wrote a post about rendering options using .NET 3.5 SP1's charting component. I outlined a few of the more conventional/out-of-the-box methods (temporary directory, binary streaming). I also outlined a lesser-known technique in which you stream binary data to the src attribute of your <img> tag. That ends up looking like this... <img src='data:image/png;base64, iVBORw0KGgoAAAA[snip]; /> ...
Soo… Long time no write… A quick project was assigned to me and two other guys at work the other week – one of those quick 2-3 day projects, the ones were speed is paramount. Quality can be worked on after release… Sooo.. 3 parts, 3 of us, we split it 3 ways and all was good – one on database duty (using LINQ to SQL), one on UI (Adobe Flash 10) and me, on WCF service… All was going well, the database was up and running, I was using the libraries to interact it with it without any problems, then we ...
Lately I’ve been working with EF 4.0 and finding that many of the new features are catching up with the features previously available in other framework like LINQ to SQL. One example of this is the ability to easily attach objects (for example, disconnected objects that come in from another tier). For example, imagine you had a web service where a consumer submitted an object to get saved – you’d want to instantiate a new context, attach the incoming entity, and save the object. In previous versions ...
In this Issue: Rene Schulte, Jason Harper, Brad Abrams, John Papa, Jeremy Likness, Jeff Wilcox, Fredrik Normén, Tim Heuer, Shawn Wildermuth, and Andrej Tozon. Shoutouts: Ward Bell has a PDF up of PDC 2009 Session Links -- thanks Ward! Tim Heuer also has posted a Microsoft PDC09 and Silverlight Round-up... I'm adding this to the Silverlight Links in the WynApse.com outlookbar. Don't forget that Loek van den Ouweland and Fons Sonnemans have SilverlightXP up and running full of resources... They'd like ...
I've almost finished my first Umbraco project, which is probably the most awesome CMS I've ever seen. In case you've been under a rock (which, after having rooted around this thing, I am starting to feel like), Umbraco is a brilliant, ingenious, pure-XML-powered .NET CMS - sorry to say, but much better than DotNetNuke, and fully validates with XHTML 1.1 due to it's XML nature. It supports nested master pages, Intellisense with Visual Studio, custom user controls, XSLT rendering, Web Services and ...
I’d like to provide you with a SilverBullet™, a small snippet of Silverlight, a class or namespace hidden in the silverlight .NET framework, to help you out in times of need. It’s not to learn, but something to keep in your pocket. Just remember it’s there and you’re safe. When writing the demo for the code-camp I ran into issues getting back on the UI thread after calling a webservice. The call to the webservice was made from the UI thread, but the callback was made on a different thread. The System.Threading.Synchroniz... ...
In this Issue: Jeremy Likness, Andrej Tozon, Lee, Adam Kinney, Karl Shifflett, Andy Beaulieu, and Rob Houweling. From SilverlightCream.com: Revisiting Lorem Ipsum in Silverlight 4 with RichTextArea and Printing Jeremy Likness revisits some previous work on inline hyperlinks now in Silverlight 4B where the task becomes much simpler. He includes samples and code. MVVM with WPF, Silverlight, and… Windows Forms It appears that Andrej Tozon's blog slipped off my list... sorry Adrej, but point being, if ...
In this Issue: Jeremy Likness, Jesse Bishop, Deborah Kurata, Mark Tucker, Fredrik Normén, Corey Schuman(2), Laurent Duveau, Jeff Wilcox, and Erik Mork. Shoutout: Joe Stegman posted his BrowserFlow sample from PDC 2009 From SilverlightCream.com: Rich Data Forms in Silverlight 4 Beta Jeremy Likness' latest is on some of the new features in Silverlight 4B such as IDataErrorInfo, Data Annotations, Implicit Styles, and a lot more all with links out to descriptive posts... great overview posting! Implementing ...
Although delegate type and Enum type are class types, we can not inherit from them as they are sealed classes after compile, public delegate void DelegateTestType(); //Compile time error class myTest : DelegateTestType { ... } we can not make it as a type constraint either on class or method: //Compile time error class myTest<T> where T : DelegateTestType { } From the C# 2.0 specification we can read (20.7, Constraints): A class-type constraint must satisfy the following rules: · The type must ...
In this Issue: Rob Houweling, Michael Washington, Colin Eberhardt, Laurent Bugnion, Tomasz Janczuk, Jeremy Likness, and Andy Beaulieu. From SilverlightCream.com: Silverlight 4 – Using the webcam Rob Houweling has a tutorial up on using the webcam in Silverlight 4 Beta ... all good stuff, and hmm... I'm not following their new site, so that brings the total up to 397 :) Silverlight Bridge - A Silverlight 4 File Manager Access your local file system and drag-and-drop, and OOB in Silverlight? --- wow, ...
So in response to some comments on my original post on this topic, I started playing around with some other ideas. I figured it would be cleaner to post code here, rather than the comments. How many variations on the theme can we really have? As suggested in the comments on the previous post: 1: public static string Join1<T>( this IEnumerable<T> items, string delimiter, Func<T,string> converter ) 2: { 3: return string.Join( delimiter, 4: items 5: .Select( converter ) 6: .Where( ...
Last time I was taking a look at SubSonic’s SimpleRepository functionality and wondering about the return value of the ‘Add<T>’ method. More specifically, I was wondering why the ‘object’ instance being returned was typed as a decimal rather than an int when the object I was persisting had a primary key field that is typed as an int. I had discovered that the while Add<T> was returning a decimal, it was also updating the primary key field (PostID on my Post class instance in this case) ...
In this Issue: AfricanGeek, Brian Genisio, Loek van den Ouweland, Victor Gaudioso, Jeremy Likness, CrocusGirl, Walt Ritscher, Rob Eisenberg, Andrea Boschin, Alan Mendelevich, and nmarun. Shoutout: The Microsoft Expression blog has a quick tip up: Paste or move a keyframe Adam Kinney gives us a Silverlight Developers Guide to PDC09 See the post below about Walt Ritscher's new ShaderGallery Add-in for Expression Blend, but he's also Seeking WPF pixel shader effects samples for ShaderGallery From SilverlightCream.com: ...
I’ve been spending some time lately digging into SubSonic 3 and have really enjoyed working with it so far. I love the how “low friction” it is to get up and running. I’ve been particularly impressed with the SimpleRepository in this regard. It definitely lives up to it’s name by providing truly simple data access functionality in a pretty sane and straightforward way. That said I don’t think it’s the best choice for every project, but if you don’t have to care much about the implementation details ...
I've been very frustrated with the lack of flexibility with wordpress.com hosted blogs, so I am yet again moving. This time I wanted to host my own instance of Subtext but discovered that geekswithblogs.net uses Subtext and figured I would give one last attempt to a hosted community online :) I guess I just don't want to deal with running my own server just for a blog. The most important thing I wanted back was Syntaxhighlighter which was about impossible to use with wordpress.com without paying ...
Thanks to everyone who attended my LINQ to SQL presentation at RockNUG last night. The code samples can be downloaded here: LINQ to SQL demo code. As a point of clarification from last night’s Q&A session after the presentation regarding using LINQ to SQL with true POCO classes that do not even have [Column] mapping attributes, you can have a class like this: 1: public class Contact 2: { 3: public int ID; 4: public string FirstName { get; set; } 5: public string LastName { get; set; } 6: public ...
Run FxCop as a post build event Since FxCop 1.36 it is possible to include FxCop in a post-build event. So FxCop runs after compiling in Visual Studio and allows you directly jumping to the warned line. Description of the command line In the sample above the command line is IF $(ConfigurationName) == Debug $(ProjectDir)..\..\..\..\to... /console /file:"$(TargetPath)" /directory:"$(ProjectDir)..... Interop Assemblies" /directory:"$(ProjectDir)..... ...
In a project that I completed a few years ago I had need to programatically zip an xml file for use as an email attachment. This specific implementation was a part of a BizTalk Adapter written in VB.Net, but the code library used to carry out the zip process was a freely available C# library that can be used in any .Net code for zipping purposes. The library used was called SharpZipLib. The .Net SharpZipLib library (formally NZipLib) supports Zip as well as GZip format and comes with C# source code ...
You remember the previous post on dynamic. We will today look into it in a bit more detail. Yeah, let's ILDASM it and try and identify what is going on under the hood. But for the context of the post let's look at a simpler tale. namespace Coderslog.Net4.Samples { public class SimpleDynamic { public void CallDoSomething() { var instance = GetDoSomething(); instance.DoSometing(); } private dynamic GetDoSomething() { return new BehaviourA(); } } } A very basic class, hmmm which roughly translates to ...
In this Issue: Michael Palermo, Rishi, Microsoft Expression Blog, Jeremy Likness, David Burela, and Ward Bell. Shoutout: Adam Kinney has a Photosynth linked that you won't believe: A Photosynth of Neil Gaiman’s Library From SilverlightCream.com: Silverlight and Internet Download Manager Michael Palermo has a solution to the use of the Internet Download Manager dorking up your Silverlight app. I Command MVVM On March 9, 2009, Rishi Posted I Command Silverlight, now he's posted I Command MVVM. With ...