Technical Articles by Paul D. Sheriff

Over the years I have written hundreds of articles for many different magazines. I write mostly on C#, .NET, MVC, WPF, Angular, JavaScript, jQuery, HTML, CSS, SQL Server, and other technologies.

How to Find Samples

The sample code for each article can either be found at the magazine website or on my Github page. The file name on the github site is the 'title' of the article with underscores replacing spaces. If you have problems finding a sample, feel free to email me.


All Articles - Descending Date Order
# Articles: 93

In this article, you're going to learn the many ways to serialize and deserialize C# objects to and from memory and disk. Along the way, you're going to create some classes with extension methods to simplify the serialization process.
In this article you are going to learn how to read and write XML files using C# and .NET Core. There are a few minor differences from the .NET Framework classes you used before. The .NET Core XML processing has been greatly optimized and processes XML files much faster than the .NET Framework. In this article you learn to create XML document in memory, save and load XML files from disk. You also see how to use LINQ to XML for processing XML nodes including sorting, filtering, and aggregation.
In the last two parts of this article series, you created a web server using Node.js, Express, and JavaScript. You built a series of API routes to retrieve an array of products and a single product, searched for a set of products, and added, edited, and deleted products. The product data was retrieved from a connection to a SQL Server database. In this article, part three of the series, you'll build a website using Node.js and Express to serve web pages. You're going to see how to use a templating engine, Mustache, to create dynamic web pages from the data retrieved from API calls. To communicate from your website to your Web API server, you must configure cross-domain resource sharing (CORS). You'll see how to enable CORS in your Web API project. You'll then build a set of search, add, edit, and delete pages that make calls to your Web APIs.
In Part 1 of this article series, you created a web server using Node.js, Express, and JavaScript. You built a series of API routes used to retrieve an array of product objects, search for a single object or a set of objects, and add, edit, and delete objects. In this article, you'll move some of the hard-coded values from the code into a configuration file and read those settings into your application. You're going to add middleware functions to handle exceptions. You're going to write different types of errors to different locations, such as to the console and to a file. Thus far, the set of product data coming from the API calls has been from a JSON file. In this article, you'll learn to retrieve the same data, but from a SQL Server table.
Many developers use JavaScript to add client-side functionality to their web pages. JavaScript can be used to create server-side web pages and Web APIs too. In this three-part article series, you're introduced to Node.js and Express and you'll learn their roles in the creation of a web server. You're going to build a new web server from scratch, create some routes to return data, and learn how to modularize your web application. You'll be guided step-by-step to creating a set of APIs to return an array of objects or a single object, search for a set of objects, and add, edit, and delete objects. If you've never used Node.js or Express to build a server, don't worry: this article has everything you need to learn the basics of working with these two powerful tools.
In this article you learn how to use the GetSchema() method on the DbConnection class to retrieve tables, views, columns, index, stored procedures and more from any database system. This method is implemented by each data provider to retrieve schema information in a generic fashion. What do you do with this information? You can present column names to your user to let them select columns to filter on for a report. You can use it to build your own code generator. You can even use it to create a SQL comparison tool. Read and follow along with this article to see how easy it is to use GetShema() to accomplish these various tasks.
Data annotations are not only for use in ASP.NET web applications. Any type of .NET application can use data annotations for validating data. It only takes about 10 lines of code to programmatically validate data annotations attached to entity classes. There are many built-in data annotations supplied by Microsoft that can validate your data quickly and it's easy to create your own data annotation attributes to apply to your entity classes. If you have some very specific validation needs, you may implement the IValidatableObject interface for your entity classes. If you're developing multilingual applications, you can even move your error messages into resources and specify the name of those resources on each of your attributes.
In the last two articles (Simplifying ADO.NET Code in .NET Core: Part 1 and Part 2), you learned how to retrieve data using a set of wrapper classes around ADO.NET. The code you wrote was about the same lines of code you might write when using the Entity Framework. In this article, you're going to build the appropriate methods to modify data in a table, perform transactions, validate data using data annotations, and add exception handling.
In the last article (Simplifying ADO.NET Code in .NET Core: Part 1), you wrote code to simplify ADO.NET and map columns to properties in a class just like ORMs such as the Entity Framework do. You learned to use reflection to make creating a collection of entity objects from a data reader and take advantage of attributes such as [Column] and [NotMapped]. In this article, you're going to refactor the code further to make it even more generic. In addition, you'll learn to get data from a view, get a scalar value, handle multiple result sets, and call stored procedures.
When developers think of how to access data, many use the Entity Framework (EF), Dapper, NHibernate, or some other object-relational mapper (ORM). Each of these ORMs use ADO.NET to submit their SQL queries to the backend database. So, why do many developers use ORMs instead of just using ADO.NET directly? Simply put, ORMs allow you to write less code. If each of these ORMs are simply wrappers around ADO.NET, can't you write your own wrapper to cut down the amount of code you need to write? Absolutely! This series of articles shows you how to create a set of reusable wrapper classes to make it simpler to work with ADO.NET in .NET Core.
It's very easy to get started using Minimal Web APIs in .NET Core, but as the number of routes grows , your Program.cs file can easily become overwhelming to maintain. Instead of keeping all your app.Map*() methods in the Program.cs file, you should create a Router class to separate your groups of app.Map() methods into. For example, if you have a set of CRUD routes for working with products and another set for working with customers, create a ProductRouter class and a CustomerRouter class. In this article, you're going to see how to move each group of Web APIs into their own router class to provide a much more consistent and maintainable way to create Minimal Web API calls.
This article continues my series on how to enhance the user experience (UX) of your MVC applications, and how to make them faster. In the first three articles, entitled Enhance Your MVC Applications Using JavaScript and jQuery: Part 1, 2, and 3, you learned about the starting MVC application that was coded using all server-side C#. You then added JavaScript and jQuery to avoid post-backs and enhance the UX in various ways. If you haven't already read these articles, I highly recommend that you read them to learn about the application you're enhancing in this series of articles. In this article, you continue learning how to add more Ajax to your MVC application to further speed up your Web pages.
In this article I am continuing my series on how to enhance the user experience (UX) of your MVC applications, and how to make them faster. In this article you are going to build Web API calls you can call from the application to avoid post-backs. You are going to add calls to add, update and delete shopping cart information. In addition, you are going to learn to work with dependent drop-down lists to also avoid post-backs. Finally, you learn to use jQuery auto-complete instead of a drop-down list to provide more flexibility to your user.
In this article, I'm continuing my series on how to enhance the user experience (UX) of your MVC applications, and how to make them faster. You're going to continue to add additional client-side code to the MVC application to further enhance the UX as you work your way through this article. You'll learn to expand search areas after the user performs a search, hide certain HTML elements when printing a Web page, and create custom jQuery validation rules to enforce business rules on the client-side.
In this first of a multi-part article series, I'm presenting an MVC application written with all server-side code to which you are going to add client-side code to make the user experience better and to make the application more efficient. Some of the things you'll learn in this article display a 'Please Wait' message for any long operations, complete with a spinner from Font Awesome. You're going to disable all buttons and links, and gray the background, while long operations take place so the user can't accidentally click on something else. You're going to learn how to use Bootstrap events to toggle collapsible areas so only one is open at a time. In addition, you'll learn to use the setInterval() function to display a countdown until the user's shopping cart is cleared.
In this article you learn to use the Fetch API which is a promise-based wrapper around the XMLHttpRequest object. As you will see, the Fetch API makes using the XMLHttpRequest object easier to use in some ways but does have some drawbacks where error handling is concerned. To make working with the Fetch API a little easier a set of IIFE's (closures) are created in this article. Using a closure makes your code easier to read, debug and reuse. You do not need to have read the previous articles to read this one. However, the .NET Core Web API project is created from scratch in the first article, so reference that article if you want to learn to build a CRUD Web API using .NET Core.
This article is going to continue with where you left off and finish creating a page that allows you to display a list of product data, add, edit, and delete products. If you use JavaScript, jQuery, Angular, React or almost any front-end framework, you most likely use Ajax to get and modify data from a server. Most of those front-end frameworks have their own wrapper around the XMLHttpRequest object. What you are learning in this series of articles is how to use this object natively. I am always a big fan of understanding what goes on under the hood as I believe it makes me a better programmer. If you are reading this article, and the last one, then you believe the same. So, let's create a CRUD page using JavaScript and the XMLHttpRequest object.
This is the first in a series of articles where you'll learn to use Ajax and REST APIs to create efficient front-end applications. In this article, you create a .NET Core Web server to service Web API calls coming from any Ajax front-end. You also learn to create an MVC Web application and a Node server to serve up Web pages from which you make Ajax calls to the .NET Core Web server. In future articles, I'll show you how to use the XMLHttpRequest object, the Fetch API, and jQuery to communicate efficiently with a .NET Core Web API project.
Working with stored procedures using the Entity Framework (EF) is a challenge because depending on what the stored procedure does determines how you call it using EF. This inconsistency, along with the names of the methods you call to submit a stored procedure change from one version of EF to the next can lead to much frustration for developers. This article will not solve these issues, but it will show you how to make calls to stored procedures using the version of Entity Framework in .NET Core.x. You are going to learn how to retrieve data from a stored procedure, how to pass parameters, return a scalar value, modify data, and handle multiple result sets.
As many users browse websites on their mobile phones, you might need the ability to guide the user from their current location to your location. This is easily accomplished using the browser's built-in navigator.geolocation object and Google maps. The geolocation object provides the latitude and longitude of the user's phone or desktop. You can embed a Google map on your web page and show the user their location based on that latitude and longitude. Additional API calls to Google's mapping API can give the user step-by-step directions to your location. This article shows you how to get started using these two powerful API's.
In this final part of this article series, you build a product detail page to add and edit product data. You add a delete button on the list page to remove a product from the database. You learn to validate product data and display validation messages to the user. Finally, you learn to cancel out of an add or edit page, bypassing validation and returning to the product list page.
In this article, you're going to add on to the sample from the last article to sort the database when the user clicks on any of the column headers in the HTML table. You're going to learn how to add a pager to your HTML table so only a specified number of rows are displayed on the page. Finally, you learn to cache the product data in the Session object to improve performance.
This article presents how to use the Model-View-View-Model (MVVM) design pattern in MVC Core applications. The MVVM approach has long been used in WPF applications but hasn't been as prevalent in MVC or MVC Core applications. This article illustrates how using MVVM in MVC makes your applications even more reusable, testable, and maintainable. You're going to be guided step-by-step building an MVC Core application using the Entity Framework (EF) and a view model class to display and search for product data.
Unlike MVC or Web Forms, when using WPF, you don't get a pre-built security system. Thus, you need to come up with your own method of securing controls on WPF screens, such as the one shown in Figure 1. There are a few different methods to accomplish this goal. For example, you can create different properties in your View model to make controls invisible or disabled based on a user's role. The problem with this approach is that if you need to secure more controls, you need to change the code and then redistribute your WPF application to your users. In this article, I'm going to take a data-driven approach to security so you can make changes in a database table and have your WPF application's security update without having to make code changes.
In the previous articles in this series on building a WPF business application (check www.CODEMag.com for the others), you created a new WPF business application using a pre-existing architecture. You added code to display a message while loading resources in the background. You also learned how to load and close user controls on a main window. You built a login screen, a user feedback screen, and a user maintenance screen to display a list of users, and the detail for a single user. In this article, you're going to finish this user maintenance screen by learning to manage button state, and to add, edit, and delete users.
In part 3 of this series, you'll build a user feedback screen to allow a user to submit feedback about the application. You build a view model and bind an Entity Framework entity class to the screen. The entity class contains data annotations and you learn to display validation messages from any data annotations that fail validation. You also start learning how to build a design pattern for standard add, edit, and delete screens. You build a user list control and a user detail control to display all users in a table, and the detail for each one you click on.
In Part 2 of this series, you're going to display a status message by sending a message from a View Model class to the main window. You're going to reuse the splash screen area that you built in Part 1 to display informational messages. A timer will be used to have these informational messages disappear after a specific amount of time. Finally, you'll create a WPF login screen with an image, a title area, and input fields for a user name and password. The user name and password data is validated and appropriate validation messages are displayed to the user.
When building any kind of application, it's important to start with a good architecture, a set of reusable helper classes, and design patterns. In this first of a multi-part series of articles, you'll learn to use a message broker to eliminate strong coupling between classes. You'll see how to display status and informational messages to the user while resources are loading. Instead of having a ton of open windows, you'll learn to load user controls onto a single window and how to aggregate controls and build large screens.
Using user controls for each of your screens is a great way to build WPF applications. Instead of having multiple windows pop-up on a user's screen, each user control can be loaded onto one main window. You do miss out on having the Minimize, Maximize, and Close buttons that a WPF window provides with this method. That's an easy situation to rectify and is the subject of this article.
Sometimes you need to upload files to your server from an Angular application to a Web API method. There are many ways to upload a file. In this article, I'm going to present a method that works well for small files, up to about one or two megabytes in size. You're going to build two projects; a .NET Core Web API project and an Angular project. You'll build these two projects from scratch using the Angular CLI, .NET Core, and the Visual Studio Code editor.
In my last two articles (Security in Angular: Part 1 and Security in Angular: Part 2), you created a set of Angular classes to support user authentication and authorization. You also built a .NET Core Web API project to authenticate a user against a SQL Server table. An authorization object was created with individual properties for each item that you wished to secure in your application. In this article, you're going to build an array of claims and eliminate the use of single properties for each item that you wish to secure. Using an array of claims is a much more flexible approach for large applications.
In my last article, Security in Angular: Part 1, you learned to create a set of Angular classes to support user authentication and authorization. You used these classes to log in a user and make menus and buttons visible and invisible. In this article, you'll use a .NET Core Web API project to authenticate a user against a SQL Server table. You'll return an authorization object by reading claim information from a claim table. You'll also secure your Web API methods using the JSON Web Token (JWT) standard.
It seems that more programmers are switching to C# from Visual Basic (VB) than ever before. As we all see when searching the Web, there are more samples in C# than there are in VB. Visual Basic is a perfectly good language for creating .NET applications, but it's just not the cool kid down the block anymore. If you currently have VB applications, and your current programmer(s) quit, you're going to be hard-pressed to replace them. Programmers don't want to keep working in what are viewed as legacy technologies. Right or wrong as that might be, you can't fight the trend.
In most business applications, you're going to want to disable, or make invisible, various features such as menu items, buttons, and other UI items, based on who's logged in and what roles or permissions they have. Angular doesn't have anything built-in to help you with this, so you must create it yourself.
It seems that more programmers are switching to C# from Visual Basic (VB) than ever before. As we all see when searching the Web, there are more samples in C# than there are in VB. Visual Basic is a perfectly good language for creating .NET applications, but it's just not the cool kid down the block anymore. If you currently have VB applications, and your current programmer(s) quit, you're going to be hard-pressed to replace them. Programmers don't want to keep working in what are viewed as legacy technologies. Right or wrong as that might be, you can't fight the trend.
If you're a Web developer, you know you should target your Web applications to be 'mobile first.' This means that your Web applications should look great on a mobile device, and good, if not great, on a desktop browser. There are many techniques you can use to help you develop for mobile. One technique is to use Bootstrap to give yourself responsive styles that change based on the device being used. Another technique, and the focus of this article, is to eliminate HTML tables.
Just like in .NET applications, you might want to have global configuration settings in your Angular applications that you can access from any component or service class. There are many approaches you can take for retrieving these global settings; I'm going to use a service that can be injected into any class. I think the flexibility of using a service is an ideal method for providing application-wide settings to any class that needs them.
Programmers frequently use console.log to record errors or other informational messages in their Angular applications. Although this is fine while debugging your application, it's not a best practice for production applications. As Angular is all about services, it's a better idea to create a logging service that you can call from other services and components. In this logging service, you can still call console.log, but you can also modify the service later to record messages to store them in local storage or a database table via the Web API.
This article builds upon my prior articles entitled From Zero to CRUD in Angular: Part 1 and From Zero to CRUD in Angular: Part 2. If you haven't already read these two articles, please go back and do so because this article adds to the project created in Part 2. In the last article, you learned to add, edit, and delete data via Web API calls. You also learned to handle validation errors coming back from the Entity Framework. In this article, you'll add additional server-side validation to the generated Entity Framework classes. You'll also learn to use the built-in client-side validation in Angular. Finally, you'll create your own custom Angular directive to validate data not supported by the built-in validation.
In this article, you'll add the appropriate HTML, Angular code, and Web API methods to allow the user to add, edit and, delete product data. To the Web API, you'll add POST, PUT, and DELETE methods, as well as a GET method to retrieve a single product. To the Angular product service, you'll add code to call each of these methods in response to user input.
Many business application Web developers build Create, Read, Update, Delete (CRUD) pages in their day-to-day jobs. Over the years, you might have built these pages in Classic ASP, Web Forms, and MVC. You might have even used JavaScript, jQuery and possibly AngularJS. It's now, once again, time to learn how to build a CRUD page using Angular 4. In this series of articles, you'll start with an empty Web application, built using Visual Studio 2015, and build up to a complete CRUD page.
Every developer needs to test their own code or have it tested by someone else. Many developers aren't great at testing their own work. The main reason is that we tend to test only the happy path" through the functionality that we wrote. We often avoid testing the boundaries of our code, such as invalid inputs, exceptions that might occur, etc. One way to become a better tester is to start writing unit tests. Although it takes more time up-front to write unit tests, it saves a ton of time if you have to regress test changes to existing features.
To build a Single-Page Application (SPA) using Angular (v1.x), you typically build a single HTML page and inject HTML fragments within this one page as the user navigates within your application. There are a few different methods you can use to navigate around your SPA in Angular. Navigation in Angular employs a mechanism called routing. In this article, you'll be introduced to many of Angular approaches using the route provider and the route object. You'll learn the various properties of the route object to help you control how routing occurs.
In my last three articles for CODE Magazine, you learned to use AngularJS to search and select data. You also saw how to add, edit, and delete data. In this article, you'll see how to add validation to the page in order to catch any input errors prior to sending the data to the server. Of course, you're not going to get rid of your server-side validation; you still need to protect the data in case someone bypasses your client-side validation.
In my last two articles in CODE Magazine, you learned to use AngularJS, which is a client-side framework, to replace code that you used to write all on the server-side using Web Forms or MVC. Angular is becoming the framework of choice to develop modern Web applications due to its ease-of-use and great industry support. In this article, you're going to learn to use Angular to insert, update, and delete data. You're going to build some Web API calls and connect to those APIs using the Angular data server. Using Angular data binding, the data from your user will be automatically updated in client-side objects, which are then sent to the server via Web API calls.
In my last few articles, I've explored a lot of JavaScript, jQuery, and the Web API. The code I wrote points out some deficiencies when writing in these technologies. That's the problem with JavaScript and jQuery: It's often difficult to write good, reusable, and extensible code. However, things are changing fast in the client-side world, especially now that Angular and other similar frameworks have been invented. In the last article (CODE Magazine May/June 2016), you improved your client-side code by using a closure and by using Mustache for data binding. In this article, you'll learn how these same concepts are applied in Angular.
In the eighteen years that I've been doing Web development, a lot has changed. We started out creating HTML pages to present static information to our users. We then used classic ASP to get database data and incorporate that into our pages. To use both of these technologies, we had to know a lot about HTML, CSS, and JavaScript. Along came .NET and we started rendering everything on the server-side. We forgot a lot about HTML, CSS, and JavaScript as Web Forms wrapped up a lot of that for us. Web Forms' architecture closely mimicked the way developers created desktop applications. This was great for helping developers move to the Web, but unfortunately hid a lot of the power of the Web, and also tended to be a little slow.
In the last two articles about CRUD and HTML (CODE Magazine, November/December 2015 and January/February 2016), you created a product information page to display a list of product data returned from a Web API. In addition, you built functionality to add, update, and delete products using the same Web API controller. In those two articles, there was a very basic exception handler function named handleException. This function displays error information returned from the API in an alert dialog on your page, as shown in Figure 1.
In my last article (CODE Magazine, November/December 2015), I showed you how to manipulate data in an HTML table using only JavaScript and jQuery. There were no post-backs, so the data didn't go anywhere. In this article, you'll use the same HTML and jQuery, but add calls to a Web API to retrieve and modify product data. It isn't necessary to go back and read the previous article; this article presents all of the HTML and the calls to work client-side and add the server-side code as well. I'll be using Visual Studio and .NET to build the Web API service, but the client-side coding is generic and can call a Web API built in any language or platform.
As developers, we're always asked to do more for our users. They want their Web pages faster, smaller, and with more features. This means that you have to start working more in JavaScript and jQuery on the client-side. By doing more client-side coding, you reduce post-backs to the server, thereby increasing performance. In this first article of a series on working within HTML and the Web API, I'll show you how to add, edit, and delete data in an HTML table using JavaScript and jQuery, but no post-backs. In subsequent articles, you'll learn how to take that data and use the Web API to retrieve and modify this data.
Bootstrap makes it easy to create a nice looking menu system (see Figure 1 and Figure 2). Instead of coding all your menus within your shared layout file, make your menus dynamic by storing them in an XML file or a database table. In this article, you create a simple one-line menu system using two C# classes and a little bit of Razor code in an MVC page. The sample in this article shows you how to build a hierarchical menu structure to be used with drop-down menus. You'll also see how to store and retrieve the menus from an XML file using LINQ to XML and a little bit of recursion.
When a user clicks on a button or link on a Web page, there can be a delay between posting to the server and the next action that happens on the screen. The problem with this delay is that the user may not know that they already clicked on the button and they might t hit the button again. It's important to give immediate feedback to the user so they know that the application is doing something.
As you can tell from my recent articles, I've been working a lot with Bootstrap. I've been learning how to extend Bootstrap with my own customizations. In this article, I'll show you how to create a custom product selection system like the one shown in Figure 1. To build this system, you'll use the Bootstrap panel classes, button groups, and glyphs. Along with these classes, you'll write a little jQuery to keep a running total of the selected products and make the glyphs change on the button groups. Finally, a little CSS is used to enhance the look of your product selection system.
In my last article, I showed you how to extend the Bootstrap accordion. While the jQuery and CSS I created worked, I realized that I forgot a couple of things. In this article, you'll learn to ensure that the glyphs added to the accordion work when you click on the title of the accordion. In addition, you'll see how to make the jQuery work with multiple accordions on one page. Finally, you'll see how you can use different glyphs on each accordion on each page and use data- attributes to control the glyphs used.
Over the last few years, my company has created many mobile websites for our clients. Like many programmers, we use Twitter Bootstrap to write these mobile websites. Right out of the box, Bootstrap gives you a very nice look and feel, but at times, either your customer wants something different, or you find that you need to add on some functionality to make something easier to use. One thing I added was the ability to add an up- or down-arrow to the title area of the Bootstrap accordion (See Figure 2 for an example of an accordion). In this article, you'll learn how to write just a little bit of CSS and jQuery to extend Bootstrap's accordion.
Many businesses have invested thousands of man-hours into ASP.NET Web Forms. These same businesses don't have time to rewrite their systems using the latest Web technologies, such as MVC. However, with just a little reworking of your Web Forms, you can still get all the advantages of modern Web techniques, such as HTML 5, CSS 3, Bootstrap, and jQuery. Lately, I've been assisting many clients as they upgrade their Web Forms applications to take advantage of Bootstrap, jQuery, JavaScript, Friendly URLs, and many other modern Web application techniques.
It seems like everywhere you read, everyone is talking about using ASP.NET MVC to create mobile Web applications. But what about programmers still working in Web Forms? We want our projects done using the latest techniques, we want to build mobile Web apps, and we want to use jQuery and Bootstrap, too.
The .NET Framework is huge. There's often more than one way to accomplish the same programming task, and knowing which way to go can sometimes make the difference between code that is slow or fast, flexible or rigid, and either maintainable or a maintenance nightmare. In this article, you will learn several tips and tricks for developing code that is flexible, extensible, maintainable, and testable. Some techniques in this article may be familiar to you, while others you may not have thought of.
There are many examples of using the Windows Presentation Foundataion (WPF) Tree View that you can find on the Web, however, most of them only show you how to go to two levels. What if you have more than two levels? This is where it's vital to understand exactly how the Hierarchical Data Templates work. In this article, I'm going to break down how these templates work, so you can really understand what's going on underneath the hood.
Sometimes your .NET applications need to interact with Microsoft Active Directory (AD) to authenticate users, get a list of users, retrieve groups, or determine which users are within which AD groups. There are a few different approaches you can use to retrieve information from your AD database within your domain.
I have a client that has a few Windows Services and some EXEs that run on a computer to perform various business functions. Every once in a while, the processes fail and need to be restarted. I helped the client write a Windows Service to monitor their running processes and ensure that they are up and running and to notify them and to attempt to restart those processes. As part of this process, I had to write a class to get a list of all of the processes running on the current computer or on another computer on their network.
If you are like many developers, you are using Windows Communication Foundation (WCF) to provide services to Windows Forms, WPF, Silverlight, ASP.NET and possibly Windows 8 Store applications. Now your boss is asking you to develop some mobile applications using HTML 5 and jQuery. You know you can reuse many of your WCF services, but you are having trouble calling them from jQuery without breaking your existing applications. In this article, I will walk you through the steps for taking a sample WCF service from working just for .NET applications to working with jQuery as well. Don't worry, your existing applications will still work with the changes you are going to make.
Almost every programmer knows (unless you have been living under a rock for the last five years or so) that you should be using classes for all of your programming. You should also be using collections of objects instead of using a Data Reader, a DataSet, or a DataTable in your applications. The reasons for using collections are many and are explored in this article.
In Part 1 of this article you learned how to create a Windows 8 look and feel for your WPF applications. In Part 2 of this article you learned to create a few of the user controls that went into making the shell application. In this final article in this series, you will learn how to create the last few user controls that I used to create the Windows 8 Shell application. In this article, you will learn to put together a WPF Image button, an Image button with text and finally the main Tiles used for the primary navigation system.
In part 1 of this article, you learned how to create a Windows 8 look and feel for your WPF applications. You were shown a high-level overview of the various components that made up the shell for navigating. In part 2 of this article you will learn to create a WPF Button user control, a Message Box you can style, and a simple Message Broker System. All of these components are used to create the 'Windows 8 Style' WPF shell you learned about in part 1.
Many people will not be able to upgrade to Windows 8 right away for various reasons. However, there is nothing to stop you from designing your WPF applications to have a similar look and feel. In this article I will show you how to create a Windows 8 style shell (Figure 1) for hosting 'Tiles' that you can use to launch features of your application. The first part of this article will discuss how to create the main window, use the tiles to launch applications and how to navigate around the shell. In the second part of this article you will learn about the different user controls used to build this application.
When people think of having to store data for their applications, a database such as SQL Server immediately comes to mind. However, XML files are very handy for storing data without the overhead of a database. Using XML files to cache often-used, but seldom changed data such as US state codes, employee types and other validation tables can avoid network roundtrips and speed up your application. In addition, XML files are great for off-line applications where a user needs to add, edit and delete data when they can't connect to a database.
You know you should be moving code out from behind your forms, windows and web pages and into stand-alone classes. Everyone preaches that this is what to do, everyone shows you examples of ViewModel classes, but no one really shows you a real-world example of how to get rid of the code behind.
In most business applications, you create a common look and feel, data entry pages, and a method for navigating through the application. As you begin to work with HTML5, you will want to build these features and take advantage of the features of HTML5 that can make your applications stand out from the crowd. In this article, you will be presented with several common business Web pages that give you an idea of the power of HTML5 and CSS 3.
In Part 1 of this article you learned how to work with orientation changes on the Windows Phone and how to create horizontally scrolling pages using Panorama and Pivot pages. In Part 2 you'll see how to interact with some of the built-in applications on the phone through the use of the Launcher and Chooser applications.
Developing for Windows Phone is easy if you have been doing any XAML at all. That's because you use Silverlight for Windows Phone development. This is a great thing because everything you already know can be applied immediately. This is not to say that there are no new things that you will have to learn. In fact, with the reduced screen size, the ability to change the orientation of the phone and some of the new types of pages, there are actually quite a few things you will need to learn. This article and the next one is your introduction to some of these new UI techniques.
Most programmers have a hard time making applications that look interesting and fun. We are great at creating functionality that makes the application do exactly what the user wants, but many applications often look very utilitarian. However, with just a few little XAML tricks, you can make your Silverlight or WPF applications look like an artist had a hand in their creation. In this article I will provide you with a couple of very easy XAML tips that you can use right away to spice up the images in your Silverlight and WPF applications.
The Silverlight ListBox is much more than you may think. When most people think of a ListBox they typically think of just a simple control that displays rows of text. However, the Silverlight ListBox is one of the most flexible controls you will find. I tend to think of the ListBox as similar to the ASP.NET Repeater control as it too is very flexible. In this article, I will show you six different ways to display data in a Silverlight ListBox.
In challenging economic times, you need to 'Be All You Can Be.' I am not just talking about being the best at coding in your company. I assume because you are reading this magazine that you are a programmer and that you are probably very good at your job. To ensure that you are not the one that gets the pink slip on your desk, you really should think about what else you can do to make yourself more valuable to your company. In this article, I present several of those soft skills that I think will help you with this goal.
By the time you read this, the Windows Phone 7 devices will be widely available on the market. Many developers are thinking about developing for this phone. If you are thinking about it, then I suggest you do more than think and start developing! This is a whole new opportunity and a whole new market available to you as a .NET developer that you have not had before. If you held off on developing mobile applications because of the learning curve of iPhone or Android programming, then this is your chance, as you will use Silverlight and .NET to program the Windows Phone. In this short article, I will introduce you to the basics of Windows Phone and give you some reasons why you will want to develop using this important new technology.
Have you found that you can understand the basics of data binding in WPF and Silverlight, but when you start to read about Model-View-View-Model (MVVM) you find that you have been dropped off a cliff? Have you looked at some of the XAML frameworks like PRISM only to find that it is just way too complicated for what you need? If this sounds familiar, then don't worry, you are not alone. Many great programmers struggle with this every day. In my humble opinion, I say don't try to implement a pure MVVM model. Just keep it simple! Many times the simplest approach is the best.
Software piracy runs rampant these days! You need to protect your code using a good licensing scheme and obfuscation. If you develop software for a living (and since you are reading this magazine, I assume you are), at some point you will most likely figure out how to protect your investment in that software. Two things you will need to do to accomplish this are to add licensing to your software, and to obfuscate your code so others cannot reverse engineer your hard work. These two tools are absolutely essential in your efforts to protect your software. This article will provide you with an overview on how you can use these tools to protect yourself from piracy.
When you read about history, the stories are mostly about the people involved, and not as often about the tools and technologies people used. In software engineering, the stories about the people involved are known as 'human factors' - and it is often the human factors in the life of a software project that make life interesting for software developers.
Do you store information about your customers, clients, suppliers, vendors, and your employees on a computer system? If so, you need to be aware of the many different movements that are happening, at least in the United States, about keeping that data secure. Many states are enacting or have enacted legislation requiring businesses to not only safeguard that information, but also force those businesses to notify customers if such information becomes compromised.
In a WPF application I am building right now, I have a need to create different shapes and center text within those shapes. The shapes I need are rectangles, circles, ellipses and triangles. The problem is WPF shapes are not containers so you cannot add any text inside of them, but WPF is flexible enough that there are often several ways to work around this. In this article, I will show you a few different methods of centering text in each of these shapes.
Your manager just dropped into your office and said, 'We have a very important, new assignment with a limited budget and tight schedule. I am assigning you to be the project manager. Good luck.'
Every developer needs to test their code, or have it tested by someone. I don't know about you, but I am horrible at testing my own code. Does this mean that I do not need to test my code? Heck, no! It is always best if you do not rely on your end user to test your code. This can end up with a very frustrated user, and your user can lose faith in your ability to get their project done.
If you are considering making a jump from being an employee to being self-employed, the following article will help you make the transition.
If you have not taken a look at Windows Presentation Foundation (WPF) yet, you really should. WPF is a great desktop development platform. Granted, all of the tools are not yet in place, but Microsoft is pouring millions of dollars into developing WPF tools. Microsoft now considers Windows Forms a legacy technology and they won't update it within
Our industry is constantly changing. So much so, that it is difficult to keep up sometimes. This last May at Microsoft Tech Ed 2009, I heard the same comments from many attendees; 'Which technology should I use?' 'What should I learn?' 'Why does Microsoft have to keep changing things all the time?' While there are no easy answers to these questions, and none of us has a crystal ball, there are a few things that are tried and true and have always worked in our industry that I recommend that you stick with.
Why is it that over time, any machine you buy just seems to get slower and slower? Well, I am sure you can chalk some of it up to perception, as your time gets squeezed more and more by work demands and personal demands. However, there are other factors at work on your computer that periodically need your attention. Of course, there are the obvious things you can do to speed up a machine such as adding more RAM or getting a faster CPU, but there are a few tuning things you can do within the OS and on your hard drive that can make a dramatic difference in the speed of your computer. As a developer, you need to pay attention to what Visual Studio and .NET do to your computer as well. This article will share some ideas on how to maintain a good development machine.
A lot of programmers tend to over engineer their software solutions. In the course of my consulting, I have reviewed many applications from many companies. In many cases I find a lot of areas where the software was just too complex. The reasons for this are varied, but seem to be centered around a few main areas: inappropriate use of design patterns, the 'not invented here' syndrome, and building a Cadillac when a Chevy would do the job. You can solve these issues in many ways. All it takes is a little bit of re-thinking on how you build software. This article offers guidance on some things you can do to simplify your software development process
Software development is a lot more than just writing lines of code. You need to think about project management, prototyping, database design, software architecture, framework usage and a whole host of other factors. In this article you will learn one approach to developing software applications from start to finish. This approach has been used successfully to develop hundreds of applications by a software development company that has been around since 1991.
In this article you will learn how to isolate yourself from change by taking advantage of the Provider Model. Designing your applications using the Provider Model will allow you to swap components out at runtime, thus allowing you to upgrade them easily.
Every company has some form of Software Development Lifecycle (SDLC) process - whether it is formal or informal. An SDLC includes people, processes, and tools that span the design, build, and support of your information systems. Some components of an SDLC are requirements gathering, analysis, prototyping, software construction, estimating, time tracking, project management, ongoing support, standards, best practices, and software configuration management. Typically, companies that we have engaged in our consulting practice have very weak SDLC implementations and in particular, even weaker software configuration management implementations. Our article will help you get a handle on what software configuration management is, why you need to have it, and how best to apply its principles to help you manage and develop your organization's software.
ASP.NET Whidbey adds a huge number of productivity features and enhancements. Although it's still early in the development process, Paul and Ken dig in and start playing with some of the new features, passing along what they've found.
Good exception handling should be put into an application from the very beginning. The Microsoft Exception Management Application Block (EAAB) will allow you to write one line of code in all of your Catch blocks and this one line of code can be configured to call multiple classes to log errors in any way you see fit. The best part is you do not need to recompile your application; you simply have to provide a new DLL that contains these new exception classes.
Most of you are probably aware that the web.config file in an ASP.NET project controls the behavior of your Web site. If you make a change to one of the built-in settings in this file, ASP.NET automatically detects those changes and applies them immediately. Wouldn't it be nice if you could have your own settings in this file applied immediately as well? In this article you will learn how to do just that. You will also learn the difference between the Application object and creating your own Configuration class.