word break a long sentence by word - css

"Subject to 10% service charge per room per night. Any cancellation or
amendments can be made 2 days prior to arrival. Otherwise, one nights’
room rate will be levied. The first night guarantee is required at
time of reservation and one night room rental will be charged to the
credit card provided in the event of no show, late cancellation or
amendment. If any dispute arises, Hotel Rainbow Hong Kong reserves the
final decision."
i use the css properties "word-break:break-all", but it did not do well.
there are still some word being break up.

** You need 'word-wrap' property **
Use this one
word-wrap:break-word;

Visit http://www.w3schools.com/cssref/css3_pr_word-break.asp
p{word-break:break-all;}

Related

How to remove from a string questions asked with a clear pattern in R?

Let's assume I have a text like the following one:
x = "\n\n\n\n\n\nTranscript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB\n\n\n\nQuestion: Dr. Duisenberg, on structural reform, when you talk to economists about the euro's exchange rate weakness with the dollar, some of them don't point to anything to do with the currency per se but talk about the lack of structural reform, particularly in labour markets and particularly in Germany, for a factor which keeps the exchange rate down long term. What is your opinion on the matter and your opinion on the state of structural reforms, the amount of progress, or the lack thereof?\nDuisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him.\nQuestion: Mr. President, you have said many times, and also very recently, that you are expecting an appreciation of the euro. Would you say that the changeover, or yesterday, is a turning-point for the currency?\nDuisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see. \nQuestion: Mr. Duisenberg, you have told us several times already that whenever there was an intervention by the ECB in the currency market, you would tell us. So, could you tell us something today on this issue?\nDuisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either.\nQuestion: A question to you, Mr. President, and to the Vice-President also if he maybe has something to add to the question. Do you expect a wider use of the euro as a reserve currency of central banks outside the euro zone as a denomination for bonds, especially corporate ones, or do you think it is possible that all will be paid in euro instead of dollars one day and, if so, when?\nDuisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the \"when\", precisely if I assume he knows as much as I do."
As you can see, questions are asked with a clear pattern: \nQuestion: .....?\n. I would like to remove every question asked from the text. I have been playing with gsub but not very successfully so far. The outcome would be:
x = "\n\n\n\n\n\nTranscript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB\n\n\nDuisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him.Duisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see. Duisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either.Duisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the \"when\", precisely if I assume he knows as much as I do."
Can anyone help me with this?
Thanks!
You can do
gsub('\nQuestion:.*?\\?', '', x)
resulting in
cat(gsub('\nQuestion:.*?\\?', '', x))
Transcript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB
Duisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him.
Duisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see.
Duisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either.
Duisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the "when", precisely if I assume he knows as much as I do
Another option using rm_between from qdapRegex:
x = "\n\n\n\n\n\nTranscript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB\n\n\n\nQuestion: Dr. Duisenberg, on structural reform, when you talk to economists about the euro's exchange rate weakness with the dollar, some of them don't point to anything to do with the currency per se but talk about the lack of structural reform, particularly in labour markets and particularly in Germany, for a factor which keeps the exchange rate down long term. What is your opinion on the matter and your opinion on the state of structural reforms, the amount of progress, or the lack thereof?\nDuisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him.\nQuestion: Mr. President, you have said many times, and also very recently, that you are expecting an appreciation of the euro. Would you say that the changeover, or yesterday, is a turning-point for the currency?\nDuisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see. \nQuestion: Mr. Duisenberg, you have told us several times already that whenever there was an intervention by the ECB in the currency market, you would tell us. So, could you tell us something today on this issue?\nDuisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either.\nQuestion: A question to you, Mr. President, and to the Vice-President also if he maybe has something to add to the question. Do you expect a wider use of the euro as a reserve currency of central banks outside the euro zone as a denomination for bonds, especially corporate ones, or do you think it is possible that all will be paid in euro instead of dollars one day and, if so, when?\nDuisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the \"when\", precisely if I assume he knows as much as I do."
x
#> [1] "\n\n\n\n\n\nTranscript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB\n\n\n\nQuestion: Dr. Duisenberg, on structural reform, when you talk to economists about the euro's exchange rate weakness with the dollar, some of them don't point to anything to do with the currency per se but talk about the lack of structural reform, particularly in labour markets and particularly in Germany, for a factor which keeps the exchange rate down long term. What is your opinion on the matter and your opinion on the state of structural reforms, the amount of progress, or the lack thereof?\nDuisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him.\nQuestion: Mr. President, you have said many times, and also very recently, that you are expecting an appreciation of the euro. Would you say that the changeover, or yesterday, is a turning-point for the currency?\nDuisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see. \nQuestion: Mr. Duisenberg, you have told us several times already that whenever there was an intervention by the ECB in the currency market, you would tell us. So, could you tell us something today on this issue?\nDuisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either.\nQuestion: A question to you, Mr. President, and to the Vice-President also if he maybe has something to add to the question. Do you expect a wider use of the euro as a reserve currency of central banks outside the euro zone as a denomination for bonds, especially corporate ones, or do you think it is possible that all will be paid in euro instead of dollars one day and, if so, when?\nDuisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the \"when\", precisely if I assume he knows as much as I do."
library(qdapRegex)
rm_between(x, "\nQuestion:", "?\n", extract = F)
#> [1] "Transcript of the questions asked and the answers given by Dr. Willem F. Duisenberg, President of the ECB and Christian Noyer, Vice-President of the ECB Duisenberg. There has been some progress with structural reform. It is certainly not the case that nothing has been done in the past couple of years, but it is certainly not enough. And it has to be continued with force, we hope, and that is also everything that the governments are working towards, especially the Spanish presidency, ahead of the European summit in Barcelona this year. As far as the causes are concerned, the analysis you just gave was recently also given by Mr. Greenspan, who also ascribed the lack of movement in the exchange rate to the far lower degree of flexibility in the economy of Europe as compared with the United States and, as usual, I happen to agree with him. Duisenberg. I will not speculate further. I am here to fight speculation rather than to add to it. But certainly the movement of the past couple of days was, well, to say the least, gratifying to see. Duisenberg. I have also learnt never to talk again about intervention until after the event. So I won't do that today either. Duisenberg. The last parts of the question will undoubtedly be answered by Mr. Noyer. The use of the euro as an international reserve currency is increasing, but very slowly. And it was expected to be very slow, but increasingly we are getting signals that countries, especially central banks of countries, are beginning to realise the possibilities they now have to diversify their reserve holdings. But it is not something we are aiming for, we will just let it happen. But it is happening, and the fact that, for example, in the recent experiences of the cash changeover, we have frontloaded to more than 20 non-euro area central banks sizeable sums, billions and billions worth of euro banknotes, is already an indication of this. The fact also that in the eastern hemisphere, where we are, more than 50 countries, in one way or the other, link their currency or align their currency to the euro is also a telling aspect of the phenomenon. But I don't want to ask Mr. Noyer to speculate about the \"when\", precisely if I assume he knows as much as I do."
Created on 2022-08-26 with reprex v2.0.2

