TechEd Europe 2013 – Thursday

Yet another day at TechEd Europe has passed. This day started with a second keynote, the reason being that Windows 8.1 was announced at the Build conference the night before. Microsoft had to do these announcements before they could talk about Windows 8.1 at TechEd I suppose. Kind of makes TechEd look like a second class conference, Build seems to receive considerably more focus from Microsoft. Steve Ballmer himself did the keynote at Build and all delegates receive generous giveaways. At TechEd we have gotten a rather good Surface tablet offer this year, being able to order a Surface RT and a Surface Pro with quite good discounts. At Build however, the delegates gets a Surface Pro and an 8 inch Acer tablet for free…

Now, this blog post was not going to be about Build (I’m reporting from TechEd after all) but it’s worth pointing out that it seems that there is less developer focus at TechEd and that Microsoft is expecting developers to go to Build instead. I heard that approximately 25% of the TechEd delegates are categorized as developers, the rest being IT pros, so that’s also an indication.

However, being interested in enterprise development, I have attended several interesting sessions today. There was one session about the news in Windows 8.1 and it seems to be not very revolutionary. Apps can now be snapped more freely than before, for example. Another example is that there is a new speech synthesis API. That was actually not very impressive, it sounded a bit like my old Amiga 500 speech synthesis from the early nineties. Not sure who needs that, actually.

There was also lots of other smaller changes making the Windows 8 experience a little more polished, but nothing major so I guess that the version number 8.1 is pretty accurate. The most peculiar new feature is that Windows 8.1 will support 3D printing inside the OS in the same manor as 2D printing, with a print dialog with preview, etc. Obviously a gimmick, but certainly something that will get some attention (I’m blogging about it right now, for example…).

My reward for testing Azure Web Sites and TFS Services

My reward for testing Azure Web Sites and TFS Services

Other sessions I’ve been to have been about Team Foundation Server / Services and Azure Service Bus, both of them quite interesting. I can’t help noticing that most of the sessions that have been relevant to me have been about Azure or TFS so it seems that Microsoft is really pushing those technologies.

Microsoft also had a challenge at the conference that if you did certain experiments with Azure and Team Foundation Services (mainly creating a web site and deploy into that from your own project in TF Services) you’d get some prizes. Of course I couldn’t help accepting the challenge and was up last night doing 4 of the 5 challenges and in return I collected a water bottle, ear plugs with the Azure logo and an R/C car to play with. 🙂

It was actually rather fun trying out these technologies and the challenge was a way for Microsoft to make us take a little time to actually do some testing. And it worked, I’ll probably be using this stuff in the future…

Emil

TechEd Europe 2013 – Wednesday

So I find myself at the keyboard again after another long day at TechEd Europe in Madrid. My sessions of today were about Team Foundation Server, Windows Azure BizTalk Services, Windows Azure Mobile Services, continuous integration with TFS Service and Azure web sites and finally an interesting session about F#. There is much happening in Azure, I already knew that but after attending these sessions I realize that the pace of progress is faster than I thought…

Editing the Insert action of a service.

Editing the Insert action of a service.

As I mentioned yesterday, I’m starting to get really impressed with Mobile Services, the demos I’ve seen in Madrid has really been an eye-opener. Steven Sanderson had another great session on that subject today, entitled Develop Native iOS and Android Apps with Windows Azure Mobile Service. First time I’ve seen Android programming and iOS programming on a Microsoft event (and boy, is Objective C ugly!). Really great stuff, check it out if you’re interested in mobile services!

Screen shot of Dustin Campbell's text adventure game compiler

Screen shot of Dustin Campbell’s text adventure game compiler

Dustin Campbell held an interesting session about Build Data-Rich Solutions Faster with Microsoft Visual F#. The talk was not so much about data-rich application as a set of cool F# demos. Without a doubt he gets the geek award of the day for his demo of his text adventure game compiler written in F#. He was very proud to demo playing Zork, written in a grammar that was runtime compiled into MSIL by F#. Rather cool, and utterly unnecessary 🙂

I’m also more more interested in TFS again, the agile planning tools keep getting better and better. TFS 2012 Update 3 is coming out any day and now includes tag support. More interesting stuff is happening in TFS 2013 but we have to wait little more for that. When I asked about the time frame, MS refused to answer, other than that they’re going to respect the year part of the name…

Inspired by today’s sessions I signed up for a TFS Services account (i.e. TFS in the cloud). This way I can try out some features not yet released in the on-premise version. It’s dead simple and the feature auto-deploy to Azure web sites is very neat. The integration between TFS Services and Azure is obviously something that Microsoft has put some effort into.

