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. ... WHY?!

... WHY?!

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharphtmlasp-netarchitecturehelp
16 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.
  • M Matt U

    I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:

    if (Session["tWidth"] != null)
    {
    htmlToImageConverter.BrowserWidth = int.Parse("1025");

    }

    I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:

    djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

    B Offline
    B Offline
    Brisingr Aerowing
    wrote on last edited by
    #2

    And what is the tWidth for? Is it an integer? Or just some random value?

    Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor

    M Q 2 Replies Last reply
    0
    • B Brisingr Aerowing

      And what is the tWidth for? Is it an integer? Or just some random value?

      Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor

      M Offline
      M Offline
      Matt U
      wrote on last edited by
      #3

      I had a difficult time understanding that as well. 'tWidth' is, in fact, an integer. In other places throughout the project it's used to store the width of certain widgets in a report. But this particular statement, I have no idea. That's literally all the code in it. It never references 'tWidth' in this particular section. *smh* There are a ton of bad practices in this project. A lot of empty 'catch' statements after a large 'try' block and so forth. Almost *ZERO* comments. Blah, blah, blah. :(

      djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

      B 1 Reply Last reply
      0
      • M Matt U

        I had a difficult time understanding that as well. 'tWidth' is, in fact, an integer. In other places throughout the project it's used to store the width of certain widgets in a report. But this particular statement, I have no idea. That's literally all the code in it. It never references 'tWidth' in this particular section. *smh* There are a ton of bad practices in this project. A lot of empty 'catch' statements after a large 'try' block and so forth. Almost *ZERO* comments. Blah, blah, blah. :(

        djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

        B Offline
        B Offline
        Brisingr Aerowing
        wrote on last edited by
        #4

        X|

        Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor

        1 Reply Last reply
        0
        • M Matt U

          I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:

          if (Session["tWidth"] != null)
          {
          htmlToImageConverter.BrowserWidth = int.Parse("1025");

          }

          I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:

          djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

          B Offline
          B Offline
          Bernhard Hiller
          wrote on last edited by
          #5

          The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace temporarily

          htmlToImageConverter.BrowserWidth = int.Parse(tWidth);

          by

          htmlToImageConverter.BrowserWidth = int.Parse("1025");

          But then forgot to change it back. And nobody complained till you happened to find that WTF...

          Z M W 3 Replies Last reply
          0
          • B Bernhard Hiller

            The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace temporarily

            htmlToImageConverter.BrowserWidth = int.Parse(tWidth);

            by

            htmlToImageConverter.BrowserWidth = int.Parse("1025");

            But then forgot to change it back. And nobody complained till you happened to find that WTF...

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #6

            Quote:

            But then forgot to change it back.

            You're probably right; however, that takes all the fun out of harassing the previous developer for this. :)

            There are only 10 types of people in the world, those who understand binary and those who don't.

            1 Reply Last reply
            0
            • B Bernhard Hiller

              The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace temporarily

              htmlToImageConverter.BrowserWidth = int.Parse(tWidth);

              by

              htmlToImageConverter.BrowserWidth = int.Parse("1025");

              But then forgot to change it back. And nobody complained till you happened to find that WTF...

              M Offline
              M Offline
              Matt U
              wrote on last edited by
              #7

              That's a very reasonable observation, and you're probably quite right. Thank you for that. Now I'm going to put "tWidth" back in there and see if it fixes some of these problems. Haha.

              djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

              B 1 Reply Last reply
              0
              • M Matt U

                That's a very reasonable observation, and you're probably quite right. Thank you for that. Now I'm going to put "tWidth" back in there and see if it fixes some of these problems. Haha.

                djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                B Offline
                B Offline
                Bernhard Hiller
                wrote on last edited by
                #8

                Be careful! It might introduce a new defect now - do you know how many later changes assume that that WTF is the correct solution? :)

                M 1 Reply Last reply
                0
                • B Bernhard Hiller

                  Be careful! It might introduce a new defect now - do you know how many later changes assume that that WTF is the correct solution? :)

                  M Offline
                  M Offline
                  Matt U
                  wrote on last edited by
                  #9

                  Haha. I changed it and it didn't make any difference whatsoever. ;-P

                  djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                  B 1 Reply Last reply
                  0
                  • M Matt U

                    I'm working on a maintenance project for a client. It's ASP .NET MVC. When exporting some charts, they use an HTML To Image converter. I found this today:

                    if (Session["tWidth"] != null)
                    {
                    htmlToImageConverter.BrowserWidth = int.Parse("1025");

                    }

                    I've seen similar posts here before. Why call int.Parse() and pass what's obviously an integer, instead of simply assigning: 1025? Why, oh why? :doh:

                    djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                    G Offline
                    G Offline
                    Giuseppe Tollini
                    wrote on last edited by
                    #10

                    that's easy to fix, just change it to: int.Parse(int.Parse("1025").ToString());

                    M 1 Reply Last reply
                    0
                    • G Giuseppe Tollini

                      that's easy to fix, just change it to: int.Parse(int.Parse("1025").ToString());

                      M Offline
                      M Offline
                      Matt U
                      wrote on last edited by
                      #11

                      :laugh:

                      djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                      1 Reply Last reply
                      0
                      • M Matt U

                        Haha. I changed it and it didn't make any difference whatsoever. ;-P

                        djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                        B Offline
                        B Offline
                        Bernhard Hiller
                        wrote on last edited by
                        #12

                        You lack experience with such WTF code! In some two or three years, a customer will complain about a page being too wide or too narrow... And then the new guy working on the project will submit your little change as a WTF: a useless change introducing a new bug. That's how such WTF code works...

                        M 1 Reply Last reply
                        0
                        • B Bernhard Hiller

                          You lack experience with such WTF code! In some two or three years, a customer will complain about a page being too wide or too narrow... And then the new guy working on the project will submit your little change as a WTF: a useless change introducing a new bug. That's how such WTF code works...

                          M Offline
                          M Offline
                          Matt U
                          wrote on last edited by
                          #13

                          ;-P I do lack experience. This is the first project I've ever worked on that was written by someone else.

                          djj55: Nice but may have a permission problem Pete O'Hanlon: He has my permission to run it.

                          1 Reply Last reply
                          0
                          • B Brisingr Aerowing

                            And what is the tWidth for? Is it an integer? Or just some random value?

                            Getting information off the Internet is like taking a drink from a fire hydrant. - Mitchell Kapor

                            Q Offline
                            Q Offline
                            Quirkafleeg
                            wrote on last edited by
                            #14

                            It may be for those special people with a 1025 x 768½ screen resolution?

                            1 Reply Last reply
                            0
                            • B Bernhard Hiller

                              The reason behind that WTF is likely simple: somewhen during development, there was a problem, or an extreme value case had to be tested (width greater than screen width), and a developer decided to replace temporarily

                              htmlToImageConverter.BrowserWidth = int.Parse(tWidth);

                              by

                              htmlToImageConverter.BrowserWidth = int.Parse("1025");

                              But then forgot to change it back. And nobody complained till you happened to find that WTF...

                              W Offline
                              W Offline
                              walterhevedeich
                              wrote on last edited by
                              #15

                              Bernhard Hiller wrote:

                              and a developer decided to replace temporarily

                              You seem to know about it very well. I can almost pinpoint who that was. :laugh:

                              Signature construction in progress. Sorry for the inconvenience.

                              Damn you have the perfect signature - CBadger

                              B 1 Reply Last reply
                              0
                              • W walterhevedeich

                                Bernhard Hiller wrote:

                                and a developer decided to replace temporarily

                                You seem to know about it very well. I can almost pinpoint who that was. :laugh:

                                Signature construction in progress. Sorry for the inconvenience.

                                Damn you have the perfect signature - CBadger

                                B Offline
                                B Offline
                                Bernhard Hiller
                                wrote on last edited by
                                #16

                                Oh dear, I'd better use a different login name for such posts...

                                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