Blog ala Vidar

SQL, AppFrame and other cool technologies

Category Archives: Published

5 minutes interview #11 – Jan Christian Brataas

Me and JanCB are like SQL Server 2008 and Windows Server 2008. We’re a great team, mostly agreeing about almost anything. He started in Omega back in 2004, and he’s been in the IT-department all the way till about 6 months ago when he moved to technology. He’s been the main IT-guy since Eiolf started in Ølen Betong a couple of years ago. Together, we’ve built the new server room, and have had the responsibility of "running" all Omega’s servers. Sometimes he calls me at 23:00 just to chat about a new feature he found somewhere. I LOVE people with enthusiasm and I guess that’s one of the reasons why I like working with this guy! You can visit his blog here.

How did you start at Omega?
I had taken the exam to get my Service Electrician diploma and wanted to get into the university but needed to take some classes first so I moved to Ølen from Moss 6 years ago to take math and physics on Ølen VGS. I got an interview with Omega and a job for E134 through Omega. E134 was a firm that was created by all the main Firms in Ølen and had in mind to get everyone in Ølen on Broadband because Telenor did not want to use money to build out ADSL. After a year with this it was servers and network with Eiolf Berge.

What do you prefer working with? Servers or coding?
Before I tried .NET and T-SQL I was always saying that coding was for sissies, the real deal is servers, but after doing some T-SQL I understood that this was interesting and after touching VB I got it. Coding isn’t for sissies! 🙂 I love servers of course, but after getting to work with CR3 and doing tasks for MarketMaker I’m now 70/30 for coding. There are things in the server world that I haven’t touched but want to try, but Omega’s server and network infrastructure is more or less as it should be to suite Omega and we don’t need BIG changes as we did two years ago. So for me now to have time to learn coding in a real world scenario is just perfect!

Do you have any other hobbies except computer stuff?
Right now I’m training to Technology Iron Man. If I manage I’ll get someone to film the last competition, the Triathlon, and post it out. I don’t have any hobbies actually other then the PC and electric stuff, but when we got the time we try to fish and hiking at our mountain cabin. It’s maybe not a hobby, but it will take some years to get my two girls at home addicted to computer stuff 🙂 By the way, it’s not always fun to be Ken!

Trackmania

About a half year ago my uncle died and I had to find something to keep me busy, to not think too much. I started playing Trackmania Nations, a free race game. Since then I’ve played a couple of times a week, because I’ve found out that I can’t keep playing with SQL and other servers 24/7. So why not play with SQL 12 hours a day, and then use the rest of the day for Trackmania?! 😀 I’ve never been able to play the same game over and over again, for more than a couple of days, but this have kept me “busy” for almost 6 months now. So why am I blogging about this now? The about page says that “The purpose of this blog is to tell you about all new tips and tricks that I learn”. This is, in my mind, a good tips for you guys. Yeah, some of you might say that I need a girlfriend, but I don’t have time for that. After all, SQL server takes most of my hours 😉 Anyhow.. A bit about this game

Trackmania Nations is a racing game where you have the same car (you may change the looks of it, but the steering, speed etc is the same). You can either race against time (to get medals), or you can connect to servers and play with others. At the moment my ranking is:

Norway: 1 321 of 68 866 players
World: 62 550 of 2 963 861 players

I’ve got 60 000 LP, what ever that is and 173 medals.

Today I joined a clan. I’ve never been in a clan before, but I thought that if Yan Friis (a famous Norwegian radio-dude) can play World of Warcraft at the age of 57 and talk about that on radio, I can join a clan in my favorite game, although all the other members are younger than me! So, sign up (it’s free) and join me at the “TT Norwegian Tech Tracks” server, and I’ll burn your ass! My nick is TTtican (TT is the clan..)

5 minutes interview #10 – Kenneth Steinsvik

