Potpourri
I have a lot of comments from readers on different topics that have been accumulating. So, today I’m going to catch up on some of the backlog.
Marty reminds us that there is a need for people who can get software to work together…something that becomes more critical as underlying tools for valuable assets are deprecated.
Not only am I seeing the issue of multiple database platforms (in SQL Server AND Oracle in my case), but I am also seeing issues with old applications and software, and interfacing issues to later versions of SQL Server and/or Oracle. These issues include things like Access applications using an older version of Access, but needing to interface to a newer version of SQL Server (eg. linked tables function). Also, I run into a lot of ODBC interface issues now with the advent of multiple database versions AND o/s changes (ie. 32 bit to 64 bit).
The latter issue is for both Oracle AND SQL Server. It has made me somewhat more ‘valuable’ being the only old-timer (over 36 years in the business) who can ‘flange’ or paste-together the various software involved…
Ian writes in seeking direction for hosting SQL Server in a VM environment…Anybody have any experience or tips you might be able to share?
We have a MS SQL 2008 R2 express installation on a VM. If the entire VM node reboots then the SQL service fails to come up. Restarting the VM in isolation results in a running service. We have put the SQL service on delayed start and the actions for the service being stopped as restart for all counts of the service being stopped. The VM service supplied by openmindhosting.com they are secretive about when their VM node restarts – which suggests to me that the answer is to move hosts but in the short term is there a good monitoring application that someone can suggest (or some sequence of batches etc)?
Talking about Immutable objects from yesterday’s editorial Ira writes:
I am semi-regular reader of the sswug newsletter. Your article on Immutable Objects had potential, but it is badly in need of editing.
I read it and immediately noticed that
1. You don’t bother to define Immutable Objects
2. Your example of the .NET class is not really relevant
3. You have at least one instance where you ask a question, but can’t be bothered with a question mark.
Editor:
Thanks Ira for keeping me honest. Let me see if I can do a better job today? <– Question Mark 🙂
Immutable objects are objects that are immutable (horrible definition, I know). In short, once the data is created within the object, it can never be modified. Immutable objects do not expose properties. Instead, the objects are maintained through constructors or other methods. If the state of the object is modified then a new object is returned.
I tend to write our software with mutable objects. Most of my classes are full of read/write properties allowing the state of the class to be modified. Immutable objects will not allow this kind of activity. My simple class demonstrates this by having read only properties. The only way you can modify the contents of the class is to either create a new instance or to call the transform method. Either method returns a new variable, and the original variable, if there is one, is left intact.
The Wikipedia entry had a good example of the ToLower() method on a string class. When calling the ToLower() method it does not modify the internal representation of the string instance. Instead, it returns a new string with all the characters modified to lower case. This is a good example of immutable.
The problem I presented really didn’t have as much to do with Immutable objects as it could have. It was simply the train of thought I was following that brought the concept to mind.
Martin was intrigued with the Exercise of transferring the value from a to b , and b to a, without using a third variable using TSQL. It looks pretty much the same as many of the Java examples I saw.
declare @a as int
declare @b as int
set @a = 3
set @b = 5
select @a, @b
set @a = @a + @b
set @b = @a - @b
set @a = @a - @b
select @a, @b
Alex got the same result using Bitwise methods which is something I have started using more often in SQL Server. If you think about it, the two techniques are essentially the same using a different operator.
I’m sure your reason for discussing this solution was for edification. However, I think that you should have mentioned what I think is the most elegant solution to this particular problem. If the language you are using provides an Exclusive OR, three successive XORs with the same two variables will result in their values being swapped. For example, in binary:
Given: A = 11011 , B = 01101
A = A xor B -> A = 10110, B = 01101
B = A xor B -> A = 10110, B = 11011 (B now has A’s original value)
A = A xor B -> A = 01101, B = 11011 (A now has B’s original value)
I may have had reason to use this on one occasion, but it is interesting and has always stuck with me.
That’s about it for this week. If you have any comments you’d like to share, or tips for Ian’s virtual server problem, please send them to btaylor@sswug.org.
Cheers,
Ben
$$SWYNK$$
Featured White Paper(s)
All-At-Once Operations
Written by Itzik Ben-Gan with SolidQ
SQL supports a concept called all-at-onc… (read more)