A new Azure service that I haven’t seen before (I just heard about it a few weeks ago) is BizTalk in the cloud, Windows Azure BizTalk Sevices (currently in preview). I’s a little unclear however how much is actually the good old BizTalk we love and hate. They have new designers and this time you get to configure the entire path from source to destination from inside Visual Studio in an artifact called a Bridge. If you have worked with BizTalk you know that today you define schemas and transforms in Visual Studio but you have to associate them with receive and send ports using the BizTalk administration tool, causing complex deployments. Just this single feature make the new version very interesting but the main aspect is of course that integration is now available as a service in the cloud, with scalabitity, quick provisioning, and so on. BizTalk Server 2013 is also in the pipeline but for the moment these two offerings seem to be rather separate.

That’s all for today. I’ll be back tomorrow…

Emil

TechEd Europe 2013 – Tuesday

The IFEMA - Feria de Madrid convention center

The IFEMA – Feria de Madrid convention center

I have now spent the first day of TechEd listening to keynotes and sessions, and walking between the different rooms where the presentations take place. Actually it’s a lot of walking, then venue is pretty large…

The keynote discussed four themes:

  1. Empower people-centric IT
  2. Enable modern business applications
  3. Unlock insights from any data
  4. Transform the datacenter
GeoFlow demo at TechEd Europe 2013 keynote.

GeoFlow demo at TechEd Europe 2013 keynote.

A lot of sales talk of course, and not a whole lot of news. A little unexpected for me, it was actually point 3 above that was the most interesting with a some very cool demos of Excel Data Explorer and GeoFlow, new tools for data discovery and BI in Excel. These worked with data sets coming from HDInsight (Hadoop) in Azure.

If we skip the sales talk it seems the main trends are the cloud (of course), big data, BYOD (bring your own device, i.e. how IT departments handle people bringing their smart devices to work)

Also interesting was the announcement of Windows Azure Pack for Windows Server, enabling automatic provisioning of VMs in on-premise servers letting user’s configure their environments using the well-known Azure Portal locally. Pretty neat.

I went to several different sessions, most of them relatively good. Best was probably Steve Sanderson’s talk Cloud-Powered Web Apps in Minutes with Windows Azure Mobile Services where he developed a SPA (Single Page web Application) using Azure Mobile Services as a backend. Really cool presentation with almost no PowerPoint. Interesting to see that Mobile Services is not just for mobile apps, it can be used as a backend regardless of the type of application, something I had not realized can be quite useful.

This evening there was the customary welcome reception with free food and drink and a lot of exhibitors throwing swag at you if you let them scan your badge. Being a TechEd alumni, I have learned that it’s not worth all the spam you’re going to get in the coming year so I got away with just foldable frisbees for my kids and a “tech trap”, apparently used for stowing away mice and cords in the computer bag…

To sum this up I think it was an okay first day. Comparing to TechEd North America it’s a quite similar experience but in a smaller scale (perhaps half, or a third, of the number of participants). The sessions are of similar standard to those that I have attended in the US.

/Emil

TechEd Europe 2013

TechEd 2013 bling bling
My trip to sunny Madrid is now just a few days off. I’ll probably not be working much on my tan though, since I’ll be at TechEd Europe this year. Really looking forward to it, as I’ve been to two great TechEd North America events before. This time it’s Europe so it’s probably a slightly smaller event but I’ve found plenty of interesting sessions in the agenda.

I’ll be writing reports about my TechEd experience next week so stay tuned if you’re interested 🙂

/Emil

Excel macro for generating sequential id numbers

This post describes how to write a simple Excel macro to create sequential id numbers. This can be useful whenever you create lists with rows that should have a unique id, for example in product backlogs, requirement lists, etc. Often you type these ids by hand, the first starting with 1 and then increasing the id for each consecutive row. This works okay as long as the rows are in the original order but when sorting and filtering is used it can be a little difficult to know what the next row id should be. You can always select all existing ids and look at Excel’s status row which is the highest but it would be nice to automate this, yes? Yes! 🙂

This is the result we’re aiming for:

Generated id rows

To meet this goal, I have created a simple Excel macro that calculates the next id and this post describes how to use it.

First of all, make sure that the Developer Tab is enabled in the Ribbon:

Excel Ribbon Developer Tab

If it’s not, then enable it in the Customize Ribbon section of Excel’s Options dialog:

Enable Excel Developer Tab In Ribbon

Once the Developer bar is enabled, start to create a new macro by clicking on the Record Macro button and fill in the fields:

Create macro

Close the dialog and immediately stop recording the macro by clicking the same button again (it now says Stop Recording).

Then click the Macros button and edit the newly created macro by clicking the Edit button:

Edit macro

The empty source code for the new macro is displayed. Paste the following code into the macro:

ActiveCell.Formula = "=MAX(A4:A" + CStr(ActiveCell.Row - 1) + ")+1"
ActiveCell.Formula = ActiveCell.Value 'Convert formula to a value

