TDD developer

June 28, 2009

Google Web Toolkit (GWT) on Ubuntu Desktop 9.04

Filed under: Uncategorized — makka @ 12:20 pm

After watching a Google Wave video presentation my interest in the Google Web Toolkit (GWT) grown so I decided to create Virtual Machine with all the stuff I need to play with GWT. I’m using a VMWare virtual machine with Ubuntu Desktop 9.04.

Im order to setup the development environment I found this great blog post with detailed informations on how to set up Glassfish, Eclipse, Google Web toolkit (GWT), Development Environment on Ubuntu Desktop 9.04.

I follow the instruction step by step. I’m not a Linux geek but everything was quite easy. Here below you can see my first application build with GWT.

Capture

Technorati Tag: ,,

June 25, 2009

Moonlight on Ubuntu 9 with Firefox

Filed under: Uncategorized — makka @ 7:14 pm

Just few mouse clicks and it works like a charm.

Here below you can see the site of the italian national television build with silverlight 2.0

Capture

Technorati Tag: ,,

December 25, 2008

Microsoft Sync Framework using IronRuby

Filed under: .NET, Uncategorized — makka @ 11:38 am
Tags: ,

Microsoft Sync Framework is a comprehensive synchronization platform that enables collaboration and offline access for applications, services and devices. It features technologies and tools that enable roaming, sharing, and taking data offline. Using Microsoft Sync Framework, developers can build sync ecosystems that integrate any application, with any data from any store using any protocol over any network.

In these days we used Microsoft Sync Framework to develop some occasionally connected application. These application use Microsoft Sync Framework to synchronize their local storage with the centralized database hosted on-line.

Microsoft Sync Framework includes a number of providers that support common data sources. The following providers are included:

  • Sync Services for ADO.NET: Synchronization for ADO.NET enabled data sources
  • Sync Services for File Systems: Synchronization for files and folders
  • Sync Services for FeedSync: Synchronization for RSS and ATOM feeds

Key features of the File system provider include:

    • Incremental synchronization of changes between two file system locations specified via a local or UNC path.
    • Synchronization of file contents, file and folder names, file timestamps, and attributes.
    • Support for optional filtering of files based on filename/extensions, sub-directories, or file attributes
    • Optional use of file hashes to detect changes to file contents if file timestamps are not reliable
    • Reliable detection of conflicting changes to the same file and automatic resolution of conflicts with a no-data-loss policy
    • Allow for limited user undo operation by optionally allowing file deletes and overwrites to be moved to the Recycle Bin
    • Support for Preview mode which provides a preview of the incremental sync operation without committing changes to the file system
    • First-class support for the scenario where the user may start synchronization with equal or partially equal file hierarchies on more than one replica.
    • Support for graceful cancellation of an ongoing sync operation such that the remaining changes can be synchronized later without having to re-sync changes that were already synchronized.

An example of Sync Services for File Systems usage can be found here. In order to test IronRuby I decided to convert this sample from C# to Ruby

require "mscorlib" require "Microsoft.Synchronization.dll" require "Microsoft.Synchronization.Files.dll" include System include Microsoft::Synchronization include Microsoft::Synchronization::Files class Syncronizer def DoWork replica1RootPath, replica2RootPath idFileName = "filesync.id"; replica1Id = GetReplicaId( replica1RootPath + "/" + idFileName) replica2Id = GetReplicaId( replica2RootPath + "/" + idFileName) options = FileSyncOptions.RecycleDeletedFiles filter = FileSyncScopeFilter.new filter.FileNameExcludes.Add idFileName DetectChangesOnFileSystemReplica replica1Id, replica1RootPath, filter, options DetectChangesOnFileSystemReplica replica2Id, replica2RootPath, filter, options SyncFileSystemReplicasOneWay replica1Id, replica2Id, replica1RootPath, replica2RootPath, filter, options SyncFileSystemReplicasOneWay replica2Id, replica1Id, replica2RootPath, replica1RootPath, filter, options end def GetReplicaId path id = Guid.NewGuid if File.exist? path str = File.read path id = Guid.new(str) else File.open(path, 'w') {|f| f.write(id.ToString) } end id end def DetectChangesOnFileSystemReplica replicaId, rootPath, filter, options provider = FileSyncProvider.new(replicaId, rootPath, filter, options) provider.DetectChanges; provider.Dispose end def SyncFileSystemReplicasOneWay sourceReplicaId, destinationReplicaId, sourceReplicaRootPath, destinationReplicaRootPath, filter, options agent = SyncOrchestrator.new agent.LocalProvider = FileSyncProvider.new(sourceReplicaId, sourceReplicaRootPath, filter, options) agent.RemoteProvider = FileSyncProvider.new(destinationReplicaId, destinationReplicaRootPath, filter, options) agent.Direction = SyncDirectionOrder.Upload agent.Synchronize end end sync = Syncronizer.new sync.DoWork "D:/tmp/SyncFXSamples/A", "D:/tmp/SyncFXSamples/B"

I have uploaded a little zip here that contains all the stuff you need to get ready. If you want to run the sample you have to run the command: ir sync.rb as show below

image

Technorati Tag: ,

December 1, 2008

Use NAnt to run mbunit tests using gallio

Filed under: Uncategorized — makka @ 7:55 pm
Tags: , ,

Gallio has a great build-in support for NAnt!
Unfortunately at the moment this is not well document so if you need to create a target to execute all tests inside an assembly you can write this xml fragment inside your NAnt project file:

