We got a puppy!

by Graffen 23. December 2009 08:28

We’ve been talking about getting ourselves a puppy for a number of years but since we had cats while we lived in Sweden, we never really looked into it seriously. But after moving back to Denmark and changing our lives around a bit, we decided that now was just about the right time to start looking around. We chose to go for a Jack Russell terrier, mostly because they’re cute but also because they are an intelligent breed of dog. This means they are easily trained and can make really good family dogs. David looked around a bit and after talking to a lady who lives in the same building as us, found his way to Kennel Hoba

We went out yesterday to look at their puppies and ended up taking home the one named Hoba’s Speedy (there’s something about breeders giving their puppies names in alphabetical order or something – and the name of the kennel is there to keep track in the breeding program).

 

Apollo1 

We decided to change his name to Apollo, and he’s now busy settling into his new home. He has already found his spot next to whoever is sitting on the couch watching TV :-)

We’ll probably set up a separate blog to post pics and stuff of our progress with him.

Tags:

ASP.NET MVC 1.0 Html.CheckBox() outputs a hidden field?

by Graffen 1. December 2009 11:41

I just stumbled over a funny little thing in the HTML output from the Html.CheckBox() helper method in ASP.NET MVC 1.0.

In my .ASPX file, I had defined a checkbox like this

<%=Html.CheckBox("MyCheckBox") %>

 
This resulted in the following HTML output:

<input id="MyCheckBox" name="MyCheckBox" type="checkbox" value="true" /><input name="MyCheckBox" type="hidden" value="false" /> 


A bit stumped as to why I got an extra hidden field, I decided to have a look in the ASP.NET MVC source code and found the following comment:

