Blog ala Vidar

SQL, AppFrame and other cool technologies

Microsoft Releases 2010

There’s been a “wave” of releases from Microsoft the last months, and more to come. The following are already released: Visual Studio 2010, Silverlight 4, SQL Server 2008 R2 (will be available on MSDN/TechNet May 3rd), Office 2010 (mmmmmm, sexy) and SharePoint Server 2010. Later this year Windows Live “Wave 4” will be released, Windows Phone 7 and the new Windows Home Server (code named “Vail”). It’s a lovely year for those of that LOVE playing with new (betas and) releases.

To get all of these (except Visual Studio (which you can get with MSDN), Windows Live and Phone 7), the only thing you need is a TechNet subscription which costs $349 the first year and $249 for renewal. Compared to buying all these licenses in the store, it’s almost as cheap as pirating it! And, you don’t need to worry about downloading viruses, things that doesn’t work etc.

SQL Server 2008 R2

R2 has finally hit RTM (Release To Manufacturing). Is it worth upgrading? Always! But there aren’t many changes that’s not related to the BI (Business Intelligence) part. Here are the keywords: Better SQL Azure compatibility, support for 256(!!!) logical processors. 2008 “only” supported 64. SSMS dashboards.

They’ve also done a couple of things regarding licensing. Datacenter and Parallel Data Warehouse editions have been introduced. Oh, yeah and Express Edition will now support up to 10GB databases, instead of 4GB.

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.

SQL Server Analysis Services

Today a couple of us in Ølen had the pleasure of attending a session with Jan Ove Halvorsen with SSAS (SQL Server Analysis Services) as topic. This was an introduction to SSAS, although most of it was heavy stuff. I’ve played with SSAS before, but have had problems understanding some of the basics. This might help you on the way.

What is SSAS?

SSAS is part of the OLAP BI (Business Intelligence) part of SQL Server.  It’s also a part of the SQL Server licensing. This means that if you own a SQL Server license, you also own a SSAS license. It is recommended to install it on a server beside SQL Server, because it’s heavy on RAM usage. To connect to it you either use Visual Studio, Management Studio or an API. You can also connect to it using ADOMD.NET.

SSAS Modes

There are three main modes in SSAS:
MOLAP – Multidimensional OLAP – Data, aggregations and structures are stored in OLAP
HOLAP – Hybrid OLAP – Mix of MOLAP and ROLAP
ROLAP – Relational OLAP – Uses data from SQL Server but stores some structural data in OLAP

This means that you don’t need to run non-live data. For instance you can run MOLAP on monthly updates with a SQL Server Agent job running every month (or similar), storing everything in SSAS. This makes it VERY fast to query. If you need more live data, you can run ROLAP, so you get live data all the time. This will not be as fast, and it will also give a load on the SQL Server each time a query is executed.

With the 2005 version there came a new feature to SSAS, enabling it to “subscribe” to updates on the SQL Server. So, if you’re running ROLAP, it will generate the cube, and just use that local cube till there’s updates in the underlying data (on the SQL Server). When there’s an update SSAS gets a notification that there are changes, and it will rebuild the cube. Either the whole cube, or just parts of it.

OLAP Cubes and Dimensions

In SSAS you’re browsing cubes. A cube is a “collection” of dimensions. A dimension is a set of data, in many cases a one to one relation to a table or similar in SQL Server. This might for example be “Products”, “Cities”, “Countries” or similar. You also must have a time dimension. This means that all your data are aggregated so that every possible join of these (Products, Cities, Countries and Time) are stored as one “table”. This is what’s making this so fast to query, because everything’s “prejoined”.

Hierarchy

You can create hierarchies in SSAS. The most common is the Year –> Month –> Day hierarchy. This enables you to group by year, and just by clicking expand, you’ll get group by month in your client without having to get new data from the server.

Creating cubes

There are several ways of creating cubes, dimensions and other stuff. You can either use Visual Studio, Management Studio, or you can use a query language. This can be done using MDX (MultiDimensional eXpressions) which looks a lot like Transact SQL, but is also VERY different. An example could be:

SELECT
  { [Measures].[Store Sales] } ON COLUMNS,
  { [Date].[2002], [Date].[2003] } ON ROWS
	FROM Sales
	WHERE ( [Store].[USA].[CA] )

