C# Windows Task Scheduler Wrapper Classes – C Sharp

Came across these wrapper classes that creates scheduled tasks in windows.  This wrapper class is pretty handy while creating automated tasks that runs in every period of time. such as running a program that generates hourly reports. Very easy to use.


One of the important aspect of running automated tasks is to ensure that the program is running without any errors. Since this is not a windows service, error reporting should be implemented in the program, in case there is an exception, someone should be notified. Log4net is cool tool for this purpose.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32.TaskScheduler;

namespace testscheduler
    class Program
        static void Main(string[] args)
            using (TaskService ts = new TaskService())

                // Create a new task definition and assign properties
                TaskDefinition td = ts.NewTask();
                td.RegistrationInfo.Description = "Does something";
                td.Principal.LogonType = TaskLogonType.InteractiveToken;

                 // Run the service every hour.
                var tt = new TimeTrigger();
                tt.Repetition.Interval = TimeSpan.FromMinutes(60);

                // Add an action that will launch someProgram.exe whenever the trigger fires
                td.Actions.Add(new ExecAction(@"someProgram.exe",null, null));

                // Register the task in the root folder
                const string taskName = "Test";
                ts.RootFolder.RegisterTaskDefinition(taskName, td);

                // Remove the task we just created
                // ts.RootFolder.DeleteTask(taskName);


C# Converting a String to Enum

Converting a string to Enum in c# is as follows:

object Enum.Parse(System.Type enumType, string value, bool ignoreCase);

You can then cast the object to some enum you desire.


Enum Direction

var dat = (Direction) Enum.Parse(typeof(Direction), “North”);

Quite easy right? and you don’t need many if statements to convert a string to Enum.


You can make HTTP POST using Java, and below is a way of doing it. This is just for educational purpose. You can work more on the class below. You need to enter the form fields by their name, because all the programming languages processes form by the field names, you might not need the “submit” name but sometimes, that s also being used.

By the way, this is what spammers usually use in order to fill up the forms with this automated programs. A nice feature added to this would be given a page, a spider to parse the forms and extract the field names etc.

package com.firatatagun;

import java.net.*;
import java.io.*;

public class HTTPPost{
	public static void send(){
		try {
			for(int i= 0; i <1; i++){
	        String data = URLEncoder.encode("form_field_by_name", "UTF-8") + "=" + URLEncoder.encode("some_text", "UTF-8");
 	        data += "&" + URLEncoder.encode("form_field2_by_name", "UTF-8") + "=" + URLEncoder.encode("some_text", "UTF-8");
                // might not be necessary
	        data += "&" + URLEncoder.encode("submit_form_name", "UTF-8") + "=" + URLEncoder.encode("submit", "UTF-8");
	        // Send data
 	        URL url = new URL("http://localhost/test.form");
	        URLConnection conn = url.openConnection();
	        OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
	        // Get the response
	        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
			String line = null;
		        while ((line = rd.readLine()) != null) {
	    } catch (Exception e) {


Essential Tasks of System Administration

Below are some essential tasks of system administration :

Adding and Removing Users :
The system administrator adds accounts for new users and removes the accounts of users that are no longer active. These process of adding and removing users can be automated.

Adding and Removing Hardware :
When there is a change in hardware configuration, System administrator should handle the new device drivers, configuration of the device.

Performing Backups :
Performing backups is one the most important role of  a System Administrator, To avoid chaos and data loss , System administrator should take back ups. Taking back ups can be automated.

Installing Software :
When a new software is installed, it should be tested many times before informing users.Local software should be installed in seperate folders than system programs to avoid problems during , upgrade of the system or kernel, in case local software wont be overwritten by System Software.

Monitoring the System:
Unix systems require supervision. Daily activities include making sure that , email, web services , network services are working correctly.Writing shell script and watching log files for signs of trouble and keeping an eye on system resources.

TroubleShooting :
Unix System administration has been like chaos. Finding the problem is sometimes harder than solving it. Trouble shooting  is a key role of system administrator and it comes with experience.

Maintaining Local Documentation :
Updating and orginizing man pages is yet another role of the SysAdmin.

Auditing Security :
Security is a very big issue. As the systems get bigger, security becomes more important. SysAdmin must implement security audits, run sniffers and script to ensure that network, system and file system is secure.

Linux File system summary

/bin :Contains executables for everyuser.
/boot :Contains the kernel image, system mpa, bootstrap…
/dev :Contains special files that represents hardware
/etc :Containts configuration files
profile : defualt settings for the system (path, alias commands)
fstab :File system table, default mounts.
X11 : X window configuration files
rc.d :start up scripts
init.d :startup scripts
inetd.conf :inetd listener configuration
skel :Direcotry comntaining default user confguration files.
passwd : user information and passwords
shadow : User password
sysconfig :may files with control system configuration

/home : Contains user’s home directories
/lib : Contains libraries
/mnt : Contains mount points for other file systems.
/proc : Virtual system (in memory) contains kernel and process info
cpuinfo :CPU information
dasd/devices : dasd addresses that the system recognized
devices :devices supported
meminfo :memory utilization
proc/swaps :swap file or devices enabled
proc/uptime : time since last boot

/root :home directory for root user
/sbin :Contains system admin executables
/tmp :Temporary storage space
/usr :Unix system resources
/var : contains logs & spool files
/lost& found :location for lost and found files are stored after a crash recovery by fs2ck

WGET linux utility

Wget is a really handy little command line utility. That assists downloading and retrieving of remote files. Luckily most systems ship with Wget.


Installation is very simple because this is an rpm. As root just type

[[email protected] root]# rpm -ivh wget-1.5.3-6.i386.rpm
wget                     ##################################################
[[email protected] root]#

Each hash mark (#) represents 2% of the install completed.


This program is very simple to use, check out the following example.

$ wget http://www.linuxinstruct.com/tutorials/wget/wget-1.5.3-6.i386.rpm

The first thing you will notice is that it displays a lot of information on the download. You might want to use this on its own terminal so you can continue working.

That will download the file from the following location. Many other handy arguments can be used but the most popular is the -c arugment. That is the continue arg. It allows you to cancel the download and pick up where you left off. Another handy arg is -q. That changes it output from verbose to quiet.

Creating Tar and Gzip files

To create a tarball use this syntax:

#  tar -cf [name of tarball].tar [list of files or directories]

That will create the tarball. A tarball is just a bunch of files inside one. Now we want to compress it using gzip.
To compress it with maximum compression use this syntax:

#  gzip -9 [file].tar

This will create a file called [file].tar.gz
The -9 is for maximum compression. It can be anything from 1-9

TRedD—A database for tandem repeats over the edit distance

A tandem repeat is a sequence of two or more approximate copies of a pattern. In DNA, tandem repeats are used for disease diagnosis, mapping studies, and human identity testing.


Contributed to Professor Dina Sokol’s Project and working on this project for the last 2-3 years.