Blog ala Vidar

SQL, AppFrame and other cool technologies

Monthly Archives: March 2011

5 minutes interview #29 – Aleksandr Narožnij

First time I met Aleksandr was my first visit to Klaipeda, Lithuania. He was kind enough to pick me up at the airport in Palanga (about 45 minutes by car), even though it was late at night. Before I met him, he had been on my team at Omega AS, and from day 1 I knew we’d be good friends. Aleksandr has been my guide every time I’ve been in Lithuania, taking me EVERYWHERE, helping me buy boxers (yes, believe it or not, this is REALLY hard to find when you’re out of clean ones) and generally just being awesome! Aleksandr joined Omega in 2006 as a trainee while finishing his studies. He finished these 1,5 years ago, and has been working with PIMS in the Products-team since then.

What did you study?
I’ve been studying Computer Science at Klaipeda University for six years. I have defended the thesis “Efficiency of database table’s indexes” for my bachelor and “Implementation of decision making process’ rules model in a software system based on models transformation” for the master degree. I got excellent grades on both – true story 🙂
Studies were mainly held at the faculty of Natural Science and Mathematics; so you can imagine how many additional “important” subjects did we have: ecology, math of all various types and even social behavior deviation 🙂 Of course, I don’t remember much of what I’ve been taught, but I’m grateful to all my tutors for helping me master the main skill – skill of studying on my own.

What’s the biggest difference between being a trainee and a full-time employee in Omega UAB?
Trainee position in UAB is a dream job. After passing the standard Certification Program you are normally given some real projects to work with, however you are free to use part of your working time for exploring how things work. I came to Omega with some basic theoretical knowledge and learnt pretty much everything in practice. Many thanks to Vidar – he spent much time and effort with us trainees.
I still “google” a lot, but now I don’t have enough time to go deep into details – that’s the main difference.

At work, what’s in and what’s out of your comfort zone?
I’m a kind of a SQL guy, if you like. Anything directly related to SQL Server is what I really like working with, especially when it comes to tricky data-model questions and realization. I believe that well modeled and strictly implemented database integrity is a basis of any system of a perfect sound. There is so much to learn in the field; therefore I’ve started preparing myself for Microsoft exams.
I’m not a Web-guy for sure. I guess Web is the future, but at the moment I do not like working with web-apps.

You’re good at focusing on your projects. What’s your secret?
There is no secret – I like what I do and I do it with all responsibility. My projects are most often quite interesting and challenging. When your job is interesting and gives you satisfaction – that’s all you need to do it well. Even if I happen to work with some routine tasks, I always try making it interesting for myself.

You like taking pictures. Any favorite genre(s)?
Oh, yeah – I like the process of taking pictures. Especially when you are lucky enough to “catch” the right moment or emotion. I am always happy when I succeed in sharing the mood of the moment via a picture.
I was planning to organize something similar to a photo-club, which guys are having in Ølensvåg. Still have a desire for it, so – coming soon 🙂

Take a look at Aleksandr’s flickr album here.


Advertisements

SQL Server Licensing

Occasionally I get questions related to licensing, which is boring but necessary to know a bit about. There are many resources out there to help, but some might be more confusing than others. Therefore I’m posting this to give you a quick overview of how it works.

Two licensing types

Processor License; For physical servers you need one license per physical CPU. If you buy two quad-core CPUs, that’s two physical CPUs, not eight. In other words, you need 2 processor licenses. Now, if you have a virtual server, it’s a bit different. There you need one license per virtual CPU assigned to the virtual machine. If you have a virtual hosting machine, with two quad cores, running 4 virtual servers which each has access to 2 cores, and each of those virtual servers are running SQL Server, you need 4 * 2 processor licenses. Processor licensing is recommended if you don’t know how many users or devices that’s going to connect to your server(s), or the number of connected users/devices are so high it’s less expensive to buy processor licenses.

CALs; Using CAL-licensing you first need a server software license, and then one CAL per user or device connecting. NB! This is not concurrent users or devices. And, this is counting physical users/devices, not the number of SQL Server logins on your server.

Pricing

Edition Per Processor Software CAL
Enterprise $27,495 $8,592 $164
Standard $7,171 $898 $164

Editions

There are many editions of SQL Server, as most of Microsoft’s server products. Here are the most common ones.

  • Compact Edition; Mostly used in embedded system to help caching data, syncing or similar. Limited to 4 GB. This is completely free, but isn’t an adequate server.
  • Express Edition; Used for small databases with few users. Free, but limited to 1 CPU, 1 GB RAM and 10 GB (data file, not counting the log file).
  • Developer Edition; Same as Enterprise, no physical (or feature) limitations, but license limits you to development and testing only. $27 per developer, unlimited computers.
  • Standard Edition; Most common in medium size companies. Limited to 4 CPUs and 64 GB RAM. Some feature limitations. Pricing: see table above.
  • Enterprise Edition; Most common in big size companies. Limited to 8 CPUs and 2 TB RAM. Pricing: see table above.

