Tag | C# Posts

This morning, Channel 9 launched the new Channel 9 Learning Center. From Channel 9, here’s a description of what the Learning Center is: “The Channel 9 Learning Center is the destination for free technical training on emerging Microsoft products and technologies. The Learning Center consists of a set of courses with each course including a set of videos, hands-on labs, and source code samples to get you up-to-speed quickly.” I’m pleased to say that Visual Studio 2010 is one of the first Training ...

Just going through some function programming comcepts in .Net .Don't wonder how we have this in .Net. Its there from VS2008(.Net 3.5) . I checked this blog post and its very intersting.

F# Programming Concepts and Difference with C#

Thanks,

Thani

In our team we have developers with Visual Studio 2005 and 2008. Often we have projects which must be coded by a mixed team. Visual Studio 2005 and 2008 compatibility for project-files Normally this is no problem because adding projects in Visual Studio 2005 and manually introducing the ToolsVersion="2.0" attribut in the new csproj-file allows an coexisting working when using two sln-files for Visual Studio 2005 and 2008. We name the sln-files normaly <solution>.2005.sln and <solution>.2008.sln. ...
Javascript Intellisense I read this interesting artilce when trying to enable intellisense for my Javascript file. Don miss this as its very useful. Its similar to what we do for VB or C# for intellisense i.e XML documentation. Same concept applies for JavaScript also. This will work in Visual Studio 2008 as there is an enahncement for this. Thanks, Thani ...
More Adventures in MVVM I have been taking a few weeks off from my personal studies/experiments in the .Net space to learn more about Ruby and Ruby on Rails (RoR). I have two main goals for this study: Get to know another platform as an option for future development Examine how I can incorporate different concepts into my existing framework What follows is intended to document my experimentation with the second bullet: How might we design a ViewModel if we were in Rails? My thoughts on this are still ...
Wow, this looks like a fantastic learning resource for coming up to speed with Visual Studio 2010 Beta 2. Yeah, I’m lazy and just grabbed the following text from the Visual Studio 2010 and .NET Framework 4 Training Kit page: “The Visual Studio 2010 and .NET Framework 4 Training Kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize the Visual Studio 2010 features and a variety of framework technologies including: C# 4.0 Visual Basic 10 F# Parallel ...
The Beta 2 version of DPE’s Visual Studio 2010 Training Kit is now live (you can find it at http://tinyurl.com/Beta2Tra... A training kit includes presentations, hands-on labs, and demos. This content is designed to help you learn how to utilize a variety of Visual Studio 2010 and .NET Framework 4 technologies. The Beta 2 release of the Training Kit contains 15 presentations, 19 hands-on labs, and 13 demos. Many technologies are covered in this release, including: C# 4, VB 10, F#, Parallel Extensions, ...
It’s been a while since I’ve blogged since things have been crazy busy. I finally decided to kick myself and do a post so without further ado, the problem at hand: A co-worker of mine asked me whether its possible to dynamically create a type from some data he is receiving from a WCF service (over HTTP). My natural response was, why would you need to do that since Visual Studio creates a proxy from the metadata exposed by the service and the return types would typically be DataContracts. Well, it ...
I recently needed to un-gzip (gUnzip?) a large amount of files programatically and eventually ended up with the class/library posted below. With the GZipStream (.NET / dot net), I had seen a lot of examples compressing and decompressing strings in memory, but I needed the straight-forward, simple method of just compressing and inflating/decompressing a file (in the simplest manner). I made the buffer size modifiable to allow you to customize the amount of RAM needed for the process. In all of this, ...
When trying to generate an ASP.NET proxy class from a physical wsdl on your local file system, you're probably doing something like this: wsdl.exe MySevice.wsdl /o:Proxy.cs /l:CS You'd expect a file named Proxy.cs to get created in C# for you. You'd be right, except if you're attempting to generate proxy for a service that uses complex types. If that is the case, you'll get an error that looks a lot like this: Error: Unable to import binding 'MyBinding' from namespace 'http://www.example.org/MyN... ...
UPDATE: Please see first comment to do this the "safe" way... It took a bit for me to get comfortable enough with LINQ-to-objects to write ‘queries’ off the top of my head…but once you’re used to it you realize it’s much more concise, easier to interpret/read, and well..it’s less code. Here are some real quick examples… This first example selects the string array value as well as its position from the someItems array. Note, the user of new{} creates a new generic type that has the properties ItemName ...
Recently I had the need to implement support for Dynamic Linq queries in my framework project. For the uninitiated, Dynamic Linq allows me to write statements like this: var query = db.Customers.Where("City == @0 and Orders.Count >= @1", "London", 10). OrderBy("CompanyName"). Select("New(CompanyName as Name, Phone)"); where I can specify the predicates and selectors as string values. Microsoft has published a helper class that enables DynamicLinq support here -->C# Dynamic Query Library (included ...
This example shows how to move multiple rows between GridViews. The main idea here is to use a CheckBox control for selecting the rows to be removed from one GridView to another and vise versa. Take a look at sample screen shots below: On initial load: Selecting rows from the left GridView: After Moving the selected rows to the right GridView: As you notice the selected rows are automatically sorted by its ID upon moving. Selecting rows from the Right GridView: After Moving the selected rows to the ...
I recently had the need to set the output path of the log files at runtime in log4net. For some reason up until now I had never attempted to accomplish this. As corporate permissions are more and more restrictive I found the need to set the FileAppender.File path at runtime to a location within the users profile. It turns out accomplishing this task is quite simple. public static void Initialize(string logDirectory) { //get the current logging repository for this application ILoggerRepository repository ...
As a VB MVP and someone who really loves VB in general, this kind of news really makes me smile… Microsoft has heard your feedback that VB/C# content parity is a top priority for the VB community. Given that, this issue has become a top priority for the languages team. The Approach We’ve gone about a prioritized approach, in order to fill holes for the most important technologies and content types first. Here are some general guidelines we’ve used… Technologies are prioritized by the number of current ...
Doug Turnure has recently provided a lot more content to .NET University. .NET University is a site where user groups (or individuals) can download presentations, complete with spiffy slide decks and demos/labs. There are now over 40 downloads (both C# and VB.NET - Yay!) RV.NUG used .NET U back when .NET 3.0 was first released. We found the slides and demos were both excellent. (You can even see us on the alumnus page on .NET U!) This resource provides many opportunities to user groups. Here's my ...
Over the years, I have met many user group leaders (and been one myself a few times) and I often hear this question, or a variation of it... "I'm in a pinch, I can't find a speaker, I've got a new guy who wants to try speaking... Where can I get already prepared presentation materials to use at code camps and user group meetings?" Well... I am thrilled to announce that Doug Turnure from the Microsoft Marketing team has been leading an effort to compile these materials. He’s made about 40 presentations ...
As a freelancer who is constantly selling his skills on the free market, I always have to be up to date and keep myself informed about the latest technologies - in a more cursory way to know what options are available in a certain situation, or more in-depth if I am actually working with a specific technology. Although you can go overboard with trying to stay on top of the IT industries' evolution (I talked about that in a previous post), I simply consider continuous learning to be a natural part ...
Mono Addins Windows Forms Application Sample - Part 1 One new framework I came across recently is: Mono Addins. I have the need for a framework that will allow me to easily build extensible applications, whether they be Windows, ASP.NET or VisualWebGUI application(s).
SharePoint has been around for quite some time. I first worked with it in its original version in 2001. And so began a love hate relationship that has lasted these many years. Recently I have been spending a significant amount of time writing custom web parts. Below are a number of notes I have accumulated while rediscovering what SharePoint can do. I don’t claim that these are best practices, only that they have worked for me. Environment General Creating web parts for WSS 3.0 or MOSS 2007 requires ...
Thanks to everyone who attended my sessions yesterday at Richmond Code Camp. Both the code and PowerPoint slides are available for download. Download samples for: MVC in the Real World. Check out the readme.txt file in Solution Items and all SQL scripts for creating the databases. Download samples for: C# 4.0 New Language Features. I had several questions about some of the tools I was using during the presentations (all of which are free). For the zooming and highlighting, I was using a tool called ...
What is a good code and how can we write a more object oriented code? Sometimes I heard my team members complaining about the quality of code which I wrote, so I started a search for some instructions about “What is a good code?” I went through “Agile Priniciples, Patterns and Practices in C# by Robert C. Martin”, “Refactoring by Martin Fowler” and “Head first Design Patterns from O’Reilly press” and found some useful tips. So before going through those tips, let’s start with what is bad code? The ...
Every now and again you may come across an error when trying to update a database from a data driven control (i.e. gridview, formview) that is tied to a SQL or Object data source. The errors usually are along the lines of “Could not find xxx that has parameters” along with a list of those parameters. Or an error that states there are too many parameters being passed. Aside from looking for typos, counting or lining up the parameters I will use one of these techniques to try and narrow down what may ...
Here’s a great list of new Azure and cloud related projects on CodePlex. All of these are very helpful tools. Client Cloud Services, Client Cloud Services (CCS) is a set of Windows Azure-based services which help application developers integrate licensing, trial management, feedback, error reporting and product usage into their applications Azure Storage Manager, Azure Storage Manager helps you organize your Azure Storage Accounts and to modify data on them. It is written in C# 3.5 and has no other ...
Windows Embedded CE 6.0 R3 has been released yesterday, you can download it from here: http://www.microsoft.com/do... One of the most exciting new features of R3 is Silverlight for Windows Embedded. With this technology the UI of an application can be described using XAML, an XML-based language, and can be designed using visual tools like Expression Blend. This will allow UI designers to work on embedded devices using ...
I just found out today that I was awarded the MVP designation from Microsoft in the area of ASP.NET. It has been a very busy 2009 for me, speaking at various user groups and code camps including CMAP, CapArea, RockNUG, SoMDNUG, FredNUG, and Richmond Code Camp. I would like to thank all of those user groups for having me present and I look forward to continuing my involvement with all of those user groups and more in the year to come. With .NET 4.0 and the 2010 wave just around the corner, the upcoming ...
[Source: http://geekswithblogs.net/E... For a forthcoming celebration, I've been working on a jukebox web application: The client controls the music being played on the server, so its intended for local networks where you want shared control of a central music player. If you can find a use for it, help yourself – it's on CodePlex here: The People's Jukebox. If nothing else it's a straightforward example of a Silverlight 2.0 client talking to WCF REST services, in what's probably a familiar ...
I've been trying to sharpen my blunt mathematical brain by solving some of the problems on Project Euler. Prime numbers figure in a few of the questions, so here's a bit of C#/LINQ goodness for generating them up to 100: Enumerable.Range(2, 100 - 2).Where(i => Enumerable.Range(2, (int)Math.Sqrt(i)).All((j) => i == 2 || i % j != 0)).ToList().ForEach(Consol... ...
Muljadi Budiman was the top-rated speaker at the recent St. Louis Day of .NET event, and it’s easy to see why. His presentations are energetic, humorous, and packed with useful information. At tonight’s St. Louis .NET User Group meeting, he zipped through an overview of Visual Studio 2010 and 4.0 features of C#, VB, WPF, the CLR and the DLR in a little over 90 minutes. Highlights included: VS2010: multi-monitor support Call Hierarchy visualizer “Navigate To” improvements “Consume-First Development” ...
At first sight, StreamInsight doesn’t appear to offer any support for dynamic queries. Once you have got over the initial ‘wow’ factor of creating continuous queries over streams using LINQ, rather than some SQL dialect or specialised DSL, the reality hits you that your query is just code. You wrote the LINQ using C# or VB.NET, and you ended up compiling it into some assembly. That’s all very well, but it’s not very flexible. How are you going to store and manage your queries in a repository so that ...
Martijn Boland recently blogged about his first adventures with a new contract using EF. He compares notes with the original Vote of No Confidence and realizes the fears from back then were right on the money. The thing that totally blows me away is one of the comments to his post:EF might not have tons of features, but from what I’ve read lately,performance is not one of its weaknesses, specially when compared toNHibernate, am I missing something?Here we go again... I heard NH doesn't perform well, ...
I needed to get a pop-up window to come up in ASP.Net. Now while JavaScript happily does this (with the alert(); function ASP.Net does not. So I needed to work out how to do it. Another wrinkle in this comes from Ajax. None of the JavaScript code seemed to work when placed in an AJAX page. As I have now been tasked with changing this code and moving from the Anthem Ajax library to a pure MS solution it was time for this died in the wool VB/C# developer to get his head around getting these scripts ...
I live in a great neighborhood and am fortunate to have some great neighbors. Two of these neighbors (a husband and a wife actually) are retired math instructors and we always have a good time having a glass of wine and discussing why the methods our schools use to teach our children math are totally antiquated and backwards. Well yesterday I found both retired instructors at home scribbling madly on paper trying to solve a math problem which was supposedly intended for 6th to 12th graders (as both ...
Problem Statement: To Evaluate a complex expression in dotnet and show the result to end users. The expression could be something like this X2 +Y3+Log10 (z) . Solution: There are different ways to solve the problem stated above. Am planning to show how to use Scripting Engines like Jscript/VBScript inside C#. We can make use of Windows Script Control to achieve this. Windows Script control can be downloaded from MSDN site. It is shipped as an Activex control which lets you make use of JavaScript ...
C# in Depth is not for beginners. It assumes a working knowledge of C# 1.0, and is not so much a tutorial of C# 2 and 3 features as an in-depth examination of how and why they work. I don’t think I learned anything I didn’t know about using generics, extension methods, delegates, anonymous methods and lambdas, but Skeet does a great job of zooming in on the inner workings of each of these features, building up to the big picture of how they all snap together to make the game-changing programming ...
In our Workflow application it was created a lot of Workflow level Dependency properties that was used to interchange data between different activities. Workflow.PropertyA= Activity1.PropertyA Activity2.PropertyA=Workflo... We believed that is a safe way to avoid concurrency problems. But it was WRONG. Article ActivityExecutionContext in Workflows explains, that Workflow properties as a shared data between activities is not a safe method and can cause concurrency errors in case of CAG or ...
Usually, I'm not what you would call an early bird. That's why I have read about the new dynamic keyword in C# 4.0 only now. To say it clear: I was horrified. My first intuition was to write an FxCop rule to blame all its usages in the analyzed code. Instead, I wrote this post, which is basically a rant against dynamic - simply because writing a post is much quicker and I felt the urgent need to express my opinion on this, but I'm still thinking about the FxCop thing... The basic fact is in short, ...
Like many ASP.NET developers, I’ve gotten by for years knowing just enough JavaScript to get by. I’ve spent many frustrating hours cursing the language, when the problem was not really JavaScript (although it has more than its share of weirdness), but my assumption that I knew how it worked, just because it looks like C#. Now, thanks in large part to jQuery, I actually enjoy client-side programming. jQuery makes things so much easier (replacing dozens of lines of code that I painstakingly figured ...
ASP.NET MVC Reports in ASP.NET MVC Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth Microsoft Chart Controls to PDF with iTextSharp and ASP.NET MVC Setting Up ASP.NET MVC with NUnit for Visual Studio 2008 Standard Edition ASP.NET MVC ExtJS using LINQ Using ExtJS Grid with ASP.NET Ajax WCF WebServices & C# How To Get Started With Selenium Core And ASP.NET MVC ASP.NET MVC Cheat Sheets ASP.NET How to Implement Trackback Handler in ASP.NET How to Implement Pingback Handler in ...
I just got done reading "Effective REST Services via .NET" by Kenn Scribner and Scott Seely. ISBN-13: 978-0-321-6125-7 I've been hearing a lot about restful services and have absorbed the basics by osmosis but always like to read a book to cement the ideas more clearly. This book does a good job of that but goes a few steps further. A few things I particularly liked were: - Review of http and how the internet works, things I don't pay much attention to any more! - While presenting "pure" restful ...
DynamicWrapper project on CodePlex Edit: DynamicWrapper does not work in SIlverlight as I first though. My unit tests passed, but in runtime I get an exception when I try to use the class. I will be looking at some alternatives. Over the past few weeks, I have been working on a utility that I have wanted for years: something that allows me to apply an interface to an object that matches the contract but doesn’t actually implement the interface. In other words, I’ve wanted duck typing in C#. The code ...
I was having an discussion with my wife on things to come in computer software and silverlight. below is a brief snippet: My wife holds an computer engineering degree and is passionate about new innovations. She is a prolific programmer though she ONLY codes when she feels like(or finds a problem worth her attention) and thus is NOT a regular coder like mortals like me who are ... well, just coders, who codes for money:D Wife: What is this buzz around Silverlight? Subodh: Because we need smarter ...
Databinding in SL and WPF are interesting concepts and once mastered really solves many a issues with cleaner code. In XAML everything is dataaware. Elements can be bound to data from a variety of data sources in the form of common language runtime (CLR) objects and XML. In this post we will discuss about Simple CLR Object binding using code Simple CLR Binding using XAML only – Demo value converters Control Binding – Slider and textbox Implementing IValueConverter Validation Update Source Trigger ...
I presented “What's new in silverlight 3.0” at Teched, Delhi on roads and got overwhelming response for it. Actually there was two events. The venue for the first event was Microsoft office, Gurgaon, Delhi. I must admit i had to change gears because most of the attendees were new to “Silverlight” itself; and i was introducing them to Silverlight 3.0 version!! So i was back to questions like Why Silverlight? What silverlight means to Developer Architect Manager End user It did generated lots of interest ...
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, ...
Thanks to Ray and Gavin for organising another top EdgeUG meeting in Microsoft Cardinal Place and for everyone who attended my talk on Hyper-V for Developers. The audience had to deal with a huge amount of technical information that I crammed into the hour - hopefully it didn't put them off their pizza. Fortunately the Stack Overflow master and author of C# in Depth, Jon Skeet, was on hand after the break for a interesting glimpse into code contracts coming with VS2010 and C# 4.0. For those who weren't ...
If you have ever wondered why your .net application has a slow startup performance you normally start watching with Process Explorer at your processes. But this will not always give you the full picture since it can loose some csc.exe calls because if you have a fast machine it will not get them. A more reliable tool is Procmon where you can look for process starts: Where do these compiler invocations come from? It turns out that XmlSerializer is to blame which generates a C# file in your TEMP folder, ...
Really no magic here and just a simple add on to my previous post just in case you need something that can easily copy the contents of a given directory to another location. public static void CopyContentsTo(this DirectoryInfo source, string desinationDirectory) { if (string.IsNullOrEmpty(desin... { throw new ArgumentNullException("root... } if (!Directory.Exists(desinati... { Directory.CreateDirectory(d... } foreach (string file in Directory.GetFiles(source.F... ...
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 ...