Before I started at Omega I worked at Clas Ohlson. Kenneth also had a summer job there and we talked a lot about computer stuff. Mostly Linux, but also some other things. Kenneth was in technology and he’s actually the one who "recommended" me for Johnny, so thanks again Kenneth 😉 NB! Remember to visit the CMS blog by Kenneth here.

How did you start at Omega?
About 5 years ago I was finishing up school and I saw an ad in the local news paper. I put in my application for the job and got an interview with Sigmund, Torgeir and Arne Gunnar. I was lucky and they offered me a job the same night. Since then I have learned a lot and it has been some great years working for Omega.

You only were in technology for a couple of months? What else have you been doing?
I started working in Omega as a part of the technology group, mostly focusing on the CR2 framework and developing internal applications. I was there for about 6 months, before one day Sigmund asked me to go and help out the Mechanical Completion group at the KEP 2005 project at Kårstø. This was my first experience working with PIMS CMS. I really liked it and since then I have been working for various clients around the world. When I have not been travelling, I have worked closely with Svein Tore developing our product. Right now I am located in Canada and I spend my days either working for clients, developing PIMS CMS or doing sales.

You’ve been traveling a lot. What’s your favorite destination?
For work, my favorite place is Perth, Australia. This was my first international assignment setting up PIMS CMS for Clough Oil and Gas. I worked there for about 3 months and had a great time! For holiday, it is a pretty close race between Tuscany (Italy) and the Greek Islands. They are both great destinations and I would love to go back.

Do you have any hobbies except computer stuff?
I like to stay in shape and try to go to the gym, play squash or go for a hike. In the winter time I like snowboarding and skiing. I can recommend the Rocky Mountains in Canada for everyone that enjoys the snow. The skiing there is awesome! Besides that, I also enjoy travelling. When we got the chance, my girlfriend and I try to travel to somewhere new.

What’s happening in CMS nowadays?
PIMS CMS has become a really strong product over the last couple of years competing head to head with the other top completion management systems. As a result of this we have a lot of exciting international opportunities. I just came home from a week in Rio de Janeiro and earlier this year I spent a couple of months in China. Product wise, we are constantly working on making our product stronger, more flexible and as user friendly as possible for the end users.

NNUG Haugesund – September 2009

September 29th at 18:00 there will be an NNUG Haugesund meeting at Hemmingstad Kultursenter in Haugesund. Arild Røksund will talk about SQL Tuning. Some of you might have listened to me talk about this topic, but wait till you hear Arild! He’s like the über guru! Jan Ove Halvorsen will also have a 15 minutes zip-talk about .NET RIA Services. I’ve ordered pizza, soda and coffee (nice mix?) to 19:00. Remember to sign up. Oh, did I mention it’s free?!

Sign up here: http://www.nnug.no/Avdelinger/Haugesund/Moter/NNUG-Haugesund—September-2009/

Active Directory support in AppFrame

Most of you probably know what AD (Active Directory) is, but for you who don’t, it’s a (LDAP) directory service from Microsoft. This enables you to have all user, group and policy management in one place, instead of on all your servers. Most of the systems engineers in Omega have an AD user, which is a member of the SystemsEngineers group. This group has access to the test servers most system engineers need access to. Before we started using AD, when a new guy got hired, we had to manually go in to every server he needed access to, create a local user and add him to the local administrators-group. Now we just add a new user in AD, add him (or her) as a member of the SystemsEngineers group and he is now able to log on to all the servers he needs to, with the same username and password. Neat?

In AD you also got something that’s called an organization unit (OU). This is used to separate objects in the directory. For example could there be one OUs called Omega, OmegaIAT, and OmegaPS. Under these we would put the users, groups etc associated with those OUs. You can also have nested OUs, which means that in the Omega OU you can have one OU called Users, another called Groups, and a third called Servers. This is just to make things easier to find in the directory.

