LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Improve the performance of a useless program (https://www.linuxquestions.org/questions/linux-general-1/improve-the-performance-of-a-useless-program-4175653668/)

Michael Uplawski 05-10-2019 05:46 AM

Improve the performance of a useless program
 
This is not about giving sense to a useless project. Just about improving it ...

Good afternoon.

I will elaborate the question further below. Have a little patience.

First.., when I log-in to LQ, I use to check at first the list of new and latest articles to see, if I can contribute to a discussion. Quite often I cannot, more often I do not want to. Being uninterested by too many topics, finding just those which I like to spend time on, takes too much effort and recently, I wonder if it would not make more sense to just abstain completely from reading LQ.

LQ has become mainly a place where I can get answers, sometimes. If “faint” can be used in this context, it describes completely how this improves my situation..; I grow vegetables and insulate a house with hemp and lime.

---------- Real post begins here -------------
Okay, then. If you still deem this worth an effort, here is the project. I have mentioned it once in a different context: My little program creates/invents English or German proverbs by combining beginnings and endings of existing proverbs. The result is completely senseless rubbish. It sometimes is funny and you can (e.g.) call the program from .bashrc as a replacement for fortunes.
To comprehend the issue that I try to address, you must know that my main inspiration is a parlor game, where, holding 6 cards, you can choose between the beginnings and endings of three proverbs and choose a combination which is likely to win you points, as your creations are evaluated after each round of the game.

My program cannot do this right, as the random generator cannot “choose” anything. In consequence the output of the program is either hilarious or completely dull and I have to live with it.

My latest idea is to “qualify” random proverbs, i.e. to give the user 5 seconds or so to hit the '+' key, if she/he considers the proverb ... meaningful, funny... worth keeping in a list or whatever. I implemented this and now I have a possibly growing list of randomly constructed proverbs.

The Question (at last): What would you do with it? Can there be a purpose to have this list around?

Modifying the program to give a bigger chance to proverbs already qualified to be displayed, will reduce the choices considerably and thus reproduce the same proverbs quite often...

Oh please. Take your time by all means... I do not even know when I will get back to this post or thread to see your answers...

Edit: https://rubygems.org/gems/Sprichwoerter

rtmistler 05-10-2019 07:45 AM

Whenever I have an open-ended, freely defined project I may think about enhancements, which is exactly what you're doing here.

If I feel that an enhancement is "do-able", I do it.

If I feel it may be complicated, I divide and conquer.

An example involving divide and conquer would be:
  1. You have a window of time where you show a phrase, and then you presumably would switch to a new one.
  2. During that window of time you could first add the capability to accept input. Test that it works the way you want, or maybe improve it a bit til you get it working satisfactorily.
  3. Next you could write the current phrase to a file if someone does provide the correct input, during the time window.
Is there any worth to this? My answer would be that it is of whatever worth your own inventive creations are to you. There are plenty of things which I retain which may not seem to make any sense to another person. There are also plenty of things I throw away.

Beryllos 05-10-2019 11:30 AM

A few ideas for improving the performance:
  • Rank proverbs not on a binary (in/out) scale, but on a continuous scale.
  • One way to do that is to present two proverbs, of which the user chooses the better one. Another time, present the same two in reverse order, to factor out order preference.
  • Beware, however, that user preference may be non-transitive. For example, the user may prefer A over B, B over C, and C over A. This phenomenon, if common, might make an interesting research project.
  • Add more raw material by mining song lyrics and quotation collections. Perhaps this could be automated.

Beryllos 05-10-2019 11:42 AM

Another idea for your consideration: Build your proverb generator into a fully-automated (unattended) Twitter account which creates and refines proverbs according to likes and retweets.

This article tells how one programmer did something not exactly like this on Instagram: https://medium.com/@chrisbuetti/how-...m-a5ed8a1e2a10

Michael Uplawski 05-11-2019 06:45 AM

It is raining. This is Normandy, but I mention it anyway... 25mm since yesterday, all storage tanks are full and I have even compiled a few programs in the meantime, GnuPG 230-beta from git and stuff like that. Now it is clear that I will not use the cement-mixer today. Wait... make that hail. Need some hail?

Cool thread! :) “Thank YOUHoouu” (Mark Knopfler).
Quote:

Originally Posted by rtmistler
You have a window of time where you show a phrase, and then you presumably would switch to a new one.
During that window of time you could first add the capability to accept input. Test that it works the way you want, or maybe improve it a bit til you get it working satisfactorily.
Next you could write the current phrase to a file if someone does provide the correct input, during the time window.

This means turning the program into a game. I had not thought about it this way and it could be worth an effort. However, as I program this in Ruby and all is very text-oriented, modifications of this kind are so simple that they even become boring.

Quote:

Originally Posted by rtmistler
There are plenty of things which I retain which may not seem to make any sense to another person. There are also plenty of things I throw away.

I recently tried to convince the users of the SoftMaker® Office-Suite that in the absence of an integrated programming interface, the XML file-types offer ample ways to become creative and to achieve automation. With other attempts that targeted all kinds of manipulations of office files, quite some demonstrations, scripts and mini-programs have piled up. All hope that someone could get some inspiration from them and produce something useful, be it only for her/himself has been dashed in the meantime and I give up all effort. I will be throwing away stuff (useful or not) but wait until I thought up the equivalent of a book burning party.

Quote:

Originally Posted by Beryllos
Rank proverbs not on a binary (in/out) scale, but on a continuous scale.

I had that idea; but already at that time got bugged by the question for a reason.

Quote:

One way to do that is to present two proverbs, of which the user chooses the better one. Another time, present the same two in reverse order, to factor out order preference.
This improves the overall quality of the list and I shall give it a try anyway.

Quote:

Add more raw material by mining song lyrics and quotation collections. Perhaps this could be automated.
The dilemma will be the same in the end, but I will try a few original citations.
Quote:

Another idea for your consideration: Build your proverb generator into a fully-automated (unattended) Twitter account which creates and refines proverbs according to likes and retweets.
Do not take this personally, but I warn people not to mention my name on any existing so-called “social media”. AFAIK I do not exist there and hope that I never will. In consequence I keep away from them as best as I can and also consider anonymization efforts vain.

TY for now.

Beryllos 05-11-2019 08:58 AM

Yes, I understand why you wouldn't want to turn this into a social media project. The article I cited shows how you can exploit other people online, which in my opinion is immoral/unethical if done without their informed consent. Even with their consent, there are other problems.

rtmistler 05-11-2019 03:30 PM

Quote:

Originally Posted by Michael Uplawski (Post 5993945)
This means turning the program into a game. I had not thought about it this way and it could be worth an effort. However, as I program this in Ruby and all is very text-oriented, modifications of this kind are so simple that they even become boring.

To be honest, I was proposing nothing specific. I was in fact discussing a possible approach towards the requirements you cited here:
Quote:

Originally Posted by Michael Uplawski (Post 5993615)
My latest idea is to “qualify” random proverbs, i.e. to give the user 5 seconds or so to hit the '+' key, if she/he considers the proverb ... meaningful, funny... worth keeping in a list or whatever. I implemented this and now I have a possibly growing list of randomly constructed proverbs.

I missed the detail that you had implemented this already.

Meanwhile you also wrote in your first post about a card game.

Either way, my intentions were to give some perspective towards how to continue development on a project you seemed so indifferent about as opposed to give you input towards specific features.

scasey 05-11-2019 04:16 PM

I've written a couple of "random generation" programs. One chooses cards and displays interpretations from a Tarot-like card deck. The card images and related readings were stored in a database. The trickiest part was to insure that a card was never drawn twice during the processing of a reading layout (the application allowed several different layouts with varying numbers of cards).

The second was called the Story Component Generator -- it also used a database consisting of Characters, Conflicts, Genres, Events, Minor characters, and Settings. It randomly selected and plugged together these components to provide an outline for the user to write a story. It was a feature of a site that was designed to encourage people wanting to learn and write fiction.

As the OP implied, random "choosing" requires something to choose from. My programs used database entries, but one could as well choose a random line or lines from a text file or files. Both programs required building lists of things to draw/choose from.

ondoho 05-11-2019 11:27 PM

