Can I whitelist a RuboCop Rails/DynamicFindBy method on a per-file basis

Question: RuboCop's Rails/DynamicFindBy cop gives false positives when it encounters Capybara's (as opposed to Rail's) find_by_id method.
There's apparently a way to whitelist methods so that they are ignored by this cop. See http://rubocop.readthedocs.io/en/latest/cops_rails/#railsdynamicfindby (mentioning Whitelist attribute).
I would like to whitelist find_by_id, but only for certain files (the ones with Capybara tests) in my tests/integration directory.  Is this possible?
(I am aware that I can turn off the entire cop on a file by file basis, but I don't want to turn off the cop entirely. I am also aware that I can turn off the cop for portions of a file, or on a line-by-line basis, but those are not preferred solutions.)
Answer: There is no way to do this on a file-by-file basis. Closest you can get is having a particular configuration on a directory level, by putting another .rubocop.yml configuration file inside.
It might look like this is a solution at first:
# .rubocop.yml
Rails/DynamicFindBy:
  Include:
    - tests/integrations/first_test.rb
    - tests/integrations/second_test.rb
  Whitelist:
    - find_by_id

But Include means "included for inspection", not "included for configuration", so this actually excludes all other project files from being inspected by the cop entirely. (Which you wouldn't notice if there were no offences in the other files to begin with.)
That leaves two options:

Whitelist #find_by_id for all files in /integrations, using another configuration file.
Use inline disables and -enables.

The former would probably be the recommended one, unless there's a strong reason for why #find_by_id should not be allowed in the other integration tests.
Comment: Maybe a way to fine-tune this is to move all the capybara test files to a separate directory, and whitelist `find_by_id` only for that directory. My concern: I'd like -- as much as reasonably possible -- to continue blacklisting **ActiveRecord's** `find_by_id` dynamic method.
Comment: Can you please provide more context about how someone would "whitelist #find_by_id for all files in /integrations, using another configuration file"?
Answer: You should be able to set this in your rubocop config file like
# In .rubocop.yml
Rails/DynamicFindBy:
  Include:
    - tests/integrations/**/*.rb
  Whitelist:
    - find_by_id
    - find_by_something_else

Or you could add a new .rubocop.yml file to the directory that contains the files in which you want the methods whitelisted and inherit from the overall config - see https://github.com/bbatsov/rubocop/blob/master/manual/configuration.md#inheritance
Answer: That answer is almost it, and can be easily modified to do exactly what I want. The answer isn't perfect, because it's directory-by-directory, rather than file-by-file.  So the only change is to list specific files in the Include:
# In .rubocop.yml
Rails/DynamicFindBy:
  Include:
    - tests/integrations/first_test.rb
    - tests/integrations/second_test.rb
  Whitelist:
    - find_by_id
   - find_by_something_else

Answer: You can exclude specs in rubocop.yml:
Rails/DynamicFindBy:
  Exclude:
    - "spec/system/**/*"


I think a pro is/are the sights

Question: The context is talking about the pros and cons of a certain city. I'm not sure if the verb 'to be' should agree with the subject here or with the predicate, although I would say 'is'.
Comment: Verbs always agree with their subjects, not their complements.
Comment: For pros and cons, you have to say here: I think one of the pros is the sights.
Answer: "Is" The verb should agree with the subject when it has a clear number.
But the sentence is badly phrased.  It can easily be improved by just swapping it around

I think the sights are a pro.

But I don't like the use of "pro" here, and "sights" is a weak and generic word.

The view from the top of the castle is one of the best things about the city.

There is a much better sentence.  It doesn't have the weak sense of "the sights", it is much more specific to this city. It doesn't have "pro" and there is no problem choosing "is/are". I've removed the "I think"; it is not required and removing it makes the sentence stronger. You can swap it around

One of the best things about the city is the view from the top of the castle.
Comment: Thanks so much for the detailed answer. I agree with all the stylistic changes you have made. I'm grading an essay and I didn't want to completely change what the student had written. (they used 'are')

I think a pro is/are the sights


Why timeout in TCP is not a predefined fixed value?

Question: Why timeout in TCP is not a predefined fixed value? I know there is a set value of 15 for a timeout value but I was asked why timeout in TCP is not a predefined fixed value which I couldn't find an explantion for.
Answer: the main reason for RTO to be variable is to avoid congestion collapse.
if the timer is set to a too shorter value, there is a danger that the sender starts retransmitting packets, that are still being in-flight, thus overloading the network with unnecessary packets (that may end up delivered twice). The Jackobson algorithm for calculating RTO is intended to achieve this.
unless you set an RTO to unreasonably high value, there is a danger of this happening. and if your RTO is unreasonably high, any flow that had lost a packet, especially at the end of the stream, where there are not enough ACKs for dupacks to trigger, might take forever to complete.
Also, Internet is extremely diverse. As of now, typical RTTs between network paths can vary by an order of magnitude. data center networks have extremely low (<<ms), normal paths in countries with good internet (~10ms), bad internet(~50-60ms), and satellite networks (i think about 200ms). It will be very hard to have a reasonable fixed value to accomodate all of then.
Comment: The absolute worst-case scenario is Internet access via TV satellites. Those are in a 36000km geostationary orbit, which means that even if it is directly overhead, the pure light speed latency without any routing or processing is already 120ms *one way*. Also, don't forget jitter. I worked a job once where we he had a redundant link between UK and Germany, with one side of the link having an RTT between 10ms–15ms and the other side 50ms–70ms(!!!). And that was a dedicated line, not the public Internet.
Comment: Did you mean one-way delay of 10-15 and 50-70 respectively, or did it have different round-trip times depending on which end the sender was?
Comment: I mean the two links of the redundant pair. It was two "fibers" by two different telcos. (The behavior made it clear that they were, in fact, obviously not fibers but some sort of tunnel, but the whole organization was a mess and I never managed to find out what exactly it was. Even the people who hired me and leased those fibers couldn't tell me what they actually leased, other than "10 Gbit". I told them if they want to build a low-latency real-time link, the next time they should probably specify an SLA with at least latency, jitter, and loss, …)
Comment: Sorry, I can't read.... :(
Answer: If I am running a high performance local area TCP network then I would want the timeout value to be low. On the other hand, if I am sending messages to
a low performance, over loaded TCP server I would want the timeout value to be  long because the server might not be able to get to my traffic right away.


When it is preferable to have a multi-language platform and when is not?

Question: In a world where English became the second language for most people or at least for the users that buy on international platforms, multi-language websites/ apps are still the best choice for a good UX? I know having the platform in the native language of a user is the best choice, but this comes with multiple challenges, and also it is hard to cover a large number of languages.
What do you think, when it is recommended to have the platform in English/ the most used language for the website/app users and when it is better to have a multi-language platform?
Answer: When users' experience is localized
If your users are interacting with content across continents, it's less important to translate than when they are interacting and consuming content within their locale. For instance, if you are delivering news about Japan in Japan, you would not expect it to be in English. However, it's less likely consumers of international news would expect it to be in their native language.
When you are trying to maximize sales
If providing translated content gives a boost to sales that outweighs the cost to translate, then it makes perfect financial sense to do so.
SEO
Your site will place higher in search rankings in international versions of the search engines.
Branding
By having an international platform, the brand becomes multinational and appears larger and more successful.
Comment: Thank you for your comment. Maybe the question in the title doesn't summarise exactly the issue... I wrote in the description more. I think the question is multi-language websites/ apps are the best choice for a good UX, even this comes with multiple challenges, and also it is hard to cover a large number of languages?
Comment: This question came from personal experience, I have for my portfolio multiple languages available and I'm not sure this offers a plus for the website...


imported data not displaying and no option to set tab to show "All"

Question: I have imported data to a custom object using dataloader. It said all records imported successfully. When I run a report I can see the data. However, when I go to the tab it only shows "recent" with no option to change to "all records".
How can I fix this?
Answer: In Classic, once you click on the tab, choose the All option in the View drop down menu and click Go. If there is no All option, click Create New View, give it the name All, and save it.
In Lightning, once on the tab, click the View dropdown at the top of the tab and choose the All view. If there is no All view, click on the ⚙ (gear) icon, then click New to create a new List View, change the filter to show All records, and Save the changes.


Find record in lookup field on a case object based on custom case number

Question: We have a Visualforce page on the case object which is used to create quality issue related cases of our customers. We have different functional areas such as Design, Quality etc., For ex, customer A has an issue related to his product quality, we create a case, say the custom case number is (QR-121). That issue is resolved and case will be closed. Customer has another product which has the same issue with product quality in the near future. so, we create a case, assume the case number is (QR-145). Since there's a similar case resolved earlier for the same customer, we want to use that case as a reference and add it to the current visualforce page. I've a look up field to case object to add the reference case (QR-121), but when I try to look up for (QR-121), it obviously won't show any records, as the lookup is associated with the standard case number. How can I be able to add reference cases by it's custom case number (QR-121) instead of the standard case number?
Answer: You can't. Lookup fields always use the "name" field (which for a case, is its case number). You can still query on your custom field and just use the ID that's returned, but the lookup field will always show the case number. There's no way to modify the behavior of how lookup fields work.
Answer: Associating lookup fields with any other attribute other than the standard Record ID field is not supported in Salesforce.
Another solution to ease your search process, would be to create an inline Visualforce Page (assuming you are using a standard Case page layout) to search and display the matching Closed cases based on a certain search criteria. The User can then select the specific record, whose Record Id can be associated in the Lookup Field.


probability of failure estimation when only one piece broke

Question: Let's say I have 4 pipes that have been testes for 150 000 cycles each and one of them broke at 120 000. How can I estimate the probability of failure from this sample?
Answer: It seems that what you describe fits the exponential distribution.
First you calculate the failure rate $\lambda$. There was one failure in $3 * 150000 + 1 * 120000 = 570000$ cycles, thus:
$\lambda = \frac{failures}{\Delta t} = 1 / 570000$.
The reliability in time is then:
$R(t) = e^{-\lambda t} = e^{\frac{-t}{570000}}$,
where t is the number of cycles.
You can look at the mean time to failure (MTTF) of a piece, given by:
$MTTF = \frac{1}{\lambda}$.
Comment: Thanks. So t here would also be 570 000 which then gives me e^(-1) which is 0.36787944117. How do I interpret this number?
Comment: That means that at time t=570000
cycles the probability that all your pieces are still functioning is 36.787..%. In other words, by then, expect a bit less than two thirds (63.2%) of the pieces to be broken. You can also take a look at the mean time to failure (MTTF). I will add to the answer.


Do I need to perform Ghusal?

Question: I don't know why but naturally I got a strong feeling before discharge of semen but at end I could control it.
Now I can say that I didn't discharge semen and due to pressure I couldn't control urine from being discharged so, should I perform Ghusal?
Comment: Can you please fix your grammar. Your question is already complicated and with badly written question, you are making it harder for us to answer it.
Comment: Yes you should. If you feel lust, you should perform ghusl.
Answer: To be honest, i assume that your question is complex (somewhat), actually I didn't figure it out completely. anyhow, I hope my response be related to your question and can help you (God willing)
In accordance with the ruling(Fatwa) of Imam Khomeini:

The Ghusl is not wajib(mandatory) in case the semen moves from its
  place and doesn't get out, or you doubt that the semen has gone out or
  not. But if some water( after a while) gets out from the body and you
  are sure that is semen (that had moved but didn't get out), leads to
  the Wajib Ghusl(Jenabah).
(Tozihul-Masaael, Al-Mhshi lel-Imam-Khomeini, Vol.1, Pages 208 & 211)

Of course you can see the link below which consists of another similar issue and it could help you as well.
www.islamquest.net (in Arabic and Farsi)

Source:
www.islamquest.net (in Farsi)

Do I need to perform Ghusal?


Expand Track Playlist from D-Command

Question: Is there a way to expand the playlist of a track from the D-Command?
Comment: when you say expand, you mean track height? or track view?
will be on an icon soon there is a section (right above your keyboard) with a soft-key to access playlist section. I'll give you a more specific answer when I'm there.
Answer: ok so track height you can change by using the track size buttons on the edit section of the desk (right hand side, under the ZOOM/NAVIGATE panel).
if you are trying to change playlists, with the D-Command on Focus (not select as it will still follow the selection done with the edit selection on your window), and on the soft key section (the one with the 6 led scribble bits) it says playlist. It will put on the LED option to create playlist or to cycle through them.
If you are trying to quickly change track views, may I suggest ctrl+cmd+left/right arrows? it will include the collapsed version of playlist view.
Hope i helped!

Expand Track Playlist from D-Command


Why are some people always warm/hot to touch even with normal core temp?

Question: I have met a few people like me who are always warm to touch even in the winters. With people sitting close often inquiring if I have a fever. Why is that? and Is it normal?
Answer: For a constant basal metabolic rate, then those with relatively smaller body surface areas will feel warmer than those with high body surface area.  This is because with a higher BSA the body has to shut down more of the surface blood flow to conserve heat and thereby ensure a constant core body temperature.

In addition, larger animals usually have a smaller surface area relative to their body mass and, therefore, are comparatively inefficient at radiating their body heat off into the surrounding environment.  The relationship between surface area and volume of objects was described in the 1630's by Galileo. 1

But on top of this men have more muscle mass which generates more heat and this needs to be lost by increasing blood flow to the skin.  So, this explains why women are so cold.

A 1998 study found that women's average hand temperature hovers around 87.2 °F, while men's averages 90 °F 2

https://www2.palomar.edu/anthro/adapt/adapt_2.htm
http://www.thelancet.com/journals/lancet/article/PIIS0140-6736%2805%2978875-9/fulltext
Answer: This question should be migrated to Physics SE. since this is mainly about thermodynamics and has nothing to do with health. This is fairly simple, it depends on your metabolism. We call it Basal Metabolic Rate (BMR). Before your question was edited by Carey, you said that your palms are mostly sweaty and having a hard time sweating while working out. Muscle mass play a key role to your metabolism no doubt. You will also feel "warmer" when your blood vessels near the surface of the skin. In addition, during cold climate your blood vessels will constrict to conserve heat and vice versa.
Comment: I'd be very surprised if this question would be welcomed in physics. Although BMR certainly involves physics in the sense that almost everything involves physics, BMR is first and foremost a biological phenomenon.
Answer: This may not be the answer you are looking for if you are only interested in a (Western) scientific explanation, but I would suggest reading about the practical life science of Ayurveda, which determines 3 'doshas' or body types, based on an elemental world view.
You may find the detailed explanation from Ayurveda (take an online dosha quiz for quick results, and then read more deeply) a more practical and actionable set of information than Western medicine would provide on this particular question.
Woo-woo / new age disclaimer. I am not into either of those realms particularly. However, I mention that because lots of people have a hard time distinguishing Vedic Science and actual Yoga from all the hippy hocus pocus being peddled around, especially in America :)
Comment: Welcome to Health.SE. Since health is an important topic, the site has a strict policy that all answers should be [backed up with reliable references](https://health.meta.stackexchange.com/questions/1/should-we-require-references-to-back-up-all-answers) so that the answer can be independently verified, regardless of the reader's background. *See [this list of reliable sources](https://health.meta.stackexchange.com/questions/783/quality-of-references/784#784)*. If you still have trouble with this, feel free to visit the [help] or [meta].


Transformer-based architectures for regression tasks

Question: As far as I've seen, transformer-based architectures are always trained with classification tasks (one-hot text tokens for example). Are you aware of any architectures using attention and solving regression tasks? Could one build a regressive auto-encoder for example? How would normalization fit into this (as LayerNorm destroys some of the information from the input)?
Answer: In the simplest case, doing regression with Transformers is just a matter of changing the loss function.
BERT-like models that use the representation of the first technical token as an input to the classifier. You can replace the classifier with a regressor and pretty much nothing will change. The error from the regressor will get propagated to the rest of the network and you can both train the regressor and fine-tune/train the underlying Transformer.
Also, I don't think that layer normalization causes severe information loss. It is already there when the network is trained, so the rest of the network parameters need to take care of that, which should not be a problem because the gradients "know very well" that there was a normalization layer.
Comment: Regarding the information loss, I was more referring to the autoencoder scenario. Because of LayerNorm, mean and variance of each input sequence will be completely destroyed. With that in mind, how could autoencoder ever learn to replicate input?
Gradients "know very well" that there was a normalization layer in terms of learned affine transform, but a portion of information is truly lost.
Answer: Transformers are increasingly being used in the area of temporal forecasting, which is autoregressive by nature and thus a good fit. Lim et al. (2021) recently announced "temporal fusion transformers" in which they perform quantile regression https://www.sciencedirect.com/science/article/pii/S0169207021000637.
I have not experienced any issues with normalization, although I normalize my data before feeding it into the transformer.


$u_t+a u_x=0$ solved by Discontinuous Galerkin

Question: If $u_t+a \cdot u_x=0$ under a periodic boundary condition (to mimic an infinite domain) is solved by Discontinuous Galerkin (DG), how to implement periodic boundary condition and the other details in DG?
Comment: One can impose periodic boundary conditions by imposing them on the trial function basis. Their span will consist only of periodic functions.
Answer: You can implement the boundary condition topologically. In pseudo-code this might look something like:
<code># I'm assuming 0-based indexing in 1D, adjust accordingly for 1-based indexing
for every element i:
    if i == 0:
        left_element = nelems - 1
    else:
        left_element = i - 1
    if i == nelems - 1:
        right_element = 0
    else:
        right_element = i + 1
    compute_dg_update(left_element, i, right_element)
</code>
If you want to uniquely pre-compute the numerical flux instead of recomputing it in an element-based update, you would compute the numerical flux only for left faces (or only right faces, but not both). Then the numerical flux for the right face of element $\mathrm{nelems}-1$ would be the flux computed for the left face of element $0$ (vise-versa if you instead computed the flux at the right faces).
A third way to implement periodic boundary conditions is by using "ghost values". You can initialize your storage array to hold elements $[-1, \mathrm{nelems}]$, then copy the values in element $\mathrm{nelems}-1$ to element $-1$, and copy element $0$ to element $\mathrm{nelems}$.
You then only update the solution for elements $[0, \mathrm{nelems}-1]$ using DG. This method generalizes well when you want to partition your domain for MPI parallelism since the periodic BC is handled almost seamlessly by the same code which handles regular sub-partition coupling.


Why are collations specified at the column level?

Question: The charset defines how the row data is saved into the file store.
Row 17: <CHARSET('utf8', 'hello'), 17, CHARSET('latin-1', 'sup')>

But it seems that collation only affects sorting of these rows.
So why is the collation specified when you are defining the column?
Instead I would expect that you would only specify the collation when defining things that matter with sorting rows, i.e. indexes (because they are stored sorted), queries (because they test equality and inequalities) and constraints (because they are effectively queries).
Comment: Also filtering.  In some collations, ss=ß; in others, they are treated as unequal.
Comment: Is that filtering different than a query?
Comment: @WilliamEntriken "Filtering" = comparison...typically in a `WHERE` clause, but can also be done in a `JOIN`. Basically, any place where operators such as `=`, `<>` / `!=`, `<`, `>`, `<=`, `>=`, `LIKE`, etc are used.
Answer: Unless MySQL / MariaDB does something that I'm unaware of (being that I typically focus on SQL Server): because encoding (i.e. "character set") is handled separately, column-level collation should simply be a default used for those operations that you mentioned (creating indexes, queries, etc), and comparisons, so that you don't need to specify the collation each and every time (strings cannot be either compared or sorted if the specific rules for doing so are not provided). That would not only greatly complicate queries, it would make it nearly impossible to provide consistency across queries as not having it declared at the column level (or at least at the DB level) would leave it to query developers to remember the intention of the data modeler, and that's certainly not a recipe for success ;-).
If not specified at the column level, collation needs to at least be specified at the database level or even the instance level (and I believe there are RDBMSs that do specify at either level, and maybe don't even allow for specifying at the column level).
Collation just needs to be specified somewhere, else you can't even rebuild an index (let alone create it) without providing the collation. And, allowing the granularity of specifying collation at the column level allows for maximum flexibility as different string columns within a table, or between tables in the same database, can easily have different needs / requirements.
And, just as a side note: for RDBMSs such as SQL Server that combine encoding along with collation in a singular "Collation" (and no way to separate the two), it is a necessity to specify at the column level as it indicates the encoding (at least for VARCHAR / CHAR / TEXT column; NVARCHAR / NCHAR / NTEXT are always UTF-16 LE).
Comment: So basically collation is part of the data model because the data designer cares if `'Straße' = 'Strasse'`.
Comment: @WilliamEntriken I would say that yes, it is something that the data modeler/designer cares about because collation is an inherent part of the datatype. But please review the updates I just made to this answer. Thanks :)
Answer:
(OP) But it seems that collation only affects sorting of these rows.

That's not true.

CREATE TABLE test1 (txt VARCHAR(4) COLLATE 'latin1_general_ci')
SELECT 'Test' txt UNION ALL
SELECT 'TEST'     UNION ALL
SELECT 'tEsT';

CREATE TABLE test2 (txt VARCHAR(4) COLLATE 'latin1_general_cs')
SELECT 'Test' txt UNION ALL
SELECT 'TEST'     UNION ALL
SELECT 'tEsT';

SELECT COUNT(DISTINCT txt)
FROM test1;

| COUNT(DISTINCT txt) |
| ------------------: |
|                   1 |

SELECT COUNT(DISTINCT txt)
FROM test2;

| COUNT(DISTINCT txt) |
| ------------------: |
|                   3 |

db<>fiddle here
The same while specify collation in a query:
SELECT COUNT(DISTINCT CONVERT(txt USING 'latin1_general_c?'))
FROM test;

(OP) why is the collation specified when you are defining the column?

Collation granularity is single value.


How to properly install WD Advanced Format drive in Ubuntu as 2nd HDD?

Question: I got a new Western Digital WD15EARS Caviar Green 1.5TB SATA drive but it seems to use WD new advanced format using 4k blocks or something (I get the general idea but not really).
Is there a way to properly format it for an Ubuntu 9.10 Server to take advantage of the advanced format? Such as with sector sizes?
Comment: I just posted a little guide about all this. It's partially explained on Western Digital's website but somehow it's incomplete and I ended up gessing from what the WD Align tools fixed in my partitioning mistakes... Anyway here it is: http://notepad.patheticcockroach.com/927/dealing-with-wd-advanced-format-hard-drives-on-linux-part-2/
Answer:
Is there a way to properly format it
  for an Ubuntu 9.10 Server to take
  advantage of the advanced format? Such
  as with sector sizes?

The potential problem arises not from formatting the drive but from where on the drive the partitions are located. 4K sector drives need to be aligned on a logical block address that is a multiple of 8.
Supposedly the Linux tools have been updated to do the right thing when it comes to the 4K sector drives.
If you are using the most recent version of a popular Linux partition editor to create one or more new partitions on the drive you should be OK.
One warning: The WD drives can be jumpered as a kludge to work "correctly" with partitions created by Windows XP. Since you are using Linux make sure you do not have the jumper set for Windows XP. (If you did have the XP jumper set then you would get terrible performance from the drive).

Update:
OK, after Googling around a bit further, I'm confused. On the one hand, I've read the overview articles which claim Linux has no problem at all with 4K sector drives. But on the other hand, there are articles like these which claim the opposite.
Linux Not Fully Prepared for 4096-Byte Sector Hard Drives
Linux WD EARS Advanced Hard Drive Format
The second link above is probably more useful since it seems to offer suggestions on how to properly partition a 4K sector drive.
What I suggest is that you first check the alignment of your partitions by using fdisk -lu to display their starting LBAs. If your partition(s) are already aligned on LBAs that are a multiple of 8 then you should be fine. (You could also time the transfer of a large file just as an extra sanity check.)
If you have unaligned partitions then you probably want to delete and recreate using the method in the second article to ensure they are aligned properly.
Hope this helps ...
Comment: I'm using the latest version of Ubuntu 9.10 (aptitude full-upgrade). Is that enough? Also, I was using this guide but it may be a bit outdated. I used ext4 instead of ext3.
Comment: ext4, ext3, NTFS ... whatever, it doesn't matter how you format the partition. What matters is the Logical Block Address (LBA) where the partition starts. The Anandtech article you linked to in your question says, "Notably, Linux and Mac OS X are not affected by this issue." I think you'd be safe with Ubuntu 9.10 since it was available around the time WD appears to have been doing their testing.
Comment: @wag2639 BTW, what tool are you using to partition your 4k sector WD drive? I'm in the process of trying to digest this article http://www.osnews.com/story/22872/Linux_Not_Fully_Prepared_for_4096-Byte_Sector_Hard_Drives to see if it points out anything which really needs to be worried about.
Comment: @john I just left fdisk do whatever the default setting was, at least at first just to make sure the drives works, I was hoping others would chime in over time and offer some advice or other experience.
Comment: just realized i didn't include the guide i was using, i'll include for others with this problem: https://help.ubuntu.com/community/InstallingANewHardDrive
Answer: Parted tool starting from version 2.1 is includes support for aligning Advanced Format drives. This recommendation is from WD official FAQ.


Bringing children to the front of the stage depending on y-axis value

Question: I just have a simple problem that needs resolving and I am pretty new to actionscript, I am making a sideScroller game where enemy troops spawn in randomly on some y value and then go across the screen, but how do I make it to where if they are lower on the y-axis(higher up on the screen), they appear in front of the others? They are troops so it looks bad if their legs overlap other people below them when it is supposed to look as if they are behind them. I hope I am explaining this well.
Any help would be awesome!
thanks
Answer: Keep all your troops in an Vector. First, sort them based on the y value. Then, iterate through the vector, and if the depth of the element at i is lower than the element at i+1, you should swap the objects' depths. Hope this helps, if you need more details, let me know.


Crash while using memcpy?

Question: I am trying to copy file  from one location to other location using memcpy.
And I am getting a crash every time when the file path which I provide as source is non existing.
Is this a correct behaviour, if yes then how could I prevent the crash.
Comment: You are doing it wrong. How do we know what exactly wrong? You should have provided your source code. BTW is this homework?
Comment: Please provide a [short example](http://sscce.org). And I believe you're using `memcpy` completely wrong.
Answer: memcpy's purpose is not to copy files, but chunks of memory from one place to another. Depending on platform, I'm sure there are better ways to copy files between directories.
Answer: No, no, no! What in the name of holy memory are you doing? memcpy is strictly used for memory transfer. For example, say you have a bunch of vertices in a graphics application that you want to give to the vertex buffer without actually passing a pointer. That way, you copy the entire array of bytes that represent your vertices and from thereafter - they are a problem of the underlying API. That's the intended usage. Also, be careful how you use it. You specify the amount of bytes that are to be copied. Make sure it is exact. At the lowest levels, there is no such thing as types, if you give it too much, it'll wreak havoc - tear into bytes that "belong" to other variables. If you're lucky, such code will kill your application. If you're not - it'll continue working.
For file reading/writing/copying, you have to consult standard C/C++ file input/output (or some more refined methods courtesy of the underlying platform, as one of the answers suggested). There's a lot of resources online, so I won't reinvent the wheel here. Hope it gave you a better idea of what memcpy is for.

Crash while using memcpy?


IE 7 CSS float issue

Question: I'm having issues with my mandatoryIndicator class asterisks and their appearance in IE7.  For some reason the asterisk appears almost on top of the City: label in the form but it looks fine in Firefox and IE 8 and above. I've also included the affected part of the HTML as well.  Any help would be greatly appreciated.
.mandatoryIndicator {
    margin: 0 0 0 -.75em;
    padding: 0 4px 0 2px;
    color: #cc0000;
    font-weight: bold;
    float: left;
    position: relative;
}

      *
      City:

Comment: Can you make a http://jsfiddle.net/ or http://jsbin.com/ demo?
Answer: Try not to use negative value to margin in CSS. This always produces style issue in IE7. Anyway, there you should not use position: relative for inline element (span). It is only used for block level elements, i.e. div, to contain other elements.

IE 7 CSS float issue


why when making a command on bitcoin console does this appear staggered square brackets appear

Question: Why when making a command of listunspent ,generate ,listlockunspent etc , Does this appear?  [
].
Answer: The output is in JSON format; <code>[]</code> is a list containing no items.
Comment: Thankyou,is this because i am not synced yet?
Comment: It just means your wallet contains no UTXOs, whatever the reason. Given comments you've made on other questions, my assumption is simply that you don't have any coins.


SMC sensors failure while running on battery

Question: I have problem with SMC in MacBook Air 2016. While running on battery, data from SMC module freezes. In iStat Menus temperatures from sensors, RPMs, current meters and voltage meters from CPU aren't refreshing. Also fan sometimes switches on high RPM and runs continuously, even when laptop is quite cold. When I plug in charger, fan goes back to 1200 RPM and temperatures are being normally refreshed. I had this issue propably even before updating to Mojave. I tried resetting SMC, but nothing happens. What is the possible reason for this issue?
Comment: so your iStat is not working ?
Comment: iStat works, but problem is with SMC overall. Fan is working really strange, it's turning on when not necessary, and won't tun off until I connect power or turn system to sleep.
Comment: so did you successfully reset SMC with visual confirmation ?
Comment: When resetting SMC watch the MagSafe light briefly flicker.
Comment: I did, and MagSafe turned green for a sec (battery was about 50% so it was orange normally)
Comment: actually the light just goes on/off for a moment, set volume low and screen low and try again. Turn off (Quit) iStat and any other app that could control your system. Actually just Quit all non Apple apps.
Answer: You've already reset the System Management Controller, which was the first thing to try, so I would probably start with testing to see if this behaviour is replicated when booted into Safe Mode and if the issue persists then running Apple Diagnostics.
Boot into Safe Mode
Follow these steps to boot your Mac into Safe Mode:

Fully shut down your MBA
Restart your MBA
Immediately press the Shift key and keep it down
Let go of the Shift key when you see the login window (NOTE: If you have FileVault enabled you may need to log in twice).
Take a note of what happens (i.e. does your MBA still seem to behave strangely when running on battery, etc)
Exit Safe Mode by restarting your MBA as normal
Test again when booted normally

If the problem doesn't occur while booted into Safe Mode, let me know and we'll go from there.
If the problem persists, proceed with running Apple Diagnostics.
Run Apple Diagnostics
Follow the steps below to run Apple Diagnostics:

Fully shut down your MBA
Restart your MBA
Immediately press the D key and keep it down until you see the Diagnostics screen appear
Wait for Diagnostics to finish (this typically only takes a few minutes)
Once complete, one of two things will appear on the screen:

a No issues found message
a brief description of any errors found plus further instructions

If the diagnostics test does find errors, take a note of what they are

Note: If pressing and holding the D key at Step 3 doesn't work, start again at Step 1 and, at Step 3 press and hold both the OptionD keys instead. This will try and run diagnostics from the internet instead, so you will need to allow more time for it to complete.
Regardless, take a note of what happens and let me know how you went.


How to convert a u32 into a BoundedVec compatible format?

Question: I am using a BoundedVec as the id for a storage map, and intend to transform a u32 value into a compatible format. Is there a streamlined way to accomplish this, or should I split the u32 into smaller bits and insert them into the BoundedVec? If the latter is true, how should I go about this?
Comment: Why can you not use the `u32` as map key directly?
Comment: Currently, I have the storage setup with the u32 as the key, however, due to new requirements, the Ids may also include characters, hence the boundedvec (of u8). Instead of creating a separate storage for these new items, I am trying to modify the existing one. Then, I can distinguish the two different types either through an enum, or through a specific prefix.
Comment: Okay I see, thanks.
Answer: You can use the SCALE codec to encode types into Vec. Then the Vec can be converted into a BoundedVec.
For example a u32 (but it works the same for any other encodable type):
use codec::Encode;
use sp_core::ConstU32;
use sp_runtime::BoundedVec;

let value: u32 = 123;
let encoded: Vec<u8> = value.encode();
let bounded: BoundedVec<u8, ConstU32<4>> = encoded.try_into()?;

Note that the conversion from Vec to BoundedVec is fallible, in case that it does not fit into the bounded vec. There are also infallible functions like BoundedVec::truncate_from, but personally I would rather use the fallible version and return in an error case.
It is possible to use the MaxEncodedLen for testing to ensure that the BoundedVec is always long enough to hold the encoded values.


How can I write in first person present tense without it being annoying or distracting?

Question: I am currently writing a story in first person and present tense. I've read a lot about what various people think of this perspective and I've heard many people say they enjoy it when it's done well, but hate it when it isn't. Does anyone have any advice on how I can write this perspective without it being annoying or distracting from the story?
Answer: There are genre conventions regarding tense. If most of your genre is written in present tense, readers will expect it and not take much note of it. If present tense is a deviation from genre conventions, it will be more conspicuous and readers will find it irritating in and of itself. In this case the challenge to you as a writer will be steeper.
Also, the tense needs to fit the viewpoint and story. If you write in present tense, the narrator cannot know the future or events outside of the present moment. It is therefore more befitting to a first person narrative and a limited perspective. Third person present tense often feels rather factual and cold and would fit a more "scientific" narrative better, e.g. a psychological portrait of pathological behaviour or certain kinds of science focussed hard SF, than a love story or a story of subjective emotional development. Present tense also lends itself well to action and surprise, while past tense does better at reflection and drawing conclusions.
As for how to write it well, that is a very broad question and I'm not sure I can answer it exhaustively. I believe the most important aspect, though, is linguistic flawlessness. The more readers note something, the better it needs to be executed. So make sure you understand and master all the grammatical consequences of present tense, e.g. anteriority and posteriority, indirect speech, etc. Write in a smooth and unobtrusive style. Use words that the readers are familiar with and that fit the voice of your narrator. Bascially what you do all the time as a writer, except even more carefully.
I would also say that present tense requires shorter sentences on average than past tense, at least outside of passages that recount people ruminating about their past. The thoughts of people may be convoluted and their experiences multi-layered, but the awareness of people in the present moment is usually rather compartmentalized and moment to moment. Only looking back on events (in past tense) creates a coherent and structurally complex narrative.
Comment: Completely disagree that 3rd person present is more factual and cold, not suited to emotional development, and better for action and surprise. Many of the present tense books I've read have been quite the opposite. I don't have access to my books right now so the only one I can point to is Maggie O'Farrell's 'Instructions for a heatwave'.
Comment: @Mousentrude Reading the beginning of Maggie O'Farrel's *Instructions for a Heatwave*, I find the narration distincly distanced from the characters and observing them and their behavior with maybe an empathetic but nevertheless inquisitional gaze. I haven't read the book, but according to one review it is about "a dysfunctional but deeply lovable family", and that would fit my assessment of third person present tense befitting psychological analysis well.
Answer: Action-oriented books are easier to read in first person present. If you are doing a lot of world-building or description, third person allows for easier descriptions since you don't have to constantly have the main character look and describe the scene and what is happening right this second in every scene isn't quite as important. Past tense feels right most of the time because the reader is reading - it's more a "this has already happened" feel than, say, a visual story like a movie.
Present-tense keeps action tight and feeling like it's happening right now so it's well-used for action genres. The best example of 1st person/present tense I can think of is "The Hunger Games." Horror can be another genre with first person/present because the reader is stuck with only what can be seen and experienced by the main character.
It is sometimes disorienting to read in present tense. I recommend starting off with an action sequence, this helps to introduce your reader to what they can expect to happen later on in the story AND the distraction of what is happening in the scene should allow for a reader to accept the POV/tense choice. If it's badly written, it's a big slog and most won't bother to finish.
Use tight word choices, more short sentences than long. With the latter, don't write only short sentences, mix it up so the rhythm of your sentences doesn't get boring. But when you have a choice, write shorter sentences.
Answer: First person present tense narration gives the sense of watching a stream of the hero's direct perception and experience as it is happening. It's a good choice if you want to show your reader what the hero is going through from that raw, unfiltered perspective.
It doesn't lend well to elements that wouldn't be part of the immediate moment:

Passages summarising a development over a longer period of time (say, weeks) in broad strokes.
Asides explaining things the hero knows in the back of their mind when there's no reason to focus on those things at the moment.
Commentary from the narrator's older, more knowledgeable self. (A past tense first person narrator can say things like, "Boy, was I wrong." In present tense, they don't know they're wrong yet.)
The narrator deciding not to reveal a detail. (You can still hide things from your reader by skipping a scene, like you do with uneventful periods such as brushing teeth in the morning, but that's basically your only tool.)

What you need to do is the same as with any other form you write in — decide well if the form fits the content, and then work in accordance with its nature and limitations.
Comment: @Laurel I wanted the answer to consist of three well-defined parts. The way you've reformatted it, it makes the disadvantages look like the only relevant part, and all the rest easy to completely miss. That's a misrepresentation of what I was trying to say. Would you please allow me to reverse your edit? Or can you suggest some other formatting that wouldn't make the first and third paragraph so inconspicuous?
Comment: Having actual bullets is essential for anyone who uses a screen reader, because otherwise the bullets would be read as one large paragraph, which would be confusing. Now, you probably could convert it to actually be a single paragraph with a few minor changes which would do what you want. Alternatively, you could add headings to each section which summarize the point (`## Heading` in markdown). Also, the reason the middle seems emphasized is because it is — you spent more words on it, explaining it in the most detail, so adding more details to those other sections would even it out.


Can I attack even after striking a deal?

Question: I struck a deal with a slaver vessel. I will spare them for a slave. How do I attack after a successful deal? They are bad after all.
Comment: In addition to the given answers, it's worth noting that if you really like calling backsies on your acceptance of surrender, you could download The Captain's Mod, which will allow you to accept surrender from most enemies, then carry on shooting them anyway. This assumes, of course, that you don't care about suffering a mutiny.
Comment: @ymbirtt you can suffer a mutiny in the mod or is that a new feature?
Comment: @JFA, that's part of the mod. As far as I know there is nothing that can be described as a mutiny in either the base FTL or Advanced Edition.
Comment: I believe you also have the option of suffocating the crew of the slaver ship, which if done successfully rewards you with the much-higher scrap reward of a suffocated crew AND a slave sometimes
Answer: If you end an encounter with a peaceful resolution, there's no way to manually force an attack.  The only option is to move on.
The Friendly Slaver event has a special "blue" option if you have a level 2 teleporter where you can get a crew member and initiate combat.
However, as I mentioned, there's no way to choose a different outcome once you've completed the event.
Comment: @agent86 I've destroyed ships via fire and such after a truce was negotiated many times.  You get no reward for doing so other than the satisfaction of seeing them *asplode*.
Comment: I do think if you're using missile weapons and one is in-flight when you broker your deal, that one missile may still end up hitting (and potentially killing) the slavers. Similarly, if their ship is on fire when you make your deal, it's possible for the fire to kill the slavers and destroy their ship even after the deal is concluded. That's all just down to luck, though.
Comment: @AdamV, yeah, attacks in flight can sometimes destroy a ship after peace has been made.  I think I've also wiped out the last crewmember after peace was attained.  I'm not sure you get a reward from that, though, right?  It's only happened to me once or twice.  At any rate, in the scenario the asker describes, I think they never started combat, so there's no way to start it now.
Comment: @BlackVegetable, thanks for confirming my shaky memory :)
Comment: AFAIR, weapons *do* miss after surrender and all combat stops, but I'm 100% sure the fire/breaches/solars/asteroids still damage/kill afterwards.
Answer: No, if you choose to purchase from them you will not be able to attack the slaver vessel during the Friendly Slaver Vessel event.
If you want to obtain potentially 2 crew members from this event, you will need at least a rank 2 teleporter and pick the blue option in an attempt to free some slaves.
Answer: Note that in many cases the ship can still be destroyed after a surrender. This happens if you have some shots in the air, or if their ship is on fire (and you wait), for example.
So yes, you can destroy the ship after striking a deal, however you can't attack them after striking the deal.
Comment: This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
Comment: @DJPirtu fixed; forgot to mention the last sentence


What is the best multivariate analysis method to study data with missing values and outliers?

Question: I'm working with a dataset of elemental concentrations in polluted soils. Using the same units, some elements have high values and some have low values. If the concentration of some element is too low in any given soil it can't be determined, so I have missing values (they could be approximated, though), and polluted places have much higher values, so they are outliers and most variables are not normally distributed.
I want to group soils with similar profiles, and if possible know what elements (variables) make them similar or different.
The methods I know (like PCAs) can't be applied here, so what method could be?
Comment: Not exactly an answer, but this paper seems to address your questions in a closely-related domain featuring many of the same problems (or at least, closely-related from the POV of a statistician who's never done lab work in his life :) )
[https://link.springer.com/article/10.1007/s10040-002-0196-6](https://link.springer.com/article/10.1007/s10040-002-0196-6)
Answer:
If you know for certain that your missing values only occur where an element is below the limit of detection (L.O.D.), I would argue that an approximation of half of the value of the L.O.D. would be better than treating them as missing values.

Have you considered transforming your variables so you can use them in analyses that you're familiar with?

Have a look at similarity matrices and hierarchical cluster analysis. If you already have defined groups that you know are similar, you may also find it worth taking a look at Random Forests - they can be used with categorical data as the response variable, and deal with various explanatory variable data types and missing values (although you still need to be careful to consider issues that these might cause in terms of bias, and take a look at conditional importance vs. the original variable importance score).
Comment: Both your answer and the article shared by proof_by_accident in the comments go along the same lines, I did not know that transforming variables is an acceptable way to do it, so I will try with that, thank you!
Comment: Glad it helped. The article is good. I should also add that CART/decision tree methods (which underpin Random Forests) can be used for regression to predict a numerical value and so could also be used for grouping (you might need to restrict the number of 'leaves' on the tree so you don't end up with too many small groups). If I had lots of potential explanatory variables, I would consider running a Random Forest first to filter down to a smaller set.


What is the evidence that Ignatius of Antioch was ordained by the Apostles?

Question: What evidence do we possess today indicating that Ignatius of Antioch was ordained by the Apostles?
Comment: "Ordained" in what way?  How are you defining "ordained"?
Comment: @SLM - Like "ordained" in Titus 1:5.
Answer: Whenever you have questions like this, the first place to turn is wikipedia.  Of course, you can never really "trust" wikipedia, but you can still get a good overview of the situation, and---much more importantly---you can use its references to track down the information you really want.  So, if you visit the wikipedia page on Ignatius, you will find two primary sources.  I have tracked them down for you.  The first is Theodoret, who wrote in Dialog 1---the immutable:

You have no doubt heard of the illustrious Ignatius, who received episcopal grace by the hand of the great Peter, and after ruling the church of Antioch, wore the crown of martyrdom.

But then in the Apostolic Constitutions VII.iv we read:

Now concerning those bishops which have been ordained in our lifetime, we let you know that they are these:---James the bishop of Jerusalem, the brother of our Lord; upon whose death the second was Simeon the son of Cleopas; after whom the third was Judas the son of James. Of Cæsarea of Palestine, the first was Zacchæus, who was once a publican; after whom was Cornelius, and the third Theophilus. Of Antioch, Euodius, ordained by me Peter; and Ignatius by Paul.

So, there appears to be conflicting evidences, and both very late (fourth and fifth centuries CE).
According to wikipedia, Eusebius also mentions Ignatius.  This has, oddly enough, proved more difficult for me to track down.  But you can explore the references---and pretty much everything by Eusebius has a free online English translation available.
But then, according to the post-Nicene fathers, we should consult the so-called Dictionary of Christian Biography and Literature to the End of the Sixth Century for more information.  There---in particular, in the Euodius/Evodius entry, we find the following very rich information:

Evodius (1), according to early tradition, first bp. of Antioch (Eus. Chron. ann. Abr. 2058; H. E. iii. 22). His episcopate has indirectly the older testimony of Origen, who speaks of Ignatius as the second bishop after Peter (in Luc. Hom. 6, vol. iii. p. 938; see also Eus. Quaest. ad Steph. ap Mai, Scr. Vet. i. p. 2). This tradition has all the appearance of being historical. Ignatius early acquired such celebrity that it is not likely the name of an undistinguished person would have been placed before his, if the facts did not require this arrangement. The language used about episcopacy in the Ignatian epistles agrees with the conclusion that Ignatius was not the first at Antioch to hold the office. As time went on, the fitness of things seemed to demand that Ignatius should not be separated from the Apostles. Athanasius (Ep. de Synodis, i. 607) speaks of Ignatius as coming after the Apostles without mention of any one intervening; Chrysostom makes him contemporary with the Apostles (Hom. in Ignat. vol. ii. p. 593); the Apostolic Constitutions (vii. 46) have recourse to the expedient adopted in the parallel case of Clement of Rome, the hypothesis of a double ordination, Evodius being said to have been ordained by Peter, Ignatius by Paul. Theodoret (Dial. I. Immutab. iv. 82, Migne) and others represent Ignatius as ordained by Peter. The authorities are given at length by Zahn (Patres Apostol. ii. 327).
  There is reason to believe that the earliest tradition did not include an ordination even of Evodius by Peter; for the chronicle of Eusebius places the departure of Peter from Antioch three years, or, according to St. Jerome's version, two years before the ordination of Evodius. The chronology of the early bishops of Antioch has been investigated by Harnack (Die Zeit des Ignatius). He infers that the earliest list must have contained only names of bishops of Antioch without any note of lengths of episcopates, but still that Eusebius must have had the work of some preceding chronologer to guide him. We may well believe, as Harnack suggests, that Eusebius got his chronology of early bishops of Antioch from Africanus, to whom he acknowledges his obligation, and whose chronicle has generally been believed to be the basis of that of Eusebius. If the belief had been entertained at the beginning of the 3rd cent. that Evodius had been ordained by Peter, it is incredible that Africanus would have assigned a date which absolutely excludes an ordination by Peter. The date assigned by the chronicle of Eusebius to the accession of Evodius appears to have no historic value, and thus, while we accept the episcopate of Evodius as an historic fact, we have no data for fixing his accession, but may safely place it considerably later than a.d. 42.

This is, obviously, full of references.  But the abbreviations are hard to decode, and so I leave it to you to investigate further.
Comment: This is strange.  If you already knew the ancient sources for the traditions in question, why not say so in your question?  And why refuse to countenance non-contemporary sources as evidence?  I did some work for you, and you pissed on it.  If you know how to do the work yourself, then get to it.  Don't bother us with questions asking us to do it for you.
Comment: Ah, okay.  And sorry, now that I re-read your first comment, I see that I misinterpreted it.  I had gone to some effort to track down those sources for you, and it seemed on a first reading like you didn't appreciate it.  But now that I re-read your comment, I can see that you were just clarifying your question.  Sorry!  Anyway, I would suggest that you try to track down the references in the *Dictionary of Christian Biography and Literature to the End of the Sixth Century*.  You won't find anything contemporary to Ignatius, but you might find something a lot closer than the fourth century!
Comment: Thank you. I DID read Wikipedia prior to asking this question and I DID get familiar with all the resources that you have "tracked down for me". All of them come from people that are set apart from Ignatius by more than two centuries. They themselves never saw Ignatius in person and couldn't have physically communicated to him face to face or through epistles. Therefore, they are all merely references, but hardly be classed as evidence. What I need, however, is the evidence, that is, some materials contemporary to Ignatius' life.
Comment: (1) "**If you already knew the ancient sources for the traditions in question, why not say so in your question? And why refuse to countenance non-contemporary sources as evidence?**" - I think it's all about my poor knowledge of English. The thing is I thought that the English word "evidence" meant only the contemporary sources (just like in my language) and any relevant assertions made centuries later would be deemed as merely "references", but now I see that obviously the word "evidence" has a broader meaning in English. It's just like the ↙
Comment: (2) word "tragedy". In my language this word can be easily applied to the outcomes of war, for example, it would be absolutely fine to say "What Hitler did to us in the WWII was a huge tragedy for our nation", however, once I really offended one American when I told him that what had happened on 9-11 was a real tragedy for the USA, to what he angrily said, "That was not a tragedy! That was an attack!"
Answer: It appears we have no hard evidence of this, in spite of the legends that have grown up around Ignatius of Antioch. Thomas J. Heffernan says in Sacred Biography, page 58, that we know nothing about the historical figure of Ignatius of Antioch other than his journey to martyrdom from Antioch to Rome and that he wrote letters to Christian communities along the way. Allen Brent says in Ignatius of Antioch page 14, that Ignatius tells us nothing about his life prior to his departure from Antioch in chains. In other words, we do not know when Ignatius was born, in spite of the persistent tradition that he was born in 35 CE, and we do not know when he was ordained or by whom.
Ignatius died in 107 CE. At a time when commoners rarely lived beyond about 50 years, the tradition that he was born in 35 CE means that he was executed at the age of 72, after withstanding the rigours of captivity that would have killed a much younger man. There being no evidence that he was really born in 35 CE, f we make a different guess at his date of birth, say 57 CE, and assume that he was ordained at the age of 20, then his ordination as a deacon would have taken place around 77 CE - after Peter and the other apostles were probably all dead.
Wikipedia states that Theodoret of Cyrrhus reported that St. Peter appointed Ignatius to the episcopal see of Antioch. However, Theodoret lived during the fifth century, centuries after the time of Ignatius, and could not be regarded as a good historical source. Perhaps Ignatius was ordained by an apostle, but we have no way of knowing.
Comment: Well, we have no way of knowing FOR SURE.  But it's possible that Origen might be helpful here, per the final quotation in my answer above.  And Origen wrote in the first half of the third century.  And Apostolic Constitutions is from the fourth century.
Comment: @anonymous Yes, we can both speculate on this, although Origen is little more likely to have known what might have happened a century and a half earlier than Theodoret would have been.  I have pointed out that on the balance of probability, Ignatius was not likely to have been ordained as a presbyter before about 77 CE and as a bishop somewhat later, probably 2nd century in order to have the respect of his juniors.
Comment: It's not necessarily the case that "commoners rarely lived beyond 50 years"; what's your evidence for that?
Comment: @MattGutting For example: http://www.ucl.ac.uk/museums-static/digitalegypt/age/roman.html provides some census data for Roman Egypt. Note that lifespans fell off quite quickly from the 50s on, with few living beyond 70.
Comment: Not bad; still debatable, though. But definitely food for thought.


Can I use ICO (Initial Coin Offering) to fund for a non-blockchain project?

Question: I did a fair amount of googling before posting.
Let's just say, I am planning to create a yet-another-blog-engine which is noway related to blockchain. Can I use ICO (Initial Coin Offering) to fund such projects?
Answer: It's possible to treat an ICO as nothing more than a funding mechanism, yes. Filecoin, for example, ran an ICO on the Ethereum blockchain, but will be operating on a separate chain, indicating that there is no hard relationship between the ICO chain and the eventual product. Taken further, there is no technical reason for the product to be blockchain related at all.
Note that although there are no technical restrictions here, there may be other issues. For example, investors may not trust a developer's ICO if he has no evidence of using the blockchain in a meaningful way. It might also be a sign of a scam - since the tokens will have no intrinsic value within the context of the application, the price will be driven purely by speculation, which can lead to an unstable market.
Answer: Initial Coin Offering means you are offering a COIN before the project goes live. This coin is supposed to appreciate in the future, this is why everybody is going to get in and buy your coin. If you are not offering a COIN, then it is an IPO (Initial Public Offering) where you offer something else than a coin, say a share of your newly created company. If you are offering a PRODUCT, then it is more like a Crowdfunding Campaign. If you offer nothing valuable, then it is called charity.
To collect funds you can use anything, a credit card, a deposit, cryptocurrency or whatever. Just make sure this is legal in your country.
ICOs are popular because it is very easy to take ETH or BTC and exchange it for a token, which is some sort of like a ticket, when you go to the movie. With this ticket the user has some rights to do something or to claim some assets inside the virtual "world" of your project.
Blockchain has nothing to do here, it is just an algorithm, but many companies use this popular word to make their project more appealing.


What about adding a help submission

Question: I have a list of SQL statements that can help with determining the 1st and last day of the month, with conversion, etc. Can I post it as a question?
Comment: If you're having trouble with your SQL, you can certainly post your code along with an explanation of what you're having trouble with. You should just check to make sure your question hasn't already been asked on the site.
Answer: Yes, you may post the question and its answer as well. Just make sure to phrase the post as a question that covers the guidelines of a good question and answer it immediately.
From the Help Center:

Can I answer my own question?
Yes! Stack Exchange has always explicitly encouraged users to answer their own questions. If you have a question that you already know the answer to, and you would like to document that knowledge in public so that others (including yourself) can find it later, it's perfectly okay to ask and answer your own question on a Stack Exchange site.

In the Ask a Question page, there is an option for self-answering:

Note: Do spend some time to search if there is a duplicate question already present on the site, in which case you should not post your question.

What about adding a help submission


Include rejected paper in Masters application?

Question: Is including the manuscript of a rejected paper (without claiming that it has been published or mentioning any rejections) as a supporting document in my application ethical / would it in any way increase my chances of admission?
Comment: @WantsToLearn The reason for rejection matters. If it was rejected for being fatally flawed, then probably it's best not to mention it. If it was rejected due to lack of enthusiasm or something more subjective like that, then I would include it.
Comment: Why was your manuscript rejected?
Comment: I was volunteering with a professor (in a different department at the same school) so I'm not the primary author. The manuscript was rejected for methodology concerns. My point of including it is to show my aptitude for research.
Answer: I would recommend putting it in your cv as a Manuscript in Preparation section where you list authors, title only. If you don't do that, it's something to bring up very briefly as either a bullet point of writing a resume, or in the cover letter. You may wish to spin this as "motivated to disseminate research" rather than to prove your aptitude for research, since publishing and doing research aren't synonymous. Good luck
Answer: No.  Don't include copies of papers (published, in press, or rejected).  That's TMI.
Just list research done as a bullet point on your CV or discuss in your cover letter or essay.
And I would be a little more positive.  Say publication TBD.*
*Maybe they figure out how to clean it up and get something published.  [And don't get into a discussion of "it was rejected, but I done good".  Don't meander into details like that.]
Comment: What are TMI and TBD?
Comment: TMI: Too much information (informal language). TBD: to be done (common abbreviation).
Comment: "I done good" please use English like what she should be spoke....
Answer: If this is an application for an MS in the US, it's probably not expected that you will have published papers.
Depending on circumstances, it might be worth mentioning that you participated in research. (For example, if you did computer coding or statistical analysis for a project in biology and your application is for a CS or statistics MS. In that case, maybe briefly mention computer language/methods or statistical methods--without going into details about the work not being finished.)
Comment: Always best to ask your 'real' question first. Overall GPA may not be as important as GPA in major and other courses directly relevant to MS program. (But some MS programs have absolute minimums for overall GPA, which you might be able to discover in advance, saving useless applications.) Can you get an enthusiastic letter of recommendation from the prof with whom you collaborated on the unfinished research? And maybe someone in your field who believes you show promise for MS work?
Comment: My issue is that my UG GPA is rather embarrassing, so I'm trying anything that would improve my chances of admission.
Answer: Make the manuscript publicly available (e.g., in a technical report repository or on your personal website) and list it on your CV. There's no need to includ[e] the manuscript...as a supporting document, since it'll be publicly available.


Deck Staining with a little light drizzle

Question: Can I apply deck stain if there is a slight drizzle of rain?
Comment: Water base or oil base stain?
Answer: It depends.
Let's back up for a second and talk about how stain/waterproofing works. Wood is a porous material. When dry, it will soak up liquids like a sponge. In fact, it's that soaking/drying cycle of water that will eventually wreck your wood (and why waterproofing helps extend the life of exterior wood). Deck stains generally rely on that principle. The wood soaks the stain (or waterproofing) and thus it penetrates into the top layers of wood (latex relies a bit less on this, and tends to coat the outside a bit more).
If your wood is wet, even a little, it interferes with this because the wood has absorbed some water, and thus the pores that would fill with stain are filled with water instead. If your stain is oil-based, it just won't penetrate as well. If it's latex, the water will wreck your finish because latex is designed to break up in water.
The real question isn't about drizzle, it's about how wet your wood is. If we're talking about one of those wintery "fine mist" drizzles, the wood might stay relatively dry enough you can still apply stain. If we're talking about anything heavier, I would say probably not.
Either way, I wouldn't risk it. Just wait for a dry day. Eliminates any question of how well the stain will work.


White color substance on the branch of hibiscus plant

Question: I have three hibiscus plants growing in our garden but for one hibiscus I could see some white color substance on the new leaves and branch. Can anyone please advise on how to get rid of this and save this plant as well as it should not spread to other plants.
Comment: A close-up picture of the "substance" could help us identify it. otherwise, it can be many things, each with a specific cure.
Comment: Sure will post the pics
Comment: Posted few pics. I could also see leaves are eaten by some insects can you please help to find a solution
Comment: Seems not too bad. The damage on the leaf seems to be of different source (caterpillar?); Try to crush them manually, and see if they come back. This worked great for me in case of aphids attacks. But I agree with Sami id: looks like mealy bugs. Difficult to get rid of.
Answer: It can be mealy bugs. They are hidden in a white coating that may also have a cottony look. They are pretty common in hibiscus. I heard that insecticidal soap is a good control for mealy bugs.Before you apply anything first identify what you have.


installing usbmuxd under Mac OS X

Question: I installed the latest version of libusb and now I'm trying to install usbmuxd.
However, it gives this error:
configure: error: Package requirements (libusb-1.0 >= 1.0.3) were not met:

No package 'libusb-1.0' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

In the installation log of libusb it says
libtool: install: /usr/bin/install -c .libs/libusb-1.0.0.dylib /usr/local/lib/libusb-1.0.0.dylib

It looks like the wrong version of the library is getting installed.
How can I solve this?
Answer: You should consider installing macports, which has usbmuxd v1.0.7 available, and then:
$ sudo port selfupdate
$ sudo port install usbmuxd

(you should de-install the libusb package you installed yourself, before doing this probably).

installing usbmuxd under Mac OS X


What did Chewbacca do before Episode III?

Question: It is known that Chewbacca was a Wookiee that fought (along with other Wookiees) for the Republic during the Clone Wars, but is there any information on what he did before the Clone Wars and Episode III?
Comment: @Valorum That's what he did before Episode V, not Episode III. And shame on your for reminding us that the Holiday Special exists!
Comment: He lived on Kashyyyk with Lumpy and Malla, celebrated Life Day and watched weird holographic crap on the chess table; https://www.youtube.com/watch?v=2TTnjivfuUk
Comment: Trick question. There is no episode 3.
Comment: There is no information in canon, but in Legends he did appear in several comics explaining his early years. Start from here and explore further http://starwars.wikia.com/wiki/Chewbacca/Legends
Comment: http://starwars.wikia.com/wiki/Chewbacca/Legends
Comment: It is likely that the Solo movies will answer this question for Disney Canon version.
Comment: @TimSparrow looks like it didn't :(
Answer: Like most topics regarding Star Wars after the canon shift, you have two different answers.
In terms of current Canon for Chewie, not a lot has been said as yet about his past history prior to the Clone Wars or in the period between Revenge of the Sith and Solo. However, we do have a paltry amount of information. Chewie was born some 180 years prior to the start of the Clone Wars, was married to Mallatobuck before the Rise of the Empire, and had a son, Lumpawaroo, in that time period as well.
In the Legends continuity, we have somewhat more information about Chewie's earlier life. For one thing, in the years prior to the Clone Wars, Chewie travelled throughout the Galaxy and eventually became a renowned hyperspace navigator among the Wookiees' Claatuvac Guild, an organization that worked with mapping and finding new and existing hyperspace routes. Chewbacca also met Obi-Wan Kenobi and Qui-Gon Jinn during a dispute over a Wookiee colony on the world of Alaris Prime in the Kashyyyk system, which Chewie helped lead against a Trade Federation incursion. He also courted his future wife Mallatobuck in his youth but they did not renew a romantic relationship until after the end of the Clone Wars.
I've only put in some of the highlights of Chewie's Legends life; there's a bit more information on Wookieepedia but the gist of it is all there.
Answer: The (horrible yet canonical) Star Wars Holiday Special shows Chewbacca has a home, wife, and kid.  He was most likely just living the normal Wookiee life with work and family until the Separatists invaded. His piloting skills, weapons proficiency, being on the front lines during the Clone Wars, the sash he wears, and implied resistance to the Empire makes me guess he was a soldier in the Wookiee army, but I can't find any sources on that.
Comment: The Holiday Special itself is, thankfully, *not* included within the current official canon, but it's still part of Legends/EU, as much as we might wish otherwise. Chewie's family is canon, though, and so is Life Day and several other elements from the Special but so far it hasn't been brought back into the fold 100%.
Answer: He most likely lived like a human before the Clone Wars rolled around. You must remember that Wookiees are as intelligent as humans and Chewbacca probably spent time with his family or did his hobby of repairing mechanical parts.
Comment: Can you source any of these claims? Is there any reason to believe Chewbacca was on Kashyyyk and not elsewhere?
Comment: What does it mean to live "like a human"? Do you mean, like, he lived in a home and a family as opposed to living in the wild? Is there any indication that Wookies lived significantly differently than humans, or that they were meaningfully lower in intelligence, technology, or civilization? I don't think there is.


What's the best ratio for sand-only concrete?

Question: I'm making concrete countertops, so sand-only is the way to go to reduce voids in the forms. (I've done a half dozen samples). I've looked everywhere for mix ratios, but it's a weird request, and I can only find either concrete with aggregate ratios, mortar ratios, or someone wants me to give them a bunch of money to tell me 3 numbers. My best guess is 0.5 water/1 cement/2 sand/ 0.0035 superplasticizer. The sample looks fine, and doesn't break when I hit it with a hammer... but I'm just worried that I'm doing it wrong, and it's going to crumble in 3 months or something.
Comment: I found this site reviewing another post here there was some free training [here is a link](https://concretecounter.infusionsoft.com/app/page/diy-concrete-countertops-free-training) concrete counter top training. I am sure they are trying to sell something but it may give you some pointers. I really liked an article that had some glow stones gave me an idea for the walk around my pool.
Answer: First I want to point out that the hardness has a lot to do with cure time and temperature. Longer cures (6-8 weeks) at cool temperature (say 50 °F) are harder. Short, hot cures are harder initially, and crumble later.
Generally, the 1pt cement : 2pt sand ratio is best and will have a 3500 psi compression stress. A 1:3 ratio will have less than 3000 psi. Gravel can actually strengthen the mix... up to 3 parts. The mix of choice (concrete) is 1pt cement :2pt sand : 3pt gravel, because it's the best/hardest (for the money).
Comment: If too much water is used, it will evaporate leaving air (entrained) which is weak. For cement, it's exactly 0.42pt water by weight per 1pt cement; so 0.42pt water, 1pt cement, 2pt sand and 3pt gravel. But the ideal amount (just enough to react with the cement) is actually less than what is used because gravel will absorb water. Slump is the term that masons use when "measuring" the water content. Slump is the best thing for you to read about I think. I think 1/2pt water would be close if the mix was bone dry. I would start with 1/3pt water, 1pt cement, and 2pt sand... and add water slowly.
Comment: Remember also less water stronger mix. Also fiberglass makes it extremely hard to work. You'll never have to worry about breaking, 3500psi with glass is jackhammer hard. Im sure u know this take a vibrating sander several if u have help and run it down all the edges, base, where ever u can get solid contact with the forms.
Comment: What about water?
Comment: I looked into slump, and it seems like it really is only about the workability of the mix, which is not very useful to me because for this application about 0.75 pt water makes the mix pourable to fill the forms, which drastically reduces the strength, from my understanding. That's why I'm using a superplasticizer. Your information is extremely helpful. Thank you.
Comment: @jgrant slump is a measure of workability... and a measure of wetness. Coincidence? Meh. Slump is a good test because it's a reproducible test. Also, have you considered fiberglass (GFRC)?
Comment: I tried a premix with fiberglass, but the set time was ridiculously long (like a few days, even though the bag said 12hrs). I live in an extremely humid environment, and relatively cold, so I think that might have something to do with it. I might dabble in glass fiber additives once I've got the moisture level right.
Answer: I use 10 parts sand and 4 parts portland cement and it seems quite suitable for most home projects ie trash can pads , picnic table pad , sidewalk etc
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to contribute here.
Answer:
High-strength concrete has a compressive strength greater than 40 MPa (5800 psi). In the UK, BS EN 206-1 defines High strength concrete as concrete with a compressive strength class higher than C50/60. High-strength concrete is made by lowering the water-cement (W/C) ratio to 0.35 or lower.

Bob Vila is looking at 6000 PSI (40 MPa) concrete for countertops.

Three days after pouring a counter with Countertop Mix, the compressive strength of the slab will achieve resistance equal to 2,000 pounds per square inch (PSI). At seven days, it reaches 4,000 PSI, and at full cure (28 days), the countertop slab will reach 6,000 PSI. All-purpose concrete at full cure reaches only 4,000 PSI. Choosing the mix with the higher PSI will provide better defense against cracks (and limit crack repair) down the line.

Concrete Mix Design as per IS 10262-2009 – Procedure and Calculations. If that math isn't beyond you as it is me, then you could figure it out. The important part is a water-cement ratio of 0.35 or lower.
Answer: You are overthinking. Concrete holds up huge buildings, your cup of tea or your wife's bottom will be just fine sat on any old mix you throw together. Just don't go thinner than 2". 3-4" is better.


Converted existing win7 instalation from mbr to gpt using gdisk, can't lauch OS

Question: I have existing win7 instalation which I just moved to 3 tb disc via clonezilla (2tb partition). I wish to extend that partition so I can use all 3 tb of disc space. I've read that because it's bootable partition it must be gpt based and it must be launched by efi firmware. As I do have uefi (asrock p67), I've conerted mbr to gpt by using gdisk, then rebooted my PC. But now during boot there is "Select proper boot software or insert media" after POST checks. I am obviously missing some step, but Googling around didn't get me the answer I was looking for
Comment: @PiotrK this could be of help: http://www.mpspartners.com/2013/10/how-to-convert-windows-7-on-mbrbios-to-gptuefi/
Comment: I believe to be able to boot in uefi, the OS installation registers itself against the BIOS. Therefore you need to install Windows in UEFI boot mode, not sure if you can convert an existing OS to UEFI.
Comment: @Marcelo I really don't want to reinstall OS and more than 1.8 tb of stuff. Is there any workaround for this? For example OS repair tool like fixmbr in old win xp recovery console?
Comment: @PiotrK - You are indeed correct there is indeed a command you can run.   But the error in question indicates there isn't an EFI partition can you confirm it actually does exist and contained the proper files?
Comment: @Ramhound I was able to boot Linux Live cd and I was able to mount all partitions and access ntfs filesystem, all files seems ok and in place. What is the EFI partition?
Comment: @PiotrK - The partition that contains the EFI files.  I suggest you research what files it should contain.
Answer: Okay, thanks to @Marcelo comment I was able to figure this out, 10 hours later...
1.) First, the ASRock P67 Pro3 has undocument feature (or bug, if you wish to call it so), it is amusingly hard to boot a CD as UEFI. The UEFI option will keep disapearing from boot menu even if you set your SATA mode to AHPI (tested on BIOS 40 version)
2.) Sooo, prepare a UEFI pen-drive (at least 4 gb) with Windows Installer. Instructions here: http://www.eightforums.com/tutorials/15458-uefi-bootable-usb-flash-drive-create-windows.html
3.) Make a backup of system partition. As in my case I was upgreading from old drive, I've already had a backup on it, but in your case do a Clonezilla or similiar backup of everything to another drive of the same or higher capacity
4.) Format drive and set it up as GPT (I used Gparted for this)
5.) Install Windows 7 from pen-drive boot in UEFI mode (F11 after POST checks)
(If it says that it cannot be installed in GPT drive, then you didn't boot it in UEFI mode)
6.) Use Clonezilla again to overwrite windows instalation with your backup
And now here comes the tricky part: if you try to boot your Windows now, you will encounter 0x0000007B BSoD
1.) First of all, boot your Win7 installation pen-drive once more, select repair and wait until it tell you that there were some problems and were repaired (when scanning for system list)
2.) In my case I had to boot pen-drive installer again and select repair again, so the Windows would fix drive file system. Don't know if this is manditory step or just sanity check of NTFS filesystem
3.) Boot pen-drive installer for the third time and select console, then enter:
bcdboot C:\windows
(replace C: with your windows drive letter, you can see it in the OS picker tool just before you picked console). Then enter
4.) It still won't boot up, until you turn SATA mode back to IDE. I don't know why the hell it works, but it works.
5.) After booting you will be prompted to install disk driver, which will require reboot
6.) FINALLY! You should have Windows 7 working on 2tb+ hard disc :-)
Comment: You also could have used gdisk in Windows to change the type ID of the 100MB partition from (gdisk)0700 to ef00. Then extended it, reformatted it with FAT32. Then bcdboot would have worked directly.


What is the etymology of "Pasifika"?

Question: What is the etymology of the term "Pasifika", which can mean the Pacific Islands, people of Pacific Island heritage (in a New Zealand context), or a festival held in Auckland about Pacific Island culture?
Comment: I feel like I should give this question a +1 and the answer a -1 (or vice versa) just so that proper order in the universe can be preserved.  :)
Comment: who knew ??????
Answer: It's a New Zealand English term derived from the Samoan version of a Portuguese version of a Latin phrase.
From The New Zealand Herald

Pasifika is an odd term, and one gaining increasing currency outside
  the annual festival at Western Springs. Essentially, its the
  samoanisation of a Portuguese nod to the Latin phrase Mare Pacificum,
  or peaceful sea, so named by navigator Ferdinand Magellan.
Comment: Wait... did you... at the same time...
Answer: It comes from Niuean. Favoured by publication editors, academics and government as way of raising  awareness about the diversity of cultures.
Comment: Can you elaborate? Which cultures? What/where is Niuea?
Comment: I can't elaborate with respect to etymology, but Niue is a tiny, single-island (well, coral reef) country in the Pacific, in free association with New Zealand (i.e. all Niueans are citizens of New Zealand). https://en.wikipedia.org/wiki/Niue

What is the etymology of "Pasifika"?


