Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Fitting Code from Microsoft

Fitting Code from Microsoft

Scheduled Pinned Locked Moved The Lounge
csharpcssandroidwpfcom
13 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Lost User

    Often times the MSDN site sucks for that very reason. I've gone out there to learn how to do something simple like iterate through a collection and they'll throw in a log function or something. I think the sample guys get bored and add stuff that interests them instead of keeping the example simple. Guy 1: OMG, I got stiffed - I have to write the MSDN article for how to iterate through a collection. Guy 2: Pfft. Make it a recursive iteration which sorts Fibonacci numbers, but only those numbers that are also prime numbers. Guy 1: That would make a criminally insane example. Guy 2: Either that or we could order a pizza and kill the delivery boy. Guy 1: Naw, an evil example would make more people cry.

    C Offline
    C Offline
    CMullikin
    wrote on last edited by
    #4

    MehGerbil wrote:

    Guy 1: Naw, an evil example would make more people cry.

    This just made my day. :laugh:

    The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin

    1 Reply Last reply
    0
    • J Judah Gabriel Himango

      Is a list of static properties complex?

      My Messianic Jewish blog: Kineti L'Tziyon My software blog: Debugger.Break() Judah Himango

      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #5

      No, but I was surprised to find a 900 line class file that has to use WPF with XAML just to show me how to use Kinect Sensors. The point of showing examples is to keep things simple. Me, personally, I think this would have been a much better introduction to drawing an image on screen.

      if(KinectSensor.KinectSensors.Count > 0){
      KinectSensor sensor = KinectSensors[0];
      if(!sensor.IsRunning){
      sensor.Start();
      }
      Kinect.AllFramesReady += new EventHandler(Kinect_AllFramesReady);
      }

      private void Kinect_AllFramesReady(object sender, AllFramesReadyEventArgs e) {
      ColorImageFrame frame = e.OpenColorImageFrame();
      if (frame != null) {
      byte[] pixels = new byte[frame.PixelDataLength];
      frame.CopyPixelDataTo(pixels);
      Bitmap image = new Bitmap(frame.Width, frame.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
      BitmapData bmapdata = image.LockBits(new Rectangle(0, 0, frame.Width, frame.Height), ImageLockMode.WriteOnly, image.PixelFormat);
      IntPtr ptr = bmapdata.Scan0;
      Marshal.Copy(pixels, 0, bmapdata.Scan0,
      frame.PixelDataLength);
      image.UnlockBits(bmapdata);
      pictureBox1.Image = image;
      }
      }

      Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

      _ 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        Is a list of static properties complex?

        My Messianic Jewish blog: Kineti L'Tziyon My software blog: Debugger.Break() Judah Himango

        _ Offline
        _ Offline
        _beauw_
        wrote on last edited by
        #6

        Perhaps not "complex," but the source code in question is apparently sufficiently ugly that if you created something similar, you'd be warned.

        L 1 Reply Last reply
        0
        • _ _beauw_

          Perhaps not "complex," but the source code in question is apparently sufficiently ugly that if you created something similar, you'd be warned.

          L Offline
          L Offline
          lewax00
          wrote on last edited by
          #7

          I guess it's a good thing that I had no idea such a warning was even possible...

          1 Reply Last reply
          0
          • E Ennis Ray Lynch Jr

            So I have the Kinect SDK and Toolkit downloaded. All of the C# samples are in WPF, how nice of them. *rolleyes*. IN the KinectSensorManager class (which is 848 lines long) it is decorated with this: [SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity", Justification = "Complexity is caused by long list of static properties. This is not real complexity.")] Fitting, MS provides an overly complex sample code base to show how to use a connect and Suppresses there own message that should have told the developer, hey, wait a minute, I probably should be doing a lot less work. I feel sorry for any developer who wants to learn this stuff who isn't an experienced programmer if these are the supposed samples for people to use.

            Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

            _ Offline
            _ Offline
            _beauw_
            wrote on last edited by
            #8

            Ugh. That's the kind of mumbo-jumbo that keeps me from using WPF. The good news is that, if games are what you wish to develop, OpenGL is still around and it's almost completely devoid of architecturally correct foolishness.

            J 1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              No, but I was surprised to find a 900 line class file that has to use WPF with XAML just to show me how to use Kinect Sensors. The point of showing examples is to keep things simple. Me, personally, I think this would have been a much better introduction to drawing an image on screen.

              if(KinectSensor.KinectSensors.Count > 0){
              KinectSensor sensor = KinectSensors[0];
              if(!sensor.IsRunning){
              sensor.Start();
              }
              Kinect.AllFramesReady += new EventHandler(Kinect_AllFramesReady);
              }

              private void Kinect_AllFramesReady(object sender, AllFramesReadyEventArgs e) {
              ColorImageFrame frame = e.OpenColorImageFrame();
              if (frame != null) {
              byte[] pixels = new byte[frame.PixelDataLength];
              frame.CopyPixelDataTo(pixels);
              Bitmap image = new Bitmap(frame.Width, frame.Height, System.Drawing.Imaging.PixelFormat.Format32bppRgb);
              BitmapData bmapdata = image.LockBits(new Rectangle(0, 0, frame.Width, frame.Height), ImageLockMode.WriteOnly, image.PixelFormat);
              IntPtr ptr = bmapdata.Scan0;
              Marshal.Copy(pixels, 0, bmapdata.Scan0,
              frame.PixelDataLength);
              image.UnlockBits(bmapdata);
              pictureBox1.Image = image;
              }
              }

              Need custom software developed? I do custom programming based primarily on MS tools with an emphasis on C# development and consulting. I also do Android Programming as I find it a refreshing break from the MS. "And they, since they Were not the one dead, turned to their affairs" -- Robert Frost

              _ Offline
              _ Offline
              _beauw_
              wrote on last edited by
              #9

              Yeah, but what if you want to make an enterprise Kinect application? Your garage hacker example won't help then, you cowboy!

              1 Reply Last reply
              0
              • _ _beauw_

                Ugh. That's the kind of mumbo-jumbo that keeps me from using WPF. The good news is that, if games are what you wish to develop, OpenGL is still around and it's almost completely devoid of architecturally correct foolishness.

                J Offline
                J Offline
                Julien Villers
                wrote on last edited by
                #10

                And of course OpenGL is completely functionally equivalent to whatever MS has to offer, not to mention the tooling. Please, the OpenGL vs Direct3D war is now long lost, mostly through self-inflicted wounds (I can quote posts from OpenGL proponents if you wish). There are some places where OpenGL will reign freely (embedded) and some places it won't enter (Xbox, Windows 8), accept it, move forward and use the right tool for the job.

                'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                _ 1 Reply Last reply
                0
                • L Lost User

                  Often times the MSDN site sucks for that very reason. I've gone out there to learn how to do something simple like iterate through a collection and they'll throw in a log function or something. I think the sample guys get bored and add stuff that interests them instead of keeping the example simple. Guy 1: OMG, I got stiffed - I have to write the MSDN article for how to iterate through a collection. Guy 2: Pfft. Make it a recursive iteration which sorts Fibonacci numbers, but only those numbers that are also prime numbers. Guy 1: That would make a criminally insane example. Guy 2: Either that or we could order a pizza and kill the delivery boy. Guy 1: Naw, an evil example would make more people cry.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #11

                  No greater truth has ever been spoken. :D I loathe the MSDN for that very reason. :mad:

                  1 Reply Last reply
                  0
                  • J Julien Villers

                    And of course OpenGL is completely functionally equivalent to whatever MS has to offer, not to mention the tooling. Please, the OpenGL vs Direct3D war is now long lost, mostly through self-inflicted wounds (I can quote posts from OpenGL proponents if you wish). There are some places where OpenGL will reign freely (embedded) and some places it won't enter (Xbox, Windows 8), accept it, move forward and use the right tool for the job.

                    'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                    _ Offline
                    _ Offline
                    _beauw_
                    wrote on last edited by
                    #12

                    I didn't claim that OpenGL and DirectX were functionally equivalent. My claim is that one of them makes me want to spend the day programming, while the other makes me want to round up the townspeople and head up to Redmond with pitchforks.

                    J 1 Reply Last reply
                    0
                    • _ _beauw_

                      I didn't claim that OpenGL and DirectX were functionally equivalent. My claim is that one of them makes me want to spend the day programming, while the other makes me want to round up the townspeople and head up to Redmond with pitchforks.

                      J Offline
                      J Offline
                      Julien Villers
                      wrote on last edited by
                      #13

                      I'm trying to picture in my head developers with pitchforks... doesn't compute :D

                      'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups