Where to get difficulty data for all crypto coins?

Question: I need to get difficulty data and exchange rate for past 10 days for making a graph out of it (i.e., for all coins). Can anyone suggest where can I get it?
Answer: I suggest you take a look at CoinWarz's API, you can collect your own set of data for a period of time out of it (say 10 latest days, format it your own way and save it on a spreadsheet). You'll need to generate an API key on their site, and then you could either use your own scripts, or visit the API endpoint manually to collect the data, if you so desire (remember that you need your own API KEY to get the data).
Once you have the data you could generate your own graph within a spreadsheet or your  software of preference.
Recomendations: OpenOffice (info on graphs, download page), LibreOffice (info on making graphs, download page).
Here's the reference for that specific API call (quoted from coinWarz's documentation)

Mining Profitability API
The Mining Profitability API provides profitability data listed on CoinWarz.com. This >data can be for all coins or for specific hashing algorithms: SHA-256, Scrypt, Scrypt-N, >X11, X13, Keccak, Quark, Groestl, JHA, Blake-256, NeoScrypt, Lyra2RE
API Endpoint
http://www.coinwarz.com/v1/api/profitability/?apikey=YOUR_API_KEY&algo=all
API Call Usage
  This value will be deducted from your API usage limit each time you successfully call this API.
Required Input Parameters
  All input parameters are required and not case sensitive.
Parameter - Data Type - Description
ApiKey - String - Provide your approved API key for this parameter.
Algo - String    - Provide one of the the following values for this parameter:
  all, sha-256, scrypt, scrypt-n, x11, x13, keccak, quark, groestl, jha, blake-256, >neoscrypt, lyra2re

Remember that each time you either visit the API Endpoint or call it to fetch the info with a script, it'll count as 1 call out of your limit, as noted on their documentation.
Now the easiest way for you to collect the data if you're not into programming your own stuff, would be to use some REST client extension for your browser such as Postman REST client (If you use a different browser look into their respective stores)
It's fairly easy to get used to and you do not need to code your own scripts.
Here's an example of how the info would be rendered for to you:

(remember you need to place your own API key in lieu of the placeholder "YOUR_API_KEY")
I recommend you use the JSON and PRETTY options so the data is more human readable.
You can then export this to a CSV file using this awesome tool (JSON to CSV)
This site allows you to pase the JSON data and transfer each value pair to a CSV file
Here an example of how it looks:

Now you have a (set of, since you need multiple days) CSV file that you can use for graph creation using the aforementioned Office Suite Tools.
Hope you'll find this helpful, and good luck!
Answer: Are you looking for an API or for just the data?
You can't really find every last coin as more are comign each and every day.
However, coinwarz or coinchoose usually have most of the data.
coinchoose has current+historic data available via json api
Answer: Maybe your answer is in coin warz.
Comment: YoMismo, thanks for your answer. I just added a post notice because I think you could explicitly show where on "coin warz" the OP could find the information they are looking for. Thanks!
Comment: The information is exactly in the link I posted, there you have the difficulty and the coins mined up till now. I thought there was nothing else to explain since the information is right there and if that information is posted here it would be easily outdated since it changes fast.
Comment: It seems like the OP wants to use the data for making a chart though, so they probably are looking for a way to get raw data in large amounts, not just to look at the current difficulty data that is displayed on the front page of coinwarz. I agree, though, coinwarz is a great resource for this, and posting current difficulty data would not be worthwhile as it would go out of date very fast.
Answer: Going by the apis given in Coinwarz documentation, it seems that there is no way of getting historic coin difficulty data.


Profile 2 Not showing fields on user edit page

Question: I install Profile 2 module and create separate registration page.
after login with this user
not showing that fields on edit user page
Can any one help me in this
Comment: What is your Drupal version? Can you see the fields as the administrator? Have you checked the user's permissions?
Answer: Give the permission "[PROFILETYPE]Edit own profile" under "Profile2" section to the respective user roles.
And the fields will be appeared on edit user page.
Comment: this should happen automatically? I'm not getting any profile2 fields on my edit page and those permissions are set.. :/
Comment: even i am having the exact same problem..however in my case the field which are marked as required are displaying but the rest fields are not
Comment: I have the same issue,I want profile 2 fields to appear on the same with other account fields.How can I do that?
Answer: @theBraveDave - THANK YOU THANK YOU THANK YOU!! - I don't have enough "points" to vote-up your answer, but that fixed my problem with profile2.
Specifically:

If you're using Panels, check the admin/structure/pages admin page has the /user/%user/edit turned off
When editing the profile type (from admin/structure/profiles), make sure "Provide a separate page for editing profiles" is turned off

Then suddenly it started working again. (I'd recently done a Drupal core update plus ctools plus other key modules and suddenly profile2 had stopped working. It appears that somehow the user/edit page was turned back on again and it was as simple as turning it back off ("simple" once I read @theBraveDave's post - thank you!)
-Tom
Answer: Using profile2, the first 'main' profile you set up needs to have the box 'Provide a separate page for editing profiles' unchecked on the administration page before it will display on user/[id]/edit forms.
Admin form at /admin/structure/profiles
Answer: I was having the problem where I would be on my user edit page and I could see my profile2 profile buttons on the top right. Clicking on them though would just load the same drupal core user/edit page. The profile link was highlighted like I was on that particular profile2 profile edit page, but only the standard core user edit form fields were showing.
I then remembered I was toying around with Drupal Panels and found that I had enabled the Drupal Panels Page- User edit template    /user/%user/edit
I disabled this panel page and then when I clicked on my profile2 profile button from the standard Drupal core user/edit page my Profile2 profile loaded properly. Hope this helps someone.


ASP.NET MVC add HiddenInput attribute to Model in DLL

Question: I'm working on an asp.net MVC 3 application which is using Data Models from a compiled library.  However I would like to be able to add the following declaration to some data model properties in the compiled dll:
[HiddenInput(DisplayValue = false)]

The problem is that I don't have the source for the DLL and the author doesn't want to introduce a dependency on System.Web.Mvc.  Is there a way, using partial classes or something like that, that would allow me add this attribute?
Mark
Answer: No, there is no way. Attributes are baked in the metadata of the assembly at compile time and existing classes cannot be modified at runtime. As far as partial classes are concerned they only work within the same assembly.
Also if the authors of this assembly don't want to introduce a dependency in their library with System.Web.Mvc they probably have reasons for this. Obviously, you, as an MVC developer should use view models which are classes specifically tailored to the needs of your views and then map between the domain models (stuff that comes from different libraries, ...) and view models. Then you would pass those view models to the view and not the domain models. Of course your view models will have all the necessary metadata and formatting such as DisplayName, Hidden, ... To ease the mapping between those two classes you could use AutoMapper.
Answer: You could map your compiled library Data Models to a set of local models.
If you were to map your compiled library Data Models to your own set of local models you could do what you like.
You can do this manually or look at a tool like AutoMapper.
Answer: Add reference to system.web.mvc to your class project.


PDE: Heat equation problem

