-
Nov 11th, 2020, 04:02 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Special sorting/ordering problem
Hi all
I have a special sorting problem, and I look for a good idea on how to solve it.
There is a string array which holds parents and children.
Parents start with !, children are everything else.
This array has to be processed several times in order to have the parents one time only,
and the children shall follow every single parent.
This is my code:
Code:
Private Sub Command1_Click()
Dim Lines(26) As String
Dim ToDoCount As Integer
Dim FirstRun As Boolean
Dim LastRun As Boolean
Dim i As Integer
Dim j As Integer
Dim n As Integer
Dim m As String
'the parents start with !
'children are everything else except -START- and -END-
Lines(0) = vbNullString
Lines(1) = vbNullString
Lines(2) = vbNullString
Lines(3) = vbNullString
Lines(4) = "-START-"
Lines(5) = "!A (first parent)"
Lines(6) = " 1a"
Lines(7) = " 2a"
Lines(8) = "!B"
Lines(9) = " 3b"
Lines(10) = " 4b"
Lines(11) = " 5b"
Lines(12) = "!C"
Lines(13) = " 6c"
Lines(14) = ""
Lines(15) = "!D"
Lines(16) = " 7d"
Lines(17) = ""
Lines(18) = " 8d"
Lines(19) = "!E"
Lines(20) = " 9e"
Lines(21) = ""
Lines(22) = " 10e"
Lines(23) = "!F"
Lines(24) = " 11f"
Lines(25) = " 12f (last child)"
Lines(26) = "-END-"
Text1.Text = vbNullString
ToDoCount = CInt(Text2.Text)
For i = 1 To ToDoCount
FirstRun = (i = 1)
LastRun = (i = ToDoCount)
For j = LBound(Lines) To UBound(Lines)
If Lines(j) = "-START-" Then
If (Not FirstRun) Then GoTo Skip
End If
If Lines(j) = "-END-" Then
If (Not LastRun) Then GoTo Skip
End If
If Len(Lines(j)) Then 'only if a lines has a content
n = n + 1
m = m & CStr(n) & vbTab & Lines(j) & vbCrLf
End If
'down to here it works so far
'nonsense
' 'kill parent so it can't be output again
' If Left$(Lines(j), 1) = "!" Then
' Lines(j) = vbNullString
' End If
Skip:
Next
Next
Text1.Text = m
End Sub
Desired output with 2 counts:
Code:
1 -START-
2 !A---
3 1a
4 2a
5 1a
6 2a
7 !B
8 3b
9 4b
10 5b
11 3b
12 4b
13 5b
14 !C
15 6c
16 6c
17 !D
18 7d
19 8d
10 7d
21 8d
22 !E
23 9e
24 10e
25 9e
26 10e
27 !F
28 11f
29 12f---
30 11f
31 12f---
32 -END-
And this is the test project:
TestT.zip
-
Nov 11th, 2020, 05:43 PM
#2
Re: Special sorting/ordering problem
I don't want to solve your exercise but I have to give you some tips:
1. Make the right key before you do the sort job.
2. Parents must be uinque, so you must have a second list, for parents, to check if a parent added to final unordered list.
Code:
-START-
-START-
A { !A (first parent)}
A00010001 { 1a}
A00010002 { 2a}
A00020001 { 1a}
A00020002 { 2a}
A00030001 { 1a}
A00030002 { 2a}
B { !B}
B00010003 { 3b}
B00010004 { 4b}
B00010005 { 5b}
B00020003 { 3b}
B00020004 { 4b}
B00020005 { 5b}
B00030003 { 3b}
B00030004 { 4b}
B00030005 { 5b}
C { !C}
C00010006 { 6c}
C00020006 { 6c}
C00030006 { 6c}
D { !D}
D00010007 { 7d}
D00010008 { 8d}
D00020007 { 7d}
D00020008 { 8d}
D00030007 { 7d}
D00030008 { 8d}
E { !E}
E00010009 { 9e}
E00010010 { 10e}
E00020009 { 9e}
E00020010 { 10e}
E00030009 { 9e}
E00030010 { 10e}
F { !F}
F00010011 { 11f}
F00010012 { 12f (last child)}
F00020011 { 11f}
F00020012 { 12f (last child)}
F00030011 { 11f}
F00030012 { 12f (last child)}
-END-
-START-
END
-
Nov 11th, 2020, 06:12 PM
#3
Re: Special sorting/ordering problem
It's not really a "Sorting-", but a "Grouping-Problem"...
And those are best solved (normally) via SQL-instructions (working against an InMem-DB, or a permanent DB).
Alternatively one could use Dictionaries or Collections for such grouping-tasks...
(the following approach is using an RC5 cSortedDictionary, and a cArrayList for the ChildEntries):
Assuming you have initialized your Input-Array in Form_Load() this way:
Code:
Option Explicit
Private Lines(26) As String
Private Sub Form_Load()
Lines(0) = vbNullString
Lines(1) = vbNullString
Lines(2) = vbNullString
Lines(3) = vbNullString
Lines(4) = "-START-"
Lines(5) = "!A (first parent)"
Lines(6) = " 1a"
Lines(7) = " 2a"
Lines(8) = "!B"
Lines(9) = " 3b"
Lines(10) = " 4b"
Lines(11) = " 5b"
Lines(12) = "!C"
Lines(13) = " 6c"
Lines(14) = ""
Lines(15) = "!D"
Lines(16) = " 7d"
Lines(17) = ""
Lines(18) = " 8d"
Lines(19) = "!E"
Lines(20) = " 9e"
Lines(21) = ""
Lines(22) = " 10e"
Lines(23) = "!F"
Lines(24) = " 11f"
Lines(25) = " 12f (last child)"
Lines(26) = "-END-"
End Sub
A Form_Click() can now solve your grouping-problem quite easily like that:
Code:
Private Sub Form_Click()
Dim i, Chld, PKey, P As New cSortedDictionary
'parsing-part (we only react to lines, which contain Child-Infos)
For i = 1 To 2
For Each Chld In Lines
If Chld Like "*[0-9][a-z]*" Then 'it's a Child-Text-Line
Chld = Trim$(Split(Chld, "(")(0)) 'remove superflous stuff from the Child-Text
PKey = "!" & UCase$(Right$(Chld, 1)) 'derive the ParentKey from the Child-Text
If Not P.Exists(PKey) Then P.Add PKey, New_c.ArrayList(vbString) 'add a new, empty Array
P(PKey).Add Chld 'add the current child to the now existing Parent-Array-entry
End If
Next
Next
'output (enumerating the Parent-entries, which store their children in an ArrayList-object, we can join
For i = 0 To P.Count - 1
Debug.Print P.KeyByIndex(i); " ("; P.ItemByIndex(i).Join(","); ")"
Next
End Sub
Generating the following debug-output (for two rounds):
Code:
!A (1a,2a,1a,2a)
!B (3b,4b,5b,3b,4b,5b)
!C (6c,6c)
!D (7d,8d,7d,8d)
!E (9e,10e,9e,10e)
!F (11f,12f,11f,12f)
HTH
Olaf
Last edited by Schmidt; Nov 11th, 2020 at 06:53 PM.
-
Nov 11th, 2020, 07:17 PM
#4
Re: Special sorting/ordering problem
Sorting not needed if we get the data as is always, and this is the solution:
Code:
Dim where
For j = LBound(Lines) To UBound(Lines)
LastRun = (i = ToDoCount)
If Lines(j) = "-START-" Then
n = n + 1
m = m & CStr(n) & vbTab & Lines(j) & vbCrLf
GoTo Skip
End If
If Lines(j) = "-END-" Then
n = n + 1
m = m & CStr(n) & vbTab & Lines(j) & vbCrLf
GoTo ex1
End If
If Len(Lines(j)) Then 'only if a lines has a content
n = n + 1
m = m & CStr(n) & vbTab & Split(Lines(j), " (")(0) & vbCrLf
where = j + 1
For i = 1 To ToDoCount
j = where
Do
If Len(Lines(j)) Then
If Left$(Lines(j), 1) = " " Then
n = n + 1
m = m & CStr(n) & vbTab & Split(Lines(j), " (")(0) & vbCrLf
Else
Exit Do
End If
End If
j = j + 1
Loop
Next
j = j - 1
End If
Skip:
Next
ex1:
Last edited by georgekar; Nov 11th, 2020 at 07:23 PM.
-
Nov 12th, 2020, 07:10 AM
#5
Thread Starter
Fanatic Member
Re: Special sorting/ordering problem
@Olaf
It's not really a "Sorting-", but a "Grouping-Problem"...
Yes, I didn't know how to name it.
The SQL approach is a good idea.
I think it is not the first choice for me, but I got the principle.
Thank you!
@georgekar
I don't want to solve your exercise
I didn't expect that.
BTW, it's not an exercise but a real world task.
Anyway, in the end you did my 'exercise'.
Clever idea to do the loops the other way around and to remember where things were found.
I have to modify/harden it a bit (i.e. when "-END- is missing etc.).
I also tried different input combinations, they do all work good.
So no second list and no unique parent necessary :-)
Thank you for kicking me on the right track!
-
Nov 12th, 2020, 01:54 PM
#6
Re: Special sorting/ordering problem
Originally Posted by Karl77
@Olaf
Yes, I didn't know how to name it.
The SQL approach is a good idea.
I think it is not the first choice for me, but I got the principle.
What I was trying to express was, that it would be a good idea,
when TreeStructures are held in a proper Object-Container.
But if you have to "hold" such tree-structures in a String (for whatever reason),
then at least express them in a String-Serialization-Format, which is standardized (using hardened, standardized parsers)...
(as e.g. JSON-Format, which can transport Tree-structures just fine).
For example, if you'd have used a JSON-string to begin with, you could (at any time):
- deserialize this string into an Object-Container (to conveniently access, and manipulate members)
- and of course also the opposite is possible (serializing this Object-Container back into JSON-string-format)
Here is, how your example could look like, when you'd have based it on JSON:
Code:
Option Explicit
Private oTree As cCollection 'our JSON-Object-Container
Private Sub Form_Load() 'we start from String-Input (to create our oTree-JSONObject)
Const sJSON = "{'!A':['1a','2a'],'!B':['3b','4b','5b'],'!C':['6c'],'!D':['7d','8d']}"
Set oTree = New_c.JSONDecodeToCollection(Replace(sJSON, "'", """"))
Debug.Print oTree.SerializeToJSONString 'output is possible (at any time) from Obj into a standardized serialization-format
End Sub
Private Sub Form_Click()
MsgBox TreeToPlainText(oTree) 'normal "special rendering" of the tree-obj into a string
MsgBox TreeToPlainText(oTree, 2) 'and again, this time with twice the child-entries
MsgBox TreeToPlainText(oTree, 0) 'and again, this time rendering only the Parents
End Sub
Private Function TreeToPlainText(oTree As cCollection, Optional ByVal ChildMultiplier& = 1) As String
Dim SA As cArrayList, i&, j&, Child
Set SA = New_c.ArrayList(vbString, "--Start--")
For i = 0 To oTree.Count - 1
SA.Add oTree.KeyByIndex(i)
For j = 1 To ChildMultiplier
For Each Child In oTree.ItemByIndex(i): SA.Add " " & Child: Next
Next
Next
SA.Add "--End--"
TreeToPlainText = SA.Join(vbCrLf)
End Function
HTH
Olaf
-
Nov 12th, 2020, 03:35 PM
#7
Re: [RESOLVED] Special sorting/ordering problem
@Karl77,
My second post triggered from Olaf. He gave a solution that i thought was not proper for an exercise. So you say that this was not an exercise. My first post is more universal. You have to think a way to make a key, and then you have to use a vector type list, with pairs key/value, like that classes provided by Olaf's classes, with sorting function.
I have also a class for sorting, although in my class sorting happen manual, by our command when we need to do that.
https://github.com/M2000Interpreter/...Collection.cls
Olaf's classes from RC6 are black box, as I know, and I don't know if he has the will to open these. Mr Olaf has gave to all of us good examples, and its certain a major contributor to the forum's community. Always my thoughts about the close approach of RC6 and previous versions has to do on legal issues, perhaps breaking some patents.
-
Nov 13th, 2020, 03:09 AM
#8
Re: [RESOLVED] Special sorting/ordering problem
Last edited by wqweto; Nov 16th, 2020 at 05:44 AM.
-
Nov 13th, 2020, 12:58 PM
#9
Re: [RESOLVED] Special sorting/ordering problem
Sorry, but i start programming at a time without indentation. For times to times when I want to revise my code I pass the proper indentation. I am fun of ctrl+F (is the most used keystroke in vb6 ide). Also I am a GOTO fun user, so some times I do some nasty jumps.
Fastcollection was the first class from a series of classes with the same basic task, to implement a hash table. The FastCollection used by the M2000 programmer as Inventory (and Inventory Queue), to store keys or keys/values.Keys are internal strings, but can be numbers and the class hold the type of number too. Values can be objects or variants.
This class has two variation (and a half) in same class, the List and the Queue, plus a readonly list, used for Structures, as readonly list (keys are name for offsets, an values are offsets and types, in an auxiliary field in the class). The difference has to do with the deletion of an item. The list not guarantee the position of the items in the deletion. This happen because when we delete an item in the middle we take the last one and move it to the deleted position. In queue style we remove items from the last insert. The list style has unique keys, but the queue can handle same keys. So the sorting for list style is a non stable sorting, but for queue we have to use a stable one, so two keys with same name never miss the order in which each placed in the queue. So we have two sorting functions, and for each one we have also two variations, one for comparing strings as strings and the second one which compare fields of string as numbers, without defining the size of field, the algorithm finds the parts, numeric and not numeric and use them as 1st, 2nd, nth key.
For filenames sort look here:
https://github.com/M2000Interpreter/...ter/RecDir.cls
Last edited by georgekar; Nov 13th, 2020 at 01:12 PM.
-
Nov 13th, 2020, 02:13 PM
#10
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by georgekar
My second post triggered from Olaf. He gave a solution that i thought was not proper for an exercise.
I disagree.
Your second post is just another variant of "loop-spaghetti" (IMO) - only feeding the need for "Copy&Paste-coding" (there's nothing to learn from that).
It did not break the problem-structure apart into Parent- and Child-Lists.
Originally Posted by georgekar
My first post is more universal.
You have to think a way to make a key, and then you have to use a vector type list, with pairs key/value,
I agree, that your first post was slightly better than your second one -
but in my opinion, your classification of the Child-List (as a list of Key/Value-pairs) is wrong,
since there's apparently "no sorting at all" wanted within these Child-Listings.
Instead those Child-Listings simply have to maintain their "Add-Order"
(and in later multiplying-attempts are added to the end of the listing again, in their entirety, in the same order they were found)
Originally Posted by georgekar
Always my thoughts about the close approach of RC6 and previous versions has to do on legal issues, perhaps breaking some patents.
Well, if you think so, then please enlighten us, which parts of the RichClient-Classes are screaming "patent-fraud" at you.
Just name the software-patents, which you think my Class-implementations violate.
George, please be more careful with such statements in the future, since you could be dragged to court for such libel.
There's a significant difference between "what you think is true" (as long as you keep it to yourself, in your mind) -
and "bringing your thoughts to paper" (in a public forum no less, where your speculations are read by thousands of people, and cannot easily be erased).
You cannot just walk around, making a whole community aware, that you think (for example), that a school-teacher is a "child-molester"...
Because even if it comes out later, that you were wrong "in your thinking" - the damage to that guy is irreparably done - and "it remains"...
(because it's human nature... some parts of the community will never really trust their children into the care of "that guy" again,
and so this teacher has to probably change his working place, and might be even forced to move out of the city he taught in).
That's the reason, why laws exist for "slander and libel" - please keep that in mind.
Olaf
Last edited by Schmidt; Nov 13th, 2020 at 02:20 PM.
-
Nov 13th, 2020, 03:13 PM
#11
Re: [RESOLVED] Special sorting/ordering problem
Olaf, my spirit was to trigger you to answer the expected answer; So now honestly I believe that there is no such a patent or any other violation in your code. This is my thought (or believe) (we have problem in translation here...). So for either i stand on my belief.
To express my beliefs, for a theoretical situation, i think there is no reason to suite me.
-
Nov 13th, 2020, 04:06 PM
#12
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by georgekar
To express my beliefs, for a theoretical situation, i think there is no reason to suite me.
I'll certainly not sue you over that... (since it was ridiculous enough to be believable).
The reason I was calling you out was, that quite a lot of people seem to think (nowadays),
that "freedom of expression" (of their own personal beliefs) is somehow their "god-given right",
no matter whether it is nonsense they might utter, and entirely careless about, who the audience is...
When you express your private thoughts to a public audience (in speach or writing),
you should better double-check beforehand, that you can give proof, especially when
"the publically expressed thought" was "accusing somebody of breaking the law".
Olaf
-
Nov 13th, 2020, 06:59 PM
#13
Re: [RESOLVED] Special sorting/ordering problem
I understand what I wrote, and why. It was a message to initiate a discussion about the "code opening" of RC5, now RC6. I couldn't accuse anything for a close to me and for everyone, piece of a proprietary software, for bad fit of others patent, I am not magician to know what you use, and why I do such a thing? Freedom of expression, is for you to reply a code snippet, and you get judge for it, like you judge mine reply. There is no publicity expressed thoughts, as a class of forbidden thoughts. There are thoughts that happen to be accepted or rejected. So you can reject my thoughts, and this is the essence of freedom in expression, you can hear anything from anything. As we say in Greece, you have to take serious what happen to said from a middle position from serious to no serious. So I use exaggeration to show you that a bad think about your code can exist. The idea (abstraction) exist no matter what we say to each other. So the abstraction isn't private, and I am not working to spread this, nor I am the ownership of the abstraction.
In your http://www.vbrichclient.com/#/en/About/, I see this: The RC65.dll is written in VB6 - and a later Open-Sourcing under LGPL is planned.
You may had reply: wait for RC65, no further discussion will need. But this is another abstraction, just happen to not shared with you.
With Respect
George
Last edited by georgekar; Nov 13th, 2020 at 07:02 PM.
-
Nov 13th, 2020, 07:49 PM
#14
Fanatic Member
Re: [RESOLVED] Special sorting/ordering problem
To be fair, Olaf has contributed and helped a lot to VB community, more than most of us. Why you guys always eye on RC6 open source, RC6 is his property, why people like to steal his property??? even after he has opened the source, 99.9% people won't read at all.
-
Nov 13th, 2020, 09:56 PM
#15
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by georgekar
There is no publicity expressed thoughts, as a class of forbidden thoughts.
Seriously?
I've already tried to explain in my last two postings, that there indeed is a class of "forbidden thoughts":
- 1) when you not keep them to yourself - and express them (e.g. in writing)
- 2) to a public audience (e.g. in a public internet-forum)
And this class includes unproven allegations towards another person, as e.g. alleged law-infrigements, up to even "plain mobbing or bullying".
And of course you're free to "do as you like anyways", but you can be sued for it.
Originally Posted by georgekar
I use exaggeration to show you that a bad think about your code can exist.
You seem to be under the impression, that providing and maintaining a massive, battle-hardened helper-library is a weekend-task.
And that providing it to every community-member at no costs (including a ton of examples) is not enough.
No, you also want its sourcecode on top (entirely forgetting, that I'm one of the main-contributors of free VB6-Sources over the last 2 decades).
Originally Posted by georgekar
And there's nothing wrong with that statement, because otherwise I'd have deleted it last week, in my recent Editing-session on the WebSite.
(and BTW "RC65.dll" was an editing-mistake which is now corrected to "RC6.dll")...
Originally Posted by georgekar
You may had reply: wait for RC65, no further discussion will need.
I've explained the reasons for not opening the sources several times already (over the last years, here in this forum - so you could have just googled them) -
but here they are again:
1.) My plan always was, to release them together with the IDE- and Compiler-sources (the RC6-Classes are the "Runtime-Classes" for this new environment).
1.1) ... but the compiler-development is currently "crawling along" very slowly (not much spare-time for it currently)
2.) Furthermore, maintaining a Public Repo for that enormous amount of source-code:
2.1) ... would be time-consuming (time I don't have, currently)
2.2) ... so why risking "a fork" due to "alienating others by not reviewing larger pull-request, or leaving tickets open in the issue-tracker"
In other words, "please let me finish the whole thing at my own pace in peace, goddammit!" ;-)
Olaf
-
Nov 13th, 2020, 11:30 PM
#16
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by Schmidt
In other words, "please let me finish the whole thing at my own pace in peace, goddammit!" ;-)
Please continue to do it at your pace. I'm always ready to use your new IDE and Compiler to develop new apps, because I've decided that I'll use Basic and JavaScript throughout my life. I've developed some apps with VB6 and RC5, but I haven't released them because I want my apps to be cross-platform.
If your new IDE and Compiler are released, I'll switch my VB6 apps to your new IDE and Compiler as soon as possible.
(From dm)
Last edited by SearchingDataOnly; Nov 13th, 2020 at 11:43 PM.
-
Nov 14th, 2020, 04:28 AM
#17
Thread Starter
Fanatic Member
Re: [RESOLVED] Special sorting/ordering problem
Back to the initial topic...
The data comes in as strings, I have no choice.
The example I prepared *looks* like a tree structure, because I manually made it look like that, just to illustrate the task.
There is no parent/child relationsship.
The real data is much more complicated and it is some effort to decode what is meant by it.
For asking my question I simplified the data as much as possible.
I could make such a tree structure of it, yes.
In fact this not an option, because it is useless effort.
I only need the described grouping and nothing else.
Which is solved so far after some finetuning.
I needed a hint, I got several hints, I made use of them.
So again thanks to all of you.
-
Nov 14th, 2020, 08:20 AM
#18
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by Karl77
The data comes in as strings, I have no choice.
Would have liked to know, from where exactly this "string you have to parse" was originating from:
- a (Text-)File? (if yes, coud you give at least the file-ending of that file)
- a (Webserver-)Response? (if yes, could you give at least the mime-format of that response)
I'm curious about that, because I've never encountered a scenario so far,
where one was required to increase redundancy (which happens here, by multiplying already existing data behind some "Parent-Marker").
Originally Posted by Karl77
I could make such a tree structure of it, yes.
Well, if you could do that, then there's obviously "Parent/Child relationships" in the underlying "flat-data".
Originally Posted by Karl77
In fact this not an option, because it is useless effort.
You probably mean, that obtaining your filtered results in just one pass
(usually via a "hand-written parser-routine", which already includes also the "handwritten-filter-ops")
seems preferable to a "two passes"-approach like:
1) straight parsing of data into a better "container-structure" (without any attempt of filtering at this stage)
2) subsequent filtering of the results you want, from that better suited container-stucture
From my experience, going the "two passes"-route is in almost all cases more worthwhile, with several advantages:
- in code-volume
- surprisingly, also the over-all performance is usually better this way
- but most importantly: better code-maintainability
The last point comes into play, e.g. when someone decides that your filtering has to be adjusted
(to include "some more, or some other stuff in the results").
With a two-passes approach, you'd have to only adjust "a few lines" (or ideally an SQL-string),
whereas with a one-pass-approach, you will have to:
- "get familiar with your handwritten code again" first
- before manually implementing additional filter-ops via VB6 String-Functions
- hoping that your adjustments didn't break the priorily existing filter-functionality
So, well - that's what I was trying to bring across with my examples.
HTH
Olaf
Last edited by Schmidt; Nov 14th, 2020 at 08:28 AM.
-
Nov 16th, 2020, 04:48 AM
#19
Thread Starter
Fanatic Member
Re: [RESOLVED] Special sorting/ordering problem
@Olaf
Would have liked to know, from where exactly this "string you have to parse" was originating from:
Why?
But to answer your question: Comes in via text file along with other info.
I'm curious about that, because I've never encountered a scenario so far,
where one was required to increase redundancy.
Redundancy doesn't get increased.
The "parent" is a kind of 'tool' that does some jobs.
The jobs, let's call them "children", have to be done in several places.
There is also a list of the places.
The goal is to avoid changing the 'tool', but to visit the several places where the 'tool' does it's job.
So redundancy is not increased because the places do change.
From my experience, going the "two passes"-route is in almost all cases more worthwhile, with several advantages:
In most cases and from your experience.
I agree a code has to be easy to understand not only by the creator.
This aspect is ok in the current situation.
And there are no fantasies on how to extend the functionality.
Again, the problem is solved using just a simple loop.
The solution is near to perfect.
No need to argue for a solution that is much more complicated.
Your approaches and solutions are a great source to learn from.
Which I also did in this thread.
Please don't insist on 'my solution is better'.
In this case it is not.
Thanks for your effort
-
Nov 16th, 2020, 08:56 AM
#20
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by Karl77
@Olaf
Why?
But to answer your question: Comes in via text file along with other info.
That did not answer my question.
I was specifically asking for the File-Ending (in case it's a Text-File).
Originally Posted by Karl77
Please don't insist on 'my solution is better'.
In this case it is not.
It's not about "my solution is better" - that's not what motivates me - or what I'm after, not at all.
What motivates me (to sit down and start writing code for something that is currently no use to myself),
is "to understand an interesting problem better, in case it might come up later in my work".
That's "plain nerdism" which is at work here on my end.
The fact that I "share my efforts publically" is a necessity,
because it's the only thing which encourages others, to share "their own nerdy efforts" as well
(in a place like this forum).
And what you're denying me at this point, is a description of the "true problem"
(avoiding all my questions in that regard).
It's enormously unsatisfying, that I was trying to understand something,
which was "entirely made up" (not really reflecting the real-world-scenario, wich I'd still like to learn more about).
The whole thread (as it is currently) reads to me like:
You: "I need an integer number between 1 and 20"
Me: "13"
George: "8 ... no - wait, it's 7"
You: "George is right..."
Me: ??? ...(well, "lucky him")...
George: "Yeahhh, I knew I had it in me, to pick an integer out of 1-20 correctly..." (SCNR)
...
You: Well, you know... it wasn't really about Integers, it was all about something else, but you gave me inspiration, thanks - problem solved.
Me: "What was the real problem?"
You: "Doesn't matter, problem solved"
Me: "But I'd really like to know more about the probl..."
You: "As said, problem solved. You've lost"
Olaf
-
Nov 16th, 2020, 01:05 PM
#21
Thread Starter
Fanatic Member
Re: [RESOLVED] Special sorting/ordering problem
@Olaf
I really appreciate your interest and effort.
Thanks again.
But to answer your question: Comes in via text file along with other info.
That did not answer my question.
I was specifically asking for the File-Ending (in case it's a Text-File).
Now I'm not sure what you mean by File-Ending.
I answer as best as I can:
The filename extension is txt.
The last line contains some info or not, it depends.
The last char in the file is LF.
What motivates me (to sit down and start writing code for something that is currently no use to myself),
is "to understand an interesting problem better, in case it might come up later in my work".
I understand.
Therefore I described the scenario for you in post #19.
Besides the intial description in the very first post.
Not good enough?
That's "plain nerdism" which is at work here on my end.
The fact that I "share my efforts publically" is a necessity,
because it's the only thing which encourages others, to share "their own nerdy efforts" as well
(in a place like this forum).
Very good.
And what you're denying me at this point, is a description of the "true problem"
(avoiding all my questions in that regard).
As you know, I did not.
See post #19.
I was not willing to follow your advice, that's all.
For reasons which have nothing to do with your person, your style, your tone etc.
It's enormously unsatisfying, that I was trying to understand something,
which was "entirely made up" (not really reflecting the real-world-scenario, wich I'd still like to learn more about).
It makes sense to simplify as much as possible.
Even in a description of a problem.
You are not the only other participant.
The whole thread (as it is currently) reads to me like:
...
You: "As said, problem solved. You've lost"
This statement reads to me:
I was so busy and didn't win.
georgekar gave me a tangible hint.
Seems he understood the task...
---
Olaf, I'll be glad to show you the real use of the solution.
I don't want to publish it here.
In a private TeamViewer/Skype/Whatever session I can explain.
Takes 5 minutes, and you will know all.
PM me.
-
Nov 16th, 2020, 02:02 PM
#22
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by Karl77
It makes sense to simplify as much as possible.
Even in a description of a problem.
No, especially not there.
Originally Posted by Karl77
In a private TeamViewer/Skype/Whatever session I can explain.
Takes 5 minutes, and you will know all.
You could just PM me a link to your *.txt File, since that's all I'd like to have a look at.
Olaf
-
Nov 16th, 2020, 02:10 PM
#23
Thread Starter
Fanatic Member
Re: [RESOLVED] Special sorting/ordering problem
Olaf, the Lines() in my initial post reflects very well the principle of the file.
I'll end here regarding this thread, sorry.
-
Nov 16th, 2020, 02:39 PM
#24
Re: [RESOLVED] Special sorting/ordering problem
Originally Posted by Karl77
Olaf, the Lines() in my initial post reflects very well the principle of the file.
Well, you wrote in your post #17:
"The real data is much more complicated and it is some effort to decode what is meant by it."
... which triggered my curiosity.
Then you offered, to show me that data "on your machine" (via a Remote-Session).
And now you deny my request, to take a look at that file-data via a PMed Download-link
(which is much simpler and less time-consuming than a Remote-Session)?
"What the heck's going on here?"
Olaf
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|