In this example Sales is the name of the cube. Store is one of their dimensions.

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.

VB.NET 10
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.

Blogs

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 🙂

Mix10

Microsoft’s MIX10 conference is over, and all their sessions have been uploaded. These are high quality sessions about web and windows phone related development and design. You can download the videos at http://live.visitmix.com/Videos

Handling strings in SQL Server

In .NET, if you have a string it’s:
VB: Dim vMyString As String
C#: string vMyString;

In SQL Server you’ve got more than one choice. varchar, nvarchar (with or without MAX), char, nchar, text and ntext. That’s why SQL Server is better than .NET. No, just kidding. When you’ve got a String in .NET, what’s the equivalent? nvarchar. If you’re trying to put varchar in .NET, you’ll end up with an nvarchar (since the text is changed to Unicode).

SQL is built to store large amounts of data and retrieving it faster than lightning. It’s not built to handle strings, but sometimes you need to do it on the SQL Server. That’s when functions like SUBSTRING, LEFT, RIGHT, REVERSE and PARSENAME are useful! The last one, PARSENAME, is a function that’s saved me A LOT of time. The purpose of this function is to retrieve table names, schema names etc from a string. For example a string like “Server.Database.Schema.Table”. If you put PARSENAME and set the second parameter to 1, you’ll always get the Table. 2 will always give you Schema etc. Now, how can we use this other than retrieving object-names?

DECLARE @Name AS NVARCHAR(100)

SET @Name = 'Nordnes, Vidar Stangeland'
SET @Name = REPLACE(@Name, ',', '.')

SELECT
  PARSENAME(@Name, 1) AS FirstName,
  PARSENAME(@Name, 2) AS LastName

The @Name variable contains a name where you’ve got “LastName, FirstName (MiddleName)”. Replacing comma with a period enables you to use PARSENAME. The cool thing about this is that it returns NULL if it doesn’t have any values. If you didn’t use PARSENAME, you’d have to do something like:

DECLARE @Name AS NVARCHAR(100)

SET @Name = 'Nordnes, Vidar Stangeland'

SELECT
  CASE WHEN CHARINDEX(',', @Name) > 0
	THEN SUBSTRING(@Name,
			CHARINDEX(',', @Name) + 2,
			LEN(RIGHT(REVERSE(@Name),
				CHARINDEX(',',
					REVERSE(@Name)))))
	ELSE @Name
  END AS FirstName,
  CASE WHEN CHARINDEX(',', @Name) > 0
	THEN LEFT(@Name, CHARINDEX(',', @Name) - 1)
	ELSE @Name
  END AS LastName

WAY more time consuming, for doing something that should be pretty easy. REVERSE is also a great function to know about. As is REPLICATE, STUFF, ISNULL (or COALESCE), LTRIM and RTRIM.

While I’m at it, “asdf “ (with trailing space) isn’t always the same as “asdf” (without trailing space). Just take a look at this example:

SELECT '1' WHERE 'asdf' = ' asdf'
UNION ALL
SELECT '2' WHERE 'asdf' = 'asdf '
UNION ALL
SELECT '3' WHERE 'asdf ' = ' asdf'
UNION ALL
SELECT '4' WHERE 'asdf ' = 'asdf'
UNION ALL
SELECT '5' WHERE 'asdf' LIKE ' asdf'
UNION ALL
SELECT '6' WHERE 'asdf' LIKE 'asdf '
UNION ALL
SELECT '7' WHERE 'asdf ' LIKE ' asdf'
UNION ALL
SELECT '8' WHERE 'asdf ' LIKE 'asdf'

Before you run the code, think about what you THINK will be returned. 1-4 is the same as 5-8 except the = vs LIKE. My first guess was 0 records. My second guess was 2 and 6. None of my guesses was correct though.

Remember also that a nvarchar(MAX) field can contain very much data. Returning this to the client could be very slow, especially if you include this field in other fields (for instance one field returning HTML-data, and one without the HTML-formatting), or as we often see here in Omega, a SearchColumn which is used by our framework for filtering. This field normally consist of all the (n)varchar-fields in the table.

5 minutes interview #22 – Rune Grothaug (Microsoft)

