Blog ala Vidar

SQL, AppFrame and other cool technologies

Tag Archives: AppFrame

Exchange 2010

Have you heard the big news? We’re changing from our own mail-system to Exchange 2010! This means everyone in Omega will be able to use Outlook to everything. And by everything I mean not just mail, but calendar, contacts +++. After what I’ve heard it might already be up and running within a couple of weeks. There will be an integration with our Persons-form (with all our contacts) which will be synced to AD so everyone’s got read-only access to them. In addition you can of course create your own personal contacts.

Mail will still be integrated in TeamDocuments, but I’m counting on that will be the OWA (Outlook Web Access) interface.

AppEd 2010

If you were at AppEd 2008, you should go “WHHOOOOHOOOO” right now because I’m here to tell you about AppEd 2010! It’s still in planning stage, but we’re getting there. We hope to host this event every second year. We’ll also try to make it an even better success than last time, if that’s possible.

We’re planning on Thursday – Saturday in the beginning of September. We’re also working on getting an external speaker (and maybe two? :), so we have to try to set our schedule after him/her/they etc.

The planning is done in TeamDoc and OneNote. OneNote is btw a GREAT tool for putting thoughts on “paper”. We’ll have two focus areas this time; PIMS and Web3, but we’ll also cover CR3, SQL, Reports and maybe even Silverlight! Do you have any requests for sessions or speakers, just contact me and I’ll see what I can do. We’re also hoping on making it works so that MSDN Live in Stavanger is on Wednesday before the event, so that we’ll almost get a full week with pure learning, and of course mingling. I’m also working on enabling our employees outside Norway to join via the Advantage system, but don’t tell Johnny and Peter about this as I haven’t told them about my ideas there yet! … and for the record, the “lessons learned” from last time is in my OneNote notebook, so we’ve got those in mind 🙂

This might also be the first AppEd with attendees outside Omega, which means we will invite customers etc to the conference. THAT will be cool! Because of this, we’ll of course have everything from “for dummies” sessions to deep-advanced-shit-that-only-a-rocket-scientist-understands.

Bottom line; Start spreading the word. AppEd 2010 will (hopefully) be in September, bigger AND better than last time! If you’ve got ideas, give’em to me!

News from Ølen about stuff that matters

You might have noticed there was just a holiday. Something about Jesus eating some bad chicken, so everyone thought he died, but then he woke up a couple of days later feeling much better. Anyways, because of this bad chicken, I’ve been VERY busy the last week, playing Modern Warfare 2 on Xbox. Ai can has vacation 2!

AppFrame as a product!
Since I started in Omega I’ve been fighting for releasing AppFrame as a framework for developers outside Omega. Now that’s almost a reality. We’re soon going to offer AppFrame as a product, along side PIMS and our other products. There haven’t been any final decision on pricing and stuff, but I can guarantee it will be affordable. This means that all developers out there that want to use AppFrame as their Framework to make applications can soon start doing this! They MIGHT even get the source code! After releasing CR3 I’m now confident that this is an AWESOME product. If you’ve met me, you know I’m not a sales person. I always say what I mean, and I can say with my full heart that AppFrame is without a doubt a VERY good product to develop applications for customers! Contact me if you want a presentation (from a developer, or a sales person. Your choice!). I’ll probably post a blog about the details when there’s been a decision on price etc.

NNUG and MTUG Haugesund
I’m the chapter of NNUG (Norwegian .NET User Group) Haugesund. We had a meeting at Rica Maritim Hotel in Haugesund March 22nd. The speaker was Einar Ingebrigtsen, and he talked about creating games with managed code. That means, using Silverlight, XNA, DirectX and similar. We had a new record of attendees: 27! That’s really high, at least if you compare us to Bergen which is a MUCH bigger city, but they’ve got about an average of about 20 people every meeting.

Since I’m both interested in programming and hosting-related stuff, I thought it would be cool to start a user group that could concentrate about the IT Pro’s out there, just like NNUG is concentrating on MSDN-people. Timing perfect, as always, I read on twitter that a guy called Jan Egil Ring was about to start MTUG (Microsoft Technology User Group). I’ve offered myself as the contact person in Haugesund, and I’m now working on gathering people so we can get a committee to manage this group. I’ll keep all of you updated when we’ll start having meetings etc.

