I want to suggest functions and classes for implementation in CopperSpice

Discuss anything related to product development
Post Reply
Navadvipa Chandra d
Posts: 29
Joined: Sun Apr 19 2020 7:02 pm

I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello? All!

I present to your attention some interesting classes and functions that I did not find in CopperSpice, but which can be added to it very easily.

1. The QStorage and QStorageDB class
It can serialize C++ classes, which do not need to be modified at all.
To do this, you need to create a Storager helper class. Chris Kawa gave me the idea of an assistant class
on the Qt forum. You can choose the location where the class will be stored - in a file, in memory, or in a database.

For example, we want to restore the APrabhupadaLoginDialog dialog box from a file:

Code: Select all

LoadObject< QStoragerPrabhupadaLoginDialog >( APrabhupadaLoginDialog, &AStorage, QStorageKind::File );
And now we save the dialog box to a file.

Code: Select all

SaveObject< QStoragerPrabhupadaLoginDialog >( APrabhupadaLoginDialog, &AStorage, QStorageKind::File );
The QStoragerPrabhupadaLoginDialog class is an assistant class in this case.

2. We can suggest an interesting simple QEmitValue template for consideration.
Using it, for example, as

using QEmitInt = QEmitValue< int >;
using QEmitBool = QEmitValue< bool >;

and also using inheritance
class Languageindex : public QEmitInt

I have solved almost all the problems in my program "Srila Prabhupada's Dictionary!"

3. StringNumberToWords function - converts a numeric string into a verbal form
, for example "123" -> one hundred and twenty-three. I took the algorithm of this function a long time ago somewhere on the Internet. She was on Pascal. Redone it in C++

4. The Like function, it works as a very simplified regular expression, its operation is similar to the LIKE operator in a SELECT SQL query.
In other words, it compares a string with a string mask that contains two special characters.:

% - means any string, including an empty
one _ - means any letter, but not an empty space.

The Like function is still faster than the regular expressions of QRegularExpression, for example,

Like for the word "mach" successfully found 1298 words in 48 milliseconds
The QRegularExpression for the word "mach" successfully found 1298 words in 94 milliseconds

An example is here.

https://github.com/Navadvipa-Chandra-das/PrabhupadaDictionaryCopperSpice

This project took ideas and inspiration from the Kitchen Sink program.
If you have any problems with the launch, write to me, maybe I can help. The project has not been completed yet.

Thanks!
Sincerely, Navadvipa Chandra das.
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Thanks for sending us this information. We are always looking for contributors to CopperSpice. If you are looking for other ways to contribute please let us know and we can offer some other suggestions. There are lots of planned areas of improvement.


>> 1. QStorage and QStorageDB class

Without talking about implementation, can you tell us the purpose of these classes. What does it mean to "serialize class"? Are you referring to saving some data?

>> 2. We can suggest an interesting simple QEmitValue template for consideration.

You mentioned "we" so I am curious if there is another person involved. Is this item part of item 1 or a stand alone feature.

>> 3. StringNumberToWords function

This seems like a function specific to your project. Not sure if this really belongs in CS.

>> 4. The Like function, it works as a very simplified regular expression,

Have you used our QRegularExpression class? How would your function be different?

This may sound a bit silly but we need to ensure that all of your work is written by you and not lifted from another project.
We tried the link and it went to a 404. If the repo is not public (which is fine) then please send us an invitation on github.

Barbara
Navadvipa Chandra d
Posts: 29
Joined: Sun Apr 19 2020 7:02 pm

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello, Barbara and All!

1. Yes, QStorage and QStorageDB class work for saving and restore data.
2. No. While I was working on the project alone.
3. Butter won't spoil porridge. A Russian proverb
4. In regular expressions, the dot symbol "." means any character, and the asterisk symbol "*" means repeating zero or more times. In this case, you just need to change the mask.

I wrote it myself. For example, I've been thinking for a long time, how is it possible to compare a string with a mask?

StringNumberToWords is not my algorithm. This has been going on since the first and second versions of Borland Delphi. The function was either on the FAQ question list, or someone on the forum shared it with everyone.

Yes, that's right. my repository on github turned out to be private. I can't make it publicly available. I've given up on github.

https://gitflic.ru/project/navadvipa-chandra-das/slovar-shrily-prabhupady-na-copperspice

Because gitflic did not accept the large Sanskrit.db file.I made three volumes of the archive.

Sanskrit.7z.001
Sanskrit.7z.002
Sanskrit.7z.003

The archive must be unpacked before assembly.

