For the past years, we are using ASP.NET AJAX for our web applications. With built-in security features, easy implementation of navigations, data validations and intuitive presentation, among others, there is no doubt it’s been our choice.

However, with the release of Silverlight 3 and the latest version Silverlight 4 combined with RIA Services, I am enticed to explore the possibility of migrating to this platform.

Why? Well, when I tried to create my first Silverlight Business Application template in Silverlight 4, I was surprised that the basic features of web application such as navigation and authentication are built in!

And because Silverlight runs on the client side with no post-back of pages (in the case of  traditional web apps), the GUI is more responsive – it is just like a windows application. It also runs in a sandbox so its security is comparable to a web application. Above all, there is no web browser rendering issue because it is run by Silverlight runtime. It is compatible with most web browsers on Windows and MAC OS X operating systems plus support to mobile devices such as Windows Mobile and Symbian 60. Linux platform is also supported via Moonlight.

Hmm… should I migrate now to Silverlight?

Not right now.. not until I can climb the 10-degree-slope learning curve of Silverlight.

The release of SQL Server 2008 R2 Express is a very exciting news both for developers and consumers. Not only it is FREE but it now comes with 10GB database storage. That’s a lot of data for small to medium enterprises. With the same advanced database engine as the full version of SQL Server 2008, I myself as a developer, is confident in using this database engine in mission critical applications.

But when the time has arrived that we have to deploy the application using Visual Studio 2008 Setup and Deployment Project, there is no SQL 2008 R2 Express in the Prerequisites options! That was a very frustrating one since we like that the installation should be as smooth as clicking next, next, install and finish.

Here is the solution I came up.

1. Download the SQL Server 2008 R2 Express installation setup
Download the 32-bit installer http://go.microsoft.com/?linkid=9729742
Download the 64-bit installer http://go.microsoft.com/?linkid=9729743

2. Go to folder  C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages. For 64 bit system, go to C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages

3. Under Packages foder, create a new folder SQLExpress2008R2.

4. Go to SQLExpress2008R2 folder and create a new file product.xml with the contents below. Download product.xml

<?xml version=”1.0″ encoding=”utf-8″?>
<!– SQL Express 2008 VS Bootstrapper : product.xml : Language neutral information –>
<Product xmlns=”http://schemas.microsoft.com/developer/2004/01/bootstrapper” ProductCode=”Microsoft.Sql.Server.Express.10.50″>
<RelatedProducts>
<EitherProducts>
<DependsOnProduct Code=”.NETFramework,Version=v4.0″ />
<DependsOnProduct Code=”Microsoft.Net.Framework.3.5.SP1″ />
</EitherProducts>
<DependsOnProduct Code=”Microsoft.Windows.Installer.4.5″ />
<IncludesProduct Code=”Microsoft.Sql.Server.Express.1.0″ />
<IncludesProduct Code=”Microsoft.Sql.Server.Express.9.2″ />
</RelatedProducts>
</Product>

5. Still in SQLExpress2008R2 folder, create a new folder named en.

6. Go to folder en. Create a file with name eula.rtf. I just put a word SQL 2008 in this file.

7. Create a file with name package.xml with the contents below. Download package.xml.

<?xml version=”1.0″ encoding=”utf-8″ ?>
<Package xmlns=”http://schemas.microsoft.com/developer/2004/01/bootstrapper” Name=”DisplayName” Culture=”Culture” LicenseAgreement=”eula.rtf”>