Question: I'm trying this PDE: $$u_t = u_{xx} + g(x);\quad x\in[0,\pi]$$
With boundary conditions: $$u_x (0,t)=u_x(\pi,t)=0$$
And initial condition: $$u(x,0)=f(x)$$
I think variable separation proposing a u(x,t)= X(x)T(t) could be a good approach but: $$Let\quad u(x,t)=X(x)T(t)$$ $$\Rightarrow X(x)T'(t)=X''(x)T(t)+g(x)$$
Then trying to separate I get: $$\frac {T'(t)}{T(t)}=\frac {X''(x)}{X(x)}+ \frac {g(x)}{X(x)T(t)}$$
I don't know how to make that last last function just dependant of one variable. Any ideas or am I taking the wrong path?
Answer: If $u$ is a solution of the given problem, then
$$
v(x,t)=u(x,t)+\int_{0}^{x}\int_{0}^{x'}g(x'')dx''dx'-\frac{1}{\pi}\int_{0}^{\pi}g(y)dy\, (t+x^{2}/2).
$$
is a solution of
\begin{align}
v_{t} &= u_{t}-\frac{1}{\pi}\int_{0}^{\pi}g(y)dy=u_{xx}+g-\frac{1}{\pi}\int_{0}^{\pi}g(y)dy=v_{xx} \\
v_{x}(0,t) &= u_{x}(0,t) = 0, \\
v_{x}(\pi,t) &= u_{x}(\pi,t)+\int_{0}^{\pi}g(x'')dx''-\frac{\pi}{\pi}\int_{0}^{\pi}g(y)dy = u_{x}(\pi,t)=0. \\
v(x,0) &= u(x,0)+\int_{0}^{x}\int_{0}^{x'}g(x'')dx''dx'-\frac{x^{2}}{2\pi}\int_{0}^{\pi}g(y)dy
\end{align}
So the inhomogeneous problem is reduced to the equivalent homogeneous problem
\begin{align}
v_{t} &= v_{xx}, \\
v_{x}(0,t) &= 0,\hspace{5mm} v_{x}(\pi,t) = 0,\\
v(x,0) &= f(x)+\int_{0}^{x}\int_{0}^{x'}g(x'')dx''dx'-\frac{x^{2}}{2\pi}\int_{0}^{\pi}g(y)dy.
\end{align}
Answer: The short answer is you cannot assume, in general, separation of variables in a non-homogenous problem. Since your boundary conditions are homogenous, solve the alternative problem $\theta_t = \theta_{xx}$ with the same boundary conditions (no matter the initial condition) and then expand:
$$ u(x,t) = \sum_n T_n(t) X_n(x), $$ where $X_n(x)$ are the eigenfunctions of the homogenous problem (I think they are $X_n(x) = \cos{n x}$). Since the functions $X_n$ form a complete basis on $0 \leq x \leq \pi$, any smooth function can be approximated/represented according to the series above.
Plug the series in the original PDE and use the orthogonality properties of $X_n$ to find the coefficients $T_n(t)$, which will satisfy a first order differential equation. The initial condition for $T$ can be extracted from the initial condition of $u$ using, again, orthogonality.
I think this is often referred to as Fredholm's alternative.
Hope this helps!
Comment: Could the downvoter please tell me where I am wrong?

PDE: Heat equation problem


How can dfa have more than one sink state? Isn't it the same state?

Question: I can't understand How can dfa have more than one sink state? Isn't it the same state? Maybe there is some examples
Answer: Consider the following automaton.

There are two sink states: $q_3$ and $q_4$. Of course, any automaton with multiple sink states is equivalent to an automaton with at most one sink state, and even to an automaton without any sink state if the automaton is not complete.
Comment: Even for complete automata we can artificially remove sink states by splitting them into a pair of non-accepting states pointing to one-another. We get a sink connected component, a kind of trap.

How can dfa have more than one sink state? Isn’t it the same state?


is there a basic custom application with Apex classes and a few visualforce pages to get started?

Question: I am looking to jump-start custom application development for salesforce. I am hoping that there is a skeletal apex application (similar to basic hello world web apps for j2ee or node.js platform) that  I could import into my Eclipse ( with Force.com plugin) and begin incrementally adding  pages and features.
Answer: Trailhead is best guide for interactive learning.
Another good option is apex and visualforce guide.
Comment: I have used trailhead tutorials and also viewed the apex and visualforce guides. I still don't know how to create a custom application package.
Comment: What do you mean by package? Here you can simple install ide of your choice and create a project with entering your orgs credentials. Then it'd be connected to your Salesforce environment where you could start creating your application.
Comment: by package , I mean a managed package which I could put on appexchange and have others try it out in their org.
Comment: Packages are being created from setup menu of salesforce. Eclipse is only for updating your code. You can find enough information over the web about it. I could not find package related question in your original question, so from next time please add sufficient information to your question.


What is the difference between Twenty eleven & roots framework?

Question: Just amazed by the usability of Twenty eleven wordpress theme & extensibility of roots theme http://www.rootstheme.com
Now in conflict. I want all twenty eleven features to use on extensive features of roots. Is it possible to add boilerplate and bootstrap to use with twenty eleven theme? How?
Comment: yes you can, make a child theme of twentyeleven and go code. Nobody else is gonne do this for you. http://codex.wordpress.org/Child_Themes
Answer: It seems like there are two questions here: "how do I include Boilerplate/Bootstrap in Twenty Eleven?" and "how should I choose between these two theming options?". I'll try to answer both:
Boilerplate/Bootstrap in Twenty Eleven
I'll start by saying this probably isn't a good idea. With that said, the easiest way would be to

make a child theme of Twenty Eleven
Download Boilerplate and/or Bootstrap and place their img/css/js files inside the child theme
override the header.php in the child theme to include the css files you're interested in and the modernizr script from Boilerplate
override the footer.php to include the JavaScript that you're interested in

After this point, you would need to begin modifying pieces inside of Twenty Eleven so they can take advantage of these two frameworks. How you would do this would depend entirely on what you were trying to build, and it's the sort of thing you would need to ask individual (and quite specific) questions about.
Basically, just adding Boilerplate and Bootstrap to Twenty Eleven won't do much. What will happen is that they'll override some CSS definitions and make Twenty Eleven look broken until you fix it (this is especially true if you include Boilerplate's CSS after the default Twenty Eleven style.css file). They could help when it comes to styling custom content, or pages that you modify quite a bit, but would require a lot of work.
My guess is that, if you want to use Bootstrap, or you like the way Boilerplate resets things and provides best-practices, you're better off just making your own custom theme, or using Roots. If you just want to make Twenty Eleven easier to modify, you might want to look at including the pieces of Boilerplate/Bootstrap into your child theme's style.css as you need them.
Choosing between Twenty Eleven and Roots
The Twenty Eleven theme is a great showcase of WordPress' features, but it makes a lot of assumptions in the way its put together. As suggested in comments, you could just create a child theme of Twenty Eleven and start changing things (adding HTML5 Boilerplate pieces, for example), but this would require a good deal of work. The main problem with this idea is that Twenty Eleven is a complete visual as well as structural theme.
Roots on the other hand is just a structural theme. It starts you off with a lot of the markup and WordPress functionality that you need, but doesn't make nearly as many assumptions about how you want your design to work. The gotcha here is that you might end up needing to re-implement functionality or styles that already exist in the Twenty Eleven.
At work we have our own base theme which is similar to, but less robust than, Roots. Partly, our theme is less robust on purpose. We don't want to use child themes because we don't want the style or structure of our custom designs changing out from under us in the case of an upgrade. I definitely prefer not to touch the themes included with WordPress and just build my own themes from as close to scratch as is feasible.
The bottom line? With Twenty Eleven you would need to design by changing design that already exists, and with Roots you would be building up from your own design. There's no right or wrong here, it's just a matter of preference.


What causes matter to initially rotate/spin/orbit?

Question: What causes matter to initially rotate/spin/orbit? All I can find is the statement that in space particles of dust/gas/matter contract into a spinning disk due to gravity (to form stars, solar systems, galaxies etc.), with no explanation as to why the spin began. I see a lot about the conservation of angular momentum, but these discussions all presume that the 'spin' already exists. What caused the spin in the first place? Shouldn't gravity simply attract particles of dust, gas or matter together along a straight path till they collide, as a magnet does to a paper clip? The magnet does not make the paper clip revolve around it, and if I fall off of a building, I don't spin around the earth. I fall in a straight path till I collide with the earth. What am I missing?
Comment: When an object has speed, it isn't attracted in straight line. It simply orbits.
Comment: Hi Tally, and welcome to Physics Stackexchange! As per our request [here](http://physics.stackexchange.com/help/behavior) I've edited out the signature from your post, restricting it just to the physics. (Yes, this is a different policy from many other websites out there.) Feel free to put any personal information in your profile, though, where anyone who is interested can see it.
Comment: Possible duplicates: http://physics.stackexchange.com/q/23104/2451 , http://physics.stackexchange.com/q/12140/2451 and links therein.
Answer: The Universe starts out as a nearly perfectly smooth distribution of matter with tiny perturbations to the density and velocity distributions across it. If you pick any region of this early Universe, it almost certainly has an angular momentum, or in other words it has a slow net spinning motion. As matter collapses under gravity, angular momentum is conserved and the slow spin of a large object becomes the fast spin of a more compact object. This is analogous to spinning on a chair with your arms out then pulling them in - you spin faster.
Answer: If you reverse your question, the answer will be obvious. You write no explanation as to why the spin began. Try to think the other way: what zero spin would mean? That would mean that two pretty random objects have their relative speed directed exactly in the same direction as the vector connecting their center of masses. Which is rather unlikely is you consider two objects with random speeds.
The magnet does not make the paper clip revolve around it just because magnetic field is not gravity and if you fall off of a building, you don't spin around the earth just because 1) Earth is rather big compared with a building 2) you do not just fall in some random direction with some random speed but start falling with zero velocity (which is rather unlikely). If you take building somewhat larger than Earth and jump from the top in some random direction, most likely you will.
Answer: Kyle has the right answer to what caused the spin in the first place (small perterbations in the early universe) but in answer to your other questions:

Gravity does attract matter along a straight path, it is the combination of linear momentum and gravitational pull that creates centrifugal force, which produces an orbit.  Think about water in a bucket that you swing over your head, it stays in the bucket because of centrifugal forces, it doesn't fly away because of the pull of your arm (analagous to gravity), and it keeps spinning because of it's momentum.
The magnet and falling examples only appear to break the rules because of the difference in scale.  Consider that the paperclip does not orbit the magnet from gravitational forces either.  For any given attractive force, the speed required to produce an orbit must exactly balance the centrifugal and attractive (centripital) forces; too fast, and the orbit becomes hyperbolic, too slow, and the objects collide.  In either case, it is the component of motion tangential to the attractive force that matters.  For you to orbit the earth at a distance of the height of a building, you would have to be traveling at hypersonic speeds in a horizontal direction; similarly for the paperclip and magnet.

As it happens, I just finished reading a good book that walks through the change in mindset that allowed modern science to develop these concepts.  You might be interested.
Example

As you can see in the article on centripital force mentioned above, the acceleration of an object in uniform circular motion is:
$ a = \frac{v^2}{r} $
Solving for $v$ gives:
$ v = \sqrt{a r} $
We know that the acceleration of gravity at the surface of the Earth is about 9.8 m/s^2 and we can look up that the radius of the Earth is about 6,000 km.  Putting this together, we see that a horizontal speed that would produce a centripital force significant enough to keep an orbit at the surface of the Earth would be:
$ v = \sqrt{9.8 \frac{m}{s^2} \cdot 6,000,000 m} $
$ v \approx 7,500 \frac{m}{s} $
Given the speed of sound in dry air of 350 m/s, that means you'd have to jump off of that building at more than mach 20 horizontal to the ground to orbit.
Answer: is it not because of mass? the surface being lighter than the core would have to travel faster forcing the body to rotate. not too sure but i think everything has travelled the same distance in space but the lighter the mass the longer the route you take (spinning around heavier objects). like the naughty soldier running in circles round the marchers only covers the same distance but travells much further.
hope this makes sense.


how disable edit for a certain content type, and a certain role,

Question: in a drupal 7 site i have been given to maintain, it seems that permissions are not working as expected. I check and uncheck the buttons for a certain user role, but that user role always has the right to edit any node that belongs to this particular type.
1. What could be the cause for this?
2. If this is not working from the gui, how i could achieve something similar with code?
I would appreciate an example
Answer: In /admin/people/permissions Under "Node" category you can uncheck the permission "Edit content X" for your desired role.
I would recommend using this module if your site has a lot of modules/permissions since due max upload vars limitation by PHP could led to not storing your chages when submitting the form.
Also by code you can implement hook_node_access and put there some logic. Take a look on how core does it.
/**
 * Implements hook_node_access().
 */
function node_node_access($node, $op, $account) {
  $type = is_string($node) ? $node : $node->type;

  if (in_array($type, node_permissions_get_configured_types())) {
    if ($op == 'create' && user_access('create ' . $type . ' content', $account)) {
      return NODE_ACCESS_ALLOW;
    }

    if ($op == 'update') {
      if (user_access('edit any ' . $type . ' content', $account) || (user_access('edit own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
        return NODE_ACCESS_ALLOW;
      }
    }

    if ($op == 'delete') {
      if (user_access('delete any ' . $type . ' content', $account) || (user_access('delete own ' . $type . ' content', $account) && ($account->uid == $node->uid))) {
        return NODE_ACCESS_ALLOW;
      }
    }
  }

  return NODE_ACCESS_IGNORE;
}

Comment: permissions via GUI do not take into effect. The module also did not help. How the above code should be transformed to a module, so as a user role cannot edit a certain content type?
Answer: In answer to your first question, this existing answer about debugging access permissions should be able to help you uncover what is causing this unexpected behavior.
https://drupal.stackexchange.com/a/17435/34061


'be said to be' what does this mean?

Question: Here goes example,
"The earliest recorded use of "queer" as a form of homophobic abuse is said to be a 1984 letter by John Sholto Douglas, the Marquess of Queensberry."
Comment: People say that that's what it is.
Comment: 1984 seems rather recent. My father told me he met 'queers' in the Royal Air Force during World War II and that was 1939-45.
Answer: [be] "said to be" is a passive locution used to assert something as a fact supported by authority without actually specifying that authority.
Notice that your example is well chosen.
It asserts as historical fact that no one used "queer" as a written slur against homosexuals before John Sholto Douglas, notoriously responsible for the prosecution and incarceration of Oscar Wilde. It is eminently plausible that Douglas used the slur in writing. It is not inherently plausible that Douglas coined the term. We cannot judge the credibility of whoever asserted these propositions because no name is provided; in fact we cannot even determine whether the person who allegedly said them is historical or fictional. We cannot judge the weight of the evidence because we are provided neither evidence nor a citation to what is implied to be evidence. Ultimately, even the author refuses to affirm these propositions and attributes them to some mysterious other.
"Said to be" is a rhetorical device implying the truth of a proposition without personally affirming it and without providing evidence or authority for it. All writers should have it in their rhetorical armamentarium, and all readers should view it with suspicion.
Answer: It means "people said that the earliest recorded use of "queer" as a form of homophobic abuse is a 1984 letter by John Sholto Douglas, the Marquess of Queensberry.

'be said to be' what does this mean?


Surveys for mobile- from UX point of view is it better to implement questions on 1 scrollable landing page or 1 question-1 page flow?

Question: Currently, I'm redesigning the survey and I'm looking for any use case/research in which flow increases completion rates. Does someone have any insights?
Comment: What is your use-case? I reckon the two approaches tackle different business needs. Could you expand a bit more?
Answer: Depends
Both are great, and solve the user problem
I thinking you should use a scrollable landing page, when you have a question with similar context and could group them.
You can use a page flow, when the questions doesn't have a similar context.
Answer: If you are filling some "Form" alike it's better to use a scrolling page. But if it is for a survey/question, I rather choose 1 question-1 page (with a progress bar) it encourages the user to more focused on filling the question.
Answer: In my project, I use questions on 1 page, because I have an interviewer who can skip questions and choose which ones to voice.


How to click on an item in a list or a library and be able to add more details about it?

Question: I want to create a list where view can look like Employee_Name, Employee_ID, Start_Date. Now if I click on Employee_Name, it should bring up more details about that employee like designation etc. Is it possible to do this SP?
Comment: Yes. Do you want Employee_Name to be "single line of text" or a "person or group" field type?
Answer: You can hide Designation etc. from View, and Employee_Name can be Title field renamed, once you click Title by default it will open details of the item in popup which will include Designation.
Simply click Title column in List Settings and change the column name to Employee Name.
Rename Title column in SharePoint List


Whitelist VPN provider's IP address in cloud service provider

Question: I wonder how safe is it to whitelist honorable VPN service provider's IP (for example NordVPN) in, for example Azure/AWS to use RDP/SSH? Is it any better then whitelisting local ISP's IP assigned to me?
Comment: The IP will be shared among multiple VPN users (which is one of the key privacy mechanisms of VPN services) while the IP assigned by the ISP will usually be exclusive to you for the time you're logged on.
Answer: While restricting the address space that is allowed to access the ports is always a good idea, both your options are equivalent, generally speaking.
If your local ISP has as many customers as the VPN provider - or both numbers are in the same ballpark - you have equivalent security gains if the ISP uses an IP pool where you regularly get a new IP from that pool. There's one thing to consider though: VPN providers allow access from everywhere for basically everyone who wants. This is either a pro for you while you travel and do not have an IP from your local ISP assigned or a pro for an adversary that is not able to get service from your local ISP.
If restrictions on the ACL are so wide, either way, you should still consider the ports public and use public key authentication rather than password authentication and keep your machine up to date.
If you only use the currently assigned ISP's IP or if your ISP does not use a pool, you'd be better off using that IP to whitelist.
If you need to access the services while away, you might host a VPN proxy in your home network
Comment: I have a VPN server at home both to access my home network and to provide me some privacy
Comment: Thank you for the extended explanation. In the end I've chosen to use Dedicated IP, provided by online VPN provider, to have access to all my services in any location with hight probability of ONLINE VPN server (my home server can be inaccessible quite often due to some house stability issues: ISP/Electricity issues). Sure that is additional money, but I think its worth for security reasons.


where does today Quran variants come from?

Question: where does today Quran variants like khalaf, hafs, warsh, etc... come from? do they go back to the prophet(pbuh) and it's the different way the Quran was originally revealed with or they go back to Uthman(ra) Quran as Uthman(ra) burned those different variants and these different came to place where Arabic diacritical marks had to be added to the Quran?
Comment: This question has been answered several times on the site. The qur'an was revealed in seven ahruf. Please check the site first, if you haven't found a satisfactory answer or still need clarification come back and ask (maybe by editing this post and referring to/explaining what you miss)
Answer: Quran was revealed in 7 ahruf and 10 Qira'at to prophet muhammad(PBUH). THIS IS Because of the fact that different people have different ascent or dialects and different way to pronounce words. EXAMPLE: https://dictionary.cambridge.org/pronunciation/english/privacy
7 ahruf was revealed to make 7  Arab tribes -(Quraysh, Hudhayl, Tameem, Hawaazin, Thaqeef, Kinaanah and Yemen), easy to understand Quran and leave no room for doubt.
Answer: The differences between the canonical qira'at (and the accepted transmissions thereof) are supposed to be derived from authentic ahruf recited by the Prophet. The canonical readings are those that comply with the Uthmanic rasm (there were many others that did not), which had only sparse or no dotting to distinguish homographic consonants which can change a letter from one to another, nor short vowel marks which affect grammar. The variants also involve far more than dialect differences. Each of the seven or ten canonical readers is supposed to have picked from authentic options passed down to him (as well as having his own general recitation rules, or usul) and after some centuries they were considered fully authentic. Of course, the details are more questionable and even some early scholars and grammarians criticised things now recited as Quran before the consensus emerged. There is still disagreement on the nature of the ahruf and some other questions. The following site has a good Resources page listing ways that you can see the variants in English, Arabic and transliteration, useful academic papers and books etc. https://quranvariants.wordpress.com


How can I update file attachment and keep filename?

Question: I understand changes of file attaching in D7, but problem is, if I delete and re-upload changed file, the deleted file is still on server and re-uploaded filename gets changed. If I understand correctly, removed file is deleted by cron, so there is a delay. Is it possible to get file deleted in real time, to avoid renaming of uploaded one?
Answer: It is not possible. If files were deleted "in real time", node your readers see would have a link and reference to a file no longer on server's hdd.
If you need to get the same file name, remove file, save node, upload new version, save node. That way you will avoid both broken links and name conflicts.
Answer: If you have IMCE installed go to
Home » Administration » Configuration » Media
and change IMCE common settings:
Default behaviour for existing files during file uploads

Keep the existing file renaming the new one
Keep the existing file rejecting the new one
Replace the existing file with the new one

Hope this helps.


How to improve audio performance on high end gaming pc?

Question: I have a nice pc, with very good processor and gpu, ssd, 16gb of ram and all that good stuff needed for gaming. But when I made my pc I was focused on video performance, totally forgetting about audio.
Now I'm equipped with cheap Amazon KLIM Mantis USB headphones and the "sound card" built in in my AsRock 450m mobo, but when I'm playing a game like battlefield 5 I'm not quite satisfied with the audio immersion. It sounds pretty flat, although I installed all the drivers and tweaked all settings.
How should I proceed to improve my gaming audio experience? What to buy first? Better headphones? A cheap dedicated audio card? I'm totally ignorant about audio, please enlighten me
Comment: I'm voting to close this question as off-topic because this is not a problem unique to gaming.
Comment: Doesn't look that broad to me... you know the headset and you know the board, so you have all the information you need.
Comment: This seems like a really broad question, and I'm not sure it's answerable because no one knows exactly how your machine is set up except you.
Answer: You'll need a good headset first and then maybe another sound card depending on your needs. Nowadays onboard sound cards are usually better than cheap dedicated ones, so you should be fine with just a headset.
Even the best sound cards can't do anything about a shitty headset. It's pretty much like having a Porsche on a cobbled road: it works, but it's no fun at all.
Answer: Bottlenecks in terms of audio quality are almost always due to the speakers themselves. Investing in a pair of good noise cancelling headphones can drastically improve your audio quality in games.


bipartite graph coloring

Question: Hi, I don't know much about graph theory so I would need to know if the following problem has a positive answer or a reference. There is a bipartite graph G with the two vertex sets V1, V2. Each vertex of V1 is connected to a least 2 vertices of V2 and with at most N vertices of V2. Each vertex of V2 is connected with some vertex of V1. Is there a function f(N) such that choosing f(N) colors to color the vertices of V2 I can ensure that each vertex of V1 is connected with at least two vertices of different colors?
Comment: For the case where all the V1 vertices have two neighbors, this reduces to vertex-coloring an arbitrary graph, with all its NP-complete goodness.  The structure you are describing as "a bipartite graph with..." is more commonly called a hypergraph.  V2 is the vertices of the hypergraph and V1 is the hyperedges.
Comment: The number of colors that you are required to use is basically independent of N because of how little it affects the graph.  Consider the following graph: I have a vertex in V1 connected to N vertices in V2.  I also have a bunch of vertices in V1 which are connected to vertices in V2 that aren't from the original N.  The number of colors required is essentially independent of N

The number required can also be arbitrarily high.  For the vertex set V2, for each pair of vertices put a vertex in V1 that connects to both of them.  Then every vertex in V2 needs to be colored differently.
Answer: Answer is NO. Consider the following bipartite graph $G=(V,E)$.
$V(G)=\{ v_1, \ldots , v_n\}\cup \{u_{i,j}: 1 \leq i < j \leq n\}$,
$E(G)=\{v_i u_{i,j}:1 \leq i  \leq n  , \, \, 1 \leq  j \leq n\}$.
Let $V_1=\{u_{i,j}: 1 \leq i < j \leq n\}$ and $V_2=\{ v_1, \ldots , v_n\}$. Each vertex
in $V_1$ is connected to exactly two vertices in $V_2$, so $N=2$, but we need at least $n$ colors to color the vertices of $V_2$, to ensure that each vertex of $V_1$ is connected with at least two vertices of different colors.
Comment: Is this answering the question? It doesn't seem clear to some of our readers that it does.
Comment: Your edit is fine; I'd suggest you remove all the extraneous material, starting at "For more information ...". It's a bit off-putting that you cited your own not-exactly-relevant paper as your original answer, and I think this part would be best removed.

bipartite graph coloring


Good Queuing Theory Introductory Textbook

Question: I am an undergraduate student who is going to be taking a queuing theory introductory course next semester, I am wondering what's a good introductory book out there? (my math background is probability theory, linear algebra and differential equations)
Answer: I thought I'll point you to online resources available for Queueing Theory. Hope this helps!
The first one and the second one consisting of a list of books available online.
You could also get motivation (at the cost of missing some finer mathematical details) from here. The solutions are also available here
Comment: The first book looks like a good introduction. I'll leave the question open if anyone contributes other resources they know of.
Answer: Have you checked out Leonard Kleinrock's books? I am not an expert (in fact, I have taken only an introductory course in queueing theory), and have not read his books; but I wanted to mention them for completeness.
His two-volume book on queueing theory (Theory and Computer Applications) is old now (first published around 1975), so I am guessing they are probably outdated; but I am not sure about this. Also perhaps they are still good enough for an introductory course?
While searching, I also found a problem book Queueing Systems: Problems and Solutions that is more recent, but is still 15 years old now. The publishers' note says:

Queueing theory is an effective tool for studying several performance parameters of computer systems. It is a difficult subject, and the best way to comprehend queueing theory is by working on information processing problems. This manual contains all of the problems from Kleinrock's Queueing Systems, Volume 1 and their solutions...
Comment: +1! What were your introductory materials?
Comment: @Tim: I mostly followed my professor's lecture notes, unfortunately I am not allowed to be share it in public. (In fact, I myself lost my personal hard copy. :-)) I am sorry I cannot be more helpful.
Answer: Hope you already got vast knowledge in queuing theory by now. For other novice, my suggestions to start with U. N. Bhat, 2008. It has more chronological details on queuing theory history. Makes a map to reach the theory development knowledge. Another books that can helps in learning queuing models quickly, are  E. P. C. Kao (1996) and Henk C. Tijms (2003).
There are more and latest information at Dr Myron Hlynka's Queueing theory page.
Hope it can helps the queuing theory learners.


Where is the online help text located in Fallout 4?

Question: A while ago, I extracted the actual Online Help Texts (in-game help strings accessible from the Help menu when the game runs) from Fallout 76 from the main .ba2 file for better readability. I've used the Bethesda Archive Extractor (free signup required for downloads). Doing this was relatively straightforward, with some amount of copy-paste. :-)
Now I wanted to the same for Fallout 4, but I fail to find the strings. I've extracted Fallout4 - Interface.ba2, as well as the DLC's strings. greping through these files for strings gleaned from the actual online help window within the game revealed no matches — just unlike Fallout 76 extracted strings.
Where can I find the online help text strings from Fallout 4? And how can I extract these to a file, if they are located in kind-of-an archive?
I'm asking this question in here because I fail to find a better place on Stackexchange. Proposals where to ask better are welcome.
Comment: Yes. I've updated the question to be more precise.
Comment: With "Online Help Texts" you mean the in-game help strings?
Answer: They can be found in the Fallout4 - Interface.ba2 archive file, in the /Strings folder.
There you can find .STRINGS, .DLSTRINGS, and .ILSTRINGS files for all supported languages.
You can use BSA Browser or an equivalent to extract them. BSA Browser for Skyrim, and likely other Bethesda games, works perfectly fine, in case you already have any other installed.

You can use xTranslator to read the .STRINGS files:

(And that randomly selected string already displays an inconsistency: the perk is called 'Cap Collector', but the description reads 'Caps Collector". Typical Bethesda.)
Comment: Thanks a lot! I don't know why my other grep over those extracted strings failed. Also thanks for the hint to xTranslator!


drupal watchdog filter the entries in the database

Question: On drupal 6 can i filter the entries of the watchdog into the database depending on the severity?
For example i want to exclude the "error" severity messages.
Answer: You can't control what is written to the watchdog table through Drupal's UI, but you can filter which messages are displayed on the Recent Log Entries (/admin/reports/dblog) using the Filter Log Messages form within the collapsed fieldset at the top of the page (expand the fieldset, CTR+Click each of the severity levels you want displayed and click on the filter button.
If you really want to stop PHP errors from being written to the watchdog table, you can override your server's error_reporting (http://php.net/manual/en/function.error-reporting.php) setting.
You can do this by, for example, placing a new directive in your settings.php file. Add this line to the bottom of settings.php:
<code>error_reporting(E_ERROR);
</code>


Docker-Compose with Docker 1.12 "Swarm Mode"

Question: Does anyone know how (if possible) to run docker-compose commands against a swarm using the new docker 1.12 'swarm mode' swarm?
I know with the previous 'Docker Swarm' you could run docker-compose commands directly against the swarm by updating the DOCKER_HOST to point to the swarm master :
export DOCKER_HOST="tcp://18.104.22.168:3375"
and then simply execute commands as if you were running them against a single instance of Docker engine.
OR is this functionality something that docker-compose bundle is replacing?
Comment: Possible duplicate of [Can Docker 1.12 in "swarm mode" provide "a single, virtual Docker host"?](http://stackoverflow.com/questions/38198275/can-docker-1-12-in-swarm-mode-provide-a-single-virtual-docker-host)
Comment: Can't do it with docker-compose directly, you need to bundle and then load the stack with the experimental build. See [the duplicate question](http://stackoverflow.com/q/38198275/596285).
Comment: Yes it is @BMitch. Great answer thanks!
Answer: I realized my question was vaguely worded and actually has two parts to it. Eventually however, I was able to figure out solutions to both issues.
1) Can you run commands directly 'against' a swarm / swarm-mode in Docker 1.12 running on a remote machine?
While you can't really run commands 'against' a swarm you CAN run docker service commands on the master node of a swarm in order to run services on that swarm.
You can also configure the Docker daemon (the docker daemon that is the master node of the swarm) to listen on TCP ports in order to externally expose the Docker API.
2) Can you still use docker-compose files to start services in Docker 1.12 swarm-mode?
Yes, although these features are currently part of Docker's "experimental" features. This means you must download/install the version that includes the experimental features (check the github).
You essentially follow these instructions  https://github.com/docker/docker/blob/master/experimental/docker-stacks-and-bundles.md
to go from the docker-compose.yml file to a distributed application bundle and then to an application stack (this is when your services are actually run).
$ docker-compose bundle
$ docker deploy [OPTIONS] STACK
Here's what I did:

On my remote swarm manager node I started docker with the following options:
docker daemon -D -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2375 &
This configures Docker daemon to listen on the standard docker socket unix:///var/run/docker.sock AND on localhost:2375.
WARNING : I'm not enabling TLS here just for simplicity
On my local machine I update the docker host environment variable to point at my swarm master node.
$ export DOCKER_HOST="tcp://XX.XX.XX.XX:2377" (populate with your IP)
Navigate to the directory of my docker-compose.yml file
Create a bundle file from my docker-compose.yml file. Make sure to include the .dab extension.
docker-compose bundle --fetch-digests -o myNewBundleFile.dab
Create an application stack from the bundle file. Do not specify the .dab extension here.
$ docker deploy myNewBundleFile

Now I'm still experiencing some networking related issues but I have successfully gotten my service up and running from my unmodified docker-compose.yml files. The network issues I'm experiencing is documented here : https://github.com/docker/docker/issues/23901
Answer: While the official support for Swarm mode in Docker Compose is still in progress, I've created a simple script that takes docker-compose.yml file and runs docker service commands for you. See https://github.com/ddrozdov/docker-compose-swarm-mode for details.
Answer: It is not possible. Compose uses containers to create a client-side concept of a service. Docker 1.12 Swarm mode introduces a new server-side concept of a service.
You are correct that docker-compose bundle; docker stack deploy is the way to get a Compose file running in Swarm Mode.


Shopping cart rules

Question: We offer an automatic discount of 10% over $300, no coupon code needed.  However when we run another promotion, for instance, 15% using a coupon code, that discount is being added on to the automatic 10% discount, giving the customer a 25% discount.  Is there a way to set the 15% promotion to discount the subtotal only?
Answer: You can use sort orders if you want some rule to precede others or you can mark the first rule found is used only, i think you must use the order field too to say wich one will be first validated

Shopping cart rules


Do virtual electron-positron pairs have mass?

Question: When a photon produces an electron-positron pair, do both these particles have mass? Why or why not?
Comment: 1. The title talks about *virtual* pairs (which cannot be "produced" since they are just lines in a diagram), the body does not. Since photons can produce *real* pairs in [pair production](https://en.wikipedia.org/wiki/Pair_production), you should perhaps also add the "virtual" in the body if you really want to ask about virtual particles. 2. What would it mean for a *virtual* particle to "have mass" (or to not have mass)?
Answer:
Do virtual electron-positron pairs have mass?

Virtual particles are within an integral depicted by a Feynman diagram

Only lines entering or leaving the diagram represent observable particles. Here two electrons enter, exchange a photon, and then exit. The time and space axes are usually not indicated. The vertical direction indicates the progress of time upward, but the horizontal spacing does not give the distance between the particles.

The virtual lines are described by a fourvector, and the "length" of a four vector is the mass for a free particle.In an integral this mass is variable within the limits of integration.
you ask:

When a photon produces an electron-positron pair, do both these particles have mass? Why or why not?

A photon has zero mass, and conservation of energy and momentum do not allow the decay into massive particles.
Comment: @Shashaank this may help https://edwardfhughes.wordpress.com/2015/07/28/what-gets-conserved-at-vertices-in-feynman-diagrams/ about conservation at vertices.(comments have been removed)
Comment: ok... Thank you for the help...
Answer: A virtual pair is by definition "off shell". That is, it does not obey the usual mass relation for that kind of particle:
$$E^2 = m^2 + p^2$$
Rather, it can have any $E$ and $\vec{p}$ such that 4-momentum is conserved at vertices. That means that the meaning of the "mass" of an off-shell system is pretty nebulous. You can, of course, choose to compute a value of $m$ for the virtual pair as though the usual mass relation were accurate. If you do, you will find that it could be anything, including zero.
Computing the mass of a virtual pair serves no useful purpose, nor does contemplating whether it is nonzero.
Answer: A free photon may not produce electron-positron loops in a correct theory. In the current (incorrect) QED those corrections are mainly subtracted from the solutions - just to remove incorrectness of the original equations.
Comment: Any reference to support these bold statements?
Comment: @Ruslan: Any QFT book that states that free equations are for non-physical, non-observable bare particles.


What is the difference between "bush" and "shrub"?

Question: What's the difference between "bush" and "shrub"? Are these absolute synonyms?
Comment: There are certainly meanings of *bush* for which *shrub* is not appropriate. [Example (Safe for work)](http://www.lrsshop.co.uk/category/catalogue/suspension/suspension-bushes/land-rover-bushes)
Comment: And do they denote the same when we are talking about a plant?
Comment: Please [edit](http://english.stackexchange.com/posts/132674/edit) your question to show us what research you have already done.
Comment: https://www.google.com/search?q="difference between bush and shrub"
Comment: Not entirely germane, but _Shrub_ is a derogatory nickname for George W. Bush (i.e., the younger President Bush). I believe the late Molly Ivins, a Texan left-wing journalist, coined it when Bush was running for Governor of Texas.
Answer: From a horticultural standpoint, 'bush' and 'shrub' are not synonymous. 'Bush' is a term used by the uninitiated to describe any bushlike plant, but in horticulture, bush usually refers more to the shape something makes, so you might see a plant description which says 'forms a bush' (as opposed to being tree like or with growth which doesn't bush out but goes straight up, for instance, Berberis 'Red Pillar'). 'Shrub', on the other hand, has a very distinct meaning - it is a plant which retains structure above ground year round, evergreen or otherwise, which cannot be split or divided because the growth is coming from one set of roots. Some shrubs can be considered small trees, but will still be defined as shrubs.
Comment: You mention the different and conflicting usages, but a good answer on ELU requires supporting references.
Answer: There are no exact synonyms. If there are two differently pronounced words that seem to be interchangeable in most instances without changing the meaning, there will still be contexts where one sounds more right than the other, one is more common than the other, one is not said in certain contexts, one is used differently in other contexts giving it different associations. Identical dictionary definitions do not make two words identical; the dictionary is not saying enough.
But, yes, despite the technically used differences by botanists and lawn care specialists, shrub and bush are very very similar in informal speech, so I'll try to show how they are different.
To me, a bush is more about the specific plant and shrub is more about the generic concept of those kinds of plants.
A shrub is "a woody plant smaller than a tree, usually having multiple permanent stems branching from or near the ground"
A bush is "a shrub or clump of shrubs with stems of moderate length." so they definitely seem to be exact synonyms.
I think of shrubs as decorative plants usually around or nearby a house. They are usually made of bushes (In fact I can't think of anything else the shrubs would be made of).
I suppose you could have bamboo as shrubs, and bamboo are definitely not bushes, though they can certainly be bushy (short and full as opposed to tall and thin).
You're more likely to point at a single plant and say 'that bush needs trimming', but to a whole bunch of them and say 'The shrubs need trimming'.
'in the bush' sounds a bit Australian or African, like you're out in the countryside with no trees. But that might also be called 'shrubland' or 'scrubland'. That's interesting question: "what is the difference between 'shrub' and 'scrub'?" (interesting because they are cognate like 'shirt' and 'skirt', or 'ship' and 'skiff')
Comment: Have you managed to prise apart 'abstruse' and 'recondite'? Of course, taken to its limit, '2,4-dinitropnenylhydrazine' has different connotations for different people. 'All words are infinitely polysemous.'
Comment: "There are no 'exact' synonyms."  I forget who suggested 'abstruse' and 'recondite', but I've not found a situation where they're not interchangeable. Of course, neither is all that common, which certainly helps.
Comment: @EdwinAshworth Sorry. There are no exact synonyms...except when people _stipulate_ that two words must be treated so (as in the sciences).


Baire Category Theorem and nowhere differentiable function

Question: As seen here, standard application of the Baire Category Theorem is to show that the set of functions differentiable at a point in $[0,1]$ is a nowhere dense set in the space of continuous functions on $[0,1]$. For that we construct sets
$$
C_{n} = \{f \in C[0,1] : \exists a, \delta \in [0,1] : \frac{|f(a+h) - f(a)|}{|h|} \leq n \text{ for all } |h| < \delta\}
$$
The standard proof shows that each $C_{n}$ is closed and has empty interior. I get the empty interior bit, but I'm confused about why it's closed. Yes, we take a sequence $f_{k}$ in each $C_{n}$ and find a point $x_{k}$ for each $f_{k}$ where the above property holds and find a convergent subsequence of $\{x_{k}\}$. My question: how is taking a limit of the $x_{k}$ sufficient? Don't we need to take care of $\delta$ as well? When we take $k \to \infty$, why can we fix $h$? Each $f_{k}$ might have a different value of $h$ that works, so even the $h$
 has to be part of our sequence. But we introduce a sequence $h_{k}$, how do we take care of the $\delta$ for each $h_{k}$? Who's to say that $h_{k}$ doesn't converge to $0$?
Comment: You cannot show that this set is closed. Take a look at your source again and see which set is supposed to be closed.
Comment: @KaviRamaMurthy What is the set?
Comment: @KaviRamaMurthy Is it "for any h" instead of just small enough h?
Comment: Go to the link you have given and write down the complement of $A_n$ corre tly. Then use the fact that intersection of closed sets is closed. This allows you to prove closedness for a fixed $h$ which is easy.
Comment: @KaviRamaMurthy So is the idea to do it for smaller and smaller h and then intersect all those sets to get arbitrarily small h?
Answer: Let $A_n$ be the set in your link. Then $A_n^{c}=\cap_h \{f:\exists t: |f(t+h)-f(t)| \leq n|h|\}$. Fix $h$. If $(f_j)$ is a sequence in $\{f:\exists t: |f(t+h)-f(t)| \leq n|h|\}$ converging uniformly to $f$ then $|f_j(t_j+h)-f(t_j)| \leq n|h|$ and there is a  subsequence of $(t_j)$ which converges to some $t$. Can you show that $|f(t+h)-f(t)| \leq n|h|\}$?


Bulk Upload Attachments into Lightning Knowledge Articles

Question: I would like to bulk upload list of pdfs as attachments against knowledge articles.
I think the documents are getting stored in ContentDocument, but how can I use dataloader to load attachments and link it against knowledge articles? Thanks.
Answer: Unfortunately, I don't think you can do this in one load. ContentDocumentLink is what you need to insert that'll have a lookup to the file and the Knowledge Article. Both of those records need to exist to insert these records.

Dataload the files first. These are stored in the ContentDocument type.
After inserting, export the files to get the Id.
Export your Knowledge Articles to get the Id of your articles.
Insert ContentDocumentLink records using the ContentDocument Id for ContentDocumentId and KnowledgeArticle Id for LinkedEntityId. You'll also want to consider what values to set for Visibility and ShareType.

This obviously assumes you'd have an ability to figure out which file should go with which article based on the fields you have available (ex. title, file name). If you can't, I'm not sure you have another option.
Comment: Thank you Kris. I figured it out. Since articled will be attached to only one knowledge article, I did that with one single data load stepe i.e. loading into ContentDocument by providing the FirstPublishLocationId = Knowledge Article ID


orientation change, FragmentTransaction, Activity has been destroyed, WeakReference

Question: Alright. My first question here. And I already found some solution, but honestly do not really get the stuff that happens in the background. So perhaps there's someone who could clear up this stuff a little bit. After days of debugging I'm just glad that it works... and hope I did not make some serious error. So let's have a look.
I got some Main-Activity. Just a FragmentActivity extending JFeinstein's SlidingFragmentActivity. Further I decided to go the fragment-way and just put any content (list-fragment, article-fragment, …) as a fragment into a container (to right of the sliding-menu); my main-container. So far, so good.
One essential fragment is my article-fragment. A ViewPager (with a FragmentStatePagerAdapter) - containing some pages with text and perhaps another list-fragment. Still no problem so far, until I decide to rotate the device. And to be more precise, rotating the device works too as long as I do not decide to update my article-fragment.
I understood (correct me if I am wrong) that Android handles the fragments state on its own when rotating the device. And it seems to be everything fine just until I want to reload/update its content.
Ok let's dig deeper into that.
On first start I got some empty main-container. Then I am loading my article-fragment for the first time. Just getting the SupportFragmentAdapter, creating my ArticleFragment and replace the main-container with the newly created fragment - tagged. No rocket-science - just a simple transaction:
ViewPagerFragment pagerFragment = (ViewPagerFragment)
    getSupportFragmentManager().findFragmentByTag(TAG_FRAGMENT_ARTICLE);

if(pagerFragment != null){
    if(pagerFragment.isResumed()){
        pagerFragment.triggerReload();
    }
} else {
    pagerFragment = new ViewPagerFragment();
    FragmentTransaction t = getSupportFragmentManager().beginTransaction();
    t.replace(R.id.id_main_root_frame, pagerFragment, TAG_FRAGMENT_ARTICLE);
    t.commitAllowingStateLoss();
}

To avoid creating a fragment each time I reload my content, I'm trying to fetch the fragment before the transaction and - if it is found and resumed - trigger some reload on the existing fragment.
Now I rotate my device in this state. To avoid messing with the fragment state I left onSaveInstanceState() inside the fragment untouched. So I guess the fragment is just destroyed and recreated. And everything still works so far. But I think this part has something of a black box.
After that - normal startup, creating fragment and put into main-container, rotating device - I trigger some update. But instead of finding the old (recreated) fragment by tag, nothings found and a new fragment is created and inserted. At least tried to be inserted, because this is where I got the following exception:
java.lang.IllegalStateException: Activity has been destroyed

To be precise, I get the above exception when finish my transaction with a commitAllowingStateLoss(). When I just commit() the transaction I get the following exception:
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

So that's where the error comes up. And after ages of debugging and searching I found some hint on this question/answer to get the SupportFragmentManager on a WeakReference of my MainActivity. And what should I say. Since I implemented that, it works. I had to change my update-process a bit, but it works. But leaves some questions ...
The behaviour seems to be similiar. First creation works perfect. Reload just the same - fragment is found by tag. After rotation, article is still shown. And when I reload the fragment with that state it is not found by tag so a new one is created, but the commit()-request does not throw an exception. A look inside the debugger shows that the WeakReference is some other instance (other id), than the one(this) all of this takes place in. And thats where I lose the plot. ..
If some of you could give me some hints, would be great!
Thanks in advance!
Comment: I have the exact same issue and not the slightest clue why it is behaving this way.  Super frustrating since none of this stuff is documented.
Answer: try this:
commitAllowingStateLoss(); instead commit();


Enable default camera in Lenovo T410

Question: I was using Lenovo T410 with Windows. Last week I wiped off Windows and installed Ubuntu 10.10 as my primary OS. Now, I am not sure how to install/enable the default camera in ubuntu. I searched lenovo site for ubuntu drivers but they are all for Windows only.
Comment: please provide the follow information execute in terminal `lsusb` and `lspci` and update your post with this information and will see what happen.
Answer: I own a T410 and I have no troubles with the camera. It works out-of-the box, withoug any effort from my side.
It works both with cheese and skype.
Try Fn + F6 as it seems to control the camera somehow (I don't have the user's manual here with me, to check what they actually do).
Comment: According to the hardware manuals, the T410 and T510 use the same camera and it should work out of the box. Thanks for confirming this! Awarding the bounty to this answer (due to the lack of further activity of the questioner).
Answer: There are a number of webcam programs to access your web cam Cheese is just one.
To test if the default open source drivers are working I access my built in web cam on my laptop using Video for Linux or Video for Linux 2 and vlc media player.
I open vlc media player.
Click on the the Media menu
Either Advanced Open File or Open Capture Device
Choose Capture mode I use Video for Linux 2 [try experimenting with the other modes]
You may need to install Video for Linux in order for the Capture Device to become available.
You can also check if there is a v4l device in the /dev directory.
$ ls /dev/v4l
by-id  by-path
$ ls /dev/v4l/by-*
by-id:
usb-Bison_Electronics_Inc.BisonCam_NB_Pro-video-index0
by-path:
pci-0000:00:1a.0-usb-0:1.1:1.0-video-index0
Answer: If the camera is enabled in the BIOS, then it should just work (you can test it by installing and running the webcam program cheese).
Comment: From Cheese, I see grey image and nothing else. Let me check from BIOS.
Comment: Nothing from bios too. Not sure how to enable this...
Comment: I'm afraid I can't help you then (I got a T510 and I was hoping it just works for you the way it does for me).

Enable default camera in Lenovo T410


Processing an order with products out of stock

Question: Im new to Magento and in doubt how to process an order when there are products sold out. My Magento is set up to automatically process the payments from within the order. But what should I do when there are products that are sold out? I will invoice the products that i can, but then there will still be a part of the payment left and my order status is still "processing". How do you normally handle this situation?
Answer: If you want to invoice and collect payment for all products, then invoice all of the line items, and raise a separate shipment for just the items that you're shipping out now.  When the other products are back in stock, raise a second shipment for the remaining products.
"Processing" means that the order has been invoiced, but not fully shipped.  If you use two separate shipments as above, the order will live in the "processing" state until the second shipment has been created, at which point it'll switch to "Complete".  This is the normal Magento order flow.  The Aligent team has drawn a complicated looking diagram showing the complete order state flow which might help understand what's happening.
Comment: My problem is that we will never send the second shipment as the products are rarely restocked. Therefor the orders status will forever stay as "processing" which is confusing.
Comment: In that case, raise a "Credit Memo" in Magento, or Cancel the items you won't be able to supply, and the order will move to the "Complete" stage and won't show as processing any more.


Low temperature solder

Question: I am soldering LED strips together but I am in a location without access to an electrical outlet.  I am using a battery powered soldering iron but it doesn't get very hot compared to my home soldering iron.  I am having a tough time melting the solder with it and getting it to stick to the pads.  Can you guys recommend a solder that melts at a low temperature?  I have also tried a butane powered iron but it broke after only a few uses so I would prefer to try a new solder before changing the iron.
Comment: Use an inverter and a car battery with a proper soldering iron.
Comment: We cannot recommend low-temperature solder. Especially since they usually contain things that make lead look as harmless as a flower.
Answer: Tin-bismuth solder melts at ~140C and is also lead-free. Japanese use it extensively; however since JEDEC is hostile towards it you will have difficulties to source it outside of Asia. SnBi solder paste is available from eBay, expect 2-3 weeks delivery.
If your iron is capable of melting the solder you currently have you may try to help it with another heater. Plain household hotplate will work in a pinch; ones currently sold in the states are cold enough at full power to use with SAC305. If you're using leaded solder start with low setting and advance slowly - and never use this hotplate for cooking food afterwards.
Comment: If the OP doesn't have an outlet, he's unlikely to be able to plug in a hotplate. Maybe a camp stove with a heavy griddle to distribute heat.
Comment: @DoxyLover Almost anything having good thermal mass and two parallel flat surfaces of sufficient size will work, even a brick heated up in a campfire - I'm speaking from experience.

Low temperature solder


How to "play with friends" with more than 10 players

Question: I was trying to set up a game with 12 players. But the play with friends lobby would not let more than 10 players join. How can i set up a game with more than 10 players
Comment: Set up a server and let the 12 people join your server through Steam.
Comment: You need this server online or lan?
Answer:
Set up your own server at crosshairgenerator.com
Set maxplayers to what ever you like in the gamemodes_server.txt file.
Have fun

Note: in the command line of your server you can use maxplayers_override [#] to change the number during a game
Answer: If you don't want to host your own server then you could change the game mode to casual. However it won't be as fun. I would recommed setting up your own server and use this as a single conditions option. The reasons that I wouldnt personally is because I would have to mess around with my port settings and I probably will make a mistake and then I will get hacked (not really but you get my point)


Origin of Mexican hat potential in Higgs mechanism

Question: I have recently read a layman's version of the Higgs mechanism with a Mexican hat potential. The only thing I don't get is what actually causes the Higgs potential to have a Mexican hat shape?
Comment: Do you mean why the potential rises up at infinity instead of going down ?
Comment: No please read my question literally as it is written
Answer: In the Standard Model there is no explanation for the shape of the potential. It's just an assumption. Possibly some future unified theory will give us an explanation for why the higgs field behaves as it does, but at the moment no such explanation exists.
Comment: Yes, we don't know why the parameters have the signs st we get that shape. But there is only one possible renormalizable gauge invariant potential, with 4 shapes from the 2 signs
Answer:
Without the Higgs mechanism, or some other effect like it, all bosons (a type of fundamental particle) would be massless, but measurements show that the W+, W−, and Z bosons actually have relatively large masses of around 80 GeV/c2. The Higgs field resolves this conundrum. The simplest description of the mechanism adds a quantum field (the Higgs field) that permeates all space, to the Standard Model. Below some extremely high temperature, the field causes spontaneous symmetry breaking during interactions. The breaking of symmetry triggers the Higgs mechanism, causing the bosons it interacts with to have mass. In the Standard Model, the phrase "Higgs mechanism" refers specifically to the generation of masses for the W±, and Z weak gauge bosons through electroweak symmetry breaking.

In fact , without the symmetry breaking all elementary particles of the standard model would have zero mass.
The shape of the potential is chosen so as to generate the symmetry breaking suspected from the symmetries  of weak and electromagnetic interactions .

Spontaneous symmetry breaking simplified: – At high energy levels (left) the ball settles in the center, and the result is symmetrical. At lower energy levels (right), the overall "rules" remain symmetrical, but the "Mexican hat" potential comes into effect: "local" symmetry is inevitably broken since eventually the ball must roll one way (at random) and not another.

The Mexican hat has the minimum necessary functions: a metastable point at the center of the hat  for high energies , and a lower stable position.
In this sense the mexican hat may be the first order approximation to a Higgs potential that might appear in a unified theory of everything, or any other theory at that,  but it suffices for the reason it was proposed, to break the symmetry and give masses to the elementary particles.
Because it is a heuristic potential, the constants that describe it have to be determined by the experiment, that is why the discovery of the Higgs boson was important, as its mass constrains the higgs field in the theory.
Comment: @JohnDuffield  The mass of the higgs boson is more complicated  , have a look here http://profmattstrassler.com/articles-and-posts/particle-physics-basics/how-the-higgs-field-works-with-math/3-how-the-higgs-particle-arises/
Comment: Anna, does the Higgs mechanism give mass to the Higgs boson?
Comment: I've read that thanks! In fact that's why I asked you the question.


Is it possible to invert text and background colors in a PDF when printing?

Question: I have an existing PDF with a totally black background and all text is white.
Is there a way to get the text to print black and the black background to not print at all?
I have Bluebeam and Adobe PDF.
Answer: Funnily enough there are "legitimate" use cases for this, notably people with low vision.  Acrobat and other readers can override colors for display (eg Ctrl-I in Evince and via the Accessibility menu in Acrobat Reader X) but strangely not for printing.  What you can do, though, is use GhostScript's pdf2ps converter (or a fake PS printer driver that just writes the file) to get a postscript file, then edit the file by putting
{1 exch sub} settransfer

as the first line in the file and then printing that PostScript file.  That way you get a more faithful rendering of the doc than you would if you converted the PDF to an image and inverted that.
Comment: I've done something like this (on Windows) by installing a PostScript printer driver and then telling it to print to file to capture the output. The same concept should work on other OSs. It should be noted that PostScript files are just text files that can be edited with most text editors.
Comment: Using a combination of `pdf2ps` and `ps2pdf` I can be able to export the original pdf into an inverted pdf file. I'm just curious on what the proposed line do and if it is possible to "revert" back to the original colors.
Answer: None of the previously posted solutions worked for me so I wrote this simple bash script. It depends on pdftk and awk. Just copy the code into a file and make it executable. Then run it like:
$ /path/to/this_script.sh /path/to/mypdf.pdf

The script:
#!/bin/bash
pdftk "$1" output - uncompress | \
awk '
  /^1 1 1 / {
    sub(/1 1 1 /,"0 0 0 ",$0);
    print;
    next;
  }

  /^0 0 0 / {
    sub(/0 0 0 /,"1 1 1 ",$0);
    print;
    next;
  }

  { print }' | \
pdftk - output "${1/%.pdf/_inverted.pdf}" compress

This script works for me but your mileage may vary.  In particular sometimes the colors are listed in the form 1.000 1.000 1.000 instead of 1 1 1. The script can easily be modified as needed. If desired, additional color conversions could be added as well.
Answer: There is an easy way, and a technical way.
The technical way is that if you have Ghostscript installed and have its .../bin folder added to your PATH, you should just be able to invert the colours of your PDF by calling something resembling the following from the command-line:
gswin64 -o C:/outputfile.pdf -sDEVICE=pdfwrite -c "{1 exch sub}{1 exch sub}{1 exch sub}{1 exch sub} setcolortransfer" -f C:/inputfile.pdf

Note that gswin64 (located in the .../bin folder) might be called gswin32 if you downloaded the 32-bit version, or something else entirely if you're on a *nix system instead of Windows, and that you should obviously replace C:/outputfile.pdf and C:/inputfile.pdf with the actual paths of your input file and intended output file location. Also take care that in my experience there can sometimes be a bit of trouble if you have spaces in your path directories, even if you put quotation marks around them.
It's also worth noting that iirc some versions of Ghostscript might fail on this unless you put the {1 exch sub}{1 exch sub}{1 exch sub}{1 exch sub} setcolortransfer line in a separate .ps file and just add the .ps file to your command.
(This is really just a more fleshed-out version of Mateen Ulhaq's answer above)
The easy way is that if you can't be bothered doing any of the above, you can use some sort of online PDF inverter which will probably just do this for you. (Edit: There used to be no such websites. After seeing this thread, I made one and ran it for a while, but then after a few other websites popped up offering the same service I closed mine.)
Answer: According to this page, you may be able to accomplish it with ImageMagick. However, the PDF will be converted to images before it is inverted. If the quality isn't sufficient because of this, you should be able to adjust the DPI number.
convert -density 300 -negate "input.pdf[1-999]" output.pdf

Replace 300 with your desired DPI and 1-999 with your desired page range.
NOTE: This command is for an older version of ImageMagick and you will need to ensure that legacy utilities are installed.
Comment: @fixer1234 Thanks for bringing this to my attention. I have added a link to that page on the Internet Archive.
Answer: In Acrobat Reader X
Edit->Preferences->accessibility
Select: Replace document colors
Select: Custom color
Set remaining options according to personal preference.
Note: This does not change the document, just your view and they way it is printed.
Comment: Does not print differently than the original AFAICT
Answer: I've tried many of the answers here, and none have been adequate for me. The top answer simply didn't work, and most other solutions converted each page of the PDF into a raster image, inflating the size and decreasing the quality.
For these reasons, I decided to create a solution of my own, which can be downloaded from github here. It's a relatively simple Java program built upon a fork of pdfbox. (The fork exists simply to allow access to two otherwise private fields/methods.) It's licensed under the highly nonrestrictive MIT license.
Using the program is very simple. Simply enter the following command in the same directory as PDFInverter.jar:
java -jar PDFInverter.jar input_file.jar output_file.jar

This will invert all objects, including raster images, in the PDF, while maintaining the lossless nature of text and vector elements in the file. Additionally, you can supply a custom background color by specifying a CSS color string as a 3rd parameter like so:
java -jar PDFInverter.jar input_file.jar output_file.jar #7f7f7f

If you would like to leave raster images contained in the file untouched, you can enter "false" as the 4th parameter to disable the feature:
java -jar PDFInverter.jar input_file.jar output_file.jar #7f7f7f false

Caveats:

There are certain uncommon features which the program does not support. Primarily, it doesn't support the use of the Pattern color space. (See the PDF specification §22.214.171.124 and §8.7)
The program converts all colors to the DeviceRGB color space (§22.214.171.124), meaning there might be a loss of gamut if the corresponding color was defined in a different color space.

Disclaimer: This is a project which I have personally developed. While I have nothing to gain from your use of the program, I still feel it is important to make it clear that I am the one who developed the program, and might be biased towards its use or otherwise.
Answer: If you want a more pleasing greyscale, and are OK with converting your document to images, throw this into a .bat file and then simply drag your PDF onto the .bat file.
"C:\Program Files\gs\gs9.20\bin\gswin64c" -o inverted.pdf -sDEVICE=pdfwrite -c "{1 exch sub}{1 exch sub}{1 exch sub}{1 exch sub} setcolortransfer" -f %1
convert -brightness-contrast 3,-18 -compress lzw  -density 300 -colorspace Gray inverted.pdf output.pdf

Requires Ghostscript to be installed for the first command (please specify correct path). Requires ImageMagick with legacy utilities to be installed for the second command.
Answer: Many had suggested using the Edit->Preference->Accessibility method but sadly it did not work for me.
After testing and playing around PDF setting, I managed to get what I wanted!

Go to Print (Ctrl + P)
Click Advanced Settings
Check Settings: Custom
Click on Output from left panel
Under Color: select Composite Gray
Check the Negate box
Click OK

This should do the trick!
Important Note!
I would suggest printing this file to a PDF than directly. Especially if you intend to print multiple pages in one page as it will result in the whitespace turning black too!
Lastly, if you are going to print the document as another PDF, under Page Sizing & Handling , click on Fit and check both the boxes - "Choose paper size when needed" and Use custom paper size when needed.
(To avoid unwanted whitespace)
Hope this help!
Comment: This is specific to your printer driver
Answer: Using ImageMagick worked for me, although the outputfile is about 50 times larger than the input one.
convert -density 300 -negate input_file.pdf output_file.pdf

Comment: The command line (in luinux) was :
convert -density 300 -negate input_file.pdf output_file.pdf


Using the metadata api to Deploy actionOverrides on a Standard Object

Question: I am trying to do as the title says and deploy an actionOverride using the metadata api. I have read everything in the developer guide (there isn't much). Has anyone had any success deploying actionOverrides on standard objects. I don't have an issue with Custom Objects.
Comment: No, I've had the same problem, where I couldn't find any elements associated with action overrides in the metadata xml that i pulled down using the ide. I've had to do it as a manual step to deploy it into each environment.
Answer: Had a look at this for you Daniel. Few postings of a similar nature around, such as this one. Sometimes such things are available as so call metadata subcomponents. But no joy here either (ActionOverride does not extend MetadataBase). Finally nor do I see it in the component types available when adding components to packages.
The docs do state it is only available for (and within) Custom Objects, but then as we know this data type in the WS schema is reused for Standard Objects as well, so again disappointing. Sorry but I think I'm concluding this is not possible.

Action overrides are defined as part of a custom object.
Comment: For somebody bumping into this: Now it is possible to deploy action overrides for both custom and standard objects as stated in docs https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/actionoverride.htm


is the smallest $\sigma$-algebra containing all compact sets the Borel $\sigma$-algebra

Question: Let $R$ be the smallest $\sigma$-algebra containing all compact sets in $\mathbb R^n$.
I know that based on definition the minimal $\sigma$-algebra containing the closed (or open) sets is the Borel $\sigma$-algebra. But how can I prove that $R$ is actually the Borel $\sigma$-algebra?
Comment: I think the question should say "_the_ Borel $\sigma$-algebra"
Comment: @Ana Well, that's what the exercise shows :) But what is written seems like a tautology.
Comment: In the second sentence, do you want to say _open_ sets?
Comment: @Dylan Moreland that is another definition of it
Answer: Well the Borel $\sigma$-algebra is the $\sigma$-algebra generated by the open (or closed) sets of $\mathbb{R}^n$. I believe (I don't want to put words in your mouth) you are asking whether the sigma-algebra generated by the compact sets is equivalent to the sigma algebra generated by the open sets.
Since $R$ is not the greatest choice when referring to a $\sigma$-algebra over the reals, let us denote the $\sigma$-algebra generated by the compact sets by $\mathfrak{C}$ and the Borel $\sigma$-algebra by $\mathfrak{B}$.
Now every compact set is closed so it's the complement of an open set; hence $\mathfrak{C} \subset \mathfrak{B}$. Now, we want to show $\mathfrak{B} \subset \mathfrak{C}$. Let $F \subset \mathbb{R^n}$ be a closed set. Consider $F_n = F \cap \overline{B(0, n)}$ where $B(0,n)$ denotes the open ball of radius $n$ centered at the origin. Now $F_n$ is a sequence of compact sets whose union equals $F$. This means $F \in \mathfrak{C}$. Hence, all closed and open sets are in $\mathfrak{C}$. By countable union and intersection we see that $\mathfrak{B} \subset \mathfrak{C}$. Thus, the two $\sigma$-algebras are equal.
Answer: It is enough to show that every closed set is in the $\sigma$-algebra. So let $C$ be closed, $x$ be an arbitrary point and $K_n$ the closed ball with center $x$ and radius $n$. Then $K_n\cap C$ is compact for all $n$ and $\bigcup_n (K_n\cap C)=C$.
Comment: The important fact that entered this argument (and the other answers) is that $\mathbb{R}^n$ is a countable union of compact sets. In a general topological space, the $\sigma$-algebra generated by the compact sets is strictly smaller than the Borel $\sigma$-algebra. The easiest example of this probably is the discrete topology on an uncountable set: the $\sigma$-algebra generated by the compact sets (=finite sets) is the countable-cocountable $\sigma$-algebra, while the Borel $\sigma$-algebra is equal to the $\sigma$-algebra of all sets.
Answer: Let $\mathcal{B}$ denote the $\sigma$-algebra of Borel sets, i.e. the smallest $\sigma$ algebra containing the closed sets. Let $\mathcal{C}$ is $\sigma$-algebra generated by all the compact subsets of $\mathbb{R}^n$.
As you mentioned in your previous question, Are all compact sets in $ \Bbb R^n$, $G_\delta$ sets? , all compacts sets are closed. Hence $\mathcal{C} \subset \mathcal{B}$.
My answer to your previous question showed that all closed sets are $G_\delta$. Hence all open sets are $F_\sigma$. Let $U$ be an arbitrary open set. Let $(F_n)$ be a sequence of closed sets such that $U = \bigcup_{n \in \mathbb{N}} F_n$. Let $\bar{B}_k$ be the closed ball of radius $k$ centered at the origin. Define $C_{n,k} = F_n \cap \bar{B}_k$ is a closed and bounded subset of $\mathbb{R}^n$. Hence $C_{n,k}$ is a compact set. So $U = \bigcup_{n,k} C_{n,k}$. Thus $U$ is a countable union of compact sets. So $\mathcal{C}$ contains all the open sets. $\mathcal{B} \subset \mathcal{C}$.
Finally, $\mathcal{B} = \mathcal{C}$. The two $\sigma$-algebras are identical.


Doubt in magnetics

Question: Two current carrying wires kept at a distance will repel each other if they have currents in opposite directions. In the case of a current carrying square loop, would two opposite sides also repel each other?
I think there would be a repulsive force which would cause a strain in the other two wires. Can somebody rectify this?
Comment: oooooeeeeee thats a good question, but if you have just a loop of wire with a power supply, you will end up with a short circuit, which should cut it out, removing any potential repulsive effect
Answer: Yes,  they two loops would repel/attract each other based on their orientation. In fact, a bar magnet works in a similar way.
Answer: Yes, running a current around a wire loop creates Lorentz forces that act to expand tbe loop and stretch the wire.
An alternative way to think about this is in terms of the magnetic pressure. The current produces a magnetic field passing through the loop and this in turn is responsible for a magnetic pressure $B^2/2\mu_0$ (in SI units and which is equivalent to the energy density of the magnetic field).
According to the wikipedia page cited above it is possible to pass enough current to force the wire into a circular loop (the minimum energy configuration) or even to stretch and break the wire.

Doubt in magnetics


How can I implement private Org-wide defaults access to draft Knowledge articles?

Question: My client wants to allow some users to see only draft knowledge articles created by them.
I assummed that I could implement this using sharing setting and set Knowledge object to Private Organization Wide Defaults.
To my surprize Knowledge object is not listed in Sharing settings to setup OWD.
Is there are any way to implement private Org-wide defaults access to draft articles?
Answer: Go to Knowledge Settings and Check Use standard Salesforce sharing checkbox in Sharing Settings section

After this is applied, the Knowledge object becomes available in Sharing Settings


Can I replace my 10 speed Shimano cassette with a 9-speed Shimano cassette on a Bontrager non-specific 10 speed hub

Question: I removed a Shimano HG 10 speed cassette from my Bontrager rim and it has a indexed spacer below the 10 speed cassette. I want to install a Shimano HG 9 speed cassette on that hub. I have a 1 mm non-indexed spacer that I had bought in anticipation of doing this. The indexed spacer that is on the Hub is definitely thicker than 1 mm. I am wondering should I leave the indexed spacer in place and also install the 1 mm spacer that I have before I install the 9-speed cassette and tighten it down or should I install the 9-speed cassette on top of the original indexed spacer and not use a 1 mm spacer?
Answer: The term "indexed spacer" isn't a standard one.
Some (many) 10-speed Shimano cassettes come with a 1mm spacer that's always used except with a very few hubs.
What's in question here is whether your wheel has an 8/9/10 HG freehub body, or 11-speed road. (If it's a road wheel from around the last decade, it's probably 11-speed-compatible).
If it's 11-speed road (36.85mm long from the end of the freehub body to the shoulder that the cassette/spacer rests against), and it's any kind of normal road or mountain 9-speed cassette, you'll use a 1.85mm spacer under it.
If it's 8/9/10 (35mm long), you don't use any spacer.
Comment: Thank you for the great advice, what I meant by a indexed spacer is that it has the shape of the Hub stamped into it so that it slides on the Hub as the cassette does. I believe that spacer is 1.85 mm. I guess I'm not sure if I should leave that spacer in place and not use the 1 mm spacer that I had bought in anticipation of changing the cassette from a 10 to a nine. I will have to try to make some of the measurements that you mentioned. Thanks again for the great advice I really appreciate it
Comment: If it had it before, yes use it. It's an 11spd conversion spacer. The 1mm spacer is here nor there for nine-speed.
Answer: I have found at least two combinations of cassette and freehub that do or do not need spacers, when the expectation was opposite.
I prefer to fit the cassette and do up the lockring, and then see if it needs more spacer.   The cassette should not have lateral play and still have sufficient thread engagement on the lockring to tighten it all down.
Note: spacers go between freehub and cassette.  You should not put a spacer between cassette and lockring/locknut.
Comment: Okay that is pretty much what my Biking friend told me to do. So I guess I will just leave the original spacer in place which seems to be a 1.85 mm and install my 9-speed cassette on top of that. So I guess I should be looking to tighten the lock ring down enough to where it's in place very tightly but still has room to be tightened down just a bit more
Comment: @Michael I'm concerned about your last sentence. The lock ring should be tightened to 40 Newton-meters, which is quite tight, leaving no room for "a little more" when one is using standard length tools (which I define as having an 8-10 inch handle portion as found on, say, a common adjustable (Crescent) wrench, a 3/8" or even 1/2" drive ratchets used with a socket). Using a torque wrench and a 1" socket (usual size of the hex flats on a lock ring tool) if & when 40N•m is reached, that's it: a torque wrench will click and a normal man using a tool mentioned above won't coax it in a bit.
Comment: Thanks much Jeff, I guess what I meant by " a little more" is that there would still be some thread left on the Hub after reaching tightness of 40 newton meters. I realize you would not be able to know if there is thread left unless you tried to tighten Beyond 40 Newton meters which would probably destroy your Hub threads at some point. I will get out my trusty old torque wrench and use that rather than guessing that it's tight enough.