How much do ball bearings wear?

Question: I have a rescued bike with rear Maillard Helico Matic hub. I decided to replace the ball bearings and removed the old ones. Cages, balls, and cones looked ok. I measured old balls and they were cca. 3,7mm in diameter. I looked around on the intewerbs and found this site with the picture below. The hub on the picture looks exactly like mine. Well, the decal has a bit different graphics but by eyeballing everything else is identical. The picture says that this hub takes 5/32" ball bearings, which is bigger than my measured 3,7 mm by about 0,2 mm. Is it possible for ball bearings to wear this much?
Comment: @ChristianLindig I have used Vernier caliper. I know how to use it. And... no pictures taken. I find it also odd for ball bearing to wear this much and still remain round. I have measured balls in different orientations. I suspect that someone refilled the bike with wrong size ball bearings.
Comment: It's unlikely that ball bearings wear this much. 5/32'' is 3.97mm - so it would be even more than 0.2mm. How did you measure the diameter? Could you post a picture of the measurement?
Comment: You're assuming they started at the nominal size.  I suspect someone's replaced them with a set of slightly smaller ones, which is fine if they're all the same size.  You'd be better getting the correct size for a rebuild though - bearings are cheap.
Comment: Unless subjected to corrosion or excessive dirt ball bearings do tend to remain remarkably round as they wear.  0.2mm sounds like quite a bit, but not beyond the realm of possibility.
Comment: What is the source of the photo? I find it odd that the cones and locknuts are metric while the bearings are imperial.
Answer: When bearings wear down, they tend to wear unevenly. They pit and chip and generally come out of round. The races tend to look equally rough if they're the same age as the bearings. If all is looking to be in fairly good shape, I think it's far more likely that someone has previously serviced the hub and used slightly smaller bearings.
Comment: When bearings pit and chip and go out of round they wear more rapidly, but bearings can wear substantially with no visible problems.  This is why if you replace one ball you should replace them all, since a new ball is apt to be larger than the rest, and that *will* cause the bearing cups/cone to pit and wear out of round.

How much do ball bearings wear?


Sitecore Form Validation to Match 2 field Values

Question: I have requirement to match 2 field values in Sitecore Form. If value doesn't match then form shouldn't get submitted. How to handle this scenario.
Comment: Sitecore forms provide email/password confirmation fields out of the box. Have you used custom form fields for your requirements?
Comment: I need to apply that on 2 Single Line(OOTB) Text field.
Answer: I would say use OOTB conditional logic for your forms. Check if this is possible by following the link - https://doc.sitecore.com/xp/en/developers/93/sitecore-experience-manager/use-conditional-logic-for-your-forms.html
To add conditions:

On the form canvas, click a form element to select it.

In the relevant field, in the Form elements pane, in the Conditions section, click Edit Conditions.

In the Conditions dialog box, add the relevant conditions. For example, if for a survey commentary you want to know the reasons for people rating your product poorly, you can display a multiline field. If visitors rate the product well, you can display the submit button. To do this, click Add condition and enter the IF and THEN fields.

Note:
Depending on the element you select, the available options from the drop-down list in the target field can differ.
You can add multiple actions for different target fields in a single condition group. If the conditions evaluate to true, all actions will be executed.

Click Apply and save the form.

The conditions now display in the Form elements pane. Click Edit conditions to change them.

Option 2 : If above option is not working then try to Create New Conditions by following -https://inspeerity.com/blog/sitecore-forms-create-new-conditions
Below is for showing Single line field based on radio button, so you can use something like this.

Sitecore – create new action type (clear) under /sitecore/system/Settings/Forms/Meta Data/Conditions/Action Types/

JS – add new action, just after disable action:

clear: function($target, action, conditionsResult) {
if(conditionsResult)
{
$target.val("");
}
},

JS – add new line with clear in actionLinks, so it would look like this:

actionLinks: {
show: "hide",
enable: "disable",
clear: "clear",
"go to page": "go to page"
},

And now you'll just have to set this new condition in form editor and see the result.
Answer: It could be possible with Sitecore Forms Conditional Validation, Here is the link that matches your case https://www.oshyn.com/blog/sitecore-forms-conditional-validation-p1
Just a few twics are required

You need to use Single line text rather than Number.
Update form.custom.validation.js file (just remove number checking)
&& !isNaN(otherField.val()) && !isNaN(value)
Compare with "=" instead of ">" or you can update the code to compare string with string.Equals(val, "astringvalue", StringComparison.OrdinalIgnoreCase) in Validator class

I'd also recommend updating variables and method names as per your requirement and cleaning up the redundant code. I'd strongly recommend server-side validation as well for such implementation.
I tried by my self and here is the result.

I hope this helps!


Which Fiasco playset resembles Pulp Fiction?

Question: Fiasco is an RPG creating movie tropes. There are playsets for all genres, from horror to western to romance. Is there one that matches the vibes of Tarantino Pulp Fiction (i.e. a dark satiric gangser imbroglio)?
Comment: I don't think this is appropriate to close. This is asking for a recommendation, but it's not a game rec request. It's pertinent that game recs failed because they always surfaced the same set of crowd favourites and answers often weren't justified. This just isn't that kind of question. It's well-constrained & can receive good answers. D&D players get to ask for recommendations about what what part of the game will help them solve their problem. Why doesn't a Fiasco player get to ask which available playset in their game's domain will help them approach a particular narrative?
Comment: @doppelgreener D&D adventure recommendations are regularly closed as shopping questions even if requirements are clear and question can be answered objectively? Why Fiasco should be exempt from no shopping questions rule?
Comment: As a product identification it would be allowable, but as a shopping question not.
Comment: @Molot because Fiasco is a pan-genre system about purely dramatic play that encompasses a vast variety in its playsets, from slasher to wuxia, sportsball to suburbia, "city comma state" to "CYBER.COMA.STATIC", and as per my answer, the components of the playset are usually credited to some inspiring media when possible. "a Fiasco playset that does Pulp Fiction" is pretty much a product identification, like "a D&D module featuring Bluedor the Gold from the 1987-89 Lost Orb series by Weena Mercator" (I have made this up).
Comment: @Mołot Because those questions are closed incorrectly because the decision to ban shopping questions has been wildly mis-applied and over-construed.
Answer: Oddly enough, there are none that explicitly do.
Fiasco playsets wear their influences on their sleeve - literally. A standard part of every playset PDF is its Movie Night section, which mentions the various forms of media that inspired the elements that went into the playset.
I checked my personal collection of playset books and the Bully Pulpit site, and there wasn't a playset with Pulp Fiction listed under Movie Night.
But you could do worse than Run, Fools, Run.
An official Bully Pulpit release (though PDF only) Run, Fools, Run is a series of three connected playsets: The Last Heist, which is what it sounds like, White Line Fever, the rickety getaway drive afterwards, and The Murderists, who stalk down the white line and clean up the mess.
The Last Heist puts Reservoir Dogs in its Movie Night section, and while Pulp Fiction doesn't explicitly show up in The Murderists, it's absolutely got some murderists in it.


Network Security

Question: I have been a .net developer for the past three yrs. Just curious to know about the network security field. What kind of work does the developers working in these area do? I really have not much idea about network security but what my understanding is these people are involved in securing network, preventing attacks on network  as obvious. Could any one please give me some details about this field and also what does it take to move to this field.
Answer: Network security is a vast subject.  On the developer side, I think you would most likely be concerning yourself with lots of encryption schemes and process security.  There are basic things like using SSL for network traffic of a program to more advanced subjects like preventing any traces of a sensitive operation from remaining in RAM after a program has processed (and probably encrypted) it.
Answer: Take a look at "Security Engineering" by Ross Anderson.  The first edition and part of the second are available for free online here.  While he talks about many non-network issues, the principles mostly apply.
Answer: Today, you would need to become an expert in TCP/IP protocols. Everything from ARP, DNS, UDP, ICMG, BGP, and on and on. Most networks are IP-based, with IP-based firewalls. The firewalls will allow, for example, "TCP traffic on port 80" to come through. You need to be able to understand if that traffic is valid web surfing, DOS attack, or otherwise malicious. This can only be accomplished with detailed understanding of how IP networks work. Ditto for other protocols like DNS. In addition, lower-level understanding of ethernet communications and other means of transport (like cell phone networks or WiFi networks) would be important. I suppose it depending on what you mean by "network security" - to me this is below the application layer.

Network Security


How can I tell what version of Might and Magic: Heroes 6 is installed using Steam?

Question: Is there any way I can check what version (for example v1.0.2) of Might and Magic: Heroes 6 is currently installed via the Steam client?
Answer: If you want to know the version of the game, you can find it in the main menu in the lower right/left corner.
However, be aware that Steam does not patch Heroes 6.
It's patchable through the Ubisoft Installer application which in turn is installed by Steam when it enters the prerequisite stage of the game installation phase. Whenever you launch HOMM 6 via Steam it automatically launches the Ubisoft application which checks if there is a new patch.
Comment: @mikemaccana The question is really just asking about HOMM6, although it's poorly worded. I've updated the question (and title) to make this more clear.
Comment: Thanks! It does seem however, that you do have to verify the game cache after each ubisoft update
Comment: This answer doesn't answer the question 'How can I tell what version of a game is installed using Steam?', as it is specific to a single game.
Comment: @Wipqozn Fair enough. I wanted to find out what version of another game was installed, but I can ask a separate question.


find date and time user last access database

Question: I need to find the last time a user accessed the database.  I am new to SQL and rarely have to use it.  Details would help or links to learn those details.
Comment: The options and syntax change with the type and version of the database.  What type  (MS SQL, Oracle, Postgres, etc) and version are you using?
Comment: MS SQL     Microsoft SQL Server Management Studio      14.0.17254.0
Microsoft Analysis Services Client Tools      14.0.1016.251
Microsoft Data Access Components (MDAC)      10.0.14393.0
Microsoft MSXML      3.0 6.0
Microsoft Internet Explorer      9.11.14393.0
Microsoft .NET Framework      4.0.30319.42000
Operating System      6.3.14393
Answer: Short answer, most default configurations do not track successful SQL access.
There are a bunch of ways that you can start tracking, (based on your configuration, as mentioned by @kevinsky in the comments.)
You can look into to those to see if any have been implemented. If not...
Answer: For MS SQL server logins are not automatically tracked but this can be easily enabled with the Common Criteria Compliance option.
From the link you would run this
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'common criteria compliance enabled', 1;
GO
RECONFIGURE WITH OVERRIDE;
GO