if (inputType == InputType.CheckBox) {
    // Render an additional <input type="hidden".../> for checkboxes. This
    // addresses scenarios where unchecked checkboxes are not sent in the request.
    // Sending a hidden input makes it possible to know that the checkbox was present
    // on the page when the request was submitted.
...

This is really quite logical. The reason it works is that the first time a browser hits an element with a value attribute, the parser will ignore all subsequent elements with the same name. This way, we’ll always get a result back to our controller containing all the checkboxes that are present on the page, no matter if they are checked or not.

Tags: ,

.NET | Programming | ASP.NET MVC

Another way of creating an RSS feed in C#

by Graffen 18. November 2009 09:15

A friend of mine mailed me yesterday saying that he remembered that I had showed him a way of generating an RSS feed easily from an ASP.NET page. I pointed him at an old blog post that I wrote a couple of years back.

However, I remembered after sending him the link that I had actually re-coded that whole page to make use of a feature in the .NET library that is made for exactly the task of creating syndication feeds.

So here’s a code snippet that does basically the same thing as the old way, but does it all in C# (which means you could throw it in a HttpHandler and let it handle requests for *.rss or *.xml files :-))

 

public void ShoutBox()
{
    Response.Buffer = false;
    Response.Clear();
    Response.ContentType = "application/xml";

    using (XmlWriter writer = XmlWriter.Create(Response.OutputStream))
    {
        SyndicationFeed feed = new SyndicationFeed("mrfs.se: Shouts",
                                               "Malmö Radioflygsällskaps Shoutbox",
                                               new Uri("http://www.mrfs.se"));
        feed.Authors.Add(new SyndicationPerson("webmaster@mrfs.se", "MRFS Webmaster", "http://www.mrfs.se"));
        feed.Categories.Add(new SyndicationCategory("Shouts"));
        feed.Copyright = new TextSyndicationContent("Copyright © 2009 Malmö Radioflygsällskap");
        feed.Generator = "Graffen's RSS Generator";
        feed.Language = "se-SE";

        List<SyndicationItem> items = new List<SyndicationItem>();
        foreach (var shout in r.GetShouts(20))
        {

            SyndicationItem item = new SyndicationItem();
            item.Id = shout.ShoutDate + ":" + shout.ShoutedBy;
            item.Title = TextSyndicationContent.CreatePlaintextContent(shout.ShoutedBy);
            item.Content = TextSyndicationContent.CreateXhtmlContent(shout.ShoutText);
            item.PublishDate = shout.ShoutDate;
            item.Categories.Add(new SyndicationCategory("Shouts"));

            items.Add(item);
        }
        feed.Items = items;
        Rss20FeedFormatter rssFormatter = new Rss20FeedFormatter(feed);
        if (writer != null)
        {
            rssFormatter.WriteTo(writer);
            writer.Flush();
        }
    }
    Response.End();
}

Tags:

Enabling code syntax highlighting on a SharePoint blog

by Graffen 17. November 2009 14:35

I’ve just spent an hour looking over our Sharepoint site at work and decided that I wanted to implement the same code syntax highlighting plugin as I use on here, namely the SyntaxHighlighter plugin.

To do this was actually pretty straightforward, once I figured it out. The following steps need to be performed on all three “views” that the blog has: Default, Post and Category. What you need to do is as follows:

  1. Put the page in Edit Mode by clicking Site Actions –> Edit Page in the top right corner
    image
  2. Click image  above the “Posts” Web Part
  3. Select image and press Add
  4. On the right side of the Web Part, click Edit and select Modify Shared Web Part
    image
  5. Click the image button
  6. Insert the following code snippet:
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shCore.css"/>  
    <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/2.1.364/styles/shThemeDefault.css"/>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shCore.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushCSharp.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushXml.js"></script>  
    <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/2.1.364/scripts/shBrushSql.js"></script>  
    <script type="text/javascript">  
        SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.1.364/scripts/clipboard.swf';  
        SyntaxHighlighter.all();  
    </script> 
  7. To add more brushes, simply add the references you want. To see the list, browse to http://alexgorbatchev.com/pub/sh/2.1.364/scripts/
  8. Next, in the tool panel on the right side of the page, expand the Layout section and select Hidden
    image
  9. Click OK

 

Now all you need to do is use the PreCode Pluginfor Windows Live Writer (or alternatively just use the <pre class=”brush: csharp”> … code … </pre> in the WYSIWYG editor (remember to click the Edit Html button)


image

Happy blogging :-)

Tags: , , ,

Blogging | Utilities and Tools

Can’t add extensions to my BlogEngine.NET blog running on SurfTown

by Graffen 10. November 2009 09:22

Okay, so it’s getting really annoying now. Every morning I have to spend about 30 minutes deleting comment spam from my blog. Just this morning, here’s what my GMail inbox looked like:

 

blogspam

 

I’ve tried to enable the akismet extension, but something isn’t quite right – at least not when I upload my blog to my hosting provider (Surftown). When I add the extension, my extensions config page goes empty (or only shows 1 or 2 extensions – it differs). To rule out the possibility of a bug in the akismet extension, I tried adding a much simpler extension that doesn’t really do anything. Here’s the code:

 

using System;
using System.Web;
using BlogEngine.Core;
using BlogEngine.Core.Web;
using BlogEngine.Core.Web.Controls;
using BlogEngine.Core.Web.HttpHandlers;
 
[Extension("Just a test!", "0.1", "Graffen")]
public class TestExtension
{
  static TestExtension()
  {
    
  }
}

 

Before adding this extension to the app_code folder on my blog at Surftown, here’s what the extension settings page looked like:

 

 extensions_b4_add_new

 

And here’s the same list, after only adding the above file:

 

extensions_after_add_new

Deleting the file again brings back all the other extensions – so it must have something to do either with the extension handler, or with a configuration issue at my hosting provider.

There’s nothing in my error log, and the application isn’t throwing any exceptions (at least none that I can see). Anyone have any ideas? Please post a comment if you do (but if your name is “payday loans” I’ll just delete your posting) I’m running BlogEngine.NET 1.5.0.7 on a shared host at Surftown Denmark.

Tags:

Why is Scrum so hard to implement?

by Graffen 27. October 2009 21:14

A little over a year ago, I got my Scrum Master certification. The two day certification was extremely encouraging and inspiring, and I really felt I was ready to take on the world with my newly-acquired skills. And Certified Scrum Master sure does sound sexy, doesn’t it?

One of the things I like the most about the Scrum Master role is the coaching aspect. I really enjoy coaching, and I love the satisfaction I feel inside as the process begins to grow on the development team. When they start gathering at one-minute-to-daily-scrum-time so they can report the day’s progress to each other.

But why is Scrum so hard to get to work properly?

At the company I work, I have been trying hard for a year now to implement, if not all, then some of the Scrum process into our daily workflow. And my boss has been backing me as best as he can. My main problem is that he (and basically everyone else in the organization) don’t really understand Scrum. Some know of the basics (daily standup “scrums”, sprints, timeboxing, burn down charts), but I’m learning the hard way that if Scrum is to be successful in our department, everyone around us needs to somehow be aligned to the process and work model. Basically, I think that sending everyone to get Scrum Master certified would definitely help. But of course this isn’t really an option.

One of our biggest impediments is that we don’t have real product owners. This role is basically missing, and we “get by” at every sprint start by asking someone in the organization with domain knowledge to play the role of product owner. We also face the challenge that many of our projects are either complete re-writes of older products, or they’re something new altogether. They aren’t simply existing products that we’re just adding features to. This means that the scrum teams are facing a huge amount of architectural decisions during sprints. And seeing as we don’t really have an “architecture team”, many decisions are just made at meetings they hold together. These meetings are expensive – they often come up completely unplanned and can easily throw the burn down chart way off (I’ve seen it happen many times).

Another impediment is that we’re in the process of integrating systems from a competitor that we acquired earlier this year. This is of course a top-priority from the management group and they will spare no means to get the job done. In practice this has the effect that team members can get pulled at moments notice to do something else. And there is little I can do to stop that.

Another challenge I’m facing is the whole aspect of reporting. Finance would like us to begin reporting hours spent on each and every development project. The problem is that “time spent” is not measured in Scrum. At least not if you want to follow the process completely (which is a goal for me – Ken Schwaber, the father of Scrum, says “If you are not an expert in something, you are not at liberty to change it” – and I totally agree) I cannot possibly adapt Scrum to “work better for us” if I haven’t fully tried it in its basic form first. And we’re still getting there. But nonetheless I still have to figure out an effective way of reporting hours from the team, without asking them to actually start logging work done.

The next thing I’m going to try to push into the team is the concept of using story points when planning the product backlog. I want to start pushing the concept of relative size of backlog items, as opposed to using hours or man-days. The reason I like the idea of story points is that managers have a tendency to accept hour or day estimates as a commitment from the team. By using story points we abstract this away and convey the fact that backlog estimates are extremely rough and are solely based on hunches (because of the nature of backlog items, in that they are not at all very specific).

Next week I’ll be attending the ÖreDev conference in Malmö, Sweden. I’ll be following quite a few Agile sessions and hope to get some answers to some of my questions. Like “How can we get better at following the Scrum process as a company and not just as a small isolated team”

Tags: , , , ,

Programming | Scrum

My blog is working again

by Graffen 25. October 2009 23:18

I finally got around to taking a look at what was causing my blog to return 404 errors on most posts. It turned out that it was one specific (spam) comment on almost every single post that caused BlogEngine.NET to freak out somehow.

I’ve now upgraded to the latest version, deleted the bad comment on most posts and everything again seems to be working alright.

I have a few posts lined up for here that I’ll post over the next few weeks, so stay tuned :-)

