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

Vesuvius vesuvius Count Orlock
  • 50% of C9 is Spam

    Minh said:
    phreaks said:
    *snip*
    Oh, you're one of them annoying "glass is half full" people! Haha!
    I am just happy to have the glass.

  • C# to Visual Basic

    Sven Groot said:
    vesuvius said:
    *snip*

    RaiseEvent raises an event (so it is used only by the class that declares the event). AddHandler attaches an event handler, same as += in C#.

    Visual Basic does not support statement lambdas, only expression lambdas. Essentially that means that a lambda must return a value, so you cannot use them this way. You'll have to use a real method instead. Fwiw, I believe VB2010 will support statement lambdas.

    That stops the dog chasing its tail and running around in endless circles.

    Thanks alot for that!

  • C# to Visual Basic

    Sven Groot said:
    This was done by hand, I haven't tried it but it should be correct.

    Private Function BuildStories(ByVal e As DownloadStringCompletedEventArgs) As IEnumerable(Of DiggStory)
        If e.[Error] IsNot Nothing Then
            Return New List(Of DiggStory)(New DiggStory() { New DiggStory() With { .Title = e.[Error].Message } })
        End If
    
        Dim xmlStories As XDocument = XDocument.Parse(e.Result)
    
        Dim stories = From story In xmlStories...<story> _
                      Where story.<thumbnail> IsNot Nothing AndAlso _
                            Not story.<thumbnail>.@src.Value.EndsWith(".gif") _
                      Select New DiggStory() With _
                      { _
                          .Id = CInt(story.@id), _
                          .Title = story.<title>.Value.Trim(), _
                          .Description = story.<description>.Value.Trim(), _
                          .ThumbNail = story.<thumbnail>.@src.Value, _
                          .HrefLenk = new Uri(story.@link.Value), _
                          .NumDiggs = CInt(story.@diggs), _
                          .UserName = story.<user>.@name.Value _
                      }
    
        Return stories
    End Function

    thanks for that, I was having a few errors with the @src attribute, so removed it, and got this (basically all the fileds are strings and integers except the uri) and VS does not complain now



    this is basically Scott Gu's Silverlight Demo. I have tried to compile this but it won't let me. the iissue is this part now



    Where I have the DownStringCompleted event as

            AddHandler diggService.DownloadStringCompleted, Function(sender, e) SearchCompleteCallback(BuildStories(e))

    but visual studio does not like the lambda which gives this error



    I also don't understand why this is not,
     
    RaiseEvent diggService.DownloadStringCompleted, Function(sender, e) SearchCompleteCallback(BuildStories(e))

    and you have "add handler" instead. Again I apologise for my highly probable misunderstanding of how the language works.

  • C# to Visual Basic

    I need to convert the following method to Visual Basic, but just cannot seem to get it

            private IEnumerable<DiggStory> BuildStories(DownloadStringCompletedEventArgs e)
            {
                if (e.Error != null)
                {
                    return new List<DiggStory> { new DiggStory() { Title = e.Error.Message } };
                }

                XDocument xmlStories = XDocument.Parse(e.Result);

                var stories = from story in xmlStories.Descendants("story")
                              where story.Element("thumbnail") != null &&
                                    !story.Element("thumbnail").Attribute("src").Value.EndsWith(".gif")
                              select new DiggStory
                              {
                                  Id = (int)story.Attribute("id"),
                                  Title = ((string)story.Element("title")).Trim(),
                                  Description = ((string)story.Element("description")).Trim(),
                                  ThumbNail = (string)story.Element("thumbnail").Attribute("src").Value,
                                  HrefLink = new Uri((string)story.Attribute("link")),
                                  NumDiggs = (int)story.Attribute("diggs"),
                                  UserName = (string)story.Element("user").Attribute("name").Value,
                              };

                return stories;
            }


    I know you can use XML literals but the Visual Basic IDE down have an XDocument class and it works. the best converter has gotten me to this point



        Private Function BuildStories(ByVal e As DownloadStringCompletedEventArgs) As IEnumerable(Of DiggStory)
            If e.Error IsNot Nothing Then
                Return New List(Of DiggStory)(New DiggStory() {New DiggStory() With {.Title = e.Error.Message}})
            End If

            Dim xmlStories As XDocument = XDocument.Parse(e.Result)



            Dim stories = _
             From story In xmlStories.Descendants("story") _
                     Where story.Element("thumbnail") IsNot Nothing AndAlso (Not story.Element("thumbnail").Attribute("src").Value.EndsWith(".gif")) _
                     Select New DiggStory
            '    CInt(Fix(story.Attribute("diggs"))), UserName = CStr(story.Element("user").Attribute("name").Value),
            '        'Dim TempUri As Uri = New Uri(CStr(story.Attribute("link"))), NumDiggs = CInt(Fix(story.Attribute("diggs"))), UserName
            '        'CStr(story.Element("thumbnail").Attribute("src").Value), HrefLink = New Uri(CStr(story.Attribute("link"))), NumDiggs
            '        '(CStr(story.Element("description"))).Trim(), ThumbNail = CStr(story.Element("thumbnail").Attribute("src").Value), HrefLink
            '        '(CStr(story.Element("title"))).Trim(), Description = (CStr(story.Element("description"))).Trim(), ThumbNail
            '        'CInt(Fix(story.Attribute("id"))), Title = (CStr(story.Element("title"))).Trim(), Description
            '        'Id = CInt(Fix(story.Attribute("id"))), Title

            'stories as NEW IEnumerable(of DiggStory)
            Return stories
        End Function



  • DVD Nonesense

    CannotResolveSymbol said:
    warren said:
    *snip*
    Except that Microsoft's spam detection effort has gone towards email (and doesn't work all that well, if the amount of garbage I see in my Hotmail account is any indication).

    If I were them, I'd plug into Akismet (which is most commonly used to block spam on Wordpress blogs, but is a web service and therefore can be adapted to work with forums or with other blog software).
    I would second that.

    I have a wordpress weblog, and have yet to be infiltrated by spam using Akismet.

    The key feature you need to deal with is deleting/isolating any post that has more than 1 or 2 links in it.  That will get pretty much all your video spam.

  • Tired of Channel 9 in a browser

    Charles said:
    vesuvius said:
    *snip*
    If you do create something, then please do share it with the rest of us. You can always upload your app to the C9 Sandbox.

    Code on, Niners!
    C
    Absolutely!

    Many thanks again.

  • Tired of Channel 9 in a browser

    Duncanma said:

    So... we do support the metaweblogapi, but I believe it is limited to adding entries into shows and blogs though. This is merely a code limitation though, I believe we could add forums without more than a line or two of changes. The other issue would be authentication, because having Live Writer send in Live ID creds would be a bad thing, but we actually do have a way to provide that.

    If you go to your profile URL + /GetAPIKey then you'll see a GUID. If you needed to login using Live Writer you would just use APIKey as a username and that GUID as your password.  This is how our authors connect now, those that use Live Writer, and it should work. I'll add an item to our queue to see what, if anything, would need to be changed to enable Live Writer for posting to the forums.

    As far as the general idea, we'd love to see a rich client (WPF for example) for Channel 9

    That is really quite useful, thank you.

    I will let you know how I get along.

  • Networking in Unix

    In the real world, you will be just the type of developer I will not want to employ - however much of a brainbox you might be

    My reasons are:

    Your Professor has already dissuaded you from choosing the path you are taking, and you have basically ignored him. This indicates insolence, and is a poisonous trait when you have a software project with a team of developers.

    You are frightened of leaving your comfort zone i.e. C/C++ and in this day and age, I could achieve what you need to do in 30 seconds using WCF. I know the object is for you to learn the why rather than the how, but the lesson you are failing to learn is to use the right tools for the job, time-wise and cost effective wise.

    Through the years I have countenanced a great many learned friends, that if I'm honest are intellectually superior than I, but they lacked the key decision making abilities hence remain coding, and are flummoxed why they are never allowed to become system architects.

    Your stubbornness is the type that drives a $500 000 software project to $5 000 000, and even more in maintenance because you have failed to use the correct tools for the job.

    Obviously I mean no offence, as you are very smart, but I only wish to precipitate a train of thought that you may choose to ignore. If you continue down the path you are choosing, then you have already lost 50% in your coursework, and Java really is not that hard. Like .NET it is laden with Library after Library and I would say that your should be able to research a multi-threaded Java web service very easily, as surely there must be oodles and oodles of people that have run into the same problem.

    Good luck with your assignment.

  • Tired of Channel 9 in a browser

    What would it take to create a client based application to read, post and download content from Channel 9?

    I presume you use the MetaWeblogAPI. If I used the Windows Live Sign-in SDK to log in users, would I need any special licensing (cough cough...should read, would you be prepared to license access) or have you any web services available that clients can use to obtain information?

    I am thinking of something like Live Writer for Channel 9. Do niners think this would be a waste of time?

  • F# Discussion

    Harlequin said:
    phreaks said:
    *snip*
    I never did any of the old-skool languages, but doesn't this look like it's back to the C/C++ in terms of syntax or look and feel? Not sure about anyone else but as a front-end guy who dove into the back-end with Classic ASP then C#, this looks totally unreadable to me:
    let squares3 = [1; 2; 3; 4] |> List.map (fun x -> x*x)

    Even if I did know F# intimately I'd say this just wasn't pretty for others to look at, example, if they came into your code 2 years later.

    Or I don't know what I'm talking about, one of the two Smiley
    What I love is just how terse/succinct/crisp the language is. They say that the true masters of English use the fewest words possible, without a loss in quality of communication. F# is a bit like that.

    The real beauty is the help you get from the IDE i.e. intellisense