Then restart the database and run the scripts here from Microsoft.
The logins can be accessed with this query
Select * from sys.dm_exec_sessions

You need elevated permissions (View Server State or higher) to query this table.


What will be the best battery solution for keeping electrical power a tradable commodity in an industrialized star system?

Question: On Earth, electricity became a tradable commodity thanks to Chile in the 1980s, it has since become a staple of international economic markets. One would assume the same outcome to happen on the interplanetary stage. However, unlike on earth, we can't string-cheese electrical conduits across the kinds of distances between orbital masses, and whilst 'beaming' electricity via laser beams is already a technology we are experimenting with today, and we could potentially use massive supercapacitor stations to store the output via static charge, which might even negate leakage thanks to vacuum, what are some of the more effective/portable alternative battery solutions for a Type II and beyond civilization?
Comment: electricity became a tradable commodity thanks to Chile in the 1980s? can you explain? Electricity was sold way before the 1980's
Comment: Have them haul super concentrated coal around the galaxy instead, aka diamonds
Comment: To convert coal into electricity, maybe you need water and oxygen also. This is not really a direct solution.
Answer: Hydrogen fuel cells.

fuel cell
https://www.eia.gov/energyexplained/hydrogen/use-of-hydrogen.php
Yep.  Hydrogen and oxygen.  Both stable.  Mix them and let their love make electricity.  Just water in the end.  Not that fantastic or fabulous.  It would be kind of neat if you could plug the cell in and run it backwards and regenerate your H2 and O2 from the water.  That can be the fiction.  Maybe while you are getting crazy you can have bananas that are blue too!  And spell "Korean" with a Q.  Ok, ok going to settle down.