What does "abstract aspects" of a subject mean?

Question: For example, political theory deals with the abstract aspects of politics, and similarly, there is theoretical (abstract) physics. Why are they called abstract or theoretical? Is something that we study not supposed to be a reflection or a representation of the real or of what happens in practice?
Comment: This reads like a student homework/essay exercise. Is it?
Comment: @Buffy no, sir. I'm trying to study some books written in English on my own and I often come across "abstract" and "theoretical". I did not have an English-medium education up until college and it's very difficult for me because most of the essential and recommended readings for my field of study are in English only.
Comment: Abstract (and abstraction) is not the same as Theoretical. But any good dictionary or a web search will give you the answers and point out the distinction.
Comment: @Buffy with the level of understanding of English that I have, dictionaries only serve to confuse me.
Comment: @Buffy consider this: "political theory is an abstract model of the political order". Is it not equivalent to saying "political theory is a theoretical model of the political order"?
Answer: Ok, let me try to clarify the difference. As an English writer, I hope it helps. But you could also translate the terms into your own language and seek sources for those terms.
In theoretical work we form a hypothesis about something unknown (or only partly known) and then seek evidence as to whether the hypothesis is true or not. The subject of the "theory" might not even exist. In theoretical work you are exploring the unknown. You are attempting to add "detail" from the real world - evidence to support the hypothesis or not.
Abstraction, on the other hand, is a process of removing details from a complex topic to try to come to the essence of some question. For example, democracy is an abstract concept that exists in the world in many forms, some of them very messy. The abstract concept of democracy removes much of the detail to arrive at some core "essence" or abstraction of the idea. So, the US and the UK are both democracies, but have a very different governmental structure. But, there is not really such a thing as a "pure democracy" conforming to the idea without any of those messy details. Abstraction lets us work with very complex systems in a simpler form.
Language, actually, is a form of abstraction. Many of the things we speak of would be impossibly difficult to discuss without the simplification of removing details thought to be unnecessary to the essence. If you want to discuss me for example, then, for most purposes, you don't need to know my height or hair color. The me you discuss is an abstraction.
It would be possible to work in the political arena in a theoretical manner. One could devise a theory of government not represented in the world and then seek evidence as to what the effect would be. Science Fiction does a lot of that sort of thing.
On the other hand, one can do physics as a form of abstraction, looking at what exists in the world and trying to "abstract" what is making it behave like it does. The orbiting of the Earth around the Sun was explored in this way. See Heliocentrism. At the time of those explorations, there was a Theory that the Earth was the universe (or, more properly, a religious dogma). But in the end, that theory proved to have little evidence.
Note that the "elliptical" path of the Earth around the Sun is itself an abstraction. The Earth is deflected slightly from the ideal elliptical path due to various forces, such as passing asteroids.
And, sometimes a field has to go back and forth between theory and abstraction, when a theory needs to be revised due to contrary evidence, leading the practitioners to try to devise new abstractions that might be better representations other aspects of the data not originally considered.
So, you can't say that it is all abstraction or all theory. You need to consider the process by which researchers in a field actually work.
Finally, theory, itself, is an abstraction.
Comment: Wow @Buffy that is amazing. You've explained it in very simple words. There's nothing I couldn't understand about it. Thank you so much. You have no idea how significant this is. Believe me, dictionaries aren't that helpful to us non-natives because they try to explain everything with as few words as possible. I was about to give up reading books written in English but this has made me change my mind. The examples you used were familiar to me and that made the explanation just what I wanted. Thank you so much.


