Entries:
Comments:
Posts:

Loading User Information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading User Information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Discussions

Bent Rasmussen exoteric stuck in a loop, for a while
  • .Net R-Tree

    Maddus Mattus said:
    AdamSpeight2008 said:
    *snip*

    Because it's too slow when you have a large number of appointments,..

     

    I started out with your approach, but it's come to a point where I have to bite the bullet and index them,..

    Still, out of curiosity

    - what is a large number

    - what is slow

     

    Just curious here Smiley

  • Extensia

    Dr Herbie said:
    exoteric said:
    *snip*

    Hah!  Don't think we hadn't noticed!

     

    Good Idea.

     

    Herbie

     

    I've been unmasked! All welcome to join the fun, it's very very alpha atm, though Smiley

    Write codeplex username here for anyone interested.

  • Thread formatting: bold italic => italic; italic bold => bold

    See this

     

    bold

    italic

    bold italic

    italic bold

     

    well, technically strong and emphasis (em)

     

    The rendering does not respect a overlaid elements, rather it picks the inner-most element as the ruling style. Probably a stylesheet issue.

  • Widescreen Channel 9

    Do we need a wide-screen version (option) of Channel 9 that is more code friendly?  Smiley

  • Extensia

    A colleague asked how to query an XElement for elements being completely oblivious to what namespace it has - or not! Using XElement.Element will not work. He asked about search/replacing on the source to eliminate prefixes. That's ugly and doesn't remove the namespace attributes. Maybe some fancy regular expression can do this. But I think the best solution is to somehow filter on the element without namespaces. Second best way is to somehow remove all namespace annotations and continue, but that sounds wasteful. I came up with this quick solution - maybe there's more natural ways to deal with this. I don't recommend ignoring namespaces but it's what he wanted.

     

    Solution provided by extension methods.

     

    /* <foo><bar/></foo> <foo xmlns="boo:far"><bar/></foo> */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Extensia.Infoset { using System.Xml.Linq; public static class Extensions { public
     static IEnumerable<XElement> WithLName(this IEnumerable<XElement> elements, string name) { return from element in elements where element.Name.LocalName == name select element; } public static IEnumerable<XElement> LDescendants(this XElement context, string
     name) { return context.Descendants().WithLName(name); } public static IEnumerable<XElement> LElements(this XElement context, string name) { return context.Elements().WithLName(name); } public static XElement LElement(this XElement context, string name) { return
     context.LElements(name).FirstOrDefault(); } } } 

     

    I want to measure the performance of this at some point.

  • Extensia

    exoteric said:

    Seeing Sven's parameter parsing library made me think of publishing a very simple technique I've been using for a couple of small console applications. Material for another blog post.

     

    Example code first

     

    static void Main(string[] args) { // parse flag - naturally typed as bool var a = args.Argued("fast"); Console.WriteLine("fast("+a+")"); // parse parameter, naturally typed as string var b = args.Argument("price"); Console.WriteLine("price("
     + b + ")"); // parse parameter into typed value, naturally typed as T? var c = args.Argument("price").Eval<decimal>(); Console.WriteLine("price<" + c + ">"); // parse parameter into typed value, with sweeter syntax, naturally typed as T? var d = args.Argument<decimal>("price");
     Console.WriteLine("price<" + d + ">"); if (!d.HasValue) Console.WriteLine("value missing or format was wrong"); }

     

    Now the extension methods

     

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Extensia.Console { using Core; public static class Extensions { public static bool Argued(this string[] arguments, string parameter) {
     return arguments.Contains("/" + parameter); } public static string Argument(this string[] arguments, string parameter) { var x = (string)null; if (arguments != null && parameter != null) { var p = "/" + parameter + ":"; var q = from arg in arguments where
     arg.Contains(p) && arg.Length > p.Length select arg.Substring(p.Length); x = (q.Count() > 0) ? q.First<string>() : null; } return x; } public static T? Argument<T>(this string[] arguments, string parameter) where T : struct { return arguments.Argument(parameter).Eval<T>();
     } } } 

     

    And a former aquaintance, slightly redesigned due to the mess that is exceptions

     

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Extensia.Core { using System.ComponentModel; public static class Extensions { public static T? Eval<T>(this object x) where T : struct
     { var z = (T?)null; if (x != null) { var ct = TypeDescriptor.GetConverter(typeof(T)); if (ct.CanConvertFrom(x.GetType())) { try { z = (T)ct.ConvertFrom(x); } catch (Exception e) { var safe = (e.GetBaseException() is FormatException) || (e.GetBaseException()
     is InvalidCastException); if (!safe) throw e; } } } return z; } } }

     

    Enjoy Smiley

    Thought about letting formatting and null errors surface as exceptions with parameters named so you could try/catch and provide helpful feedback. To-do.

  • Embedded video

    Right now when you want to embed a video, you are noted that you can point to SoapBox and YouTube videos. Maybe you should make that YouTube and Vimeo.

  • Weekend videos

    I don't know about anyone else, but I've come to visit this site quite frequently and although Channel 9 is cool in weekends too, it is really felt that everybody is on weekend. So maybe it would be interesting to use the fact that people usually have more time to spend in weekends and schedule a couple of videos for weekends. Just a thought Smiley

  • Splinter Threads

    JoshRoss said:

    Wouldn't hierarchical threading achieve a similar result with less complexity?

    I think you're right. I'm not totally sure hierarchical threading is a pragmatic solution in the sense that it may foster more splintering - on the other hand, all splintering that would happen anyway, is tucked away.

  • The Radio

    Erisan said:
    jamie said:
    *snip*

    > i like it - but just cant listen to it

     

    Smiley. I admit that I can't listen it everyday either but there's days at a work when that kind of "music" makes a lot of sense ...

     

    LOL Erisan! That first guy sounds like bad trip or possibly grenade shock in a warzone  Big Smile