Coding

Ever since I advanced beyond the “hello worlds” of Java, I had never stopped coding. This section is for documenting code usages that I had employed while solving the technological problems that I had encountered.

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.

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.