The Fed has a $4.5 trillion balance sheet: where did they get that money?

Question: Who paid for that $4.5 trillion balance sheet?
https://www.cnbc.com/2017/09/19/hedge-fund-titan-ray-dalio-says-to-succeed-in-markets-you-need-to-bet-against-the-consensus--and-be-right.html
Comment: The writing in that article is terrible. I can see how anyone could be confused by this article
Answer: "Money" in this case is a liability of the Federal Reserve - mainly reserve balances held at the Fed, but also curency in circulation (which was largely stable).
Like any other entity, the Fed creates liabilities by issuing them. It did this by buying bonds in the open market (mainly Treasury and mortgage securities).

The seller of the bond (more likely, its bank) will get a deposit ("money").
The Fed gets an asset (the bond).

As people have found out, there is little to stop the Fed from doing this. They get matched assets and liabilities, and the assets it buys pays a higher rate of interest than its liabilities.
Other entities have to worry about funding risk when conducting such trades -- others may fear bankruptcy, and not lend them money. Very few people worry about the central bank running out of money.


How can I randomly select one element from a vector or array?

Question: I have a vector where the element is a (String, String). How can I randomly pick one of these elements?
Answer: You want the rand crate, specifically the choose method.
use rand::seq::SliceRandom; // 0.7.2

