sabato 12 settembre 2015

My PS3 seems to be dead. Long live to PS3

Some days ago, my children have problem with our PS3. They tried to restart the console but when the device restarted, an error message came up asking to check the storage. 
Obviusly we answered yes and we started to wait .... a long wait. .... long ...

The day after (yes this operation was very slow and was necessary one whole day) finally the check disk was finished but PS3 was telling us that the system was corrupted so we had to insert an USB stick with latest firmware.
No problem, we had it, so we inserted USB stick and reflash our PS3 (yes all games progress was lost). When flash process was finished we restarted the console and .... nothing happened on the screen.  The screen was blank.
We tried to start recovery console but nothing.  The screen still was blank.
We checked all connections: power cord, HDMI cord;but nothing, the screen still was blank.

Some days later I tried to remove the internal HD from PS3 and when I power on it an error screen came up on the screen. Wow, I thought, so no hardware problem on video card and motherboard, probably the problem is the communication with HardDisk.

In the office I had an 2.5" HD so I took it and when I come back at home I tried to insert in the PS3 and ... opla ... recovery console now came up.

Now with a new HD my PS3 is like new.

I can understand that HD is critical for console but Sony could simply show an error message on the screen. In this was we though that it was dead but that wasn't true.

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 = "127.0.0.1";
   int port = 1502;
   int sizeMapping = 512;
   bool debug = true;
   
   // Modbus Initialization 
   ModbusCore modbus = new ModbusCore(modbusAddress, port);
   modbus.Debug=debug;
   modbus.SetSlave (1);
   modbus.Connect();
      if (modbus.MappingNew(sizeMapping,sizeMapping,sizeMapping,sizeMapping)) {
    Console.WriteLine("Failed to allocate the mapping.");
          return;
      }

   // 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

sabato 13 marzo 2010

Mono 2.4.3 on Maemo devices

After long long time I find some freetime to spend to update mono for maemo devices. After a lots of work, at the end I able to compile mono 2.4.3 for the maemo devices. Here you can find the instaction to compile mono for maemo. This instruction are refered by Maemo5 but work also on maemo4 and maemo4.1. I test it only on maemo4.1 device (I have N810 device but unfortunally not a N900 one). Here a the output of "mono --version" from a terminal:
Nokia-N810-23-14:~# mono --version
Mono JIT compiler version 2.4.3 (tarball Sat Feb 27 22:09:03 CET 2010)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
    TLS:           normal
    GC:            Included Boehm (with typed GC)
    SIGSEGV:       normal
    Notifications: epoll
    Architecture:  armel,soft-float
    Disabled:      debug,large_code,logging,com

sabato 4 luglio 2009

FsGateway - access to Sugar Datastore

FsGateway is a Mono application that allows to mount several entities as a filesystem using mono-fuse. Now we see the sugar_datastore module.

sugar_datastore module

This module allows mounting a Sugar Datastore storage as a filesystem. This way you can access to your document created using Sugar. Tags are shown as directories in the exported filesystem. You can open a Write document by simply double-clicking on it, and Open Office will be opened.

To do this, simply run the application specifying the filesystem type (sugar_datastore), the location where your data is stored (in this case datastore_sample) and the mountpoint (in this case mountpoint/):

mono --debug fsgateway.exe sugar_datastore datastore_sample mountpoint/

Now you can use your preferred file manager such as Nautilus or Dolphin to see the content and open each object with a double-click:

Here some snapshopt:




Since the datastore is read scanning the storage directory without using the datastore internal storage capability, data is read-only. This is done by the module, changing this behavior is very easy.

