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. Other Discussions
  3. The Weird and The Wonderful
  4. Who wrote this code?

Who wrote this code?

Scheduled Pinned Locked Moved The Weird and The Wonderful
javascriptpythonvisual-studiocomquestion
8 Posts 4 Posters 19 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.
  • M Offline
    M Offline
    Marc Clifton
    wrote on last edited by
    #1

    modelTables.Single(kvp => kvp.Key == model.GetType()).Value.ForEach(mt => mt.BeginProgrammaticUpdate()); vs simply: modelTables[model.GetType()].ForEach(mt => mt.BeginProgrammaticUpdate()); Oh yeah, I did! :rolleyes: At least there's an assert that the key exists in the dictionary. Or equally amusing: (from rec in context.GetTable<T>() select rec).ForEach(m => AppendRow(dv, (T)m)); vs. context.GetTable<T>().ForEach(m => AppendRow(dv, (T)m)); :rolleyes: :rolleyes:

    Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

    Richard DeemingR R R 3 Replies Last reply
    0
    • M Marc Clifton

      modelTables.Single(kvp => kvp.Key == model.GetType()).Value.ForEach(mt => mt.BeginProgrammaticUpdate()); vs simply: modelTables[model.GetType()].ForEach(mt => mt.BeginProgrammaticUpdate()); Oh yeah, I did! :rolleyes: At least there's an assert that the key exists in the dictionary. Or equally amusing: (from rec in context.GetTable<T>() select rec).ForEach(m => AppendRow(dv, (T)m)); vs. context.GetTable<T>().ForEach(m => AppendRow(dv, (T)m)); :rolleyes: :rolleyes:

      Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Marc Clifton wrote:

      At least there's an assert that the key exists in the dictionary.

      You'll get a different exception, but you will get an exception in both cases if the key doesn't exist. :) But the first version has the added advantage of iterating over the entire dictionary, and calling model.GetType() once for every single item within it. Probably not a huge issue, but not the best for performance. Also from x in collection select x seems to be fairly common with novice LINQ developers. :-D


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      M 1 Reply Last reply
      0
      • M Marc Clifton

        modelTables.Single(kvp => kvp.Key == model.GetType()).Value.ForEach(mt => mt.BeginProgrammaticUpdate()); vs simply: modelTables[model.GetType()].ForEach(mt => mt.BeginProgrammaticUpdate()); Oh yeah, I did! :rolleyes: At least there's an assert that the key exists in the dictionary. Or equally amusing: (from rec in context.GetTable<T>() select rec).ForEach(m => AppendRow(dv, (T)m)); vs. context.GetTable<T>().ForEach(m => AppendRow(dv, (T)m)); :rolleyes: :rolleyes:

        Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

        R Offline
        R Offline
        RickZeeland
        wrote on last edited by
        #3

        So you were looking for models that are single you old cad:

        Quote:

        modelTables.Single

        M 1 Reply Last reply
        0
        • M Marc Clifton

          modelTables.Single(kvp => kvp.Key == model.GetType()).Value.ForEach(mt => mt.BeginProgrammaticUpdate()); vs simply: modelTables[model.GetType()].ForEach(mt => mt.BeginProgrammaticUpdate()); Oh yeah, I did! :rolleyes: At least there's an assert that the key exists in the dictionary. Or equally amusing: (from rec in context.GetTable<T>() select rec).ForEach(m => AppendRow(dv, (T)m)); vs. context.GetTable<T>().ForEach(m => AppendRow(dv, (T)m)); :rolleyes: :rolleyes:

          Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

          R Offline
          R Offline
          Rick York
          wrote on last edited by
          #4

          My favorite columnist, the late Paul DiLascia used to write in the header of his code, "If this code works it was written by Paul DiLascia. If not, I don't know who wrote it."

          M 1 Reply Last reply
          0
          • Richard DeemingR Richard Deeming

            Marc Clifton wrote:

            At least there's an assert that the key exists in the dictionary.

            You'll get a different exception, but you will get an exception in both cases if the key doesn't exist. :) But the first version has the added advantage of iterating over the entire dictionary, and calling model.GetType() once for every single item within it. Probably not a huge issue, but not the best for performance. Also from x in collection select x seems to be fairly common with novice LINQ developers. :-D


            "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

            M Offline
            M Offline
            Marc Clifton
            wrote on last edited by
            #5

            Richard Deeming wrote:

            Also from x in collection select x seems to be fairly common with novice LINQ developers.

            And when I wrote that, I definitely was. Still learning actually. Just now re-discovered that Select has version that includes the index!

            Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

            1 Reply Last reply
            0
            • R RickZeeland

              So you were looking for models that are single you old cad:

              Quote:

              modelTables.Single

              M Offline
              M Offline
              Marc Clifton
              wrote on last edited by
              #6

              RickZeeland wrote:

              So you were looking for models that are single you old cad:

              As of June 24th, 2018, not any more! ;)

              Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

              R 1 Reply Last reply
              0
              • R Rick York

                My favorite columnist, the late Paul DiLascia used to write in the header of his code, "If this code works it was written by Paul DiLascia. If not, I don't know who wrote it."

                M Offline
                M Offline
                Marc Clifton
                wrote on last edited by
                #7

                Rick York wrote:

                "If this code works it was written by Paul DiLascia. If not, I don't know who wrote it."

                An a shorter version: "If this code works, it wasn't written by you!" ;)

                Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                1 Reply Last reply
                0
                • M Marc Clifton

                  RickZeeland wrote:

                  So you were looking for models that are single you old cad:

                  As of June 24th, 2018, not any more! ;)

                  Latest Article - Building a Prototype Web-Based Diagramming Tool with SVG and Javascript Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny Artificial intelligence is the only remedy for natural stupidity. - CDP1802

                  R Offline
                  R Offline
                  RickZeeland
                  wrote on last edited by
                  #8

                  So that must be:

                  Quote:

                  Love and marriage, love and marriage They go together like a horse and carriage This I tell you, brother You can't have one without the other

                  Congratulations !

                  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