Blog ala Vidar

SQL, AppFrame and other cool technologies

Monthly Archives: September 2009

5 minutes interview #12 – Arild Røksund

My first meeting with Arild was in Stavanger a couple of weeks/months after I started in Omega. I was "responsible" for CR1 and CR2, although I still didn’t have the full picture of how it worked. Arild and a couple of other guys in Stavanger started asking me questions I didn’t know how to answer. After a couple of trips to Stavanger I managed to get on Arild’s "good side" and started learning tips and tricks from him in SQL Server, and of course other things. Since Arild is having a session named “SQL tuning for dummies” at the NNUG meeting Tuesday September 29th, I thought it would be a good idea to publish this interview today.

How was your start in Omega?
When I started fulltime in Omega, worked 6 months part time when I was finished school, I was a "Cost Engineer" on Heidrun Water Injection project in Tananger. Completely new to PIMS and thrown into a real project right away, quite scary but the best way to learn. After some time in Tananger I traveled to Houston and from there to Singapore, working with ConocoPhillips as "cost engineer" there. REAL good experience!!

What’s your current position at Omega and how do you like it?
I’m technical responsible for the PIMS solutions in StatoilHydro and "head" of the development team in Stavanger. I really like this job. It’s challenging, mostly because of the number of developers working on their own modules. Another example each quarter, with new builds are arriving there is a lot of planning to do, to make all run as smooth as it usually do. With four separate databases that should be running CR1, CR2, R3 and web, internally and externally in StatoilHydro, there is almost only room for errors here 🙂

Do you have any hobbies, except SQL Server?
Hehe, well maybe one or two… I play football two times a week, like traveling, skiing and "friluftsliv" (not so much of the "friluftsliv" part dough) and have tried some other activities to (diving, climbing etc). This fall we are going to start building a house here, so I guess my spare time from that moment will disappear. We are planning to do quite much stuff ourselves, so there will be more than enough work to do.

You have any tips or tricks you want to share with us?
Get rid of overcomplicated, complex, should-not-be-on-web-in-the-first place web applications and welcome R3 info your hearts (and hands)! When we can stop "fire fighting" and clean up bugs, we can start developing rich\intuitive\user-friendly\stable applications. Our customers are going to love us even more, and really be aware of what the applications can do for them.

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.