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. KeyUp event

KeyUp event

Scheduled Pinned Locked Moved The Weird and The Wonderful
8 Posts 6 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 Offline
    F Offline
    Frederic Vaillancourt
    wrote on last edited by
    #1

    I just ran across this line of condition in a KeyUp handler. if ((e.Modifiers.GetHashCode().ToString() + "+" + e.KeyCode.GetHashCode().ToString()) == "131072+39")

    0 1 Reply Last reply
    0
    • F Frederic Vaillancourt

      I just ran across this line of condition in a KeyUp handler. if ((e.Modifiers.GetHashCode().ToString() + "+" + e.KeyCode.GetHashCode().ToString()) == "131072+39")

      0 Offline
      0 Offline
      0x3c0
      wrote on last edited by
      #2

      It could be worse. They could then split the generated string by the "+", convert each element to a float, and ask if the value is 131072. Then if it is, repeat the process with the second element using a nested if-statement. X|

      Between the idea And the reality Between the motion And the act Falls the Shadow

      D S 2 Replies Last reply
      0
      • 0 0x3c0

        It could be worse. They could then split the generated string by the "+", convert each element to a float, and ask if the value is 131072. Then if it is, repeat the process with the second element using a nested if-statement. X|

        Between the idea And the reality Between the motion And the act Falls the Shadow

        D Offline
        D Offline
        DaveyM69
        wrote on last edited by
        #3

        ... so that's the way to do it :doh:

        Dave
        BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
        Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
        Why are you using VB6? Do you hate yourself? (Christian Graus)

        0 1 Reply Last reply
        0
        • D DaveyM69

          ... so that's the way to do it :doh:

          Dave
          BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
          Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
          Why are you using VB6? Do you hate yourself? (Christian Graus)

          0 Offline
          0 Offline
          0x3c0
          wrote on last edited by
          #4

          Of course. I can't think of any 'better' way to obfuscate make it version-dependant write it

          Between the idea And the reality Between the motion And the act Falls the Shadow

          1 Reply Last reply
          0
          • 0 0x3c0

            It could be worse. They could then split the generated string by the "+", convert each element to a float, and ask if the value is 131072. Then if it is, repeat the process with the second element using a nested if-statement. X|

            Between the idea And the reality Between the motion And the act Falls the Shadow

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

            I remember one program which wanted to check if two variables were equal to something like 73 and 89, in either order, so rather than testing whether (var1=73 and var2=89) or (var1=89 and var2=73) it tested whether var*var2=6497. Not sure whether that qualifies as brilliant or horrible. The two variables were bytes, and the constants were primes, so the factorization was unique.

            OriginalGriffO J 2 Replies Last reply
            0
            • S supercat9

              I remember one program which wanted to check if two variables were equal to something like 73 and 89, in either order, so rather than testing whether (var1=73 and var2=89) or (var1=89 and var2=73) it tested whether var*var2=6497. Not sure whether that qualifies as brilliant or horrible. The two variables were bytes, and the constants were primes, so the factorization was unique.

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

              supercat9 wrote:

              Not sure whether that qualifies as brilliant or horrible. The two variables were bytes, and the constants were primes, so the factorization was unique.

              I'd go with horrible. Because they are bytes, the multiplication test relies on an implicit conversion to (at least) int16. Future failure coming up!

              No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

              "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

              S 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                supercat9 wrote:

                Not sure whether that qualifies as brilliant or horrible. The two variables were bytes, and the constants were primes, so the factorization was unique.

                I'd go with horrible. Because they are bytes, the multiplication test relies on an implicit conversion to (at least) int16. Future failure coming up!

                No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

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

                I'd go with horrible. Because they are bytes, the multiplication test relies on an implicit conversion to (at least) int16. Future failure coming up! I can't see a problem there, since I don't know of any language which wouldn't do at least an 8x8->16 multiply. A more interesting problem would arise if the constants changed so the factorization was no longer unique.

                1 Reply Last reply
                0
                • S supercat9

                  I remember one program which wanted to check if two variables were equal to something like 73 and 89, in either order, so rather than testing whether (var1=73 and var2=89) or (var1=89 and var2=73) it tested whether var*var2=6497. Not sure whether that qualifies as brilliant or horrible. The two variables were bytes, and the constants were primes, so the factorization was unique.

                  J Offline
                  J Offline
                  justastupidgurl
                  wrote on last edited by
                  #8

                  Brilliant if documented by a comment that they must be primes. Otherwise Horror.

                  JustAStupidGurl

                  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