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. Put your right paren in, take your right paren out...

Put your right paren in, take your right paren out...

Scheduled Pinned Locked Moved The Weird and The Wonderful
database
6 Posts 5 Posters 1 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.
  • C Offline
    C Offline
    ColinBashBash
    wrote on last edited by
    #1

    I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely

    'Write out the orders found.
    Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
    & "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
    & "<td width=65>" & (rsSearch("START") & "</td>" _
    & "<td width=65>" & (rsSearch("FINISH") & "</td>" _
    & "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
    & "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
    & "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
    & "<td width=55>" & (rsSearch("FITEM") & "</td>" _
    & "<td width=215>" & (rsSearch("FDESC") & "</td>" _

    & "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
    & "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
    & "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
    & "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
    & "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
    & "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
    & "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
    & "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
    & "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
    & "</tr><br></table>")))))))))))))))))

    C J 2 Replies Last reply
    0
    • C ColinBashBash

      I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely

      'Write out the orders found.
      Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
      & "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
      & "<td width=65>" & (rsSearch("START") & "</td>" _
      & "<td width=65>" & (rsSearch("FINISH") & "</td>" _
      & "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
      & "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
      & "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
      & "<td width=55>" & (rsSearch("FITEM") & "</td>" _
      & "<td width=215>" & (rsSearch("FDESC") & "</td>" _

      & "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
      & "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
      & "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
      & "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
      & "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
      & "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
      & "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
      & "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
      & "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
      & "</tr><br></table>")))))))))))))))))

      C Offline
      C Offline
      ColinBashBash
      wrote on last edited by
      #2

      I should note that it's printing each data-row in it's own table.

      S 1 Reply Last reply
      0
      • C ColinBashBash

        I should note that it's printing each data-row in it's own table.

        S Offline
        S Offline
        supercat9
        wrote on last edited by
        #3

        ColinBashBash wrote:

        I should note that it's printing each data-row in it's own table.

        Not always a bad thing. If some items are overly long, they'll cause some rows of the table not to match others, but the entire table won't get pushed out by an overly-long item. Further, depending upon how many items there are, some browsers may display a number of short tables better than one really long one. I wouldn't consider the HTML table split horrible, even though the formatting of the source code is nasty.

        S 1 Reply Last reply
        0
        • S supercat9

          ColinBashBash wrote:

          I should note that it's printing each data-row in it's own table.

          Not always a bad thing. If some items are overly long, they'll cause some rows of the table not to match others, but the entire table won't get pushed out by an overly-long item. Further, depending upon how many items there are, some browsers may display a number of short tables better than one really long one. I wouldn't consider the HTML table split horrible, even though the formatting of the source code is nasty.

          S Offline
          S Offline
          sergiogarcianinja
          wrote on last edited by
          #4

          Guys, If you look careful, you will discover that the problem is not actually the HTML table, but the wrong usage of parenteses which make the code very dificult to understand. In each line, the guy put a open parenteses to separate the function call, and not close it in time. So, at the end of code block, you have a lot of parenteses. In time, the parenteses aren't need it this case and don't change the return of expression.

          D 1 Reply Last reply
          0
          • S sergiogarcianinja

            Guys, If you look careful, you will discover that the problem is not actually the HTML table, but the wrong usage of parenteses which make the code very dificult to understand. In each line, the guy put a open parenteses to separate the function call, and not close it in time. So, at the end of code block, you have a lot of parenteses. In time, the parenteses aren't need it this case and don't change the return of expression.

            D Offline
            D Offline
            David Skelly
            wrote on last edited by
            #5

            Personally I'm glad the parentheses are there because now I can clearly see the precedence of the & operators. Without the parentheses I would be totally lost and wouldn't be able to follow the code. I think this is an excellent example of self-documenting code.

            1 Reply Last reply
            0
            • C ColinBashBash

              I was asked to check why they're query wasn't working, so I was going to add a column to their table. I started to copy/paste a line... and the parens are just one of the million issues with this "classic" asp code... lovely

              'Write out the orders found.
              Response.Write "<table width=1000 cellspacing=0 cellpadding=0 class=style1><tr>" _
              & "<td width=40>" & (rsSearch("WKCTR") & "</td>" _
              & "<td width=65>" & (rsSearch("START") & "</td>" _
              & "<td width=65>" & (rsSearch("FINISH") & "</td>" _
              & "<td width=60>" & (rsSearch("JOBNO") & "</td>" _
              & "<td width=55>" & (rsSearch("ORDNO") & "</td>" _
              & "<td width=35>" & (rsSearch("OPSEQ") & "</td>" _
              & "<td width=55>" & (rsSearch("FITEM") & "</td>" _
              & "<td width=215>" & (rsSearch("FDESC") & "</td>" _

              & "<td width=45 class=style4>" & (rsSearch("REMAINING") & "</td>" _
              & "<td width=45 class=style3>" & (rsSearch("TQCTD") & "</td>" _
              & "<td width=45 class=style3>" & (rsSearch("SCRAP") & "</td>" _
              & "<td width=45 class=style3>" & (rsSearch("ORTTL") & "</td>" _
              & "<td width=45 class=style3>" & (Round(rsSearch("LABTIME")) & "</td>" _
              & "<td width=45 class=style3>" & (Round(rsSearch("MACHTIME")) & "</td>" _
              & "<td width=15 class=style3>" & (rsSearch("CONDS") & "</td>" _
              & "<td width=45 class=style3>" & (rsSearch("CONQT") & "</td>" _
              & "<td width=80>" & (rsSearch("OSTAT") & "</td>" _
              & "</tr><br></table>")))))))))))))))))

              J Offline
              J Offline
              Jason Vetter
              wrote on last edited by
              #6

              The other users got this right of course...bad and incorrect use of parens but jeez dont you just hate this style of ASP coding! I havent done ASP is years now but isnt this so much easier to look at that than trash:

              <table width="1000" cellspacing="0" cellpadding="0" class="style1">
              <tr>
              <td width="40"><% = rsSearch("WKCTR") %></td>
              <td width="40"><% = rsSearch("START") %></td>
              <td width="40"><% = rsSearch("FINISH") %></td>
              <td width="40"><% = rsSearch("JOBNO") %></td>
              </tr>
              </table>

              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