Rune is NNUG’s contact in Microsoft, since his title is "Developer Community Manager" in Microsoft Norway. He’s responsible for communication between developers and Microsoft and has been responsible for events such as MSDN Live and NDC (Norwegian Developer Conference). He’s leaving Microsoft soon, and I’m sure we’ll miss him. He’s been a great resource for NNUG, and has done a wonderful job with planning various tech-events. I bet this will be hard task for whoever’s replacing him!

What’s the coolest thing about working for Microsoft?
The coolest thing about working for Microsoft (and especially for the Developer Platform Evangelism team) is that we usually get to learn about new tech some time before it becomes publicly available. In addition I work with some pretty smart people who I learn a lot from. I do not think I’ve ever experienced the same amount of brain conditioning anywhere else in my life. Most of my coworkers work really hard and put in many hours to try to cover as much ground as possible. It’s not always easy being the world’s smallest DPE team, but we still deliver some of the best results in the world (really!). Working for Microsoft is different from many other jobs. Like Coca-Cola, Google, IBM and other large brands, most people have an opinion about Microsoft, and that allows for some really good discussions. Both when I’m officially working and on my own time. Especially after a few drinks people are VERY eager to come at me with all kinds of questions and weird allegations. I say bring it on!

Who’s your favorite speaker(s)?
Uh oh. This is tricky. I should definitely just point out all the speakers on this year’s NDC roster. I´m afraid it’s a bit more complicated. To be honest there are so many great speakers out there and I’ve been fortunate enough to have met many of them in person. If i have to mention a few, I´d like to point to Scott Hanselman for his incredible capacity, humor and being so knowledgeable about a huge variety of topics. Then there’s Bob Martin (Uncle Bob) for being able to make so many people really think about the effort they put into their work. Rafal Lukawiecki for his clarity and in-depth understanding of BI, Data Mining and Security (and being able to actually explain complex matters in a easy-to-understand way). I would have to point to both Luca Bolognese and Mads Torgersen for their supernatural understanding of programming languages and for explaining the choices made by the language team in Redmond in an engaging way. They both drew a good crowd at the last two NDC’s. Roy Osherove for being so focused on TDD and having inspired thousands of people to test better (and for playing a whole slew of geek songs during TechEd, NDC and in other conferences). David Chappell for being so eloquent and pleasant to listen to when he gives his renowned talks. Then there’s Ted Neward, Juval Löwy, Michele Bustamante and so many more who make our lives difficult by submitting a whopping >20 abstracts last year. Not easy to choose from that pile of great talks. Ian Griffiths is also a very good speaker and there are many more I should list up but this will have to suffice for now 🙂

You’re switching job. What are you going to do now, and what have you been doing before you started in Microsoft?
I recently decided to leave Microsoft. Not an easy choice but I´m taking on the role as team lead for the .NET guys in Avenir, one of Norway’s largest consultant businesses. I’ll have 35 directs so I’ll be busy busy. I´d have liked to stay with Microsoft longer but couldn’t pass up this great career opportunity. Maybe I’ll find me way back at some point – if they’ll have me 😉 Before I joined Microsoft I worked as a developer for 6+ years. First I did mostly web projects, like http://www.bmw.no and many other small and large portal solutions, working for a company called Electric Farm. It’s been out of business since 2004/2005 I think. Then I went on to do mostly Java programming with a company called Lawson. They had an ERP system huge as a house that needed continuous work and maintenance. I found it too boring in the end and started looking for a job that´d allow me to work more with people. That’s when I found the Microsoft job. The Developer Community Manager title is one I made up so people could understand better what it is I do. When I took on this job I had only one goal in my mind and that was to contribute to making it more fun to be a .NET developer in Norway. Some people say I’ve succeeded. I hope that is true. I will for sure miss all the good talks I’ve had with developers literally around the world, but first and foremost in Norway. I truly believe that the average Norwegian developer is very skilled. However I’ll still be part of the community as a NNUG member, so I won’t disappear completely. I´d like to thank everybody who’s been to MSDN Live, NDC and all the other events we’ve put on the last four years.

