TechSpoken
"Any ideas?" is the most frequently-asked question in technical forums. My answer is: yes.

XSLT and your mother don't speak C#

July 11, 2009 21:56 by LSN

Being an integration specialist is never dull.

I am going to excerpt from an IM chat with one of the programmers on my team, about an SSIS package we are developing.

He:
I got:
 
A package of type Policy, labelled as ECWISE\XXX 2009-07-03 15:33:17.940, FAILED during its run from 2009-07-03 to 2009-07-03.\r\nHere is the error information: \r\n"\r\n----------------------------------------------------Please do not reply to this automated message.

 
why the \r\n escaped in the mail?
i used the xslt to transform the xml column into a string variable, and later i use this variable as the MailMessage.Body
Me:
how do you set message body on the Send Mail task?
He:
i'm using the script task and using the smtpclient
Me:
You put in the carriage return and newline escaped in your body, what do you expect?
He
i expect a real new line
Me:
Why? That's ridiculous. what do you mean by "real"?
He:
I expect:

Here is the error information: C:\temp31 does not exist!
-----------------------------------------------
Please do not reply to this automated message.

Something like that.
Me:
FOR GOD SAKES
I KNOW WHAT A NEW LINE AND CARRIAGE RETURN LOOK LIKE
I mean: why do you use the word "real"...
What makes \r\n "real" to you?
Think about it.

Sigh.

At this point, everybody who knows me can tell this is a verbatim conversation, right?

To continue:

He:
I used the wrong word, sorry.
Me:
No, don't say "sorry". Figure it out!
Why is \r\n "real"?
Think why you said it.
they are only characters, why are they "real" ?
\r\n is real because...
He:
I thought they are carriage return in text
Me
Really? If you are writing a letter to your mother, and you write \n\r does she interpret it as lf cr?
The letter is text.
[A long pause here]
When you wrote that string in your code what did you do?
did you write x + "\r\n" + y in the script task?
He:
Almost
I'm doing it in XSLT, so concat(x, "\r\n", y)
Me:
<rofl>
That is utterly ridiculous.
Let me ask you about your mother again
Does she read \r\n as CRLF?
He:
Never.
Me:
That's right, never.

So why do *you* read it that way? Why does it seem "real" to you?

I will tell you why, but you will kick yourself... It's because you are a C# programmer .

\r\n is not "real. It is just a convention in some languages. There is nothing "real" about it.
Your mother and XSLT don't speak C#.

  

It's not XSLT's fault, or your mother's.

In XSLT he ended  up using <xsl:text> to force a line break in his text e-mail message. That's okay, but please note you can use properly encoded entity references to create a CRLF in XSLT, just like you can in C#. 

As an interesting side-note, this project was being written in SSIS 2005. SSIS 2005 script tasks don't speak C# either. So, even if we were not using XSLT to formulate the message from the XML source containing the error information, we would have to use a VB convention, not \r\n, to get the job done.

If he were sending the message body as HTML rather than text for this error notice, he'd have to use <BR/>. SSIS 2005 script and HTML are two more environments that don't understand \r\n.

There's always a way to do it. But there is nothing inherently "real" about \r\n, no matter a person who is single-language-centric might think.

I want to be fair and say that this particular programmer is usually very agile-minded as we hook differently-abled types of code to each other in an integrated application. I'm not pointing him out in particular.

We live in the Matrix

I'm trying to say: in the world we live in now, nobody can afford to be language-centric.  I'm trying to say: none of this is real. 

Use what's best for the customer and best for the product. Don't get hung up on what's cool or what a vendor recommends.  Don't get freaked out by the little places, like representation of characters, that are different in each environment. 

Just take a breath, get your bearings, you'll find the right "words" in the right dialect. If what you're trying to express is important, have a little faith and realize there's a way to do it, in any language, no matter where in the world you are. 

And be careful out there.


Comments

July 8. 2009 17:40

Vietnamet

niche info

Vietnamet

July 19. 2009 23:08

BlackBerry Malaysia

I've encounter this problem once as well.

BlackBerry Malaysia