Much more fun for a fiction battery would be cold fusion batteries, or antigold ions trapped in charged buckyballs.  Maybe transactinide drip fission cells?
But if you want actual real batteries it is hydrogen fuel cells.
Comment: Fuel cells almost always run from fuels stored externally. A "spent" fuel cell would be one with catalysts or electrodes that have degraded beyond being useful.
Comment: @Trish You don't develop this hydrogen storage capacity in a vacuum. Most non-beam-rider spacecraft will use hydrogen, be it as fusion fuel (Deuterium and Tritium as well as the similarly leaky Helium3) or as reaction mass. While ion drives are great, you don't run a Type 1 civilizations shipping needs on rare noble gases. The the problem will be solved. Is freezing it the best option? Depends, you might need it in fuel pellet form anyway. Maybe methane is the superior way for storing in. Concerning it's energy density, MJ per L is bad, MJ per kg is amazing (we care about the latter in space).
Comment: *"it would be kind of neat if you could plug the cell in and run it backwards and regenerate your H2 and O2 from the water. That can be the fiction"* I think you meant O (oxygen) rather than O2 (doubly ionised oxygen)? Umm, so that'd be electrolysis of water then, somewhat wkte mundane reality, not fiction at all .. so are we testing someone, being humourous or just having a senior moment?  Ah! *"blue bananas"*, humourous with a touch of irony it is then
Comment: @Pelinore - I am ignorant about how actual hydrogen fuel cells work.  Agreed;  not especially creative fiction that you could run electrolysis in the fuel cell.  I had this idea that in real fuel cells, hydrogen from a different source was loaded in spent fuel cells,   If you could recharge them they really would be batteries.,
Comment: @ChristopherJamesHuff - ok, good.  That was my impression.  A fuel cell you could recharge with an external current would really be a battery.
Comment: Hydrogen is a **horrible** thing to save energy, because the molecules are so small that it leaks from literally every container it can be stored it and thus gets less over time.
Comment: @Trish Graphene sheets can be used to make leak prove containers. Not even the ever elusive Helium can escape from those. Additionally, you can freeze it into a solid to deal with the leakage. Once it is frozen, wrap it in several independent layers of reflective foil and let the vacuum of space keep it cool.
Comment: @TheDyingOfLight You mean you prefer 14 Kelvin Hydrogen? Which sublimes into a gas at the slightest contact with anything warmer and will over time make its tank very brittle? Where you need to use helium as a cooling medium, because everything else is already a solid? And keep it all at temperatures that over time make everything super brittle and prone to breaking? Hydrogen is a horrible medium, and atop that has a super low energy density.
Answer: Batteries store energy chemically in structures that also have to carry electricity and mechanically support the cell, among other requirements. Capacitors are even worse: rather than storing energy in chemical bonds, they store it in a physical charge difference between conductive plates. The highest-capacity versions actually also do some electrochemistry of a sort on the surfaces of those plates, but still fall far short of batteries in energy density.
It's far more effective to transport tanks of chemicals that can be reacted when needed, for example in fuel cells. Another example is chemical rocket propellant...which also demonstrates that even this isn't likely to carry enough energy. With chemical rockets, it is difficult enough just to carry return propellant all the way to your destination. Low-cost interplanetary transportation with chemical rockets will require refueling at your destination, and for any but the shortest hops, that's likely to take more energy than you can deliver as payload.
And you can't avoid this by using non-chemical rockets. Perhaps your transport could be a solar-electric craft with huge solar wings, or a beam-rider with a smaller laser collector, or it could be powered with an advanced fission or fusion reactor...but all of these give you far more effective ways of getting energy to your destination. The energy demands of interplanetary travel are just too high to make shipping chemicals around a useful way to trade energy.
Answer: Antimatter and beamed power, at least for a while
Refining antimatter takes a lot of energy. In the inner system this means solar power, in the outer system fusion energy. While it is currently quite inefficient to produce antimatter, the facilities we use aren't dedicated refineries and there are theoretical possibilities like Q-mirrors.
For some purposes beamed energy (be that laser, particle of projectile beams)(a kilometer seized receiver isn't an issue in space) or Helium3 freighters might just be better options for some times and purposes.
However as civilization advances you will likely move towards matter to energy conversion technologies. Black hole Penrose processes, Kugelblitz micro black holes, magnetic monopole based conversation technology, ... Something will pan out in the long run. At this point is is E = m * c^2 * efficiency. So ultimately the civilization will be transferring mass (hydrogen would be my guess), as it is much simpler to handle than the alternatives and use local conversion reactors.
Answer: If you want crates of energy-containing things being shipped around the solar system, then hydrogen fuel cells are probably the way to go.  Someone else has already mentioned that, so I'm going to raise a couple options that most people don't consider.
Lasers: Instead of batteries, use tightly focused and very, very carefully aimed laser beams.  Much faster delivery time, and possibly fewer issues with degradation in transit.
Big rocks: Loosely speaking, a "battery" is just a means of storing energy.  It's completely possible to do that in the form of gravitational potential energy - for example, pumped hydro-electric storage, where you pump water uphill past a dam so you can release it later.  You can't really haul a lake to another planet, but anything drifting through space has lots of gravitational potential energy.  If your civilization doesn't want to throw moons at their inhabited planets for some weird reason, they can just send spacecraft around carrying really big weights.  On receipt, the weight gets attached to the upper end of a space elevator, and its trip down into the gravity well generates energy.
Hyperspace travel: If your FTL system uses something like an Alcubierre field, then an arriving ship may announce itself by hucking a smorgasbord of high-energy particles out in front.  Set something up at the starport to catch this and you have free energy.  (As an added bonus, this will protect your planet from having a mass extinction event every time someone comes to visit.)
Comment: The problem with lasers: you are dealing with distances in the lightyears. Unless you can get the light truely parallel (you can't), then you will lose energy to the deep space by virtue of the target area getting positively huge. As in, Solar-system-size.  This also weakens the impact on any point it hits by the square-cube law... so, no danger to the target.
Comment: @Trish "you are dealing with distances in the lightyears": no, we're dealing with distances measured in AU, or even less...perhaps even less than a light second.
Answer: Even in space, one of the best energy densities you can achieve is in liquid or solid hydrocarbons. Such hydrocarbons can be made on planets that have plant life and ample light - simply by planting algae and fermenting them into alcohols. These can be processed into longer chain hydrocarbons easily in chemical plants.
Not all places humanity settles have the required ability to sustain plant life or are too backwater to have large enough chemical plants to process enough fuel. Those little fringe markets however are unlikely to be serviced too often: To get anywhere, the ships need all their fuel to get there, and selling it at the destination is exactly the opposite of what you'd do: you need to buy more to get back!
Sadly, for all but fringe cases, trading any energy on an interstellar level is unfeasible.
Fuel as battery however, requires a generator as a converter, but those are comparatively small. The best method to earn from energy is to transport this equipment as a commodity.


How to add higher strings onto an 8 string guitar?

Question: I want to extend my guitars upper range then the lower range, the highest note is a B6, high e. I want to have my highest note being in the B8 range if possible. but open string wise, i would rather have 2 higher strings then 2 lower ones. How can this be achieved?
Comment: It's unclear to me what you mean by those pitches. At any rate, it's not really feasible to tune a standard-scale string length (steel strings, no matter what gauge) to higher than A4; even G4 is pretty fragile. It would probably work with titanium or aluminium-alloy strings, but those wouldn't be suitable for magnetic PUs.
Comment: Another solution you could try is an octivator pedal or use harmonics.
Comment: If you want another string on your guitar it would become the high A, the Brahms guitar has a High A string.
Comment: Just also wondering if you know that a B8 is like just shy of 8kHz? There is no reason to need to piece people's ears with that is there?
Answer: First off, on an E standard tuned guitar (ie, a high E4 string), with 24 frets, the highest fret-able note is an E6. Remember that the notation for guitar is written an octave higher than it sounds. For playing higher than that there are a few options.

Higher tuned strings. Up tuning very thin, plain steel strings is the most obvious option, but also difficult. You have to take into account the scale length as well, and this will work much better with a shorter scale length like 24.75". According to string gauge calculators you can get a 'G4' with a .009" string at 17 lbs of tension alright, and even a 'G#4' with a .008". Getting an 'A4' is much harder but would be doable if you don't mind playing really soft so as not to break it since you might need a .007". A 25.5" would have a much harder time with this, and any more tension has the tendency to break strings at such low gauges.
Multi scale length. When manufacturers started making 8 string guitars some of them realized that having the same scale length for all 8 strings was a huge compromise, so they looked into making them all different. Fanned fret designs started to gain popularity as did headless designs, so now we have brands like Strandberg that make a living off of selling these style of guitars. Getting a custom made guitar with a short scale length for the high strings would be the best way to up-tune. Something like a 23" scale length could tune to A4 with a .009" or .010" with 20 lbs. of tension easily, allowing you to use regular string gauges. If you use thin gauges you could potentially tune up to B4 for a high note of B6. Unfortunately, this short scale would be rather awkward to play if you wanted a normal, 25.5" scale length for your low strings. The fanning of the frets would be quite extreme, and the custom order would surely be expensive.
Short scale length. Buy or custom order a guitar with an overall shorter scale length. This will most likely severely effect the tone of the low strings and may even require ditching them, but it may be cheaper than a multi scale instrument. Another option would be to ditch guitar altogether and play the mandolin.
Play with more harmonics. This is what most guitarists do, and I especially notice it in metal. Pinch/artificial harmonics are the best way to play extremely high with a standard tuning, and with distortion they lose little energy or tone. Using thicker strings can make it easier to get strong harmonics out of them.
Answer: Given that it's a normal 25" ish scale guitar, and you want to get a top string up to three and a half octaves above a normal top string, it's hardly going to happen. Imagine going up one octave. The standard string, say .010", will have to be approximately twice as tight. Two octaves, way tighter still. Or, for about the same tension, one octave higher, half as thick. So without going into detailed maths, for what you are hoping, it's a string about .003" - much finer than human hair, and under far more tension than the other strings. Quite well on the road to breakage!
The other option is to shorten the string/s somewhat like a banjo, which requires major surgery on your neck.


Spearman vs. Pearson for an evenly distributed variable. Can I just choose the coefficent with the stronger correlation?

Question: I am doing my thesis using a a non experimental descriptive correlation analysis with continuous ratio data. One of the variables is unevenly distributed.
I have calculated Pearson's correlation coefficient ($-0.61$) and Spearman's correlation coefficient ($-0.48$), and I am now deciding which one to use. I have checked the distribution of each variable using The Kolmogorov-Smirnov test of normality and one of the variables is not normally distributed and the other is. Ideally, I would prefer to use Pearson's (as the correlation is stronger) but everything I have read has said to use Spearman's if unevenly distributed. Which should I use? Why is Pearson showing a stronger correlation?
Comment: Read topics with "Spearman Pearson" on the site.
Answer: Pearson's and Spearman's correlation coefficients have nothing to do with normal distributions (or with uneven distributions). Pearson's correlation coefficient measures the linear relationship between two variables, so if you were to check anything, it would be this.
Draw a scatter plot of your two variables and check if the relationship looks linear, if it doesn't, then Pearson's r is not appropriate. If the relationship is not linear but is monotonous then you can use Spearman's rho.
Pearson's r is a parametric measure, and as such has higher power (more easily detects effects) compared to non-parametric measures such as Spearman's rho, meaning if the relationship is truly linear then Pearson's r will have a higher (absolute) coefficient. However, this could also be for other unrelated reasons (such as outliers), so you cannot decide on which measure to use based solely on the coefficient.
Comment: I have been unable to reconcile your initial statement that the Pearson correlation is unrelated to Normal distributions with your later statement that "Pearson's r is a parametric measure." Could you explain what you mean by the latter?  What is being parameterized, if not some family of distributions, of which the Normal family would be the most natural in this context?
Comment: @whuber I don't know. I guess the Pearson correlation coefficient can be parametric if used to estimate the parameters of a multivariate normal distributions, or it can non-parametric if making no assumptions about the data. Maybe the statement `Pearson's r is a parametric measure` is wrong.
Comment: It's unclear what "parametric measure" even means.  The term "parametric" is applied in situations where procedures assuming a finite-dimensional distribution family are used.  The definition and interpretation of any "measure" (or statistic or metric or anything else like that) rarely, if at all, refers to any such distributional family.
Answer: Have you read about Anscombe's quartet? Get that data and compute the Spearman's r and also Kendall's tau; the results are interesting. Bivariate correlation analysis is quite limited and can be misused. Do a scatter plot and let the reader decide.
Comparing Spearmans r and Pearsons r is like comparing apples and oranges: they have different meanings, so don't do it.
Also, it's relatively easy to achieve P < 0.05 (against the null hypothesis that r = 0) but large sample sizes are needed for narrow confidence intervals. If someone reports only r = 0.xx and P < 0.05 without any scatter plot, I can't accept that as evidence.


Is there a place to get raw consumer data?

Question: I was looking at an app on Iphone which allows people to track their meals, and trying to think, how would I build variance of taste into an economics sim ? And the only thing I can think is raw consumer profiles, which this app which stores things online would likely be collecting. But it would be collecting these things and SELLING them. Is there a free place I can say find data samples related to what people eat daily or what forms of entertainment they most frequently consume ? It seems like a very difficult thing to emulate really, but at least I might gain a few insights.
Comment: Welcome to Econ StackExchange. Please consider mentioning a country whose data you are looking for.
Answer: Two sources come to my mind for USA. Both sources, as far as I can remember, are free.

CES - Consumer Expenditure Survey: This has information about expenditures and incomes of consumers across USA at different points of time. You can access the data from BLS https://www.bls.gov/cex/

ATUS - American Time Use Data: This collects the time people spend doing things. You can access this from BLS, https://www.bls.gov/tus/

IPUMS also has access to ATUS, along with MTUS (involving different countries).
Also, you can check this paper; I do not remember if their data is available for free, but it may be helpful to you:
Bajari, Patrick, Denis Nekipelov, Stephen P. Ryan, and Miaoyu Yang. 2015. "Machine Learning Methods for Demand Estimation." American Economic Review, 105 (5): 481-85. DOI: 10.1257/aer.p20151021


what are the advantages and limitations of OFBIZ framework 9?

Question: I am new to OFBIZ 9.I would like to know what are the advantages and limitations of using OFBIZ ERP based framework.Does anybody having thoughts about this Please share with me...
Thanks & Regards,
SARAVANAN.P
Comment: I can see from your questions, you've been using OFbiz for some time - so what area specifically do you want to know
Answer: I guess that the version number is not important here. You're just asking for Ofbiz in general, right? I wrote a blog post about how time consuming it is to start with Apache Ofbiz in comparison with Broadleaf Commerce. I cannot talk about the other components that the shopping cart itself, because I didn't need almost any of them.
The advantage is, that after you spend the time learning and investigating the engine and develop a production ready shopping cart. It is not so hard to change / modify it to come up with another custom cart. And if you anytime need an advanced components like promotions, accounting (billing, invoicing), CMS or CRM, you will be ready to add them.
The disadvantage is, that the framework is good for truly custom development for rather medium and big businesses. It's not like that you would come up with a SaaS where you would rent shopping carts that suits needs of small businesses. The entity model and administration is flexible, but the one who makes the changes is the developer. The developer adds/changes groovy scripts that define the product etc.
Answer: I've been working for about a month with ofbiz. And I've found it to be very difficult to follow and understand because of the lack of online resources.
The official documentation is outdated, in http://www.stackoverflow.com I have not found many questions and answers to the issues I've had when working on ofbiz and I haven't found recent books on ofbiz either. The only place that really helped me understand ofbiz has been HotWax University http://www.hotwaxsystems.com/company-news/hotwax-university/
I do appreciate that big parts of the logic that you'd have to implement are already implemented. But, imho, given it's so big and complex, you have to have a very good knowledge of how to build an ERP before you feel comfortable with ofbiz.
Answer: Today there are some books and many tutorials to learn functionalty:
https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Related+Books
As a user you could just download and run OFBiz to explore the interface
and e.g. the ecommerce application.
As developer you could read a startup tutorial:
https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide
To understand the data model and the overall functionality of
OFBiz you could read the Data Model Ressource Book,
which gives an excellent explanation of the
basis, on which OFBiz operates.
This question has not been posted yesterday, but the answer about 7 years
later could be: there is anupdated documentation and in Version 16 some important simplifications (e.g. from minilang and java to groovy), so it seems worth exploring OFBiz from a todays perspective.


Intersection of functions given asymptotic relationship

Question: If $f(n) = O(g(n))$ and $g(n) \neq O(f(n))$ than can we say that $f(n)$ and $g(n)$ will never intersect?
Comment: We discourage posts that simply state a problem out of context, and expect the community to solve it. Assuming you tried to solve it yourself and got stuck, it may be helpful if you wrote your thoughts and what you could not figure out. It will definitely draw more answers to your post. Until then, the question will be voted to be closed / downvoted. You may also want to check out [these hints](http://meta.cs.stackexchange.com/q/1284/98), or use the search engine of this site to find similar questions that were already answered.
Comment: It's even possible for two functions to intersect infinitely often. (cc @YuvalFilmus)
Answer: The asymptotic behavior of a function only depends on its value on "large" inputs. More formally, let $f$ be an arbitrary function, and let $f'$ be obtained by changing finitely many values of $f'$. Then for every function $g$, $f = O(g)$ iff $f' = O(g)$.
I believe that you can now answer your own question.


HTML Signature in Evolution

Question: I've tried cut and pasting the html code for my email signature that works fine in various other email clients and doing it in html formating, not text, when saving the signature, but the code never turns into the proper formatting.  Instead it just shows the text of the html code when I try to use the signature.
Answer: This appears to be a bug in Evolution 3.10.4
There is a simple workaround though. Write your html signature in a file called signature.html Test that it works by opening it in Firefox. Then when you have finished writing a message add the signature by using menu item insert -> html file.
Comment: I know this thread is old, but am I expected to do it every single time I compose a new e-mail. This thread is still relevant as much as html signature do not work in the latest version of Evolution still (3.36.3)
Comment: This worked for me, but **before** using `insert -> html file`, I needed to change the `Format` dropdown value from `plaintext` to `HTML`.  If I changed the `Format` value **after** `insert`, then it would **not** work.
Comment: To automatically insert your signature, go to Edit -> Preferences -> Mail Accounts -> Click on the Account Name -> Edit -> Identity. Under Optional Information, Pick the Signature and click OK.
Answer: The better workaround is to create signature.html and signature.sh (also chmod +x it)
signature.sh:
#!/bin/bash
cat ~/.signature.html

In Evolution: File -> Composer Preferences -> Signatures -> Add Script -> your script on file system
Answer: signature.sh doesn't work for me.  I got this to work by:

Create signature.html file
Test in Firefox as above.
Insert into a new email message in Evolution.
Copy the inserted signature.
Paste the signature in an "Add Signature" dialog.
New signature can be inserted and looks as expected.

Now, I can't seem to get the signature to automatically be inserted into email messages....
Answer: Seems still not to be fixed in Evolution...
Another workaround:

Go to ~/.config/evolution/signatures
Add a "dummy" html Signature in Evolution
This will have create a new file in signatures folder (filename is random id)
open this new file and paste your real html code there (without double dash+space)

HTML Signature in Evolution


PHP Simultaneous File Writes

Question: I have two different PHP files that both write to the same file. Each PHP script is called by a user action of two different HTML pages. I know it will be possible for the two PHP files to be called, but will both PHP files attempt to write to the file at the same time? If yes, what will happen? Also, it is possible to make one of the PHP fail gracefully (file write will just fail, and the other PHP can write to the file) as one PHP function is less important that the other.
Answer: The usual way of addressing this is to have both scripts use flock() for locking:
$f = fopen('some_file', 'a');
flock($f, LOCK_EX);
fwrite($f, "some_line\n");
flock($f, LOCK_UN);
fclose($f);

This will cause the scripts to wait for each other to get done with the file before writing to it.  If you like, the "less important" script can do:
$f = fopen('some_file', 'a');
if(flock($f, LOCK_EX | LOCK_NB)) {
    fwrite($f, "some_line\n");
    flock($f, LOCK_UN);
}
fclose($f);

so that it will just not do anything if it finds that something is busy with the file.
Comment: Exactly what I was looking for! That was so easy, I should have checked the PHP documentation more.
Comment: Take care using flock() since the function isn't atomic.
Comment: Another tip to prevent file contents from becoming empty on two exactly simultaneous writes. That happened to me a lot with one popular page with a flatfile visitor counter. The solution: I added a random delay of 20-80 ms before fwrite(), and that fixed the problem, even to date with much higher visitor counts.
Answer: Please note posix states atomic access if files are opened as append. This means you can just append to the file with several threads and they lines will not get corrupted.
I did test this with a dozen threads and few hundred thousand lines. None of the lines were corrupted.
This might not work with strings over 1kB as buffersize might exceed.
This might also not work on windows which is not posix compliant.
Answer: Please note:

As of PHP 5.3.2, the automatic unlocking when the file's resource handle is closed was removed.
  Unlocking now always has to be done manually.

The updated backward compatible code is:
if (($fp = fopen('locked_file', 'ab')) !== FALSE) {
    if (flock($fp, LOCK_EX) === TRUE) {
        fwrite($fp, "Write something here\n");
        flock($fp, LOCK_UN);
    }

    fclose($fp);
}

i.e. you have to call flock(.., LOCK_UN) explicitly because fclose() does not do it anymore.
Answer: Take a look at the flock function.
Answer: FYI: flock only works on *nix and is not available on Windows
Comment: From the PHP documentation: "flock() allows you to perform a simple reader/writer model which can be used on virtually every platform (including most Unix derivatives and even Windows)."
Comment: While `flock` as a system call is not implemented on Windows, this is abstracted away in the `flock` PHP function.
Comment: yeah, I mis-spoke. This is the bug I was thinking of when I said that wasn't available on Windows: http://bugs.php.net/bug.php?id=39138 (the time I needed it on a windows local dev server, I ran into this and have avoided it on Windows machines ever since). Keep calm and carry on.

PHP Simultaneous File Writes


LVM with SSD + non SSD in volume group (for snapshot storage)

Question: I have a KVM box running some critical VMs which perform software builds.  The server runs SSD drives.  I have an older version of KVM which has limited snapshot capability, and I have decided to use LVM snapshots to save the VM states after each new release (so we can revert to a certain release if we need to patch).  The PVs are full, so I need to add a disk to the volume group for the snapshots to live on.  Is there any harm to adding a regular USB drive to the volume group that the VMs live on, just for a storage place for LVM snapshots?  Will I lose the SSD speed?
Answer: In theory this should be fine but how are you going to ensure the VM data doesn't end up on the USB disk?
Comment: Only snapshot data will end up there, I am never mounting it, just adding it to the VG.
Comment: Good point, well made :)
Answer: several points here

LVM snapshots do not form a chain, they do not use the COW algorithm, you can only have one really. If you need a snapshot chain to be able to roll back anywhere, you need to use qcow2 snapshots.
Having said that, running a production VM off of a chain of snapshots is not recommended in production, the performance hit can become quite significant after a while, not to mention the loss of space. This is not just a KVM thing, any VCP instructor will tell you the same thing.
Mixing different types of storage under one VG is not best practice either. I've seen LVM go down in flames when two different LUNs from two different raid arrays were mixed in a striped volume, serialized will probably be more stable, but why risk your VM so?

I would do this in a different way:

Use LVM snapshots to back a VM upwhenever I need to
save the backups on the USB disk, separate from the runtime LVM data
In case of a rollback, replace the LV on SSD with the one from backup.

I know this will mean keeping full backups in place, but with proper planning, you will not deviate from your current SSD performance, and will not lose the current system stability, be able to roll back to a reasonable amount of PITs and stay within best practice boundaries
Comment: I thought LVM snapshots do use COW.  Also, I think that when you create a snapshot, it is essentially like creating a volume in the free space of the volume group, if my volume group is full and then I extend it with this USB drive, and new volume in the group would have to be created there, including snapshots, however if I don't mount the volumes/snapshots, then I was thinking the slower disk speeds would be moot and it would just be a storage for the not mounted snapshot LVs.
Comment: well, if you're very careful and you monitor your LVM down to the block offsets, you could pull it off, but this construct would be flimsy at best. Those snaps aren't COW though
Comment: Do qcow2 snapshots affect performance as more are created like LVM snapshots do?  Is there any way to show all of the internal snapshots on a qcow2 image?  It seems qemu-img info shows only one, when it does not account for the size of the file being so large.  I assume there are more snaps but don't know how to see them.
Comment: Yes, every snapshot has an effect on performance. It is not recommended to use them on loaded VMs in production (and I'm not talking only about qcow2 - every virtualization system has this recommendation). To see all the snapshots, I usually write a simple script which recursively checks the information for every image and builds the snapshot chain.


If it takes infinite steps to prove a statement, is that a valid proof?

Question: In Cantor's diagonal argument, it takes (countable) infinite steps to construct a number that is different from any numbers in a countable infinite sequence, so in fact the proof takes infinite steps too. Is that a valid proof?
Comment: What is an "infinite step" (which is not the same as "infinitely many steps")? Does defining the computable function $f(n) = n+1$ require infinitely many steps?
Comment: The number is defined in one formula, essentially, so there is only one step. What is your definition of step?
Comment: There is something called [infinitary logic](http://en.wikipedia.org/wiki/Infinitary_logic). But, as Henno said, we don't need proof of infinite length to use Cantor's diagonal method.
Comment: @HennoBrandsma I'd like to define "step" as execution of Turing Machines. If I assign that task to a Turing Machine, it won't halt.
Comment: @CarlMummert: See http://english.stackexchange.com/q/57395/14775.
Comment: Since you bring up Turing Machines, this paper by JDH and Andy Lewis discusses [Infinite Turing Machine](http://arxiv.org/pdf/math/9808093.pdf). Hope it helps.
Answer: Take the Cantorian diagonal argument that, given a countable sequence of infinite binary strings, there must be a string not in the sequence. To get the argument to fly you don't need to actually construct the anti-diagonal string in the sense of print out all the digits (that would indeed be an infinite task)! You just need to be able to specify the string -- as is familiar, it is the one whose $n$-th digit is 1 if the $n$-digit of the $n$-th string in the countable sequence is 0, and is 0 otherwise. And just from that (finite!) specification, it follows that this specified infinite string is distinct from all the strings on the original list. You don't have to actually, per impossibile, construct (in the sense of write down all of) the string to see that!
It's the same, of course, with the Cantorian argument for e.g. the uncountability of the reals between 0 and 1.
Answer: In the usual logic employed in mathematics and in most related systems, a proof has to have only finitely many steps. This means that on the level of the formal, uninterpreted language, a proof has to have only finitely many steps.
But one can use a language in which all proofs are finite to make arguments abut infinitary theories, such as set theory. And the usual language of logic is expressive enough to make infinitary statements in a finite statement. The intuitive conjunction of the infinitely many statements "$1<2$", "$2<3$", "$3<4$", and so on is the same thing as "$\forall n: n<n+1$", which consists of a total of $8$ symbols and is provable in finitely many steps from the axioms of Peano arithmetic.
It is easy to create a finite theory that has only infinite models. For example, it is very easy to axiomatize the theory of strict partial orders without maximal elements with three axioms:

$\forall x:\neg(x>x)$
$\forall x,y,z:(x<y)\wedge (y<z)\implies (x<z)$
$\forall x\exists y:x<y$.

By a standard argument, every finite strict partial order has a maximal element, so this theory describes only infinite strict partial orders.
In set theory, we only use finite proofs and have a countable language. This gives rise to the so called Skolem paradox that a theory dealing with uncountable sets can have a model of countable cardinality. But inside the theory, we can deal with many sizes of infinite and make operations that would correspond to infinitely many operations in a weaker language. And it is the formal language in which set theory is formulated in which all proofs are of finite length.
Answer: First, let's deal with your confusion about Cantor's theorem. Here I find that proving the general case makes it much clearer that there's nothing special about numbers being used.
Let $X$ be a set, let $\mathscr{P}(X)$ be the set of subsets of $X$, and let $f : X \to \mathscr{P} (X)$ be a map. We define a subset
$$C_f = \{ x \in X : x \notin f (x) \}$$
and we observe that $C_f \ne f (y)$ for any $y$ in $X$. Indeed, suppose $C_f = f (y)$. Then, $y \in C_f$ if and only if $y \notin C_f$ – a contradiction. So $C_f \ne f (y)$. We conclude $f : X \to \mathscr{P} (X)$ is not surjective.
I think it is fairly obvious here that we have a finite proof, even though $X$ may be an infinite set. With this in mind, it's easier to see why the proof of the uncountability of the real numbers is a finite one: we don't have to construct the counterexample stage-by-stage in any sense at all – we just define it in one fell swoop like we did with $C_f$.

Here is a real example of an infinite "proof" that turns out to be invalid. Suppose first-order Peano Arithmetic (PA) is consistent. Then, each of the following statements can be formally proven in PA:

$0$ does not code the proof of an inconsistency in PA.
$1$ does not code the proof of an inconsistency in PA.
$2$ does not code the proof of an inconsistency in PA.
etc.

It is tempting to now claim that PA proves

For all $n$, $n$ does not code the proof of an inconsistency in PA.

but this is in fact false – because it would contradict Gödel's second incompleteness theorem. Essentially this is because the entities $n$ that PA considers to be natural numbers are potentially non-standard; for example, by the compactness theorem for first order logic we can construct an uncountable model of PA, which for obvious reasons must contain non-standard numbers. Thus, we are forced to conclude that the infinitary inference rule

From $\phi (0), \phi (1), \phi (2), \ldots$, deduce $\forall n . \phi (n)$.

is inadmissible for PA.
Answer: Since you have a computability bent, here is another version of Cantor's theorem:
Let $T$ be a Turing machine that prints a sequence of outputs. Each of the outputs of $T$ is the specification of a Turing machine that prints a sequence of numbers.
Cantor's argument says there exists a Turing machine $S$ that prints a sequence of numbers that is not printed by any of the outputs of $T$: specifically the Turing machine:

For every natural number $n$:

Simulate $T$ to obtain it's $n$-th output.
If $T$ has halted prematurely:

Output 0
Halt.

Let $M$ be the $n$-th output of $T$.
Simulate $M$ to obtain it's $n$-th output.
If $M$ has halted:

Output 0.

Else

Let $x$ be the $n$-th output of $M$.
Output $x+1$

Furthermore, it's not hard to see there exists a Turing machine that can, given the specification of any $T$ satisfying the hypothesis, will output the specification of the corresponding Turing machine $S$.
Answer: As long as the nature of the steps is formulaic, I see no problem with it. The proof of equal cardinality of Dedekind-infinite sets is similar. To prove that two sets have the same cardinality, you define a bijection that will transform each element of the one set to a unique element of the other, with no "holes", no duplicates and no ambiguities (one element transforming into either of two elements). If such a bijection exists, then one can say that by applying the bijection to each of the (infinite) elements of the source set, a unique element of the destination set is created, and thus the sets have the same number of elements (even though that number is infinite).


What is the use or importance of square roots in solidity and in blockchain in general?

Question: I have been seeing many posts about different implementations of finding the square root of a number with regard to blockchain and there is an edit in this question:
https://math.stackexchange.com/questions/296102/fastest-square-root-algorithm referring to smart contract engineers. What exactly is their importance in blockchain and why is it so hard?
Answer: It just happens to be a difficult mathematical operation to implement in an environment with certain restrictions, such as Ethereum smart contracts, which don't support floating point arithmetics (decimals).
So, as far as I can tell, it's not a super interesting or super essential function to have, but it just happens to be a function which is difficult to implement and has therefore open questions.
Furthermore, smart contracts require efficiency. The question you linked is specifically asking about efficient solutions.


Flashing Gapps on Second Account

Question: I have a rooted Nexus 5 running CyanogenMod 12.1-20150510-NIGHTLY-hammerhead. I created a new user from the top right corner, but it didn't have gapps installed on it. When I try to install, it only replaces the one on the original account. How do I install it on the second account? I have TWRP Recovery
Answer: It should've been installed by default. If it hasn't then there is something wrong, do you see the play store if so go to the play store and install the other Gapps.
I think it's because you need to setup the space seperately. So you need to install it from there.

Flashing Gapps on Second Account


Jaynes Probability Theory 6.44 (May be it is an error) help

Question: I read about this,
$$ p(R|r=0,NI_{1}) = {N\choose n+1}{N-R\choose n} \; (6.44)$$
but the probability can not be greater than 1, this expression is an apparent error.
$I_{1}$ means the state of knowledge about the urn is that 0 < R < N, while the general sum $S = \sum_{R=0}^N{{R\choose0}{N-R\choose n-r}}= {N+1\choose n+1} $ is given by $I_{0}$ which means we do not know the state of the knowledge about urn at all, so the $S'= S - {N\choose n}\delta(r,0) - {N\choose n}\delta(r,n)$, and the S' should be the denominator.
Finally i get the result is
$$ p(R|r=0,NI_1) = \frac{N-R\choose n}{N\choose n +1}$$
Comment: This question is not readable without getting back to the book and should be made self-contained.
Comment: Yes, when I come across problem while reading the book, i will post a question here. I will make question more clear next time.
Answer: You will find this error discussed (along with many others) at the website http://ksvanhorn.com/bayes/index.html.
For more information on Jaynes's book, see http://www.etjaynesinfo.com
Comment: Thank you!  It would be better if you would edit this post to cite the specific error that was made, rather than requiring interested readers to follow the links.


How would you give away free bitcoins by letting the user just scan a qr code?

Question: I'm currently trying to build a game where if the user reaches a certain amount of points they get rewarded with btc at the end of the game. But the thing is I would like the QR code to show up on the screen and the user would just have to scan it and they would receive the btc. Is there an application that can do such a thing? I'm guessing it would show the private key of the qr code. But is there a better method of doing this?
Answer: You would have to do this in a couple of steps, the first of which doesn't involve Bitcoin at all.

User scans QR code using an app you provide.
Your provided app sends a request to your server. This request contains something that identifies the user (say, the user's Bitcoin address).
Your server sends Bitcoin to the user's address.

Having said that, if you already have the user's Bitcoin address, then you should consider skipping the QR code entirely and proceed directly to step 3.
Answer: You are correct that the QR code would be of the wallet's private key. But for obvious reasons, you would need to generate a new address and private key for each user, otherwise, people would be sharing wallets together. You would need to load each wallet before displaying its private key in QR code format by sending funds to the wallet's address.
There are bitcoin wallet apps on both Android and iOS that can import a wallet by scanning a private key QR code. The players of your game would need to download one of these apps to do this though, so that might be a small hurdle. This may not be the best way to distribute bitcoin to your users for two main reasons:
1) You would be able to move funds out of the wallets of your users, even after they've imported the wallet themselves. I'm not saying you would do this, but you could.
2) Whether the private keys come packaged with the game files or the game contacts a server to retrieve the private keys, they may be susceptible to theft.
It might be smarter to let the users input their Bitcoin address, and have your server send the bitcoins, instead. This is safer and requires zero trust between you and the users. There is no possibility of theft perpetrated by you or other users of the game, as long as the funds are not in a hot wallet.
Further reading:
https://en.bitcoin.it/wiki/Bitcoind#Wallet_Services
https://en.bitcoin.it/wiki/Paper_wallet#Redeeming_Keys_and_Withdrawing_Funds
https://en.bitcoin.it/wiki/Private_key
https://en.wikipedia.org/wiki/Bitcoin#Wallets
Comment: You can just have people type in their Bitcoin address or [firstbits](https://en.bitcoin.it/wiki/Firstbits).
Comment: the problem is i would then need a camera to scan their qr code now which would require more hardware and extra coding to integrate a camera scanning feature into the game. i'm trying to take the method with least resistance.


On the Existence of the Word 'Grousily'

Question: Is 'grousily' a word?  I would like to use it in a sentence to mean 'grumpily, as if in imitation of a rumpled grouse' but don't think it's okay because of how I couldn't find it in either OS X's dictionary via Spotlight or on the Internet via Google.
Comment: The counterpart to "*grousily*" would not be "*grumpy*" but "*grumpily*". As in "I woke him, and he got out of bed *grumpily* (or *grousily*)", meaning he was in a grumpy *during the time he got out of bed*", whereas "I woke him, and he got out of bed *grumpy* (or *grousy*)" would mean he woke up, and stayed in, a grumpy mood.
Comment: If I read the word I would interpret it as referring to a tendency to "grouse" (gripe) a lot.
Comment: @DanBron:  You're right, so I've fixed it.
Comment: Keep in mind that the adjective ***grousy*** can mean abounding with grouse. The first OED citation for this sense is **"1830** *Blackw. Mag.* XXVIII. 585 ― The stony regions··melt away into miles of the grousey heather."  Now, how you might make of that an adverb of manner, or rather, what it would mean, I'm not perfectly certain.
Comment: Um…you're barking up the wrong tree:  that might be true if you were using the form of 'grousy' derived from its _noun_ form 'grouse' instead of the one derived from its _verb_ form 'to grouse' meaning 'to complain' as discussed below.  Modifying the latter so as to make it into a superlative adverb would be perfectly acceptable, albeit colloquial.
Answer: Grouse is a noun (bird) and a verb ( complain). As an adjective (excellent) is used mainly in NZ and Australia and  it is not commonly used as an adverb. I suggest you use 'grumpy' or a synonym of it.
Grouse: (intransitive verb) (from MW)

complain, grumble
She's been grousing to her boss about the working conditions.
  Fans have groused that the higher prices are unfair.

adj:   Austral and NZ excellent
  (of unknown origin)

A grouse: (www.vocabulary.com/dictionary)

is a small game bird. But the verb to grouse is different. It means to gripe about how unhappy you are. It's not recommended for most people, because grousing is unattractive.

People's excitement about the rise of the Internet has been largely replaced by disappointment that it's turned out to be essentially a forum for people to grouse. No disappointment is too small to grouse about on the Internet. Did you stub your toe? Grouse about it in your blog! Did your sister tattletale? Get online and start grousing. "I grouse, therefore I am," might be the motto of the Internet. Oh well: now I'm grousing too.
Comment: But *grousy* as an adjective is used in the U.S. meaning *grumpy.* I assume the derivation is that it originally meant *given to complaining*. [Urban Dictionary](http://www.urbandictionary.com/define.php?term=grousy).
Comment: Like 'gripe', which is both verb and noun, 'grouse' is also a noun meaning 'complaint', 'reason to be annoyed'.
Comment: @PeterShor:  So, would that justify extending the derivation even further like I'm thinking about doing?  Off-topic:  I _swear_ I've seen the term used _somewhere_, but that may be due to the average Internet user's less-than-adequate grasp of the English language, about which a whole other discussion for could be spawned, but that's probably best saved for another time.
Comment: Well, I would understand it, as would anybody who knows the *Urban Dictionary* meaning of *grousy*. The word *grousy* isn't in any of the standard dictionaries, which I assume means it's slang that isn't widely used. I expect that outside the U.S., nobody will have heard of it.
Comment: Ah; okay, then I suppose that it would be appropriate for me to use it as part of a casual, fictional story that I'm writing.

On the Existence of the Word 'Grousily'


What is the difference between memmove and memcpy?

Question: What is the difference between memmove and memcpy? Which one do you usually use and how?
Comment: Note the problems that might arise: https://lwn.net/Articles/414467/
Answer: With memcpy, the destination cannot overlap the source at all. With memmove it can. This means that memmove might be very slightly slower than memcpy, as it cannot make the same assumptions.
For example, memcpy might always copy addresses from low to high. If the destination overlaps after the source, this means some addresses will be overwritten before copied. memmove would detect this and copy in the other direction - from high to low - in this case. However, checking this and switching to another (possibly less efficient) algorithm takes time.
Comment: @DanielHsH 'restrict' is a promise you make the compiler; it is not _enforced_ by the compiler. If you put 'restrict' on your arguments and do, in fact, have overlap (or more generally, access the restricted data from pointer derived from multiple places), the behavior of the program is undefined, weird bugs will happen, and the compiler will usually not warn you about it.
Comment: @Alcott, don't use memcpy if you don't know that they don't overlap - use memmove instead. When there is no overlap, memmove and memcpy are equivalent (although memcpy might be very, very, very slightly faster).
Comment: when using memcpy, how can I guarantee that the src and dest addresses don't overlap? Should I personally make sure that src and dest do not overlap?
Comment: @Mecki then I don't see the difference between your comment and bdonlan. It seems you are saying the same thing. Restrict is a promise made to the compiler. But the compiler will let you violate that promise with potentially undefined results. Replace "promise" with "requirement" and you are saying the same thing.
Comment: You can use 'restrict' keyword if you are working with long arrays and want to protect your copying process. For example if you method takes as parameters input and output arrays and you must verify that user does not pass the same address as input and output. Read more here http://stackoverflow.com/questions/776283/what-does-the-restrict-keyword-mean-in-c
Comment: @bdonlan It's not just a promise to the compiler, it's a requirement for your caller. It's a requirement that is not enforced but if you violate a requirement, you cannot complain if you get unexpected results. Violating a requirement is undefined behavior, just like `i = i++ + 1` is undefined; the compiler doesn't forbid you to write exactly that code but the result of that instruction can be anything and different compilers or CPUs will show different values here.
Comment: Looking at these comments, it looks like always use memmove.
Comment: @Mecki "not enforced" and "requirement" don't go together. It seems you're saying the same thing as bdonlan once we strip the first two contradictory sentences away.
Comment: @iheanyi They do go together as requirement means "it is required to do it that way if you want to have correct results" but getting correct results is **not enforced**. Of course you can write code that produces incorrect results if you like.
Comment: @Mecki I disagree. If that's the definition of "requirement", then it means nothing. You can write code that doesn't compile too if you'd like. There's no compiler that forces anyone to do anything they don't want to do.
Comment: @iheanyi No, you don't. You just repeated what I've said. A requirement in behavior does not mean that you cannot behave in a different way, it only means that behaving a different way has consequences. It is a requirement to follow the law but you can also violate it. If something is made in such a way, that you cannot violate it, then no requirement is necessary as there is no choice; you have to do it in the only way possible so what would be the requirement then? Not doing it that way means not doing it at all.
Answer: memmove can handle overlapping memory, memcpy can't.
Consider
char[] str = "foo-bar";
memcpy(&str[3], &str[4], 4); // might blow up

Obviously the source and destination now overlap, we're overwriting
"-bar" with "bar". It's undefined behavior using memcpy if the source
and destination overlap so in this case we need memmove.
memmove(&str[3], &str[4], 4); // fine

Comment: @jagsgediya Sure it might. But since memcpy is documented to not support this, you should not rely on that implementation specific behavior, that's why memmove() exist. It might be different in another version of gcc. It might be different if gcc inlines the memcpy instead of calling out to memcpy() in glibc, it might be different on an older or newer version of glibc and so on.
Comment: @ultraman: Because it MAY have been implemented using low level assembley that requires that memory does not overlap. If it does you could for example generate a signal or hardware exception to the processor that aborts the application. The documentation specifies that it does not handle the condition, but the standard does not specify what will happen when these conditions are vialoated (this is known as undefined behavior). Undefined behavior can do anything.
Comment: with gcc 4.8.2 , Even memcpy also accepts overlapping source and destination pointers and working fine.
Comment: From practice, it seems the memcpy and memmove did the same thing. Such a deep undefined behavior.
Answer: Assuming you would have to implement both, the implementation could look like that:
void memmove ( void * dst, const void * src, size_t count ) {
    if ((uintptr_t)src < (uintptr_t)dst) {
        // Copy from back to front

    } else if ((uintptr_t)dst < (uintptr_t)src) {
        // Copy from front to back
    }
}

void memcpy ( void * dst, const void * src, size_t count ) {
    if ((uintptr_t)src != (uintptr_t)dst) {
        // Copy in any way you want
    }
}

And this should pretty well explain the difference. memmove always copies in such a way, that it is still safe if src and dst overlap, whereas memcpy just doesn't care as the documentation says when using memcpy, the two memory areas must not overlap.
E.g. if memcpy copies "front to back" and the memory blocks are aligned as this
[---- src ----]
            [---- dst ---]

copying the first byte of src to dst already destroys the content of the last bytes of src before these have been copied. Only copying "back to front" will lead to correct results.
Now swap src and dst:
[---- dst ----]
            [---- src ---]

In that case it's only safe to copy "front to back" as copying "back to front" would destroy src near its front already when copying the first byte.
You may have noticed that the memmove implementation above doesn't even test if they actually do overlap, it just checks their relative positions, but that alone will make the copy safe. As memcpy usually uses the fastest way possible to copy memory on any system, memmove is usually rather implemented as:
void memmove ( void * dst, const void * src, size_t count ) {
    if ((uintptr_t)src < (uintptr_t)dst
        && (uintptr_t)src + count > (uintptr_t)dst
    ) {
        // Copy from back to front

    } else if ((uintptr_t)dst < (uintptr_t)src
        && (uintptr_t)dst + count > (uintptr_t)src
    ) {
        // Copy from front to back

    } else {
        // They don't overlap for sure
        memcpy(dst, src, count);
    }
}

Sometimes, if memcpy always copies "front to back" or "back to front", memmove may also use memcpy in one of the overlapping cases but memcpy may even copy in a different way depending on how the data is aligned and/or how much data is to be copied, so even if you tested how memcpy copies on your system, you cannot rely on that test result to be always correct.
What does that mean for you when deciding which one to call?

Unless you know for sure that src and dst don't overlap, call memmove as it will always lead to correct results and is usually as fast as that is possible for the copy case you require.

If you know for sure that src and dst don't overlap, call memcpy as it won't matter which one you call for the result, both will work correctly in that case, but memmove will never be faster than memcpy and if you are unlucky, it may even be slower, so you can only win calling memcpy.
Comment: Note that the result of relational comparing pointers to different objects/arrays is unspecified. So there is no way to safely detect if two objects overlay with each other. In fact, the typical implementation of `memmove` copies data from front to back if `dst < src` otherwise copies data from back to front. It is safe because if there's overlay, the result is defined(and correct) so the behavior is safe, otherwise if there's no overlay, the result is unspecified but copying in both directions is safe.
Answer: From the memcpy man page.

The memcpy() function copies n bytes
  from memory area src to memory area
  dest. The memory areas should not
  overlap. Use memmove(3) if the memory
  areas do overlap.
Answer: The main difference between memmove() and memcpy() is that in memmove() a buffer - temporary memory - is used, so there is no risk of overlapping. On the other hand, memcpy() directly copies the data from the location that is pointed by the source to the location pointed by the destination. (http://www.cplusplus.com/reference/cstring/memcpy/)
Consider the following examples:

#include <stdio.h>
#include <string.h>

int main (void)
{
    char string [] = "stackoverflow";
    char *first, *second;
    first = string;
    second = string;

    puts(string);
    memcpy(first+5, first, 5);
    puts(first);
    memmove(second+5, second, 5);
    puts(second);
    return 0;
}

As you expected, this will print out:
stackoverflow
stackstacklow
stackstacklow

But in this example, the results will not be the same:
#include <stdio.h>
#include <string.h>

int main (void)
{
    char string [] = "stackoverflow";
    char *third, *fourth;
    third = string;
    fourth = string;

    puts(string);
    memcpy(third+5, third, 7);
    puts(third);
    memmove(fourth+5, fourth, 7);
    puts(fourth);
    return 0;
}

Output:
stackoverflow
stackstackovw
stackstackstw

It is because "memcpy()" does the following:
1.  stackoverflow
2.  stacksverflow
3.  stacksterflow
4.  stackstarflow
5.  stackstacflow
6.  stackstacklow
7.  stackstacksow
8.  stackstackstw

Comment: "is that in "memmove()", a buffer - a temporary memory - is used;" Is not true. it says "as if" so it just has to behave so, not that it has to be that way. Thats indeed relevant as most memmove implementations just do a XOR-swap.
Comment: I don't think the implementation of `memmove()` is required to use a buffer.  It's perfectly entitled to move in-place (as long as each read completes before any write to the same address).
Comment: But, it seems the output you mentioned is reversed !!
Comment: When I run the same program , I get the following result :  stackoverflow
stackstackstw
stackstackstw // means there is NO difference in output between memcpy and memmove
Answer: One (memmove) handles overlapping destinations the other (memcpy) doesn't.
Answer: simply from the ISO/IEC:9899 standard it is well described.

18.104.22.168 The memcpy function
[...]
2 The memcpy function copies n characters from the object pointed to by s2 into the
object pointed to by s1. If copying takes place between objects that overlap, the behavior is undefined.

And

184.108.40.206 The memmove function
[...]
2 The memmove function copies n characters from the object pointed to by s2 into the
object pointed to by s1. Copying takes place as if the n characters from the object
pointed to by s2 are first copied into a temporary array of n characters that does not
overlap the objects pointed to by s1 and s2, and then the n characters from the
temporary array are copied into the object pointed to by s1.

Which one I usually use acording to the question, depends on what functionallity I need.
In plain text memcpy() doesn't allow s1 and s2 to overlap, while memmove() does.
Answer: There are two obvious ways to implement mempcpy(void *dest, const void *src, size_t n) (ignoring the return value):

for (char *p=src, *q=dest;  n-->0;  ++p, ++q)
    *q=*p;

char *p=src, *q=dest;
while (n-->0)
    q[n]=p[n];

In the first implementation, the copy proceeds from low to high addresses, and in the second, from high to low.  If the range to be copied overlaps (as is the case when scrolling a framebuffer, for example), then only one direction of operation is correct, and the other will overwrite locations that will subsequently be read from.
A memmove() implementation, at its simplest, will test dest<src (in some platform-dependent way), and execute the appropriate direction of memcpy().
User code can't do that of course, because even after casting src and dst to some concrete pointer type, they don't (in general) point into the same object and so can't be compared.  But the standard library can have enough platform knowledge to perform such a comparison without causing Undefined Behaviour.

Note that in real life, implementations tend to be significantly more complex, to gain the maximum performance from larger transfers (when alignment permits) and/or good data cache utilisation.  The code above is just to make the point as simply as possible.
Answer: memmove can deal with overlapping source and destination regions, while memcpy cannot. Among the two, memcpy is much more efficient. So, better to USE memcpy it if you can.
Reference: https://www.youtube.com/watch?v=Yr1YnOVG-4g Dr. Jerry Cain, (Stanford Intro Systems Lecture - 7) Time: 36:00
Comment: [This answer](http://stackoverflow.com/a/28624068/2410359) says "possibly a smidge faster" and provides quantitative data indicating only a slight difference.  This answer asserts one is "much more efficient". How much more efficient have you found the faster one to be?    BTW: I assume you mean `memcpy()` and not `memcopy()`.
Comment: The comment is made based on the lecture of Dr. Jerry Cain. I would request you listen to his lecture at time 36:00, only 2-3 minutes will suffice.

And thanks for the catch. :D


In a soccer/football game, have all 22 players ever been on the same half of the pitch at the same time?

Question: In soccer, when one team is dominating in attack, it's not uncommon to see that team have almost all of its players up forward, and the defending team all staying on their half. This is especially common when, say, a team is 1-0 down in the dying moments of a critical game and is desperately trying to get an equalizer.
My question is, have all the players on the pitch, including the goalkeepers, ever been on the same half of the field at the same time. (Still include instances where some of the
players have been sent off. Players swarming the referee to protest a decision, or penalty shootouts, do not count.)
If there are such instances, when/where was it, how long did it last, and what was the context of the game?
Comment: This has happened multiple times at just the professional level alone. It's not relatively common, given the sheer number of games and the time spent with all players in one half, but it's not feasible to list them all either.
Comment: It's actually pretty common at the end of a game when a team is down by just one goal. Free kicks, corner kicks, etc awarded to that team are then usually taken with all players in the box (except the one taking the shot).
Comment: I *very* rarely watch football, but I've seen this happen in maybe half of all games that I've watched.
Comment: @Chenmunka It is rare for a goalkeeper to go into the other half of the field, but where a team is desperate for an equaliser, or a critical goal, toward the end of the match, it sometimes happens that a goalkeeper will go up to theopponents' penalty area when a corner is about to be taken.
Answer: The context would be a match where losing by two goals is no worse than losing by one goal. Knockout matches like the FA Cup, or league matches towards the end of the season where a win or a draw (or goal difference) is vital for survival/promotion.
The goalkeeper Jimmy Glass scoring for Carlisle to keep them in the league. I think I have correctly counted 22 players in the same half.
Peter Schmeichel came up for the first corner (equalizing goal) in the 1999 Champions League final as well. Losing 2-0 would have been no worse than losing 1-0 so the keeper and the team had nothing to lose.
I would go as far as to say that any time the keeper comes up for a corner you will have 22 players in the same half.
Comment: "I would go as far as to say that any time the keeper comes up for a corner you will have 22 players in the same half." – I don't think so. It is quite common for a smaller player to defend the back in case of a quick turnover. Often, that will happen near the middle of the field in the opponent's half, but sometimes, they stay further back.


Bike keeps suddenly changes gears w/o me shifting

Question: I've noticed that there are times that my bike suddenly changes gears, without me touching the shifters. It usually happens when I'm on a hard gear and I suddenly power out of a full stop, it pops into an easier gear and my foot drops from the pedal. What's happening, and how do I prevent it from happening again?
Comment: Most likely your derailers need adjustment.  In particular, as a new bike "breaks in" the cables stretch.  There are cable stretch adjusters somewhere along the cables that you can twist to make up for the stretch.
Comment: As mentioned above it's probably the normal cable stretch that you get from a new bike/cable. A bit of adjustment should hopefully fix it. Many bike shops say to go in for adjustment after a few weeks anyway. Start with the simple things. No point checking to see if your chain stays are flexing just yet.
Comment: Welcome to [bicycles.se] @Paulo. We recommend that new members take the [tour] to make best use of the site, and before posting questions [ask] is good value too. I'm pretty sure that the answer you seek is already here; maybe you can find it under the [tag:gears] tag.
Comment: How old is your bike?  What is the frame made of?  What kind of shifters do you have?  Does the gear change back after you let the power off?  Is it the left foot or the right foot powering down that causes the ghost shift-problem?
Comment: Hi Criggie, it's a TrinX K036, and I just bought it last month. It's a 17 steel frame with shimano 7-speed rapid fire shifter combo. I've noticed that it'll change gears when I power out of full-stops, then when I ease up it pops back into the original gear. Is this normal or is something wrong? I usually start with my left foot when pedaling.
Answer: If your chain is dropping on the front ring, it can be:

Your BB is loose and shaking.
Your derailleur is not properly adjusted.
Your crank is loose and shaking.
Your derailleur or crank is bent.
Answer: You need to get your derailers adjusted.


Aligning text in legend using ArcMap

Question: I am working in ArcMap 10.4.1.  Trying to align the text in a legend.  I want my title to be centred and the text next to the patches to be aligned left. The normal buttons to select alignment are missing from the links to change size and colour of text etc.
Answer: You can change the legend alignment from the beginning of creating legend. Here is the screenshot from the Legend Wizard:

To change the alignment of the patches you can follow these steps after creating the legend:

Right click on the legend box.
Select Convert To Graphics
Select Ungroup. You will have to ungroup all elements, until you get control of each element

After you ungroup each element (texts and symbols) you can align them manually by dragging.
Comment: Thank you for  the information.  I had already made the legend but the title was a long one and I have had to divide it up onto different lines.  This looks odd left aligned and I wanted to centre it for a better appearance.  Is the only way to do this to start the legend all over again?
Comment: You can follow the 3 steps I have mentioned before. After ungrouping, right click on the title, select properties where you will find the alignment options. But it may not work sometimes, it is better you do the alignment from the beginning.
Comment: I am curios to know that why your legend title is so long. Generally we only write "Legend".

Aligning text in legend using ArcMap


A phrase indicating something that gives a reward or outcome disproportionately large to its effort

Question: I originally had the term "power principle" in my head, but googling around makes it seem like it's not actually a common phrase and may be one I made up.  Essentially, I'd like to say "do the things that will give you a lot of impact with little effort."
Comment: "low hanging fruit"
Comment: Are you looking for a replacement for that whole sentence, or is there some particular piece you'd like to replace? The more details you can include about how you'd like to use the phrase, the more targeted our answers will probably be. Just off the top of my head, something like *most bang for the buck* or maybe *low-hanging fruit* seem possible.
Comment: Words like **exponential** and **high-yielding** are often found referring to processes where the output is markedly high compared to the input. Another (controversial) word signifying colossal output relative to input is *nuclear*!
Answer: There is a principle that has a similar connotation, to the one you have talked about in your question:
Pareto principle

The Pareto principle (also known as the 80/20 rule, the law of the
  vital few, or the principle of factor sparsity) states that, for many
  events, roughly 80% of the effects come from 20% of the causes.

-- Wikipedia
The principle has a wide variety of applications but the general meaning of the idea fits your context well, that a disproportionate (80%) of net effects come from just (20%) of the effort (causes).
It's an idea frequently used in management circles, where division of labor to achieve some specific result is studied quite closely, but also has wide application outside the world of management.
Comment: I think this is the closest thing to what I'm looking for so far.
Answer: Words like exponential and high-yielding are often found used in situations referring to processes where the output is markedly high compared to the input.

His shrewd financial decisions resulted in exponential growth.
I would always advise you to invest your energy in high-yielding projects.

Other (controversial) words signifying colossal output relative to input (not that you should use them in your specific context) are atomic & nuclear!
Answer: A close match is an aleatory contract. I can define the exact meaning of the word with the following example:
A life insurance policy is an aleatory agreement because the financial benefits can be greater than the premiums paid.
Aleatory is something depending on a contingent event, but aleatory contract is used so often with life insurance that the usage of the term is closely associated with an agreement where "something that gives a reward or outcome disproportionately large to its effort".


Do VPS hosts typically offer an option to take snapshots of the virtual machine (VM)?

Question: Is taking a snapshot of the virtual machine that a VPS runs on a standard feature provided by VPS hosts?
Comment: It's not a standard feature, but there are VPS hosts that offer snapshots. You can search for them using a combination of something like "VPS hosting with snapshots".
Comment: It depends on the company. I am now hosted on Negative0 who offer me weekly snapshots. I was earlier hosted on some other company that did not.
Answer: Well, it depends on what you mean with snapshot. Do you mean an image of the OS, or a backup?
Some VPS providers offer images and/or backups, and some don't. It's not 'usual'. I have used one VPS host, they gave me a free backup server of 50 GB. I was considering switching to another provider, they didn't offer backups but they did offer snapshots (images).
I also want to note that most VPS providers offer backups instead of images.
To answer your question: no, not typically. At many VPS providers, backup space is an add-on, but it will cost you more. Some VPS providers do the same for images.
Comment: Thanks for upvote, I now have enough reputation to comment :)
Answer: The term snapshot can mean many things to many people. If you mean a backup, they should be doing that already and you should be able to do this yourself too. If you mean image backup then that would have be to asked of the ISP as to whether they perform image backups or not. Image backups usually mean having access to a server with a bootable floppie or cd-rom but there may be other options out there that I am not aware of. VPS would not normally afford this option except perhaps at the ISP level.
It has been a long time since I performed an image backup. I used to use Ghost since it was the best at the time. There are free image backups out there as well as regular backups that you should be able to use including free backup software available depending upon the linux install you have.
Comment: The term "snapshot" comes from virtual machine/server software (like that of VMWare), and means to take a picture/image of the current state of the virtual machine so it can be rolled back to that state at a later time if needed.
Comment: @dan That's what I meant, a VM Snapshot.
Comment: Thanks Dan. Similar options exist within Windows. I got it. I have been out of the hosting world for quite a while though I worked with various VM(s) back in my consulting days. We used to use the term snapshot for image style of backups. My mistake.


What is the series where humans are genetically altered to go under cover on alien planets?

Question: It was a series of 3 or 4 books.  The crew of a ship were on a mission to recover something ( rings I think) from different planets.  Humans had been genetically altered to live on each planet.  Volunteers were permanently altered to blend in on the planet to complete their missions.
Answer: Not sure anything I know of fully fits your question.. but it COULD be Jack Chalker's "Four Lords of the Diamond" series, although there are no rings to retrieve.  The main character has his personality cloned (basically) 4 times, and stuck into 4 bodies, each of which travels to one of the four planets of the Warden Diamond.  On each, the 'wardens' (basically a planet-specific adaptation of a kind of virus) modified each person in a way consistent with the specific planet.
They were very much NOT volunteers, though, and each one, waking up thinking he was the original, became quite upset to realize he was simply a clone, but eventually reconciled it by deciding to follow whatever life they could have.  The 'original' monitored what each did/thought/experienced all thru the series.  The planets were used as Prison planets, and each of the cover identities was someone who was consigned to there, so they were pretty fully set to blend in.

Lilith: A Snake in the Grass
Cerberus: A Wolf in the Fold
Charon: A Dragon at the Gate
Medusa: A Tiger by the Tail

A second series (also by Chalker) that could be what you are thinking of is the 'Rings of the Masters' series.  Although not the primary focus of it, there was a way to modify people down to the cellular level, that allowed them to be changed into any other life form, and a number of the characters did so, in their quest to retrieve the rings; it's a one way change, as multiple changes to the same cells caused death.

Lords of the Middle Dark
Pirates of the Thunder
Warriors of the Storm
Masks of the Martyrs
Comment: Thank you.  I think it was the "Rings of the Masters".
Comment: Don't forget to 'accept' the answer once you are able to confirm :)
Answer: Jack Chalker has a series from the late 80's called Rings of the Master that includes modifying humans to fit into the societies of aliens to find five rings.
The books are:

Lords of the Middle Dark
Pirates of the Thunder
Warriors of the Storm
Masks of the Martyrs
Comment: *LOL*  While I was being longwinded, you came up with the (partially) same answer... Lets hope this means one of us is right! :) +1
Comment: I thought about the Four Lords of the Diamond series but since it didn't have the rings decided to stick to the Rings of the Master series. Jack has several other series that involve people changing bodies in different ways. Seems to be a speciality/fetish of his.
Comment: Yeah; he seems to have a strong affinity for things that raise the question of what makes up identity.  Body changes, memory changes, copied identity, conditioning... Heck, one of his earlier works seems to be the template in some ways.. 'The Identity Matrix.'  But MOST of his stories have someone change bodies, sexes, species or something :)


Solving vector equations. (Vectors are not with components)

Question:
How to solve this and what is the answer?
Answer: HINT
Observe that
$$\alpha \vec x + \vec a \times \vec x = \vec b \implies \vec a \cdot(\alpha \vec x + \vec a \times \vec x) = \vec a \cdot\vec b \implies \alpha\,\vec a\cdot \vec x = \vec a \cdot \vec b$$
We can use this to verify which solution holds.
Answer: First, I'm assuming that these vectors are three-dimensional. Write $x = (x_1,x_2,x_3)$ and similarly for $a$ and $b$. Calculate $\alpha x$ and $a\times x$, and add them together to get a vector with three components that we can set equal to $b$'s three components. The equations will each be in the form of $c_1 x_1 + c_2 x_2 + c_3 x_3 = c_4$ for some constants $c_i$, which will give three linear equations with three unknowns. We can solve this with whatever techniques you have for that, which will give you the components of $x$ in terms of the components of $a$ and $b$. Then you can try to simplify the three components into a single vector expression, which will be your answer.


Why does sodium hydroxide react with aluminum oxide?

Question: I have seen all the chemical formulas for the reaction between sodium hydroxide, water, and aluminium. I understand that the hydrogen gas comes from the aluminum reacting with the water and the sodium hydroxide just breaks down the aluminum oxide. But why does sodium hydroxide break it down? Also since aluminum oxide is amphoteric can you do this reaction with a strong acid instead of a strong base?
Comment: Hydrogen is in reaction with metal so which one you really mean?
Comment: Sodium hydroxide would react with aluminum oxide precisely for the reason you explained yourself: because the latter is amphoteric.
Comment: @IvanNeretin thanks Ivan, so I understand that sodium hydroxide does interact with aluminum oxide because it is amphoteric, but what is the reason behind it reacting and how does it react?
Answer: If you use a "strong acid" to break down the passive oxide you need to be careful which acid you choose.  Sulfuric or nitric acid is oxidizing and thus could maintain the oxide.  Hydrochloric acid would be best, among common mineral acids, for actually getting to the metal while being relatively easy to handle.
Answer: C2H6O2 is a chemical formula.
HOCH2-CH2OH is a chemical formula.
CH4 + 2O2 → CO2 + 2H2O is a chemical equation. You should learn the difference.
Reaction products are usually lower in Free Energy than the reactants. If it's helpful, then the answer to your question of why does NaOH react with Al2O3 is: because the products are lower in free energy than the reactants. In my more experienced view, this is a circular answer: of course the products have more negative delta G, but that doesn't answer "why?". Science is much better answering "how?" than "why?". But at your level of understanding, you should be aware that speaking about the oxide coating on aluminum and its reactions with acids and bases is (arguably) categorically different than speaking about Al° and its reactions. You've asked about the oxide. Al+3 exists in aqueous solution as [Al+3].6H2O with its counter ion (in HCl(aq) is would be the Cl- anion) and as [Al(OH)4]- with the counter ion (in your case it would be Na+ ). BOTH of these are stable, one in acid, one in base (it's obvious which is which, right?). So, the question is: is the dissolution of Al2O3 spontaneous in acid (in base)? The answer is:"in sufficiently low (sufficiently high) pH it is." Strong base attacks skin, so does strong acid. The reactions are different, they are NOT opposites. I don't see anything unusual in the fact that a material reacts with strong acids and strong bases.  My guess is that one reason you might see a dichotomy between acids and bases is because in water solutions you don't generally have both simultaneously. (at least, since the equilibrium constant of water is 1E-14, in most solutions of chemical interest (contrasted with biologically interesting situations), either acid or base is present in overwhelming concentrations...). While dealing with Bronsted acid/bases, it's sometimes convenient to consider acids as opposites to bases, that approach has limits beyond which other definitions of acidity or basicity are more useful. HTH


Python differences between running as script and running via interactive shell

Question: I am attempting to debug a problem with a ctypes wrapper of a windows DLL and have noticed differences when I run tests via an interactive shell (python or ipython) and when I run the scripts non-interactively.
I was wondering if there is any explanation for the differences I am seeing here?
Specifically, when I interactively run a simple test, a DLL call will hang and never return, where as exactly the same code run as a script will not exhibit this problem.
To be more explicit with what I mean here, imagine you had the following code
from foobar import bar, foo
bar(foo(1,2,3))

When put in a file, say "myfoo.py", and excecuted via "python myfoo.py", the above code executes as expected. However, if you type in the above into a python/ipython shell, the code behaves differently (in my case, hangs when calling a ctypes.WinDLL function)
Some additional details:
I am using the same interpreter and the same PYTHONPATH in both cases.
The DLL being wrapped is the Canon EDSDKv2.9, a SDK to remotely control cameras.
It is always hangs in the DLL, not in python code.
When initialised, my EDSDK wrapper launches a thread whose run method looks like this:
  def run(self):
    sys.coinit_flags = 0 #use multithreaded mode
    from pythoncom import PumpWaitingMessages
    #^^ done here so this thread is correctly initialised
    error(EDSDK.EdsInitializeSDK())
    self.EDSDK_initialised = True
    while self.active:
      PumpWaitingMessages()
      sleep(self.msg_sleep_time)
    error(EDSDK.EdsTerminateSDK())

This threads purpose is basically to initialise the SDK, pump messages, and allow other threads to call wrapped methods.
Note: this has worked, both interactively and non-interactively, in previous EDSDK versions. My current problem only happens in the latest version of EDSDK.
I suspect it may be something to do with threads (hence the snippet), but can't find any information online to back up my suspicion.
So, is anyone aware of any differences when running python interactively and non-interactively? Possibly related to windows threads? Any help, even wild guesses, would be appreciated at this point, because I am completely stumped! :)
Answer: The Python interactive interpreter is not thread safe. So, if you try to send a blocking command, the whole interpreter will hang.
See this article as to why this happens (tl; dr is that the IDLE and threads don't mix). As for how to fix this, use the console rather than the IDLE GUI. Or, you can just use a script.
Answer: This is something to keep in mind in the context of asynchronous or concurrent operations (e.g. multithreading, multiprocessing). For all intents and purposes when you're running Python interactively you do not have a main loop.  Even though __name__ is set to __main__, anything assigned or executed there might not be available.  This is especially the case with multiprocessing and in some cases multithreading, where the state of objects may not shared between processes/threads.
This behavior can be confusing at best and dangerous at worst.  A good habit to get into when debugging is to always name your threads and pair that with the use of Python's logging module to track what is going on behind the scenes.