To see which features are in each edition, please visit Microsoft’s “Edition Compare” at http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx

Example

A world-wide customer needs a SQL Server to run PIMS and other systems. They have already bought a server with 4 x quad-core CPU and put it in their in-house data center. All their offices are connected to their HQ with very good connections so no need for replication or similar. This customer has about 1.000 employees, each connecting to one or more of the systems on their new SQL Server. Enterprise Edition is probably the one you want to go for.

Server + CALs
License Price per # Total
Server $8,592 1 $8,592
CALs $164 1.000 $164,000
$172,592
Per Processor
Price per # Total
$27,495 4 $109,980


As you see in the tables, 2 physical CPUs are much cheaper than 1.000 CALs. In addition, you don’t have to worry about the customer adding new employees to the systems. Be aware though that the server license is per OSE (Operating System Environment), so if you run multiple virtual Windows Servers with SQL Server installed on each of them, you need one server license per virtual machine.

If you want to read more details visit Microsoft’s SQL Server information pages:
http://www.microsoft.com/sqlserver/2008/en/us/licensing-faq.aspx#licensing
http://www.microsoft.com/sqlserver/2008/en/us/pricing.aspx
http://www.microsoft.com/sqlserver/2008/en/us/editions.aspx
http://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx

5 minutes interview #28 – Roger Gullhaug

Roger is one of the board members in NNUG Haugesund. He’s active both in the user group and on twitter, which I really like. In addition to being an active community member, Roger works at Hatteland Computer as one of the technical dudes, creating their new framework in Silverlight. Since he’s a Silverlight-guru, I’ve exploited his knowledge when I was testing out developing in Silverlight. Very helpful guy, and might I add; VERY patient with me 🙂

Can you give us a little insight on what you do at Hatteland Computer?
I’m working as a developer in Hatteland Computer. For the last 2 years I have mainly worked with Silverlight. I have been technical responsible for our Silverlight client framework which will be used for all Silverlight development in Hatteland Computer in the future. The framework is focusing on solving the challenges of writing a large system in Silverlight. We have a plugin-based architecture which makes it easy to split a large system up into small maintainable pieces which can be deployed independently. Other main areas of the framework are to make it easy to connect to the backend, make it easy to develop multi lingual applications and take care of everything which has to do with navigation. The framework also includes a Widget framework which makes us able to easy develop customizable dashboards. In addition to writing the framework I have also worked on developing a new user interface for our Rambase ERP system. Our framework is built according to the needs for this new user interface. It has been a very interesting project, and we now have released the first beta version to some selected customers.

Hatteland is famous for RamBase. Could you tell us a bit about it?
Rambase is an ERP system developed by Hatteland Computer. It is a complete business system made up of modules for sales, customers (CRM), purchasing, warehousing, production, auctions, economics, specialized trade (retail), human resources and web shops. In addition to being an ERP system, Rambase is also the name of the database used by the Rambase ERP system. It’s a database system developed by Hatteland Computer where all data is stored in RAM.

Hatteland Computer also has another product called Autostore. Before starting working with the Silverlight framework I worked on Autostore. I’m still a little involved in this, but not much anymore. It’s a very cool product. Take a look at this video.

