Re: Validation

2014-10-07 Thread Greg Keogh

 There is a similar usage of DataAnnotations described in an article at
 CodeProject -
 http://www.codeproject.com/Articles/256183/DataAnnotations-Validation-for-Beginner


Ta, I eventually stumbled on that one too. For ages I couldn't find
anything that actually used the attributes and I thought they might be only
used internally for DB entities. But I finally found the Validator class
(which has a rather strange class!). I made a custom validation attribute
and it works pleasantly -- *Greg*


RE: Validation

2014-10-07 Thread ILT (O)
The DataAnnotations namespace is extensive. I haven’t explored how to make use 
of its many classes.

 

  _  

Ian Thomas
Albert Park, Victoria

 

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com] On 
Behalf Of Greg Keogh
Sent: Tuesday, October 07, 2014 5:03 PM
To: ozDotNet
Subject: Re: Validation

 

There is a similar usage of DataAnnotations described in an article at 
CodeProject - 
http://www.codeproject.com/Articles/256183/DataAnnotations-Validation-for-Beginner
 

 

Ta, I eventually stumbled on that one too. For ages I couldn't find anything 
that actually used the attributes and I thought they might be only used 
internally for DB entities. But I finally found the Validator class (which has 
a rather strange class!). I made a custom validation attribute and it works 
pleasantly -- Greg



REST body encoding

2014-10-07 Thread Greg Keogh
Folks, I'm returning an XML element fragment in the body of a REST style
response, and in Fiddler I noticed it looks like this:

EFBBBF result/result

So the utf-8 BOM is going out, but I'm not sure if this is desirable,
standard or expected. This service is to be consumed by non .NET clients,
so I have to play nice for everyone. Are there official rules or other
conventions to follow regarding this?

*Greg K*


3d Trilateration

2014-10-07 Thread David Rhys Jones
Hi all,

Does anyone have code / link to a library that can do 3d Trilateration?

*I've been looking for the last hour, lots of theory and references to
matlab but nothing that looks like what I need.*

*Thanks*
*Davy.*

*Si hoc legere scis nimium eruditionis habes*.


Re: REST body encoding

2014-10-07 Thread Thomas Koster
Greg,

The standard states quite explicitly that a BOM in UTF-8 is
unnecessary[1, 2] and discouraged[2]. I never understood why
Microsoft's Unicode implementation emitted it.

There is an overload of the System.Text.UTF8Encoding constructor that
lets you encode without a BOM.

[1] http://www.unicode.org/faq/utf_bom.html#bom5
[2] http://www.unicode.org/versions/Unicode5.0.0/ch02.pdf (section 2.6, p. 36)

--
Thomas Koster

On 7 October 2014 23:08, Greg Keogh g...@mira.net wrote:
 Folks, I'm returning an XML element fragment in the body of a REST style
 response, and in Fiddler I noticed it looks like this:

 EFBBBF result/result

 So the utf-8 BOM is going out, but I'm not sure if this is desirable,
 standard or expected. This service is to be consumed by non .NET clients, so
 I have to play nice for everyone. Are there official rules or other
 conventions to follow regarding this?

 Greg K


Re: REST body encoding

2014-10-07 Thread Greg Keogh

 The standard states quite explicitly that a BOM in UTF-8 is
 unnecessary[1, 2] and discouraged[2].


I've been looking for official REST documentation on this matter (that I
still can't find), I didn't search the Unicode documentation, where it does
say

Where UTF-8 is used* transparently* in 8-bit environments, the use of a
BOM will interfere with any protocol or file format that expects specific
ASCII characters at the beginning

I'm guessing this applies to REST bodies, so I'm getting rid of the BOM.
I'm using a stream writer for the XML, so there'll be some options
somewhere to omit it.

*Greg*


Re: REST body encoding

2014-10-07 Thread Thomas Koster
On 8 October 2014 11:39, Greg Keogh g...@mira.net wrote:
 I've been looking for official REST documentation on this matter (that I
 still can't find),

I think REST is more an idiom than a hard standard. The HTTP 1.1 spec
is the closest thing you will find to a REST standard.

RFC 2616 (HTTP 1.1) and RFC 2617 (HTTP authentication) are invaluable resources.

 I didn't search the Unicode documentation, where it does
 say

 Where UTF-8 is used transparently in 8-bit environments, the use of a BOM
 will interfere with any protocol or file format that expects specific ASCII
 characters at the beginning

 I'm guessing this applies to REST bodies, so I'm getting rid of the BOM. I'm
 using a stream writer for the XML, so there'll be some options somewhere to
 omit it.

REST does not prescribe any particular text encoding. Indeed, a
resource (the HTTP spec calls it an entity) needn't be text at all.
Whatever entity you send, just be sure to include a correct and
detailed Content-Type header and always include the charset parameter
if the media type is text.

Note however that JSON's media type is application/json, not text. I
think it is generally agreed that JSON is always encoded in UTF-8.

On 8 October 2014 11:04, Thomas Koster tkos...@gmail.com wrote:
 The standard states quite explicitly that a BOM in UTF-8 is
 unnecessary[1, 2] and discouraged[2].

--
Thomas Koster