ASP.NET Cross-Platform Solutions

ASP.NET applications mainly focused on Windows platform with using IIS web server which installed on Windows platform; However, we want ASP.NET applications to support different platforms such as Windows, Linux and Mac OSX.

We known Mono project already, Mono is the most popular solution which supports ASP.NET application to run Linux and OSX. However, Technology is changing time by time. Let us find more solutions here.

Continue reading “ASP.NET Cross-Platform Solutions”

Download Ubuntu 12.04 Version

We have a product which needs elder Ubuntu such as 12.04, we spent some time to get the right .iso version (not torrent file), finally we downloaded from this page (still specified by Ubuntu official website).

What we need is 32-bit PC desktop iso file, this is the link to click to download directly.

Just for record.

Install Mono on Ubuntu

My testing Ubuntu is Ubuntu 14.04 LTS edition.

1: Add the Mono Project GPG signing key and package repository Ubuntu system:

sudo apt-key adv –keyserver –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

echo “deb wheezy main” | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

sudo apt-get update

Continue reading “Install Mono on Ubuntu”

Install Ubuntu 14.04 LTS on Hyper-V Virtual Machine

Our development needs different OS and platforms to test, so we set some virtual machines on Windows Server 2012.

Here we set a virtual machine to install Linux, we install Ubuntu 14.04 LTS this time.

1: We will use a .iso image file, set the virtual machine to load the .iso file:


Continue reading “Install Ubuntu 14.04 LTS on Hyper-V Virtual Machine”

Upper Case or Lower Case String in Linux C

There is no direct function to convert a string to upper case or lower case in Linux C. Here we collect 2 functions from internet:

#include <ctype.h>

static char* Str2Upper(char *str)  
    if(str == NULL)
        return NULL;
    char *p = str;  
        *str = toupper(*str);  
    return p;  


static char* Str2Lower(char *str)
if(str == NULL)
return NULL;

char *p = str;

*str = tolower(*str);

return p;

A sample of thread sleep in Linux

Our R&D Manager and senior system designer Mr. Mohamed gave us the following sample for a thread sleep in Linux.

#define _POSIX_C_SOURCE 199309
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <sys/time.h>
#include <time.h>

void mySleep()
  int32_t  retval
  struct timespec  requestTm, remainTm;

  retval = 0

  requestTm.tv_sec = 0;
  requestTm.tv_nsec = 200000;  //200ms

    retval = nanosleep(&requestTm, &remainTm);
    if((retval == -1) && (errno != ENITR))
       retrun MBR_GAPDELAY_ERROR;

    requestTm = remainTm;

  }while (retVal != 0);


What does dirty memory means ?

Dirty memory is not memory leak.

Dirty memory has been released and can be re-allocate, but memory leak indicates the memory block has not released correctly  so the memory can not be re-allocated.

from RedHad website:

Dirty means "might need writing to disk or swap." Takes more work to free. Examples might be files that have not been written to yet. They aren’t written to memory too soon in order to keep the I/O down. For instance, if you’re writing logs, it might be better to wait until you have a complete log ready before sending it to disk.

You can read more information about "Free," "buffer," "swap," "dirty." concepts from here.

Some special commands for linux embedded devices

There are some embedded devices or products in the market which are using Linux. They need some special Linux commands, Here we list part of them, and maybe we will keep on update them if we find more:

1: copy file to Plug and Play device:

# cp /usr/local/bin/scripts/menu.rss /tmp/usbmounts/sdb1/

copy menu.rss to a USB drive

2: copy all folder content to another folder:

# cp -r /usr/local/bin/scripts /usr/local/etc/scripts

In some case you can not modify files under some Read-Only folder such as if your file system is SQUASHFS format. then you have to copy Read-Only folder to a writable folder, then later you can mount them.

3: Mount file or device:

# mount -o bind /usr/local/etc/scripts /usr/local/bin/scripts

copy the file to some place editable (/usr/local/etc) then after you are done with the edits, overmount the original file.

mount –bind /usr/local/etc/modified_file /original_file_path/original_file

Once tested and found running fine just add the overmount command to you /usr/local/etc/rcS startup script.

A sample using union in C

This sample code is for testing some data type border value using C union. Worked on Linux OS.


int main(void)
unsigned long int lms;
unsigned short shms[2];
unsigned char  bms [4];
} myms;

myms.lms = 0;

while (1)

printf(“long: %ld  short: %d  byte: %d\n”, myms.lms, myms.shms[0],[0]);
return 0;