<PackageFiles CopyAllPackageFiles=”false”>
<PackageFile Name=”SQLEXPR32_x86_ENU.EXE” HomeSite=”SqlExpr32Exe” PublicKey=”3082010a0282010100bd3089fb4572a8536b9e894f0023c0bed41d3db1594038f373918226e696120053d91c820e3cce1dbbbdf7428d97d4fc381ae4b9f9e3ecd36103bfa0d3d6754d5c46a9ed5ef0d2e2695b1a73eab31c8d04cd2944a064592f1e985d6ec7ab18398265c4a7bcab758819ea87971426b37f2676a4d4383984e3b326d518f92be9d2c9165a5421f2978d878629fef4492ce68bf8043f7dcdcd9692860d7103e2d0fe0c4235ffd7b83fdd8e450a7df6d74bad5bf076721d77237d8935c41c5db250034b476d07a75588980680a681ad544ed881d6fabf42c031be550d99d553491230ebe5a5887c5ec47a5a148708b43769a0eb32248c08ebf9d414bae0fccdeaa4150203010001″/>
<PackageFile Name=”SQLEXPR_x64_ENU.EXE” HomeSite=”SqlExpr64Exe” PublicKey=”3082010a0282010100bd3089fb4572a8536b9e894f0023c0bed41d3db1594038f373918226e696120053d91c820e3cce1dbbbdf7428d97d4fc381ae4b9f9e3ecd36103bfa0d3d6754d5c46a9ed5ef0d2e2695b1a73eab31c8d04cd2944a064592f1e985d6ec7ab18398265c4a7bcab758819ea87971426b37f2676a4d4383984e3b326d518f92be9d2c9165a5421f2978d878629fef4492ce68bf8043f7dcdcd9692860d7103e2d0fe0c4235ffd7b83fdd8e450a7df6d74bad5bf076721d77237d8935c41c5db250034b476d07a75588980680a681ad544ed881d6fabf42c031be550d99d553491230ebe5a5887c5ec47a5a148708b43769a0eb32248c08ebf9d414bae0fccdeaa4150203010001″/>
<PackageFile Name=”eula.rtf”/>  </PackageFiles>
<Commands Reboot=”Defer”>
<!– Defines a new installation (x86) –>
<Command PackageFile=”SQLEXPR32_x86_ENU.EXE” Arguments=’/Q /HideConsole /IAcceptSqlServerLicenseTerms /Action=Install /Features=SQLEngine,SSMS /InstanceName=SQLEXPRESS /EnableRANU=1 /sqlsvcaccount=”NT AUTHORITY\Network Service” /AGTSVCACCOUNT=”NT AUTHORITY\Network Service” /AddCurrentUserAsSqlAdmin /SqlSysAdminAccounts=”BUILTIN\ADMINISTRATORS” /SkipRules=RebootRequiredCheck /SecurityMode=SQL /SaPwd=mypassword /TcpEnabled=1′ EstimatedInstalledBytes=”225000000″ EstimatedInstallSeconds=”420″>
<InstallConditions>
<FailIf Property=”VersionNT” Compare=”ValueNotExists” String=”GeneralFailure”/>
<FailIf Property=”VersionNT” Compare=”VersionLessThan” Value=”5.1.2″ String=”InvalidPlatformXP”/>
<FailIf Property=”VersionNT” Compare=”VersionEqualTo” Value=”5.2.0″ String=”InvalidPlatform2K3″/>
<FailIf Property=”VersionNT” Compare=”VersionEqualTo” Value=”5.2.1″ String=”InvalidPlatform2K3″/>        <FailIf Property=”AdminUser” Compare=”ValueEqualTo” Value=”false” String=”AdminRequired”/>        <BypassIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”Intel”/>
</InstallConditions>
<ExitCodes>
<ExitCode Value=”0″ Result=”Success”/>
<ExitCode Value=”1641″ Result=”SuccessReboot”/>
<ExitCode Value=”3010″ Result=”SuccessReboot”/>
<!– 0x84BE0BC2 (1214,3010) –>
<ExitCode Value=”-2067919934″ Result=”FailReboot”/>
<!– 0x84C10BC2 (1217,3010) –>
<ExitCode Value=”-2067723326″ Result=”FailReboot”/>
<!– 0x84BE0007 (1214,7) –>
<ExitCode Value=”-2067922937″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84C4001F (1220,31) –>
<ExitCode Value=”-2067529697″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84BE0001 (1214,1)–>
<ExitCode Value=”-2067922943″ Result=”Fail” String=”InvalidPlatformOSServicePacks”/>
<!– 0x84C4000B (1220,11) –>
<ExitCode Value=”-2067529717″ Result=”Fail” String=”AnotherInstanceRunning”/>
<!– 0x84BE01F8 (1214,504) –>
<ExitCode Value=”-2067922440″ Result=”Fail” String=”BetaComponentsFailure”/>
<!– 0x84BE01FA (1214,506) –>
<ExitCode Value=”-2067922438″ Result=”Fail” String=”BetaComponentsFailure”/>
<!– 0x84BE0202 (1214,514) –>
<ExitCode Value=”-2067922430″ Result=”Fail” String=”InvalidPlatformArchitecture”/>
<!– 0x84BE0203 (1214,515) –>        <ExitCode Value=”-2067922429″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <ExitCode Value=”216″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <DefaultExitCode Result=”Fail” FormatMessageFromSystem=”true” String=”GeneralFailure” />      </ExitCodes>    </Command>
<!– Defines an upgrade installation (x86) –>    <Command PackageFile=”SQLEXPR32_x86_ENU.EXE” Arguments=’/Q /HideConsole /IAcceptSqlServerLicenseTerms /Action=Install /Features=SQLEngine,SSMS /InstanceName=SQLEXPRESS /EnableRANU=1 /sqlsvcaccount=”NT AUTHORITY\Network Service” /AGTSVCACCOUNT=”NT AUTHORITY\Network Service” /AddCurrentUserAsSqlAdmin /SqlSysAdminAccounts=”BUILTIN\ADMINISTRATORS” /SkipRules=RebootRequiredCheck /SecurityMode=SQL /SaPwd=mypassword /TcpEnabled=1′ EstimatedInstalledBytes=”225000000″ EstimatedInstallSeconds=”420″>      <InstallConditions>        <BypassIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”Intel”/>      </InstallConditions>      <ExitCodes>        <ExitCode Value=”0″ Result=”Success”/>        <ExitCode Value=”1641″ Result=”SuccessReboot”/>        <ExitCode Value=”3010″ Result=”SuccessReboot”/>        <!– 0x84BE0BC2 (1214,3010) –>        <ExitCode Value=”-2067919934″ Result=”FailReboot”/>        <!– 0x84C10BC2 (1217,3010) –>        <ExitCode Value=”-2067723326″ Result=”FailReboot”/>        <!– 0x84BE0007 (1214,7) –>        <ExitCode Value=”-2067922937″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84C4001F (1220,31) –>        <ExitCode Value=”-2067529697″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84BE0001 (1214,1)–>        <ExitCode Value=”-2067922943″ Result=”Fail” String=”InvalidPlatformOSServicePacks”/>        <!– 0x84C4000B (1220,11) –>        <ExitCode Value=”-2067529717″ Result=”Fail” String=”AnotherInstanceRunning”/>        <!– 0x84BE01F8 (1214,504) –>        <ExitCode Value=”-2067922440″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE01FA (1214,506) –>        <ExitCode Value=”-2067922438″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE0202 (1214,514) –>        <ExitCode Value=”-2067922430″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <!– 0x84BE0203 (1214,515) –>        <ExitCode Value=”-2067922429″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <ExitCode Value=”216″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <DefaultExitCode Result=”Fail” FormatMessageFromSystem=”true” String=”GeneralFailure” />      </ExitCodes>    </Command>
<!– Defines a new installation (amd64) –>    <Command PackageFile=”SQLEXPR_x64_ENU.EXE” Arguments=’/Q /HideConsole /IAcceptSqlServerLicenseTerms /Action=Install /Features=SQLEngine,SSMS /InstanceName=SQLEXPRESS /EnableRANU=1 /sqlsvcaccount=”NT AUTHORITY\Network Service” /AGTSVCACCOUNT=”NT AUTHORITY\Network Service” /AddCurrentUserAsSqlAdmin /SqlSysAdminAccounts=”BUILTIN\ADMINISTRATORS” /SkipRules=RebootRequiredCheck /SecurityMode=SQL /SaPwd=9476444B-1A8F-438b-BAA2-6D635FC2A99E /TcpEnabled=1′ EstimatedInstalledBytes=”225000000″ EstimatedInstallSeconds=”420″>      <InstallConditions>        <BypassIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”amd64″/>      </InstallConditions>      <ExitCodes>        <ExitCode Value=”0″ Result=”Success”/>        <ExitCode Value=”1641″ Result=”SuccessReboot”/>        <ExitCode Value=”3010″ Result=”SuccessReboot”/>        <!– 0x84BE0BC2 (1214,3010) –>        <ExitCode Value=”-2067919934″ Result=”FailReboot”/>        <!– 0x84C10BC2 (1217,3010) –>        <ExitCode Value=”-2067723326″ Result=”FailReboot”/>        <!– 0x84BE0007 (1214,7) –>        <ExitCode Value=”-2067922937″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84C4001F (1220,31) –>        <ExitCode Value=”-2067529697″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84BE0001 (1214,1)–>        <ExitCode Value=”-2067922943″ Result=”Fail” String=”InvalidPlatformOSServicePacks”/>        <!– 0x84C4000B (1220,11) –>        <ExitCode Value=”-2067529717″ Result=”Fail” String=”AnotherInstanceRunning”/>        <!– 0x84BE01F8 (1214,504) –>        <ExitCode Value=”-2067922440″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE01FA (1214,506) –>        <ExitCode Value=”-2067922438″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE0202 (1214,514) –>        <ExitCode Value=”-2067922430″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <!– 0x84BE0203 (1214,515) –>        <ExitCode Value=”-2067922429″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <ExitCode Value=”216″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <DefaultExitCode Result=”Fail” FormatMessageFromSystem=”true” String=”GeneralFailure” />      </ExitCodes>    </Command>
<!– Defines an upgrade installation (amd64) –>    <Command PackageFile=”SQLEXPR_x64_ENU.EXE” Arguments=’/Q /HideConsole /IAcceptSqlServerLicenseTerms /Action=Install /Features=SQLEngine,SSMS /InstanceName=SQLEXPRESS /EnableRANU=1 /sqlsvcaccount=”NT AUTHORITY\Network Service” /AGTSVCACCOUNT=”NT AUTHORITY\Network Service” /AddCurrentUserAsSqlAdmin /SqlSysAdminAccounts=”BUILTIN\ADMINISTRATORS” /SkipRules=RebootRequiredCheck /SecurityMode=SQL /SaPwd=9476444B-1A8F-438b-BAA2-6D635FC2A99E /TcpEnabled=1′ EstimatedInstalledBytes=”225000000″ EstimatedInstallSeconds=”420″>      <InstallConditions>        <BypassIf Property=”ProcessorArchitecture” Compare=”ValueNotEqualTo” Value=”amd64″/>      </InstallConditions>      <ExitCodes>        <ExitCode Value=”0″ Result=”Success”/>        <ExitCode Value=”1641″ Result=”SuccessReboot”/>        <ExitCode Value=”3010″ Result=”SuccessReboot”/>        <!– 0x84BE0BC2 (1214,3010) –>        <ExitCode Value=”-2067919934″ Result=”FailReboot”/>        <!– 0x84C10BC2 (1217,3010) –>        <ExitCode Value=”-2067723326″ Result=”FailReboot”/>        <!– 0x84BE0007 (1214,7) –>        <ExitCode Value=”-2067922937″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84C4001F (1220,31) –>        <ExitCode Value=”-2067529697″ Result=”Fail” String=”AdminRequired”/>        <!– 0x84BE0001 (1214,1)–>        <ExitCode Value=”-2067922943″ Result=”Fail” String=”InvalidPlatformOSServicePacks”/>        <!– 0x84C4000B (1220,11) –>        <ExitCode Value=”-2067529717″ Result=”Fail” String=”AnotherInstanceRunning”/>        <!– 0x84BE01F8 (1214,504) –>        <ExitCode Value=”-2067922440″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE01FA (1214,506) –>        <ExitCode Value=”-2067922438″ Result=”Fail” String=”BetaComponentsFailure”/>        <!– 0x84BE0202 (1214,514) –>        <ExitCode Value=”-2067922430″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <!– 0x84BE0203 (1214,515) –>        <ExitCode Value=”-2067922429″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <ExitCode Value=”216″ Result=”Fail” String=”InvalidPlatformArchitecture”/>        <DefaultExitCode Result=”Fail” FormatMessageFromSystem=”true” String=”GeneralFailure” />      </ExitCodes>    </Command>
</Commands>
<Strings>    <String Name=”DisplayName”>SQL Server 2008 Express R2</String>    <String Name=”Culture”>en</String>    <String Name=”SqlExpr32Exe”>http://go.microsoft.com/fwlink/?LinkID=153228amp;clcid=0×409</String>    <String Name=”SqlExpr64Exe”>http://go.microsoft.com/fwlink/?LinkID=153229amp;clcid=0×409</String>    <String Name=”AdminRequired”>You do not have the permissions required to install SQL Server 2008 Express R2. Please contact your administrator.</String>    <String Name=”GeneralFailure”>An error occurred attempting to install SQL Server 2008 R2.</String>    <String Name=”InvalidPlatformXP”>Windows XP Service Pack 2 or later is required to install SQL Server 2008 R2.</String>    <String Name=”InvalidPlatform2K3″>Windows 2003 Service Pack 2 or later is required to install SQL Server 2008 Express R2.</String>    <String Name=”MissingMSXml”>SQL Server 2008 Express R2 requires MSXML. Please ensure MSXML is installed properly.</String>    <String Name=”InsufficientHardware”>The current system does not meet the minimum hardware requirements for SQL Server 2008 Express Service Pack 1. Contact your application vendor.</String>    <String Name=”InvalidPlatformOSServicePacks”>The current operating system does not meet Service Pack level requirements for SQL Server 2008 Express Service Pack 1. Install the most recent Service Pack from the Microsoft download center at http://www.microsoft.com/downloads before continuing setup.</String>    <String Name=”InvalidPlatformIE”>This version of SQL Server 2008 Express Service Pack 1 requires Internet Explorer version 6.0 with SP1 or later. To proceed, install or upgrade to a required version of Internet Explorer and then run setup again.</String>    <String Name=”AnotherInstanceRunning”>Another instance of setup is already running. The running instance must complete before this setup can proceed.</String>    <String Name=”BetaComponentsFailure”>A beta version of the .NET Framework 2.0 or SQL Server was detected on the computer. Uninstall any previous beta versions of SQL Server 2008 components, SQL Server Support Files, or .NET Framework 2.0 before continuing.</String>    <String Name=”InvalidPlatformArchitecture”>This version of SQL Server 2008 Express Service Pack 1 is not supported for the current processor architecture.</String>    <String Name=”InvalidUpgradeNotExpress”>The instance of SQL Server 2005 named ‘SQLEXPRESS’ is a not an instance of SQL Server Express. It cannot be upgraded to SQL Server 2008 Express R2.</String>    <String Name=”InvalidUpgradeNotExpressCore”>The instance of SQL Server 2005 Express named ‘SQLEXPRESS’ contains components that are not included in SQL Server 2008 Express R2. SQL Server 2008 R2 cannot upgrade this instance. Please use SQL Server 2008 Express with Advanced Services instead.</String>    <String Name=”InvalidUpgradeLanguage”>The instance of SQL Server 2005 Express named ‘SQLEXPRESS’ is a different language version than this SQL Server 2008 Express R2. SQL Server 2008 Express R2 cannot upgrade this instance.</String>    <String Name=”InvalidUpgradeWoW”>SQL Server 2008 Express R2 (x64) cannot upgrade the existing instance of SQL Server 2005 Express (x64 WoW) named ‘SQLEXPRESS’. Uninstall this instance of SQL Server 2005 Express and retry installing SQL Server 2008 Express Service Pack 1 (x64).</String>  </Strings></Package>