Do you have any hobbies, except computer stuff?
I’m an avid cook. Never get tired of pushing the limits. I love good food and don’t know anyone that’s as fixated as myself. So I had to start learning how to cook a good while back. Today I master many things in the kitchen but I am still work in progress. One can never learn enough. In addition I tend to geek out with just about everything. Lately cars and that’s kind of expensive. So maybe I should take to collecting match boxes or beer coasters to keep the cost down. My wife says I can’t buy everything just because they´re shiny objects. I beg to differ. Computers have always been on my mind, and these days my 1 year old is trying to write his first pieces of code. It doesn’t go as well as I had hoped. Today he sat himself down on the display – good thing it didn’t break. I think we currently have 8 PCs in our house (two are Macs). Oh yeah, and then I try to take pictures with my digital SLR camera. It sometimes turns out ok.

Links:
http//blogs.msdn.com/grothaug
@grothaug
@runegrothaug
http://flickr.
com/grothaug

5 minutes interview #21 – Einar Ingebrigtsen (Bouvet)

Einar has been a software developer since the mid-1990s. Now he’s working as a consultant at Bouvet with Microsoft .NET related technologies as is primary focus. 1st October 2008 he got awarded with the MVP title on XNA and DirectX. He’s been developing games for both PlayStation and Xbox and now 22nd March he’ll have a session for us at NNUG Haugesund about this topic. Click here to sign up for this event!

What have you been working on? Any projects we might have heard about?
I worked with gaming till late 90s and started doing Interactive TV applications for a couple of years for TV channels in Norway and abroad, the biggest installation was NRK and TV2 in Norway. In 2002 I started working with enterprise application development on the Microsoft .NET platform, and worked on an ERP product at Visma; shift management software called Turnusplan. Worked there for 6 years and then started in consulting and have been involved with quite a few projects / products during my now 2 year experience in the consulting business. The technology range I’ve been working with in the enterprise spans from .NET to SQL Server, BizTalk, Windows Forms, WPF and Silverlight to mention a few. Customers has been a few, but Nordea and Komplett is probably the most known.

Being rewarded with the MVP title, is there anything you get to do that you couldn’t do before?
One of the biggest benefits with the MVP title is that one gets a chance to work close with the product team one represents, in my case these days, the Silverlight team. Last week we got to go to the MVP summit, which is an annual summit that Microsoft holds for all its MVPs and we get to interact with the development teams at Microsoft. Holding the MVP title is certainly a door opener in other ways. Microsoft uses the MVP directory actively and once in a while you can get contacted by Microsoft offices in other countries if they are looking for a certain profile and you match that.

Any particular software releases you’re looking forward to the next year?
I guess Visual Studio 2010 is something I’m looking forward to. After using the Release Candidate for a couple of weeks now I must say I’m really impressed with what’s coming there.
The technology I hold dearest these days; Silverlight, will have a release this year – and I can’t wait for it to hit the global web – some amazing stuff has been done in this technology for version 4. With Silverlight 4 we are really seeing the full potential Silverlight in the enterprise; I am personally really excited about the new printing support, Webcam/Mic support and a lot of changes and improvements in data binding support.
Also, the out-of-browser experience that was introduced in SL3 has a lot more capabilities. For SL4 we’re getting an elevated security model, which enables us to do a lot more and make our applications richer on the desktop – such as more file access, both read and write COM access and more. In SL4 they are also putting the MEF (Managed Extensibility Framework) in there. There is a lot more, if you want more details, I have a post summarizing most of the features here: http://www.ingebrigtsen.info/post/2009/11/18/Silverlight-4-beta-announced.aspx.

You were podcasting a while. Any chance you’ll continue with this?
I was, and I really enjoyed it – I had to put it on pause due to heavy workload with Balder, the open-source 3D engine for Silverlight, which got a bit of attention. And attention in software means responsibility, so I’ve been filling up my spare time with working on that project. I want to get more time for doing podcasts as well, but maybe in a different form than what I did and possibly targeting a Norwegian audience only. No guarantees though.

Do you have any hobbies, except computer stuff?
Well, I must admit that the last couple of years I really haven’t had time for any hobbies. But I love to do stuff with my hands and used to spend quite a few hours doing carpentry earlier. It’s the kind of work that really makes my brain relax, which is quite necessary when working in the software industry. I will be picking up my hammer again in a couple of months and find a project (usually too large) that I can work on, so I don’t get stuck in front of my computer. Also, I discovered bi-cycling – I have a few personal goals in that area.

Also, remember to check out Einar’s blog at http://www.ingebrigtsen.info