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.

Generate PHP codes with PHP

Throughout my programming years, I observed similar trends in code structures and I felt that being able to generate them automatically will greatly reduce development time.

Although there are many code generation software on the web, coding one for your own usage can be simpler and more convenient, especially when you had written custom functions that your generated codes will utilize.

In this post, I shall discuss my recent experience in creating a PHP code generator for my own usage.

How to build a web based user interaction layer in C#

With the ubiquity of web browsers, it can be ideal for the user interaction layer of applications to be web based. The most common approaches to building web based applications is to write server side scripts running on web servers. However, these approaches require server programs to be present in the production environment.

What if you want the web server functionality to be contained in your C# program? In C#, there is a System.Net.HttpListener class which listens for HTTP requests from clients.

This post is part 1 of the sequel. In this post, I will introduce the HttpListener class and how we can use it to receive HTTP requests from clients in our C# program.

Downloading a file via HTTP post and HTTP get in C#

Previously, I had written two posts on how to upload files to a web server, one for the case when the size of the HTTP request is small, and the other for the case when the size of the HTTP request is large. How about the downloading of files from a web server? In this post, I shall discuss how to download files from a HTTP server via the System.Net.HttpWebRequest class.

Uploading large HTTP multipart request with System.Net.HttpWebRequest in C#

My previous post described a method of sending a file and some data via HTTP multipart post by constructing the HTTP request with the System.IO.MemoryStream class before writing the contents to the System.Net.HttpWebRequest class. This method of sending our HTTP request will work only if we can restrict the total size of our file and data.