September 1. 2009 15:32

Brad

You got that pissed off over such a simple question? You really need to relax. All it would have taken was explaining the correct method, but you had to be a dick. Was this in the documentation? If so did you recommend the person read the documentation for other pitfalls he may come across? No, you got hung up on the use of the word "real". Yes, it may be an inaccurate and strange way of saying it, but it's really clear what the person meant. All it took would have been a simple explanation, yet you had to be a dick.

Don't be an unprofessional arsehole to your colleagues. You're the one who should worry about finding the right words in discussions.

Brad

September 1. 2009 18:12

>L<

I wasn't pissed off.  But I wasn't just going to give him a simple explanation; he's my student, not my colleague, and I generally like to lead him to the answer rather than giving it to him -- because he is a very good and promising student, and we have a long relationship and pretty good understanding of each other and how these conversations are supposed to work.  

I do need people on my team to lose "language tunnel vision", because of the kind of work we are asked to do.

I do find that simply giving the explanation doesn't bring us any further on that path, because the individual makes the same mistake next time unless led to think for himself.

And, Brad, I don't like to work with people who think they should be "given a simple explanation" so they don't have to think about the wider context of why the mistake is being made.  I try to kick them off my team as fast as possible, so as not to make them uncomfortable, and so as to continue Getting Stuff Done.  

See spacefold.com/.../...onym-that-really-counts.aspx; I'm quite serious about this, and I have to be.

>L<

September 24. 2009 04:58

>L<

No you may not copy this article on your blog.

>L<

September 30. 2009 15:33

ed hardy

Great work every buddy can get lots of interesting information, keep on posting this type of brilliant articles. I really like this keep it up again!

ed hardy

November 9. 2009 04:17

Indian property transfer

This information proved to be extremely helpful. Can you please provide more aspects of this topic?

Indian property transfer

November 11. 2009 04:58

beera

i have solved my problem with your help .thanks a lot for posting such info here.

beera

November 16. 2009 10:43

powerpoint presentation design

What is the latest version of XML and XSLT? And what is the difference b/w their previous versions?

powerpoint presentation design

November 19. 2009 19:35

Tagesgeldkonto Vergleich

Hi,
thanks for these detailed and interesting information. It is a good thing to share this with a broad public. Continue your brillant work.

Tagesgeldkonto Vergleich

November 22. 2009 06:16

outdoor furniture plans

I agree doing whats best for the customer will end up making a better end product with less customer service issues.

outdoor furniture plans

November 22. 2009 18:45

J

I don't know why I am writing this other than your article annoyed me.

For one trying to claim the person is single language minded due to \r\n is silly. One \r\n is not a convention of C# it is in fact a convention of C; Two Java, C#, PHP, Python all accept this information as new line and C++ and Perl interpret \n the same as C.  So for a single language mind set we have 5 languages that accept this convention and two languages that almost accept this convention.  

It seems to me you are ridiculing a person over the notion that their experiences says \r\n can be a new line in programming languages just because he hasn't interacted with other languages that say other wise.  A simple example would be you throwing something at a person because they picked up a Japanese book and assume you read it right to left.

Another statement that I find flawed is that XSLT and C# don't talk this is not entirely true (nor entirely false).  An XSLT style sheet can run scripts and last I check C# can be scripted which means XSLT can talk to C#.  In fact many XSLTs that I have been writing utilize C# Script in order to manipulate the XML document being translated in ways that would be more cumbersome if I were to do it in "pure" XSLT.

And last but not least I think the thing that annoyed me the most is the I lead a team and he is my student comment.  Now I could be wrong but typically a person can only claim another as their student if one they are in an academic arena for learning and you are his professor or two the person is genuinely under you for the purpose of learning (mentoring in a company setting).  Frankly if I worked with such a person who happened to be my team lead and he made the assumption that because he held such a title that I was his student and therefore he could insult my intelligence and speak to me how you transcribed the conversation I would be seeking a new place of employment after a visit to HR.  Even if he is under you; he is still a colleague; a person you are suppose to be working with not talking down to.