So, what does this got to do with AppFrame? Most of our customers, and also our selves are using AD, and it would be nice to be able to log on automatically into AppFrame without having to type your username and password, right? We already support this, in some degree. You can add a user to AppFrame just by adding his username. For example “COMPANY\User1”. But, what if you want to have a group in AD where you can add users, and those users would automatically be added in AppFrame? Here is an example of code that you would need. For this example we’ll use the domain “MyCompany.com”. Our domain admin have created a group called “AppFrameUsers” which is placed in the OU Office1, Department1. (Department1 is a sub OU of Office1).

First we need to create a linked server from SQL to AD:

EXEC master.dbo.sp_addlinkedserver
	@server = N'AD1',
	@provider=N'ADSDSOObject'

EXEC master.dbo.sp_addlinkedsrvlogin
	@rmtsrvname=N'AD1',
	@useself=N'False',
	@locallogin=N'JobLogin',
	@rmtuser=N'MyCompany\MyUser',
	@rmtpassword='MyDomainPassword'

We create a server “AD1”, where we link the login (“JobLogin”) that is going to run the script under in the job to our domain user (“MyCompany\MyUser”).

DECLARE @SQL AS NVARCHAR(MAX)
DECLARE @Domain AS NVARCHAR(20) = 'MyCompany'
DECLARE @TopDomain AS NVARCHAR(6) = 'COM'
DECLARE @OrgUnit AS NVARCHAR(200) = 'OU=Department1,OU=Office1'
DECLARE @GroupName AS NVARCHAR(200) = 'AppFrameUsers'
DECLARE @TemplateUser AS NVARCHAR(128) = 'AppFrameTemplateUser'