fn main() {
    let vs = vec![0, 1, 2, 3, 4];
    println!("{:?}", vs.choose(&mut rand::thread_rng()));
}

Comment: I'd disagree. The only differences with this approach and other languages are the need to put the trait in scope and manually needing to specify where the rng state comes from.

Perhaps a tad more explicit than usual, but I find it okay.
Answer: Using choose_multiple:
use rand::seq::SliceRandom; // 0.7.2

fn main() {
    let samples = vec!["hi", "this", "is", "a", "test!"];
    let sample: Vec<_> = samples
        .choose_multiple(&mut rand::thread_rng(), 1)
        .collect();
    println!("{:?}", sample);
}

Answer: Another choice for weighted sampling that is already included in the rand crate is WeightedIndex, which has an example:

use rand::prelude::*;
use rand::distributions::WeightedIndex;

let choices = ['a', 'b', 'c'];
let weights = [2,   1,   1];
let dist = WeightedIndex::new(&weights).unwrap();
let mut rng = thread_rng();
for _ in 0..100 {
    // 50% chance to print 'a', 25% chance to print 'b', 25% chance to print 'c'
    println!("{}", choices[dist.sample(&mut rng)]);
}

let items = [('a', 0), ('b', 3), ('c', 7)];
let dist2 = WeightedIndex::new(items.iter().map(|item| item.1)).unwrap();
for _ in 0..100 {
    // 0% chance to print 'a', 30% chance to print 'b', 70% chance to print 'c'
    println!("{}", items[dist2.sample(&mut rng)].0);
}