Anyways I will wrap this up since I have ranted long enough; this rant is not meant to be a trolling insult comment (though trolling can be claimed since I neither know you or have read your blog beyond this)

J

November 22. 2009 19:33

>L<

J,

I don't tend to put labels on things in general so I'm not going to label you as a troll based on any rules, don't worry.  You're entitled to your opinion.  And you can be annoyed as you want -- but I'm going to answer you seriously and at length.

In *my* opinion, I neither insult my students nor talk down to them, and I believe that they understand this.  For one thing, the people who really do talk down to them are legion, and they can tell the difference.  For another, they are appreciative of the fact that I actually expect more of them and trust that they are flexible enough to do more than one thing. This, again, is in contrast to how they are usually treated.

It's a little scarey for some people to be held to high expectations, but it also helps them think better of themselves and their own potential.  

I'm also not going to be labelling you as "bad" or "wrong" based on your statement about scripting XSLT using C# (and yes, you can use libraries with XSLT, although in many cases C# would not be an optimal choice, there are better libraries available in other languages, for other processors). However,  in an integrated app, using many different techniques and languages together, there can be real issues with delivering a bunch of DLLs and getting all the permissions and everything else to work in the customer's environment.  In this case, the XSLT is being invoked by SSIS and there are some specific pain points you don't need to know about, but it's better not to use a "crutch" like this when you don't have to.

