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. The Lounge
  3. Functions that are more trouble than they're worth

Functions that are more trouble than they're worth

Scheduled Pinned Locked Moved The Lounge
javascripthelpcsharpcomsysadmin
17 Posts 14 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.
  • F F ES Sitecore

    I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

    RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

    Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

    InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

    It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

    Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #4

    I think the problem is that the teachers don't understand what a "client-server" model is and as a result their students don't have a clue either. And testing websites on the development PC (which is also the server) doesn't discourage that misunderstanding at all. How many times do we see server code with Messagebox.Show in it? :doh:

    Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    F N 2 Replies Last reply
    0
    • F F ES Sitecore

      I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

      RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

      Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

      InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

      It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

      Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

      P Offline
      P Offline
      Peter_in_2780
      wrote on last edited by
      #5

      Error 18446744073709551616: Symbol length exceeds system limit. (and my screen width)

      Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

      1 Reply Last reply
      0
      • F F ES Sitecore

        I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

        RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

        Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

        InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

        It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

        Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

        H Offline
        H Offline
        HobbyProggy
        wrote on last edited by
        #6

        Youwrotetomuchwithinonelinewithoutusingasinglespacesothewholetextdoesdropoutoftheframeanditdoesnotonlylookstrangebutalsoiskindaannoyingifyourscreenaintbigenough.

        Rules for the FOSW ![^]

        if(this.signature != "")
        {
        MessageBox.Show("This is my signature: " + Environment.NewLine + signature);
        }
        else
        {
        MessageBox.Show("404-Signature not found");
        }

        1 Reply Last reply
        0
        • F F ES Sitecore

          I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

          RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

          Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

          InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

          It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

          Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

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

          Some more for the list:

          • Using MsgBox / MessageBox.Show from the code-behind;
          • Using Process.Start to try to open a file on the client;
          • Using the FileName property of a FileUpload / HttpPostedFile to try to read the file directly from the client's disk;

          All of which "work" when you run the site in Visual Studio. Maybe we should be blaming VS for encouraging incorrect reasoning about the code? Then there's the "There must be a way to bypass this security feature - my client requires it!" brigade. And the "I need to show 1 million records in one page without filtering or paging, and it needs to load in less than one second - it's a client requirement!" brigade:

          Quote:

          Agnes Skinner: And you! Start over! I want everything in one bag. Bag Boy: Yes, ma'am. Agnes: But I don't want the bag to be heavy. Bag Boy: I don't think that's possible... Agnes: What are you, the "possible police"? Just do it!


          "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

          C 1 Reply Last reply
          0
          • F F ES Sitecore

            I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

            RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

            Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

            InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

            It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

            Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

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

            Weddings, christening and those awful work parties that you're forced into attending! X|

            Ah, I see you have the machine that goes ping. This is my favorite. You see we lease it back from the company we sold it to and that way it comes under the monthly current budget and not the capital account.

            1 Reply Last reply
            0
            • OriginalGriffO OriginalGriff

              I think the problem is that the teachers don't understand what a "client-server" model is and as a result their students don't have a clue either. And testing websites on the development PC (which is also the server) doesn't discourage that misunderstanding at all. How many times do we see server code with Messagebox.Show in it? :doh:

              Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

              F Offline
              F Offline
              Foothill
              wrote on last edited by
              #9

              OriginalGriff wrote:

              How many times do we see server code with Messagebox.Show in it

              Hey! I resent resemble that remark. :sigh: From the very first website I ever built with ASP.Net and VB over half a decade ago.

              if (Object.DividedByZero == true) { Universe.Implode(); } Meus ratio ex fortis machina. Simplicitatis de formae ac munus. -Foothill, 2016

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                I think the problem is that the teachers don't understand what a "client-server" model is and as a result their students don't have a clue either. And testing websites on the development PC (which is also the server) doesn't discourage that misunderstanding at all. How many times do we see server code with Messagebox.Show in it? :doh:

                Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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

                I remember someone, this time not me but out application architect, leaving a message box in a 'never happen' branch of the server code. Guess when it hit the branch? About 3 frickin a.m. one night, luckily I wasn't in bed. Actually I had been in bed, but I was on my home and had stopped off for a beer...

                veni bibi saltavi

                H 1 Reply Last reply
                0
                • F F ES Sitecore

                  I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

                  RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

                  Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

                  InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

                  It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

                  Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

                  D Offline
                  D Offline
                  dandy72
                  wrote on last edited by
                  #11

                  I see a pattern evolving in your function naming scheme. I'd hate to use your libraries. :-)

                  J 1 Reply Last reply
                  0
                  • D dandy72

                    I see a pattern evolving in your function naming scheme. I'd hate to use your libraries. :-)

                    J Offline
                    J Offline
                    Jon McKee
                    wrote on last edited by
                    #12

                    Just write wrappers :-\

                    RegisterStartupScript_PS-RTFM
                    Interop_PS-RTFM
                    Access-Control-Allow-Origin-PS-RTFM

                    1 Reply Last reply
                    0
                    • F F ES Sitecore

                      I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

                      RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

                      Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

                      InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

                      It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

                      Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

                      Sander RosselS Offline
                      Sander RosselS Offline
                      Sander Rossel
                      wrote on last edited by
                      #13

                      How about renaming the courses these students take? IT Course PS this will only teach you some basics because the teachers don't really know what's going on either anyway if you're a moron now you'll be a moron on graduation (but somehow you'll still graduate). Minimum requirements: Common sense Scrapped due to a drop in enrollments

                      Best, Sander arrgh.js - Bringing LINQ to JavaScript SQL Server for C# Developers Succinctly Object-Oriented Programming in C# Succinctly

                      1 Reply Last reply
                      0
                      • F F ES Sitecore

                        I see a common trend in Q&A and that is that almost everyone who uses RegisterStartupScript (or one of its variations) is under the impression that they are calling javascript code from code-behind, or that the js is executing immediately in the browser. Needless to say the problem they are having is almost invariably the result of this misunderstanding rather than an issue with the code itself. I think Microsoft should rename this function to something like

                        RegisterStartupScriptPSYourJavascriptIsNOTRunningImmediatelyInTheBrowserYouCANNOTCallJavascriptFromCodeBehind.

                        Interop is another issue that many have problems understanding and again almost everyone that posts with an Interop problem is labouring under the impression that "Interop" is simply .net code that manipulates Office documents (it's always Office). Microsoft should rename the Interop namespace to something like

                        InteropPSThisCodeIsJustAProxyToYourCOMApplicationItIsNOTStandAloneCodeYouNeedTheActualApplicationInstalledOnAnyMachineYouWantThisCodeToRunOn

                        It's not just Microsoft, I think some standards should be updated to remove issues too. Almost everyone who posts with a CORS issue is attempting to solve the issue by adding the allow origin headers to the request they are sending. I think that the "Access-Control-Allow-Origin" header should be renamed to something like

                        Access-Control-Allow-Origin-PS-You-Add-This-Header-To-The-Server-Not-The-Client-What-Good-Is-Any-Security-Measure-The-Client-Can-Simply-Disable

                        B Offline
                        B Offline
                        Brady Kelly
                        wrote on last edited by
                        #14

                        Yes, but MS doesn't use Java! :laugh:

                        Follow my adventures with .NET Core at my new blog, Erisia Information Services.

                        1 Reply Last reply
                        0
                        • N Nagy Vilmos

                          I remember someone, this time not me but out application architect, leaving a message box in a 'never happen' branch of the server code. Guess when it hit the branch? About 3 frickin a.m. one night, luckily I wasn't in bed. Actually I had been in bed, but I was on my home and had stopped off for a beer...

                          veni bibi saltavi

                          H Offline
                          H Offline
                          Herbie Mountjoy
                          wrote on last edited by
                          #15

                          Why use MessageBox? What's wrong with writing to a log?

                          We're philosophical about power outages here. A.C. come, A.C. go.

                          1 Reply Last reply
                          0
                          • Richard DeemingR Richard Deeming

                            Some more for the list:

                            • Using MsgBox / MessageBox.Show from the code-behind;
                            • Using Process.Start to try to open a file on the client;
                            • Using the FileName property of a FileUpload / HttpPostedFile to try to read the file directly from the client's disk;

                            All of which "work" when you run the site in Visual Studio. Maybe we should be blaming VS for encouraging incorrect reasoning about the code? Then there's the "There must be a way to bypass this security feature - my client requires it!" brigade. And the "I need to show 1 million records in one page without filtering or paging, and it needs to load in less than one second - it's a client requirement!" brigade:

                            Quote:

                            Agnes Skinner: And you! Start over! I want everything in one bag. Bag Boy: Yes, ma'am. Agnes: But I don't want the bag to be heavy. Bag Boy: I don't think that's possible... Agnes: What are you, the "possible police"? Just do it!


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

                            C Offline
                            C Offline
                            Charles Programmer
                            wrote on last edited by
                            #16

                            FOCK! You have some stupid clients. I hope you're taking advantage of them.

                            Richard DeemingR 1 Reply Last reply
                            0
                            • C Charles Programmer

                              FOCK! You have some stupid clients. I hope you're taking advantage of them.

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

                              Charles Programmer wrote:

                              You have some stupid clients.

                              I don't. These are comments that regularly crop up in QA[^].


                              "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

                              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