Tag | .NET Posts

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. There are times when it is desirable to know who called the method or property you are currently executing. Some applications of this could include logging libraries, or possibly even something more advanced that may server up different objects depending on who ...
I know I’ve been a bit quiet on my blog lately. I’ve still been adjusting to my new life in Seattle and learning different technologies for my new job. It’s been a lot of fun, but has left me with precious little free time! That said, a few months ago I was invited to throw together some tutorials on Tech.Pro as part of their startup series, so I decided to give it a go. Their site has a nice collection of tutorials of various skill level ratings from several different authors. These were the tutorials ...
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. I have had the pleasure to program in a variety of programming languages throughout the years including the trifecta of C++, Java, and C#. It's often interesting how these three languages are so similar and yet have such key differences as well. Each of them has ...
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. Most of the time in C#, we implement interfaces implicitly. This is by far the simplest method and makes the method available both to consumers of the interface and the implementing type directly. There are times, though, when you may want to implement an interface, ...
Win32 API offers a lot of functionality for Windows platform, which the .NET Framework doesn’t have for good reason – One of them being ‘managed’. However, that doesn’t stop us from doing some unsafe things! We can always build a wrapper for Win32 API and then call those functions directly from .NET. Let us evaluate one of such area which requires calling Win32 API functions from .NET. That area is ‘Simulating UI Automation’. Of course, the subject is too vast to fit in a single blog post, however, ...
If you’re familiar with NetSqlAzMan or CanCan, you know that checking permissions based on a user’s activities is easier to manage and more flexible that working with the roles a user is in. Whatever method you take to add activity based authorization, if you are working in MVC you will run into the issue that AuthorizeAttribute only cares about Users and Roles. The good news is that you can inherit from AuthorizeAttribute and easily adapt it to account for activity-based authorization. If you didn’t ...
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. Many times in software development, we want to invoke several processes at one time and continue when we get all the results back. Obviously, if we were needing to process a sequence of items in a similar matter, we could use PLINQ. Unfortunately, when the things ...
Once again, in this series of posts I look at features of Visual Studio that may seem trivial, but can help improve your efficiency as a developer. The index of all my past little wonders posts can be found here. Well, my friends, this post will be a bit short because I’m in the middle of a bit of a move at the moment. But, that said, I didn’t want to let the blog go completely silent this week, so I decided to add another Little Wonder to the list for the Visual Studio IDE. How often have you wanted ...
So this week I decided I’d do a Little Wonder of a different kind and focus on an underused IDE improvement: Visual Studio’s Box Selection capability. This is a handy feature that many people still don’t realize was made available in Visual Studio 2010 (and beyond). True, there have been other editors in the past with this capability, but now that it’s fully part of Visual Studio we can enjoy it’s goodness from within our own IDE. So, for those of you who don’t know what box selection is and what ...
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. Today’s little wonder is another of those small items that can help a lot in certain situations, especially when writing generics. In particular, it is useful in determining what the default value of a given type would be. The Problem: what’s the default value ...
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. Often times in our code we deal with the bigger classes and types in the BCL, and occasionally forgot that there are some nice methods on the primitive types as well. Today we will discuss some of the handy static methods that exist on the char (the C# alias of ...
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. When I started the “Little Wonders” series, I really wanted to pay homage to parts of the .NET Framework that are often small but can help in big ways. The item I have to discuss today really is a very small item in the .NET BCL, but once again I feel it can help ...
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. Two posts ago, I discussed the Interlocked Add(), Increment(), and Decrement() methods (here) for adding and subtracting values in a thread-safe, lightweight manner. Then, last post I talked about the Interlocked Read() and Exchange() methods (here) for safely ...
Assembly is the smallest unit of deployment in .NET Framework. When you compile your C# code, it will get converted into a managed module. A managed module is a standard EXE or DLL. This managed module will have the IL (Microsoft Intermediate Language) code and the metadata. Apart from this it will also have header information. The following table describes parts of a managed module. Part Description PE Header PE32 Header for 32-bit PE32+ Header for 64-bit This is a standard Windows PE header which ...
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. Last time we discussed the Interlocked class and its Add(), Increment(), and Decrement() methods which are all useful for updating a value atomically by adding (or subtracting). However, this begs the question of how do we set and read those values atomically as ...
I have been following the events at X-tensive.com and excited by the release of DataObjects.Net community license and new features in version 4.5.4. I have always had a sweet spot on DataObjects.Net, mainly because of the clean architecture and features that the product has. Now my mind is getting blown away by features that I never thought may be possible in an ORM. Over the past few months the DataObjects.Net community started working on plugins that would extend the functionality of DataObjects.Net. ...
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. Often times, we need to update a count in a multi-threaded program. This may be an incrementing, decrementing, or adding a value in a thread-safe manner. This post will discuss one of the lightest ways to do this: the Interlocked class. Problem: Increments Are ...
Here are the slides for my three presentations this year for the St. Louis Days of .NET 2012. Enjoy them and feel free to share them as you see fit! If you enjoy these presentations, please check out the entire index of my C# Little Wonders, Little Pitfalls, and Fundamentals blog posts which can be found here. Update: Source has been updated to include Saturday’s presentations as well, also added more comments. Also, each of the presentations will have a small pool ball in the lower right hand corner ...
Today is the kickoff for the St. Louis Days of .NET! Today begins the pre-compiler sessions for those who are interested followed by the kick-off gathering at the Bottleneck Blues Bar at the St. Charles Ameristar Casino.This is the 5th year for this conference, and the 3rd year I've been fortunate enough to speak at it. I'll be giving my three talks at the following times (yes, the More Little Wonders is repeated):Friday @ 10:30 - "Little Wonders of .NET"Friday @ 2:50 - "More Little Wonders of .NET"Saturday ...
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. There are many times in .NET where we have an instance of a value type that we need to treat as optional. That is, we may want to consider its value as being supplied or missing. The System.Nullable<T> structure in the .NET Framework can be used to represent ...
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. In the .NET 3 Framework, Microsoft introduced the concept of anonymous types, which provide a way to create a quick, compiler-generated types at the point of instantiation. These may seem trivial, but are very handy for concisely creating lightweight, strongly-typed ...
I, like many, was disappointed when I heard that Reflector 7 was not free, and perhaps that’s why I waited so long to try it and just kept using my version 6 (which continues to be free). But though I resisted for so long, I longed for the better features that were being developed, and began to wonder if I should upgrade. Thus, I began to look into the features being offered in Reflector 7.5 to see what was new. Multiple Editions Reflector 7.5 comes in three flavors, each building on the features ...
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. We’ve seen how the Select() extension method lets you project a sequence from one type to a new type which is handy for getting just parts of items, or building new items. But what happens when the items in the sequence are already the type you want, but the sequence ...
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. We’ve talked about the Select() and Where() LINQ extension methods before. The Select() method lets you project from the source type to a new type, and the Where() method lets you filter the list of items to the ones you are interested in. Most people know of these ...
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. So last week we covered the Enumerable.Range() method in the System.Linq namespace, which gives us a handy way to generate a sequence of integers to either use directly, or to feed into a more complex expression. Today we’re going to look at another static method ...
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. Thanks for all of your patience while I’ve been dealing with other matters these last few weeks. I didn’t want to let my post slide a third week, so I decided to say a few words about a small static method in the Enumerable class from System.Linq. Using Range() ...
I recently created a DLL and I wanted to reference it from a project I was developing in Visual Studio. In previous versions of Windows, doing so was simply a matter of dropping the DLL file in the C:\Windows\assembly folder. That would add the DLL to the Global Assembly Cache (GAC) and make it accessible in Visual Studio. However, as is often the case, Window 7 is different. Even if you have Administrator privileges on your machine, you still do not have permission to drop a file in the assembly ...
Good things are hard to kill. One of the most useful predefined compiler macros in C/C++ were __FILE__ and __LINE__ which do expand to the compilation units file name and line number where this value is encountered by the compiler. After 4.5 versions of .NET we are on par with C/C++ again. It is of course not a simple compiler expandable macro it is an attribute but it does serve exactly the same purpose. Now we do get CallerLineNumberAttribute == __LINE__ CallerFilePathAttribute == __FILE__ CallerMemberNameAttribute ...
This is first in series of articles about project I've been building in my spare time since last Summer. Actually it all began when I was researching a topic of modeling human motion kinematics in order to create gesture recognition library for Kinect. This ties heavily into motion theory of robotic manipulators so I also glanced at some designs of robotic arms. Somehow I stumbled upon this cool looking open source robotic arm: It was featured on Thingiverse and published by user jjshortcut (Jan-Jaap). ...
For those out there that are interested… I am now one of the hosts of the Driven2Distraction podcast. Being a fan of podcasts like .Net Rocks and Hanselminutes for years now, I have always wanted to be involved in the recording of a podcast and now that time has finally come. What makes the Driven2Distraction podcast different from all the others out there is its uniquely South African flair. It’s focus is towards Software Development in the Southern Africa – and has a mix of “what happening locally” ...
Just a small tidbit that's sprung up today. I had to book-keep and emit diagnostics for the average thread performance in a highly-threaded code over a period of last X number of calls and no more. Need of the day: a thread-safe, self-managing stats container. Since .NET 4.0 introduced new thread-safe 'Collections.Concurrent' objects and I've been using them frequently - the one in particular seemed like a good fit for storing each threads' performance data - ConcurrentQueue. But I wanted to store ...
Have you ever had the need to implement a 3rd party JavaScript plugin, but your needs didn’t fit the model and usage defined by the API or documentation of the plugin? Recently I ran into this issue when I was trying to implement a web snapshot plugin into our site. To use their plugin, you had to include a script tag to the plugin on their server with an API key. The second part of the usage was to include a <script> tag around a function call wherever you wanted a snapshot to appear. The ...
The Microsoft Press half price deal of the day at http://shop.oreilly.com/pro... is the training material for the MCTS Self-Paced Training Kit (Exam 70-516) "Accessing Data with Microsoft® .NET Framework 4""EXAM PREP GUIDE Ace your preparation for the skills measured by MCTS Exam 70-516—and on the job—with this official Microsoft study guide. Work at your own pace through a series of lessons and reviews that fully cover each exam objective. Then, reinforce and apply what you’ve ...
Node.js is a server-side JavaScript platform "for easily building fast, scalable network applications". It's built on Google's V8 JavaScript engine and uses an (almost) entirely async event-driven processing model, running in a single thread. If you're new to Node and your reaction is "why would I want to run JavaScript on the server side?", this is the headline answer: in 150 lines of JavaScript you can build a Node.js app which works as an accelerator for WCF REST services*. It can double your ...
Introduction I’m currently working on broadening the content in the Windows Azure Service Bus Developer Guide. One of the features I have been looking at over the past week is the support for transactional messaging. When using the direct programming model and the WCF interface some, but not all, messaging operations can participate in transactions. This allows developers to improve the reliability of messaging systems. There are some limitations in the transactional model, transactions can only ...
Hey everyone, I just discovered this great post yesterday that shows how to have msbuild build projects in parallel Basically all you need to do is… Read more at http://blog.danskingdom.com... ...
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. I’ve covered many valuable methods from System.Linq class library before, so you already know it’s packed with extension-method goodness. Today I’d like to cover two small families I’ve neglected to mention before: Skip() and Take(). While these methods seem so ...
For the last decade, I have repeatedly, in my imitable Microsoft fan boy style, offered an alternative view to commonly held beliefs about Microsoft's stance on open source licensing. In earlier times, leading figures in Microsoft were very vocal in resisting the idea that commercial licensing is outmoded or morally reprehensible. Many people interpreted this as all-out corporate opposition to open source licensing. I never read it that way. It is true that I've met individual employees of Microsoft ...
So, day 1 of DevWeek. Lots and lots of Windows 8 and WinRT, as you would expect. The keynote had some actual content in it, fleshed out some of the details of how your apps linked into the Metro infrastructure, and confirmed that there would indeed be an enterprise version of the app store available for Metro apps.) However, that's, not what I want to focus this post on. What I do want to focus on is this: Windows 8 does not make .NET developers obsolete. Phew! .NET in the New Ecosystem In all the ...
Financial Apps feel the need for speed – this can come via parallelization, and via infrastructure - fast messaging and non-blocking distributed memory management. This blogpost gives an overview + examples of various technologies that can squeeze performance out of your trading apps and clock cycles out of your modeling apps. Low Latency via Infrastructure ZeroMQ · ZeroMQ is a messaging library - ‘messaging middleware’ , ‘TCP on steroids’ , ‘new layer on the networking stack’. not a complete messaging ...
Unlike the other concurrent collections, ConcurrentBag does not really have a non-concurrent analogy. As stated in the MSDN documentation, ConcurrentBag is optimised for the situation where the same thread is both producing and consuming items from the collection. We'll see how this is the case as we take a closer look. Again, I recommend you have ConcurrentBag open in a decompiler for reference. Thread Statics ConcurrentBag makes heavy use of thread statics - static variables marked with ThreadStaticAttribute. ...
For those interested, myself and a few other people from Red Gate will be going to DevWeek 2012 in London this week. I'll be mostly around the .NET and C# talks, but may drop into the architecture and agile talks as well. I'll be blogging interesting stuff I come across as well. If you want to meet up, do feel free to contact me via the blog or on twitter at @simonmcooper. See you there!Cross posted from Simple Talk ...
In our last post I demonstrated how to implement the datagram channel shape, and in the second and third post I described the request reply shape. In this post I will explain the last MEP in WCF, duplex, which is the most complex one. Basis of the Duplex Channel Shape (MEP) In the MSDN document it said that “The duplex MEP allows an arbitrary number of messages to be sent by a client and received in any order. The duplex MEP is like a phone conversation, where each word being spoken is a message. ...
In the previous post I demonstrated how to implement a very basic transport extension over an in memory message bus that supports request reply MEP. At the end of that post I created a console application and establish the service and client directly through the channel listener (on the server side) and the channel factory (on the client side). But this is not the WCF usage that we are familiar with. If you have been using the WCF for a while the common pattern is to create a ServiceHost on the server ...
Cloud computing gives us more flexibility on the computing resource, we can provision and deploy an application or service with multiple instances over multiple machines. With the increment of the service instances, how to balance the incoming message and workload would become a new challenge. Currently there are two approaches we can use to pass the incoming messages to the service instances, I would like call them dispatcher mode and pulling mode. Dispatcher Mode The dispatcher mode introduces ...
This post is continued HERE. Go to Part 1 – List of Product Updates for information on Visual Studio and TFS 2012 updates Looking for the VS 2010 extensions ? Go to Visual Studio 2010 - List of Product Updates (Part 1) + Extensions (Part 2). Looking for links to the test adapters, go to this blog post. UPDATE Aug 18th 2013: Updates: Visual Studio Tools for Git, TypeScript, ReSharper, TFS Power Tools, Code Contracts, Build Manager, Web Essentials, Code Contracts, tangible T4 editor , Just Decompile, ...
I have seen many Sharepoint Newbies cracking their head to create a Console/Windows application in VS2010 and make it talk to Sharepoint 2010 Server. I had the same problem when i started with Sharepoint in the begining. It is important for you to acknowledge that SharePoint 2010 is based on .NET Framework version 3.5 and not version 4.0. In VS 2010 when you create a Console/Windows application, Make Sure you select .Net Framework 3.5 in the New Project Dialog Window.If you have missed while creating ...
Today's $10 Deal of the Day from APress at http://www.apress.com/97814... is Pro Agile .NET Development with SCRUM."Pro Agile .NET Development with SCRUM guides you through a real-world ASP.NET project and shows how agile methodology is put into practice." ...
The beta for BIDS Helper 1.6 was just released. We have not updated the version notification just yet as we would like to get some feedback on people's experiences with the SQL 2012 version. So if you are using SQL 2012, go grab it and let us know how you go (you can post a comment on this blog post or on the BIDS Helper site itself). This is the first release that supports SQL 2012 and consequently also the first release that runs in Visual Studio 2010. A big thanks to Greg Galloway for doing the ...
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. Today I’m giving a brief beginner’s guide to LINQ and Lambdas at the St. Louis .NET User’s Group so I thought I’d post the presentation here as well. I updated the presentation a bit as well as added some notes on the query syntax. Enjoy! The C#/.NET Fundaments: ...