Adjust the area so it suits the table. In the example the id column is A and the first row with data is row 4, so the area is given as A4:A. Close the macro dialog and you’re done!

Edit macro text

Try the macro by placing the cursor in the id column of the first empty row and press the keyboard shortcut you selected when you created the macro (Ctrl-N in my case) and the new id should turn up. No more counting of rows or selecting all rows to see what the highest number is, we have now automated this process, and again there is some rest to be had for our lazy soul… 😉

Note that the Excel workbook must be saved with the .xlsm extension (Excel Macro-Enabled Workbook) for security reasons as macros are considered riskful by Microsoft:

Save Macro Enabled Workbook

/Emil

Extracting stored procedure source text from SQL Server

SQL Server logo

It’s been a really long time since the last post so here’s a small SQL Server tip. I recently had to extract the source code for more than two hundred stored procedures from a SQL Server database. Obviously I didn’t want to do that by hand so I wrote a simple script using sp_helptext:

exec sp_helptext proc1
exec sp_helptext proc2
exec sp_helptext proc3
...

This did indeed extract all the source code for the procs but for some obscure reason I had a newline character after every 255:th character in the result. Close but no cigar…

I did some googling without finding anyone with the identical problem (I had already increased the “Maximum number of characters displayed in each column” setting of SQL Server Management Studio). However, it turns out there’s an alternative to sp_helptext, namely the sys.sql_modules table which can be queried like this:

select definition from sys.sql_modules where object_id = object_id('proc1')
select definition from sys.sql_modules where object_id = object_id('proc2')
select definition from sys.sql_modules where object_id = object_id('proc3')
...

This time there were no irritating newlines in the output. Problem solved!

/Emil

HTML 5 canvas performance experiment

I have started playing around with HTML 5 canvas to see what it can be used for and decided to test the performance with an old animated plasma-like demo effect that I used to do in my early days of programming some 20 years ago (I can’t believe I’m that old, how did that happen?).

Here’s a screen dump of the effect on a 600 by 400 pixel canvas:

Screen dump of the plasma effect in action

Here’s the page with the demo in real-life: http://www.meadow.se/codesamples/html5/canvasdemos/canvasdemo2.html

In Chrome I get a frame rate of about 18 frames per second on my Intel Core i7 2.70 GHz laptop with Mobile Intel graphics circuits. That’s okay I suppose, since most of the time is spent in the calculations of the color values using the following formula:

var r = Math.cos(animationOfffset + x/100 * y /100) * 255;
var g = Math.sin(animationOfffset + ((x * x) / 300) * (y / 300)) * 255;
var b = Math.cos(animationOfffset + (x-y) / 500) * 255;

This calculation has to be done for each of the (600 x 400 = 240 000) pixels in each frame. The limiting performance factor in this demo is definetely the CPU rather than the graphical performance of the canvas.

However, when I tried the demo in IE 9 on the same machine, I got about 5 fps! That’s 4 times slower! I have also tried the same demo with IE 10 and while that’s faster than IE 9, it’s still about 2.5 times slower than Chrome on the same machine.

All is not bad for IE though since it rendered the rotating text better. Comparing IE and Chrome side by side it’s obvious that IE has more stable text rendering, in Chrome the individual characters jiggle slightly when rotating the text. Once you notice it, it’s actually rather ugly.

I also tested the demo on my Samsung Galaxy S3 mobile and got 4 fps in Chrome and about the same in the built-in browser. About the same figures as for IE on my laptop. Not bad for a mobile phone…

To conclude, it’s apparently still very important to take the different browsers you’re running you’re Javascript and HTML 5 code on into account when developing web applications. It’s the 90s all over again… 😉

PS. If you try the demo yourself, feel free to post your frame rates in a comment to this post, It’ll be interesting to see how much it differs.

UPDATE 2012-12-06:

I have now tried replacing the calls to the Math.sin and Math.cos functions with pregenerated lookup tables (inspired by this code: Professor Cloud’s Fast Sine demo) and the new demo can be found here:

http://www.meadow.se/codesamples/html5/canvasdemos/canvasdemo2_LUT.html

I now get 42 fps in Chrome on my laptop, i.e. more than doubled performance, which is rather nice. However, the result in IE 9 is still only 5 fps, the same as before. So now Chrome is 8 times faster!

In Chrome on my Samsung Galaxy S3, the result is now 5 fps, also not a great improvement. The only deduction I can make from this is that for IE9 and Galaxy S3, it wasn’t the maths that limited the performance, but something else in the code. I don’t know what it might be so if anyone can shed some light on this it would really appreciated.

/Emil

Unique constraints in Sql Server do not allow multiple NULL values

