General: Recursive Programming

So what is recursive programming?  As someone who took up Computer Science, this is something you learn in school but never really used it at work.  Unless you work in a specialized field, it is not something that one might use when programming business applications.

Remember Fibonacci?  Fibonacci numbers are defined as the sum of the two preceding numbers.

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, ...

I still remember Fibonacci because I was given a test on it in my job interview 4 years ago.  In fact, I blogged about it here.  You can use a loop function to program Fibonacci, but a recursive function is the way to go, as in below:

public int fibonacci(int n)
{
if (n <= 0) return 0;
else if (n == 1) return 1;
else return fibonacci(n - 1) + fibonacci(n - 2);
}

You can use recursive functions to implement linked lists and binary search as well.  Go to this link to quickly refresh yourself on recursive programming.

General: On a 64-bit OS/machine, what will be the issues in running your application that uses Access database directly or indirectly using SQL Server’s Linked Server object

If you have an application, say in .NET, that uses an Access database in some way or the other, or uses SQL Server that in turn links to an Access database through the Linked Server object, and you want to run your application and also the SQL Server on a 64-bit OS/machine, you might be in for a lot of surprises.

 

Here is why:

  • The Microsoft.Jet.OLEDB.4.0 is only available on 32-bit.  Same with Microsoft.ACE.OLEDB.12.0 if you are using a later version of Access like 2007 and up.  You can still run them on a 64-bit OS/machine in WoW64 (a subsystem in 64-bit Windows that allows 32-bit applications to run on them).  Only problem is that the application that uses them need to run in 32-bit mode.  So much for running your application on 64-bit eh.  But fear not, there is a solution, although many of you might stay away from it, and that is linking your Access database in SQL Server and  having your application connect to the SQL Server instead.  So now you can run your application in 64-bit mode.

 

  • If you have a SQL Server that links to an Access database through the Linked Server object, you cannot install a 64-bit version of SQL Server on a 64-bit OS/machine or else your linked server to the Access database will not work.  You have to install a 32-bit version of the SQL Server.  Yes, that is the only solution, for now, until Microsoft comes up with a 64-bit version of the Access database engine, if that will still come.

 

  • If you have created a link to your Access database from your SQL Server, you might encounter a similar collation problem below when running your T-SQL queries involving joins to the linked server Access database:

Cannot resolve the collation conflict between “Latin1_General_CI_AS” and “SQL_Latin1_General_CP1_CI_AS” in the equal to operation.

 

One way to solve this problem is by adding the COLLATE DATABASE_DEFAULT to every text fields that you are comparing with either on the WHERE or JOIN clause, such as the example below:

SELECT *
FROM 
    SQLServerTable1 s
    INNER JOIN LinkedServerAccessDB...AccessDBTable1 AS a
        ON s.DateField1 = a.DateField1
        AND s.IntField1 = a.IntField1
        AND s.TextField1 COLLATE DATABASE_DEFAULT = a.TextField1 COLLATE DATABASE_DEFAULT
        AND s.TextField2 COLLATE DATABASE_DEFAULT = a.TextField2 COLLATE DATABASE_DEFAULT

 

 

  • Be aware that in using a linked server to an Access database that any DELETE statements that you execute within a transaction (where you can commit or rollback) will not work (at least for me it did not work) and will give you the below error message:

The requested operation could not be performed because OLE DB provider “Microsoft.Jet.OLEDB.4.0” for linked server “LinkedServerAccessDB” does not support the required transaction interface.

 

Solution to this is to bring all DELETE statements out of the transaction and execute them after committing the transaction.

 

So that’s it for this topic.  If you have any questions, feel free to comment :).

General: C#, HTML, CSS, Javascript, AJAX

My previous job requires me to work on C#, and occasionally on HTML, CSS, Javascript, and AJAX.  To be honest, I like C# more than VB.NET, being a C programmer for a while way back starting from University days and was very good at it.  So I created a C# category on my blog because I plan on keeping my C# skills and improving on it.  I also created a Web UI category where I can put all my notes about HTML, CSS, Javascript, AJAX, and more.  I don’t use these skills much but since I wanted to work more on the front end of web development for some time now, I plan to keep these skills up to date and what better way to do this is to make use of the W3Schools site.  So I added a link to the website under Favorite Links.  I am so excited about these technologies that I can’t wait to be blogging more often.  Happy blogging!

General: If we have Cloud, then what is SaaS? What about ASP?

I was going through some job description that I was applying for and stumbled upon this tech jargon multi-tenant describing a data architecture, which I will be talking about on a separate post under SQL Server.  I searched the Internet and found out that this tech jargon is actually common in the SaaS, Cloud or ASP space.  From my limited understanding, these spaces deal, in one way or the other, with delivering software as a service.  As it turned out, multi-tenant means serving multiple clients or tenants and that makes logical sense when talking about these spaces.  But now I wonder, is there any difference between these spaces.

ASP stands for Application Service Provider.   So it’s actually a company that specializes in providing software as a service.  An ASP runs or hosts applications on behalf of the clients.  The clients pay or subscribe for that service.  How this software is delivered to the clients is what differentiates one from another ASP.  These ASPs initially delivered software through virtualization and for some client-server applications, the client side components of the application are installed on the users’ computers.  Nowadays, with Internet technologies, these applications are now delivered through browsers with no need for any installation on the users’ computers.

SaaS stands for Software as a Service.  So this is a type of software delivery model used by ASPs.  In an ideal situation, the application being provided to the clients is a multi-tenant application –  only  one running application servicing multiple clients or tenants.  Other ASPs employ a multi-instance application – for each client or group of clients, an instance of the application is running, thus multiple applications are serving multiple clients.

Cloud does not stand for anything.  If talking to non-technical people, it would make more sense to say Cloud Computing.  Cloud is more than SaaS.  In fact SaaS is just one type of service provided by Cloud.  Cloud is basically where one would go to use a computing resource that is delivered over a network, much like a SaaS.  But it’s not only software that is available in Cloud.  In fact, Cloud also provides the following types of services: IaaS (Infrastructure as a Service), PaaS (Platform as a Service), and NaaS (Network as a Service).

Hopefully this clears up some confusion.  I have not provided enough description but enough to get one in the right direction.  As always, Internet is the best resource if you need to dig further in these technologies.

EDIT: How Cloud Computing Works explains what “cloud” is all about.

General: Getting certified

I’m excited to start in my new job next week.  I can’t wait.  Now that everything seems to be going back to normal (hopefully it stays that way), I plan on getting back on track to certify myself on .NET.  I browsed the Microsoft certification website and it seems getting certified with .NET Framework Foundation is a good bet.  Not only it applies to .NET 2.0 but to .NET 3.5 as well.  Again this blog will serve as my notes as I study for this certification.  Wish me luck!