My company policy states I must put all passwords in a password safe shared with management. Is this secure?

Question: As the title says, my company has a policy that all passwords to e.g. our workstations and server logins must be stored in an online safe. I won't say which one but there are some out there you can look at promising the end of password pain. These passwords are then shared with the company's management - I don't know how that bit works, but they can read the passwords too.
Is this really that secure? I was given two reasons why it is by my boss:

If I forget my password, I can just ask him for my password.
If I turn evil, they can lock me out.

I don't agree with these. For the first one, surely there must be a better way for most of the things we use like Google Apps - e.g. the admin has a reset button. For the second one I can just change my password anyway and not update the password safe.
So am I right that this is not secure? Or is this the only way?
Comment: I guess you have plausible deniability about everything that happens with your accounts now.
Comment: Not to be grim but this policy is showing up in more and more organizations to deal with the fact that you might become suddenly dead
Comment: What if the company's management turns evil?
Comment: IANAL, but it is conceivable that you can sue your employer over the fact that your private data is not properly protected (assuming any of your private data is stored on company servers, which is almost certain).
Comment: @MarkMullin Your comment became way more powerful almost a decade later, unfortunately.
Answer: None of the reasons you've given are valid reasons for escrowing your password.  There's only a couple valid reasons for escrowing any sort of "authenticator" information.  A couple others have touched on these, but I'll try to clarify a bit.

Encryption Keys:  It makes absolute sense for the organization to have access to escrow copies of your encryption keys.  After all, the data you're encrypting (provided you're only using your company's encryption for work purposes, of course) is their data in the end anyway.  So, they need to retain access to that data in the event you lose your key or you are separated from the company.  However, the encryption key should not be the same key you use for digital signatures.  Also, they should not have actual access to your authenticator - the passcode you use for the key.  Instead, they should have their own escrow key that works with their authenticator to decrypt your data.
Failsafe Accounts:  It also makes sense that the organization should have backup copies of credentials necessary to access an Administrator-level account in the event the System Administrator's own account is locked out, or they depart the company.  However, the credentials should not be for the System Administrator's own account.  They should be for a local system account whose sole purpose is for emergency use.  To that end, the account should also never be used for non-emergencies and its usage should be closely monitored and alerted.  Traditionally, credentials for accounts like these are sealed in tamper-evident envelopes and stored in a secure, physical vault.  It's conceivable that there may be digital equivalents, but I personally wouldn't trust those without a thorough review.

There's two big reasons why it's a bad idea for management to have your password.  The first reason is potentially very bad for you, as it could end up causing otherwise unnecessary work for you if things go wrong.  However, the second actually turns this around and makes it potentially worse for the company than it is for you if things go really wrong.

Potential For Abuse:  The obvious one - managers now effectively have unrestricted access to the systems, regardless of whether they should, with the same privileges you have.  Most simply this means that the managers may leverage this to do things on the system that they otherwise should not be doing.  This also leaves the potential for them to bypass your position whenever they want to rush a particular change along without following standard procedure.
Loss of Non-Repudiation:  Once someone else has your credentials - and, especially in a case like this where it can be proven they do - they can impersonate you on any systems where those credentials are valid.  This makes it difficult to definitively prove that any actions taken by your account were actually taken by you.  If a manager does decide to use your account, and ends up royally screwing up the system, it won't be very easy to use you as a scapegoat even though your account is in the logs.  Worse for the company is, if you do something to royally screw up the system while your managers have your password, they'll have a harder time proving that it was actually you that did it.

TL;DR: There's no good reason I can think of for management to have any of your passwords.  As for the reasons they've given:

"If you forget your password..." another System Administrator can reset it for you.  Or, management can "break the glass" on the emergency account (see "Failsafe Accounts" above) and do it themselves.
"If you turn evil..." again you can be locked out by another System Administrator, or the emergency account.
Comment: Even the encryption password should not be an excuse, as properly implemented encryption system provide a way to recover lost password, for instance by offering several key slot (one for the user, one for company's IT people for instance) or backing up the encryption key on the Active Directory.
Answer: The first reason (give you your password back in case your forgot it) is quite weak: if you forgot your password, then it is not a good password, and it would make more sense to let you reset it by choosing a new password. The second reason is totally bogus: if they cannot "lock you out" without knowing your password, then they should fire their sysadmin ASAP. He doesn't know how to right-click.
Most probably, your managers want to have the feeling of being in control and to actually manage at very close range. Possibly, they might just want to prevent the employees from using swear words as passwords because it could offend some deity somewhere. Either way, this does not highlight the competence of whoever came up with that security policy in a very positive way.
Edit: though, the policy would make some kind of sense for passwords which are used for encryption, e.g. when you protect a Zip archive with a password. That kind of password cannot be reset, and losing the password (you forget it, or you become "unavailable" due to having been struck by a bus) implies losing the data. In that case, escrowing the password makes sense. But for an authentication password, no, that's a stupid policy.
Answer: No, it is not a good idea.  Thomas explained why it doesn't achieve its own goals, but it is worse than that.
Consider what happens when a rogue employee misbehaves causing damage to the company.
During the trial, you are subpoenaed to testify about logs showing that it was the employee who caused the damage, and are asked who else could log in as this employee.  You truthfully answer that anyone with access to the safe including all of management could log in as that employee and your logging systems would be none the wiser.
Anything that blurs the distinction between actor and authenticating credentials seriously undermines the company's ability to use access logging to discourage misbehavior or recoup damages.
Managers often hand out passwords to subordinates when an IBAC system fails to explicitly handle delegation, but this is the reverse of that case, where the blurring affects the credentials of the much larger group of lower-level employees.
Answer: Agree with @Thomas Pornin on the "bus factor", but there is one more thing to consider: the "online safe" is likely to be not really secure at all. It makes sense to put passwords in writing into a single physical vault, and keep them there so that in case of emergency the vault may be opened with the management's express authorization.
Answer: Depending on the types of information that your credentials provide access to, your type of organization (Financial, Healthcare) or location, there may be regulations (e.g., GLBA for banking, HIPAA for healthcare) in place that require no one have your credentials.
For instance MA 201 CMR 17 (http://www.mass.gov/ocabr/docs/idtheft/201cmr1700reg.pdf) requires that if you have access to certain sensitive info about a resident of MA that you have a unique ID and password to access that data:
"Do you assign unique identifications plus passwords (which are not vendor supplied default passwords) to each person with computer access; and are those IDs and passwords reasonably designed to maintain the security of those access controls?"
HIPAA 164.308(a)(5)(ii)(D): Each user has a unique identifier (i.e. user ID and password) when accessing their computer, EHR software, or any other system or resource.
Answer: The second requirement is completely bogus as stated.  Knowledge of the password is not required in order to revoke an employee/administrator's privilege.
The first requirement is valid, but I would discuss two things with your boss:
1) The company should sign a legal waiver absolving you from any criminal or civil wrongdoing resulting from use of your logon.  Since they have required that your logon be shared, they must acknowledge that you cannot be held responsible for your boss surfing child porn sites on your password.
2) The Discovery problem raised by @Mike Samuel. If there is any legal discovery against your company your boss could be utterly screwed.  (and you might point out that there is a relationship with #1 - if you are sued or charged for any offense whatsoever related to your logon, your lawyer would be forced to issue a discovery request.)
Low tech password escrow is a relatively normal practice in my industry. We add "Tamperproof/tamper resistant/Tamper evident" to the requirements set to protect both sides.
Write the password (for a single system) on a sheet of paper.  Fold it and seal it in a opaque business envelope.  Seal the envelope, sign across the boundary.  Now apply tape over the signature and the boundary.
Repeat this for each system.
Now insert all the envelopes into a large manilla envelope. Seal the envelope. You and your boss sign/countersign across the seal.
Store that in the safe.  This means the business is protected against the bus factor.
Write policy/procedures for opening that envelope and using the password.
Periodically verify that the envelope is unopened (frex, when you do your normal password change)
Answer: When we create a userID and attach it to a owner, it inherently become the property of an employee [not of course personal property ;)] who is responsible and accountable for all the actions/activities performed under that account until he is employed with the company.
Generally, the Password Policy of every company [except some like yours] suggests 'Not to Share' the access credentials with anyone.
In case you have to, you need declare it as a shared/generic user ['with admin rights' in your case] stating that you have shared the access credentials with Mr.x / Team x and though it is in safety vault but can be accessed upon need by them.
My suggestion to you is to go ahead and give them what they need and write an email to your manager, his manager and Password Safety Vault Manager [person who is responsible to keep a logbook when they access the password safety vault] stating that you are ready with the Password Envelope [sign it across the seal flap] and that they can keep it safe in the vault.
Regards
Answer: First, it is company policy, so like it or not... (I'm the resident security genius - not my attribution - at my company and I've been railing against our password policy for years, yet nothing changes because apparently that's what you can simply enable with a checkbox in Windows...)
Is it secure? That depends on what you mean by "secure".

It is more secure in regards to you forgetting your password, the main effect being that you are less likely to write it down or something.
It is more secure in regards to the bus factor, i.e. if you are in an accident, leave without notice or otherwise become suddenly unavailable, the company doesn't lose access to your stuff and doesn't have to jump through hoops to recover it.
It gives your manager a feeling of control.
It is less secure in regards to all eggs being in one basket, and someone getting access to the password safe now has everyone's password, congratulations.
It is less secure in eliminating the confidence that some evil deed done with one person's account must have been done by that person, because other people do have access to his password and could impersonate him.

If that's the balance the company wants, fine. Make sure to use a password that is unrelated to any personal/private passwords you are using.


ASP.NET Forms Authentication always redirecting back to Login page

Question: I have a problem with an incredibly simple website using simple Forms authentication.
I have a a single page Default.aspx and a Login.aspx.
Default.aspx is protected by <deny users="?" />
The Login.aspx calls
FormsAuthentication.RedirectFromLoginPage( tbUserName.Text, chPersist.Checked );

I used Fiddler to check if the redirect works. It does. But the Default page always redirects back to the Login page (HTTP/1.1 302 Found).
The cookie is created as expected and Fiddler tells me it's there. But it just won't load the default page.
I tried so many combinations, but the only thing that makes the default page load "successfully" is when I turn off the deny="?" rule in IIS/web.config. But then all users can get to the page, which is not what I want.
Web.config on the server and my machine:
    <authentication mode="Forms">
        <forms loginUrl="Login.aspx" name=".ASPXFORMSAUTH" defaultUrl="Default.aspx" cookieless="UseCookies" />
    </authentication>
    <authorization>
        <deny users="?" />
    </authorization>

Ironically all this is working great in any case when I debug the site in Visual Studio, but upon deployment it does not work. The web.config is deployed with the site.
I have no idea why this still isn't working.
Anyone?
Answer: Try recycle the application pool.. and then restart the IIS server.
Answer: This can be as one solution for you.
If you have the following line of code in your web.config file remove it.
<system.webServer>
    <modules>
      <remove name="FormsAuthentication" />
    </modules>
  </system.webServer>

Answer: You could check, that IIS has activated Forms Authentication for that site. If this is disabeld, it might result in odd behaviour when trying to authenticate via form.


Does Qt creator by default statically or dynamically link it's libraries?

Question: I'm developing a closed source application and to do so in accordance with the LGPL I have to dynamically link Qt's libraries to my application. Does Qt do this by default or do I have to take steps to do so? If that's the case how would I go about doing it?
Answer: Qt uses dynamic linking by default.
You'll notice this immediately during deployment to a non-developer machine, because your code will not run without the Qt libraries.
If your concern is the LGPL, just be careful when compiling Qt itself. Most LGPL violations with Qt are not because of static linking (since dynamic is the default), but for compiling Qt with non-default parameters.
LGPL is not just that the library must be provided along your binaries, but also that you specify how your users can build themselves the LGPL part. If you compile Qt yourself and do not use the pre-compiled binaries from the website, you must document that part of your build configuration in your release!
As soon as you get something running on your program, start preparing a release version for a non-developer environment without Qt installed. Your program should fail as soon as you delete the DLLs that you must copy along your program (or whatever format your OS uses).
Comment: I haven't been able to find this information in the official documentation. Care to provide a source?
Answer: It does it by default, statically linking seems to be quite involved judging by the many questions on the site regarding it.


UK closed investment company for stocks

Question: I am going to set up a closed investment company mainly for stocks (and eventually property) investments. Now, let's say I will invest in stocks and I will not cash out in the first tax year period, am I right to say the profit is 0 so the tax is also 0? Only when the company will make profit (in this case selling the stocks hopefully grown) and then I have to pay taxes.
Comment: Apologies if I've missed the point, but what about the stocks you're investing in? Won't they pay a divvy?
Comment: What about [dividends](https://www.gov.uk/tax-on-dividends)?
Comment: if you have no profit.. no dividends are possible
Answer: Just to add to DaleM's answer: as well as deducting allowable expenses, dividends are taxed as part of one's total income after taking in to account the relevant Personal Allowance and Dividend Allowance:

You do not pay tax on any dividend income that falls within your Personal Allowance (the amount of income you can earn each year without paying tax). [£12,570 for 2021/22]
You also get a dividend allowance each year. You only pay tax on any dividend income above the dividend allowance. [£2,000 for 2021/22]
Answer: A company pays tax on taxable profit
That is, taxable revenue less tax deductible expenses. Not all revenue is taxable and not all expenses are tax deductible. Capital gains are also taxed differently from normal revenue.
If the company invests in stocks (by which I assume you mean shares in publicly traded companies and not herds of cattle or flocks of sheep), most of these will pay semi-annual dividends. These are taxable revenue and, subject to any deductions, you will owe tax on them.
Comment: not all stocks give dividends. But yes the answer is clear thanks.

UK closed investment company for stocks


Why is the voltage drop across an ideal wire zero?

Question: I'm having trouble conceptualizing why the voltage drop between two points of an ideal wire (i.e. no resistance) is $0~V$. Using Ohm's Law, the equation is such:
$$
V = IR \\
V = I(0~\Omega) \\
V = 0$$
However, conceptually I can't see how there is no change in energy between these two points.
It is my understanding that the electrical field of this circuit produces a force running counterclockwise and parallel to the wire which acts continuously on the electrons as they move through the wire. As such, I expect there to be a change in energy equal to the work.
Voltage drop is the difference in electric potential energy per coulomb, so it should be greater than $0~V$:
$$
\Delta V = \frac{\Delta J}C \\
\Delta J > 0 \\
\therefore \Delta V > 0
$$
For example, suppose I have a simple circuit consisting of a $9~V$ battery in series with a $3~k\Omega$ resistor:

If the length from point 4 to point 3 is $5~m$, I would expect the following:
$$
W = F \cdot d \\
W = \Delta E \\
F > 0 \\
d = 5 > 0 \\
\therefore W > 0 \\
\therefore \Delta E > 0$$
Since work is positive for any given charge, the change in energy for any given charge is positive -- therefore the voltage drop must be positive. Yet, according to Ohm's Law it is $0~V$ since the wire has negligible resistance.
Where is the fault in my logic?
Comment: Don't forget that an electric field *accelerates* electric charge.  If there were, in fact, an electric field acting continuously on the electrons in the ideal conductor, the electric current would continuously *increase* since the electrons would be continuously accelerating.
Comment: Does this mean work is $0$ throughout the entire circuit since the velocity of the electrons remain constant?
Comment: No, and I'm not sure how you could infer that from my comment.  Electric power (time rate of change of work) is the product of voltage and current.  Since the voltage across an ideal wire is zero, there is zero power associated with the wire for *any* current.  But the voltage isn't zero across the resistor or the battery so there is power associated with these circuit elements.
Comment: Possible duplicate: https://physics.stackexchange.com/q/8675/2451 and links therein.
Comment: If there is no friction on the electrons moving through the wire, then you *don't need* to perform any work on the electrons to keep them moving at a constant velocity (Newtons first law of motion). Thus a constant electric current can flow through an ideal conductor with no voltage drop.
Comment: what about the work done by the electric field in order to accelerate the electrons?
Comment: @jabirali But there is potential difference in terminal. Shouldn't terminal accelerate those electron?
Answer: The key thing is that there is NO electric field within the perfect wire. So, there is no force acting on the electron, and thus no work done on it (while it's in the perfect wire).
This goes back to the definition of a perfect conductor (which the perfect wire is). Within a perfect conductor, there is no electric field. Instead, the charges (which have infinite mobility) rearrange themselves on the surfaces of the conductor in such a way as to perfectly cancel out any internal field.
So, the only fields in your circuit would be 1) in the battery, and 2) in the resistor.
I should also add that this is due to the approximation of the wire as 'perfect'. A real wire has some resistance, or equivalently, its charges don't perfectly reorder so as to perfectly cancel an internal field.
Comment: The cause of resistance in materials is a very complex topic (that's why it's just glossed over by either calling a wire 'perfect', or sweeping everything into the one value of 'resistance'). Resistance in a wire isn't due to the electrons bouncing off the nuclei; quantum mechanics makes things more interesting. I'd like to explain more, but don't have space in a comment. Search for "impurity scattering" and "phonons"; those are the two main culprits for electrical resistance in a normal wire.
Comment: I think that's the best way to think about it. The difficulty is that when you start asking "what actually IS resistance", you need to use quantum mechanics, and "force" just isn't a very good concept there. So, my summary would be: "in an ideal conductor, there is no net electric field, and in a non-ideal conductor, there is a net electric field but the force from that field is countered by a 'force' due to the resistance." Does that help?
Comment: @Zane Beckwith even I was having the same question you have answered very nicely but I have another question.If there is an electric field in a resistor then when an electron moves across it 1.Potenial Energy of an electron is lost 2.Energy is lost because the electrons collide etc.Now when I was studying I saw that the heat dissipation of a resistor is simply the loss of potential energy of an electron accros the resistor.How can we equate these two?
Comment: I wasn't aware that the electrical fields cancel out. Your answer seems to make sense, but I'm having trouble visualizing the charges. Would you be able to expound on how the arrangement of the charges differ in the presence and absence of resistance.
Comment: Think of the wire as a horizontal cylinder. If you apply an electric field pointing to the left, the electrons in the wire will move to the right, so that eventually they collect on the right side, and there is a deficit of electrons on the left. This distribution of charge (positive on the left, negative on the right) produces a field of its own, pointing to the right, which works against your applied field. This process will continue, until there is no net field left inside the conductor; the equilibrium is reached once there is no more field and thus the electrons experience no net force.
Comment: I see now what you mean for an ideal conductor. However, is the reason there is net force when resistance is present due to the opposing force of the protons? Furthermore, if there is a net force, why is there no acceleration as Alfred Centauri points out?
Comment: Also, in response to Alfred Centauri's comment, even if there is a field inside a material (as there is in the resistor and battery), the electron doesn't really accelerate forever. The reason is its interaction with the material, which is causing the resistance. In a material with non-zero resistance, an electric field creates an average constant velocity for the electrons; this is the content of Ohm's Law.
Comment: I think I've got it now! So in an ideal conductor, the forces cancel out causing the electrons to move at a constant velocity -- while in non-ideal conductor there is a net force accelerating the electrons, but the resistance causes various "collisions" and other phenomenon which ultimately result in an average constant velocity (i.e. drift velocity).
Comment: Yes thank you, I conceptually I understand the idea now while still being aware that getting more in depth into what is actually happening would require going beyond a Newtonian model.
Comment: What moves the electrons in the resistor? Do some electrons rearange to cancel the field and what is left continues to move at constant velocity and then gets into the resistor?
Comment: Electric fields cancel out in a conductor that is in EQUIPOTENTIAL. A conducting wire with an applied potential does NOT constitute an equipotential.
Answer: $F$ is not greater than 0 in an ideal wire, think 'frictionless surface' if it helps.
In this idealisation, the electrons are considered to move from 4 to 3 without effort...  Therefore there is no need to invoke any energetic loss.
If this doesn't appeal then you need to drop the idealisation and consider resistivity and then you can the case more physical...
If you're feeling philisophical: "In an idealisation, there is no wire."
Comment: but if there is no wire there is potential difference across two terminal


Modelling a Klein bottle

Question: How can you model a Klein bottle, such as this one?
Answer: There are most likely several methods, and they probably all have both drawbacks and advantages. I will show how to use the XYZ Math surface for this.
First of all, unless you have already done this, enable the Add Mesh: Extra Objects addon. Go to user preferences (CtrlAltU), click the Addons tab, then Add Mesh. Make sure the check box for Add Mesh: Extra Objects is ticked, then click Save user settings.

Then Add > Mesh > Extra Objects > Math Function > XYZ Math Surface.
This is what you will see

The default object created by this is a snail shell. To get the Klein bottle, enter these equations. Just copy and paste from here.
X equation:
$$-\frac{2}{15}\cos(u)\left(3\cos(v)-30\sin(u)+90\left(\cos(u)\right)^4\sin(u)\\
-60\left(\cos(u)\right)^6\sin(u)+5\cos(u)\cos(v)\sin (u)\right)$$
-2/15*cos(u)*(3*cos(v)-30*sin(u)+90*cos(u)**4*sin(u)-60*cos(u)**6*sin(u)+5*cos(u)*cos(v)*sin(u))

Y equation:
$$-\frac{1}{15}\sin(u)\left(3\cos(v)-3\left(\cos(u)\right)^2\cos(v)-48\left(\cos(u)\right)^4\cos(v)+48\left(\cos(u)\right)^6\cos(v)\\
-60\sin(u)+5\cos(u)\cos(v)\sin(u)-5\left(\cos(u)\right)^3\cos(v)\sin(u)\\
-80\left(\cos(u)\right)^5\cos(v)\sin(u)+80\left(\cos(u)\right)^7\cos(v)\sin(u)\right)$$
-1/15*sin(u)*(3*cos(v)-3*cos(u)**2*cos(v)-48*cos(u)**4*cos(v)+48*cos(u)**6*cos(v)-60*sin(u)+5*cos(u)*cos(v)*sin(u)-5*cos(u)**3*cos(v)*sin(u)-80*cos(u)**5*cos(v)*sin(u)+80*cos(u)**7*cos(v)*sin(u))

Z equation:
$$\frac{2}{15}\left(3+5\cos(u)\sin(u)\right)\sin(v)$$
2/15*(3+5*cos(u)*sin(u))*sin(v)
U min: 0
U max: pi or (3.141592653589793)
V min: 0
V max: 2*pi or (6.28318530718)
U steps and V steps control the number of vertices in each direction, the same as the number of segments and rings on a UV sphere.
If you enable U wrap, the opening of the bottle will be closed. You decide which you prefer. If you enable V wrap, some vertices will be lost, but I haven't been able to find where. I don't know at all what Close V does. It doesn't change either the appearance or the number of vertices and faces.
As you can see, these equations are very complex, and this has the drawback of making them difficult to modify. I will try to show you how to overcome that, using proportional editing and a scaling technique I learned from the answer to my own question in this thread: Making a curved tube thinner or thicker without scaling its overall size
Go into Edit mode, and select all. Remove doubles (W R). Deselect all and make sure Limit selection to visible is disabled.

Make sure proportional editing (O) is set to Connected and proportional editing falloff (ShiftO) is set to smooth.
Select the vertices you want to modify.

If you want to make any part of the mesh bigger or smaller, Shrink Fatten (AltS) is the tool. Scroll the mouse wheel to change the size of the sphere of influence of the proportional editing.

If you want to move any part of the bottle, keep proportional to its aforementioned settings, select the parts you want to move and drag them to where you want them. Like so:

Repeat steps 2 through 4 until the bottle is to your liking.

You're done.
N.B. A Klein bottle is self intersecting, and therefore won't work as a fluid container with the current fluid simulation of Blender.
Comment: It was a joke ;) There is no way to get consistent normals on a Kleine bottle (or even a Mobius strip) because at some point the inside will become the outside. I might work if you first give the surface some thickness by applying a solidify modifier, because then the surface would flip twice. I haven't tried it though.
Comment: Very nice, now you only have to show us how to ge consistent normals ;)
Comment: @maddin45 I have tried and tried, to no avail. :(
Comment: I'm working on an animation where I'll use a cheat. Using an opaque bottle containing a fluid outflow and making the vertices by the opening an inflow. This way, when the bottle is standing, the fluid will disappear into the outflow, and when it's tilted the fluid will flow as if the bottle contained it. In theory at least. I'm not quite there yet.
Comment: Just noticed that an inflow can't use vertex groups (hadn't actually come to that specific bit until now), so perhaps a fully transparent object as an inflow just at the opening and an outflow just beneath the inflow.
And doesn't the solidify modifier also require consistent normals? At least I get very bad results when trying to solidify.
Anyway, this is getting OT now, as this was about the actual modelling. I may have to post another question to explore this further. One that I can't answer myself.
Comment: Yes you are right, the solidify modifier also needs consistent normals. My bad. But have you tried to 1. split the model along one edge loop, 2. recalculate the normals, 3. apply the solidify modifier and 4. merge the result back together?
Comment: No, I haven't tried that. I may later, but first I have a few simpler ideas. Basically about the size and shape of the inflow and the outflow. And most of all, I have been sadly neglecting my sister's birthday greeting, on which I was working when I got stuck with this thing. (I still have time for the greeting... Fortunately).
Comment: @SixthOfFour thank you for the great question and answer about Klein bottles. I used your method and made one [here](http://chat.stackexchange.com/transcript/message/20932276#20932276).
Comment: @David That's great. :) I've been fiddling to and fro with one that can actually hold its liquor.
Answer: Beside math, there can be a simpler way to model it:

Add Bezier Curve, do not make it cyclic, then tweak points;
Adjust Radius (Select one or more points, AltS)
Convert to mesh (AltC - Convert Mesh from Curve/Meta/Surf/Text)
Bridge the two open loops (W - Bridge Edge Loops)
Cut off the intersect faces: Mesh > Faces > Intersect, then delete them. (optional)

P.S.:
The consistency of normals has to be broken in this case. It is very interesting, which means you cannot make thickness simply by applying one Solidify modifier. It actually isn't a 3-dimensional thing.
Comment: A good one, no doubt. :) Upvote for that.
Comment: That's a smart use of "Bridge Edge Loops". I'm sure I will borrow that technique for something someday. :-)
Comment: "Beside math, there are simpler ways..." I was getting all geared up to not believe you and then looked further, and did a quiet face-palm. That's really nice! To make a finite-thickness walled object you have to make two copies - one moving "out", one moving "in". The one that starts "out" will end in, and vice versa. Then delete the original and splice the two together.
Answer: Since it came up in the comments about the normals being a total mess after Remove Doubles is used because the mesh folds through itself I have posted an answer here on how to fix this.
Recently a tool named Intersect was added that can fix this issue by performing what is similar to a Boolean Intersect operation except that this tool works in Edit mode and can handle self-intersections.
The first image shows the messy mesh after Remove Doubles is used.

