venerdì 14 marzo 2014

NFS on LXC container

When I have two or more linux servers that need to share part of filesystem normally I use NFS.
But when the machine aren't real sometime wrong can happened.
Latest server that I had configurated are not real, but run on LXC linux container.

After several google search a lot of test finally I accepted the fact that NFS server on LXC is actually  not supported. So, what can I do?
Ok, if NFS server on LXC can't run I always try to run NFS server on real server and configure all the virtual machine as NFS client, so I try to do it.

Again, NFS client on LXC seems do not work. Why? The problem is apparmor on the real machine that block any appempt to mount NFS volumes.
In order to try to minimize the security changes on apparmor I add the following lines in /etc/apparmor.d/lxc/lxc-default

and now all run perfectly.

domenica 3 febbraio 2013

Modbus from C# - episode one - get a register value

Modbus is a protocol that allow to access data to a remote device.
Normally a modbus device is connected using serial line like RS232 or RS485 but ethernet is used also.

List of devices that support modbus protocol is very very long and you can find:

  • remote I/O interface
  • power meter
  • inverter
  • .... 
 Normally I used libmodbus library in order to access to modbus devices but this is a C library so why not write a wrapper to use libmodbus from my C# code?
Here you can find the result and below I present a first usage example where the fist 16 register are read from R/W modbus resgister:
using System;
using libmodbussharp;

namespace modbussharptutorial
 class MainClass
  public static void Main (string[] args)
   string modbusAddress = "";
   int port = 1502;
   int sizeMapping = 512;
   bool debug = true;
   // Modbus Initialization 
   ModbusCore modbus = new ModbusCore(modbusAddress, port);
   modbus.SetSlave (1);
      if (modbus.MappingNew(sizeMapping,sizeMapping,sizeMapping,sizeMapping)) {
    Console.WriteLine("Failed to allocate the mapping.");

   // Ask for first 16 read/write registers
   modbus.RegistersRWRead (0, 16);
   // Print result to console
   for (int i=0; i < 16; ++i) {
    Console.WriteLine ("{0:X2} - {1:D}", i, modbus.RegisterRWUnsigned [i]);

venerdì 25 marzo 2011

Linq on MonoDroid

I love this post so when it is possibile I modify the original source code on various environment.
I do it on GTK, Sugar (OLPC) and maemo.
Now I realize the same thing on Android platform using Monodroid.
Here there are the source code and screenshots follows:

giovedì 17 marzo 2011

PgDroid updated.

PgDroid, a software to access postgresql databases from android devices, is update in order to compile with MonoDroid preview 14.
Moreover the Npgsql postgresql driver is moved to a separate project file.
Now you can download the Npgsql postgresql driver for Android from here and use in your code without the necessity to get PgDroid code.
Any suggestions about how to improve PgDroid are welcomed.
Best Regards

venerdì 4 marzo 2011

PgDroid part 2, PostgreSQL db from Android device using Monodroid and Npgsql

News from PgDroid project: - it is possible write and executes a generic SQL query from the device. - "connection list" function is added. With this function you are able to see any database connection and, if you are connected as administrator, you are able to terminate it. In a future I hope that will be possible for database owner kill sessions to own database. The source code can be found here. Any suggestions will be appreciated.

mercoledì 2 febbraio 2011

PgDroid, access to PostgreSQL db from Android device using Monodroid and Npgsql

Finally PgDroid (PostgreSQL from Android), an application to test PostgreSQL db access from android device using Monodroid and Npgsql seems to work. Actually give me the list of Tables, Views, Indexes and Sequences of any postgresql DB. Next step are adding some "Administrative tool" and the capability for the user to write an own SQL command.

To do: - publish in an open repository - more useful functions - ......

Any suggestions will be appreciated.

Ops.... Some screenshot are needed:

martedì 23 marzo 2010

Mono 2.4.3 and WinForm on Maemo device

Today I spend some time to make some test using a real winform application on my N810 device. This application use a config file, a socket and a nontrivial winform interface to show the status of specific software server. This interface use tab pane dock to the full window, a detaililed list, and change the color of the row when a specific process is in running. I simply copy the binary from the windows server to my OpenSuSE linux machine and on my N810 maemo device. On OpenSuSE I have no problem with the latest version of mono. On Maemo device I not able to run the release version of application, so I try to run the Debug version with the "--debug" option. Now the application start perfectly. Here there is some screenshot taken from Windows, OpenSuSE and N810 :)
Window Platform
Linux Plaform
Maemo4 on N810