Felt like this method/tutorial should be let known. The method on the website kind of points in one direction, and doesn't quite touch base on how to get a decent, server/admin shop setup.
With Residences (another plugin offered by zrips), you are able to create shops within also. That has not been incorporated into this yet.
Dynamic Signs could be used if you like editing from config file. Must first be setup for each sign. Not very intuitive. if you use '/dsign' or '/cmi dsign' while looking at a dynamic sign, you can edit it. To make a dynamic sign, you place a sign, then run the following
The issue with using Dynamic sign, is if you use sign edit '/se [linenumber] text' the dynamic sign just goes obsolete. So it is recommended to NOT use /se with dynamic signs. All of these are separate features and have to be used somewhat differently from each other. Or in certain fashions to work correctly.
Interactive Commands;
Using IC, you can view all IC's available with '/ic' or '/cmi ic'
Also, once a sign has been made it will not update from config. It will be a static sign that's intractable. Using this method doesn't make it easy to edit signs already made.
Creating an InteractiveCommand Sign:
IC Method 1:
Method 1 TL;DR: Create a sign with /ic, apply permissions, use [ic:icname] in first line of sign upon creation. Doesn't work any other way. /cmi reload doesn't reload config SignLines.
Command:
Code:
/cmi ic new name-of-sign/shop
Config File: interactiveCommands.yml
Code:
# Use [ic:[icname]] in first line of sign. Make sure to give permissions for cmi.interactivesign.* to user posting
goldappless:
Locations:
- world1;-1066.0;71.0;-552.0
Commands:
- cmi money take [playerName] 10000
- cmi give [playerName] golden_apple
- cmi actionbarmsg [playerName] Golden Apple placed in your inventory
SignLines:
- '{#dfcd6f}Golden Apple'
- 'Price: {#0bda51}10000₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
sellshop:
Commands: []
carrotshop:
Locations:
- world1;-1063.0;71.0;-555.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] carrot
- cmi actionbarmsg [playerName] Carrot placed in your inventory
SignLines:
- '{#dfcd6f}Carrot'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
cakeshop:
Locations:
- world1;-1063.0;71.0;-554.0
Commands:
- cmi money take [playerName] 150
- cmi give [playerName] cake
- cmi actionbarmsg [playerName] Cake placed in your inventory
SignLines:
- '{#dfcd6f}Cake'
- 'Price: {#0bda51}150₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
applesshop:
Locations:
- world1;-1066.0;72.0;-553.0
Commands:
- cmi money take [playerName] 100
- cmi give [playerName] apple
- cmi actionbarmsg [playerName] Apple placed in your inventory
SignLines:
- '{#dfcd6f}Apples'
- 'Price: {#0bda51}100₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
breadshop:
Locations:
- world1;-1063.0;71.0;-552.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] bread
- cmi actionbarmsg [playerName] Bread placed in your inventory
SignLines:
- '{#dfcd6f}Bread'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
eggsshop:
Locations:
- world1;-1063.0;72.0;-553.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] egg
- cmi actionbarmsg [playerName] Egg placed in your inventory
SignLines:
- '{#dfcd6f}Egg'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
sugarshop:
Locations:
- world1;-1063.0;71.0;-556.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] sugar
- ' '
- cmi actionbarmsg [playerName] Sugar placed in your inventory
SignLines:
- '{#dfcd6f}Sugar'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
You can use the sign name like so
Code:
[ic:applesshop]
In the first line of the sign only when you first place the sign. You must remove and replace the sign to name again with Interactive Command options and sign lines.
If you run
Code:
/ic
You will get a list of InteractiveCommands you have created. Or option to create more by clicking GREEN + sign.
From here you can click the InteractiveCommand you want and make it public.
You should be able to see what the sign should have in the top line here also.
Make sure to
Enabled, requires permission to place the sign.
Also add that permission or cmi.interactivesign.* to the user or group trying to create the signs.
This only works when you first create the sign. Sign Edit will mess it up, along with dynamic sign. So don't use those on the sign once you get it working.
With IC, you can edit signs in the config file if you used [ic:[icname]] in top line of sign:
Code:
apples-shop:
Locations:
- world1;-1066.0;71.0;-555.0
Commands:
- cmi money take [playerName] 100
- cmi give [playerName] apple
SignLines:
- '{#dfcd6f}Apples'
- 'Price: {#0bda51}100₿'
- '{#08e8de}Click to BUY'
The lines don't seem to update with /cmi reload.
So doesn't seem to be a quick way to update compared to dynamic signs. It will reload with the command above.
You can also edit sign lines using /ic click the ic,
and look for [EditSignLines] in the new conext menu followed with a click.
Now each line is editable with a click.
Example:
If you change it to public status, anyone can paste the IC sign.
If you enable [ReqPerm], any user with cmi.interactivesign.[icname] permission node will be able to paste that IC sign.
You could give admin cmi.interactivesign.* for access to all signs.
Locations in file are updated automatically.
cmi.interactivesign.[icname] – Allows to create interactive signs when using [ic:[icName]] as top line of sign
As you can see, you can further narrow it down per group in Lucky Perms (permission software).
Have VIP members able to use signs, or maybe user shops can come into play. cmi pay command can be used etc.
Note* Editing from config and then editing from GUI can turn into a hassle. Be sure your copy is updated everytime you make an edit. Otherwise some changes won't be saved, or some changes will be overwritten. Editing sign lines DOESN'T auto update in game.
IC Method 2:
Method 2 TL;DR: You can preformat a sign in game using /se or /dsign and apply an interactive sign to the block you are looking at.
Command:
Code:
/cmi ic new name-of-sign/shop
Config File: interactiveCommands.yml
Code:
# Use [ic:[icname]] in first line of sign. Make sure to give permissions for cmi.interactivesign.* to user posting
goldappless:
Locations:
- world1;-1066.0;71.0;-552.0
Commands:
- cmi money take [playerName] 10000
- cmi give [playerName] golden_apple
- cmi actionbarmsg [playerName] Golden Apple placed in your inventory
SignLines:
- '{#dfcd6f}Golden Apple'
- 'Price: {#0bda51}10000₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
sellshop:
Commands: []
carrotshop:
Locations:
- world1;-1063.0;71.0;-555.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] carrot
- cmi actionbarmsg [playerName] Carrot placed in your inventory
SignLines:
- '{#dfcd6f}Carrot'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
cakeshop:
Locations:
- world1;-1063.0;71.0;-554.0
Commands:
- cmi money take [playerName] 150
- cmi give [playerName] cake
- cmi actionbarmsg [playerName] Cake placed in your inventory
SignLines:
- '{#dfcd6f}Cake'
- 'Price: {#0bda51}150₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
applesshop:
Locations:
- world1;-1066.0;72.0;-553.0
Commands:
- cmi money take [playerName] 100
- cmi give [playerName] apple
- cmi actionbarmsg [playerName] Apple placed in your inventory
SignLines:
- '{#dfcd6f}Apples'
- 'Price: {#0bda51}100₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
breadshop:
Locations:
- world1;-1063.0;71.0;-552.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] bread
- cmi actionbarmsg [playerName] Bread placed in your inventory
SignLines:
- '{#dfcd6f}Bread'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
eggsshop:
Locations:
- world1;-1063.0;72.0;-553.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] egg
- cmi actionbarmsg [playerName] Egg placed in your inventory
SignLines:
- '{#dfcd6f}Egg'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
sugarshop:
Locations:
- world1;-1063.0;71.0;-556.0
Commands:
- cmi money take [playerName] 50
- cmi give [playerName] sugar
- ' '
- cmi actionbarmsg [playerName] Sugar placed in your inventory
SignLines:
- '{#dfcd6f}Sugar'
- 'Price: {#0bda51}50₿'
- ' '
- '{#08e8de}Click to BUY'
Public: true
There should be a command to auto bind to the block you are facing when inputting that command. I'm not sure of it at this moment.
Instead, click the + button after you run the command. It will add the block you are looking at when looking at a sign (or hologram, or whatever object really).
You can use this exact script from above, just delete the location for everything, and in game run '/cmi ic'. Click the item you want to add a location for. Then click the '+' button to use the location you are looking at.
If you use the + button to add the sign instead of using the [ic:[icname]] in the first line, you can use sign edit (/se) or dynamic sign (/dsign) on the sign to manage it.
This does dis-associate the InteractiveCommand sign-lines with the sign though. Rather annoying it doesn't work like dynamic signs and reload anytime the top line says [ic:icname], so keep in mind that little bug.
And that's the end of IC Method 2.
You can technically have any block, hologram w/wo floating icon, or even entities as right clickable. Have a sign or another hologram line to explain the price. Only limited by your imagination it seems.
In image example below you will see I have setup a hologram in front of a sign, but when you right click the sign it will buy the item floating.
You could have the item floating right clickable in hologram also to buy. Not covered here yet.
Hologram Sell Shops:
You could use hologram with pages, and each page would be a different item. just right click the 'Buy' line to buy the item, using commands from above. May look sleek. Will have to try it later.
Note*
Priority of Sign features are like so
Sign Edit > Dynamic Signs > Interactive Commands
If you use sign edit, that sign will be dis-associated with Dynamic sign or Interactive commands. So SE (Sign edit) takes precedence over the other features. Then dynamic sign, I believe will take precedence over IC signs. So if you setup an IC, then use DS on it, you no longer can edit with IC. You can always change the commands on IC, just won't have access to edit SignLines because the sign has been dis-associated. Using IC to create a sign, changes made in config aren't static after a sign has been made using IC.
Posted by: xSicKxBot - 11-05-2022, 04:19 AM - Forum: Python
- No Replies
The Fasting Cure [Book Summary + Free Download]
5/5 – (1 vote)
Fasting has many scientifically proven benefits for your body and overall health:
Intermittent fasting improved blood pressure and resting heart rates as well as other heart-related measurements. Physical performance. Young men who fasted for 16 hours showed fat loss while maintaining muscle mass. Mice who were fed on alternate days showed better endurance in running. — Johns Hopkins Medicine
While Finxter is not a health blog and I am not a medical advisor, allow me to share this age-old wisdom from the book “The Fasting Cure” by Upton Sinclair.
Intermittent fasting has helped me and many other highly productive individuals create more value, stay more healthy, and maximize their productivity — in coding, business, or any other professional field.
Fasting can make you more money—so keep reading!
This short book summary is based on the original book that can be downloaded for free here. I’ll give many direct quotes from the book but only the ones that I think are useful for you so you don’t have to read the whole book by yourself. All highlights are my own.
Perfect Health
The Fasting Cure appeared in Cosmopolitan Magazine in the year 1910—you see: few things are as well-researched and well-understood as the benefits of fasting. More than 100 years later and scientists still agree on the benefits of fasting!
Like nobody would argue against the benefits of sleep, nobody can argue with the benefits of fasting.
Let that sink in.
The book starts with a strong opening paragraph about Perfect Health:
Have you any conception of what the phrase means? Can you form any image of what would be your feeling if every organ in your body were functioning perfectly? Perhaps you can go back to some day in your youth, when you got up early in the morning and went for a walk, and the spirit of the sunrise got into your blood, and you walked faster, and took deep breaths, and laughed aloud for the sheer happiness of being alive in such a world of beauty. And now you are grown older—and what would you give for the secret of that glorious feeling? What would you say if you were told that you could bring it back and keep it, not only for mornings, but for afternoons and evenings, and not as something accidental and mysterious, but as something which you yourself have created, and of which you are completely master? (source)
Everybody wants to be healthy, full of energy, and free from pain. Being healthy means not only a much better quality of life, but health is also the source of all human productivity.
The more you lose health, the less you get done. So spend some time on your health daily!
It is simply that for ten years I have been studying the ill health of myself and of the men and women around me. And I have found the cause and the remedy. I have not only found good health, but perfect health; I have found a new state of being, a new potentiality of life; a sense of lightness and cleanness and joyfulness, such as I did not know could exist in the human body. (source)
Next, the book goes into some personal stories of the health struggles of the author, while interesting, we’ll skip over them quickly—time is scarce.
Here’s the kicker story that made the author act on the fasting cure:
So matters stood when I chanced to meet a lady, whose radiant complexion and extraordinary health were a matter of remark to everyone. I was surprised to hear that for ten or fifteen years, and until quite recently, she had been a bed-ridden invalid. She had lived the lonely existence of a pioneer’s wife, and had raised a family under conditions of shocking ill-health. She had suffered from sciatica and acute rheumatism; from a chronic intestinal trouble which the doctors called “intermittent peritonitis”; from intense nervous weakness, melancholy, and chronic catarrh, causing deafness. […] And this woman, when she took the ride, had not eaten a particle of food for four days previously! […] That was the clue to her escape: she had cured herself by a fast. She had abstained from food for eight days, and all her troubles had fallen from her. Afterwards she had taken her eldest son, a senior at Stanford, and another friend of his, and fasted twelve days with them, and cured them of nervous dyspepsia. And then she had taken a woman friend, the wife of a Stanford professor, and cured her of rheumatism by a week’s fast. I had heard of the fasting cure, but this was the first time I had met with it. […] After another spell of hard work I found myself unable to digest corn-meal mush and milk; and so I was ready for a fast. (source)
Next, the author describes how he implemented his first fasting streak and how it helped him resolve his limitations of certain types of foods:
I had not taken what is called a “complete” fast—that is, I had not waited until hunger returned. Therefore I began again. I intended only a short fast, but I found that hunger ceased again, and, much to my surprise, I had none of the former weakness. I took a cold bath and a vigorous rub twice a day; I walked four miles every morning, and did light gymnasium work, and with nothing save a slight tendency to chilliness to let me know that I was fasting. I lost nine pounds in eight days, and then went for a week longer on oranges and figs, and made up most of the weight on these.
I shall always remember with amusement the anxious caution with which I now began to taste the various foods which before had caused me trouble. Bananas, acid fruits, peanut butter—I tried them one by one, and then in combination, and so realized with a thrill of exultation that every trace of my old trouble was gone. (source)
Let’s dive into some of the benefits of fasting and learn a couple of more insights into its working. Don’t forget that this was already figured out more than one hundred years ago!
The fast is to me the key to eternal youth, the secret of perfect and permanent health. I would not take anything in all the world for my knowledge of it. It is Nature’s safety-valve, an automatic protection against disease. I do not venture to assert that I am proof against virulent diseases, such as smallpox or typhoid. I know one ardent physical culturist, a physician, who takes typhoid germs at intervals in order to prove his immunity, but I should not care to go that far; it is enough for me to know that I am proof against all the common infections which plague us, and against all the “chronic” troubles. And I shall continue so just as long as I stand by my present resolve, which is to fast at the slightest hint of any symptom of ill-being—a cold or a headache, a feeling of depression, or a coated tongue, or a scratch on the finger which does not heal quickly.
Those who have made a study of the fast explain its miracles in the following way: Superfluous nutriment is taken into the system and ferments, and the body is filled with a greater quantity of poisonous matter than the organs of elimination can handle. The result is the clogging of these organs and of the blood-vessels—such is the meaning of headaches and rheumatism, arteriosclerosis, paralysis, apoplexy, Bright’s disease, cirrhosis, etc. And by impairing the blood and lowering the vitality, this same condition prepares the system for infection—for “colds,” or pneumonia, or tuberculosis, or any of the fevers. As soon as the fast begins, and the first hunger has been withstood, the secretions cease, and the whole assimilative system, which takes so much of the energies of the body, goes out of business. The body then begins a sort of house-cleaning, which must be helped by an enema and a bath daily, and, above all, by copious water-drinking. The tongue becomes coated, the breath and the perspiration offensive; and this continues until the diseased matter has been entirely cast out, when the tongue clears and hunger reasserts itself in unmistakable form.
Fasting and Weight
Now, you may ask: Can fasting help you lose weight?
Strange as it may seem, the fast is a cure for both emaciation and obesity. After a complete fast the body will come to its ideal weight. People who are very stout will not regain their weight; while people who are under weight may gain a pound or more a day for a month.
So fasting will help you reach your ideal weight, according to the author.
Next, he goes on with some more anecdotal material on how fasting has helped his wife and friends and thousands of readers who wrote in—the author became quite a celebrity on the subject of health and fasting. Fascinating!
While I skipped most of the anecdotes, I believe this excerpt from the book summarizes his enthusiasm quite well:
The reader may think that my enthusiasm over the fasting cure is due to my imaginative temperament; I can only say that I have never yet met a person who has given the fast a fair trial who does not describe his experience in the same way. I have never heard of any harm resulting from it, save only in cases of tuberculosis, in which I have been told by one physician that people have lost weight and not regained it.
I regard the fast as Nature’s own remedy for all other diseases. It is the only remedy which is based upon an understanding of the fundamental nature of disease. And I believe that when the glad tidings of its miracles have reached the people it will lead to the throwing of 90 per cent of our present materia medica into the waste-basket. This may be unwelcome to those physicians who are more concerned with their own income than they are with the health of their patients; but I personally have never met any such physicians, and so I most earnestly urge it upon medical men to investigate the extraordinary and almost incredible facts about the fasting cure.
Next, he goes over several anecdotes where readers of the author’s articles sent in some of their own positive experiences with fasting and how it helped them solve their health issues.
Even other medical doctors wrote in sharing their own supportive evidence of the benefits of fasting as observed in their own medical practices.
Water and Milk
While I don’t want to discuss possibly outdated implementation tactics on fasting — such as drinking lots of milk while doing it — here’s one that you cannot argue with:
One should drink all the water he possibly can while fasting, only not taking too much at a time. I take a glass full every hour, at least; sometimes every half hour.
And speaking of the suggested milk diet, the author did have mixed evidence of its benefits:
Also I tried on many occasions to take the milk diet after a short fast of three or four days, and always the milk has disagreed with me and poisoned me.
I take it as evidence that the concrete implementation of the fasting diet must be well-researched and you should read the latest research on it.
Fasting and Disease
Anyways, most implementations of fasting seems to be beneficial for your body’s long-term and sustainable well-being.
People ask me in what diseases I recommend fasting. I recommend it for all diseases of which I have ever heard, with the exception of one in which I have heard of bad results—tuberculosis.
The latter not being an issue in many parts of the developed world anymore (fortunately).
The diseases for which fasting is mos obviously to be recommended are all those of the stomach and intestines, which any one can see are directly caused by the presence of fermenting and putrefying food in the system. Next come all those complaints which are caused by the poisons derived from these foods in the blood and the eliminative organs: such are headaches and rheumatism, liver and kidney troubles, and of course all skin diseases. Finally, there are the fevers and infectious diseases, which are caused by the invasion of the organism by foreign bacteria, which are enabled to secure a lodgment because of the weakened and impure condition of the blood-stream. Such are the “colds” and fevers. In these latter cases nature tries to save us, for there is immediately experienced a disinclination on the part of the sick person to take any sort of food; and there is no telling how many people have been hurried out of life in a few days or hours, because ignorant relatives, nurses and physicians have gathered at their bedside and implored them to eat.
To summarize, this is the author’s view on the question: when is the best time to start fasting?
The fast is Nature’s remedy for all diseases, and there are few exceptions to the rule. When you feel sick, fast. Do not wait until the next day, when you will feel stronger, nor till the next week, when you are going away into the country, but stop eating at once.
Fasting as a Wage Slave
Can you fast if you are a “wage slave”, i.e., you work as an employee for an hourly or monthly rate, and you cannot stop?
Many of the people who wrote to me were victims of our system of wage slavery, who wrote me that they were ill, but could not get even a few days’ release in which to fast. They wanted to know if they could fast and at the same time continue their work. Many can do this, especially if the work is of a clerical or routine sort. On my first fast I could not have done any work, because I was too weak. But on my second fast I could have done anything except very severe physical labor. I have one friend who fasted eight days for the first time, and who did all her own housework and put up several gallons of preserves on the last day. I have received letters from a couple of women who have fasted ten or twelve days, and have done all their own work. I know of one case of a young girl who fasted thirty-three days and worked all the time at a sanatorium, and on the twenty-fourth day she walked twenty miles.
Fasting Study on Small Data
Next, a very interesting “Symposium on fasting” presents the results of a questionnaire with 277 data points — not much in today’s age of research and big data.
So, I give only the quick list of diseases benefited from the fasting cure, according to the small study (take it with a grain of salt):
Following is the complete list of diseases benefited—45 of the cases having been diagnosed by physicians: indigestion (usually associated with nervousness), 27; rheumatism, 5; colds, 8; tuberculosis, 4; constipation, 14; poor circulation, 3; headaches, 5; anæmia, 3; scrofula, 1; bronchial trouble, 5; syphilis, 1; liver trouble, 5; general debility, 5; chills and fever, 1; blood poisoning, 1; ulcerated leg, 1; neurasthenia, 6; locomotor ataxia, 1; sciatica, 1; asthma, 2; excess of uric acid, 1; epilepsy, 1; pleurisy, 1; impaction of bowels, 1; eczema, 2; catarrh, 6; appendicitis, 3; valvular disease of heart, 1; insomnia, 1; gas poisoning, 1; grippe, 1; cancer, 1.
The Ideal Fasting Diet
But what is the ideal fasting diet? The author goes on to discuss this exact question.
The general rules are mostly of a negative sort. There are many kinds of foods, some of them most generally favored, of which one may say that they should never be used, and that those who use them can never be as well as they would be without them. Such foods are all that contain alcohol or vinegar; all that contain cane sugar; all that contain white flour in any one of its thousand alluring forms of bread, crackers, pie, cake, and puddings; and all foods that have been fried—by which I mean cooked with grease, whether that grease be lard, or butter, or eggs or milk. It is my conviction that one should bar these things at the outset, and admit of no exceptions. I do not mean to say that healthy men and women cannot eat such things and be well; but I say that they cannot be as well as they would be without them; and that every particle of such food they eat renders them more liable to all sorts of infection, and sows in their systems the seeds of the particular chronic disease that is to lay them low sooner or later.
A perfectly normal and well person is, under the artificial conditions of our bringing up, a very great rarity; and so we all have to regard ourselves as more or less diseased, and work towards the ideal of soundness. We must do this with intelligence—there is no short cut, no way to save one’s self the trouble of thinking.
Eating Fruits
Okay, and now here’s my own gold standard of a healthy diet: mainly fresh fruits.
That’s super cheap, and it just has to be super healthy:
By way of setting an ideal, let me give you the example of a young lady who for six or seven months has been living in our home, and giving us a chance to observe her dietetic habits. This young lady three years ago was an anæmic school-teacher, threatened with consumption, and a victim of continual colds and headaches; miserable and beaten, with an exopthalmic goitre which was slowly choking her to death. She fasted eight days, and achieved a perfect cure. She is to-day bright, alert and athletic; and she lives on about twelve hundred calories of food a day—one half what I eat, and less than a third of the old-school dietetic standards. Occasionally she will eat nut butter, or sweet potato, or some whole wheat crackers with butter, or a dish of ice-cream; but at least ninety per cent of her food has consisted of fresh fruit. Meal after meal, day after day, I have seen her eat one or two bananas and two or three peaches, or say, a slice of watermelon or canteloupe; at some meals she will eat only the peaches, and then again she will eat nothing. A dollar a week would pay for all her food; and on this diet she laughs and talks, reads and thinks, walks and swims with my wife and myself—a kind of external dietetic conscience, which we would find it hard to get along without. And tell me, Dr. Woods Hutchinson, or other scoffer at the “food-faddists,” don’t you think that a case like this gives us some right to ask for patient investigation of our claims? Or will you stand by your pill boxes and your carving-knives and the rest of your paraphernalia, and compel us to cure all your patients in spite of you?
Speaking of fruits, let’s see what the book tells us about meat:
Eating Meat
I am asked many questions as to my attitude toward the question of meat-eating. I was brought up on a diet of meat, bread and butter, potatoes, and sweet things. Four years ago when I found myself desperately run down, suffering from nervousness, insomnia, and almost incessant headaches, I came upon various articles written by vegetarians, and I began to suspect that my trouble might be due to meat. I went away on a camping-trip for several weeks, taking no meat with me, and because I found that I was a great deal better, I believed that the meat had been responsible for my trouble. I then visited the Battle Creek Sanitarium, and became familiar with all their arguments against meat, and thereafter I did not use it for three years. I called myself a vegetarian; but at the same time I realized that I differed from most vegetarians in some important particulars.
Well, nothing surprising here. Vegetarians were much more uncommon back in the old days. But now we know without a shadow of a doubt that vegatarians are healthier and live longer. It has been proven by many studies that a vegetarian diet is much healthier:
In most countries, vegetarian diets were associated with a lower intake of energy and saturated fat, and a better cardiovascular profile (lower body weight, LDL cholesterol levels, blood pressure, fasting glucose, and triglycerides) — Hargreaves et al. International Journal Environ Res Public Health
Here’s an interesting take from the book on contamination of meat:
There have been numerous expositions of the greater liability of meat to contamination. Dr. Kellogg, for instance, has purchased specimens of meat in the butcher-shops, and has had them examined under the microscope, and has told us how many hundreds of millions of bacteria to the gram have been discovered. This argument has a tendency to appal one; I know it had great effect upon me for a long time, and I took elaborate pains to take into my system only those kinds of food which were sterilized, or practically so. This is the health regimen which is advocated by Professor Metchnikoff; one should eat only foods which have been thoroughly boiled and sterilized. I have come, in the course of time, to the conclusion that this way of living is suicidal, and that there is no way of destroying one’s health more quickly. I think that the important question is, not how many bacteria there are in the food when you swallow it, but how many bacteria there come to be in food after it gets into your alimentary canal. The digestive juices are apparently able to take care of a very great number of germs; it is after the food has passed on down, and is lodged in the large intestine, that the real fermentation and putrefaction begin—and these count for more, in the question of health, than that which goes on in the butcher-shop or the refrigerator or the pantry
Is meat good for physical labor jobs?
I have been accustomed all my life to think of meat as a very “heavy” article of food, an article of food suited for men doing hard physical labor; it is a curious fact that the view I am setting forth here is precisely the opposite. So long as I am doing hard physical labor, whether it is walking ten miles a day, or playing tennis, or building a house, I get along perfectly upon the raw food; but when I settle down for long periods of thinking and writing—often sitting for six hours without moving from one position—I find that I need something else, and nothing has answered that purpose quite so well as beef-steak. It appears to be, so far as I am concerned, the most easily digested and most easily assimilated of foods. And because the work that I am doing seems to me to be important, I am willing to make the sacrifice of money and time and trouble which it necessitates. My diet at such times will consist of beef or chicken, shredded wheat biscuit, and a little fruit. If any one is disposed to follow my example and make this experiment, I beg to call his attention especially to the fact that I name these three kinds of food, and none others; and that I mean these three kinds and none others. The main trouble with advising anybody to eat meat is that he proceeds to eat it in the everyday world, where it means not the eating of broiled lean beef, but also of bacon and eggs, and of bread and butter, and of potatoes with cream gravy, and of rice pudding and crackers and cheese and coffee. Please do not proceed to eat these things and then hold meat-eating responsible for the consequences.
The book ends with a couple of articles and testimonials submitted by avid readers of the author. I think we can skip those safely because they are mostly anecdotical.
Fasting – Conclusion, Benefits, and How to Start
Let’s finish up this book summary about the fasting diet with the top benefits of fasting as reported by Healthline:
Promotes Blood Sugar Control by Reducing Insulin Resistance
Promotes Better Health by Fighting Inflammation
May Enhance Heart Health by Improving Blood Pressure, Triglycerides and Cholesterol Levels
May Boost Brain Function and Prevent Neurodegenerative Disorders
Aids Weight Loss by Limiting Calorie Intake and Boosting Metabolism
Increases Growth Hormone Secretion, Which Is Vital for Growth, Metabolism, Weight Loss and Muscle Strength
Could Delay Aging and Extend Longevity
May Aid in Cancer Prevention and Increase the Effectiveness of Chemotherapy
All of those are backed by science (see article referenced). The article also points out the most common ways to start fasting:
Water fasting: Drinking only water
Juice fasting: Drinking vegetable or or fruit juice
Intermittent fasting: Limit your fasting period to a number of hours daily (e.g., 16 hours non-eating per day)
Partial fasting: Eliminate certain foods such as processed foods or sugar or alcoholic beverages.
Calorie restriction: Just eat fewer calories for a fixed time.
I personally prefer intermittent fasting as it can be integrated easily into your daily life and still has many of the benefits.
Posted by: xSicKxBot - 11-05-2022, 04:19 AM - Forum: Lounge
- No Replies
Today's Wordle Answer (#503) - November 4, 2022
It’s Friday, and players should end the week right by getting the Wordle correct. If you're here, then you're probably struggling in some shape or fashion, and that's not something you want to do on a Friday. Fortunately, we're here to make sure that you end the work week with aplomb and get the Wordle correct. The answer heading into the weekend is a fairly tough word. While it's extremely common, players might struggle with it due to its spelling and vowel usage. If you haven't started the November 4 Wordle yet, though, you can check out our list of recommended starting words to give yourself an advantage before you've begun.
However, if you're a few guesses deep, then it might be time to seek some helpful advice. We have exactly that just below. We’ve come up with two hints that should help players come up with relevant guesses for today's puzzle on November 4. If those don’t work, though, we’ve spelled out the full answer further down in the guide if players simply want to head into the weekend with their streak still intact.
Today's Wordle Answer - November 4, 2022
We'll begin with two hints that directly relate to the Wordle answer, but won't immediately give the word away.
Introducing the ninth installment of the best-selling Party Pack Franchise you know and love! Whether you’re hanging out with friends, having a remote happy hour, trying to make the holidays less awkward, or looking for your next game to stream, The Jackbox Party Pack 9 is here to spice things up.
About Each Game
Fibbage 4 (2-8 players) - The hilarious bluffing party game returns with an all new Final Fibbage, video questions, fan-submitted questions, and Fibbage Enough About You mode! It’s a game so beloved that we decided to slap a 4 on it.
Quixort (1-10 players) - In this trivia sorting factory, work with your team to sort falling answers into their proper order before they hit the floor! Or, play the single player mode and see how many blocks you can sort before topping out. It’s as easy as A, C, B!
Junktopia (3-8 players) - A strange wizard has turned you into a frog! Create hilarious backstories for weird objects and then get them appraised. The player with the most valuable items becomes human again!
Nonsensory (3-8 players) - Professor Nanners is here to test your NSP (Nonsensory Perception) in this drawing, writing, and guessing game! How close can you get to guessing where another player’s prompt ranks on the silliest of scales?
Roomerang (4-9 players) - Channel your inner reality TV star in an attempt to come out on top! Respond to prompts, bring the competition and role-play to avoid being voted out. Never fear though, even when you’re out you’ll find yourself Roomerang-ed right back into the drama!
Posted by: xSicKxBot - 11-04-2022, 10:00 AM - Forum: Python
- No Replies
How to Strip One Set of Double Quotes from Strings in Python
5/5 – (1 vote)
Problem Formulation and Solution Overview
When working with data, you may encounter a string or list of strings containing two (2) double quotes. This article shows you how to remove one set of these double quotes.
Question: How would we write code to remove the extra set of double quotes?
We can accomplish this task by one of the following options:
This method uses startswith() and endswith() in conjunction with slicing to remove one set of double quotes from a string.
web_name = '""The Finxter Acadcemy""' if web_name.startswith('"') and web_name.endswith('"'): web_name = web_name[1:-1]
print(web_name)
The first line in the above code snippet declares a string containing two (2) sets of double quotes and saves this to the variable web_name.
The following line calls the if statement with the startswith() and endswith() functions. Both functions are passed the argument ('"').
This statement checks to see if web_name starts with and ends with the above argument. If true, the code moves to the next line and, using slicing, removes the specified character.
The results are output to the terminal.
"The Finxter Acadcemy"
Method 2: Use Regex
You can use the regex method re.sub() to remove one set of double quotes from a string.
import re msg = '""Boost Your Python Skills""'
msg = re.sub(r'^"|"$', '', msg)
print(msg )
The first line in the above code snippet imports the re library. This allows access to and manipulation of strings to extract the desired result.
The following line declares a string containing two (2) sets of double quotes and saves this to the variable msg.
The next line uses re.sub() to search this string for any occurrences of double quotes, removes the same and saves the result back to msg. This overwrites the original string.
The results are output to the terminal.
"Boost Your Python Skills"
Another option is to use re.sub() and pass this function two (2) arguments:
The above example imports the Pandas library. This library allows access to and manipulation of a Pandas DataFrame.
The following line reads in the CSV file, without the header row into the DataFrame, df.
If output to the terminal, the DataFrame appears as follows:
0
1
2
3
0
Shop
Category
Product
Number
1
Toronto””
Jeans””
10534″”
15″”
2
Montreal””
Tops””
5415″”
32″”
3
Ottawa””
Coats””
98341″”
22″”
Note: By default, when the CSV file was imported, the beginning double quotes were removed, thus leaving the trailing double quotes.
Next, all occurrences of trailing quotes are replaced (removed) from the DataFrame.
The output of the modified DataFrame, df are output to the terminal.
0
1
2
3
0
Shop
Category
Product
Number
1
Toronto
Jeans
10534
15
2
Montreal
Tops
5415
32
3
Ottawa
Coats
98341
22
Summary
This article has provided five (5) ways to remove one set of double quotes from a string and all double quotes to select the best fit for your coding requirements.
Good Luck & Happy Coding!
Programmer Humor – Blockchain
“Blockchains are like grappling hooks, in that it’s extremely cool when you encounter a problem for which they’re the right solution, but it happens way too rarely in real life.”source – xkcd
We are welcoming everyone to join our discord[discord.gg]. We are more active there on finding giveaways, small or large, and there are daily raffles you can participate.
Posted by: xSicKxBot - 11-04-2022, 10:00 AM - Forum: Lounge
- No Replies
Review Roundup For God Of War Ragnarok
God of War Ragnarok is easily one of the biggest game releases of the year, and ahead of its arrival on store shelves next week, reviews have gone live for the PlayStation exclusive. Unsurprisingly, God of War Ragnarok is being hailed as a blockbuster hit to end the year with, an action-packed experience that deftly weaves satisfying combat with plenty of charm and heart.
"Sony Santa Monica brings back what made the original God of War reboot great and delivers another fantastic story with exceptional writing," Tamoor Hussain wrote in GameSpot's God of War Ragnarok review. "In a game where a hulking god rips all manner of creatures limb from limb, the most shocking moments aren't bathed in blood, but carried by poignant words and heartfelt emotions."
Are You Ready To Seek Your Fortune? Seek your fortune and leave your mark on the map in the UNCHARTED: Legacy of Thieves Collection. Uncover the thrilling cinematic storytelling and the largest blockbuster action set pieces in the UNCHARTED franchise, packed with all the wit, cunning, and over the top moments of the beloved thieves – Nathan Drake and Chloe Frazer. In an experience delivered by award winning developer Naughty Dog can, the UNCHARTED: Legacy of Thieves Collection includes the two critically-acclaimed, globe-trotting single player adventures from UNCHARTED™ 4: A Thief’s End and UNCHARTED™: The Lost Legacy. Each story is filled with laughs, drama, high octane combat, and a sense of wonder – remastered to be even more immersive.
This article focuses on working with a JSON file. JSON is an acronym for JavaScript Object Notation. This is a flat-text file formatted based on JavaScript (JS) Syntax.
This file is most commonly noted for its ability to transmit data to/from web applications, such as sending/receiving data from a Server/Client to display or retrieve said data.
The JSON file structure has keys and values similar to a Python Dictionary.
This structure can contain strings, boolean, integers, floats, lists, and much more. This file structure can be as simple or complex as needed.
This article works with Rivers Clothing, a new start-up. They have hired their first three (3) employees. This employee data is displayed as a List of Dictionaries.
This example creates an empty JSON file if one does not exist in the current working directory.
import os filename = 'employees.json'
isFile = os.path.isfile(filename) if (not isFile): with open(filename, 'w') as fp: pass
else: print(f'The {filename} file exists.')
The first line in the above code snippet imports Python’s built-in os library. This allows access to and manipulation of files and folders.
The following line declares the JSON file name, employees.json and saves it to the variable filename.
The next line calls the os.path.isfile() function and passes it one (1) argument, filename. This function checks the current directory for the existence of the employees.json file
The first time this code runs, and this file is not found (isFile is False), an empty file is created and placed into the current working directory.
Note: The pass statement is a placeholder code and does nothing when executed. This is used here so a file is created, and nothing else occurs.
If this code is rerun or the file exists, the following message is output to the terminal.
The employees.json file exists.
To create this file in a sub-folder, you would modify the code as follows:
import os filename = 'files\\employees.json'
isFile = os.path.isfile(filename) if (not isFile): with open(filename, 'w') as fp: pass
else: print(f'The {filename} file exists.')
When this code runs, the files folder is checked for the existence of the employees.json file.
Python Create JSON String from List of Dictionaries
The above code snippet imports the json library. This library allows access to JSON functions.
The following three (3) lines construct a List of Dictionaries containing data for the new hires. The results save to emps.
Next, json.dumps()is called and passed two (2) arguments: a List of Dictionaries, emps, and for formatting, spaces to indent. The results save to json_str and output to the terminal.
In this example, the JSON file saved earlier is read back in.
import os
import json filename = 'employees.json'
json_str = '' with open(filename , 'r') as fp: for l in fp: l.replace('\n', '') json_str += l print(json_str)
This code snippet opens, reads the employees.json file and saves it to json_str. Upon each iteration, any additional newline (\n) characters are removed using the replace()function.
Once all lines have been read, the contents of json_str is output to the terminal and is the same as indicated above.
Python Access JSON Elements
This example reads in the previously saved JSON file and accesses the ID element from each hire.
import os
import json filename = 'employees.json'
json_str = '' with open(filename , 'r') as fp: for l in fp: l.replace('\n', '') json_str += l all_emps = json.loads(json_str)
alexa_id = all_emps['hires'][0]['ID']
sam_id = all_emps['hires'][2]['ID']
print(alexa_id, sam_id)
As outlined earlier in this article, the employees.json file is read in, parsed and saved to json_str.
Then, json_str is loaded using json_loads() and passed one (1) argument, the json_str created above. This gives us access to the elements.
The following lines access the Employee IDs for Alexa and Micah and outputs same to the terminal.
3243 3245
To iterate and display the ID and name for each new hire, run the following code:
import os
import json filename = 'employees.json'
json_str = '' with open(filename , 'r') as fp: for l in fp: l.replace('\n', '') json_str += l all_emps = json.loads(json_str) for item in all_emps['hires']: print(item['ID'], item['name'])
results = [item['ID'] for item in all_emps['hires']]
print(results)
Python Delete Elements
This example reads in the previously saved JSON file and deletes the new hire, Micah Jones.
import os
import json filename = 'employees.json'
json_str = '' with open(filename , 'r') as fp: for l in fp: l.replace('\n', '') json_str += l all_emps = json.loads(json_str)
idx = 0 for item in all_emps['hires']: if idx == 1: del all_emps['hires'][idx] idx += 1
print(all_emps)
Summary
We hope you enjoyed this article about converting a List of Dictionaries to JSON and everything in between!
Good Luck & Happy Coding!
Programmer Humor – Blockchain
“Blockchains are like grappling hooks, in that it’s extremely cool when you encounter a problem for which they’re the right solution, but it happens way too rarely in real life.”source – xkcd
There are many ways to read a CSV file to an array. Online hosted tools provide interfaces to do this. Also, it is very easy to create a custom user interface for the purpose of reading CSV to the array.
In PHP, it has more than one native function to read CSV data.
fgetcsv() – It reads the CSV file pointer and reads the line in particular to the file handle.
str_getcsv() -It reads the input CSV string into an array.
This article provides alternate ways of reading a CSV file to a PHP array. Also, it shows how to prepare HTML from the array data of the input CSV.
Quick example
This example reads an input CSV file using the PHP fgetcsv() function. This function needs the file point to refer to the line to read the CSV row columns.
<?php // PHP function to read CSV to array
function csvToArray($csv)
{ // create file handle to read CSV file $csvToRead = fopen($csv, 'r'); // read CSV file using comma as delimiter while (! feof($csvToRead)) { $csvArray[] = fgetcsv($csvToRead, 1000, ','); } fclose($csvToRead); return $csvArray;
} // CSV file to read into an Array
$csvFile = 'csv-to-read.csv';
$csvArray = csvToArray($csvFile); echo '<pre>';
print_r($csvArray);
echo '</pre>';
?>
This program sets the CSV file stream reference and other parameters to read the records in a loop.
The loop iteration pushes the line data into an array. The PHP array push happens using one of the methods we have seen in the linked article.
Save the below comma-separated values to a csv-to-array.csv file. It has to be created as an input of the above program.
Map str_getcsv() to read CSV and convert it into a PHP array
This program will be suitable if you want to skip the step of writing a loop. It saves the developer’s effort. But the background processing will be the same as the above program.
The PHP file() converts the entire CSV into an array. Then, the array_map sets the str_getcsv() function as a callback to iterate the array of CSV file rows.
The resultant $csvArray variable will contain the complete CSV data in a multi-dimensional array.
The output of this program will be similar to that of the quick example.
<?php
// a one-line simple option to reade CSV to array
// it uses PHP str_getcsv
$csvArray = array_map('str_getcsv', file('csv-to-read.csv'));
echo '<pre>';
print_r($csvArray);
echo '</pre>';
?>
Convert CSV to Array and then convert array to HTML
This example will be useful if you want to display the CSV content in the UI in a tabular form.
Mostly, this code must be more useful since it has the possibility of using it in real-time projects. But, the other examples are basics which are also important to learn about reading CSV using PHP.
This code iterates the CSV row and reads the column data using fgetcsv() as did in the quick example.
Then, it forms the HTML table structure using the CSV array data. In a previous tutorial, we saw code to convert an HTML table into an excel.
<?php // PHP script to read CSV and convert to HTML table // create file handle to read CSV file
$csvFile = fopen('csv-to-read.csv', 'r'); if ($csvFile !== FALSE) { echo "<table border=1 cellpadding=10>"; while (($csvArray = fgetcsv($csvFile, 100, ',')) !== FALSE) { echo "<tr>"; for ($i = 0; $i < count($csvArray); $i ++) { echo "<td>" . $csvArray[$i] . "</td>"; } echo "</tr>"; } echo "</table>"; fclose($csvFile);
}
?>
Output:
This program will display the HTML table on the screen. The row data is from the input CSV file.