8.  Copy the SQL 2008 express installers you downloaded previously into folder en.

That’s it. Now if we look in our setup project prerequisite in Visual Studio 2008…

Enjoy installing the latest version of SQL 2008 Express.

As described by Microsoft at this link , “Microsoft Sync Framework is a comprehensive synchronization platform that enables collaboration and offline scenarios for applications, services, and devices. Using Microsoft Sync Framework, developers can build applications that synchronize data from any source using any protocol over any network.” I suggest you read more about the framework at http://en.wikipedia.org/wiki/Microsoft_Sync_Framework before you proceed.

However, I found this technology very hard to implement in my project which requires two SQL Express servers to be synchronized. Most of the samples dealt with SQL Server and SQL Server compact edition on the client side. And that was not my case.

With a week of googling and coding, I finally crack the solution. And I am happy to share you the easier way to learn this framework.

Requirements:
1. Install the Microsoft Sync Framework 2.0 Software Development Kit (SDK) that can be downloaded here.
2. Visual Studio 2008/2010

Assumptions:
1.  Server1 – with SQL Server Express installed
2. Client1 – with SQL Server Express installed
3. A table named “Customer” is created in Server1

Steps:
1. Provision the server first. This will create a tracking table of the selected table (Customer in our example), stored procedures and triggers so that can it can be used to synchronize the data. The following C# code will provision the server.

//server connection
SqlConnection serverConn = new SqlConnection(@”Data Source=.\sqlexpress;Initial Catalog=Test;Integrated Security=True”);
//scope name
string scope = “sync_customer“;
// Create a scope
DbSyncScopeDescription scopeDesc = new DbSyncScopeDescription(scope);
//GetDescriptionForTable gets the schema of the table, so that tracking tables and triggers
//can be created for that table
DbSyncTableDescription tableDetailsCustomer = SqlSyncDescriptionBuilder.GetDescriptionForTable(“Customer”, serverConn);
//add the table description to scope
scopeDesc.Tables.Add(tableDetailsCustomer);
//Create the scope provisioner
SqlSyncScopeProvisioning serverConfig = new SqlSyncScopeProvisioning(scopeDesc);
//We have to skip the creation of the table Customer because it is already created
serverConfig.SetCreateTableDefault(DbSyncCreationOption.Skip);
//Now we can provision the
serverserverConfig.Apply(serverConn);

And here is the provisioned server that was created.


Sweet, isn’t it? :)

But that’s only half of our work. We have to provision the client, too.

2. Provision the client.

//server connection
SqlConnection serverConn = new SqlConnection(@”Data Source=Server1\sqlexpress;Initial Catalog=Test;Integrated Security=True”);
//client connection
SqlConnection clientConn = new SqlConnection(@”Data Source=Client1\sqlexpress;Initial Catalog=Test;Integrated Security=True”);
//scope name
//this should be THE SAME with the scope name we provisioned
//in the server earlier
string scope = “sync_customer“;
//get the sync description from the server
//take note of the connection where we will get the description
//it should be the serverConn
DbSyncScopeDescription clientSqlDesc = SqlSyncDescriptionBuilder.GetDescriptionForScope(scope,serverConn);
//add description to scope provision
SqlSyncScopeProvisioning clientSqlConfig = new SqlSyncScopeProvisioning(clientSqlDesc);
//apply it
//take note that we have to apply to the client connection clientConn
clientSqlConfig.Apply(clientConn);

