Beware while using Japanese language
-
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
**
-
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
**
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
**
-
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
**
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
-
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
:wtf:
-
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
**
-
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
**
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;
} -
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;
}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.
-
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;
}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...)
-
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...)
That's OK - you don't need a GOTO! ;P
while (lang != "Japanese")
lang = "Japanese";
.... // as in any of the above postsSoftware rusts. Simon Stephenson, ca 1994.
-
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
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
**
-
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
**
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! ;)
-
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! ;)
-
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! ;)
-
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
**
You know him too??? ;P
-
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! ;)
-
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
: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.
-
That's OK - you don't need a GOTO! ;P
while (lang != "Japanese")
lang = "Japanese";
.... // as in any of the above postsSoftware rusts. Simon Stephenson, ca 1994.
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].
-
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
**
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|
-
Yeah, still can't get over the copypasta 'programmers'.
Posted from SPARTA!!!!!!!!!! 2.0. Don't forget to rate my post if it helped! ;)
-
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
**
If you find this funny, you'll love TheDailyWTF.com[^]