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. Code as War Crime

Code as War Crime

Scheduled Pinned Locked Moved The Weird and The Wonderful
databasedesignquestionworkspace
26 Posts 15 Posters 2 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.
  • B BobJanova

    Doesn't that run the query twice, too? (Once to bind it to the GridView, which I assume is the big laugh here – does that even work in a service? – and once when initialising dv.)

    G Offline
    G Offline
    Gordon Kushner
    wrote on last edited by
    #17

    You're probably right. I was given a task to get it working again. I later learned that it may have *never* worked.

    1 Reply Last reply
    0
    • G Gordon Kushner

      I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

      Dim ResultDS As New SqlDataSource

      ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
      ResultDS.SelectCommand = ""

      ResultDS.[Select](DataSourceSelectArguments.Empty)

      Dim dg As New GridView
      dg.DataSource = ResultDS
      dg.DataBind()
      Dim dv As New DataView
      Dim dt As New DataTable
      dv = ResultDS.Select(DataSourceSelectArguments.Empty)
      dt = dv.ToTable()

      Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

      C Offline
      C Offline
      Chad3F
      wrote on last edited by
      #18

      [Reads first line of code] Is that Visual Basic?? There's your problem right there! :laugh: Let the flame war begin (or fizzle out because nobody noticed/cared). :rose:

      L G 2 Replies Last reply
      0
      • C Chad3F

        [Reads first line of code] Is that Visual Basic?? There's your problem right there! :laugh: Let the flame war begin (or fizzle out because nobody noticed/cared). :rose:

        L Offline
        L Offline
        Lutoslaw
        wrote on last edited by
        #19

        Chad3F wrote:

        or fizzle out because nobody noticed/cared

        Now nobody will miss it. :-O

        Greetings - Jacek

        1 Reply Last reply
        0
        • G Gary Wheeler

          It could be worse. The developer could have started an instance of one of the Microsoft Office applications to do the job (in a service).

          Software Zen: delete this;

          R Offline
          R Offline
          Rob Grainger
          wrote on last edited by
          #20

          I've seen people try that - it normally fails, horribly.

          "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

          G 1 Reply Last reply
          0
          • C Chad3F

            [Reads first line of code] Is that Visual Basic?? There's your problem right there! :laugh: Let the flame war begin (or fizzle out because nobody noticed/cared). :rose:

            G Offline
            G Offline
            Gordon Kushner
            wrote on last edited by
            #21

            I still contend that Object Pascal is the better language! There, feel better? :D

            L 1 Reply Last reply
            0
            • R Rob Grainger

              I've seen people try that - it normally fails, horribly.

              "If you don't fail at least 90 percent of the time, you're not aiming high enough." Alan Kay.

              G Offline
              G Offline
              Gary Wheeler
              wrote on last edited by
              #22

              Ignoring the legal implications (server usage of Microsoft Office apps violates the license), the Office apps fail in odd ways or cause unusual server failures when used in this fashion.

              Software Zen: delete this;

              1 Reply Last reply
              0
              • G Gordon Kushner

                I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                Dim ResultDS As New SqlDataSource

                ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                ResultDS.SelectCommand = ""

                ResultDS.[Select](DataSourceSelectArguments.Empty)

                Dim dg As New GridView
                dg.DataSource = ResultDS
                dg.DataBind()
                Dim dv As New DataView
                Dim dt As New DataTable
                dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                dt = dv.ToTable()

                Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                S Offline
                S Offline
                shiprat
                wrote on last edited by
                #23

                the only coding atrocity i see here is the choice of language. maybe your gerfuffle means something to 'dozers but to the rest of us this might as well be a paragon of code purity.

                1 Reply Last reply
                0
                • G Gordon Kushner

                  I still contend that Object Pascal is the better language! There, feel better? :D

                  L Offline
                  L Offline
                  Lutoslaw
                  wrote on last edited by
                  #24

                  Nope. Befunge is the best. There is no better 2D programming languge. If there is any.

                  Greetings - Jacek

                  G 1 Reply Last reply
                  0
                  • L Lutoslaw

                    Nope. Befunge is the best. There is no better 2D programming languge. If there is any.

                    Greetings - Jacek

                    G Offline
                    G Offline
                    Gordon Kushner
                    wrote on last edited by
                    #25

                    That's a win for Jacek! http://en.wikipedia.org/wiki/Befunge[^]

                    1 Reply Last reply
                    0
                    • G Gordon Kushner

                      I haven't been on these forums in a while. But I've come across a coding atrocity so horrible, so offensive, that I have to document it. This is a Windows service. Can you see how the developer accesses database data? (Answer below)

                      Dim ResultDS As New SqlDataSource

                      ResultDS.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("JaguarReportingConnectionString").ToString()
                      ResultDS.SelectCommand = ""

                      ResultDS.[Select](DataSourceSelectArguments.Empty)

                      Dim dg As New GridView
                      dg.DataSource = ResultDS
                      dg.DataBind()
                      Dim dv As New DataView
                      Dim dt As New DataTable
                      dv = ResultDS.Select(DataSourceSelectArguments.Empty)
                      dt = dv.ToTable()

                      Hint: GridView is from the Web UI control namespace. Did I mention this is a Windows service?

                      G Offline
                      G Offline
                      giuchici
                      wrote on last edited by
                      #26

                      You know that a Windows service can be allowed to interact with the desktop in which case you can use and you need UI controls. I don't know what the intention is from those few line of codes but this is far from a War Crime, so I think you're exaggerating. Yes, I know that :

                      Quote:

                      In most cases, it is recommended that you not change the Allow service to interact with desktop setting. If you allow the service to interact with the desktop, any information that the service displays on the desktop will also be displayed on an interactive user's desktop. A malicious user could then take control of the service or attack it from the interactive desktop.

                      I have seen worse.

                      giuchici

                      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