3. Now we can synchronize the two tables

//server connection
SqlConnection serverConn = new SqlConnection(@”Data Source=Server1\sqlexpress;Initial Catalog=Test;Integrated Security=True”);
//client connection
SqlConnection clientConn = new SqlConnection(@”Data Source=Client1\sqlexpress;Initial Catalog=Test;Integrated Security=True”);
//scope name
//should be equal to the one we provision in the server and client
string scope = “sync_customer“;
//create an orchestrator
SyncOrchestrator sync = new SyncOrchestrator();
//specify that we will upload to the server first then download from the server
sync.Direction = SyncDirectionOrder.UploadAndDownload;
//specify the client
sync.LocalProvider = new SqlSyncProvider(scope, clientConn);
//specify the server
sync.RemoteProvider = new SqlSyncProvider(scope, serverConn);
//synchronize it
sync.Synchronize();

I overheard two young guys most probably college students, talking about deleting files such that nobody will ever read that file again. This happened as I was sitting in a corner next to a coffee shop in Baguio City where a free WI-FI is available as I need to use my iPAQ to check my emails.

One guy advised to the other that after deleting a file, he should Empty the Recycle Bin to make sure no one will ever read that file again.

I just smiled and hoped that this guys will stumble upon this blog and be able to understand that their assumption is wrong.

