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. Beware while using Japanese language

Beware while using Japanese language

Scheduled Pinned Locked Moved The Weird and The Wonderful
23 Posts 18 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 MalikRizwan

    if (lang == "Japanese")
    {
    msg.BodyEncoding = System.Text.Encoding.UTF8;
    msg.SubjectEncoding = System.Text.Encoding.UTF8;
    }
    else
    {
    msg.BodyEncoding = System.Text.Encoding.UTF8;
    msg.SubjectEncoding = System.Text.Encoding.UTF8;
    }

    **

    R A M

    **

    M Offline
    M Offline
    MalikRizwan
    wrote on last edited by
    #2

    I found this some one posted in ASP.NET questions today, What could be the possible reason to set same encoding with conditional statement?

    **

    R A M

    **

    R G M 3 Replies Last reply
    0
    • M MalikRizwan

      I found this some one posted in ASP.NET questions today, What could be the possible reason to set same encoding with conditional statement?

      **

      R A M

      **

      R Offline
      R Offline
      Richard A Dalton
      wrote on last edited by
      #3

      MalikRizwan wrote:

      What could be the possible reason to set same encoding with conditional statement?

      Step 1 - Copy Step 2 - Paste Step 3 - .... Oohh Donuts It could be a simple case of "I'll get back to that" I was debugging some code a few years back, there was a strange error where the system just bombed out under certain circumstances. Error handling was otherwise very good. I finally traced the problem to a function that was literally half written. It was like the developer just stopped mid thought and never got back to it. It was syntactically correct, but it made little sense beyond that. I couldn't for the life of my figure out what had posessed the developer until I noticed that he had entered a comment at the head of the function. The date of the comment was 11-Sep-2001. He, like everyone else had dropped everything and run to the TV, and never got back to what he was doing. -Rd

      C M V 3 Replies Last reply
      0
      • R Richard A Dalton

        MalikRizwan wrote:

        What could be the possible reason to set same encoding with conditional statement?

        Step 1 - Copy Step 2 - Paste Step 3 - .... Oohh Donuts It could be a simple case of "I'll get back to that" I was debugging some code a few years back, there was a strange error where the system just bombed out under certain circumstances. Error handling was otherwise very good. I finally traced the problem to a function that was literally half written. It was like the developer just stopped mid thought and never got back to it. It was syntactically correct, but it made little sense beyond that. I couldn't for the life of my figure out what had posessed the developer until I noticed that he had entered a comment at the head of the function. The date of the comment was 11-Sep-2001. He, like everyone else had dropped everything and run to the TV, and never got back to what he was doing. -Rd

        C Offline
        C Offline
        Camilo Sanchez
        wrote on last edited by
        #4

        :wtf:

        1 Reply Last reply
        0
        • M MalikRizwan

          I found this some one posted in ASP.NET questions today, What could be the possible reason to set same encoding with conditional statement?

          **

          R A M

          **

          G Offline
          G Offline
          GenJerDan
          wrote on last edited by
          #5

          Future expansion.

          1 Reply Last reply
          0
          • M MalikRizwan

            if (lang == "Japanese")
            {
            msg.BodyEncoding = System.Text.Encoding.UTF8;
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            }
            else
            {
            msg.BodyEncoding = System.Text.Encoding.UTF8;
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            }

            **

            R A M

            **

            B Offline
            B Offline
            Blake Miller
            wrote on last edited by
            #6

            This is what I would be used to seeing... :confused:

            if (lang == "Japanese")
            {
            msg.BodyEncoding = System.Text.Encoding.UTF8;
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            }
            else if( lang != "Japanese" )
            {
            msg.BodyEncoding = System.Text.Encoding.UTF8;
            msg.SubjectEncoding = System.Text.Encoding.UTF8;
            }

            L P 2 Replies Last reply
            0
            • B Blake Miller

              This is what I would be used to seeing... :confused:

              if (lang == "Japanese")
              {
              msg.BodyEncoding = System.Text.Encoding.UTF8;
              msg.SubjectEncoding = System.Text.Encoding.UTF8;
              }
              else if( lang != "Japanese" )
              {
              msg.BodyEncoding = System.Text.Encoding.UTF8;
              msg.SubjectEncoding = System.Text.Encoding.UTF8;
              }

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #7

              you forgot the fallback, when all other tests failed:

              ...
              else
              {
              msg.BodyEncoding = System.Text.Encoding.UTF8;
              msg.SubjectEncoding = System.Text.Encoding.UTF8;
              }

              :)

              Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

              Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

              1 Reply Last reply
              0
              • B Blake Miller

                This is what I would be used to seeing... :confused:

                if (lang == "Japanese")
                {
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                msg.SubjectEncoding = System.Text.Encoding.UTF8;
                }
                else if( lang != "Japanese" )
                {
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                msg.SubjectEncoding = System.Text.Encoding.UTF8;
                }

                P Offline
                P Offline
                PIEBALDconsult
                wrote on last edited by
                #8

                Don't repeat yourself...

                retry:
                if (lang == "Japanese")
                {
                msg.BodyEncoding = System.Text.Encoding.UTF8;
                msg.SubjectEncoding = System.Text.Encoding.UTF8;
                }
                else if( lang != "Japanese" )
                {
                lang = "Japanese" ;
                goto retry ;
                }

                (Or something like that; I don't actually know how to do a goto...)

                P 1 Reply Last reply
                0
                • P PIEBALDconsult

                  Don't repeat yourself...

                  retry:
                  if (lang == "Japanese")
                  {
                  msg.BodyEncoding = System.Text.Encoding.UTF8;
                  msg.SubjectEncoding = System.Text.Encoding.UTF8;
                  }
                  else if( lang != "Japanese" )
                  {
                  lang = "Japanese" ;
                  goto retry ;
                  }

                  (Or something like that; I don't actually know how to do a goto...)

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

                  That's OK - you don't need a GOTO! ;P

                  while (lang != "Japanese")
                  lang = "Japanese";
                  .... // as in any of the above posts

                  Software rusts. Simon Stephenson, ca 1994.

                  S 1 Reply Last reply
                  0
                  • R Richard A Dalton

                    MalikRizwan wrote:

                    What could be the possible reason to set same encoding with conditional statement?

                    Step 1 - Copy Step 2 - Paste Step 3 - .... Oohh Donuts It could be a simple case of "I'll get back to that" I was debugging some code a few years back, there was a strange error where the system just bombed out under certain circumstances. Error handling was otherwise very good. I finally traced the problem to a function that was literally half written. It was like the developer just stopped mid thought and never got back to it. It was syntactically correct, but it made little sense beyond that. I couldn't for the life of my figure out what had posessed the developer until I noticed that he had entered a comment at the head of the function. The date of the comment was 11-Sep-2001. He, like everyone else had dropped everything and run to the TV, and never got back to what he was doing. -Rd

                    M Offline
                    M Offline
                    MalikRizwan
                    wrote on last edited by
                    #10

                    There was this guy who joined our team as a trainee. Who, according to him, had enough knowledge of .NET specially exception handling..later on i found his code full of TRY CATCH literally on each line .. something like this.. int budgetAmount =0; try { budgetAmount = 10; }catch(Exception ex) { } try { if(budgetAmount==10) budgetAmount += (baselineAmount * actualAmount); }catch(Exception ex) { } and so on

                    **

                    R A M

                    **

                    D F D 3 Replies Last reply
                    0
                    • M MalikRizwan

                      There was this guy who joined our team as a trainee. Who, according to him, had enough knowledge of .NET specially exception handling..later on i found his code full of TRY CATCH literally on each line .. something like this.. int budgetAmount =0; try { budgetAmount = 10; }catch(Exception ex) { } try { if(budgetAmount==10) budgetAmount += (baselineAmount * actualAmount); }catch(Exception ex) { } and so on

                      **

                      R A M

                      **

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

                      I am now going to cry in a corner. I wonder what proportion of successful programmers are self-taught? Just a hunch...

                      Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                      C J R M 4 Replies Last reply
                      0
                      • D dawmail333

                        I am now going to cry in a corner. I wonder what proportion of successful programmers are self-taught? Just a hunch...

                        Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                        C Offline
                        C Offline
                        ChrisNic
                        wrote on last edited by
                        #12

                        Self-taught?? Isn't taught pushing it a bit....

                        D 1 Reply Last reply
                        0
                        • C ChrisNic

                          Self-taught?? Isn't taught pushing it a bit....

                          D Offline
                          D Offline
                          dawmail333
                          wrote on last edited by
                          #13

                          I dunno. I wouldn't be surprised if a larger percentage of great programmers were self-taught. Shows initiative/care for the topic.

                          Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                          1 Reply Last reply
                          0
                          • M MalikRizwan

                            There was this guy who joined our team as a trainee. Who, according to him, had enough knowledge of .NET specially exception handling..later on i found his code full of TRY CATCH literally on each line .. something like this.. int budgetAmount =0; try { budgetAmount = 10; }catch(Exception ex) { } try { if(budgetAmount==10) budgetAmount += (baselineAmount * actualAmount); }catch(Exception ex) { } and so on

                            **

                            R A M

                            **

                            F Offline
                            F Offline
                            fjdiewornncalwe
                            wrote on last edited by
                            #14

                            You know him too??? ;P

                            1 Reply Last reply
                            0
                            • D dawmail333

                              I am now going to cry in a corner. I wonder what proportion of successful programmers are self-taught? Just a hunch...

                              Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                              J Offline
                              J Offline
                              Jecc
                              wrote on last edited by
                              #15

                              If you don't ever learn a little something on your own, you'll never be a great programmer.

                              D 1 Reply Last reply
                              0
                              • R Richard A Dalton

                                MalikRizwan wrote:

                                What could be the possible reason to set same encoding with conditional statement?

                                Step 1 - Copy Step 2 - Paste Step 3 - .... Oohh Donuts It could be a simple case of "I'll get back to that" I was debugging some code a few years back, there was a strange error where the system just bombed out under certain circumstances. Error handling was otherwise very good. I finally traced the problem to a function that was literally half written. It was like the developer just stopped mid thought and never got back to it. It was syntactically correct, but it made little sense beyond that. I couldn't for the life of my figure out what had posessed the developer until I noticed that he had entered a comment at the head of the function. The date of the comment was 11-Sep-2001. He, like everyone else had dropped everything and run to the TV, and never got back to what he was doing. -Rd

                                V Offline
                                V Offline
                                Vikram A Punathambekar
                                wrote on last edited by
                                #16

                                :omg: I hope it was just the TV he ran to.

                                Cheers, विक्रम (Got my troika of CCCs!) After all is said and done, much is said and little is done.

                                1 Reply Last reply
                                0
                                • P Peter_in_2780

                                  That's OK - you don't need a GOTO! ;P

                                  while (lang != "Japanese")
                                  lang = "Japanese";
                                  .... // as in any of the above posts

                                  Software rusts. Simon Stephenson, ca 1994.

                                  S Offline
                                  S Offline
                                  skcsknathan001
                                  wrote on last edited by
                                  #17

                                  My current workplace, I saw 2 functions, exactly the same except the name, written by a senior developer, who suppose to overlook the juniors! Mistake? Well, those two functions are one after the other, both fit right into one screen [that small the functions are].

                                  1 Reply Last reply
                                  0
                                  • M MalikRizwan

                                    There was this guy who joined our team as a trainee. Who, according to him, had enough knowledge of .NET specially exception handling..later on i found his code full of TRY CATCH literally on each line .. something like this.. int budgetAmount =0; try { budgetAmount = 10; }catch(Exception ex) { } try { if(budgetAmount==10) budgetAmount += (baselineAmount * actualAmount); }catch(Exception ex) { } and so on

                                    **

                                    R A M

                                    **

                                    D Offline
                                    D Offline
                                    djdanlib 0
                                    wrote on last edited by
                                    #18

                                    That's basically the same thing as VB code that uses ON ERROR RESUME NEXT... *shudder* Reminds me of a story I heard. This college student asked the instructor why his code didn't pass. As in, he got a failing grade. "But there aren't any errors! It compiles!", he argued! Well, it turned out that he'd commented out every line that caused a compilation error, and this cascaded into him commenting out EVERY LINE of his "code" which wasn't any good anyway. Since it didn't create a compilation error, he figured it was correct and submitted it without TESTING it. I've seen similar things happen in production code, though... mostly from managerial types who learned a little VB in the 90's and bought a couple custom controls and wrote a quick little hacky tool that worked for them and suddenly other people wanted a copy... then years later it's the standard tool for the company... and ugliness happened when some poor shmuck like myself had to add functionality, fix a bug or port it to a web interface X|

                                    1 Reply Last reply
                                    0
                                    • J Jecc

                                      If you don't ever learn a little something on your own, you'll never be a great programmer.

                                      D Offline
                                      D Offline
                                      dawmail333
                                      wrote on last edited by
                                      #19

                                      Yeah, still can't get over the copypasta 'programmers'.

                                      Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                                      S 1 Reply Last reply
                                      0
                                      • M MalikRizwan

                                        I found this some one posted in ASP.NET questions today, What could be the possible reason to set same encoding with conditional statement?

                                        **

                                        R A M

                                        **

                                        M Offline
                                        M Offline
                                        meaningoflights
                                        wrote on last edited by
                                        #20

                                        If you find this funny, you'll love TheDailyWTF.com[^]

                                        1 Reply Last reply
                                        0
                                        • D dawmail333

                                          I am now going to cry in a corner. I wonder what proportion of successful programmers are self-taught? Just a hunch...

                                          Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)

                                          R Offline
                                          R Offline
                                          Richard A Dalton
                                          wrote on last edited by
                                          #21

                                          dawmail333 wrote:

                                          I wonder what proportion of successful programmers are self-taught? Just a hunch...

                                          Give me a self taught programmer any day. I've taught programming at both under-grad and post-grad level, and you can tell by the end of the first class who can be good programmers and who will never quite get it. It's not about brains, although that makes it easier for some. It's about whether or not you are actually interested. Learning to be a programmer has much more in common with something like learning to play guitar than with something like being an administrator or a manager. Anyone can learn the chords, but to go to the next level you have to have the desire/compulsion to pick up the guitar on evening and weekends just because you enjoy it. And the dedication to pick up the guitar to learn something new even when you don't enjoy it. -Rd

                                          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