Oh – and I’ll be moving in 2 weeks… back to good old Denmark. The story behind that decision is a whole post of its own.

 

This is the building we're moving into (it's been finished for 2 years by now)

Tags:

BlogEngine.NET | Day to Day

Testing

by Graffen 18. August 2009 15:06
Just a quick test of blogging from my iPhone. How about geotagging?

Tags:

BlogEngine.NET | Blogging

Fixing A-GPS on my new Nokia 5800 Express Music

by Graffen 26. April 2009 21:42

I just got my new phone. A shiny Nokia 5800 Express Music. I bought it mostly because I wanted a phone that was more centered around “online life” than my old N95 8GB. That means a phone where I have easy access to my Twitter, Gmail, Google Calendar etc. with a full QWERTY keyboard. I could have gone with an iPhone but I still think they’re a bit too expensive (but NICE!)

Anyway, I went for a ride today and found that the GPS was taking ages to get a proper fix. The first time it took almost 15 minutes!. So I figured that A-GPS (Assisted GPS) was configured incorrectly. When I got back home I checked the settings on my N95 8GB which used to give me a proper fix within 3-5 seconds.

In the Positioning Settings on my N95 (Settings –> General –> Positioning –> Positioning Server) the Server address was set to “supl.nokia.com”.
On my new 5800, the same settings (found under Applications –> Location –> Positioning Positioning Server) were set to “http://supl.nokia.com”. I removed the http:// part and voila!, the GPS fixes just as fast as my old N95 did :-)

Tags:

Follow up on my blade server adventures

by Graffen 24. April 2009 11:50

I promised to follow up on my adventures in using shared storage for hosting data being served by a cluster of blades. Unfortunately we don’t (yet) have a nice SAN or anything like that, so all I had access to was a simple Windows file share on a NAS (I love three letter acronyms!). I couldn’t get over the concurrence problems I faced, and servers were constantly tripping over each other giving me file locking errors and stuff like that.

So I ended up spending a day writing a small deployment application that could copy the code out to all the blade servers. What my tool does is this:

 

  1. Copy an App_Offline.htm file to the root of all web servers. The App_Offline file shows a message to users that we are upgrading and that we’ll be right back.
  2. Copy latest build from the build server to each blade
  3. Modify web.config to disable debug, fix connection strings etc
  4. Remove App_Offline from all blades.

 

All in all this ends up working really well and is easy to work with. Also, it allows me to easily hand over the deployment task to someone else, as this person only needs to install the small click-once deployment tool.

 

image

Tags:

.NET | Programming | Utilities and Tools

Copyright © 2009 Jesper Hess Nielsen. This work is licensed under the Creative Commons License.
Powered by BlogEngine.NET 1.5.0.7
Theme by Extensive SEO

About the author

A blog about me, R/C planes, .NET, Twitter and whatever else I feel like writing about.