Deleting a file in Windows does not actually delete the content of the file. It just removes the reference of the file in the file system so that you can no longer see it and the space used by the file will be re-used when Windows needs a space to write something. As long as the space used by the deleted file were not yet overwritten, you can still recover the contents of the file by using undelete tools like the FREEUNDELETE tool. I suggest you download this tool as it may come handy when you need one.

So how do we delete a file such that it will very difficult if not impossible that one will ever read the contents of that file again?

One answer is presented by Peter Gutmann in his paper. It proposes a technique to overwrite the content of the file 35 times with random and fixed pattern. Take your time to read this paper. You would be amazed how data is written into your hard drives and how it can be recovered.

A free, open source program that implements Gutmann technique to securely erase a file is Eraser. It was originally written by Tolvanen.

So next time you delete a file in your computer and wants that no one will ever read the contents, think again.

While searching on how to secure WCF, I stumbled upon this article.

SSL with Self-hosted WCF

This is a very helpful tool for developers like us to implement SSL without going to buy a certificate from a trusted Certificate Authority during the development stage of a product.

However, this self-signed certificate can also be used for production… until such time that the client can afford or be able to buy a trusted certificate of his/her own.

But what if the client does not want to buy a trusted certificate? Is the self-signed certificate good enough for its purpose?

