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

Scott spivonious
  • Why do some programmers write code this way?

    I understand it now, but still don't see why await was used in the OP method.

    The service methods sleep for 1s (either using Thread.Sleep or Task.Delay).

    //runs in ~2s
    public ActionResult Gizmos() {
                ViewBag.SyncOrAsync = "Synchronous";
    
    
                var gizmoService = new GizmoService();
    
                List<string> allGizmos = new List<string>();
                allGizmos.AddRange(gizmoService.GetGizmos());
                allGizmos.AddRange(gizmoService.GetOtherGizmos());
    
                return View("Gizmos", allGizmos);
            }
    
    //runs in ~1s
            public async Task<ActionResult> GizmosAsync() {
                ViewBag.SyncOrAsync = "Asynchronous";
                var gizmoService = new GizmoService();
    
                List<string> allGizmos = new List<string>();
    
                var gizmoTask = gizmoService.GetGizmosAsync();
                var othergizmoTask = gizmoService.GetOtherGizmosAsync();
    
                allGizmos.AddRange(await gizmoTask);
                allGizmos.AddRange(await othergizmoTask);
    
                return View("Gizmos", allGizmos);
            }
    
    //runs in ~2s
            public async Task<ActionResult> GizmosAsyncAlt() {
                ViewBag.SyncOrAsync = "Asynchronous";
                var gizmoService = new GizmoService();
    
                List<string> allGizmos = new List<string>();
    
                allGizmos.AddRange(await gizmoService.GetGizmosAsync());
                allGizmos.AddRange(await gizmoService.GetOtherGizmosAsync());
    
                return View("Gizmos", allGizmos);
            }

  • What's your solution to attaching debugger in VS?

    @androidi: I add the breakpoint, Debug->Attach to Process and choose iisexpress.exe (or the desktop app I'm running).

    I guess they could speed that up by having an "Attach to current process" ? But they'd have to know what the PID was.

  • my biggest wish for MS to do on 2015.

    Windows 9 Funbox  <- My favorite part.

  • Why do some programmers write code this way?

    @vesuvius: Here's how I read that code:

    Gizmos - method blocks until GetGizmos returns, then returns View with model attached

    GizmosAsync - method returns View to MVC internals, which then waits until GetGizmosAsync returns, then returns View with model attached.

     

    What am I gaining?

  • Why do some programmers write code this way?

    @vesuvius: Ah okay. I haven't really had a chance to dive into the async/await keywords. So the block will occur in the method calling the one quoted above. So this in effect spins off four threads to populate the values in the viewmodel?.

    edit: nevermind, I made a console app to see what happens.

    The first await returns control to the calling method, where it can continue running (assuming it doesn't need to await on the method quoted). I can kind of see a benefit to this, assuming the four calls above take a long time, but it does require some extra thinking on the front-end.

    My gut feeling says this is overkill in an internal web app, but I do see the benefit for local apps, as control returns to the UI thread. Still, nothing that BackgroundWorker couldn't handle.

  • Why do some programmers write code this way?

    @cbae: Why all the awaits? Doesn't calling them in this way make it synchronous code?

  • I dont find the App store that bad what about the rest of the Niners Community

    , DeathBy​VisualStudio wrote

    Looks like Microsoft took the complaints seriously and did something about it. Hopefully they'll continue this effort and end up with an app store that's far better than the rest. Nice work Microsoft!

    More info: http://blogs.windows.com/buildingapps/2014/08/27/how-were-addressing-misleading-apps-in-windows-store/

    Hopefully MS is starting with the lowest rated apps.

  • The Windows Desktop is dead

    M: "Hey everyone, here's something new that is perfect for a modern use case!"

    C: "Eww! It's different. This sucks! I'm sticking with Android/Apple/Windows 7"

    M: "Hey everyone, we added some half-thought-out mouse interaction to the new stuff!"

    C: "Meh, there aren't any good apps in the store. I'll stick with Android/Apple/Windows 7"

    M: "Hey everyone, we took out all the new bits so now it's just Windows 7.1!"

    C: "What, you're still here?"

     

    Come on Microsoft, be firm on something. People take time to adapt to new stuff. The users who hate the start screen can buy Stardock. The users who like the start screen are going to hate Windows 9.

  • DeLorean

    , evildictait​or wrote

    *snip*

    It's only 25MBps to get 4K TV show from Netflix to your living room - and my bandwidth is 1Gbps - admittedly towards the top end of residential bandwidth, but within a few years it'll be standard.

    And part of the point of Delorean is that because of compression, predicting 4 button inputs doesn't mean sending 4x the data.

    Or to put it another way: Delorean increases bandwidth, but for 720p streaming (SD resolution used by Netflix), this kind of bandwidth is trivially already available pretty much everywhere.

    I don't even think any ISP in the US offers 1Gbps. Comcast (the only ISP in my area) maxes out at 150Mbps, and it's a ridiculous $115/month.

    Wake me up when I can reliably stream blu-ray quality picture and sound (that's roughly 50Mbps) on a $50/month connection without affecting others using the same connection. Netflix "HD" doesn't come close, but like other media consumers have traded quality for convenience (see MP3). Especially with audio, there's no good reason to use lossy compression these days.

  • I dont find the App store that bad what about the rest of the Niners Community

    @magicalclick: Caveat emptor, sure. But Microsoft's store needs to be better than the other stores if people are going to switch from the much more mature Apple and Google stores.

    @BitFlipper: App store problems are first-world problems by definition. :) The pool app does seem like a very small audience, but it is pretty ridiculous that Apple has 50+ and Microsoft has 1 or 0 depending on which device you're using.

    Audio apps are a much bigger audience, and I completely agree that Microsoft needs to improve latency in WinRT. A full-screen DAW app would be really nice to see running on a Windows 8 device. With multiple screens, one could even set up the studio to have the touchscreen be just the sliders and display the tracks on a larger screen. With an apparently useless audio API, Microsoft is shooting itself in the foot.