I looked at it, and I like it (german version).
The randomness of it especially.
And, looking at the database, the simplicity.
And the option to add new proverbs.
I wouldn't make this into a parlor game but indeed leave it as a fortune cookie type of parody.

Michael Uplawski 05-14-2019 12:17 AM

Quote:

Originally Posted by rtmistler (Post 5994104)
To be honest, I was proposing nothing specific. I was in fact discussing a possible approach towards the requirements you cited here:I missed the detail that you had implemented this already.

I read your contributions attentively and am still contemplating your propositions. I have time to do that. :)

PSE ALL take note of the fact that I am unable and without hope to ever foresee the allusions which my choice of words and expressions causes to native English speakers. I have never spent more than a few minutes among native English speakers (10 days in Florida count as nothing nowhere with nobody around) and the conversations had never been as sincere as they are on LQ. Just try to imagine that I cannot create ambience in my postings and that what you sense is probably not there.

Quote:

Meanwhile you also wrote in your first post about a card game.
That came after “Inspiration” (see gray text).

Quote:

Either way, my intentions were to give some perspective towards how to continue development on a project you seemed so indifferent about as opposed to give you input towards specific features.
And you succeeded. No sweat. It is unavoidable that your ideas will influence the future of the program.

Michael Uplawski 05-14-2019 12:21 AM

Quote:

Originally Posted by ondoho (Post 5994207)
I wouldn't make this into a parlor game but indeed leave it as a fortune cookie type of parody.

TY.

I thought about adding quotes like “This bear is a problem-bear” or “She is destroying my Europe”. It needs more testing though, as the results had been disappointing for the time. Maybe the fun was in the way that an unnecessary ... erm. In the way that an “Unnecessary” thought to convey meaning while she/he just delivered bull. Combining the beginning of bull with the end of some rubbish bereaves the phrase of the context and ends just as bull.

I will look up some Blaise Pascal and Seneca instead...

Edit: “Power corrupts and absolute power is business.
Darn. I like that one.

ondoho 05-15-2019 12:25 AM

Quote:

Originally Posted by Michael Uplawski (Post 5994811)
I thought about adding quotes like “This bear is a problem-bear” or “She is destroying my Europe”.

you mean inventing new, nonsensical phrases?
Quote:

It needs more testing though, as the results had been disappointing for the time.
ah, yes. i think the fun is in seeing familiar phrases ("Viele Köche...") in an unfamiliar/nonsensical context.

Quote:

I will look up some Blaise Pascal and Seneca instead...
but it all depends on a very simple subject/object sentence... well hopefully you succeed.

nice!

edit:
sometimes one seems to get new, almost meaningful phrases:
"Kleine Geschenke beißen nicht."
"Ein voller Bauch zieht Arbeit nach sich."

Michael Uplawski 05-15-2019 05:16 AM

Quote:

Originally Posted by ondoho (Post 5995143)
you mean inventing new, nonsensical phrases?

Naaa. ;)
Edmund Stoiber, then „Ministerpräsident des Freistaates Bayern” about the first lonely bear which had missed a turnoff somewhere and got lost in the Bavarian forests.
The other one was just Helmut Kohl on Angie.

Here is a new Gem, version 1.4. Now this is even (quite dumbly) multi-threading:
http://www.uplawski.eu/Sprichwoerter...oerter-1.4.gem

Man-page:
German - http://www.uplawski.eu/Sprichwoerter/sprichwoerter.html
English - http://www.uplawski.eu/Sprichwoerter/proverbs.html

jtonti 05-16-2019 11:35 AM

To reduce the amount of work, keep track of '+' and also '-', then run through AI to try to determine what makes a good one, continuously learning and self-rating. Once a trend emerges (if ever), the ratio of good to bad (or better to worse if rating on a fractional scale), you will have created an amusing and possibly insightful proverb machine!

BW-userx 05-16-2019 11:48 AM

not having done anything with cards, the basic concept for me would be to have 2 arrays, 1st one is holding the beginning of a set of proverbs, the 2nd to have the endings to them. set a random on each then put the two together, print to screen, what is so hard about that?

the only check maybe to make sure the proper endings do not end up with the proper beginnings so the real proverb does not get displayed. If that match is had then call for one of them to redo the return value.


All times are GMT -5. The time now is 03:16 AM.