Except playing Xbox, what have I been doing lately? I’ve played a lot with Visual Studio 2010 RC. A hot tip for those of you thinking you’ll play with Silverlight 4 in the RC. Don’t even think about it. It doesn’t work. I didn’t know this, so after 6-7 hours of swearing, kicking, screaming etc. Erik (coworker and friend) told me that’s not possible. Well, thanks! After that I started playing with WPF, since it’s basically the same except that Silverlight is a wossy-version of WPF /me hides under the table, waiting for the Silverlight-folks to start screaming. I’ve already managed to create a simple twitter client, trying out LINQ to XML, LINQ to Entities and a couple of new minor changes to VB. The fact that you now can create a Property on a class with ONE line of code is awesome. And, yes, before you C#-fanatics say “we’ve had this for ages”, you now got optional parameters, which VB have had for about 1000 years. We now also got something that’s got a fancy name. “Implicit Line Continuation”, which basically means that you don’t have to end all lines with _ if you want to continue this line on the next. This was very annoying in for example LINQ, where you’ve got something like:

Dim v = From a In AppDomain.CurrentDomain.GetAssemblies _
		Where a.ToString.Length > 0
		Select a.ToString()

Here is a great example. On the first line you need to specify the _ at the end, if not you’re not “allowed” to continue, but you don’t need it on the Where-line. Pretty confusing. Well, now you don’t need it at all.

One other thing that I find really nice is the improved IntelliSense. Now you can start typing “To”, and you’ll get:

CompareTo, CopyTo, ToString etc

Before, you only got ToString, since that’s the only thing starting with To. You can also search for AD, and get AppDomain, since .NET uses Pascal Casing.


We’ve been working a bit on the blogs site. Or, to be honest, I’ve been making tasks and Stian has been doing them. The new (some of them are old, but you might not have noticed them before) features are: Tags. This works the same ways as Categories, except that you can tag an article with more than one Tag. We’ve then got Tag Clouds, to show which Tags are the most mentioned, and which are rarer.

If you’re using TeamDocuments, you will be auto-logged in which gives you the possibility of rating all posts, and commenting on them! You can even comment as an anonym user.

Johnny said today that he’ll start blogging more. Peter also had this statement a couple of weeks ago. Guess it’s just like X-files, “Du tror det ikke før du får se det!” (something like You won’t believe it before you see it!). But I would be very happy to see some posts from them too!

Build 5

The technology department released Build 5 of AppFrame a couple of weeks ago. Peter was our “speaker” at our last cake-meeting where he went through most of the changes done in this build. I’m really excited to start upgrading our clients to this release!

Issue Tracker

To report bugs (yes, we as everyone else, including Microsoft!, produce bugs), the technology department released a new “issue tracker”. This makes it SOOO much easier for me, since I now don’t have to read 10-15 TeamDocs every day to check if the bugs I’ve reported have been fixed. Most of the things I’m reporting is even getting fixed within a couple of hours (sometimes days), depending on the severity of the bug/suggestion. I’m strongly recommending you all to report everything you find, so we’ll get an even better product! Just today I’ve reported two things; resizing issues with the calendar in chrome and the distribution lists not working. They haven’t been fixed yet, but the distribution lists-thing is “in process”.


If you’ve got any suggestions on what you want me to blog about, or you’ve got comments, please send them to me! And remember to rate the posts! Good or bad. I won’t bite… Changed my mind. I will bite 🙂


I have set up a wiki for AppFrame developers. You can find it here. NB! This might not be available for some users (outside the Omega network), but will hopefully be available Monday morning. The reason this is set up is to gather all our resources, including all TeamDocuments like “Snippet Library”, “Technical problems for technical geeks” and similar. It is NOT set up to replace, and this will still be our portal for developers. The difference will be that will be “professional” articles, while wiki will be copy/paste code, small tips & tricks etc.

In the main page you’ll see two main headlines; Development and Setup & Maintenance. Under Development you’ll find the most important categories. Click for example “AppFrameR3” and you’ll be referred to the category which shows all articles in this category.