[youtube:http://www.youtube.com/watch?v=iyVDMp2bL9c%5D

What do you think about the community here in Haugesund?
The community in Haugesund is small, but good. When I was asked if I was interested in being part of NNUG Haugesund I didn’t hesitated. I hope the developer community will grow in the future. It’s really great to have someone like you Vidar in NNUG Haugesund, and I hope you will keep up the good work to bring NNUG Haugesund forward.

When are you going to have a session for us?
Hmm…. Suddenly it happens… but I’m a little shy when it comes to talking in front of many people. If I would hold a NNUG session it has to be on something I know really well.

What do you do when you’re not playing with Silverlight?
I have a wife and two children (3 and 6 years old) and I try to spend much time with them. I also got a new hobby – floor ball. I play together with some people from my neighborhood. Last summer I started cycling, and now that the spring is near I look forward to get on the bike again.

Links:
Blog
@RGullhaug

Dynamic SQL

Brrrrrrhhhh, that sounds nasty. It is, but sometimes there are no other ways of solving a problem. Here’s a couple of tricks that might help you on your way, and some tricks on how to use static SQL where you might have thought you needed dynamic SQL.

SET NOCOUNT ON

DECLARE @SQL AS NVARCHAR(MAX)
DECLARE @TableName AS NVARCHAR(128)

SELECT name AS TableName, CAST(NULL AS INT) AS RowsCount
	INTO ##tables
	FROM sys.sysobjects
	WHERE xtype = 'U'

WHILE EXISTS (SELECT * FROM ##tables WHERE RowsCount IS NULL)
BEGIN
	SELECT TOP 1
	  @TableName = TableName
		FROM ##tables
		WHERE RowsCount IS NULL

	BEGIN TRY
		SET @SQL = 'UPDATE ##tables '
		SET @SQL = @SQL + '	SET RowsCount = (SELECT COUNT(*) FROM  [' + @TableName + '])'
		SET @SQL = @SQL + ' WHERE TableName = ''' + @TableName + ''''
		EXEC (@SQL)
	END TRY
	BEGIN CATCH
		UPDATE ##tables
			SET RowsCount = 0
			WHERE TableName = @TableName
	END CATCH
END

SELECT *
	FROM ##tables
	ORDER BY RowsCount DESC

DROP TABLE ##tables

This is one way of looping through tables, doing something with each. In this case doing a COUNT(*), but you can also use it to update statistics or similar.

There’s another way of doing it. NB! This is using sp_MSForEachTable which is an UNDOCUMENTED stored procedure, so use it on your own risk (it might get depricated with no notice!).

DECLARE @SQL AS NVARCHAR(MAX)

CREATE TABLE ##tables2 (
	TableName NVARCHAR(128),
	RowsCount INT
)

SET @SQL = 'INSERT INTO ##tables2 (TableName, RowsCount) '
SET @SQL = @SQL + 'SELECT ''?'', COUNT(*) FROM ?'
EXEC sp_MSForEachTable @SQL

SELECT *
	FROM ##tables2
	ORDER BY RowsCount DESC

DROP TABLE ##tables2

As you see, this is much less code. You can also do the same for databases with sp_MSForEachDb.

Another cool thing you can do with dynamic SQL is to get values back from it. In other words, we can rewrite our little script which counts records in each table to execute the COUNT in dynamic, but get the results from this and updating our table in static SQL. This way, we don’t have to use global (##tables) tables.

SET NOCOUNT ON

DECLARE @RowsCount AS INT
DECLARE @SQL AS NVARCHAR(MAX)
DECLARE @TableName AS NVARCHAR(128)

SELECT name AS TableName, CAST(NULL AS INT) AS RowsCount
	INTO #tables
	FROM sys.sysobjects
	WHERE xtype = 'U'

WHILE EXISTS (SELECT * FROM #tables WHERE RowsCount IS NULL)
BEGIN
	SELECT TOP 1
	  @TableName = TableName
		FROM #tables
		WHERE RowsCount IS NULL

	BEGIN TRY
		SET @SQL = 'SET @RowsCount = (SELECT COUNT(*) FROM [' + @TableName + '])'
		EXEC sp_executesql 
			@SQL, 
			N'@RowsCount INT OUTPUT', 
			@RowsCount OUTPUT

		UPDATE #tables
			SET RowsCount = @RowsCount
			WHERE TableName = @TableName
	END TRY
	BEGIN CATCH
		UPDATE #tables
			SET RowsCount = 0
			WHERE TableName = @TableName
	END CATCH
END

SELECT *
	FROM #tables
	ORDER BY RowsCount DESC

DROP TABLE #tables

5 minutes interview #27 – Jan Ove Halvorsen

This is one of the most active guys in the community here in Haugesund. When I was thinking about starting a Microsoft-related User Group in the district, he had the same plans. He sent me an email asking if I was interested in starting it with him. That is now 3 years ago, and the UG is still up and running. Now I’m the chapter lead, and he’s the one responsible for communication with the other chapters in Norway etc. We might switch on these roles. He’s held several sessions both for NNUG and Omega AS, and we hope he’ll continue with this! Lately he joined a new company called Appex AS together with another board member of NNUG Haugesund; Tore Fremmersvik.

What’s your role in Appex?
My official title is “Technology Director”.  However, short-term I am first and foremost a fulltime consultant delivering system development services to pretty much the same customers I was already involved with before joining Appex.  Longer term it is our plan that my role will be gradually more and more in line with my title.  I will be responsible for the quality of our strategic decisions on technology and methodology.  It means I will not necessarily take the decisions, but will be responsible for the quality of the process leading up to a decision, and the implementation of decisions in these areas.  This also includes being responsible for our plans related to continuous improvement of our competence and knowledge.  Having said that, I anyway guess I will continue to do consulting in parallel for some years still.

What did you do before you joined Appex?
My education is actually within the areas (micro-)electronics, physics and mathematics.  However, all my professional life (20+ years) has been mostly about software.  I worked at Hatteland pretty much all through the 90’s, where I was involved in building the famous RamBase system.  In 2000 I joined Hydro Aluminium’s Rolled Products sector as a senior systems consultant.  During those years I was heavily involved in a major project called MACH2.  MACH2 is a production management system used by the two Norwegian rolling mills, at Karmøy and in Holmestrand.  In 2005 I took on the challenge as IS/IT-Director for these two plants, with full responsibility for the whole IS/IT domain.  But the geek in me conquered in the end.  I really enjoyed that position, but felt I drifted farther and farther away from what I love the most: programming.  So, in 2007 I left Hydro and set up my own consultancy, Halvorsen Consulting AS.  I had three nice years doing various software development tasks for a small number of clients, before I decided to join Appex less than half a year ago.

Why do you like being active in our community?
I have always been focused on and interested in knowledge sharing.  And the fact is that the process of diving deep into a new subject, build up insight on that subject and then share that insight with others is a remarkably giving thing to do.  I actually feel I get more back from doing something like that than I’m giving away.  This may sound like something I’m obliged to say, but it’s actually true.  However, I realize this takes some confidence to do.  I would never even consider doing that unless I feel the subject is something I could master.  If you asked me to learn to play the piano and have a NNUG session about it, I would shake my head wildly.  But ask me to have a NNUG session about LINQ (in C# !!), and you will see a big smile…

Are you planning any new sessions for NNUG?
Since I’m these days involved in a deep romance with a beauty called Silverlight, I can see something related to that on the horizon…  I’m also very excited about what is happening on the parallel programming area with .Net/C#, both in .Net/C# 4 and even more so in .Net/C# 5, so something related to that could also be coming up…

What do you do when you’re not in front of your computer?
I have a family, who by the way is quite forgiving when it comes to romances like the one mentioned above, so most of the not-in-front-of-the-computer time takes place in the family domain.  I am also an online gamer (hmmm… that I guess in fact counts as in-front-of-the-computer time…).  Lord of the Rings Online (LOTRO) it is.  I have been playing the same elf character, a so-called “tank”, actually for 2-3 years now.  I love the social dimension of online gaming, although it in periods sadly has to get very low priority.  As a long-term admirer of J. R. R. Tolkien’s fantasy world I just had to try when the game was launched, and I have since then been lost.  Quite interesting to be questing through Middle-Earth, fighting hordes of nasty orcs, goblins and worse creatures, at the age of 40+, together with people of all ages from all around Europe, and even beyond.

Links:
Appex AS
@JanOveH

5 minutes interview #26 – Matthew Velic

About a year ago I saw a video with a guy entering a “SQL Cruise contest” on twitter. At first I thought it was a joke, but it was well made and it made me smile. After that I kept seeing @mvelic and started reading his blog. He’s active in the SQL community (both on twitter and in real life), and has written several good blog-posts.

So, who are you Matt?
I’m a just a guy, originally from Cleveland, OH, and now living and working in Washington, DC. I moved here during college: I majored in Fine Art. I built sculptures and did installations with video and websites and even yarn. After graduation I made the conscious decision to not starve to death, and so I laid down my tools and went to work. I temped around DC, as is fairly average for graduates, but I was a step ahead of most because I had worked while in college. Most of my experience was in fund raising support and office administration.

How did you end up as a DBA?
Well, that’s where the story gets interesting. My final temp gig landed me at the Elizabeth Glaser Pediatric AIDS Foundation. They needed help through a database conversion and when I showed some aptitude for that project, they hired me full time to do data entry and fund raising support. A little over a year into the position, the official DBA was let go and his database administration tasks fell to me. At first I really didn’t know what I was doing, but with the community’s help, I was able to overcome many of my shortcomings in a small timeframe.

How do you find time to be active in the community?
I won’t lie, it’s tough sometimes. There are nights (and weekends) where I want to pick up the Xbox controller rather than work on blog posts or troll the internet for new SQL Server resources. But I enjoy doing it. I like to write, and I like to teach, and I like to share what I find. I hope I can continually get better at all these things.
And I won’t claim to be unselfish either: sharing can be a career growing activity. But as I came from an untechnical, temp-job background, I’m so glad to have a career!

If you should pick one thing, what’s the best thing about an active community?
There are so many great things about an active SQL Server community. Based on where I’m at in my life right now, the Best Thing is the feeling of support and camaraderie. I’m a one-man shop covering our fund raising systems. But I have no support. No one to ask advice, kick around ideas, or make plans. Especially through Twitter, I can get this support from the community and it’s filled that vacuum.

What do you do when you’re not in front of your computer(s)?
There’s non-computer time? Lately I’ve been reading fiction again: finished The Book of Lost Things by John Connolly, The Magicians by Lev Grossman and working on Snow Crash by Neal Stephenson. If you couldn’t tell, I’m a bit of a sci-fi and fantasy nut. I’ve also been known to partake in strategic board games from time to time, and I do enjoy good food (home cooked or going out). And when things get heavy, I break out the acoustic.

Blog: http://mattvelic.com/
Twitter: http://twitter.com/mvelic