Raft: Will term increasing all the time if partitioned?

Will the partitioned server increase term all the time?
If so, I get another confusion.
Chapter 3.6 (safety) in raft paper says:
Raft determines which of two logs is more up-to-date by comparing the index and term of the last entries in the logs.If the logs have last entries with different terms, then the log with the later term is more up-to-date. If the logs end with the same term, then whichever log is longer is more
up-to-date.
It got me thinking about a scenario when one server from a partitioned network win the election because of the huge term, then causing the unconsistency. Will that happens?
Edit part:
When a node with larger term rejoins the cluster, that will force the current leader to step down. When a leader sends request to a follower and the follower has larger term; the follower rejects the request and the leader sees larger term; that forces the leader to step down and new election will happen.
Some raft implementations have an extra step before a follower becomes candidate - if a follower does not hear from the leader, the follower tries to connect other followers; and if there is a quorum, then the follower becomes a candidate.
(I read your link), and yes, an implementation may keep increasing the term; or be more practical and wait till majority is reachable - there is no point to initiate an election if no majority is available.
I decided to comment because of this line in your question "win the election because of the huge term". Long time ago, when I read raft paper (https://raft.github.io/raft.pdf), I was quite confused by the election process.
Section 5.2 talks about leader election; and it has these words "Each server will vote for at most one candidate in a
given term, on a first-come-first-served basis (note: Section 5.4 adds an additional restriction on votes)."
Section 5.4 "The previous sections described how Raft elects leaders and replicates log entries. However, the mechanisms
described so far are not quite sufficient to ensure that each
state machine executes exactly the same commands in the
same order..."
Basically if a reader reads the paper section by section, and stops to think after each of them, then the reader will be a bit confused. At least I was :)
As a general conclusion: new term absolute value does not make any difference. It is used to reject older terms. But for actual leader election (and new term being started) it's the state of the log what actually matters.