<target name=”test” depends=”build”>
  <gallio
    result-property=”exitCode”
    failonerror=”false” >
    <runner-extension value=”TeamCityExtension,Gallio.TeamCityIntegration” />
    <assemblies>
      <!– Specify the tests assemblies –>
      <include name=”${src.dir}Data.Fixturebin${project.config}Data.Fixture.dll”/>
    </assemblies>
  </gallio>
  <fail if=”${exitCode != ‘0′}” >One or more tests failed. Please check the log for more details</fail>   
</target>

don’t forget to load Gallio NAnt Tasks before start with this line of xml

<loadtasks assembly=”.toolsGallioGallio.NAntTasks.dll” />

If you need more information you can take a look at comment in the source code here

Technorati Tag: ,,

October 16, 2008

Create Microsoft sql database before integration test

Filed under: Uncategorized — makka @ 7:56 pm
Tags: , , ,

In my last post I shown how to create a SqlCe database “on the fly” once before all integration tests. Alexander asked me how can do the same thing but using a Microsoft Sql database. Let’ s how we can do it:

using (IDbConnection connection = new SqlCeConnection(masterConnectionString))
{
    connection.Open();
      using (IDbCommand command = connection.CreateCommand())
        {
            command.CommandType = CommandType.Text;
            command.CommandText = "CREATE DATABASE UnitTestDemo";
            command.ExecuteNonQuery();
        }
    }
}
//open a new connection to UnitTestDemo database and create all objects
The only difference here is the statement used for the creation of the database. As you can see we need a connection to the master database in order to execute the CREATE DATABASE statement. Once we have the new empty database we can close this first connection, open a new one to test database and run all the scripts for the objects (tables, views, stored procedures, ecc.) creation.
 

August 14, 2008

Double interview: Ayende vs. Roy Osherove

Filed under: Uncategorized — makka @ 3:47 pm

If you like reading blogs of Ayende e Roy Osherove you can’t miss this “semi-serious” double interview made by Emanuele.

I hope you enjoy it!

Technorati Tag: ,

June 26, 2008

Firefox 3 certificate & bug

Filed under: Uncategorized — makka @ 12:44 pm
Tags:

I’m one of the millions of people who downloaded Firefox 3.0 some days ago. Here is my certificate!

image

Unfortunately TippingPoint ZDI notified Mozilla of a vulnerability in Firefox that impacts versions 2.x and 3.0 has mention here.  This issue is currently under investigation.  To protect Firefox users, the details of the issue will remain closed until a patch is made available.  There is no public exploit, the details are private, and so the current risk to users is minimal.

We look forward for a patch!

Technorati Tag:

June 18, 2008

WPF Document Outline: Visual Studio 2008 vs. Blend

Filed under: Uncategorized — makka @ 1:17 pm
Tags: , , ,

In these days I’m developing a new WPF application using VS2008 and Expression Blend.

As you can see Expression Blend has a very strong support for all graphical aspects of UI

image image

I think today you can’t develop a WPF application without using together Expression Blend and Visual Studio 2008

May 18, 2008

The Machine is Us/ing Us

Filed under: Uncategorized — makka @ 4:05 pm

Are we using the machine or the machine is using us ? Very cool video!

 

Technorati Tag:

May 3, 2008

Convert XmlDocument to DataTable using LinqToXml

Filed under: Uncategorized — makka @ 7:21 pm
Tags: , ,

I found this solution to import in my database an XML file received from an external legacy system via a POP3 server. I used an open source library to get the XML file on my hard disk. Now I need to bulk insert this information into a remote server where I can access only using MSSQL protocol so I dediced to use SqlBulkCopy class. In order to use this class I need to transfor the XML document into a DataTable.

This a sample of my XML file:

<sales>
<pos code="000000" index="0000000003">
<year value="2007">
<month value="04">
<day value="02">
<tipo code="L">
<row code="002039055" qty="1" price="7.290" />
<row code="002309045" qty="134" price="2.390" />
<row code="002427274" qty="21" price="6.500" />
<row code="003366150" qty="1" price="4.600" />
<row code="003785045" qty="0.1" price="6.940" />
</tipo>
<tipo code="V">
<row code="002039055" qty="21" price="7.290" />
<row code="003366150" qty="87" price="4.600" />
</tipo>
</day>
</month>
</year>
</pos>
</sales>

and this the code
XElement xElement = XElement.Load("test.xml");
var elements = from f in xElement.Descendants("riga")
select new
{
Code = f.Attribute("code").Value,
Quantity = f.Attribute("qty").Value,
Price = f.Attribute("price").Value,
Type = f.Parent.Attribute("code").Value,
Day = f.Parent.Parent.Attribute("value").Value,
Month = f.Parent.Parent.Parent.Attribute("value").Value,
Year = f.Parent.Parent.Parent.Parent.Attribute("value").Value,
} ;

Now you can build you DataTable using the common syntax

DataTable dataTable = new DataTable("dbo.Vendite");
dataTable.Columns.Add("data", typeof(DateTime));
//others columns

and the you can add rows using a foreach loop

foreach (var element in elements)
{
DataRow dataRow = dataTable.NewRow();
dataRow["data"] = element.Date;
//others columns
dataTable.Rows.Add(dataRow);
}

now I can use SqlBulkCopy to insert data in the server locate inside LAN.

Next Page »

Blog at WordPress.com.