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. Every day I die a little more...

Every day I die a little more...

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpjavascriptasp-nettoolstutorial
7 Posts 3 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.
  • K Offline
    K Offline
    Keith Barrow
    wrote on last edited by
    #1

    How to generate an ASP.NET menu, if you are an evil genius First one must define what it is we are to show (apologies for the odd characters, it is badly endoded arabic):

    private string memberMenu = @"<table border=0 cellpadding=1 cellspacing=1 width=100% dir=rtl style=font-family:Tahoma;font-size:12px;><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MembersResearchList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÃÈÍÇË æÏÑÇÓÇÊ\');return false;"" class=""navMenu"">ÃÈÍÇË æÏÑÇÓÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersExperience.aspx\');top.SetTitle(\'ÇáÎÈÑÇÊ\');return false;"" class=""navMenu"">ÇáÎÈÑÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersAcademicRank.aspx\');top.SetTitle(\'ÇáÑÊÈÉ ÇáÚáãíÉ\');return false;"" class=""navMenu"">ÇáÑÊÈÉ ÇáÚáãíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MemberQualificationList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ãÄåá ÇßÇÏíãí\');return false;"" class=""navMenu"">ãÄåá ÇßÇÏíãí</a></td></tr><tr><td><a href=""#"" onclick=""{0}"" class=""navMenu"">ÊÍãíá ÇáÓíÑÉ ÇáÐÇÊíÉ</a></td></tr><tr><td><a href=""#"" onclick=""{1}"" class=""navMenu"" title=""ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ"">ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ</a></td></tr><tr><td><a href=""#"" onclick=""window.open(\'loadEduGate.htm\'); return false;"" class=""navMenu"">ÇáÈæÇÈÉ ÇáÅáßÊÑæäíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MarksMainPage.aspx\');top.SetTitle(\'äÙÇã ÇáÚáÇãÇÊ ÇáÑÓãí áÃÚÖÇÁ ÇáåíÆÇÊ ÇáÊÏÑíÓíÉ ÈÌÇãÚÉ ÇáÈÊÑÇ\');return false;"" class=""navMenu"">äÙÇã ÇÏÎÇá ÇáÚáÇãÇÊ</a></td></tr></table>";

    Then one must show it:

    lblScript.Text = @"<script type='text/javascript'>document.getElementById('navContent').innerHTML='" + string.Format(memberMenu, @"top.SetLocation(\'\',\'\',\'ListOfMemberCVs.aspx?mid=" + (new FacultyMembers()).GetMemberByUserName(sUserName + "@uop.edu.jo").Rows[0]["membersID"].ToString() + @"&t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÇáÓíÑÉ ÇáÐÇÊíÉ\');return false;", @"top.SetLocation(\'\',\'\',\'../Courseslist/Default.aspx?d=" + ReserveTic

    N 1 Reply Last reply
    0
    • K Keith Barrow

      How to generate an ASP.NET menu, if you are an evil genius First one must define what it is we are to show (apologies for the odd characters, it is badly endoded arabic):

      private string memberMenu = @"<table border=0 cellpadding=1 cellspacing=1 width=100% dir=rtl style=font-family:Tahoma;font-size:12px;><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MembersResearchList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÃÈÍÇË æÏÑÇÓÇÊ\');return false;"" class=""navMenu"">ÃÈÍÇË æÏÑÇÓÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersExperience.aspx\');top.SetTitle(\'ÇáÎÈÑÇÊ\');return false;"" class=""navMenu"">ÇáÎÈÑÇÊ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'AddMembersAcademicRank.aspx\');top.SetTitle(\'ÇáÑÊÈÉ ÇáÚáãíÉ\');return false;"" class=""navMenu"">ÇáÑÊÈÉ ÇáÚáãíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MemberQualificationList.aspx?t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ãÄåá ÇßÇÏíãí\');return false;"" class=""navMenu"">ãÄåá ÇßÇÏíãí</a></td></tr><tr><td><a href=""#"" onclick=""{0}"" class=""navMenu"">ÊÍãíá ÇáÓíÑÉ ÇáÐÇÊíÉ</a></td></tr><tr><td><a href=""#"" onclick=""{1}"" class=""navMenu"" title=""ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ"">ÌÏæá ÇáãæÇÏ ÇáÊÚáíãíÉ</a></td></tr><tr><td><a href=""#"" onclick=""window.open(\'loadEduGate.htm\'); return false;"" class=""navMenu"">ÇáÈæÇÈÉ ÇáÅáßÊÑæäíÉ</a></td></tr><tr><td><a href=# onclick=""top.SetLocation(\'\',\'\',\'MarksMainPage.aspx\');top.SetTitle(\'äÙÇã ÇáÚáÇãÇÊ ÇáÑÓãí áÃÚÖÇÁ ÇáåíÆÇÊ ÇáÊÏÑíÓíÉ ÈÌÇãÚÉ ÇáÈÊÑÇ\');return false;"" class=""navMenu"">äÙÇã ÇÏÎÇá ÇáÚáÇãÇÊ</a></td></tr></table>";

      Then one must show it:

      lblScript.Text = @"<script type='text/javascript'>document.getElementById('navContent').innerHTML='" + string.Format(memberMenu, @"top.SetLocation(\'\',\'\',\'ListOfMemberCVs.aspx?mid=" + (new FacultyMembers()).GetMemberByUserName(sUserName + "@uop.edu.jo").Rows[0]["membersID"].ToString() + @"&t=\'+(new Date()).toLocaleTimeString().replace(\':\',\'\'));top.SetTitle(\'ÇáÓíÑÉ ÇáÐÇÊíÉ\');return false;", @"top.SetLocation(\'\',\'\',\'../Courseslist/Default.aspx?d=" + ReserveTic

      N Offline
      N Offline
      Nagy Vilmos
      wrote on last edited by
      #2

      In any application I scream a little every time I see a hard coded menu. FFS, it is as easy to parametrise it as it is to hard code and the latter is more extensible. If I caught one of my trained simians doing that it'd be bull-whip time.


      Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

      K 1 Reply Last reply
      0
      • N Nagy Vilmos

        In any application I scream a little every time I see a hard coded menu. FFS, it is as easy to parametrise it as it is to hard code and the latter is more extensible. If I caught one of my trained simians doing that it'd be bull-whip time.


        Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

        K Offline
        K Offline
        Keith Barrow
        wrote on last edited by
        #3

        You'd have a fit with our codebase, nothing (I and mean nothing) is well implemented. I'd call "Job Security" but the bloke who wrote the worst of it left. To add piquancy to the proceedings, I'm struggling to convince the powers that be that doing things properly will be quicker than doing things "quickly" as per the OP. Oh well, I can always resign.

        Sort of a cross between Lawrence of Arabia and Dilbert.[^]
        -Or-
        A Dead ringer for Kate Winslett[^]

        N L 2 Replies Last reply
        0
        • K Keith Barrow

          You'd have a fit with our codebase, nothing (I and mean nothing) is well implemented. I'd call "Job Security" but the bloke who wrote the worst of it left. To add piquancy to the proceedings, I'm struggling to convince the powers that be that doing things properly will be quicker than doing things "quickly" as per the OP. Oh well, I can always resign.

          Sort of a cross between Lawrence of Arabia and Dilbert.[^]
          -Or-
          A Dead ringer for Kate Winslett[^]

          N Offline
          N Offline
          Nagy Vilmos
          wrote on last edited by
          #4

          The approach has to be to give them a route to a better application. "Throw it all away" will not work. Tell the PHB's that any bug fix will take 5x what would be expected because of the shyte code, but only 4x to reimplement. Stick to this. All new work, for a given value of 'new', should be done with the new approach and the legacy code updated as and when it needs to change. If possible, black-box the legacy stuff so that you don't have to go in there too often.


          Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

          L K 2 Replies Last reply
          0
          • K Keith Barrow

            You'd have a fit with our codebase, nothing (I and mean nothing) is well implemented. I'd call "Job Security" but the bloke who wrote the worst of it left. To add piquancy to the proceedings, I'm struggling to convince the powers that be that doing things properly will be quicker than doing things "quickly" as per the OP. Oh well, I can always resign.

            Sort of a cross between Lawrence of Arabia and Dilbert.[^]
            -Or-
            A Dead ringer for Kate Winslett[^]

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

            Same here. I have written applications that have been online for months without any problems and they whine about the time it took to get them to work that well. The old application fell apart every day and was almost unmaintainable, but this time and effort somehow does not count.

            "Dark the dark side is. Very dark..." - Yoda ---
            "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

            1 Reply Last reply
            0
            • N Nagy Vilmos

              The approach has to be to give them a route to a better application. "Throw it all away" will not work. Tell the PHB's that any bug fix will take 5x what would be expected because of the shyte code, but only 4x to reimplement. Stick to this. All new work, for a given value of 'new', should be done with the new approach and the legacy code updated as and when it needs to change. If possible, black-box the legacy stuff so that you don't have to go in there too often.


              Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

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

              Yes, they don't have to know that in the end nothing of the old code will remain and that you gradually threw everything away. Hopefully the old application is not so twisted and dependent that every change triggers a chain reaction of subsequent changes. Then you have little chance to do it step by step.

              "Dark the dark side is. Very dark..." - Yoda ---
              "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

              1 Reply Last reply
              0
              • N Nagy Vilmos

                The approach has to be to give them a route to a better application. "Throw it all away" will not work. Tell the PHB's that any bug fix will take 5x what would be expected because of the shyte code, but only 4x to reimplement. Stick to this. All new work, for a given value of 'new', should be done with the new approach and the legacy code updated as and when it needs to change. If possible, black-box the legacy stuff so that you don't have to go in there too often.


                Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett

                K Offline
                K Offline
                Keith Barrow
                wrote on last edited by
                #7

                Yes, that would be a good approach, but they've agreed to a re-write (on the grounds our current site really doesn't play well will googlebots) but they want the new system to be as patchy as the first. Naturally, there is some politics going on which is behind all this.

                Sort of a cross between Lawrence of Arabia and Dilbert.[^]
                -Or-
                A Dead ringer for Kate Winslett[^]

                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