Answer: If you want to choose more than one element then the random_choice crate may be right for you:
extern crate random_choice;
use self::random_choice::random_choice;

fn main() {
    let mut samples = vec!["hi", "this", "is", "a", "test!"];
    let weights: Vec<f64> = vec![5.6, 7.8, 9.7, 1.1, 2.0];

    let number_choices = 100;
    let choices = random_choice().random_choice_f64(&samples, &weights, number_choices);

    for choice in choices {
        print!("{}, ", choice);
    }
}

Answer: If you also want to remove the chosen element, here's one way to do that (using the rand crate):
let mut vec = vec![0,1,2,3,4,5,6,7,8,9];

let index = (rand::random::<f32>() * vec.len() as f32).floor() as usize;
let value = vec.remove( index );

println!("index: {} value: {}", index, value);
println!("{:?}", vec);

Rust Playground
remove(index) removes that value at index (shifting all the elements after it to the left) and the returns the value that was at index (docs).
Answer: Another way of getting a random value is via the indexing method using rng.gen_range and vec.get(). This also prevents the borrowing of the value (which occurs with the vec.choose() method)
fn main() {
    let mut rng = rand::thread_rng();

    let my_strings : Vec<&str> = vec!["a", "b", "c"];
    let random_string_index: usize = rng.gen_range(0..my_strings.len());
    let string = my_strings[random_string_index];
    println!("{:?}", string);
}