Optaplanner: Dynamic number of planning variable based on ProblemFactCollectionProperty

Problem: Truck assignment with limited quantity to deliver to the customers.
The truck has to be assigned to the customer. As the truck has limited quantity, the truck needs to return back to reload again to deliver to the next customer.
Trip - load at Depot, unload at customer/few customers, come back to depot.
The problem facts are available trucks and customers to be delivered. We need to find dynamically how many trips can be possible from truck-based on few timing-related conditions(like truck available time, driver hours, etc).
The solution I can think off:
Pre-compute max number of trips by the truck based on business understanding- use this as a planning variable. Provide hard score for violating time constraints, so few trips will be left unassigned if truck exceeds the available truck/trip time.
Need Help:
For every solved example, we have a fixed number of planning variables before planning. Even In the chained planning variable(Like TSP,VRP), we have the fixed number of trucks beforehand.
Any help is appreciated. If there is no direct solution, is the approach I have come up is the best possible?
That solution is indeed recommended currently:
Provide enough trucks in the anchorValueRange to make sure a feasible solution can be found. Defining that number can be tricky: typically double the average usage. For example, if you have 300 visits and do on average 100 visits per truck, give it 6 trucks, as you never expect it to use more than 6 trucks (and probably a lot less). If trucks have skills or affinity, this becomes a bunch more complex.
Add an extra score level: if you're on HardSoftScore, switch to HardMediumSoftScore.
Add a medium constraint to penalize the number of trucks used. This is softer than the hard constraints (capacity etc) and harder than the soft constraints (distance etc).
(The alternative, adding/removing values to the value ranges on the fly, is only theoretically possible in OptaPlanner's architecture at the moment (don't use addProblemFactChanges for this!). It might sound like the perfect solution, but there are many subsystems that profit from a fixed value range, so that approach would have severe trade-offs.)

prevent WorkoutSession to update Activity ring

I'm developing an apple watch application (WatchOs4). I'm interested to monitor heart rate, so I'm using a WorkoutSession to get continuous data updates. The problem is : when I start a workout session, it will automatically update the exercise ring of the Activity Rings on the watch. As it's not a sport app, I would like to prevent that.
Does anyone have a solution for that ?
I just discovered that if you pause the workout session heart rate is still collected, but calories and exercise minutes are not.
session.startActivity(with: Date())
session.pause()
builder.beginCollection(withStart: Date()) { (success, error) in
guard success else {
// Handle this
return
}
}
It's really that easy. Months of trying to figure this out and the internet didn't have an answer.
Note that the Health App will still technically shows calories being collected, but it seems to only be about 15-20 per hour which doesn't seem to be more than usual for just wearing the watch normally.
Please check https://developer.apple.com/documentation/healthkit/hkworkoutsession
Filling the Rings section.
Set your workout in one of the following activities run, walk, cycle, stair climbing, elliptical, and rowing activities which provide customized calorie calculations. So if you didn't move, nothing will be contributed to the ring.
FYI I only tried indoor walking.

Long Range RFiD Reading

I'm trying to set up a practical DIY method of unlocking a garage or front door by coming into the range of a reader; even if that means standing in a specific line of sight. Essentially once I reach the garage, the ID is read and raises
I'd prefer to have passive ID's, but the reader itself would be able to have a fixed power source that doesn't need to be changed.
I've done a lot of searching on google and there are RFiD scanners that read cars to open tolls booths, but those are commercial grade products and much more expensive than anything I'm trying to make. Should I continue looking into RFiD's, or is there a more efficient method of approaching this?
Also, if my tags are active, and powerful enough, would that compensate for a low frequency reader?
You'll easily achieve to read passive tags from a distance of a few meters (up to 10m) by using any industrial UHF RFID reader (Impinj, ThingMagic, Stid, ...).
Some tags are similar to labels that can be directly stuck on the windscreen of the cars. Tags are rather inexpensive.
But in that case you will need to spend a few hundreds of dollars to buy a single reader with its antenna.
That is what makes me think that any RFID based system is an option only when the number of users of the system is quite important (i.e: check the access to a company park or to a residence).
In that case, the investment of the reader is dispatched on all the users, whereas the global investment for the tags stay low.

Resources