Thanks!
Sincerely, Navadvipa Chandra das.
Last edited by Navadvipa Chandra d on Wed Jan 22 2025 9:02 pm, edited 1 time in total.
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Thank you for looking at where you can contribute to the CopperSpice project. If you are looking for areas of CS which are on our roadmap for improvement, please let us know and we can suggest a direction.

Your last reply did not provide enough information. Let's look at your requests again.

>> 1. QStorage and QStorageDB class
>> class work for saving and restore data.

We need a lot more information. What data and how is it formatted? Can the user change the format or do they need to use your layout? Does this class marshal data to a file? To a database? What are the advantages?


>> 2. We can suggest an interesting simple QEmitValue template for consideration.

Again, we need a lot more information about what this class does and why it should be added. How does is benefit CopperSpice?


>> 3. StringNumberToWords function

Does your function take international formats into consideration? We know that "numbers to words" in India is not the same as a US format. We are not sure this is related to anything which CS does.


>> 4. The Like function, it works as a very simplified regular expression,

You did not mention if you reviewed our QRegularExpression class Since we have this functionality already it is unclear why it needs to be duplicated. Are you proposing a function or another class?

I believe it would make more sense to improve QRegularExpression if you feel it is not adequate.

Barbara
Navadvipa Chandra d
Posts: 29
Joined: Sun Apr 19 2020 7:02 pm

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello, Barbara and All!

Have you looked at the source code on the GitFlic website? Have you tried compiling and running the PrabhupadaDictionary.exe ? I sent you a link to a public repository.

https://gitflic.ru/project/navadvipa-chandra-das/slovar-shrily-prabhupady-na-copperspice

1. Format binary. The user can decide for himself what and how to record, and how to restore data. For example, I saved an unlimited number of documents in a one file. Each document consisted of data from three database tables that were linked by two master-detail relationships. And during recovery (when reading data from a file), these documents were written to the database, and all the triggers were triggered. The Storager class-helper is responsible for this.

2. You can have a look.

3."The "number to word" is needed when printing financial documents, for example. When translating words, it turned out pretty well in different languages, including English. However, there are absolutely no words "and" in English. If the words "and" are necessary, then the algorithm needs to be further corrected. But in the Russian-language FAQ, the question about the "number to word" function appeared from the earliest versions Delphi. Means that a lot of developers need it!

To test the operation of the "number to word" function, you can uncomment a section of code in the PrabhupadaDictionary source texts.

4. I made it so that the user can choose whether to use regular expressions or the Like function. At first, I also decided that the Like function had outlived its usefulness and that regular expressions were much more attractive to both the user and the programmer. That's the way it is. But I decided to test the speed of work in identical queries. Complex queries of the Like function are too much for the teeth. And since the difference in speed is significant, I decided to leave it. It's so tiny that it won't take up much space. However, it requires preliminary preparation of a comparison mask. It will process double and triple "%" characters incorrectly. For example, you must first replace "%%" with a single "%" and so on until there are no double "%". But this is not so significant. It handles duplicate "%" characters in the tail of the mask, but you can remove this functionality.

With best regards, Navadvipa Chandra das.
Last edited by Navadvipa Chandra d on Wed Jan 22 2025 9:02 pm, edited 1 time in total.
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Let's break this down and talk about just one of your items. I am going to pick #4 with is your Like Function.

We have asked a few questions and thus far we have no answers. Rather than tell us what you function or class does, we need to talk about this in a different way. Please address the following items.

a) Have you looked at the existing QRegularExpression class in CopperSpice?

b) If you have, what did you find that does not work for your requirements? Please be specific in your comparison.

c) I would suggest reviewing the CS Documentation for QRegularExpression to understand how much functionality it already provides.
https://www.copperspice.com/docs/cs_api/class_qregularexpression.html

d) A library should not have multiple classes which overlap in functionality. Can you justify why there should be a second class in CS to handle regular expressions? Saying your function or class is small is not adequate. Any code we have has a maintenance overhead. The other problem we are seeing is that users of CS will not know why they should use class A over class B.

e) Based on your explanation about how your function works, it seems to have a rather complicated syntax. Accuracy, correctness, and ease of use are required.

Barbara
Navadvipa Chandra d
Posts: 29
Joined: Sun Apr 19 2020 7:02 pm

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by Navadvipa Chandra d »

Hello, Barbara and All!

a) Yes. I was looking at the documentation on QRegularExpression in CopperSpice.

b) Everything is consistent, except for the speed of operation. I don't need the full power of QRegularExpression. Why should I pay for QRegularExpression if the Like function does the same thing 100% faster?

c) Thank you. I was watching. It's good that there is documentation. I often have to look there.

d) I agree. But it's expensive.

e) I agree. For simplicity, you can add an overloaded function.