Obviously, you can open a SoaS datastore using this step:

  • become root (unfortunately)
  • plug in your SoaS in the USB port
  • create a working directory (e.g.: //mkdir ~/soas_datastore//)
  • mount the home partition with loop option (e.g.: //mount -o loop /media/disk/LiveOS/home.img soas_datastore// )
  • mount the datastore stored inside it (e.s. //mono --debug fsgateway.exe sugar_datastore ~/soas_datastore/liveuser/.sugar/default/datastore mountpoint//)

Of course, you can try the "allow_other" FUSE option to allow other users to access to the datastore.

lunedì 15 giugno 2009

FsGateway: looking inside an XML file as a filesystem.

FsGateway is a Mono application that allow to mount several entity as a filesystem. To do this one mono-fuse is used. Actually when you need to start the fsgateway you need do specify the filesystem type and the mountpoint. Now will describe the use of xmlfs "module". This module allow to mount a XML file into the normal filesystem. To do this simply run the application specify filesystem type (xmlfs), an XML file (in this case ~/mono_sugar/xml/xml/xml/bin/Debug/test3.xml) and the mountpoint (in this case mountpoint/):
mono fsgateway.exe xmlfs ~/mono_sugar/xml/xml/xml/bin/Debug/test3.xml mountpoint/
Now you can use your preferred file manager like nautilus or dolphin to see the content and open each node like a file: If you run the "find" or "grep" utilities, the file name that you get contains the XPath query to access the node. For example:
find mountpoint -iname "*md5*"
give this result for the file that I specify:
mountpoint/def:metadigit/def:img[1]/def:md5 mountpoint/def:metadigit/def:img[1]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[1]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[2]/def:md5 mountpoint/def:metadigit/def:img[2]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[2]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[3]/def:md5 mountpoint/def:metadigit/def:img[3]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[3]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[4]/def:md5 mountpoint/def:metadigit/def:img[4]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[4]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[5]/def:md5 mountpoint/def:metadigit/def:img[5]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[5]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[6]/def:md5 mountpoint/def:metadigit/def:img[6]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[6]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[7]/def:md5 mountpoint/def:metadigit/def:img[7]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[7]/def:altimg[2]/def:md5 mountpoint/def:metadigit/def:img[8]/def:md5 mountpoint/def:metadigit/def:img[8]/def:altimg[1]/def:md5 mountpoint/def:metadigit/def:img[8]/def:altimg[2]/def:md5
The same way, if you run "grep" you get the same behavior. For example:
grep -ril piccolo mountpoint/
gives as result:
mountpoint/def:metadigit/def:bib/dc:description/text()
You can find the source code here. Note: the def prefix is automatically added by the module for the default namespace. If this prefix is already used, the module use def2, or def3 ... and so on.

venerdì 5 dicembre 2008

OLPC under the Tower Eiffel - video, slide and pictures from the event

The French guys have published a lots of material from the CodeCamp on OLPC. Here you can find a lots of material about this event including some pictures and my presentation about to use the XO datastore from Mono and C#.

mercoledì 12 novembre 2008

OLPC and MONO under the Eiffel Tower

Hi guys, OLPC France will organize a OLPC CodeCamp in Paris on November 15 th. Five workshops are planned: Sugar, Localization, Pedagogic Usage, School Server and… Development of new activities using Mono. OLPC is one of most ambitious education project, it’s cool to have opportunity to use Mono on it. I will join with this guys, and you? You can find here some useful link:here and here. This news is also published by olpcnews. You can find the full article here. Best Regards.

mercoledì 29 ottobre 2008

Mono on OLPC (One Laptop Per Child) device update

Hi guys, A new official version of the XO Operating System is came out some days ago, the 767 build. Unfortunally the mono activities doesn't work on this environment. After some work to understanding the problem (because if I try to run it from Terminal activity using sugar-launch it came up) the bug is now fixed. The problem was related to the rainbow security model implemented on XO. This version of rainbow do not create the standard input and output file handles so the application hang-up. To fix it you need to modify the script that launch the activity to add a redirection from and to /dev/null. After this you have your activity ready to run again. Here you can see the wiki page on laptop.org with the script updated. Happy hacking

mercoledì 23 luglio 2008

Mono on OLPC (One Laptop Per Child) device update

Hi guys, several months went by without any post, but I didn't remain idle. During this time I made a lots of things but now I'm glad to post an update to sugar-sharp. This update will let you to use the datastore service that Sugar makes available to store your data. The datastore data are used by the Journal and can be integrated with the school server. This version is a very low-level API because it's a one-to-one mapping with the DBUS services. In the next version I will create a new class to allow you an easier way to access to the data on the datastore. Any suggestions are welcomed. You can find the instruction about compilation of mono here, and here you can find the source code. Happy hacking to all

venerdì 18 gennaio 2008

GBrainy for OLPC v0.50

Hi everyone, my little contribution to the OLPC and Mono is not finished yet, so in the last days I tried to port the new version of GBrainy to the OLPC Device. GBrainy is so nice that the OLPC version needs to be updated. You can find it here. The original web page can be found here. Thanks to Jordy Mas for the original code.

giovedì 3 gennaio 2008

Mono on OLPC (One Laptop Per Child) device

After a lot of time I'm finally releasing the first version of Sugar assembly to "sugarize" a Mono application. This assembly is needed to integrate a Mono application with the Sugar environment so it can run on an OLPC device. This version allows creating applications that use GTK# forms created programmatically or by a Glade resource file. Additional work remains to be done to support new widgets and integrate with Journal/Datastore to enable using all of the OLPC resource. A specific wiki page has been created on laptop.org wiki at this address. I have ported two applications to the OLPC device: GBrainy and MonkeysMemory. The first application is an interesting application to "improve" your brain, while the second one is a simple "Memory" game that I wrote to play with my children. Again I created some specific wiki page on laptop.org wiki, one for MonkeysMemory and one for GBrainy. Here are some screenshots to see these applications (oops, activities) in action:

domenica 16 dicembre 2007

How to write a standalone program (part 3)?

When I was deciding which library to use for developing my application, I was in doubt between GTK and WinForm. Back then, the WinForm was not so good, so I tried to use the GTK# for both the Win32 and Linux platforms. I had a lot of problems because I had to put a widget in a specific position and I needed to make a lot of experimentation to understand how to layout the GTK widgets. In the next project I did, the WinForm API became more stable, so I decided to use it. Again, I found a lot of problems but the program is now finished. The difference between the two class libraries? Personally, I prefer GTK# because is very powerful and flexible. Unfortunaly, on the Windows platform the look is not so good as on the Linux platform, and the need to include the GTK library for Windows increases the space requirements and the startup time on the CD-ROM media. Using WinForm, the application requires less disk space, but under Linux the interface looks alien.

giovedì 6 dicembre 2007

How to write a standalone program (part 2)?

Hi, now you can look on some screenshot taken from linux and windows system.

The first sequence of image is taken from Linux system.







This other sequence of images is taken from Windows System



How to write a standalone program?

Several years ago I write some program to be run on Windows machine. This programs need to be run from CD so no installation program can be used. At this time the mail solution are two: use Visual Basic or Director. I am mainly like to have the full control of my program so prefer to use Visual Basic. Several month ago e new customer ask to me to realize a CD to put in a book. Now, which development tool use this time? In fact in the last year I'm developing web application using mainly PHP and JSP on linux platform. Again, which development tool I can use to do this? So I give a look about the old Visual Basic plaftorm. Ok the old Visual Basic is dead, and it evolve to VB.NET while Director I never use before so why use it now? So give a look to VB.NET. Ok, seems to be very interesting and powerful .... but there is a LITTLE problem ...... to run the program the virtual machine need to be installed on machine and this is not a good thing for this type of application .... So, no solution? No, of course. From several month I start to look inside MONO, an open source reimplementation of .NET Virtual Machine. In this environment I can create a standalone program using mkbundle utility shipped with mono. Using this solution you have a program that can be run where mono runtime is supported (almost everywhere) and can be transformed on a standalone program for the target that you need. In my case only windows. This utility generate a C program that include all the library needed to start the mono runtime without need to install on the computer. I listen you, and to get the data used by the application? In the past you can store you data inside the program as resource or use a MDB file. Obviously this solution is not portable so I make some test using sqlite to manage the data. This solution is high portable because sqlite is available everywhere. But, it works? Sure, after I post some snapshot taken from Windows and Linux.