Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 2453
Before You Start If you want to understand the logic of these I/O ports and want to make a quick start to LCD you have to check out my first article. If you don't need the logic and only need a quick live work, do the circuit in part 2 and download my program to make LCD live.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 1877
Introduction Sometimes, I run across the need to dynamically invoke the method of an object, where the actual method might not be known until run-time. Usually, Reflecting is nice, but frequently doing it can be too slow. This article describes an alternative method for dynamic method invocation.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 3593
Introduction This article will attempt to cover everything you need to know to work with the Common Gateway Interface in C#, including reading the input of POSTs and GETs. Although this sounds like a lofty goal, CGI is actually quite easy to get into and gains most of its power from its simplicity. Despite that simplicity, I've labeled this as "Intermediate" because in order to take total advantage of CGI, I had to slip in some intermediate things, such as threading. Threading is presented in its most straight forward of terms, however, and only briefly utilized, so don't fret. Even if you have never worked with threading in C# before, I believe you will not have trouble with that part or any other sections that earned the "Intermediate" status. The Common Gateway Interface, or CGI, is a long standing W3C standard[^] for communicating between a web page and an application available on the web server. Applications on the server communicating in CGI have all the functionality of any other native application, such as database access or reading input files. Nevertheless, in today's world, with ASP.NET, PHP, Perl and many other scripting languages providing essentially the same functionality, you may wonder why you would bother creating your own CGI application with C#. There are a few reasons I can think of that may apply.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 2358
Introduction In this step by step article, we look at implementing event handling in C#.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 774
Introduction In .NET framework, collections are omnipresent: ComboBox, ListBox, ListView, DataGrid, Menu, all of these objects, and many others, make use of collections. Not only is it important to understand how these objects use them, but can be extremely useful to know how to take the most out of them yourself. CollectionEditor is a very powerful tool for editing and persisting collections at design time, but is a poor option for run time editing, when you often need a high level of customization and versatility for implementation of themes, multilingual support and some other real world requirements. Those who need such a tool can find one here in CustomControls.CollectionEditor.CustomCollectionEditor. In order to persist a collection with CollectionEditor, you need to do three things: implement a collection item, implement a collection to hold the items, and many times, depending on the item and collection implementation, subclass the CollectionEditor to obtain the right behavior. This article is accompanied by source code structured as follows: CollectionEditingTest solution: • CustomControls project A small controls library containing the following controls: CTextBox, DropDownCalendar, DropDownColorPicker, DropDownBool, DropDownList, PushButton, ToggleButton, DropDownListBoxButton, and most important, CustomCollectionEditorForm. • TestProject project A test project where you can find support code for the issues discussed here. o CollectionEditorTest.cs contains classes used for demonstrating collection editing and persisting techniques with System.ComponentModel.Design.CollectionEditor. o CustomCollectionEditorTest.cs contains classes related with CustomControls.CollectionEditor.CustomCollectionEditor functionality. o TestForm.cs. Here you can test the design-time serialization and editing of collections implemented by a test control. o CustomControlsForm.cs serves as a showroom for the controls in CustomControls library. When you open th
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 673
Introduction Test Driven Development is the practice of (1) writing tests, (2) writing code that passes those tests, and (3) then refactoring. This concept is becoming very popular in the .NET community due to the quality assurance that it adds. While it is easy to test public methods, the natural question emerges "How do I test protected and private methods?" This article will: Summarize some key points of the "Should-you-even-test private methods debate"? Make the case that it is still useful to at least know how to test private and protected methods - regardless of which side of the debate you're on. Provide the theory and downloadable code sample to demonstrate these testing techniques.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 688
Introduction Reflection is very useful for dynamic processing. However, if you have to repeatedly reflect on a property, say in a processing loop, you'll soon find that it can lead to performance problems. I ran into this particular problem in developing a rules engine that will be able to validate collections. I thought I would share this snippet of code, since I think it could be used in a variety of situations. In this article I'll provide a fast, alternative solution for dynamic property access.
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 783
Introduction I was developing a small Windows app using C#, and I decided that it would be nice to save the window's position and size when the app exited so it would be the same the next time the app was run. Having come from the MFC world, I searched for something equivalent to GetProfile and WriteProfile methods of the CWinApp class, but found nothing. I knew there was a Registry class in the Microsoft.Win32 namespace, but there was nothing available for writing to INI files. I would need to use the Win32 APIs for those. If I wanted to use an XML file, there was a whole slew of classes available in the System.Xml namespace. I also looked into using App.config files which some people had mentioned in the forums, but those supposedly were not meant to be written to... All these similar mechanisms, each with their own interfaces... which one to use? I just needed a simple way to persist my window's position and size somewhere to be later retrieved. I set my small Windows app project on the side and decided that it was time to write a new class library; one that would unify all these mechanisms into a common and simple interface: the IProfile interface. This article presents the IProfile interface and the four classes that implement it: Xml, Registry, Ini, and Config. These four classes allow reading and writing values to their respective mediums, via a common and simple interface. Enjoy!
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 692
Introduction Property binding is one of the slick things that .NET supports. It allows you to easily bind a property of a control to a property of a container class, which in turn helps to separate the UI implementation from the business logic. However, to properly utilize data binding you need to be aware of what .NET expects in your container and you need to be aware of the limitations of .NET data binding. In the end, you may throw out .NET's implementation completely! This article will discuss those issues with regards to simple property binding. By simple, I mean a 1::1 relationship between the container property and the control property. This article will not discuss more complicated binding involving the CurrencyManager, data sets, etc. Simple property data binding turns out to be complicated enough!
Đăng bởi: host | Ngày : 12:46 29/03/09 | Xem: 676
Introduction This article will focus on Visual Studio for Applications, or VSA, and explain how it can be integrated with .NET programs. It will also explain a few key areas you must understand in order to successfully integrate VSA into your programs.