Only in this case we also get a disadvantage - one more function call. Accordingly, the execution time will increase, and the delay accumulates even more in the loop.

Thank You very much!

With best regards, Navadvipa Chandra das.
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

[ Moved from message to discuss other suggestions ]

1. What's wrong with QStorage and QStorageDB?

2. What's so bad about the QEmitValue pattern?
It solved all my problems where I needed to declare CS_SIGNAL_1 and CS_SIGNAL_2. I additionally used CS_SIGNAL_ constructs in only one place.

3. What's wrong with the StringNumberToWords function? They work in different languages.

It seems that if I want to expand the functionality of the library, then I will have to fork.
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

Let me start by saying, we do welcome all ideas and contributions. However not every suggestion will make into our project. New ideas and improvements must be relevant and of value to GUI developers.

If you are interested in seeing features added to CopperSpice then please submit a PR on github so other team members and users can comment and review your code. Contributions are not made to any project by the maintainers reading through your personal source code.

Your submission needs to follow our published CopperSpice coding standard which can be found on our website. Source code in a library should have a common look and feel, otherwise maintainability is extremely complicated.

https://www.copperspice.com/style_guide/source_code_style.html

1. What's wrong with QStorage and QStorageDB?
You have not fully explained why this would be of value to a GUI library. Please do so in your Pull Request.

2. What's so bad about the QEmitValue pattern?
It solved all my problems where I needed to declare CS_SIGNAL_1 and CS_SIGNAL_2. I additionally used CS_SIGNAL_ constructs in only one place.
I would suggest you not assume we believe your ideas are bad. You might be taking this conversation personally which is not helpful in a professional environment.

Again, you have not explained why this is of value to CopperSpice. We have no idea what you wanted to solve or how you did it. We hope your PR will explain all of this. You should include information to say what problem were you trying to solve.

There is always the chance if you tell us your problem we might be able to offer an existing or more modern solution.

3. What's wrong with the StringNumberToWords function? They work in different languages.
You misunderstood our comments about language and locale. We are not talking about translating the word "thousand" into French or German. Are you are of how words are organized in languages like Hindi, it is very different and something you will need to look up. Please do a bit of research. Then turn this function into a class that provides more than just one thing.

Are you aware that financial software does not use doubles or floats? How is your work going to solve this issue?

It seems that if I want to expand the functionality of the library, then I will have to fork.
You may have missed the entire point of what a library like CopperSpice is intended for. Rather than ignoring your upset, I would like to provide some background information. My hope is we can find some common ground. CopperSpice is a set of libraries with Classes and Methods for implementing a Graphical User Interface. Adding free functions which are not associated to a class is almost never done. But if they are, these functions are intended for internal use.

Adding a function to spell out some words solves a problem you had, we understand that idea. However you do not know if anyone else really needs this until you do an complete industry survey. We have a ton of experience in this area. This is the type of function which should be in a project or application library. This is not a feature which solves a GUI issue so no, it does not belong in CopperSpice.

You are free to take CopperSpice and create your own libraries but I would be remiss if I did not tell you the truth, maintaining this project will require more work than a full time job. It requires an experienced team, not just one or two people. You will need to write your own documentation from scratch, you will need to set up CI and test on every platform you want to support. You will need to buy or rent enough hardware, set up Docker images, and this cost is not zero. How will you provide technical support?

Instead, we would suggest you take your functions and create a small library that you can maintain. Put it on github and see where this goes before you try to reinvent the world.

Another fantastic idea would be to contribute something to CS that we actually can integrate easily. One of the best ways you can help the CopperSpice project is to add new unit tests. This is real work and will help you learn the full code base. If you want to discuss this further let us know and we will do everything to help you.

Barbara
barbara
Posts: 484
Joined: Sat Apr 04 2015 2:32 am
Contact:

Re: I want to suggest functions and classes for implementation in CopperSpice

Post by barbara »

b) Everything is consistent, except for the speed of operation
I am not sure what this comment means.
b) I don't need the full power of QRegularExpression. Why should I pay for QRegularExpression if the Like function does the same thing 100% faster?
There are several things we believe you have misunderstood and we are taking a lot of our time to help you. You are not "paying" for QRegularExpression so this comment is hard to understand.

You will need to implement your function as a class, not a function. You have said it has flaws, so correct them and then submit a PR. Make sure to include unit tests so your work can be validated.

Users strongly dislike multiple classes which have similar functionality. We have seen other libraries die on the vine over this this problem. They will not try both, instead they will walk away. This is not a good design strategy. As we have said, you should focus your energy on improving CopperSpice and improve our existing QRegularExpression.

Barbara
Post Reply