So, how do you start using wiki? First you of course need to register. After that’s done, you can click any “edit” you want. We’re using mediawiki (the same engine as which means that there are some tags that are special here. You can use most HTML tags, but also a couple of mediawiki special tags. For a list of all, go to this site. To add an article to a category, just add the following:

Also, you can edit existing articles to see which tags are used. The longest article so far is a copy of my AppFrame Security blog post.

The most used formatting tags are:

’’’’’bold & italic’’’’’

=Heading, level 1=
==Heading, level 2==

* Bullet list one
* Bullet list two
** Bullet list three, child of two

# Numbered list one
## Numbered list two, child of one

<source lang=”tsql”>
    FROM Table

[[Main Page]]
[[Main Page|Link to Main Page]]
#REDIRECT [[Main Page]]
[[:Category:YourCategory|Link to YourCategory]]
[ email me]

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 “”. 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',

EXEC master.dbo.sp_addlinkedsrvlogin

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 @Domain AS NVARCHAR(20) = 'MyCompany'
DECLARE @OrgUnit AS NVARCHAR(200) = 'OU=Department1,OU=Office1'
DECLARE @GroupName AS NVARCHAR(200) = 'AppFrameUsers'
DECLARE @TemplateUser AS NVARCHAR(128) = 'AppFrameTemplateUser'

SET @SQL = '
	  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 + ''''''')
					FROM stbl_System_Users
					WHERE Login = ''' + @Domain  + ''' + sAMAccountName)'


	  @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

		FROM ##ADUsers
		WHERE Username = @Login


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

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

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


As some of you might have noticed, I’ve had #AppFrame@EFNet as my personal message on MSN. What does this actually mean?

IRC (Internet Relay Chat) is a technology developed as early as in 1988. It’s a chat protocol. The main idea is that there are several servers connected in a network, which clients can connect to to chat with others. The idea behind MSN is in many cases very similar to IRC. The only main difference, in my eyes, is the channels. If you want to start a group discussion on MSN you have to invite several people to your conversation. This can easily be a mess. What do you do if you just need help with something, or want to chat about one topic and don’t care who answers? Well, MSN does not have any features like this. IRC on the other hand has channels. You can join any channel you want. I’ve started #AppFrame (# means it’s a channel) on the EFNet network. Anyone can join to chat, or get help with AppFrame related technologies. NB!!! THIS IS NOT AN OFFICIAL SUPPORT CHANNEL FROM OMEGA!

You can also join other channels to chat, or get help with other technologies. I myself have joined #Haugesund (my hometown), #sql and #appframe. There’s also channels like #vb, #aspnet etc.

Looking forward to have a chat with you on IRC!

Knowledge week

This has been a VERY busy week. Started with publishing a new build of R3. I wish I had more time to test before it was published, but now everything should be fixed at least! Next time we’re planning a freeze two weeks before the build where we’re only going to test and fix bugs. Monday – Wednesday I was at work for a total of 40 hours, to make sure everything should go as planned on TechNet, NNUG, AppEd and with the upgrade of SQL3.

On Thursday we went to Stavanger. We were 12 people, some went to MSDN and some to TechNet. I went to TechNet, where the red thread was Microsoft Virtualization with mainly Hyper-V but also a bit about Virtual PC and Virtual Server. Virtualization is something we’ve already started using in Omega and we’re expanding weekly! Less physical servers means less hardware-failures, easier maintenance and of course reduced cost! We learned some tricks and tips about virtualization. We also met one of my heroes, Jon Jahren. We showed him our plan about hardware setup for the new SQL3, and got some tips about how to improve it. For example, we had planned to split up the MDF to several RAID-arrays. According to him, there were no point in this. He recommended putting the MDF on ONE RAID-array, using RAID 10. He also mentioned that tempdb should have it’s own array (as we already planned), and of course the LDF-file should have one. Making several MDF-files on the same RAID-array was good though. One pr CPU! Jon also had a “competition”. The person who asked him a question he couldn’t answer, got a SQL Server 2008 jacket. I asked him a question which he actually didn’t answer, but he apparently forgot about it or something, so he made a new competition. “Hvor mange indianere får en plass til i et hult tre?” ….. En stamme. “How many Indians can you fit into a hollow tree?” … “One tribe”.. Tribe in Norwegian (“stamme”) is the same word as for a tree-trunk. Leif was the first to answer correctly, so he got the jacket. And, yes. I’m REALLY jealous! I’m going to send Jon a mail about it!

