Socket Programming C#

There is some situation that you have to work extremely real time with your network system so it is necessary to sleep some threads until they have job to do!  in this situation you need to work with

  • AsyncCallback
  • ManualResetEvent

there are good references to do that

Ref:

Advertisements

Base64

Base64 is a group of similar encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The Base64 term originates from a specific MIME content transfer encoding.

Base64 encoding schemes are commonly used when there is a need to encode binary data that need to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remain intact without modification during transport. Base64 is commonly used in a number of applications including email via MIME, and storing complex data in XML.

Ref:

Write to a file in C++


/*
Name: Open_file_and_write.c
Date: 02/01/05
Description: Opens file by append example.
*/
#include <stdio.h>
int main()
{
FILE *file;
file = fopen("file.txt","a+"); /* apend file (add text to a file or create a file if it does not exist.*/
fprintf(file,"%s","This is just an example :)"); /*writes*/
fclose(file); /*done!*/
getchar(); /* pause and wait for key */
return 0;
}

links:

htpasswd replacement


#!/usr/bin/perl
use strict;
chomp(my $filename=$ARGV[0]);
chomp(my $username=$ARGV[1]);
chomp(my $password=$ARGV[2]);
if (!$filename || !$username || !$password) {
print "USAGE: ./crypt.pl filename username password\n\n";
} else {
open FILE, ">>", $filename or die $!;
print FILE $username . ":" . crypt($password, $username) . "\n";
close FILE or die $!;
}