How to monitor a folder for new files from your C# application

Suppose that you need to write a C# application to run in an environment where there are many batch applications running and creating files as their output.

Your application is one of them and is required to process files produced by others. How are you going to know from your C# application when these files are ready?

In this post, I document the use of a .Net facility that can help you achieve that.

Code generator for list of countries

There was a second need for me to display a list of countries for my users to select. While the first required insertion of names of the countries into the database, the second required the list of countries to be populated as an array of data objects via Java.

Although the text list of countries from Pedro Posada is useful in both instances, it only fulfills part of what I need. In addition to the names, I need to include additional boiler plate coding to convert the text list of countries into usable forms for the two different programming requirements.

And since the list is more than a 100 items long, it will be more efficient to get the computer to generate the list of countries with the necessary boiler plate coding.

Some resources that I reference(d) for producing things on the web

A good colleague of mine had asked me whether I could recommend him some learning resources in the area of web production. Yes, there are wonderful resources that I came across in my pursuit to put up useful things to people in the least frustrating way.

This post is for good people like him who want to learn more about producing things on the web.

How to save and load objects to and from file in C#

Persistency is almost always a requirement for applications that are meant for serious usage. Perhaps we want the data that our C# program had harvested or generated to be available everytime it runs. Or for that load of data that we are unable to send to a server to be remembered, so that we can try sending at a later time.

Because most of the data that is held by a C# application at runtime is in the form of objects, it is convenient to be able to save and load objects to file directly. Such capability is dubbed object serialization, and like many other programming languages, C# has the facilities to perform object serialization for developers.

How to interact with applications via command line in C#

As with most programming languages, C# has the facilities to start other applications via command line. Such facilities may not be of much interest to the ardent C# programmer, who will want to fulfill every business logic with purely C# codes in his/her program. However, there are times when it is necessary to interface with applications that other people had already built for us.

How to read from file in C#

The ability to read from file gives our C# programs the ability to act on data given by other programs, which may be written in different programming languages.

Such a ability is also helpful in allowing humans to configure how our C# program will behave at runtime.

Since being able to read from file is so helpful in C#, I want to remember how I can do that with this post.

How to validate input fields as the user is filling up a form with jQuery

In order to get sensible data from users via an online form, we have to validate data that we receive from them . As much as possible, we will want the data validation process to minimize frustration to our users.

We could have perform the data validation on the input fields at the point when the form is submitted. However, a better way will be to perform data validation on the input fields as the user is filling up the form. The validation process can follow such a sequence:

  1. User clicks on the input field.
  2. User fills up the input field with data.
  3. User clicks away from the input field.
  4. Data validation occurs on the input field. If there are any errors, display the error message near to the input field. Else everything proceeds as usual.