After MSDN/TechNet we went to Ølensvåg to have a NNUG meeting. The topic was “C# 3.0 and .NET 3.5, news and best practices” with Jan Ove Halvorsen. It was a great session! We will upload his powerpoint to NNUG’s website. After that, Johnny had a zip-talk about CR3, and everyone seemed to be very impressed. There were people from Hatteland, Ecciti, Ølen Betong and Bouvet (and Omega of course) there.

On Thursday evening we went to “Løo”. This is a nice place to get to know people. We sat up till 2am, chatting!

AppEd started on Friday morning, with a keynote from Johnny and some guidelines. After that we had a “Tell us where it hurts” session, where we got some input about what, and how, we could do things better. We discussed documentation, builds, reporting issues and a couple of other things. I think it’s great to have sessions like this, where we can discuss and get to know problems that we might not be aware of. Torgeir continued with ReportingDX where I learned a couple of new things 🙂 Johnny had a little session about what we’ve made in PIMS R3.

After lunch, we split up in two where Arild had a (very interesting) session about SSIS and Johnny had one about AppFrame Security Model. After that there were two sessions going at the same time: CR3 Development and CR3 Hardcore. I participated at hardcore. I’m amazed by how much cool words Jan Leon, Peter and Torgeir knows. Serialization, delegates, proxy object, surrogate etc. I know some cool words in SQL Server, but not that many! In these sessions I started feeling sick. Not of the session, but there’s been some problems with the water in Ølen, and some has been sick (vomiting etc). I had to get home, so I couldn’t participate at “Løo” where they had dinner etc. We planned a quiz, where we were going to elect “Norgesmester i AppFrame”. Norwegian Champion in AppFrame. Of topic: You may have noticed I’m writing AppFrame, and not Appframe. This is the new way to write AppFrame.
ANYHOW! Arild Røksund won and got a T-shirt saying “AppFrame Developer Hero”, a mouse he can connect to a USB-port that cycles on a bicycle. The faster you type on your keyboard, the faster the mouse cycles. In addition he got the title “Norgesmester i AppFrame” and 50.000 advantage points. Semion Larin and Aleksander Birkeland got second and third place. They also got the t-shirt and cycling mouse.

I didn’t feel too good when I woke up, so I waited till after lunch to get to Ølen. Before that, they had hands on labs (to play with CR3), setting up R3 and R3 web. When I got to Ølen, me and Arild had a three hour session about Database Development. We went through new features in 2005 and 2008, Service Broker, Indexing and Statistics and Query Tuning. Håvard Ravatn showed me a thing I didn’t know about CROSS APPLY. I thought you could only use it for UDF’s, but no… You can also use it for queries 🙂

Because I was sick, and JanCB also was sick, we did not upgrade SQL3 this weekend. I’m still looking forward to get it up on SQL Server 2008. The plan now is after the salary payment is done.

I’ve already started planning AppEd 2009 😀 I hope you think the same as me, that it was a big success! I also hope we can expand it, so more people can attend!


For some weird reason, they’ve got a Revisions table with a field called DocRef here.
The DocRef field contains a ; seperated list of GUIDs. In the new model we’re implementing, we’ve got an own table for files, so I had to figure out something smart to get this ; seperated list to be records.

First I had to fix sfnc_System_SplitGuid. Just remove the PRIMARY KEY setting on the PrimKey field in the return @GuidTable table variable. This is of course fixed on our main database in Ølen now, so you don’t need to fix it after next build. After that I wrote the following query:

  R.Domain, R.DocDwgID, R.Rev, S.PrimKey AS FileRef
	FROM atbl_DocCtrl_Revisions AS R WITH (NOLOCK)
	CROSS APPLY sfnc_System_SplitGuid(REPLACE(REPLACE(REPLACE(R.DocRef, ';', ','), '{', ''), '{', '')) AS S

The nice thing about this is that we’re using CROSS APPLY to “apply” a UDF to a recordset. Sweet thing!

BTW! Today’s song is: Backstreet Boys – I want it that way


We’re having a technology conference in ØLEN in september. Many of the people I’ve talked with, thinks AppEd is the same as TechEd. Well, we wish!
I’m sure you’ll learn even more at AppEd, than TechEd 😉

AppEd is 4-6th of September. Click here for the agenda.

PS! This year we’re only inviting norwegian-speaking system engineers. If we succeed like we’re planning to do, we’re going to try to invite ALL system engineers next year!
If you’re interested in joining, please sign up in the “My Omega Advantage+” section.