Tag archive for: Object Serialization

How to save and load environment objects in R

There was a need for me to build a prediction model in R and a Shiny app to allow users to get predictions out of my model. As the building of a prediction model take quite a while, it is not feasible for my shiny app to build the prediction model on demand.

There must be a way for my Shiny app to load my prediction model only once for fulfilling prediction requests from the users. As with many other programming languages, there are mechanisms in R that allow me to save my environment objects in one session and load them back in another session. This post documents how I can save and load environment objects in R.

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.

Implementing client-server communication using serialization and TCP/IP in C#

As software developers, we are always developing applications that can communication with other components: A server side script that echoes html to the browser, the client application that send information to a remote server endpoint and etc. One of the requirements that I got from my project was to display feedback from a windows service. However, because of session 0 isolation in windows 7, invocations of visual display logic from the windows service application is not enough to fulfill the requirement. In order to display feedback from a windows service application, I created a separate form application that runs when users log in and have the form application connects to the windows service application via TCP/IP to listen for feedback. Communication between the two applications is achieved via Object Serialization in .NET framework.