Now press spacebar and type Intersect and click that entry to activate the tool and change the menu entry to Self-Intersect.

Next use Remove Doubles again.  This may require an adjustment to the Merge Distance.
Once that's done you can select everything and use Ctrl n to Recalculate Normals and it should look good.(aside from the quads meeting up with nGons.)
There are also some interior faces created at the junction which should be deleted.
Here's the result rendered with a glass shader and a bit of volume.
Comment: And an upvote for that one too.
Comment: Looks like this is rendered as a _solid_. The Klein Bottle is actually hollow. The messed-up normals are then a topological necessity, the Klein Bottle being famously non-orientable. So, the intersect tool actually doesn't the physically "right", but mathematically wrong thing.

Modelling a Klein bottle


getting permission or paying fee to use the System Usability Scale (SUS)

Question: I am trying to use SUS scale in my study, but wondering about the process of getting permission or paying the fee for using the scale. I could not get any hint from Google search. Thank you in advance.
Answer: It's free and you don't need any permissions, just mention the methodology used in any published work. It's a bit outdated and unreliable, though. Even the page in usability.gov states that everything there may be incorrect and/or out of date.

Usability.gov is archived and no longer updated
External links may not function and information on the site may be out
of date. Visit digital.gov for current information.

and a search for SUS on digital.gov leads to the same page in a loop, so...


Illuminated Light Switch flickers

Question: My illuminated light switch flickers when off. I've had it a long time and never noticed it flickering before. I recently had an electrician replace the 3 mini hanging lights I had that were a disaster. They took light bulbs with mini bases, the spiral kind. They were difficult to remove, some replacements wouldn't fit, I broke one that I couldn't remove. Finally had the fixture  replaced with the hanging lights that took bulbs with the normal size base.  I believe the bulbs are called CFL and have the spiral inside a regular looking bulb.
I read on this site about the bulbs flickering when there's an illuminated switch. My situation is that the bulbs don't flicker but the switch does. It's not a dimmer, just the flip kind. I'm concerned about the possibility that the flickering light switch could wear out wires and cause a fire. Bay City, Mi
Comment: If you unscrew all the CFL's does it not flicker?
Comment: Do they flicker at a constant steady rate, or erratically?  I don't think the fluorescent bulbs could make it flicker when turned off, maybe there was some damage to the switch or wiring when the electrician was working.
Comment: i bought brand new illuminated swithes at least 10 of them. about half flicker now, flickered right away. defective when purchased. I think people bring back bad ones and they just put them right back on the shelf. drives me nuts.:)
Answer: If it is an old switch that is internally illuminated when off, then it probably uses a small neon bulb as the light source.  They do burn out eventually.  Usually they flicker before they completely burn out.
The neon lamp burning out is not hazardous in any way.  The lamps are not replaceable.  If you want to fix it then you will need to replace the old illuminated switch with a new one.

Illuminated Light Switch flickers


Using Python to Query GCP Stackdriver logs

Question: I am using Python3 to query Stackdriver for GCP logs. Unfortunately, the log entries that have important data are returned to me as "NoneType" instead of as a "dict" or a "str". The resulting "entry.payload" is type "None" and the "entry.payload_pb" has the data I want, but it is garbled.
Is there a way to get Stackdriver to return this data in a clean format, or is there a way I can parse it?
If not, is there a way I should query this data that is better than what I am doing and yields clean data?
My code looks something like this:
#!/usr/bin/python3

from google.cloud.logging import Client, ASCENDING, DESCENDING
from google.oauth2.service_account import Credentials

projectName = 'my_project'
myFilter = 'logName="projects/' + projectName + '/logs/compute.googleapis.com%2Factivity_log"'

client = Client(project = projectName)
entries = client.list_entries(order_by=DESCENDING, page_size = 500, filter_ = myFilter)
for entry in entries:
    if isinstance(entry.payload, dict):
        print(entry.payload)
    if isinstance(entry.payload, str):
        print(entry.payload)
    if isinstance(entry.payload, None):
        print(entry.payload_pb)