Well, as long as the encryption strength used are the same, self-signed and trusted certificate are equally the same when the certificate is primarily used for securing the communication.

I recently attended a seminar conducted by Institute of Electronics and Communication Engineer of the Philippines – Cordillera Administrative Region Chapter now Institute of Electronics Engineers of the Philippines (IECEP-CAR CHAPTER) regarding Electronics and Communication Engineer (ECE) conversion to Electronics Engineer (EcE). The small ‘c’ in Electronics Engineer is put to distinguish between Electrical Engineer (EE) while the capital ‘C’ in ECE distinguishes between Electronics and Communications Engineer and Electronics Engineer respectively. It was held at University of Baguio, Baguio City, Philippines on March 2, 2008.

ece seminar

I was expecting to meet some of my old friends in college but that was never the case. Where are the Saint Louis University ECE Batch 1994?

Being an Electronics and Communication Engineer myself, I am concerned with this new Republic Act 9292 (RA9292) which is known as “Electronics
Engineering Law of 2004″. I was informed that we can no longer renew our license as an ECE from Professional Regulation Commission (PRC) when our license expires because of this RA 9292. In short, we have to convert from ECE to EcE.

As stated in RA 9292, this law is necessary to “develop and nurture competent, virtuous, productive and well-rounded Professional
Electronics Engineers, Electronics Engineers and Electronics Technicians whose
standards of practice and service shall be excellent, qualitative, world-class and
globally competitive through inviolable, honest, effective and credible licensure
examinations and through regulatory measures, programs and activities that foster
their integrity, continuing professional education, development and growth”

However, I am much concerned with the implementation of this law. I am appealing to the Local Government Units (LGUs) to make sure that this law is enforced so that we can achieve what is being defined in the law. It is high time that laws like should be implemented.

P.S. Field Programmable Gate Arrays (FPGA) in Telecommunications was also presented. Will this technology replace ASIC? That we have to watch out.

One of my functions has to insert to database multiple rows and multiple columns to SQL 2005 Express. In my C# code, I have to make a round trip call to each row that I have to insert.
Accidentally, I stumbled the new feature of SQL 2005 using native XML. Further searching and coding finally gets me to do a single call to insert my data that consist multiple columns and rows.
Here is the stored procedure:
CREATE PROCEDURE [dbo].[rproc_NewMember]
@EducationalAttainment xml
AS
BEGIN
INSERT INTO [dbo].[tblEducationAttainment]([sEASchool],[sEAYear],[sEADegree],[ixEducationalAttainmentType],[ixMember])SELECT R.Table1.value(’sEASchool[1]’,’varchar(100)’) as sEASchool,R.Table1.value(’sEAYear[1]’,’varchar(100)’) as sEAYear,R.Table1.value(’sEADegree[1]’,’varchar(100)’) as sEADegree,R.Table1.value(’ixEducationalAttainmentType[1]’,’int‘) as ixEducationalAttainmentType,@ixMember as ixMember
FROM @EducationalAttainment.nodes(’ea/Table1′) AS R(Table1)
END
Here is the XML:
<ea>
<Table1>
<ixEducationalAttainmentType>1</ixEducationalAttainmentType>
<sEducationalAttainmentType>Elementary</sEducationalAttainmentType>
<sEASchool>CWSC</sEASchool>
<sEAYear>1990</sEAYear>
<sEADegree>ELEM</sEADegree>
</Table1>
<Table1>
<ixEducationalAttainmentType>2</ixEducationalAttainmentType>
<sEducationalAttainmentType>High School</sEducationalAttainmentType>
<sEASchool>ASJ</sEASchool>
<sEAYear>1994</sEAYear>
<sEADegree>HS</sEADegree>
</Table1>
<Table1>
<ixEducationalAttainmentType>3</ixEducationalAttainmentType>
<sEducationalAttainmentType>College</sEducationalAttainmentType>
<sEASchool>SLU</sEASchool>
<sEAYear>1998</sEAYear>
<sEADegree>ECE</sEADegree>
</Table1>
<Table1>
<ixEducationalAttainmentType>4</ixEducationalAttainmentType>
<sEducationalAttainmentType>Others</sEducationalAttainmentType>
<sEASchool>STI</sEASchool>
<sEAYear>1999</sEAYear>
<sEADegree>CLIP</sEADegree>
</Table1>
</ea>
And here is the C# code:
string xml=”"; //set xml variable here
using (SqlConnection conn = new SqlConnection(@”Server=.\SQLEXPRESS;Database=mydb;Trusted_Connection=True;”))
{
using (SqlCommand cmd = new SqlCommand(“rproc_NewMember”, conn))
{
//set command type as stored procedure
cmd.CommandType = CommandType.StoredProcedure;
//add the parameter
cmd.Parameters.AddWithValue(“@EducationalAttainment”, xml);
//open connection
conn.Open();
//execute
cmd.ExecuteNonQuery();
}
}

