How to raise and consume custom events in C#

When something happens asynchronously, the events mechanisms in C# is a good way for different components of our C# programs to notify one another about it.

For example, when the report generation component had the finance report ready, it can raise an event to components that had registered interest in that finance report.

This post documents how we can raise and consume custom events in C#.

Books that taught me the concepts and skills that I needed to build my website

When I had that spark of motivation to build a website for myself, I do not know how to get started.

At that point of time, I found myself lacking in the following skills to:

  • design my website
  • create codes for the browser to render the front end look and feel
  • create codes for the web server to respond to HTTP requests from the browser
  • write some decent content for my website

This post lists the books that help me understood the concepts that I needed and acquired the skills that I needed to fulfill my motivation of building my website.

How to create a thumbnail of an image in Java without using external libraries

I had a situation when I wanted to display thumbnails of the images that my user had uploaded to my web application. A straightforward way could be to return the images in its entirety and use css techniques to scale down the image into a thumbnail. However, this is costly for my users who mainly access my web application from mobile devices.

One strategy for optimizing the web experiences of my users would be to generate the thumbnails at the server end so as to reduce the sizes of the HTTP responses that my server sends back to the mobile devices. And to reduce bloat from external libraries, I decided to use the facilities provided from Java standard libraries.

This post documents how I create a thumbnail from an image without using external Java libraries. For the sake of brevity, let’s assume that we had downloaded an image via HTTP GET from a web server and saved that image to the path /images/sample.jpg.

How to use the aggregate function in R to perform computation on measures that are categorized by some variables in a data frame

In today’s fast-paced world, there are tremendous amount of data being recorded periodically. These data may come from sensors which record some measurement along with some categorization such as time and sensor type.

To make sense of such data, most data analysts use the R programming language as a tool. Apart from being free, there are many nice features of R which can help make my data analysis work easier.

This post records the use of the aggregate function in R which I often use to create meaning out of the humongous data which I lay my hands on.

How to send HTTP GET request with Java without using any external libraries

There was this time when I need to build a program to check whether my web server is running fine. To determine that my web server is running fine, I wrote a Java applet that sends a HTTP GET to one of my web resources when the applet runs for the first time. And to keep the applet light, I look into Java in-built features for sending HTTP GETs to my server. This post documents a proof of concept that I did to communicate with my server endpoint via HTTP GET using Java in-built features.

How to send HTTP POST request with Java without using any external libraries

I need to create a Java solution that will be able to send some bulk processing information back to a HTTP server endpoint. The Java solution should be as lean as possible, using as many facilities that Java provides out of the box. Luckily for me, Java do provides the java.net.HttpURLConnection class for me to build my solution. This post details a proof of concept which I did to get to know more about the java.net.HttpURLConnection class.

In this proof of concept, I create a Java console program that will hit the php endpoint which I had created earlier to proof that I can use jQuery to push a dynamically generated file to the web browser based on the user’s input.

How to get information about all the printers that are installed in my windows machine from a C# program via WMI

I need to create a windows service that is able to send some print jobs to one of the installed printers. As this is a windows service, it has to be able to find the printer with a preset printer name. This post details some prototyping codes that I had created to determine whether I am able to locate information of all the printers that are installed in the windows host where my windows service will run.

A workflow for handling multiple concurrent changes on a single software system

To me, a change will mean that I am going to have more rice on my bowl. And in my nature of work, changes to the software systems under my care occur pretty often. In fact, changes had benefited me, as changes serve to increase my company’s competitiveness so that she can continue to buy me my daily bread.

There was this time when I was working with a software development house which my company had employed to build our new system. Nearing project completion, I volunteered to engineer a new workflow for my company to handle software development after we took over the system from the software development house. The main objective of the workflow is for coordinating change deliveries from multiple development teams on a single software system suite.

This post documents the workflow that I had engineered.