Dart Home | PowerTCP Winsock for ActiveX | Custom Development | Reply | PowerTCP Winsock for ActiveX Topics | Forums |
Author | Forum: PowerTCP Winsock for ActiveX Topic: DartStrings ADD method anomaly |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted July 21, 2009 10:03 AM If I add a single string containing control characters to a DartStrings collection then I get multiple items in the collection. This is with the delimiter set to "". Here is the sample code to reproduce the error. I get 3 items in the collection instead of 1. It looks like Chr(0) in my Data is interpreted as the delimiter? Private Sub Form_Load() Dim Strings As New DartStrings Dim Data As String Data = "Here is my string" & Chr(0) For i = 0 To 255 Data = Data & Chr(i) Next i Strings.Add Data MsgBox Strings.Count ' gives 3 strings End End Sub |
Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted July 22, 2009 9:29 AM You are correct. The controls is splitting on the NULL character(Chr(0)). This is the expected behavior. |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted July 22, 2009 9:41 AM Hi, Are you sure this is the expected behaviour? If I don't have a delimiter setup then I would expect every string I add to be a seperate item in the DartStrings collection. Chr(0) in my mind is a valid character and one should be able to set this as a delimiter if desired. The Help file says that DartStrings can support wide character sets (multi-language) which supports my case - if no delimiter has been setup then the delimiter should not be chr(0) by default. Please can you confrim this with the developers |
Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted July 22, 2009 10:25 AM I did check prior to answering your question as I thought that it was perhaps a bug. I've also verified my previous answer with the developers again and the answer remains the same. I'm told it has operated this way since the initial release of the control. This isn't a bug and is the expected behavior of the control. |
Jason Farrar (Admin) From: Oneida, NY USA Posts: 223 Member Since: 07/24/07 Extra Support Options Custom Application Development |
posted July 22, 2009 10:35 AM Additionally, your logic is well founded, if we were to design it today we simply would not parse the string at all if the delimiter had not been set. Unfortunately though the control has been in this state for a number of years and there may or may not be any number of customers depending on this specific behavior. |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted July 22, 2009 10:47 AM I agree that this 'bug' has probably been around a number of years but a quick search of the forum will show that I found 2 other errors (also probably around sicne Day 0) that Dart fixed for me. What can be done to 'convince' the developers to fix the problem? We have paid for custom development in the past but that was for new features so I am a bit reluctant to have to pay for something I regard as a 'bug' |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted July 22, 2009 11:25 AM Hi, Thanks for your comments. In this case, we do not feel a "fix" is warranted. The collection has a Delimiter property, which happens to use a default value of null. However, the developer can and should set this property to whatever value suits his needs. We apologize that the documentation is not clear on this point, and will endeavor to make it so in future releases. Please let us know if and why this solution does not work for you. Thanks again, -ken |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted July 22, 2009 11:40 AM Hi, We have an application that is sending us a number of strings of different lengths, and containing variable data (made up from all ASCII codes). We want to store those as seperate items in a DartStrings collection which should be able to be done if the delimiter is nothing (empty). Obviously some of those strings contain CHR(0) which is giving us problems in that we have more items in the collection than strings sent to us. |
K M Drake From: Utica, NY USA Posts: 3406 Member Since: 07/14/00 |
posted July 22, 2009 12:42 PM Hi, Thanks, I do understand your issue. My point is that it should be possible to select an alternative delimiter that will meet your needs just as well. Even if your data contains truly random strings (making it impossible for you to logically select a delimiter that cannot appear in these strings) you can come pretty close to ensuring there will be no match. Consider a random delimiter of 10 characters. I believe the math is correct when I say that the odds a random delimiter will match any other random 10 character string are 1 in 1,180,591,620,717,411,303,424. This number gets exponentially larger with each additional character added to the delimiter. For example, for a 15 character delimiter, the odds of an unintentional match are 1 in 40,564,819,207,303,340,847,894,502,572,032. Again, this is for data with no patterns. In most cases, with knowledge of the working data, the user can select a unique delimiter without resorting to random strings. So we are content with the behavior as it is. However, we are certainly open to developing an alternative strings collection that will specifically meet your needs. If this interests you, please contact Jamie (beyondsupport@dart.com) to start a discussion. -ken |
BrendanM From: Durban, South Africa Posts: 80 Member Since: 07/11/02 |
posted July 22, 2009 12:56 PM Hi. I agree your workaround will work but then I cannot use the .ALL property to get all the string data concatentated into 1 large string, without first setting the delimiter to NULL or doing an expensive search and replace. The reason why we wanted to use the DartStrings collection is that we have the item COUNT property as well as the ALL property. Our application needs to work both with the number of strings and the total concatenated string. Lets leave the issue closed, and I like you idea to update the Help to warn other users |
Reply | PowerTCP Winsock for ActiveX Topics | Forums |
This site is powered by PowerTCP WebServer for ActiveX |