New customer registration emails sent from server not received by some customers

Question: New customer registration emails that send out the link to confirm account are logged as sent from server in the linux server logs but are not received by some customers. For example: new account with firstname.lastname@example.com sent and I received it right away. New account with email email@example.com sent and I never received. I figured that this is an email filter issue on the receivers end, but obviously we want ALL of our customers to receive the email. Does the following extension help with that issue too or please advise.
http://www.magentocommerce.com/magento-connect/aschroder-com-smtp-pro-email-free-and-easy-magento-emailing-for-smtp-gmail-or-google-apps-email.html
Answer: Deliverability issues can be a number of things including:

Email/domain blacklisting
SPF/DKIM and DomainKeys, SenderId configuration
Firewall/port configuration
Mail transport misconfiguration

Check <code>/var/maillog</code> on your server (for Linux, not sure for Windows-side) and ensure proper configuration of sendmail or postfix (again, Linux).
Ashley's extension isn't going to fix any of the above issues for you, but it will allow you to point to a 3rd party email delivery service which manage the above problems.
Some trustworthy SMTP relays:
http://sendgrid.com/
http://www.socketlabs.com/
https://www.mandrill.com/

Beyond this basic troubleshooting I'm afraid that email delivery issues are probably more fit for Serverfault.
Comment: http://mandrill.com/ is another SMTP relay option
Comment: Updated Phil's answer to include the suggested Mandrill option.
Answer: Reality is that you will never be able to send email which is received by 100%.
In most cases using SMTP Pro will increase your chances that the email will come through for the simple reason that your email is being sent from a server which is specifically set up to send emails (return path, reverse dns lookup, reputation actively monitored).
Answer: It sounds like you might have some deliverability issues. SMTP PRO EMAIL is a very popular extension for Magento: it allows you to use an external SMTP service. You need an SMTP service to use with it. So the steps are:

Sign up for a SMTP relay service
Install SMTP PRO EMAIL
Insert the SMTP service credentials in the extension

There are several SMTP relay services that you can use. For example: MailUp, SendGrid, Mandrill, Mailgun, MailJet, and others.
We at MailUp include SMTP relay free of charge with our email marketing platform, which is integrated with Magento. For more info, see http://www.mailup.com/landing/magento/