The analogy I used (regarding my student's mother) was deliberate, and reflects my personal relationship with that individual, which is extremely close.  

The analogy I was asking him to envision, and which he did immediately, was this: My student could write a letter to his mother and (1) require that she understand characters indicating a carriage return or (2) employ some device that automatically translates his characters into the expected carriage return in his editor or  (3) use a different editor just so he can hit the keys he thinks are a "proper" carriage return or (4) learn what is the right key to hit to get a carriage return natively in this editor, which has many other advantages for this situation.

Because he is Chinese and we "talk" on IM, my student has to choose (2) when he talks to me.  I'm very grateful that he can do it, and astonished that he can do it so well. But when he writes a letter to his mother, should he have to go through the same process?  

The analogy was particularly apt, because as he well knows and often comments on, I'm female and his mother's age <g>. (So that's the backstory there, whether you care about it or not.)

Perhaps you, not being either my student or somebody with whom I have a relationship, would like a different analogy more. Suppose you are negotiating for a price with a vendor.  Yes, you could use a translator in the discussion, but if you *could* you would speak the same language to have the most precise and personal understanding without an intermediary or impedance mismatch between language concepts.  It's safest, most accurate, and fastest.  

Yes, there are people who insist on not learning another language, both in life and in code, for their own convenience, for expediency, out of fear of the unknown, or a hundred other reasons.  I don't know what yours are, and they're probably perfectly valid. But they wouldn't suit the kind of work I do and they would make life impossible for the situation that my students, none of whom are native English speakers, find themselves in as employees of an American firm.  Frankly, I apologize to them *daily* for not being able to speak Chinese -- and again I am grateful that they make this huge effort. And they are grateful that I don't treat them like uncreative, low-potential robotic coders, based on language issues, which many other people have done.

Yes, I understand that you haven't read anything else here, and if you don't want to, that's fine. But I do talk about this frequently, and I do speculate on the many sides of cross-language communication quite a lot. So, for a little more insight, you might want to read this spacefold.com/.../...in-Global-Communication.aspx.

>L<

November 22. 2009 19:35

>L<

OK for some reason that URL got munged.  Try again (add the HTTP part):

spacefold.com/lisa/post/2008/12/20/Sensitivity-versus-Consistency-in-Global-Communication.aspx

>L<

February 2. 2010 20:13

Medical billing practices

I think you should give news on the topic more often

Medical billing practices

February 15. 2010 20:12

International furniture removals

A good read, definitely worth a cut and paste. Thanks!

International furniture removals

March 7. 2010 05:12

relaxation mp3

For what it is worth - I agree with J. - putting labels on things is a sure fire way to come across all manner of difficulties in life.  That said I appreciate your elucidation on the subject in your reply.

relaxation mp3

March 30. 2010 06:53

Dorsey Kudley

Thanks for your information on XSLT. I am studying this stuff at college at the moment.

Dorsey Kudley

April 5. 2010 15:49

Jawatan Kosong Kerajaan

Thanks for the tips. It's not easy to come across such a great blog

Jawatan Kosong Kerajaan

April 5. 2010 15:50

Jawatan Kosong

Never give up. You did the right thing

Jawatan Kosong

April 5. 2010 15:51

Jawatan Kosong

Wow. There's no words to describe it but excellent.

Jawatan Kosong

April 23. 2010 12:06

castelle patio furniture

Never give up. You did the right thing

castelle patio furniture

May 1. 2010 18:11

Kerja Sambilan

Never stop doing what you love the most

Kerja Sambilan

May 1. 2010 18:11

Botox In Canada

Interesting concept. thanks

Botox In Canada

May 1. 2010 18:12

Botox In Canada

Never stop blogging you really made my day.

Botox In Canada

May 6. 2010 08:42

Victoria's Secret

Interesting information, Thanks for sharing it.

Victoria's Secret

May 19. 2010 23:15

Facebook Smiley

For what it is worth - I agree with J. - putting labels on things is a sure fire way to come across all manner of difficulties in life.  That said I appreciate your elucidation on the subject in your reply.

Facebook Smiley

May 24. 2010 18:14

Wettforum

LOL At first, I thought that the conversation between you and your colleague may be somehow ridiculous, but it really made me laugh. But, if I were in your place, for sure I would be really frustrated or even devastated.

Wettforum

May 26. 2010 06:31

Sports experts

Haha, dont worry, you did alright!

Sports experts

May 26. 2010 16:41

Online Backup

This is  very hilarious I enjoyed reading the article and the conversation between the two friends. I never have enjoyed reading blogs until I have found this site.

Online Backup

June 2. 2010 08:12

lijfrente stamrecht

Haha, great chat session.. It looks like one of mine.

lijfrente stamrecht

June 4. 2010 14:49

seks Melayu

Interesting idea on how you manage to solve the problem. Thanks.

seks Melayu

June 7. 2010 22:37

massage

Solving the problems is an art, you gave it wonderfully

massage

June 18. 2010 00:22

reverse telephone directory

pleasant resource. rss feed added

reverse telephone directory

June 28. 2010 12:55

iPod Free

I could swear my mother was speaking Visual Basic the other day, though I did have a lot to drink...

iPod Free

July 11. 2010 07:24

bonus bet, free bet, free bet guide

i used to have the same problem but what I did was to search over the internet and good thing I was able to get insights from people like you. thanks.

bonus bet, free bet, free bet guide

July 13. 2010 05:15

lightweight luggage

Really respect for what you wrote in here,i was digging in google very deep until i found your post in the 9th page,really your blog deserve first spot in google,
really google is unfair.
anyway keep the good job.
i will come by to visit if there is any updates.

lightweight luggage

July 14. 2010 05:35

business opportunity review

Lisa you got someone mad!  I take it the student was not as pissed off as that reader.  Must admit it did come across a little harsh.

business opportunity review

July 16. 2010 20:02

prom dresses

this is amazing! thanks for sharing this awesome post! I'm gonna follow them on twitter. love it! love it! love it! thank you so much!

prom dresses

July 17. 2010 16:44

criação de sites

<a rel="dofollow" href="http://remind.com.br">Criação de Sites</a>

criação de sites

July 21. 2010 06:28

canada goose parkas

Write your articles great hope that more exchanges to your site the first time very happy

canada goose parkas

July 22. 2010 06:50

limo in baltimore

great work is going on .

limo in baltimore

July 22. 2010 06:51

limo in baltimore

nice article..

limo in baltimore

July 24. 2010 09:31

orlando garcia

Hello Smile Have a great day. <a href="http://dgkamon.com/"> All about firefighters! </a>

orlando garcia

Add comment


(Will show your Gravatar icon)

  Country flag

Click to change captcha

biuquote
  • Comment
  • Preview
Loading