The "entry.payload_pb" data always starts like this:
type_url: "type.googleapis.com/google.cloud.audit.AuditLog"
 value: "\032;\firstname.lastname@example.com"I\n\r22.214.171.124\0228

Answer: It looks like something is broken in python library related to parsing protobuf for logging.
I found two old issues

https://github.com/GoogleCloudPlatform/google-cloud-python/issues/3218
https://github.com/GoogleCloudPlatform/google-cloud-python/issues/2674

that seems to be resolved sometime ago - but I believe problem was reintroduced.
I have ticket opened for google support on this issue and they are looking into it.
As workaround - you can use two options:

You can create export (sink) to BigQuery - so in this case you query your log easily - problem with this approach it does not export old data that you collect before creating export.
You can use gcloud command. Especially
gcloud logging read

It is very powerful (supports filters, timestamps) - but its output format is yaml. You can install and use PyYAML library to convert logs to dictionary.
Answer: The LogEntry.proto_payload is an Any message, which encodes some other proto buffer message. The type of proto message is indicated by type_url, and the body of the message is serialized into the value field. After identifying the type, you can de-serialize it with something like
from google.cloud.audit import AuditLog
...

audit_log = AuditLog()
audit_log.ParseFromString(entry.payload_pb.value)

The AuditLog message is available at https://github.com/googleapis/googleapis/blob/master/google/cloud/audit/audit_log.proto and the corresponding Python definitions can be built using the protoc compiler
Note that some fields of the AuditLog message can contain other Any messages too. There are more details at https://cloud.google.com/logging/docs/audit/api/
Comment: Thank you fort the response.  I believe the protobuf definition appears here: https://github.com/googleapis/googleapis/blob/master/google/cloud/audit/audit_log.proto .  However, I do not see the a corresponding audit_log.py anywhere. Is this distributed someplace I'm not seeing?
Comment: Typically interface code (for any language) is build from the .proto file. See https://developers.google.com/protocol-buffers/docs/pythontutorial#compiling-your-protocol-buffers

