Archives

Archives / 2006 / October
  • Comments now working

    Tags: Website

    The comments on this blog should now be working. I had some glitch in my spam detection, which should now be fixed.

  • Even better encapsulation of getting a value from XmlNode

    Tags: .NET, C#, XML

    Marcus writes in his blog how he often ends up with a method that reads an attribute from an XmlNode object. He has optimized his method so that the exception handling will be minimal, since that is pretty expensive.

    This is a pretty common scenario for me and I have an even better solution, that does'nt involve exception handling at all.

    private static string GetAttribute(XmlNode node, string name)
    {
        XmlElement elm = node as XmlElement;
        if (elm == null) {
            return "";
        }
        return elm.GetAttribute(name);
    }

    This method uses the C# as operator which cast the XmlNode to an XmlElement, if it fails it will return null instead of invoking exception handling.

    If you compare the performance of this and Marcus it's about the same using all three of them when there is an attribute with that name on the XmlNode object, but if it is not then this method is faster. 10.000 iterations of these three different implementations with an attribute that does not exist on the Xml node then we get these results:

    • Marcus first method (try/catch): 0,878 seconds
    • Marcus optimized method (foreach): 0,877 seconds
    • My implementation (cast): 0,001 seconds

    Comparisons when hitting a correct attribute looks like this for 1.000.000 iterations:

    • Marcus first method (try/catch): 0,200 - 0,240 seconds
    • Marcus optimized method (foreach): 0,133 - 0,284 seconds
    • My implementation (cast): 0,112 - 0,257 seconds

    If you have more attributes on the Xml node then Marcus optimized method will start to suffer. These timings are for 1.000.000 iterations and 6 attributes:

    • Marcus first method (try/catch): 0,323 - 0,342 seconds
    • Marcus optimized method (foreach): 0,523 - 0,533 seconds
    • My implementation (cast): 0,309 - 0,310 seconds

    You can also write this code inline (and allocate the XmlElement outside the loop so it's only allocated once), i.e. don't create a method for it, and you will have about 10% performance increase on a lot of iterations.

    This is what I really like, you may call me an optimization nerd, but that is the beauty of programming...

    Anyone have an even better implementation?

    Note: The times was measured with QueryPerformanceCounter in Kernel32.dll

  • Microsoft XPS Essentials Pack

    Tags: Microsoft, .NET, XML, Windows XP, Windows Vista, Windows Server 2003, Software, Downloads

    To view XPS files, if you do not have Windows Vista or Microsoft.NET Framework 3.0, you can download the Microsoft XML Paper Specification Essentials Pack Version 1.0. The download contains an XPS Reader, very much like the Adobe PDF reader and an XPS Document writer, which allow you to print to XPS files.

    There are other goodies in this pack such as:

    • an XPS IFilter that will help you index XPS files, with Windows Desktop Search for example
    • Windows shell handlers for thumbnail views in Windows Explorer

    The pack requires Windows 2000, 2003 or XP with the latest service packs and Microsoft Core XML Services 6.0. It's still a beta, but worth a shot.

    Read more about the XML Paper specification here where you also can find the specification and sample files.

  • Custom search engines - samples

    Tags: .NET, SharePoint, Internet and the Web, Windows Live

    Yesterday I wrote a quick post on Google Co-op and Windows Live Search Macros and i thought that I should provide you with two great samples.

    Lawrence Liu has set up a custom search on Windows Live Search called SharePoint Community Search. The search focuses on SharePoint related sites and blogs.

    Gavin Joyce, the man behind DotNetKicks.com, has created a .NET Search Engine using Google Co-op. Gavin invites everyone to contribute with .NET releated sites that should be in the search scope.

  • Windows Desktop Search 3.0 RTW

    Tags: Microsoft, SharePoint, Windows XP, Microsoft Office, Windows Live

    Microsoft has released Windows Desktop Search 3.0 RTW and it's available for download here (XP x86, other versions are available at Microsoft Download Center). I have been using the beta 2 extensively since the release, and the betas before that. It's a great desktop search application and integrates incredibly nice with the upcoming Office 2007. Finding e-mails in Outlook 2007, documents on your harddrive or captured images in OneNote 2007 is really easy and fast. Give it a try!

    Windows Desktop Search is the desktop part of the Microsoft search commitment. The other two main parts are the Live Search, for searching the Internet, and SharePoint Server 2007 for the enterprise search.

    Windows Live Gallery provides you with a number of great plugins for WDS, you can find plugins for Notes, .MSG files and others here.

  • Custom search engines

    Tags: Microsoft, Internet and the Web, Windows Live

    Both Google and Microsoft have released custom searches which allows you to create your own specialized searches. Microsoft call it Windows Live Search Macros and Google Google Co-Op. They are basically the same and allows you to create search engines that are specialized for a certain interests, sites or set of keywords.

    livesearchMicrosoft Search Macros is the easiest one to start with and with a few simple clicks and forms you are done. Before saving a macro you have to have a valid Windows Live account and then create a Creator ID, which will identify your search macros. For example I have registered wictorwilen as a creator id and my macros will appear under http://search.live.com/macros/wictorwilen/.  You have the ability to share your searches or keep them for yourself.

    googlecoopGoogle Co-Op is basically the same, you have to have a valid Google account and then you can create and share your search enginge just as with Windows Live Search Macros. Co-op requires that you have a keyword to search for but Search Macros allows you to just specify a set of sites, but Co-op have to option to search all sites for the keyword an emphasize on specified sites. The Url to the custom search is not that user friendly in Co-Op, it will be something like this: http://www.google.com/coop/cse?cx=0232320252377593622159%3Auz4tnaxf4l8.

    Both of them have the option to customize the user interface of you search engine.

    Googles Co-Op includes a number of additional features that I find really interesting especially the function to refine results of searches. You can help improving the searches of certain topics, which means that you have the possibility, if you think of yourself as en expert in a certain topic, to add annotations and sites that should be relevant to the topics so the search will be more accurate.

    In the end choosing your custom search provider is highly a matter of taste and feeling. As of now I find the Google search index more interesting and better, but the custom search from Live Search is easier and have a better user interface.

  • Why do things always fail when doing a demo?

    Tags: Personal, Business, Internet Explorer

    Demonstrating applications for customers is a haunted task. When doing a demo for a customer at least one thing will fail or result in an unexpected result; a brand new error, a debug dialog box with unwanted text, test content that should not be read by the ones you are demoing for etc. If it's not the application then you have some other things messing up; no connection between the laptop or projector or no connection to the network.

    This will happen even if you thoroughy go through your demo before and prepare everything, and you know that the application is working as it should.

    It happened me today; for some reason the laptop decided to zoom down to 10% in Internet Explorer 7 ,when I should demo our application, as soon as I moved the mouse in the Internet Explorer window. When returning back to the office I found out that the ctrl-key for some reason was stuck.

    But, since you know that something always will happen the real art of doing a demo is the knowledge of this and talking your way out of it or having a good backup plan.

    Do you have any nice stories to share on this subject?

  • Winternals resurrected in Microsoft Desktop Optimization Pack

    Tags: Business, XML, Windows Vista, Software

    The Windows Vista blog announces the Microsoft Desktop Optimization Pack, a desktop solution that will help Windows desktop users tune their applications and operating systems. It will include applications and features that will enhance:

    • desktop deployment
    • application comaptibility
    • diagnostics and repair

    This pack is a result of Microsoft aquiring a handful of nice companies, such as the great Winternals.

    You can read all about it at the Desktop Optimization Pack site.

    When I first read through that page something caught my attention:

    Why are all the downloadable files .PDF 's? Why don't Microsoft use their own .XPS file format as an alternative?

    I don't mean that they should skip PDF, but if Microsoft would like to promote XPS they should really use it on their site.

  • Update your feeds!

    Tags: Personal, Website

    From now on my feeds are published through FeedBurner to get better statistics, yeah I'm a fan of stats. I've been using Google Anlytics for this site and others for some long time now and are very satisfied with it - but the lack of tracking feeds or any other type non-script-enabled stuff annoys me. From what I can understand Urchin (the company Google turned into Google Analytics) had that possibility before when making e-mail campaings, but I can't get it to work. If you have any idea how to I'd be glad.

    So you out there who already subscribes, please update your feed and point to the new feed at: http://feeds.feedburner.com/WictorWilen

    FeedBurner

  • Dell XPS M1210

    Tags: Personal

    Last week I recieved my brand new laptop, an Dell XPS M1210. The time had come to throw my Dell Inspiron 9100 through the window!

    The 9100 has been a great laptop through the last two and a half years but my machine was a monday sample. I was on my third power adapter, one blew up with the smell of gun powder and the second stopped working. I had to switch battery once, when the old one could last for nine minutes. The last 7-8 months I got a BSOD each time I booted it and several times in a row if the laptop was cold, due to some error in the graphics card. I have reinstalled it numerous times and switched hard drive once, since the earlier one started trashing my files. I  have not been able to listen to music for a year, since the speaker output only gives my the left channel (oh, I replaced that part once) and when I was using it as a laptop I got burn marks on my thighs. On the positive side I have walked around with a nuclear powerplant - both in power and in weight!

    Dell Inspiron XPS M1210 vs 9100

    The XSP M1210 is smaller, lighter and faster but lack the great screen of the 9100, but I most often use an external monitor so I don't care that much about that. Now I can be on the road for 4-5 hours with the third of the weight. The screen is really good and the keyboard works fine. It has a small built-in camera, so Skyping is really smooth. The M1210 is equipped wiht four USB and one Firewire port but it lacks DVI output. It has 2 GB RAM and a Intel Core 2 Duo processor and a 256 MB NVIDIA GeForce Go 7400 graphics card.

    I read a lot of reviews before ordering it and I really think that this is the piece of hardware that will fit me! I have not put it through any extensive testing yet, but the performance is really good when developing and running Virtual Server or Virtual PC (I'm trying out 2007 beta now) works really smooth. I don't hope this one will cause as much headache as the last one :-), but there is one reinstall coming up really soon - Vista!

  • Task Manager in Windows Vista

    Tags: Windows Vista

    The Task Manager in Windows Vista (RC2) has improved somewhat since Windows XP. There are some really nice new features that makes the Task Manager more useful.

    Task Manager in Windows Vista

    First of all the Processes tab has been split into two: Processes and Services. This will makes it more easier to find the processes in the lists and the lists has also been improved with descriptions of the processes. On the Services tab you will also find a shortcut to the Services Management Console.

    Task Manager in Windows Vista

    The Performance tab has gotten a facelift with a shortcut to the Resource Monitor which will give you much more information on the usage of the resources of your machine and is far more useful for measuring performance (which Task Manager never was intended to be used for).

     Task Manager in Windows Vista

    Resource Monitor in Windows Vista

  • Simple List Extensions in my feed

    Tags: XML, Internet Explorer, Website

    Simple List Extensions (SLE) is a set of extensions to RSS 2.0 and Atom feeds created by Microsoft to make it easier to exposing ordered lists through the feeds.

    Simple List Extension contains a set of tags that tells the feed readers how to sort or filter the items in the feed. It also contains a tag that instructs the reader to interpret the feed as a list. If the feed is marked as a list the reader should treat the feed as the complete ordered list which means that readers must remove any cached items not present in the feed.

    I did a test om my RSS feed with the extensions and when you watch it through a SLE enabled reader, Internet Explorer 7 for instance, you will now see the possibility to sort the items based on the number of comments each item has.

    Note that when inserting the SLE tags the default Sort by and Filter by functions in IE7 is removed. I had to add the filter by category and sort by date and title to my feed.

    This is how the feed looks like:

    <rss version="2.0" xmlns:cf="http://www.microsoft.com/schemas/rss/core/2005"><channel> ... <cf:listinfo><cf:sort element="pubDate" label="Date" data-type="date" default="true"/><cf:sort element="comments" label="Comments" ns="http://purl.org/rss/1.0/modules/slash/" data-type="number"/><cf:sort element="title" label="Title" data-type="text"/><cf:group element="category" label="Category/tag"/></cf:listinfo> ... </channel>

  • Language problems with live.com

    Tags: Windows Live Writer, Windows Live

    Yesterday I sat at home using my XP Media Center and decided to check out the Windows Live Gallery if ther were any new interesting Writer Plugins. I fired up Internet Explorer and browsed to the gallery via the link from one of my earlier posts to my Acronyms Plugin.Windows Live Gallery menu in swedish

    I ended up in an error page that said that the request could not be handled, pleas try again in five minutes. The page was in swedish and provided a link to the Gallery start page, which also was in swedish and there were no links to the Writer Plugins. To bad for people in sweden! But, it all worked fine on my laptop a few hours ago and my first guess, which was right, was that Internet Explorer was defaulting to the Swedish language (found under Internet Options - Languages), and my laptop used English (United States).

    This, of course, made me to test some stuff - how do I change it to the english version without changing the browser!

    This seemed more problematic than I expected! I tried to search for the plugin and found nothing, even when I specified to search in Enligsh.

    I tried to sign in using my Windows Live account - did not matter. I tried to find some Settings on live.com that could change the market for the Gallery (this only worked on www.live.com not gallery.live.com). The help instructed me to change the IE settings.

    I think not having the option to change language or as it is right now, you get an error when trying to reach a page that don't exist in your language is embarrassing. I have worked with a lot of content management tools and they have at least a link to the page in the original language.

    Please live.com team: implement an change language/market function for the different live.com sites and a better exception handling for languages.

  • Add Office 2007 icons to SharePoint 2003

    Tags: SharePoint, Microsoft Office

    Here is a quick instruction on how to install the Microsoft Excel 2007 and Microsoft Word 2007 default icons to your SharePoint 2003 site.

    First of all you need these two icons, right-click them and choose Save Picture As.

    Copy the two .gif files into the C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\IMAGES\ folder.

    Then open the file C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\XML\docicon.xml with your favorite XML editor and add these two lines under the ByExtension element:

    <Mapping OpenControl="SharePoint.OpenDocuments" EditText="Microsoft Office Word 2007" Value="icdocx.gif" Key="docx" />

    <Mapping OpenControl="SharePoint.OpenDocuments" EditText="Microsoft Office Excel 2007" Value="icxlsx.gif" Key="xlsx" />

    Save the file and reset the IIS and you're done.

AWS Tracker

About Wictor...

Wictor Wilén is a Director and SharePoint Architect working at Connecta AB. Wictor has achieved the Microsoft Certified Architect (MCA) - SharePoint 2010, Microsoft Certified Solutions Master (MCSM) - SharePoint  and Microsoft Certified Master (MCM) - SharePoint 2010 certifications. He has also been awarded Microsoft Most Valuable Professional (MVP) for four consecutive years.

And a word from our sponsors...

SharePoint 2010 Web Parts in Action