Now I have become a certified ScrumMaster after a course by Jeff Sutherland. I really like scrum since it makes development fun and is a tool that helps the team communicate. I believe that scrum can make a difference for development teams but at the same time it is not a silver bullet that will write your code. Think of it as a very simple tool for you and your team that makes it fun to work and also will help you increase your development velocity. I am looking forward to work with scrum and would really like to build an expert team that will reach the hyper speed of development and deliver, deliver, deliver :).
Thursday, April 24, 2008
Tuesday, March 4, 2008
WPF Cursors
If you want to see or test the different mouse cursors in WPF (Windows Presentation Foundation) I've created a simple sample project to do so. Note that it is very easy to set the cursor on a FrameworkElement, all you have to do is to set the Cursor property:
<Border Cursor="Hand">
<Button Content="My Button" Cursor="Help" />
</Border>
Some default Vista cursors:
Friday, February 22, 2008
SkyDrive - Wow!
I didn't use Windows Live Spaces as source for my blog because I missed the ability to have more than one blog. But Live Spaces have other great things and it is evolving all the time. The latest thing it Live SkyDrive which is a web based storage space for files. You can have your private folders, share folders with a set of friend or you can have public folders. The storage area is 5 GB (!) and it is free. All you need is to register for Live Spaces (which is piece of cake if you have a Hotmail-account).
Read more in the SkyDrive blog: http://skydriveteam.spaces.live.com/blog/
Wednesday, January 30, 2008
3D in .NET - Business & leisure!
This is a Dotway seminar presented in Malmö, Göteborg, Stockholm and Linköping. Visit www.dotway.se for more information. It's free!
The world sees an ever increasing amount of data. Visualizing and utilizing the data is one of the largest technical challenges for todays developers and designers. With Net 3.0 and WPF, Microsoft brings the third dimension closer than ever and 3D graphics is no longer the exclusive domain of game developers. We show how you could leverage the 3D-support of WPF in every day business solutions.
Furthermore we explain why XNA is most suited for gaming solutions, why Silverlight is not 3D-ready yet and why these things should matter to you.
Monday, January 21, 2008
Reset a DependencyProperty to its default value
If we have a dependency property:
public static readonly DependencyProperty MyExampleValueProperty = DependencyProperty.Register("MyExampleValue", typeof(double), typeof(MyClass), new PropertyMetadata(3.1592));
public double MyExampleValue
{
set { SetValue(MyExampleValuePropertyProperty, value); }
get { return (double)GetValue(MyExampleValuePropertyProperty); }
}
After the value has been changed we might reach a point where we want to reset this property to its default value (3.1592). This can be done in two ways:
- MyExampleValue = (double)MyClass.MyExampleValueProperty.DefaultMetadata.DefaultValue;
- this.ClearValue(MyClass.MyExampleValueProperty);
But there are some things to note here: If we have a scenario where we want to inherit the value if the dependency property is not set in the current class, then we can not use the first example (MyExampleValue =...). Why? Because we are setting the current instance to a value, so the value will not be inherited (the only thing we are doing is setting the value to the same as the default for the property). In the second example this will work since we are clearing the property instead of setting it.
Wednesday, January 16, 2008
Custom Attributes in .NET
I found a very good blog post about Attributes in .NET. This is a pretty important functionality in all the .NET languages and can be very useful in a lot of situations. Event if custom attributes have great powers and enables a lot of thing they are not used very often (not in examples at least). So if you want an introduction to the subject, look here: http://blogs.msdn.com/gordenlin/archive/2008/01/16/net-custom-attribute-learning-and-practice.aspx.
Monday, January 14, 2008
Trigger – EnterActions and ExitActions vs. EventTrigger – Actions
- What’s the difference between Trigger and EventTrigger?
- What are EnterActions and ExitActions and how do they compare to Actions?
Triggers
Triggers corresponds to the change of a property such as IsMouseOver, IsPressed (Button), IsSelected (ListBox).
Example:
<Trigger Property="IsMouseOver" Value="True">
<Trigger.Setters>
<Setter Property="Foreground" Value="Red" />
</Trigger.Setters>
</Trigger>
This trigger will be activated when the IsMouseOver-property becomes true.
EventTriggers
EventTriggers is activated when an event (RoutedEvent) is raised. When the specified routed event is raised a set of Actions are activated.
Example:
<EventTrigger RoutedEvent="Click">
<EventTrigger.Actions>
<BeginStoryboard>
<BeginStoryboard.Storyboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Width" Duration="0:0:1" From="100" To="400" AutoReverse="true" />
</Storyboard>
</BeginStoryboard.Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
The EventTrigger above will be raised when the button is pressed so that the Click event is raised.
Conclusion: Trigger is something that is activated from property changes and EventTrigger is something that is activated when a RoutedEvent is raised.
That’s the basic of Triggers and EventTriggers. But if we look more closely at Trigger we see that it also contains EnterActions and ExitActions. The Trigger example above could be extended to the following:
<Trigger Property="IsMouseOver" Value="True">
<!-- Add a trigger when the mouse is entering the button. -->
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1.0" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<!-- Add a trigger when the mouse is leaving the button. -->
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetProperty="Opacity"
To="0.2" Duration="0:0:1" />
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
<Trigger.Setters>
<Setter Property="Foreground" Value="Red" />
</Trigger.Setters>
</Trigger>
The condition is that the Trigger should be activated when the IsMouseOver-property is set to true. When this happens the EnterAction will apply and also all the Setters in Trigger.Setters. ExitActions will only be activated when the property is set to false again. The difference between EnterActions/ExitActions and the Setters is the following; If we use Setters the value we set will automatically go back to the value it had before the Trigger kicked in. When we use EnterActions or ExitActions these values will be set permanently.
To be more explicit; If we remove the ExitActions in the code above we will only have EnterActions that will set Opacity to 1.0 (default was set to 0.5 in my code) and also the Setter that will change the Foreground to Red when the mouse is over the button. If we move the mouse away from the button the Foreground will go back to its default value (probably black) but the Opacity will still be 1.0.
The conclusion is that EnterActions and ExitActions we set values permanently and Setters will only set temporary values that will be applied as long as the property condition is fulfilled in the Trigger. We can also note that EventTriggers also have EnterActions and ExitActions but these can not be set (we will get a runtime error).
Saturday, December 22, 2007
Blogger.com as your blog engine!
About
This article is a short description of how to use blogger.com as your blog engine for your personal ASP.NET web page. I.e. an example of how to have a blogger.com account and write your blogs there and at the same time display your blog on another web page.
Problem
I was tired of developing my own blog/article engine so I wanted to use one of the existing ones (why reinvent the wheel?!) and then display the blog on my web page (www.bursjoo.se). My first approach was to use Windows Live Spaces (spaces.live.com). But the blog functionality was limited to one blog only, I wanted three (one for my personal blog, one for the tech-blog and one for my projects). Next I wanted an API for .NET and I wanted to use Windows Live Writer for writing blogs.
Solution
My choice of blog engine was blogger.com; part wise because of the very nice .NET API (Google Data API) that Google provides but also because blogger.com have great blogging functionality. After the API was downloaded and installed into a sample web project I wanted to create a web page with the following functionality:
1. A list of recent blogs.
2. A month/year-list for blog archive.
3. A page displaying the most recent blogs.
4. A page displaying a single blog-post and all its comments.
5. A structure of all the above so that a new blog could be added to a web site in a simple way.
This is the structure:
The topmost part is the Blog.aspx site. This site is the one that you can customize to fit your layout and make your blog look the way you want to. Technically the controls will call some method in the Blogger.cs file (GetRecentPosts, GetPost, GetArchive...). This class will then forward the question to blogspot.com via the Google Data API and retrieve the data.
To use several blogs on your web site you can create several files like Blog.aspx (e.g. Blog.aspx, Projects.aspx, Articles.aspx). In each of these files you set the path to the blog on blogspot (e.g. http://bursjooprojects.blogspot.com).
This example does not require you to login or pass any login-information to get the data. In other words this is a blog viewer and you can actually view other blogs than your own, you only have to provide the address to the blog you want to display. You can also not post to your blog account, use Windows Live Writer or the online blogspot.com interface.
One problem that I found when developing this example was that I wanted a visitor to be able to post comments to my posts on my site. This is kind of possible but there is one problem. Via the Google Data API, only the owner of the blog can post a comment to the blog (using login information via the API) and this means that all comments from my site will be displayed like it was I that posted the comment, not very pretty. So my solution is to put a link to the blogspot comment page, so that a user can comment the post via the blogspot.com interface. The reason why not anyone can post to your blog is that spam bots could then use the Google API to post spam to your blog. When you post a comment via the blogspot interface you must provide a captch-string and then spam bots can be stopped.
Download Source
Download the Visual Studio example here.
Examples
http://www.bursjoo.se/Blog.aspx - http://bursjoolife.blogspot.com
http://www.bursjoo.se/Project.aspx - http://bursjooprojects.blogspot.com
http://www.bursjoo.se/TechBlog.aspx - http://bursjootech.blogspot.com
Wednesday, December 19, 2007
DELL, MediaDirect and Outlook addin
If you have performance problems and have a computer from DELL with MediaDirect installed. Try to uninstall the plugin for Outlook. Run the .msi file in C:\Program Files\DELL\MediaDirect\OlAddin, choose to remove the plugin. This plugin also caused some very annoying folders (outlook calendar and outlook contacts) to be created everywhere. It also made the texteditor (when writing a new mail) very slow. I hope this will help someone!
Bind from XAML to a local property in code-behind
One way to create a binding is to bind to another element in your XAML-file. E.g. Text=”{Binding SomeProperty, ElementName=MyOtherElement}” where SomeProperty is a property in your MyOtherElement. MyOtherElement is the name (x:Name) of an element in your XAML-file. With this knowledge we just set a name on our root element (Window, Page, UserControl or whatever) x:Name="myRoot" and then refer to that name in ElementName. E.g Text="{Binding MyLocalProperty, ElementName=myRoot }". The MyLocalProperty is then a property in our code-behind file. This can be a standard property or a dependency property.
Download the sample project (BindToAPropertyDemo.zip).