For some obscure reason Sql Server does not allow multiple NULL values on columns with UNIQUE constraints. This is in conflict with ANSI standards and also very contra-intuitive.

If you think this is poorly designed, you’re not alone: http://connect.microsoft.com/SQLServer/feedback/details/299229/change-unique-constraint-to-allow-multiple-null-values

However, there is a way to create a constraint that allows multiple NULL values rather easily (this uses “filtered constraints”, introduced in Sql Server 2008):

CREATE UNIQUE NONCLUSTERED INDEX idx_yourcolumn_notnull
ON YourTable(yourcolumn)
WHERE yourcolumn IS NOT NULL;

Credits: http://stackoverflow.com/questions/767657/how-do-i-create-unique-constraint-that-also-allows-nulls-in-sql-server

/Emil

Using NDepend 4 to analyze code usage

This week I was assigned the task to analyze the usage of an ASMX web service we are planning to remove since it has a number of problems (which is another story) and switch to new and better written WCF services. As the service is rather large and has been around for years the first step was to analyze if it had methods that no client actually used anymore.

For this task I decided to use the brilliant code query functionality built into NDepend 4. I have briefly reviewed earlier versions of this tool on this blog but this time I thought an actual example of how to use it in a specific situation would be illuminating.

The first step was retrieve a list of the methods in the web service. To do that, I added an NDepend project to the web service solution. Se below for an example of the dialog used for this:

Attaching an NDepend project to a Visual Studio solution

After this NDepend performed an analysis of my solution, after which I was able to start querying my code using the CQLinq querying language. NDepend has for a long time had its SQL-like CQL (Code Querying Language) but for some reason I never got around to using it. NDepend 4 introduces CQLinq which is much nicer syntactically and has a good editor for writing code queries, including IntelliSense. For more info about CQLinq, see this introduction.

What I needed was a list of methods on my Web Service class. To retrieve this, I opened the “Queries and Rules Edit” window (Alt-Q) and typed:

from m in Methods
where m.ParentType.FullName == 
   "ActiveSolution.Lernia.Butler.EducationSI.Education" && m.IsPublic
select m

The CQLinq query window.

The results is displayed in the bottom pane. I exported the list to an Excel file for further processing.

The next step was to see which of the web service methods the different clients used, so I analyzed each client with NDepend. Note that I excluded their test projects from the NDepend analysis to make sure that no lingering old integration tests affected the results.

For each client I listed those methods of their respective web service proxy classes that they were actually calling. A query for that can look like this:

from m in Methods  
where m.ParentType.FullName == "ActiveSolution.Lernia.SFI.WinClientFacade.Butler_EducationSI.Education"  
&& m.IsPublic  
&& !m.Name.StartsWith("Begin") 
&& !m.Name.StartsWith("End") 
&& !m.Name.Contains("Completed") 
&& !m.Name.Contains("Async") 
&& m.NbMethodsCallingMe > 0 
select m

The ParentType is of course the proxy class that gets generated when adding web service references. For this type, I list all public methods (except the asynchronous helper methods that we don’t use anyway) that are used by at least one other method. The results were copied into the already mentioned Excel document and when all clients’ data was retrieved I was able to do some Excel magic to get this result:

The resulting Excel report listing the reference count for each method in the web service class.

The columns B through G contains ‘1’ of the respective client is calling it. Rows with a sum of zero in column H are not used by any client and can be safely removed. Mission accomplished.

This has absolutely just scratched scratched the surface of what can be done using CQLinq, and there is much more functionality in NDepend than just queries (the diagram tools, for example). It’s a great product for anyone that is seriously interested in code quality. And we all should be, right?

/Emil

Running Windows 8 with wide screen display in VirtualBox

If you have tried running Windows 8 in Virtual Box (a great way to try out a new Windows version before taking the leap to install it as your main OS) you might have noticed that the only display resolutions available are in 4:3 aspect ratio.

To fix this, open a command prompt (PowerShell in my case) do this:

C:\Program Files\Oracle\VirtualBox> .\VBoxManage.exe setextradata “Windows 8 test” CustomVideoMode1 1600x900x24

“Windows 8 test” is the name of the virtual machine in VirtualBox and you can select any resolution you want. Restart the virtual machine if it’s running and after that the new resolution will be available in the Screen Resolution settings inside Windows 8.

Note that it’s possible to add several new resolutions to choose from by using CustomVideoMode1, CustomVideoMode2, etc. This can be useful if you want to move between monitors in multi-monitor setups. To do that in full-screen mode, press <Host>-Home which will show a popup menu where the display can be configured. <Host> is mapped to Right-Ctrl by default.

Credits for this tip:
Running Windows 8 on VirtualBox with Additional Wide Screen Resolution

/Emil