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 Soapbox
  4. F**k you! JavaS**t

F**k you! JavaS**t

Scheduled Pinned Locked Moved The Soapbox
java
18 Posts 9 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.
  • A Offline
    A Offline
    AlphaDeltaTheta
    wrote on last edited by
    #1

    :mad: Now what's wrong here:

    function MyAwesomeFunction(value)
    {
    print("Should run my awesome function:"+value);
    if(!value)
    {
    print("no");
    //do some awesome task
    }
    else {
    print("sure");
    //some more awesome task goes here
    }

    SetValue( "DoAwesomeTask",value);
    }

    Run a for-loop and call this "awesome" method with true

    for(i = 0; i<=50; i++)
    MyAwesomeFunction(true);

    Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

    Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

    J L B M OriginalGriffO 6 Replies Last reply
    0
    • A AlphaDeltaTheta

      :mad: Now what's wrong here:

      function MyAwesomeFunction(value)
      {
      print("Should run my awesome function:"+value);
      if(!value)
      {
      print("no");
      //do some awesome task
      }
      else {
      print("sure");
      //some more awesome task goes here
      }

      SetValue( "DoAwesomeTask",value);
      }

      Run a for-loop and call this "awesome" method with true

      for(i = 0; i<=50; i++)
      MyAwesomeFunction(true);

      Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

      Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

      J Offline
      J Offline
      jschell
      wrote on last edited by
      #2

      Amitosh S.M. wrote:

      Methods are guaranteed to run without exceptions

      That however is quite a bit different than saying they are guaranteed to succeed.

      Amitosh S.M. wrote:

      code began to fail randomly....I'm out of ideas why

      Qualifying what "fail" means would be the first step. That said when an application on a computer seems to be doing something impossible then the first step is to look at the assumptions, not the code. ...for example...you are assuming that the code you posted is the code that ran.

      A 1 Reply Last reply
      0
      • A AlphaDeltaTheta

        :mad: Now what's wrong here:

        function MyAwesomeFunction(value)
        {
        print("Should run my awesome function:"+value);
        if(!value)
        {
        print("no");
        //do some awesome task
        }
        else {
        print("sure");
        //some more awesome task goes here
        }

        SetValue( "DoAwesomeTask",value);
        }

        Run a for-loop and call this "awesome" method with true

        for(i = 0; i<=50; i++)
        MyAwesomeFunction(true);

        Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

        Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

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

        NOt really the right forum, but interesting! So - are you saying that your output from the above is something like: no no no sure no sure no no sure sure etc. ?

        MVVM # - I did it My Way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

        M A 2 Replies Last reply
        0
        • L Lost User

          NOt really the right forum, but interesting! So - are you saying that your output from the above is something like: no no no sure no sure no no sure sure etc. ?

          MVVM # - I did it My Way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

          M Offline
          M Offline
          Mendor81
          wrote on last edited by
          #4

          _Maxxx_ wrote:

          no
          no
          no
          sure
          no
          sure
          no
          no
          sure
          sure

          Sounds like a normal conversation with my wife :laugh: ;P

          Hmm i wonder why its doing that......ARGHS NO STOP, ROLLBACK ROLLBACK...F*** That's how i learned to "Always Backup"!! Dogs are man's best Friend, Cats are man's adorable little serial killer

          A 1 Reply Last reply
          0
          • L Lost User

            NOt really the right forum, but interesting! So - are you saying that your output from the above is something like: no no no sure no sure no no sure sure etc. ?

            MVVM # - I did it My Way ___________________________________________ Man, you're a god. - walterhevedeich 26/05/2011 .\\axxx (That's an 'M')

            A Offline
            A Offline
            AlphaDeltaTheta
            wrote on last edited by
            #5

            Yes, something like that. And I'm out of ideas why:confused:

            _Maxxx_ wrote:

            NOt really the right forum, but interesting!

            I know, but as you see, my feelings are such that, I can vent them out only in the Soapbox.

            Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

            S 1 Reply Last reply
            0
            • M Mendor81

              _Maxxx_ wrote:

              no
              no
              no
              sure
              no
              sure
              no
              no
              sure
              sure

              Sounds like a normal conversation with my wife :laugh: ;P

              Hmm i wonder why its doing that......ARGHS NO STOP, ROLLBACK ROLLBACK...F*** That's how i learned to "Always Backup"!! Dogs are man's best Friend, Cats are man's adorable little serial killer

              A Offline
              A Offline
              AlphaDeltaTheta
              wrote on last edited by
              #6

              :laugh:

              Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

              1 Reply Last reply
              0
              • J jschell

                Amitosh S.M. wrote:

                Methods are guaranteed to run without exceptions

                That however is quite a bit different than saying they are guaranteed to succeed.

                Amitosh S.M. wrote:

                code began to fail randomly....I'm out of ideas why

                Qualifying what "fail" means would be the first step. That said when an application on a computer seems to be doing something impossible then the first step is to look at the assumptions, not the code. ...for example...you are assuming that the code you posted is the code that ran.

                A Offline
                A Offline
                AlphaDeltaTheta
                wrote on last edited by
                #7

                jschell wrote:

                That however is quite a bit different than saying they are guaranteed to succeed.

                They are guaranteed to succeed too. Ok, I remove some "awesome" code here, but that awesome code, in no way, breaks the execution unless there is an catastrophic failure. Some part of the awesome code sets the display css property to hidden at times. So, will this ever cause problems? I tried settings breakpoints, console.logs() & lot of them. And lastly, occurs only on windows (IE).

                Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                A 1 Reply Last reply
                0
                • A AlphaDeltaTheta

                  jschell wrote:

                  That however is quite a bit different than saying they are guaranteed to succeed.

                  They are guaranteed to succeed too. Ok, I remove some "awesome" code here, but that awesome code, in no way, breaks the execution unless there is an catastrophic failure. Some part of the awesome code sets the display css property to hidden at times. So, will this ever cause problems? I tried settings breakpoints, console.logs() & lot of them. And lastly, occurs only on windows (IE).

                  Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                  A Offline
                  A Offline
                  Ankur m
                  wrote on last edited by
                  #8

                  Amitosh S.M. wrote:

                  occurs only on windows (IE).

                  Ah you have the answer here! :rolleyes:

                  ..Go Green..

                  1 Reply Last reply
                  0
                  • A AlphaDeltaTheta

                    :mad: Now what's wrong here:

                    function MyAwesomeFunction(value)
                    {
                    print("Should run my awesome function:"+value);
                    if(!value)
                    {
                    print("no");
                    //do some awesome task
                    }
                    else {
                    print("sure");
                    //some more awesome task goes here
                    }

                    SetValue( "DoAwesomeTask",value);
                    }

                    Run a for-loop and call this "awesome" method with true

                    for(i = 0; i<=50; i++)
                    MyAwesomeFunction(true);

                    Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

                    Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                    B Offline
                    B Offline
                    Bassam Abdul Baki
                    wrote on last edited by
                    #9

                    What happens when you get rid of this line ( SetValue( "DoAwesomeTask",value); )?

                    Web - BM - RSS - Math - LinkedIn

                    A 1 Reply Last reply
                    0
                    • A AlphaDeltaTheta

                      :mad: Now what's wrong here:

                      function MyAwesomeFunction(value)
                      {
                      print("Should run my awesome function:"+value);
                      if(!value)
                      {
                      print("no");
                      //do some awesome task
                      }
                      else {
                      print("sure");
                      //some more awesome task goes here
                      }

                      SetValue( "DoAwesomeTask",value);
                      }

                      Run a for-loop and call this "awesome" method with true

                      for(i = 0; i<=50; i++)
                      MyAwesomeFunction(true);

                      Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

                      Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                      B Offline
                      B Offline
                      Bassam Abdul Baki
                      wrote on last edited by
                      #10

                      Tested your code using these here[^]. Works fine!

                      Web - BM - RSS - Math - LinkedIn

                      A 1 Reply Last reply
                      0
                      • A AlphaDeltaTheta

                        :mad: Now what's wrong here:

                        function MyAwesomeFunction(value)
                        {
                        print("Should run my awesome function:"+value);
                        if(!value)
                        {
                        print("no");
                        //do some awesome task
                        }
                        else {
                        print("sure");
                        //some more awesome task goes here
                        }

                        SetValue( "DoAwesomeTask",value);
                        }

                        Run a for-loop and call this "awesome" method with true

                        for(i = 0; i<=50; i++)
                        MyAwesomeFunction(true);

                        Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

                        Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                        M Offline
                        M Offline
                        Member 2053006
                        wrote on last edited by
                        #11

                        I do not code in JavaScript, but I would assume that booleans are passed by reference and the SetValue( "DoAwesomeTask",value); line somehow has the side effect of changing value. Try changing your loop to:

                        for(i = 0; i<=50; i++)
                        {
                        parameter = true;
                        MyAwesomeFunction(parameter);
                        }

                        A 1 Reply Last reply
                        0
                        • A AlphaDeltaTheta

                          :mad: Now what's wrong here:

                          function MyAwesomeFunction(value)
                          {
                          print("Should run my awesome function:"+value);
                          if(!value)
                          {
                          print("no");
                          //do some awesome task
                          }
                          else {
                          print("sure");
                          //some more awesome task goes here
                          }

                          SetValue( "DoAwesomeTask",value);
                          }

                          Run a for-loop and call this "awesome" method with true

                          for(i = 0; i<=50; i++)
                          MyAwesomeFunction(true);

                          Methods are guaranteed to run without exceptions but, when I tried to run the test code, out of 100 calls, code began to fail randomly.:mad: Sometimes, my awesome task is done, while sometimes not. But as per input it should never do my awesome task. :doh: :confused: I'm out of ideas why. Either me or Windows S**t Host is low on caffeine! :java:

                          Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

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

                          If it's any consolation, I used to work with FORTRAN compilers where numeric values were passed by reference. Not normally a problem until

                          CALL MYSUB(666)
                          ...
                          PRINT \*,"THE VALUE OF 666 IS: ", 666
                          

                          ...
                          SUBROUTINE MYSUB(I)
                          INT I
                          I = I * 2
                          RETURN
                          END

                          The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                          "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

                          A 1 Reply Last reply
                          0
                          • A AlphaDeltaTheta

                            Yes, something like that. And I'm out of ideas why:confused:

                            _Maxxx_ wrote:

                            NOt really the right forum, but interesting!

                            I know, but as you see, my feelings are such that, I can vent them out only in the Soapbox.

                            Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                            S Offline
                            S Offline
                            Sentenryu
                            wrote on last edited by
                            #13

                            are you sure there's nothing redefining value?

                            I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                            A 1 Reply Last reply
                            0
                            • S Sentenryu

                              are you sure there's nothing redefining value?

                              I'm brazilian and english (well, human languages in general) aren't my best skill, so, sorry by my english. (if you want we can speak in C# or VB.Net =p) "Given the chance I'd rather work smart than work hard." - PHS241 "'Sophisticated platform' typically means 'I have no idea how it works.'"

                              A Offline
                              A Offline
                              AlphaDeltaTheta
                              wrote on last edited by
                              #14

                              No, not even any variable defined anywhere with the same name

                              Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                              1 Reply Last reply
                              0
                              • OriginalGriffO OriginalGriff

                                If it's any consolation, I used to work with FORTRAN compilers where numeric values were passed by reference. Not normally a problem until

                                CALL MYSUB(666)
                                ...
                                PRINT \*,"THE VALUE OF 666 IS: ", 666
                                

                                ...
                                SUBROUTINE MYSUB(I)
                                INT I
                                I = I * 2
                                RETURN
                                END

                                The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)

                                A Offline
                                A Offline
                                AlphaDeltaTheta
                                wrote on last edited by
                                #15

                                Nah, I'm not messing with the value parameter anywhere.

                                OriginalGriff wrote:

                                FORTRAN

                                Seems greek to me

                                Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                                1 Reply Last reply
                                0
                                • M Member 2053006

                                  I do not code in JavaScript, but I would assume that booleans are passed by reference and the SetValue( "DoAwesomeTask",value); line somehow has the side effect of changing value. Try changing your loop to:

                                  for(i = 0; i<=50; i++)
                                  {
                                  parameter = true;
                                  MyAwesomeFunction(parameter);
                                  }

                                  A Offline
                                  A Offline
                                  AlphaDeltaTheta
                                  wrote on last edited by
                                  #16

                                  Nope, SetValue doesn't change the value of the variable. It's an ajax call to the server. If error arises, fail silently. And this was encountered during dry run. No ajax. SetValue does nothing.

                                  Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                                  1 Reply Last reply
                                  0
                                  • B Bassam Abdul Baki

                                    Tested your code using these here[^]. Works fine!

                                    Web - BM - RSS - Math - LinkedIn

                                    A Offline
                                    A Offline
                                    AlphaDeltaTheta
                                    wrote on last edited by
                                    #17

                                    That problem occurs only in Windows S**t host! :mad: on Win7 Sp1.

                                    Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                                    1 Reply Last reply
                                    0
                                    • B Bassam Abdul Baki

                                      What happens when you get rid of this line ( SetValue( "DoAwesomeTask",value); )?

                                      Web - BM - RSS - Math - LinkedIn

                                      A Offline
                                      A Offline
                                      AlphaDeltaTheta
                                      wrote on last edited by
                                      #18

                                      Nothing...

                                      Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas. Carl von Clausewitz Source

                                      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