SET @SQL = '
	SELECT
	  givenName AS FirstName,
	  sn AS LastName,
	  mail AS EMailAddress,
	  sAMAccountName AS Username,
	  mobile AS MobileNumber
		INTO ##ADUsers
		FROM OPENQUERY(adsi3, ''SELECT givenName, sn, mail, sAMAccountName, mobile
				FROM ''''LDAP://DC=' + @Domain + ',DC=' + @TopDomain + '''''
				WHERE objectCategory= ''''Person''''
				  AND objectClass = ''''user''''
				  AND memberOf = ''''
					CN=' + @GroupName + ',' + @OrgUnit + ',
					DC=' + @Domain + ',
					DC=' + @TopDomain + ''''''')
		WHERE NOT EXISTS (SELECT *
					FROM stbl_System_Users
					WHERE Login = ''' + @Domain  + ''' + sAMAccountName)'

EXEC (@SQL)

WHILE EXISTS (SELECT * FROM ##ADUsers)
BEGIN
	SELECT TOP 1
	  @FirstName = FirstName,
	  @LastName = LastName,
	  @EMailAddress = @EMailAddress,
	  @Login = Username,
	  @MobileNumber = MobileNumber
		FROM ##ADUsers

	EXEC sstp_Security_Users_Create
		@Login = @Login,
		@FirstName = @FirstName,
		@LastName = @LastName,
		@UserEMailAddress = @EMailAddress,
		@UserSMS = @MobileNumber

	EXEC sstp_Security_Users_CopyGroupsMemberships
		@FromUser = @TemplateUser,
		@ToUser = @Login

	DELETE
		FROM ##ADUsers
		WHERE Username = @Login
END

DROP TABLE ##ADUsers

This script will create the logins that doesn’t already exist in the system and copy AppFrameTemplateUser’s permissions to the logins. Running this script every night or similar will make it much easier for our customers to add users to AppFrame (or PIMS).

NB! Please notice that the @OrgUnit is “backwards”, meaning that the top level OU is on the right. Office1->Department1 is therefore OU=Department1,OU=Office1

5 minutes interview #9 – Tim Bosinius

Tim is the IT Manager at TGE in Germany. I’ve been down there visiting them about a year ago, where I helped on upgrading their database to R3. The things I remember Tim always talked about was SharePoint and Web-services. I thought he was in love with Web services, because he talked so much about it. But, then I remembered that I talk A LOT about SQL Server, so, guess we’re even there :-P. The last week Tim and Florian (also from TGE) have been on AppFrame training, learning the inside of AppFrame. He’s already got 5 posts out!

What did you do before you started at TGE?
In the mid 1990’s some fellow students and I were running our own business focused on Linux. When starting with automated deployment of Windows NT 4.0 in 1997, I completely turned to the “dark side”.  In spring 2000 I joined an international operating Telco as “Client Systems Lead” for their ~5000 seats network. This was at the climax of the dot-com bubble. Due to some lucky turn of events I managed to stay with them and the successors as Microsoft Technology Architect and later as team lead for the backend systems and data centers. When I saw the job offer from TGE in 2005 – I knew that this has my name on it and I applied.

What do you think about AppFrame?
There are so many frameworks available. For example Habanero.Net, Spring.Net or TrueView. DevExpress and Telerik provide interesting ORM tools. While all of these have some interesting aspects, I am really confident that the choice of AppFrame R3 is the right one. The security design starts at db level, it provides SQL injection protection with AppFrame and it is possible to create solutions in WinForms and Web applications with lighting speed. (well – especially if the minimal allowed coding speed that Jan Leon showed us…  a web service,  a WinForms GUI both fully functional from scratch to compile in something like 6 minutes…)

You have any ideas on what to make in AppFrame? Web services talking to SharePoint?
Integration of AppframeR3 into SharePoint is certainly an important step. The upcoming build provides a good basis. I will blog about the currently available methods and our implementation in the near future.  But my wish list for AppFrame is longer… First I would like to see that the distributed file store concept gets an addition. I would like to be able to define a central file store. Files should be copied via BITS (Background Intelligent File Transfer Service). Another thing that would be awesome would be “afWebServiceDatasource”. While it is just a few lines of code to query a web service, it would be much better to centrally define which remote web services an AppFrame solution is using. If it should be executed on client or server side, if the result should be cached and so on.

What do you do when you’re not sitting in front of the computer?
Well, I guess then it must be broken and I will most likely sit behind it trying to fix it J. My wife always knew that I am a geek. I guess my two daughters and my son should know by now.

AppFrame Podcast

I’ve been thinking about starting podcasts for quite a while now. The naming was the easiest: AppFrame Podcast. What’s left is starting the thing. I have some ideas who I’ll capture to get them talking, and some topics. But, is there any particular topics you’d like to hear about? Maybe you’d like to hear one specific guy talk about something, or you just want to hear more about a particular topic.

My thoughts was also to co-host it with someone and then invite “experts”. Then we’d have a couple of fixed columns like “tip of the day”, “tool of the day” or similar. So, the reason for me posting this blog is that I want YOUR suggestions. I already got a good idea by Kelly about not only talking to experts, but also PIMS-users. So, if you’ve got ANY idea, good or bad, please comment, or contact me (email or MSN) at vidar@omega.no

Oh, btw. This will be an audio podcast. On English, of course!

Download NDC 2009 videos

The videos of all sessions at NDC (Norwegian Developers Conference) 2009 is now available through a torrent. Illegal? Nope! They’re publicly available. Please add comments with your recommendations. I know I will…. And please seed when you’re finished downloading!

http://blogs.msdn.com/grothaug/pages/downloadable-ndc2009-videos.aspx

5 minutes interview #8 – Geir Ove Fjellstad

Did you know that Geir Ove was one of the first lucky guys to get AppFrame training from me? Now he’s the team leader for the BP-team in Stavanger. You see the connection?!

How was your first week? Did you actually learn anything at all?
Frankly, my first week was scary. AppFrame, R2, CR1, CR2, MarketMaker, PIMS – all these words that I just couldn’t figure out but felt I was expected to (not sure I really understand them today either:)
But friendly colleagues in a laid-back environment helped me relax, and one step at the time I eventually got familiar with "The Omega way" (I hope).

What did you do before you started in the BP team?
After finishing my Master in Australia in 2004, I returned to Norway to an IT job market pretty much "on hold". I therefore started working for Søral, an aluminum producer. In 2005 I decided to "do a Bill Gates" and started my own company offering IT/programming services. After a year or so I came to the conclusion that Bill probably was luckier with the timing than me, so I decided to apply for a real job instead. My timing was a lot better this time, because Omega had vacant positions and I was lucky to get one. I started in May 2006 and have never looked back.

Is there anything particular that you’ve found interesting while working in Omega?
Hard to put a finger on anything in particular because what I feel is interesting changes. A year ago I felt the most interesting thing in the world was to figure out fancy technical solutions to a problem at hand. Today however I find it even more interesting to try to "get under the skin" of the client, and try to figure out what the client really needs (which often is something completely different than what the client says he/she needs).

Do you have any hobbies, except computer stuff?"Computer stuff" is actually not a hobby for me. I like it a lot (tend to love it sometimes), but I always think of it as my profession only. I feel it’s healthier to have this attitude (and then I can book man-hours:) For hobbies I play golf once in a while, deer-hunting every autumn, scuba-diving occasionally, trip to the gym now and then, and looking at the girls all year around.

Azure

What does Azure mean? Blue sky. But what does Microsoft mean with this? You might have heard of “the cloud”. Storing data in the cloud etc. This is a term that is very popular nowadays. The point here is that your data (or applications) are stored “in the cloud”, which means that you don’t have a relationship to where it’s actually stored or executed. I just created a database in Microsoft’s SQL Azure. I have NO idea where this database is, but I can access it through management studio or similar. There are a lot of other things you can do “in the cloud”. You can store your pictures, make it do heavy calculations etc. Some have been dreaming about having a screen (TV like) where all the actual computing is done “in the cloud”. I think it’s really interesting, because most of our computers are idling most of the time anyways.

So, why am I writing about this? Arild posted a blog about SQL Azure CTP earlier which started a discussion if we should support it. That lead me to try to make AppFrame “Azure compatible”. After a couple of hours, I’ve made my decision: If we should go “Azure”, we need to do it from scratch. There are so many things that are not supported by the SQL Azure which are imho show stoppers. For starters, you can not connect to it using management studio. Correction, you CAN, but you don’t get the object browser, and it’s very limited. The unsupported features are a long list. This in it self isn’t a big problem, because we don’t use most of them, but here’s a list of those we do use, and a little description.

SUSER_SNAME() – This is used EVERYWHERE. Literally! Triggers, views, defaults etc
NEWSEQUENTIALID() – Can be replaced by NEWID(), but you loose performance
WITH (NOLOCK) – Can be removed, but can lead to performance issues and lock-problems
FullText Indexing – Can of course be replaced by normal WHERE-clauses, but this will be a performance issue.

This is the biggest problems I’ve found so far, and I’ve only scripted tables and views. In addition, you don’t have sysobjects, syslogins, sysusers etc. Making AppFrame Azure compatible IS possible, but it would in my mind be just as time consuming as making it MySQL compatible. I’m sure Microsoft will add more features. This is only the CTP, so I hope they’ll at least add SUSER_SNAME and NEWSEQUENTIALID. The others we CAN live without.

So, to summarize. Should we be thinking to “go to the cloud”? No, at least not yet. I see it as a MySQL replacer. It’s great for small applications, but when you want to do real enterprise-stuff, you run MSSQL Server Enterprise Edition 🙂 One other thing to keep in mind is where is my data stored? All companies on in the US needs to be SOX compliant. This might be a problem for Azure. Don’t get me wrong. I’m positive about Azure, but not as an enterprise database!

If you want to test out Azure SQL, go to http://connect.microsoft.com and sign up for Azure SQL.

NB! We’ve got two new bloggers (from TGE). Looking forward to their postings 🙂
Tim Bosinius
Florian Biermaier