(and yes, that's the right audit_log.proto)
Answer: In case anyone has the same issue that I had, here's how I solved it:
1) Download and install protobuf. I did this on a mac with brew (brew install protobuf)
2) Download and install grpcio. I used pip install grpcio
3) Download the "Google APIs" to a known directory. I used /tmp, and this command git clone https://github.com/googleapis/googleapis
4) Change directories to the root directory of the repository you just downloaded in Step 3
5) Use protoc to build the python repository. This command worked for me protoc -I=/tmp/googleapis/ --python_out=/tmp/ /tmp/googleapis/google/cloud/audit/audit_log.proto
6) Your audit_log_pb2.py file should exist in /tmp/audit_log_pb2.py
7) Place this file in the proper path OR in the same directory as your script.
8) Add this line to the imports in your script:import audit_log_pb2
9) After I did this, the entry.payload portion of the Protobuf entry was consistently populated with dicts.
PLEASE NOTE: You should verify what version of protoc you are using with the following command protoc --version. You really want to use protoc 3.x, because the file we are building from is from version 3 of the spec. The Ubuntu package I installed on a Linux box was version 2, and this was kind of frustrating. Also, although this file was built for Python 2.x, it seems to work fine with Python 3.x.
Comment: Caveat: unfortunately `googleapis/google/cloud/audit/audit_log.proto` is not kept up-to-date so any addition to the API like [this one that I initiated](https://issuetracker.google.com/issues/72222775) was not added in the proto and hence will not be readable as-is I assume.
Answer: Actually I missed that but you can disable gRPC and make the API return a dict (JSON) payload by setting the environment variable GOOGLE_CLOUD_DISABLE_GRPC to a non-empty string, e.g. GOOGLE_CLOUD_DISABLE_GRPC=true.
This will populate the payload instead of payload_pb - easier than compiling a proto buffer which may be out-of-date !
Answer: I followed @rhinestone-cowguy's answer, but think example usage will help people who find this answer. To use the compiled (proto) code:
from google.cloud import logging
import audit_log_pb2

client = logging.Client()
PROJECT_IDS = ["one-project", "another-project"]

for entry in client.list_entries(projects=PROJECT_IDS):  # API call(s)

    # The proto payload is an Any message.
    audit_log = audit_log_pb2.AuditLog()
    entry.payload.Unpack(audit_log)
    print(audit_log)

The use of the Any message is documented in Python Generated Code.


Using Java to read and process textfile with custom column and row separators

Question: I have a text file which contains content scraped from webpages. The text file is structured like this:
|NEWTAB|lkfalskdjlskjdflsj|NEWTAB|lkjsldkjslkdjf|NEWTAB|sdlfkjsldkjf|NEWLINE|lksjlkjsdl|NEWTAB|lkjlkjlkj|NEWTAB|sdkjlkjsld
|NEWLINE| indicates the start of a new line (i.e., a new row in the data)
|NEWTAB| indicates the start of a new field within a line (i.e. a new column in the data)
I need to split the text file into fields and lines and store in an array or some other data structure. Content between |NEWLINE| strings may contain actual new lines (i.e. \n), but these don't indicate an actual new row in the data.
I started by reading each character in one by one and looking at sets of 8 consecutive characters to see if they contained |NEWTAB|. My method proved to be unreliable and ugly. I am looking for the best practice on this. Would the best method be to read the whole text file in as a single string, and then use a string split on "|NEWLINE|" and then string splits on the resulting strings using "|NEWTAB|"?
Many thanks!
Comment: Did you tried java.util.Scanner?
Comment: With OpenCSV you can set custom separators: http://opencsv.sourceforge.net/#custom-sepators
Comment: what's wrong with String.split() ? Or Scanner like @Jomoos mentioned?
Comment: maybe i was too hasty to disregard string split. i'm giving that a go now.
Answer: You could do something like this:
Scanner scanner = new Scanner(new File("myFile.txt"));

List<List<String>> rows = new ArrayList<List<String>>();
List<String> column = new ArrayList<String>();

while (scanner.hasNext()) {

    for (String elem : scanner.nextLine().split("\\|")) {

    System.out.println(elem);

    if (elem.equals("NEWTAB") || elem.equals(""))
        continue;
    else if (elem.equals("NEWLINE")) {
        rows.add(column);
        column = new ArrayList<String>();
    } else
        column.add(elem);
    }
}

Took me a while to write it up, since I don't have IntelliJ or Eclipse on this computer and had to use Emacs.
EDIT: This is a bit more verbose than I like, but it works with |s that are part of the text:
Scanner scanner = new Scanner(new File("myFile.txt"));
List<List<String>> rows = new ArrayList<List<String>>();
List<String> lines = new ArrayList<String>();
String line = "";

while (scanner.hasNext()) {
    line += scanner.nextLine();
    int index = 0;
    while ((index = line.indexOf("|NEWLINE|")) >= 0) {
        lines.add(line.substring(0, index));
        line = line.substring(index + 9);
    }
}

if (!line.equals(""))
    lines.add(line);

for (String l : lines) {
    List<String> columns = new ArrayList<String>();
    for (String column : l.split("\\|NEWTAB\\|"))
        if (!column.equals(""))
            columns.add(column);
    rows.add(columns);
}

Comment: thanks. this looks good and i'm trying to understand it 100%. will this work if there is a "|" appearing in my text other than in a |NEWTAB| or |NEWLINE|?
Comment: @Andrew: No, it would fail. See edit for a solution that works with pipes (`|`) appearing in your text.
Answer: I think that the other answers will work too, but my solution is as follows:
FileReader inputStream = null;
StringBuilder builder = new StringBuilder();

try {
    inputStream = new FileReader(args[0]);
    int c;
    char d;

    while ((c = inputStream.read()) != -1) {
        d = (char)c;
        builder.append(d);
    }
}

finally {
    if (inputStream != null) {
        inputStream.close();
    }
}

String myString = builder.toString();

String rows[] = myString.split("\\|NEWLINE\\|");

for (String row : rows) {
    String cols[] = row.split("\\|NEWTAB\\|");

    /* do something with cols - e.g., store */
}


How to reverse the direction of rotational movement on the same axis?

Question: I want to make a "gearbox" that will transform input rotational movement to an output rotational movement with the same speed but in the different direction (clockwise / counterclockwise) on the same axis. How can this be done?
Answer: Option 1 - just reverse direction without affecting the speed: Bevel gears in differential gear setup, with the carrier (the axle on which the intermediate gears are located) fixed to the chassis.

Option 2: reverse direction and change speed by a large amount. Planetary/epicyclic gear, fixed carrier (the green part in the image below) fixed to the chassis with the second shaft connecting to the ring gear (pink). Changing gear ratio between the ring gear and the sun gear (yellow) changes the speed and torque on top of reversing the direction.

Option 3: Use two universal joints to offset the shafts relative to each other, so that they are no longer in line, then use a standard gear to reverse the direction, possibly changing speed a little in the process.
Answer: Bevel gears to each of the axles and one meshing with both of them attached perpendicular to the gearbox.
Essentially a differential where the input shaft is locked.
Comment: I'd throw in a few more details.  I know how a  car's differential works, and even so I read your last line as  "limited-slip differential," which of course has both shafts rotating in the same direction.


Gauss' proof that "the best estimate for a random variable is the average"

Question: I have read that "Gauss proved that the best estimate for a random variable is the average." Can someone provide Gauss' publication containing that proof? To be clear, I am not looking for you to perform a derivation, instead, I am simply looking for a citation. Thanks.
Comment: I think this is correct, @whuber. If you paste your comment as an answer I can select it. In the meantime, I ordered Stewart's 1987 translation of the Gauss work you mention; I will post page numbers and confirm the answer once I make my way through it. Thanks to all.
Comment: This quotation can be interpreted in different ways: do you mean to estimate a random variable *a priori* with no data, in which case by "average" you would mean "expectation"? Or do you mean to estimate some property of a random variable based on a sample?  If so, which property?  Finally, in what sense to you mean "best"?  There are some combinations of these interpretations that are (trivially) implied by Gauss's results on least squares, but not all of them are.
Comment: Thanks, @whuber, for the helpful clarification. I believe the original (quoted) author's intent was the former option; i.e., in the instance in which there is no sample data, and "average" is meant as "expectation." As for "best," I'm sure that would be outlined in the actual proof, but I think what the original (quoted) author meant was that this result should (at least) not be inferior to any other formulation. Again, thanks.
Comment: I believe that interpretation would be one of the very simplest applications of Gauss's results in *Theoria Combinationis Observationum Erroribus Minimum Obnoxiae* (1812, 1823, 1826).  It consists of fitting the model $Y=\mu+\varepsilon$ under least-squared loss based on a single observation.
Answer: This is a compendium of Gauss's contributions to statistics. If Gauss did indeed accomplish what you assert ... you should be able to find it here.... If not then the assertion may not be true.
I skimmed this rather exhaustive paper and could not precisely find what you are looking for .... but perhaps another scan will pick it up.
Comment: Thank you, @IrishStat. I will see how this question develops elsewhere before selecting a solution, but regardless this is a very helpful link. Thank you!


Why Clone Troopers changed to Storm Troopers?

Question: Is there an explanation of why the clone troopers changed to storm troopers? And why the clone troopers seemed to be more organized and specialized (colors, weapons variations, etc) than Storm troopers?
Comment: That seems to cover the first part of the question, but not the second.
Comment: This question can be edited to focus on the separate/unique question. This is a good example of why you should avoid asking multiple questions together if it can be avoided.
Answer: Basically when Palpatine turned the Republic into the Galactic Empire, he renamed the clone troopers to Imperial Stormtroopers.
From the Star Wars Wiki on Clone Troopers:

In a prolonged speech regarding the downfall of the Jedi Order and the end of the Clone Wars, Palpatine announced that the Republic would be supplanted by a New Order; the first Galactic Empire, in which he would rule supreme as its first emperor.
Just as the Republic was renamed and reorganized into the Empire, the clone troopers were also affected by Palpatine's reforms. No longer known as the clone troopers who defended the Galactic Republic under the leadership of the Jedi Order, the clones were anointed as Imperial stormtroopers.

The Star Wars Encyclopedia states that "they [stormtroopers] no longer take guidance from the wisdom of the Jedi Knights. Instead, stormtroopers are employed in the most brutal of Imperial strikes, commanded by cruel officers and governors." This may explain why they have become less organized.
Changes in color and weaponry are simply upgrades. After the initial rebranding as Storm Troopers, the old clones would still have had their colored armour. But new batches of clones were made with improved armour and eventually the old Fett clones died out in battles, specifically the Battle of Kamino (Star Wars: Battlefront II). From the wiki:

At first, the Stormtrooper Corps was composed almost entirely of clone soldiers based on the Fett template. That included the remaining clones that were engineered on Kamino, supplemented by the millions of clones created on Coruscant and Centax-2 through Spaarti technology, and three new stormtrooper clone batches grown in the Outer Rim Territories. During this time, traces of the clones' obsolete armor remained in the design of their new and improved armor. However, the stormtrooper ranks would cease to be dominated by Fett's progeny after the Battle of Kamino in 12 BBY.


How to sort a chess PGN game by date

Question: Is there a way to sort a PGN chess game by date and export the sorted games as a new PGN file?
Answer: I am sure there are many programs that include this functionality. I would be surprised if SCID (http://scid.sourceforge.net/) did not have it. There should be one or more online services that provide this function. In the end of the day, you can write your own script in e.g. Python that does this easily and nicely. The trick is that some games appear as duplicates in less well maintained PGN files. Another trick is that some games are missing certain annotation fields. Some fields could also be filled in with incorrect type of data or simply be empty. So if you go down the road of writing your own scripts, consider writing quality check scripts that make sure the PGN format is followed and that the information is complete.
Comment: Well, I don't see how to do it in Scid.
Comment: @Kinderchocolate then you should include this information in your question: "I did not find a way to do this in Scid".
Comment: If you can provide a bit more information, I can accept you as the answer.
Comment: According to http://scid.sourceforge.net/help/Sorting.html, the sorted order is saved only for non-read-only Scid database files. So perhaps try to save your PGN database as a Scid database. Then sort the Scid database according to e.g. date. Then try to export this Scid database as a PGN file. Additionally, PGN files are plain text and have a clear format and date field. You could write a script (in e.g. Python) that sorts the file by date or try to search for such a script online. By the way, does ChessBase Light (free version) support this function?
Answer: I have not tried this myself, but there is a forum post on chess.com that has instructions on how to do this in SCID (http://www.chess.com/forum/view/help-support/sorting-a-pgn)

Make an empty scid database
Import your games
Do database maintenance - Sort by date
Export your databse to PGN
Comment: The OP didn't ask what was the cheapest or the best tool, just if there was a way. Naturally, free is great. But I think Chessbase is worth the price. So I would stick with my answer regardless of cost.
Answer: You can do it with ChessBase:
http://chessbase-shop.com/en/products/chessbase12_download
Comment: Because there wasn't anything better.
Comment: You accepted this as the best answer? There should be many more ways that are free of charge. Chessbase 12 is an expensive software.
Comment: @StudentT it is of course your right to choose which answer that suits you best :) Still, in my opinion, Chessbase is not the only way to go in terms of recording your games and taking care of them. Cheers.
Answer: The accepted answer does currently (2021) not work with the latest Scid versions. Bug? But it works with Scid vs PC:

In Scid vs PC, open the PGN database which you want to sort (File → Open).
Open the game list, if it is not visible already (Windows → Game List).
Create an empty Scid database via File → New (make sure it is a *.si4 database, not a *.pgn database). You should now see both database buttons below the game list.
Select the PGN database by clicking its button.
Sort the PGN database by your desired criteria. You can do that directly in the game list by clicking on the column headers, or by doing it via Tools → Maintenance → Sort Database (you can reset any sorting by right-clicking a column header in the game list and choosing Reset).
Drag-drop the button of the sorted PGN database on the button of the empty Scid database. This imports all games, sorted in the same order. Test it by resetting the sorting. The sorting should stay the same as in the sorted PGN database.
Finally export the Scid database to a new PGN database using Tools → Export All Filter Games → Export Filter to PGN. I recommend to not set the encoding to utf-8, I encountered problems in other databases when I did that.

Voilà

How to sort a chess PGN game by date


What's the word that means "The following assumption is true if it gives the right result"?

Question: What's the word that means "I'm assuming this for the time being and upon using the assumption, if I get the correct answer, then it proves that the assumption is true"
Our teacher regularly assumes stuff and use them in a formula and if the result is correct then we know that the assumtion we made is true. He uses a word that sounds something like 'Asphases' but turns out it's not a word as per dictionary so can anyone tell me what he actually means when he says that or if there is another word which has same meaning that would be also great.
Comment: Maybe you should just ask him...?
Comment: Sounds like your teacher might be saying "Assuming that....".  Alternatively you could say "Given that..."
Answer: I think the word you're looking for (which sounds similar to your asphases)  is hypothesis:

[Merriam-Webster]
1 a : an assumption or concession made for the sake of argument
b : an interpretation of a practical situation or condition taken as the ground for action
2 : a tentative assumption made in order to draw out and test its logical or empirical consequences
3 : the antecedent clause of a conditional statement

In particular, it's sense 2 in your case.
Comment: Yes the assumption of hypotheses and testing to see if you can disprove or confirm them is the basis of the scientific method.
Comment: @chaslyfromUK Science can never literally 'confirm' hypotheses, only show they are false.
Comment: Hey thanks for your time. I figured out the word it's 'Ansatz'
Answer: If your description is accurate, it's a case of circular reasoning. You can't prove something by assuming it's true and conclude there is no contradiction. This is mathematics, not a sudoku... The opposite, assuming the negation of the original assumption and reaching a contradiction works and this technique is called proof by contradiction.
It's likely that your professor starts with certain statements called axioms, for example the Peano axioms for natural numbers. But these are foundations of mathematics and reasonings shouldn't try to prove them.
Comment: Hey thanks for your time. I figured out the word it's 'Ansatz
Answer: ...confirmation bias?
I'm sort of teasing with that answer. Perhaps he is saying "axiom"? Are you doing math? An axiom is a statement that is self-evidently true and then you can draw implications from there.
Comment: Hey thanks for your time. I figured out the word it's 'Ansatz
Answer: Ppl I got the word, it's 'ansatz'
"Ansatz : an initial estimate of the solution to a mathematical or technical problem that is used to guide work to a more precise answer"
As in Merriam-Webster dictionary


.Net Mutex Question

Question: I have an application that uses a Mutex for cross process synchronization of a block of code.  This mechanism works great for the applications current needs.  In the worst case I have noticed that about 6 threads can backup on the Mutex.  It takes about 2-3 seconds to execute the synchronized code block.
I just received a new requirement that is asking to create a priority feature to the Mutex such that occasionally some requests of the Mutex can be deemed more important then the rest.  When one of these higher priority threads comes in the desired functionality is for the Mutex to grant acquisition to the higher priority request instead of the lower.
So is there anyway to control the blocked Mutex queue that Windows maintains?  Should I consider using a different threading model?
Thanks,
Matt
Comment: Mutex doesn't have priorities
Answer: Using just the Mutex this will be tough one to solve, I am sure someone out there is thinking about thread priorities etc. but I would probably not consider this route.
One option would be to maintain a shared memory structure and implement a simple priority queue. The shared memory can use a MemoryMappedFile, then when a process wants to execute the section of code it puts a token with a priority on the priority queue and then when it wakes up each thread inspects the priority queue to check the first token in the queue if the token belongs to the process it can dequeue the token and execute the code.
Comment: Since i don't have the reputation to vote all i can do is say Thanks Chris.   I think this is the best path forward.
Answer: Mutex isnt that great for a number of reasons, and as far as i know, there is no way to change promote one thread over another while they are running, nor a nice way to accomodate your requirement.
I just read Jeffrey Richters "clr via c# 3", and there are a load of great thread sync constructs in there, and lots of good threading advice generally.
I wish i could remember enough of it to answer your question, but i doubt i would get it across as well as he can. check out his website: http://www.wintellect.com/ or search for some of his concurrent affairs articles.
they will definitely help.
Answer: Give each thread an AutoResetEvent.  Then instead of waiting on a mutex, each thread adds its ARE to to a sorted list.  If there is only one ARE on the list, fire the event, else wait for its ARE to fire.  When a thread finishes processing, it removes its ARE from the list and fires the next one.  Be sure to synchronize the list.

.Net Mutex Question


Visual Studio 2008 + MOSS 2007 : Updating ASP.NET 3.5 Web Application to SharePoint

Question: What are the steps to updating ASP.NET 3.5 Web application (compiled using Visual Studio 2008) to SharePoint Server 2007?
Answer: You can't just "move" an ASP.NET application to SharePoint. The security model is different, the navigation model is different, the deployment model is different, etc.
You basically have three choices:

Have links in to the ASP.NET application in SharePoint and vice versa. This only requires minor changes.
Use an IFrame to expose the ASP.NET application inside SharePoint pages. This option is most definitely a kludge but it can be done
Rebuild your ASP.NET application as a true SharePoint application. You won't be starting from scratch (you'll be able to salvage some code and markup) but you will be building a new application.
Answer: I'm not sure I quite understand the question.  What are you trying to accomplish?  Host the web application in sharepoint?  If so, i would host the web application elsewhere and use the page viewer webpart to display the site in sharepoint.
UPDATE:
Oh yea, now I realize you are the same person that asked the other question I answered ( MOSS 2007 + Visual Studio 2008 : How to I deploy a Visual Studio 2008 Web Application to SharePoint Server 2007 ).  Which one of my questions met the need for it to be an application page (_layouts)?
Comment: Hi Steve, this question is a new question not related to my another question posted. However, according to the link that you provided in my another question, I notice that if a developer modify his/her web application in visual studio, he/she will need to re-compile and update SharePoint. So, I was wondering how to update sharepoint if a re-compilation of the codes for asp.net web application is needed. (Anyway, it will still be needed because developer usually need to upgrade their codes to fit in new user requirements). In my previous question that you point out - it was more on deployment.


Creating macros in netbeans

Question: I wish to create macro in Netbeans to put block comment over function. I have preference of code formatting over file save. So When I close file it saves code automatically and format it.
Issue is when I create function and comment it. It unformatted my whole block of code like this.
/**
 *function abc(){
 *var a, b = 50;
 *}
 */

I wish to create comment like this. so it keep my coding properly formatted as well.
 /*
 |
 | function abc(){
 |     var a, b = 50;
 | }
 |
 */

Answer: You can add your own macro by Following this instructions:

Edit->Start Macro Recording
Edit->Stop Macro Recirding
It Will pop-up one Box For Editor Macros->Add Your Choice of Macro Name
In code area add Your custom comment code in " your code "; Like,

Blockquote
       "/*
       |
       | function abc(){
       |     var a, b = 50;
       | }
       |
       */"

Assign a Short Cut Key to your Custom Macro.

That's It
Answer: Though I couldn't find macro for the same. But I found alternative. Use Ctrl+Shift+R toggle, for multiple line action at same time & add pipeline sign. But it take extra effort for starting and ending comment.

Creating macros in netbeans


Can a train station and depot be built in the same city?

Question: I'm playing Ticket to Ride: Europe with the 1912 expansion. Can a train station and a depot be placed in the same city?
Answer: No, a depot can't be in same city as a station.  This is in the rules here

There can never be more than 1 Depot in any city. Once placed on the
board, a Depot can never be moved nor removed (nor co-exist with a
Station in Ticket to Ride Europe).


What is this sign in Season 5, Episode 1?

Question: At the end of the credits of The Walking Dead epsiode S05E01 we got to see a familiar face, seemingly following the group. He seems to be able to follow them from a "sign" carved into a tree? Or am I misreading this scene?
Comment: The weird thing is, the "No Sanctuary" sign seems to have aged and grown vines, making it appear as if that scene might be in the future?  And I didn't see anyone carving those X's, nor did I notice them when the group was walking through that area just after Rick put the mud on it.
Comment: As shown in the episodes that follow, other trees also have markings carved into them. One in particular with a fairly large "dash" symbol. Further, remember that the man in the picture is Morgan Jones, the first man Rick meets after he wakes up in the hospital after the world became infested with walkers. In the season 3 episode, "Clear", they encounter Morgan in a booby-trapped town, and he's been writing, "Clear" on everything. I believe one of the marks he used to indicate "clear" status was an X, so this mark could be one he applied to the tree, to signify the area as "clear".
Comment: Also, when re-watching the episode last night I noticed that there were multiple trees in this scene that have these marks. I don't see how anyone in the group would have time to carve out these marks in all those trees.
Answer: In episode 2, Strangers, just before Bob is abducted we see a gash carved into a tree. I presumed this was made by the gang from Terminus.
Then in the next episode, Four Walls and a Roof, the leader of the terminus gang, Gareth, is telling Bob why they did what they did. He says:

You know, we marked our way here so that we could find our way back
  after

So I thinks its' pretty clear the Terminus gang made the markings, which Morgan came across and followed to the church, where he can be seen at in the scene after the credits on episode 6.


What's the Seminal Book on data science?

Question: Can people provide the best textbook they have used for learning data science?  I know this is somewhat difficult because you have no basis of comparison but if you can just give your opinion on a book and why, I'd greatly appreciate it.
Comment: I don't think there's any such thing: first, data science is very broad and not so well defined. A more well defined domain is Machine Learning, but not everything in data science is ML. Second, data science (as well as ML) is recent and things change very fast: any general-purpose book is bound to become obsolete within a few years, so it's unlikely that any book can ever become a reference.
Comment: How could this question be answered with facts and citations?  I'm simply asking what are some respected textbooks on data science.  I'm sure it's a question that many people would like to know.  smh..
Answer: As already pointed out by the first comment, data science is a very broad field and not sharply defined.
But I think since you like to get started with data science and you're looking for resources, I share some of my recommendations with you (in no particular order).

Very applied, less academical, with lots of code examples: Hands-on Machine Learning with Scikit-Learn, Keras, and TensorFlow by Aurélien Géron
The Deep learning bible, more academical, great overview: Deep Learning by Ian Goodfellow, Yoshua Bengio and Aaron Courville
A classic for Machine learning, covers a lot of topics, very educational with great explanations: Pattern Recognition and Machine Learning by Christopher M. Bishop
If you're more into statistics: An Introduction to Statistical Learning: with Applications in R by James, Witten, Hastie & Tibshirani
Machine Learning: A Probabilistic Perspective by Kevin P. Murphy
The classic RL reference: Reinforcement Learning by Richard S. Sutton & Andrew G. Barto

This is only a partial list focusing more on theory and classic data science algorithms. Keep in mind there are many many more books, e.g. I didn't mentioned any resources for Big Data, Data Analytics, Data Mining etc. whatever one would throw into the data science bucket. Further it's possible that this list might be outdated in a few years.


Our copy of Mansion of Madness, second edition doesn't contain the original 8 investigators cards, is this correct?

Question: we had Mansion of Madness, second edition (core game) for Christmas (don't have the original) but the game doesn't have the original 8 investigators. Is this correct? We have 16 other investigators cards. The box say it should come with 8 with matching 8 figures, we have 8 figures but 16 cards. (Not sure if they match) the game comes with a conversion pack which it says has the 16 extra cards. Are we missing the 8 investigator cards??
I'm so confused!
Thanks for any help.
(The box was all sealed, etc.)
Answer: It seems to be correct. From the second-edition rulebook, page 4, "First Game" sidebar:

Before choosing a scenario, if you own the first edition Mansions of Madness base game and/or any of its expansions, you can integrate the components of those products as described by the Conversion Kit rules insert.
Players can play any investigators from the integrated first edition products, and the app can use any of the monsters or map tiles from those products during the game.

I think it's reasonable to infer that the original investigators (and monsters and map tiles) are intentionally separate from the second edition.
I don't own the game, so I can't physically confirm this.
Answer: I own both editions of the game and you are not missing any cards. The core set comes with 16 cards but only 8 miniatures.
The additional 8 cards are part of the conversion kit that allows you to incorporate those investigators if you owned the first edition of the game. If you don't own it, you can acquire the miniatures and tiles from the Recurring Nightmares expansion which is is a reprint of the components that can be used in the second edition from the first edition of the game.
The Suppressed Memories expansion provides the components from the first edition expansions of Call of the Wild and Forbidden Alchemy.
Answer: I got it for Xmas too...the 16 investigator cards are from earlier editions and not for the new one. So not sure how to use the app with no investigator cards to give me their stats


Why System.IO.FileLoadException occurs in Windows application setup?

Question: I made a windows application using c#.net(4.0) and SQLite database. It was working well while debugging, then i created the setup and installed it then when  i am executing .exe it gives the error like this:
  System.IO.FileLoadException: Mixed mode assembly is built against version
  'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without
  additional configuration information.

When i was creating setup of application-
In my app.config, code is
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
</configuration>

and database was in [System.Environment.CurrentDirectory] eg. bin\debug directory, where .exe stays.
What mistake i am doing in creating the setup, do i need to add something more in the case of SQLite??
Need help!! Thanks a lot.
Answer: You need to add
<supportedRuntime version="v2.0"/>


What are the possible cryptographic implications of Zhang's proof of the Twin Prime Conjecture?

Question: Earlier this year, Yitang Zhang published a proof of a weakened form of the Twin Prime Conjecture. I'm wondering if any of the new mathematical machinery he developed has uses in cryptography or could be adapted for future use in the field.
Comment: To anyone reading this question and wanting to answer, don't fall for the same trap as I did - read the question again. The question is about the __mathematical machinery used in the proof__, and not about the application of twin primes in cryptography per se.
Comment: >.< Sorry, that could have been clearer. @nightcracker you can edit my post for clarity if you wish.
Answer: There are no known applications or implications to cryptography of that mathematical machinery.  I've not seen any suggestion that the machinery would plausibly have implications for cryptography.  The twin primes problem doesn't have any obvious connection to any hardness assumption or problem in cryptography.
(Yes, both Zhang's proof and cryptography have something to do with prime numbers, but that is extremely thin. Much of number theory can say it is somehow related to prime numbers, but only a small fraction of number theory has had applications to cryptography. It'd be like assuming that recent improvements in building fast sailboats for the America's Cup has implications for the possible future availability of an immortality potion, since they both involve fluids.)
In other words, this is about as close to a "No" answer as one is likely to be able to give, given the nature of the question (which makes it very unlikely that you are going to get a definite, resounding no).
Here are some surveys of the mathematics of this result and related results, if you want to take a look for yourself:

https://gilkalai.wordpress.com/2013/09/20/polymath-8-a-success/
http://arxiv.org/pdf/math/0605696v1
https://terrytao.wordpress.com/2013/06/30/bounded-gaps-between-primes-polymath8-a-progress-report/


STRIPE - Subscription plan only for 5 month - using Laravel Cashier (stripe)

Question:
Cashier Version: "^12.13"
Laravel Version: "^8.0"
PHP Version: "^7.3"

Hi There!,
I have been wrote a code for create and active subscription plan using "Laravel cashier (stripe)" and It's working good but I want to add some conditions like "I want to active this plan only for 5 month".
In the stripe documentation we can set "ITERATION" during create subscription plan, means If I want to create Subscription plan only for 5 month so I need to set "iteration : 5" (https://prnt.sc/12wnbez).
So here, in Laravel cashier how can I manage it?
Can you please give me any suggestion for this?
Thank you.
Answer: You can do this with Subscription Schedules in Stripe, but I'm not sure if Cashier supports those.
Comment: Thank you for replying me.

Let me try with this. Do you have any GitHub link for integrate in Laravel?
Comment: I do not, no.  Sorry.


Private Domain with SAP Shared IP Configuration

Question: I have one use case where due to the low volume of emails sent monthly the SAP was configured with Shared IP and not Dedicated IP. SAP subdomain is mc.domain.com for example.
The client wants to send emails from the top-level domain, domain.com so we need to subscribe one Private Domain to accomplish this. The issue is that client does not want to add the Shared IP to their SPF list due to the fact is shared among other companies. Will deliverability be impacted due to this or is DKIM and DMARC features the most important ones to ensure good deliverability rates?
Answer: General notes.

Generally, you should only send your emails from an "authenticated domain". It is very unusual to have a top level domain used for sendouts. It is generally advised to have a dedicated subdomain for your email marketing.

"Authenticating" a subdomain via an SAP includes setting the SPF-Record and DKIM. I understand you are not planning to use an SAP, but to use a different domain.

"Private domain" refers to a Salesforce Product, and is referred to as such in the following.

Knowingly not following standard email marketing practices is something I would disencourage.

Details about a private domain in Salesforce Terminology:

A private domain is used as an authentication tool.  A Private Domain that is purchased separately for sending is an authenticated domain for use in the FROM address only.
It is set up either via a User or Sender Profile, and this type of Private Domain DOES NOT include link or image-wrapping. It has an MX record, SPF/Sender ID and DKIM/Domain Keys.

So your private domain (purchased via Salesforce) would have SPF and DKIM.
Typically, such a domain needs be delegated in order for the configuration by Salesforce.
As I understand, you do not want to do that either, but use and reconfigure an already owned domain. And this is where the problems start: Sending from the top level domain also is not something that I would recommend, and you are starting to see why. The domain's administration has to start making changes that are not necessarily beneficial and can have unwanted effects or create conflicts, which explains the (plausible) unwillingness to list a Shared IP in SPF.
Not having SPF configured definitely would have some negative effect. You could potentially test such a setup by sending an email from such a configuration to an inbox on https://www.mail-tester.com/ to get an "exact" measure of how bad that is, but SPF is an industry standard and no provider could really be blamed for blocking your emails, as long as you don't follow it.
There are other repercussions from using the top level domains, e.g.:
There is the potential of your sendouts and the "normal" emails coming from that domain (normal day to day business emails) becoming indistinguishable for a recipient server.  They will confounding each other, meaning that if someone decides to block your marketing emails, "normal business emails" will also be blocked. In a a B2B scenario, this can be quite severe.
In sum - reconsider. I would personally not recommend to follow this approach through.


Can I cast Elemental Touch and Shocking Grasp?

Question: Can I cast Elemental Touch in one round, and then cast Shocking Grasp afterwards?
Do they stack? If so, could I cast elemental touch and choose lightning for even more lightning damage?
Answer: Normally, you can't benefit from two different touch attack spells at the same time, because:
(Taken from FAQ for the Magic rules, see under Range: Touch, FAQ on the right):

If a spell allows multiple touches, are you considered to be holding the charge until all charges are expended?
Yes.

And from the combat rules:

Holding the Charge: If you don't discharge the spell in the round when you cast the spell, you can hold the charge indefinitely. You can continue to make touch attacks round after round. If you touch anything or anyone while holding a charge, even unintentionally, the spell discharges. If you cast another spell, the touch spell dissipates.

(Emphasis mine)

However
Since Elemental Touch is not a touch spell - it is a spell with range:personal which grants a single attack an additional energy damage, and it lasts for 1 round per level. Seems like there's no problem with casting Elemental Touch, and a round later casting Shocking Grasp. As long as you hit before the Elemental Touch ends, you apply the damage from both spells to the attack.
Answer: Yes, to both of your questions.
I can see why you'd be confused, since typically you can't hold the charge on a spell if you cast another spell. However, elemental touch isn't actually a touch spell.  It's a personal spell that targets you.  By casting elemental touch, you are giving yourself the ability to make a special melee touch attack for the next few rounds.  If you cast shocking grasp afterwards, then you can make your elemental touch attack and have it discharge your shocking grasp as well.  In addition, there's no reason that you wouldn't be able to use lightning for both.  There are no rules about damage of the same type from multiple sources not stacking.
Be careful, though, that you cast elemental touch first.  If you cast shocking grasp first, then casting elemental touch will discharge your shocking grasp to no effect, since casting a spell while you hold the charge discharges your touch spell.
Comment: You get an attack with the bonus damage every turn.  However, the secondary effects don't stack.  For example, if you hit someone with the acid touch two rounds in a row, they only take 1 point of acid damage each round, not 2.
Comment: Though it wouldn't be a bad idea to ask that as it's own question.
Comment: One thing that wasn't very clear for me. When I cast elemental touch I have X rounds to use just ONE attack, right? Or do I get one every turn?


How to upgrade a custom jQuery UI theme?

Question: I created 2 custom themes with themeroller for JQuery UI 1.7 with themeroller. Now that I update to jQuery UI 1.8.5, I want to make sure that also my themes are updated. How can I automatically re-generate/update my custom themes with themeroller?
Answer: The jQuery UI theme css file includes an edit link in its comments. This link opens Themeroller with the settings of your custom theme.
<code>  /*
* jQuery UI CSS Framework
* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses.
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Segoe%20UI,%20Arial,%[...]*/
</code>
Comment: Thanks a lot for posting your answer to this.  I think you should accept it.
Comment: Yes.  Many many thanks.  You just saved me a huge headache! =)
Comment: What if I changed manually some "margin" or "padding" (Themeroller is quite limited what can be customized)?
Answer: To add to fbuchinger's answer, this didn't work for me at first - one of the colours came through invalid, so the page did not display the theme properly and I was unable to download it.
If you have the same problem, check there is nothing highlighted red (error), correct as required and it should be OK.
And yes I know this would be better as a comment, but I don't have the required 50 reputation to comment.


Additional variable for wordpress comments?

Question: I'm stuck! I need an additional variable in Wordpress comments. I have already made a field for it, let's call it "hometown".

<input type="text" name="hometown" id="hometown" size="22" />
Whats your hometown?

This value needs to be stored and echo'ed when needed in comments loop. Is there any way to do this?
If it's not possible, a simpler method that appends #hometown value to the comment textbox's itself could do. The script I tried for appending text also doesn't work :
$("input").keyup(function () {
    var txt = document.querySelector("#hometown").value;
    document.querySelector("#comment").value+= txt;
});

Please help me asap! Thanks.
Answer: You could check this out, it might be the thing you want.
click here
Comment: Thanks, this is helpful but ''a bit too much'', I need faster and simpler solution
Comment: Well it's a plugin and with minor modifications in it you could simply add your desired custom field in your comment form


Missing Q11 output on 4060

Question: Is there any reason why Q11 is left out on 4060 IC? I've read it was done to extend the max pulse time (highest clock divider) but why was it done on Q11? Why not Q12 and therefore have a full 8-bit counter (Q4-Q11)?
Comment: You're not also interested in why Q1-3 are not brought out?  :)
Comment: That is an interesting question +1
Comment: @Szymon - I see you list having a PhD wrt driving LEDs. Is it available to see online? - Russell
Comment: @Szymon - [found it here](http://vbn.aau.dk/files/198806667/control_and_driving_methods_for_LED_based_intelligent_light_sources.pdf) thanks. Via [SE question here](http://tex.stackexchange.com/q/155194)
Answer: One possible cause for the design decision was that it was a packaging/budget constraint. They had the 4040 model which was packaged with 16 pins and they were able to manufacture a new counter with different features relatively easily by keeping it so similar:

The 4060 adds two extra digits to the counter along with two pins for directly connecting a crystal oscillator. So this would mean four extra pins. So to keep the counter at the same number of pins, they had to omit the output from some of the counter bits. It seems somewhat arbitrary to me which pins you would omit. The two MSBs of the counter seem to be the most important, since those two are one of the main features that differentiate it from the 4040 counter.
The 4040 provides a counter with a high number of bits (12) and no prescaler. The 4060 provides two different counters with different prescalers. There is a 6 bit counter with a clock/16 prescaler or a 4 bit counter with a clock/1024 prescaler.
In the end, the 4060 looks like it was designed to provide complementary features with the 4040. The 4040 doesn't have oscillator connections, where the 4060 does. The 4060 can divide the clock down 4x slower than the 4040 (the 4040 can be prescaled by /2, /4, etc by omitting LSBs). The 4060 doesn't provide a counter with a high number of bits, while the 4040 does.
I don't have any sources to back up my claims, so treat this answer as partial, and with some skepticism.

Missing Q11 output on 4060


Acidity of alcohols and basicity of amines

Question: I've been studying acids and bases in organic chemistry. My textbook says that alcohols are very weak acids, therefore they cannot react with strong bases. the conclusion i formed from this was: very low acid / base strength leads to not being able to react with stronger bases / acids. But then, while reading the chapter about Amines, i read that aromatic amines (such as aniline) ONLY react with strong acids. Therefore my question is: why is it that very weak acids cannot interact with strong bases, however very weak bases can ONLY interact with strong acids?
Comment: Some very is more very than some other very.
Comment: Does ethanol react with RMgX?
Answer: Qualitative attributes like strong, weak, very weak, very very weak (acid/base) have no widely accepted agreement/definition what it exactly means quantitatively. As consequence, different sources may give different boundaries between them.
That is the reason why you have ended with different evaluation for acids and bases.
In context of water solutions, acids have the characteristic acidity parameter $\mathrm{p}K_\mathrm{a}$. It is equal to $\mathrm{pH}$ when $\pu{50 \%}$ of the acid is dissociated.
\begin{array} {|l|c|}
\hline \mathrm{pH} & \text{% of acid dissociation} \\
\hline \mathrm{p}K_\mathrm{a} - 3 & \approx \pu{0.1 \%} (\frac{1}{1001}) \\
\hline \mathrm{p}K_\mathrm{a} - 2 & \approx \pu{1 \%} (\frac{1}{101}) \\
\hline \mathrm{p}K_\mathrm{a} - 1 & \approx \pu{9 \%} (\frac{1}{11}) \\
\hline \mathrm{p}K_\mathrm{a} & \pu{50 \%} (\frac{1}{2}) \\
\hline \mathrm{p}K_\mathrm{a} + 1 & \approx \pu{91 \%} (\frac{10}{11}) \\
\hline \mathrm{p}K_\mathrm{a} + 2 & \approx \pu{99 \%} (\frac{100}{101}) \\
\hline \mathrm{p}K_\mathrm{a} + 3 & \approx \pu{99.1 \%} (\frac{1000}{1001}) \\
\hline
\end{array}
Mutual reactions of acids with bases have to be assessed in sense what $\mathrm{pH}$ wrt the acid $\mathrm{p}K_\mathrm{a}$ is set by the base excess.
In context of Broensted-Lawry acid-base theory, bases accept H+ ion:
$$\ce{B(aq) + H+(aq) <=> BH+(aq)\text{(conjugate acid)}}$$
where $\ce{B}$ may be a molecule or a ion.
If the base has the basicity constant $\mathrm{p}K_\mathrm{b}$ then its conjugate acid has the acidity constant (at $\pu{25 ^\circ C}$)
$\mathrm{p}K_\mathrm{a, conj}$ = 14 - $\mathrm{p}K_\mathrm{b}$
We can then compare the relative strength of the given acid and the conjugate acid of the given base. (That applies on a solvent too, if it can act as a base like water)
For the stoichiometric ratio of the given acid and base, we can estimate the degree of neutralization.
\begin{array} {|c|r|}
\hline \mathrm{p}K_\mathrm{a,conj} -  \mathrm{p}K_\mathrm{a} & \text{Neutralization degree}   \\
\hline 8 & \pu{0.01 \%}  \\
\hline 6 & \pu{0.1 \%}  \\
\hline 4 & \pu{1 \%}  \\
\hline 2 & \pu{9 \%}  \\
\hline 0 & \pu{50 \%}  \\
\hline -2 & \pu{91 \%}  \\
\hline -4 & \pu{99 \%}  \\
\hline -6 & \pu{99.9 \%}  \\
\hline -8 & \pu{99.99 \%}  \\
\hline
\end{array}
Answer: There exist several sorts of weak acids. They can be weak, very weak and very very weak acids.
Weak acids react with weak and strong bases.
Very weak acids do not react with weak bases. They do react with strong bases.
Very very weak acids do not with weak and with ordinary weak bases.
Ethanol is such a very very weak acid. It does not react significantly with strong bases. I only reacts with sodium metal in a redox reaction.
Aniline is a weak base, but not a very very weak base. It reacts with strong acids.
Comment: I think I understand now. Alcohols are very very weak acids so they do not react with weak bases at all, and their reactivity to strong bases is negligible. Since my textbook said that alcohols do not react with **strong** bases, I thought that they could interact with weaker ones (if A is not B then it is C). Is it fair to conclude that if something does not have significant reactivity to strong bases, then as a consequence it will NOT neutralize a weak base?
(sorry if the questions seem trivial, I am a high school student barely scratching the surface of chemistry)
Comment: @mral The essential condition is what "does not react" mean **quantitatively**. The threshold is a subjective, deliberate parameter. If fraction $\pu{e-3}$ reacted, it reacts. What about $\pu{e-4}$?  $\pu{e-6}$? $\pu{e-10}$? $\pu{e-15}$?  Any molecule?
Comment: The weak base $\ce{NH3}$ with amount concentration $\pu{1 M}$ has $\mathrm{pH} \approx 14 -  4.75/2 \approx 11.63$. If I added a small amount (wrt $\ce{NH3}$) of a  very weak acid $\ce{HA}$ with $\mathrm{p}K_\mathrm{a} = 12.63$, it would have $\pu{\approx 9 \%}$ in dissociated form $\ce{A-(aq)}$, complemented by $\ce{NH4+(aq)}$. So very weak acids do react with weak bases. // Similarly, Aniline would react with acetic acid too. $\ce{Ph-NH3+}$ has pKa 4.63, acetic acid 4.75.  In solution with equimolar concentration, both pairs would have roughly equal concentration of respective acid/base.
Answer: Well, weak acids are even worse with weak bases.  So try logic from 2 or 3 points rather than one.
The alcohol proton is very weakly acidic, pKa 17, but much more so than hydrogen covalently bonded to alkane, around pKa 50.
A weaker base, such as ammonia, pKa 9.3, will not touch it, but a very strong base, such as lithium diisopropyl amide, pKa 35, will remove it.
Comment: pKa 9.3 for ammonia $\ce{NH3}$, without mentioning it is the acidity constant of ammonium $\ce{NH4+}$ , may be confusing for the OP.
Answer: To add to the existing answers, you can make the statement in your textbook more correct by adding "even":

Alcohols are very weak acids, therefore they cannot react with even strong bases.

Without that word, it was somewhat misleading, naturally leading to your question.
Answer: Your question employs the Bronsted theory, where acids are proton donors, and bases are proton acceptors.  Similar to e.g., a farmers' market with sellers and buyers, acid and base can action only in presence of the other.  pKa values are a convened scale to sort them according to the  likelihood they exchange goods (here, the theory deals with protons) in a set of parameters (temperature, solvent, ...).
Mayr's scales of nucleophilicity and electrophilicty numbers of reagents (link to the project / project's database) illustrate «trading criteria» can equally be applied elsewhere.


Remotely identify the version of a WordPress installation?

Question: How does DD32's tool determine the WordPress version of an installation. Its not working fine for WP 3.1 but it doesn't uses meta generator tag or the readme.txt of WP. So what else can it be?
Comment: You could try reverse engineering it, just have it check your own site and watch the HTTP requests it generates.
Answer: This is a bit of code I wrote a while back to do WP version detection in the most obvious ways: http://ottodestruct.com/class-wp-detection.phps
There are other methods, more subtle and less obvious. His method is file fingerprinting. Basically checking for whether certain files exist or not.
Answer: I'm just assuming here but this is usually done by fingerprinting for specific version files/directory's/code and sometimes even size.
For example you can remove all the meta versions tags ( isn't there like 12 places) and .txt file for 3.1 but since 3.1 is the only version to include the following new file by default, it is rather easy to fingerprint.
wp-includes/js/l10n.js

Since each release has many new additions, if you spend enough time writing a smart bot, it not very hard to find release specific data. Hiding all this info would be a lot of work for every release.
Comment: What do you mean by 12 meta version tags?
Comment: Sorry I should make that more clear. The meta version tag is inserted in several places, for instance you can get rid of it on the default header of your blog, but it shows up elsewhere. That's why you use a global "get rid of it" filter instead of just commenting out the html header output. That number is probably exaggerated though. For instance look at Otto's script below.
Comment: I got your point but +1 for Simon's question
Answer: I know there's already been an accepted answer, but just throwing this out there. The way I do it is parse out the $wp_version variable from your blog dir's 'wp-includes/version.php' file:
function get_wp_version() {
 $versionFile = ABS_PATH.'/wp-includes/version.php'
 // NO VERSION FILE //
 if (($versionStr = @file_get_contents($versionFile))=='') return '';

 $regex = "wp_version.*'(?<wpVersion>.*)'";
 if (preg_match('/'.$regex.'/', $versionStr, $matches)) {
  return $matches['wpVersion'];
 }
 return '';
}

Comment: Nice but I can bump it up & if I run the latest version, I shouldn't have any problem.
Comment: Moreover you should be executing on the same server for this to work. Didn't notice that before. lol


How important is a lack of secrecy in judgments of wrong doing?

Question: How important is a lack of secrecy in judgments of wrong doing? Obviously, no-one should be found guilty of a crime and punished for it, without being informed and making their case. What about e.g. 'infidelity': is my wife permitted to decide I have cheated on her, without telling me? What if she then sets out to destroy my life, based on false accusations: how in turn shall we judge her?
Comment: ***is my wife permitted to decide I have cheated on her, without telling me?*** - How can you not permit someone to decide something, regardless if they tell you about it or not?
Comment: @Whysoserious do you mean morally? i suppose if she does not act on it, then you have a case. but my wife is impulsive as well as a gossip, and likes to humiliate others
Comment: it's not a great question, but i am mildly pleased that the answer agreed with my intuition, thanks @Whysoserious
Answer: Secrecy is not inherently immoral, but it can be very dangerous and harmful if it is used to conceal wrongdoing or to manipulate others. Secrecy can also erode trust and intimacy in relationships, and create a sense of alienation and resentment.
Lying, on the other hand, is always immoral, according to my view.
Therefore, I would argue that a lack of secrecy is very important in judgments of wrongdoing, because it allows us to confront the reality of our situation and take responsibility for our actions. I would also argue that honesty is a virtue that we should cultivate, as it helps us to align ourselves with the truth and the good.
As for your example of infidelity, I would say that your wife has no right to decide that you have cheated on her without telling you or giving you a chance to explain yourself. That would be unfair and unjust. She would also be wrong to set out to destroy your life based on false accusations. That would be cruel and malicious. She would be violating your rights and dignity as a human being, and she would be acting immorally.
However, I would also ask you to reflect on why your wife might suspect you of cheating on her. Is there something in your behaviour or communication that might have given her that impression? Have you been honest and faithful to her? Have you shown her respect and love? Have you neglected or taken her for granted? Have you tried to understand her feelings and needs? These are some questions that you might want to ask yourself before you judge her too harshly.
Comment: haha that's a good answer. yeah i'm not a great husband