While developing a module for our Coop System application, I found a quirk bug on Visual Studio 2008 Designer.

bugonvs2008.jpg

The bug is about an enabled timer in a User Control in a Form. When switching to View Code, you can no longer edit your code since the cursor is focused somewhere else.

Steps to reproduce.

  1. Create a C# Windows Forms Application.
  2. Create a User Control into your project.
  3. Add a timer into your User Control.
  4. Add a TextBox item to the User Control.
  5. Select the timer and set the Enable to True in the Properties.
  6. Double -click the Timer to add a Tick event.
  7. In the Tick event, write the following code: textBox1.Focus();
  8. Build the solution.
  9. After successfully building the solution, you can now see the User Control from the Toolbox.
  10. Drag the User Control to the Form1 (main form)
  11. Build the solution.
  12. On the main form, switch to View Code.
  13. Holla!!! Now, see the effect.

Download the sample solution here BugOnDesignerWithTimer.zip

When I was a child, I dreamt to be a successful lawyer, like my Uncle Elping. But it never happened. Instead, my younger sister Rhoda did it. She became an attorney-at-law.

During my high school days, new technologies emerged and so I dreamt to be a Computer Engineer, to be employed in the biggest and best company available. And of course with all the luxuries of a very high-paying job. But it never happened. Instead, I became an Electronics and Communications Engineer and established my own business.

When college days came, I dreamt to study in Manila – where the best and biggest universities are believed to fulfill my studies. But it never happened. Instead, I graduated at St. Louis University, Baguio City.

Every time I started counting my dreams with my fingers, I also started to count my ‘failures’ with my feet. Most probably, I should include your feet too, in my counting.

So, I ask myself. Am I successful in life? A question that is seems to be unfathomable. A question each of us is maybe asking right now.

clavhall_web.jpg That answer came to me just a few days ago in an unlikely manner.

It was late at night. Around 10:30PM. I was busy debugging one of my software under development, when my son passed by to get glass of water from our dispenser. (He usually do that at night.)

When he passed by I ask, “How’s your school?”

He proudly replied, “I got a star in my hand!” And he showed me a red star stamped at the back of his left hand. (If a student did a good job in school, he will get a star in the hand.)

I congratulated him, “Very good!”

He smiled and I kissed him good night.

I don’t know what came to my mind. But I realized how happy had been my child when he got that star. I realized how successful he was to himself.

One by one, I count the things I have done. As I recall each thing, I smiled and look at the back of my hand and I said to my self, “This could have been full of star if I did stamp my hand for every good job I did!”

Surely, being successful is not measured by the amount of money you got. It is not measured by material things you acquire. Nor it is not measured by the luxurious lifestyle.

Being successful is doing what you think is right and best in everything you do. Being successful is appreciating yourself for each good job you made. And don’t forget to stamp that star in you hand!

Originally posted at www.lakay-lakay.com

program HelloWorld;
begin
  writeln('Hello World');
end.

That was the first programming language I was in love with – Pascal. I was able to developed an anti-virus for Sayhawatpu (the most famous virus at that time in our school, St. Louis University, Baguio City, Philippines – 1990′s) and a generic anti boot-virus which I planned to sell but turned out to be a freebie to my friends.

My passion to Pascal died down when I was introduced to C programming language. I was amazed with its efficiency, ability to access low-level system access and its flexible syntax. Eventually, I moved to objected-oriented C++ where I developed my first ever commercial application, Breakpoint WinTimer.

I was not spared from the .NET technology storm in 2002. I co-developed a school system using ASP.NET – VB.NET in 2003. However, C runs deep to my blood so I shifted to C# in my choice of programming language.

For now, all our developments are made in C# using Visual Studio.

Follow

Get every new post delivered to your Inbox.