How to generate a hash of an RDF graph using SPARQL?

Question: I have an RDF ontology in a triplestore that users can make changes to. I want to increment/alter the ontology version with each change. One way to do it would be to use a hash of the ontology graph as the version. For that I need to calculate a hash of the RDF graph using SPARQL, as that is the only available API.
Comment: I would be interested in hearing how well this approach worked in practice. You don't need to bump the version if someone only fixed a typo in a comment, and you don't know how big the change was just from a differing hash.
Comment: I refactored the query below into an update that hashes all ontology terms and sets the `owl:versionInfo` to that value. I tried https://dydra.com as well as Fuseki and on a small dataset (20000 triples) it was really quick. Haven't tried scaling it beyond that as I'm considering an alternative approach which would not require hashing.
Answer: I realized this can be addressed in 2 steps:

generating a stable serialization of the graph (e.g. N-Triples with a stable ordering) using SPARQL
applying one of the SPARQL hash functions to get the actual hash value

Following suggestions on Twitter, I came up with this query that seems to generate valid N-Triples:
SELECT  (GROUP_CONCAT(?tripleStr ; separator=' \n') AS ?nTriples)
WHERE
  { ?s  ?p  ?o
    BIND(if(isURI(?s), concat("<", str(?s), ">"), concat("_:", str(?s))) AS ?sStr)
    BIND(concat("<", str(?p), ">") AS ?pStr)
    BIND(if(isURI(?o), concat("<", str(?o), ">"), if(isBlank(?o), concat("_:", str(?o)), concat("\"", str(?o), "\"", if(( lang(?o) != "" ), concat("@", str(lang(?o))), concat("^^<", str(datatype(?o)), ">"))))) AS ?oStr)
    BIND(concat(?sStr, " ", ?pStr, " ", ?oStr, " .") AS ?tripleStr)
  }
ORDER BY ?s ?p ?o datatype(?o) lcase(lang(?o))

Please do give it a try and report bugs, if any. The approach could be easily extended to N-Quads. As was pointed out on Twitter, it will not scale to large datasets.
Now, getting the actual hash of the graph is as easy as changing the SELECT criteria to:
SELECT (SHA1(GROUP_CONCAT(?tripleStr; separator=" \n")) AS ?graphHash)

Here we used the SHA1 hash function.
Comment: Sure, then there's no ambiguity, or if blank nodes are skolemized.
Comment: Blank Node labels are implementation specific and can't be relied on for repeatable ordering.
Comment: @GreggKellogg right, but if we assume URIs only then this approach works?


A reference for smooth structures on R^n

Question: There is a theorem stating that there is essentially one smooth structure on $R^n$ for every n other than 4. Does anybody know where i could find the proof of this? Not so much of what happens in dimension four, where there are infinitely many, but of the uniqueness in other dimensions? Thanks!
Comment: See also the answers to http://mathoverflow.net/questions/24930/differentiable-structures-on-r3
Comment: For the high-dimensional case, a key part of the proof is the uniqueness of smooth structures on compact discs, which you get from the h-cobordism theorem.  skupers's answer gets you there.
Answer: For $n \geq 5$ , this was first proven in Stallings' The piecewise-linear structure of Euclidean space. It actually proves the PL case and applies smoothing theory. Anyway, Theorem 5.1 of it says

Let $M^n$ be a contractible differentiable manifold which is 1-connected at infinity. If $n \geq 5$, then $M$ is diffeomorphic to Euclidean space $\mathbb{R}^n$.

A related result appears in Lashof's ICM address on smoothing theory. His Corollary says

Every contractible open topological manifold is smoothable.

and he follows by remarking that this smooth structure is unique if $n \geq 5$.
For $n = 2,3$, there is Moise, but his articles may be hard to read. There are now easier proofs using Kirby-Siebenmann techniques. For $n = 2$, one can use Hatcher's The Kirby torus trick for surfaces. For $n = 3$, one can use Hamilton's The triangulation of 3-manifolds in the PL case and apply smoothing theory.
Answer: You can handle the case of $n \leq 3$ one at a time, and so the question really is about $n \geq 5$. Two important names in this regard are Kirby and Siebenmann. The Wikipedia article on the Hauptvermutung is a good place to start.
If M is an $n$-dimensional topological manifold (and $n \geq 5$), then $M$ admits a PL structure if and only if a special cohomology class, the Kirby-Siebenmann class, in $H^4(M; \mathbb{Z}_2)$ vanishes. If this class vanishes, then the different PL structures are parametrized up to concordance by $H^3(M; \mathbb{Z})$. (Note: The Wikipedia article on the Hauptvermutung assumes that $M$ is compact, but I don't believe that this is a necessary assumption.)
So what does this say about $M = \mathbb{R}^n$? Well, we already know that $\mathbb{R}^n$ has a PL structure, and since $H^3(\mathbb{R}^n; \mathbb{Z}_2)=0$, it follows that this structure is unique up to concordance. Since concordance implies diffeomorphism, and since every smooth structure gives us a PL structure, it follows that there can be only one smooth structure on $\mathbb{R}^n$ up to diffeomorphism.
Here are the main references (you can find them both here):

Kirby and Siebenmann, On the triangulation of manifolds and the Hauptvermutung.  Bull. Amer. Math. Soc.  75  1969 742--749.
Kirby and Siebenmann, Foundational essays on topological manifolds, smoothings, and triangulations. Annals of Mathematics Studies 88 (1977). (I did some MathSciNet investigating, and the relevant essays are IV and V.)

This expository article by Rudyak, which I found through Wikipedia, also seems interesting.
Finally, I learned all of this from Scorpan's wonderful book, "The Wild World of 4-Manifolds".
Answer: S. K. Donaldson and P. B. Kronheimer. The geometry of four-
manifolds. Clarendon Press, New York, 1990.
Michael Freedman and Frank Quinn. Topology of 4-manifolds.
Princeton University Press, Princeton, 1990.
These are recommended by Lee in his "Topology of Smooth Manifolds"
Edwin E. Moise. Geometric Topology in Dimensions 2 and 3.
Springer-Verlag, New York, 1977.
James R. Munkres. Obstructions to the smoothing of piecewise
differentiable homeomorphisms. Annals of Math., 72:521–554,
1960.
These are also recommended by Lee as proving the R^n (except for 4) claim.
I personally have not read them, but I, for now, trust Lee's judgement.
Comment: This is not quite an answer to the question.  Only the Moise and Munkres references are to answers.
Comment: Do any of these references discuss uniqueness of smooth structures on R^n for n>4?


What impact do the frequency of password resets have on password reuse?

Question: Wondering if there's any research behind the most common password reset cycle I've seen of 90-days, and if there's any research that gives any insight into how to optimize password resets to reduce password reuse.
Comment: Duh. I read your title and wrote my answer...then read the actual sentence you wrote. Sorry, guess I missed your intent. I should RTFP. ;)
Answer: The research shows that requiring time-based password changes increases re-use (users will use a password from another site, since they've already got it memorized, or will use a near-duplicate of their previous password), decreases password complexity, and increases the odds of the password getting written down somewhere.
The answers and papers in this related question would be a good starting point for further reading, for example, the introduction and conclusion of  this one.
In short, if you want to minimize password re-use, don't require time-based password changes.  The best way I've seen to encourage unique passwords is to provide the user with a randomly-generated password at account creation, rather than letting them specify a password.
Comment: @blunders, Links added.
Comment: Please link to the "research" you're referencing, otherwise, this reads as your opinion.
Answer: I assume by "frequency of password resets" you mean password aging, that is "user must change password after X amount of time".
By itself, password aging has no impact whatsoever on password reuse. By definition, password aging simply says the user must choose a new password after a certain amount of time. The key parameters that cooperate with password aging to prevent password reuse are "password history" (how many previous passwords the system must keep track of for each account) and "minimum password age" (how long a user must wait after changing a password before they can change it again.
Here's why:
Say your system requires users to change their password every 180 days, has a password history of 6, but has no minimum password age.
This means if a user only changes passwords when the system requires him/her to, they can reuse their first password after 2.5 years (or 3 years, depends on how you count it.)
Without a minimum password age, a user could change his password, and then change it again 6 more times right away, and eventually go back to his first password.
A minimum password age policy makes this much harder. A minimum age of 24 hours means it takes a week to go through all those iterations and get back to the original password. Make the minimum age 7 days and now you are in the 1-2 month range.
Comment: You seem to be arguing that password change requirements theoretically need not affect password reuse.  If so, I believe you've missed the point of the question: in practice, do people tend to reuse passwords more if they have to generate passwords more often (because of change requirements)?
Comment: Wow, a blast from the past! I barely remember this question. You may be right, I seem to have considered the question from a purely technical control perspective. If the Q was about typical users behavior and reaction to technical controls they are presented with, I think the answer would be vague and vary quite as much as user knowledge and experience does. Considering the vastly different types of users I support, I tend to consider things with the 'least common denominator' in mind while allowing for the informed types to breeze through. Probably not helpful at all, for this Q.


Align grouped paths to other paths

Question: Is there a way to align these grouped paths to the above path? I am trying to make garment gathers on a technical drawing and just want to evenly distribute the gathers.
Answer: Make a strictly horizontal piece of your pattern and drag it into the brushes collection. Define it to be a new art brush if the pattern presents the whole length without repeating or let it be a pattern brush if you want it to be repeated.
A horizontal version of the pattern you used in your example is easy to make uniform with Illustrator's alignment and distribution tools.
The continuity of the pattern brush needs some attention if there's no gaps (spacing =0%). In the next example I flipped a drawn half to make it symmetric:

Object > Expand Appearance fixes the effect and make the stroke non-editable as stroke, it becomes a group of brush elements.
If a circular arc is wanted you can bend a horizontal pattern by applying Object > Envelope distortion > Make with warp > Arc.
Comment: Add sapace so that the symbols stay on one side of the line and the curve is the line. OTOH i would use scatter brushes for this, with 2 appearences oen scatter brus and one normal line.

Align grouped paths to other paths


In Splendor can we have more than 3 joker (gold) tokens in our hand without spending them?

Question: the situation arrived when a player had one reserved card but already 3 joker tokens and wanted to reserve another card. can he receive a gold token even if he already has 3 in his hand?
Answer: Yes, you can have more than 3 joker tokens.
In the list of things you can do on a turn, the rules say:

Reserve 1 development card and take 1 gold token (joker)

The rules later restrict when you can reserve a card:

Players may not have more than three reserved cards in hand

There is no mention of a limit on the number of jokers*. There is only a limit on the number of reserved cards in hand.
*Note that jokers do still count towards the normal 10-token limit. If you are at 10 tokens already, you can still reserve a card and take a joker, but you will then have to discard a token to get back down to 10.
Comment: Note that there is a limit on the number of tokens you can have (10), but that does not prevent you from taking additional ones. You must simply discard any excess tokens at the end of your turn.
Comment: The only time you can't draw a joker is if there are none in reserve otherwise you just draw and immediately discard back down to 10. I have confirmed in the ios app that you can get a joker or draw three tokens with 10 in your hand.
Comment: We use a house rule that you can't, because especially in a four-player game, it can be quite effective to hoard the tokens to dissuade other players from reserving cards.


What would happen to a long ruler in a strong gravitational field?

Question: So, let's say that we have an incredibly long, virtually indestructible ruler. We have advanced enough to move it wherever we want. Let's also say that we have another, identical ruler of the same length and other properties. If we put one of these rulers close to a black hole (remember, it's a really tough ruler) and another one parallel to it far away from the black hole (in empty space for our purposes), what would happen to the rulers with respect to one another? Let's say that the ruler next to the black hole is also suspended by a spaceship and is therefore not being sucked into the black hole. Would the endpoints of one ruler be closer together than the other? Would each 'tick' in the ruler in the gravitational field be closer to one another compared to the other ruler? I thought of this after reading about gravitational time dilation and I was curious about a length contraction (spacelike) analog. I am also just curious about just what happens to space in a gravitational field (using a ruler as a stand-in for space for the sake of intuition). Finally, to clarify, this is a non-charged, non-rotating black hole. Feel free to explain what would happen in these scenarios, but just a static, non-charged black hole is fine for a basic explanation.
Comment: What about the fact the black hole curves space time? And how are you measuring it? Placing another ruler beside it? Aiming lasers from outside the black hole at each end and triangulating?
Comment: Vacuum solutions are Ricci flat meaning the volume of small spacetime balls is unchanged. So when time is dilated, length is radially contracted in the exact same proportion, as observed remotely. Your question is unclear, because "*closer together*" depends on who is measuring, where, and how.
Answer: There's no length contraction in this situation. Length contraction involves setting up a coordinate system and comparing the proper length of an object to a coordinate length, but there's nothing to measure coordinate length here. The rulers are far apart and each one measures only its proper length.
A ruler suspended from above in a gravitational field will stretch, and in a stronger field it will stretch more, but as far as general relativity is concerned (ignoring everything we know about realistic properties of solids), the amount of stretching can be made arbitrarily small by increasing the Young's modulus of the material. So an idealized ruler can just measure metric distance (plus epsilon), even close to a black hole. You have to give physical meaning to the notion of metric distance somehow, and this is one way to do it.
Gravitational time dilation can be observed by having a clock lower in the field emit a light signal at its natural oscillation frequency, which is compared to the frequency of an identical clock higher up when it arrives there. You could, analogously, use the ruler close to the black hole as an antenna to emit a light signal with a wavelength proportional to its length, and measure the wavelength far from the hole. It would be redshifted and therefore larger than the proper length of the other ruler. But I don't think it's reasonable to conclude from that that the ruler near the black hole is longer. It is, in any reasonable sense, the same length as the ruler far from the hole (up to epsilon), and the redshift is due to gravitational time dilation.
Answer: Assume you measure the length of each ruler by how long it takes a photon to travel from one end to the other. Due to time dilation near the black hole, the photon (as measured far away from the black hole), would take longer to traverse the ruler. This can be interpreted as the ruler near the black hole being longer (space expanding) or equivalently as time slowing down.


How to get GRUB boot option?

Question: On my laptop Acer swift 3, I had Windows 10 and I wanted to have Ubuntu alongside. So installed Ubuntu 16.04 successfully but after restarting, automatically boot Windows 10. Boot repair via Live Ubuntu didn't help. Secure Boot disable option also not helpful.
Comment: Have not seen Acer Swift, but all other Acer have required you to set a UEFI password and enable trust on grub & shim .efi boot files.Some threads mention downgrade of UEFI, but newer ones say newest UEFI from Acer works, so make sure you have newest UEFI from Acer. http://askubuntu.com/questions/627416/acer-aspire-e15-will-not-dual-boot
Comment: Are you able to hold down the **Shift** or **Esc** key during boot up and have the GRUB menu appear?
Comment: Thanks heynnema for you answer, not the Shift and Esc did not help to appear GRUB
Answer: I have an Acer Aspire F 15 just got in the last several weeks and have dual boot with Ubuntu 16.04 and Windows 10 set up and running fine.
I don't mean to plagiarize, these directions are NOT mine but I don't remember where I got them from. They were posted on line somewhere. If I could give credit to the original author, I certainly would.
Here is how I went about setting up dual boot. I think your fix is in here somewhere. You definitely need to put a password on but also you have to tell the BIOS that your boot file is trusted. Step 35ish......
Anyway, here is what I used

Turn on the laptop and press F2 as soon as you see the "Acer Explore Beyond Limits" screen. This will take you into the UEFI/BIOS screen.
If this is the first time you have entered the UEFI/BIOS section there are some adjustments that need to be made.
Using the cursor keys highlight the menu item "Main."
Network Boot: [Disabled]
F12 Boot Menu: [Enabled]
D2D Recovery: [Enabled]
Wake on LAN: [Disabled]
SATA Mode: [AHCI Mode]
Touchpad: [Advanced]
xHCI Support: [Enabled]
Cursor over to the "Security" menu item.
Set Supervisor Password to one of your choosing.
Disable "Password on Boot."
Cursor over to the "Boot" menu item and arrange these items.
Boot Mode: [UEFI]
Secure Boot: [Enabled]
Arrange the boot devices as follows
ATPI CDROM:
HDD:
USB HDD:
USB FDD:
Network Boot - IPV4
USB CDROM:
Network Boot IPV6
Windows Boot Manager
Press F10 to Save your modifications and Exit BIOS.
Open the DVD tray and insert your LiveDVD of Ubuntu. Close the DVD tray and restart your laptop.
When you restart, if the boot order is set correctly you should boot up in Ubuntu. If not go back into the "Boot" item in the BIOS menu and make sure the laptop's DVD is at the top of the boot devices.
Select the option "Install Ubuntu alongside Windows." The installation program will divide the Windows partition. My Acer Aspire has a 500 Gigabyte HDD. The installation program divided it like so:
Files (27.2 GB) /dev/sda4(ntfs) 253 GB
Ubuntu /dev/sda5(ext4) 231 GB
Wait for Ubuntu to install. This will take awhile.
After Ubuntu is installed you will be instructed to reboot your laptop. After you select reboot you will be instructed to remove the Ubuntu DVD from the DVD ROM drive. Warning: If you think the laptop will now boot up and let you choose which OS you want to run. I am afraid you will be disappointed. The only OS recognized by the UEFI firmware at this time is Windows.
Restart the laptop as we did back in Step 1.
Use the right cursor key to highlight "Security" and use the down cursor key to highlight "Select an UEFI file as trusted for executing" and press Enter.
The "Security" window will show HDD0 in white letters. Press the Enter key.
On my laptop two items; they look like folders show up: "EFI and Temp." Highlight EFI and press Enter.
These folders are displayed: ., .., ubuntu, Microsoft, Boot, and OEM. Highlight ubuntu and press Enter.
Another set of folders are listed: ., .., shimx64.efi, grubx64.efi, and MokManager.efi. Highlight "grubx64.efi" and press Enter.
The "Add an new file" window will appear in the middle of the screen with the question: "Do you wish to add this file to allowable database?" In the "Boot Description" type in grubx64.efi and press the Enter key twice.
Press F10 to Save and Exit BIOS.
Now restart the laptop and return to the BIOS menu. Cursor over to the "Boot" item and you will see a ninth boot file added: "EFI File Boot 0: grubx64efi." If you choose to leave the boot order alone. Whenever you turn on your laptop it will boot up in Windows.
Or you can move the ""EFI File Boot 0: grubx64efi" to the eight position and boot up in Ubuntu.

For stealth reasons you can let your laptop default boot into Windows, but if you need Ubuntu when you power on the Laptop press the F12 key repeatedly until the "Boot Manager's" window opens. There should be two options.
Comment: But I wanted to install Ubuntu to specific part of hdd and choosed "Something else" when i installed it. So still it gets directly in Windows 10
Comment: @dreadsoul - Follow the steps 33 on.
Comment: Thanks CelticWarrior ))) that helped. But you know, Ubuntu is somehow working not properly. That means : When i choose Ubuntu in grub it freezes in ubuntu loading and it 4th attempt i got into ubuntu but still it working strange.
Answer: I see in your comments that you have had a hard time booting Ubuntu on your Acer Swift 3. The answer above helps you get the boot option to work, but note that Ubuntu will not boot. To see why and how to fix that, read my answer here -> Ubuntu 16.10 Acer Swift-3 multiple problems
Or I will just copy pasta it here.
The answer is simple, but first a little bit of backstory.
I too, own one of these machines, and I was famished when I found that Ubuntu would hang and would boot 1/10 percent of the time.
The reason is the following. The Acer Swift 3 firmware and the ACPI firmware in Linux 4.11 & below have a bit of a conflict...
But the solution is this! Linux kernel Devs fixed it in Kernel 4.12 and above! Ubuntu 17.10 officially comes with the latest kernel, but it will release after a few months.
so a TEMPORARY solution (not recommended by me, see below why) is to boot an Ubuntu ISO with the Mainline / unstable 4.12 or above kernel, or boot Ubuntu with acpi=off, use a separate mouse and keyboard, install the Mainline Kernels, and remove that acpi=off from the grub boot commands.
Why is this not a good solution? because Mainline kernels have many bugs and stuff, and I got harsh karma from using Mainline kernels. my new Acer Swift 3's battery total went from 100% to 98%!!! I can never charge my laptop to its full potential now! And that is to be expected in any laptop, but the reason why this is such a big problem is because the battery went down in 1 day!!
within a day, the total of my new laptop took a hit. that is why I will use Linux on MY Acer Swift 3 only once Ubuntu 18.04 releases (for stability, but 17.10 will also work) But you are free to go ahead and use risky software and kernels.
LINK for Ubuntu ISO with mainline kernel -> http://linuxiumcomau.blogspot.com/2017/06/interim-ubuntu-1704-iso-with-mainline_29.html
TIP - Install That ISO, and upgrade its Mainline kernel to the latest, or at least to 4.12, because it comes with 4.12RC7.
Or maybe try an "unstable" Ubuntu kernel, but be warned, battery life takes a hit when using these kernels, so remember to use TLP ;) Good Luck!

How to get GRUB boot option?


Alien Swarm: is the armor useless?

Question: I was told in an online game not to use armor in Alien Swarm.  Is it really useless, and if not, when is it useful?
Comment: What class do you usually play?
Comment: @badp Just starting, trying to learn them all.
Answer: I've been playing as a medic; provided the armour does reduce damage by 20%, it's saved me (and my team) from death many times.
However, if you are playing as (say) a officier, you are going to have much more hitpoints to play with and armour becomes comparatively less useful. I'd still go with electric armour, though, because getting infested really is expensive (especially on the healgun).
It depends on your class, play style and ability to swiftly move from the wrong end of a shotgun to the wrong end of a flamethrower.
Answer: As you start to progress to harder difficulties, you will ending a dedicated healer. These healing resources get depleted pretty quickly and you can only have one heal gun (unless you make someone else go healer and take one and swap when it runs out)
As a result, taking less damage is very important. It is preferred that your players are better at avoiding taking the damage of course, but if its still too much the armor never hurts.
Answer: Depends on if you're prone to taking large amounts of damage or not.
If you are, then the armor will save your medic's resources.
In short, if you take lots of damage then the armor is useful.  If you take very little damage, however, you were probably better off taking something else instead.
Answer: The armor is absolutely useless, because it's taking up a slot that could be used to carry items that prevent you from taking damage at all.

Freeze grenades (level 8) a great choice for neutralizing large
swarms, or for when you or your teammates get swarmed.
Hornet barrage (level 6) can also save your bacon if you get
surrounded, though it's not as effective as freeze grenades.
Electric armor (level 14) stuns nearby and attacking enemies, kills
parasites on contact and heals infestation, a must on parasite-heavy
maps.
Officer mines are great for defending an area.

You will never see a skilled player rolling with heavy armor, do yourself and your team a favor and pick up some freeze grenades.

Alien Swarm: is the armor useless?


Did Earnur personally think he could kill the Witch-king of Angmar?

Question: Many times he went to face the Witch-king but time after time he was stopped whether it was his horse bolting off, Glorfindel warning him against it or his Steward advising him not to listen to the Witch-king's taunts which he in the end gives in to. My question is whether Earnur thought he could genuinely dispose of the Witch-king? An enemy he had been warned against fighting against time and time again.
Answer: His motivation in meeting the Witch-king was not due to thinking he could defeat him, but rather wounded pride.  We see the first sign of this when Glorfindel warned him off:

These words many remembered; but Earnur was angry, desiring only to be avenged for his disgrace.

And we see a general description of his character:

Earnur was a man like his father in valour, but not in wisdom. He was a man of strong body and hot mood...

Then when the Witch-king issues his first challenge:

When Earnur received the crown in 2043 the King of Minas Morgul challenged him to single combat, taunting him that he had not dared to stand before him in battle in the North. For that time Mardil the Steward restrained the wrath of the king.

And finally at the Witch-king's second and last challenge:

Earnur had held the crown only seven years when the Lord of Morgul repeated his challenge, taunting the king that to the faint heart of his youth he had now added the weakness of age. Then Mardil could no longer restrain him, and he rode with a small escort of knights to the gate of Minas Morgul.

Whether he did or didn't think he could defeat the Witch-king is immaterial.  Despite the warnings-off, despite everything, it was pride, anger and lack of wisdom that led him to Minas Morgul.
All references: Lord of the Rings Appendix A.
Comment: +1... but I would add that if he tought he could avenge his wounded pride, then logically it probably means he did think he could win.
Answer: It wasn't so much that he thought he could kill the witch-king necessarily--more the unthinking/unreasoning pride and/or urge to go to battle with a foe who had taunted him.  Just as the military prefers to recruit 18-year-olds who will rush into an inferno to save their comrades without regard to their own selves and will be eager to assault a dug-in enemy position in a frenzy of self-confidence, because they really don't appreciate deep down that this can kill them.  Earnur knew he wanted to engage the enemy; how, and whether he really could pull it off, were secondary considerations.


Is the input voltage on power adapters RMS voltage or peak AC voltage?

Question: For example, would a laptop power adaptor with a voltage input of 100-240V ~ be safe to use in a country with 230V RMS wall voltage? Thanks in advance!
Answer: It's RMS voltage.  In general, AC voltage means RMS voltage.
Answer: Mains distribution system voltages are always measured in VRMS unless otherwise specified.
Laptop power-supplies are switched-mode (SMPS) type and are designed to accept 100 - 240 V AC (RMS) to facilitate use on the common international voltages of 110/120 V and 230/240 V.
Internally the voltage is rectified to generate a high voltage DC. This is then switched at high frequency, and fed through an isolating transformer to the low-voltage rectifier and filter before feeding to the load. The switcher accommodates the variation in input voltage. Note that since P = VI that the input current will have to be higher when on a low voltage supply to generate the required power output.
Other reading:

How does a cell phone charger work?.


Why do pennyauction sites force you to buy credit packages?

Question: Maybe it is not the best place to ask a question like this but I could not find a better place to ask it so here it is. You probably know about pennyauction sites like Madbid, Dealdash etc. On every site you have to buy a credit package which you can use then in bidding. My question is why can't you just deposit some money in your virtual wallet on the site and use real money for bidding instead of some credits. Is it because that way it's harder to keep count how much you really spent or there are some legal issues?
Comment: "Bids" are the main source of revenue on these sites, and, just like with all products, they give you a cheaper per-bid rate the more you buy. They also (probably) want newbies to buy a big bid package upfront (by tempting them with lower prices), instead of just buying a few bids at a time.
Answer: Its a trick so that you don't feel like you're spending money when you bid since the bids are in credits, not dollar amounts.  This is especially true when there is not direct one to one match with a dollar and credit (1 credit might actually be 3 cents)
Comment: That's what I thought also, and seeing that more people vote this answer up  I decided to accept it.
Answer: I think you should evaluate the value of these so-called "penny auction" websites very carefully.
Going to a random site, madbid .com, (which is British with UK prices, but it works just the same with US prices) they claim that someone has bought an iPod Touch 64GB for £21.18. It is £249 directly from Apple. Sold for £21.18 means there were 2118 "bids". I'd have to log in to their site to find the cost of a "bid" for packages, but you can multiply the cost of a single "bid" by 2,118, add another £21.18, and you'll know what all "bidders" trying to receive this item paid - I'll bet the total is substantially more than £249.
People taking part in these scams obviously convince themselves that they are the "clever" ones who will get an item cheaply. Apart from the possibility that a single "bidder" can easily make more bids than the value of the item, if you think you are more clever than everyone else, you are kidding yourself. (If you think you are indeed more clever than everyone else, go ahead and donate your money to these companies).
The "packages" are most likely designed to give you the false impression that you get some value for money. Years ago when I checked a single bid was £1, but in bigger packages the bids would cost say 50 pence. They also want many bidders to make sure the number of bids will be high (although there is nothing other than the website's honesty that prevents them from automatically adding bids if an item would otherwise sell too cheap).
Just to clarify: These are not auction sites. In an auction, the highest bidder pays the price they bid, usually plus some commission (on eBay, the commission is paid by the seller), and gets the goods, while everyone else keeps their money. In this "auction", every bid costs money, and by increasing the bid by one penny each time they make sure there are usually thousands of bids. (They also offer the products at a "reduced" price if you don't "win" the auction; the reduced price is substantially higher than buying from the manufacturer or any reputable retailer directly).
Comment: Thank you for your warning. You are right, I'm already aware of these things.


Wordpress: Featured image -> media library : increase media number

Question: Is there a way in Wordpress to increase the number of media items shown in featured image -> media library.
Currently it is limited to 4 media item per page... How can I increase the number of item being displayed per page ?
Answer: By default the library list 20 items per page, so seems like you already have a customization in place. Maybe you can look on the functions.php file of your theme or a plugin added to the site.


India and the Impossible Trilemma

Question: This question is in the context of the impossible trilemma. India does not have full capital convertibility on its currency. According to the trilemma, it should be able to have an independent monetary policy and a stable exchange rate. Yet, India has been forced to increase its lending rates in tandem with the Fed rate hikes, even though doing so will evidently damage its credit-fuelled economic recovery. So, we have a situation where India neither has full capital convertibility nor does it have a fully independent monetary policy. Its currency exchange rate is also not fully "stable", but "managed" or "floating". What happened here? Instead of standing on two legs after sacrificing one, how is India standing on three half-legs instead?
Answer: The trilemma states that it is impossible to have all 3 of the following: free capital flow, fixed exchange rate regime, sovereign monetary policy.
This does not mean that a country will definitely have 2 out of 3. For example, a country with a floating exchange rate regime can impose capital flows.
However, your statement that India does not have independent monetary policy is incorrect. The Indian Central Bank is just reacting to the same issues the FED is reacting to. Just because they are moving in similar directions in terms of policy, does not mean they have no freedom over their policy. They are both just freely choosing similar policies, because they are faced with similar issues (inflation).
Just because you have independent monetary policy, does not mean you are immune to economic forces that make you optimally react somehow. In fact, without independent monetary policy, India may not have been able to optimally raise rates as it is doing now, but would have to react sub-optimally, e.g. to maintain the fixed exchange rate.

India and the Impossible Trilemma


How Do I Display Additional Detail On User Hover Card

Question: I want to show the city on the hoover card in the chatter app when my users hoover over the name. Anyone know how i fix that?
Answer: What I am expecting being displayed when hovering an user is the related mini page layout. This can be customised at Customize - Users - Page Layouts. This opens a list with all existing layouts for User object. Edit the layout you want to modify. There is a link to modify the mini page layout on the top bar.

However, when I tried to open it, I noticed standard fields are not selectable fields for the layout (still wondering why).
I would suggest creating a custom formula field on User pointing to Standard City field, then selecting it to be displayed on the mini page layout. That would do the trick.
Hope it helps.


What cipher(s) can or should I use for attribute based encryption?

Question: What cipher(s) can or should I use for attribute based encryption? Can I use AES for that, or should I use some other, specific cipher(s)?
Answer: I am assuming that you are asking which encryption scheme is used to encrypt the actual data (file, stream data etc.) while using ABE. To encrypt the data, you can use any block cipher such as AES. Then, use ABE to encrypt block cipher key (AES key).
Comment: Actually, ABE is usually used in a KEM construction, where a group element is randomly chosen and encrypted with ABE. This same group element is hashed to get a key for symmetric encryption. That way, we don't have to think about the sizes of the group element or the key.


How to Migrate Memberships

Question: Our organization currently has several membership levels and has since 2014. We are moving to a single membership level and sustaining contributions instead. Is there a way, short of an Update SQL Script to move anybody with Membership A to Membership B?
Answer: A 'way' would be to export all Membership data together with Internal ID, then manipulate the data as you want, and then delete all existing member data and then doing an Import. It may feel 'safer' than in mysql since you will be able to make whatever tweaks might be required for those 'odd case' members.
Comment: You'll lose user activity that way won't you?
Comment: Which user Activity are you thinking of? Membership Renewal Activities etc? Not certain. Best to test.
Comment: The entire activity log
Comment: sorry i don't follow. why would deleting membership records (not the Contacts) affect Activities - unless you mean just membership related Activities? is this a terminology question. in Civi a contact is a contact. and a contact can have membership records.
Comment: Oh yes I guess I misunderstood, but I supposed anything membership related might stick around.

How to Migrate Memberships


Path NFA-eplison to DFA conversion

Question: Does a path (as in path graph or linear graph) NFA-epsilon have a simpler or more efficient algorithm other than the subset construction to convert to a DFA?  The only simplifications I have come up with relate to the NFA-epsilon representation, the computation of the epsilon closure, and the DFA representation.  Each NFA node can be represented as a set of symbols transitioned on, if it has an epsilon transition, and a unique reference to the following node.  The DFA representation can use shared references as it is acyclic.
Answer: Unless I misunderstood your question, in a NFA $N$ that is a path one vertex has in-degree $0$ and outdegree $1$, one vertex (possibly the same) has in-degree $1$ and out-degree $0$, and all the other vertices have in-degree $1$ and out-degree $1$.
Let $N'$ be the NFA obtained by identifying all the vertices in the same component of the (undirected version of the) subgraph induced by all the edges labelled $\varepsilon$ in $N$. All vertices of $N'$ have maximum out-degree $1$, moreover $N'$ contains no edge labelled $\epsilon$. This shows that $N'$ is a DFA. The process can be performed in linear time.
A note: when a set $S$ of vertices from $N$ is identified into a single vertex $v$ in $N'$, you will need to mark $v$ as a final state in $N'$ iff at least one the vertices in $S$ is a final state in $N$.
Comment: I now realize what I meant, but did not describe (except in the simplified representation of each NFA node) was a linear multigraph (if such a term is sensible - I mean a graph where each node is of arbitrary in and out degree other than the first and last, but all edges of a node lead to the same node) for the NFA. Marking this answer as correct, and posting a new question describing the NFA as a linear multigraph.

Path NFA-eplison to DFA conversion


Where did the SIP settings go to on my LG Optimus 4X?

Question: About 3 months ago I bought my LG Optimus 4X HD (aka P-880), which shipped with Android 4.0.3. I searched the settings up and down, and was quite surprised there were no SIP settings available. I'm very sure SIP support was added to AOSP with Gingerbread, so it had to be there with ICS!
Did LG remove them from their Android installation? Is there any way to get them back?
Answer: That sip settings are hidden in "activities" below "Telefon", it took me a while to find it. Creating a SIP Account was possible but it was not stored permanently. After closing the sip settings and opening it again it's gone. Still using Vimtura Vimphone as sip dialer.
LG P880 fw v.20b, Android 4.1.2
Answer: Is the SIP functionality really gone for good from the Optimus 4X?
Actually, LG really seems to think their (European?) customers don't need SIP. Most likely official argument will be that carriers either exclude SIP usage from their mobile data plans (at least here in Germany, many do). So they removed it.
Ooops. That was only half true: They removed it from the obvious places, that is. You might not find it in the settings. But luckily, they just removed the link to the settings screen -- all the code still seems to be there!
Ah! Still available! So how to access it?
I found it more accidentally while playing with Apex Launcher. Long pressing on a free space on one of the home screens, like you want to add a widget, opens the expected menu. Select "Shortcuts" here. On top of the next screen you'll find an item called "Activities", which I long ignored -- unfortunately! But after a very interesting chat session with Dan on broadcasts versus intents versus activities, I had to dig into this. And found that:

activities of the phone app (click images for larger variants)
The top entry in the first screenshot clearly reads Sip Settings -- so I added that shortcut to my homescreen. And what should I say? Yesss! It's the long missed settings screen, from where you can configure your SIP accounts (and define whether you want the device to listen for incoming SIP calls)!
So if you miss something that should be there, this might be a place to look for it. Besides, as reputated users as ASE we're always told to watch out for hidden gems in new places -- so you might want to look further:

list of apps with activities (click image for larger variant)
You see, other apps have also activities they made freely available (they might have even more which are kind of "private" to them). The numbers to the right tell you how much activities the corresponding app has made "public". Try them out! You surely will encounter the one or other force-close when you try to start such an activity (as it might expect parameters), but it cannot hurt. You might find other interesting things!
Are there other ways to discover/call such activities?
Sure, Apex is not the only one. There are other apps available on the playstore which let you explore available activities, such as e.g. Package Explorer or Stanley. And you also can use e.g. Tasker to start your discovered activities.
Besides: With that, most of the "shortcut-apps" available on the playstore you won't need any longer this way. Just inspect the Settings app, which seems to declare each and every page it has -- so you can directly jump there from your newly created shortcut!
Does this apply to the Optimus 4X only?
For sure not! This functionality should be available on any device. I just cannot promise you to find the SIP settings on all of them. Or anything else you've seen in above screenshots :)


Why does video rendering begin at the top left corner of the screen?

Question: Why is the top left corner of the screen considered to be (0,0) and not the bottom left like in a graph?
Comment: Welcome user10646 :) Please start with the tour: http://video.stackexchange.com/tour and please add the software you are using to the question, because **not every rendering software starts at the top left corner**.
Comment: Cinema 4D starts from the center and spirals outwards unless you change the default behavior.
Answer: Probably because TV and CRTs scanned from the top left.  Video cards store the screen buffer in this order, too, so scan-out from the screen buffer in left-to-right, top-to-bottom reads sequentially increasing memory addresses.  Addressing video RAM as a 2-dimensional array
extern int32_t screenbuf[480][640];
screenbuf[0][0] = RED;
would modify the top-left pixel.  My theory is that this led to graphics APIs using coordinate systems with 0,0 at the top left, even device-independent APIs (not 640x480 or whatever), because that choice mirrors direct addressing of video RAM.  (and saves one subtraction every time a Y coordinate has to get mapped to a memory address.)
As some comment point out, not ALL graphical coordinate systems have the origin at the top left, but it is extremely common for graphics APIs as well as UIs, and for example window coordinates in the X Window System.
Comment: There is no real reason, it only depends on the preference of the programmer, because it is mathematically irrelevant calculating the pixel first on the top, bottom, left or right.
Comment: I had another think about the TV/CRT thing, and realized that video cards scan out in sequential memory order, so video RAM layout matches the 0,0 = top left convention.
Comment: Interesting - I assume it's because of consistency and optimisation. Certainly that's real time dependend, but that's my guess...
Comment: Yeah, designing the graphics hardware to only need to fetch sequential memory addresses to feed the RAMDAC is an optimization.


web applications available for testing?

Question: Is there any way to get hands-on experience with Web Application testing while not working as a tester? Are there any initiatives where people post their production and real-world apps for people to test them?
Comment: Install any open source web application on a local box and attack it? Most open source projects will be appreciative of security reports, but do check how they prefer to receive these, especially if you find anything particularly serious.
Comment: What you are asking for is "bug bounties". Many companies have them.
Comment: You can also mine the entirety of GitHub.
Answer: If you're talking about "real-world" applications to test, then like schroeder mentioned, bug bounties are your best bet. But then, while companies have them, there are a few online platforms where you can find a bunch. Examples -

BugCrowd
HackerOne
The Internet Bug Bounty Program

You register with these platforms and more or less just start pentesting live websites like Uber, Netflix etc (make sure to follow their terms and conditions!). These are just the tip of the iceberg. Many companies provide their own bug bounty programs, competitions and so on. Beyond these, well, you could always install instances of buggy applications (WebGoat etc) and practice more.
Answer: You can also try some of the competitions where real web applications are put up for candidates.
I personally started with https://ctf365.com/.
There are more such challenges in the below question
What "hacking" competitions/challenges exist?

web applications available for testing?


How many different formulations of QM currently exist?

Question: I read some while ago that, currently, eleven different formulations of quantum mechanics exist. Is this correct / accurate? If yes, can someone provide a pointer(s) (i.e. link(s)) to the various formulations?
Comment: It makes no sense to count "different formulations of QM". It's adding apples to oranges, as well as seeds from the oranges and apples, plus some boxes of oranges and trucks used to move the apples. It's not a well-defined scientific question. Only a person who isn't thinking about the world scientifically may ask questions of this sort. There are different interpretations but they don't really differ physically as long as they're correct: Copenhagen, Consistent Histories, ... There are wrong "interpretations" such as the Bohm interpretation and tons of others in uncountable crackpot papers.
Comment: It makes no sense to attribute a number to these wrong attempts to "revolutionize" quantum mechanics - there are thousands of nonsensical papers and each of them is a bit different than another, so you could count each of them as a separate "formulation". Aside from (mostly nonsensical) "interpretations" of QM, there are also meaningful ways to organize the equations of QM. Schrodinger picture, Heisenberg picture, Dirac interaction picture, Feynman's path integral are the 4 most important ones, related in many ways. But to say there are 4 is still a stretch. They're not well-separated objects.
Comment: If the formulations are formulations of the 'same' thing, then they must be equivalent (mathematically). So, up to equivalence there is only one formulation.
Comment: Do you mean different mathematical formulations or different conceptual formulations? (A "conceptual formulation of QM" would be a wall of words telling you how to think about the mathematics as physics.) Either way, there is no standard list of "eleven different formulations". Whether you end up with eleven will depend on what you include, and even on whether you count certain versions as different. Please tell us where you read this, it will help us to understand what you're talking about.
Comment: The paper Ron Maimon found looks like the source of the "11 formulations" because it lists 9+2.
Comment: Content-wise they are same but forms differ and it is meaningful to talk about them separately. In some cases interaction picture is more suitable than others, in some other cases path integral is the most suitable. One should not pretend that it is meaningless to discuss them separately. In that case, you would never have heard all these different names, would you?
Comment: sb1, was that a comment of my comment? I don't disagree with you, i was just giving a possible short answer. It depends on how you want to count, so up to equivalence there is one formulation.
Answer: The mathematical formulation of QM, as defined by Dirac, is a closed thing--- there is always a Hilbert space of states, and operators which act on the Hilbert space to produce physical changes. This mathematical scheme, however, is very general, and when you write down the description of specific quantum systems, you have to make some assumptions about the Hilbert space structure and the form of the linear operators. There are general classes of systems which are best defined in different formal schemes, I suppose that these formalisms are the quantum mechanical formulations you are talking about.
The historical formulations of quantum mechanics were matrix mechanics and wave mechanics, which are two pictures of the same mathematical structure. The two are unified and contained in Dirac's transformation theory formalism, which is what people learn today as "Quantum mechanics." This formulation includes all the others in a certain sense, because it defines quantum mechanics.
The path-integral formulation came later, and it is also mostly equivalent to the ordinary formulation, but as it is generally presented, it makes the extra assumption that the Hamiltonian is quadratic in the momentum, so that the Lagrangian can be expressed simply in terms of the trajectory. This assumption is not absolutely necessary, but it is mathematically convenient, and it is correct for nearly all applications, and when it is not, like the string world-sheet action in Nambu-Goto form, it can often be made correct using auxiliary variables. The path integral makes unitarity nontrivial, it is trivial in Dirac's formulation.
The path integral links quantum systems to non-quantum systems by analytic continuation, and this is surprising when looking at the pure Dirac formalism, so the path integral should count as a second formulation, truly different from Dirac's. The path integral formulation produces a natural description of gauge theories, which is very inconvenient in Dirac form.
The third formulation is more recent, and this is the PT-symmetric quantum mechanics. In abstract terms, PT symmetric QM is again just ordinary Dirac QM, just as path-integral QM is also Dirac QM. But it should count as a new formulation, because the metric on Hilbert space is defined dynamically, from the Hamiltonian, and you would never find it starting with a naive metric. The naive metric on Hilbert space makes the Hamiltonian seem to be non-Hermitian, and to verify that there is a Hermitian Hamiltonian requires work.
This formulation is only about 10 years old, and is very actively studied, but I think it is probably the most fundamental formulation, considering.

Dirac QM
Path integral
PT-symmetric QM

You also could formulate PT symmetric QM as a path integral, maybe you would count this as a fourth. But this gives three options. In addition, you can choose to formulate each of these as either acting on the Hilbert space of states, or on the space of all density matrices

States
Density matrices

The density matrix formulation is arguably more fundamental. It subsumes the formulation in terms of Wigner functions. So this is a choice of two options. Multiplying gives 6.
Different theories
There are different theories which are closely related to QM, which are generally not viable. These are most of the objective collapse theories, or nonlinear state evolution theories. But one deformation of quantum mechanics at least, is not ruled out by anything except theoretical principles, and this is the superoperator formulation

Superoperator formulation

The superoperator formulation generalizes the notion of Hamiltonian to the most general operator on the density matrix, rather than the state-vector. This formulation allows for a description of instantaneous decoherence, and it is developed in the 1970s in an obscure book which I read a long time ago, and whose author escapes me (I am sorry, it doesn't google for me).
Hawking also advocated a direct density matrix formulation as part of his program of information loss in black holes, but I don't think he cited the earlier book I am talking about (probably because he wasn't aware of it--- I stumbled across it in a library years ago). The name "superoperator" is not standard--- it is the name given in quantum information theory to the operator which multiplies the density matrix to give its time evolution. This is the quantum analog of the Fokker-Planck equation.
Here is a refernce with "nine formulations", with somewhat different ideas of what constitutes a formulation: http://www-physique.u-strasbg.fr/cours/l3/divers/meca_q_hervieux/Articles/Nine_form.pdf
Comment: Sorry, this is just a collection of random thoughts and concepts whose degree of validity and whose purpose in science is so completely different that I have to give it -1 for "complete mess".
Comment: @lubos: This is a collection of all valid formulations of QM that I am aware of. The superoperator formalism is the only one that isn't standard, and I can describe it in detail--- it is used in quantum information theory, and Hawking proposed it as a precise version of information loss. It certainly isn't fundamental--- there is no information loss, but it is certainly interesting in itself and has applications as a replacement for Caldera-Leggett decoherence formalism which is nonlocal in time and inaccurate for dense electronic systems.
Comment: @lubos is the paper linked in the answer a "mess"?
Comment: +1 I like this answer, especially with the link to the paper.
Comment: I think there is nothing in your answer that deserves a -1 in any way! A +1 from me.


How to set the stroke of the embedded image in Inkscape?

Question: I just need to highlight embedded images on a white background, so I tried to set the stroke of the embedded images, but the Fill And Stroke option does nothing. How can I achieve this for a group of many images when drawing a rectangle manually around each of them takes too much time?
Answer: If the embedded image is a raster image then you can't.  Fill and stroke attributes can only be applied to vector objects.
A possible workaround is to apply an outline filter to the raster images.

Select all the raster images (holding down Shift as you click each image will allow you to make a multiple selection)
Do Filters > Morphology > Outline - adjust the sliders, choose a colour etc. Note: if changing the colour, you may need to deselect the preview and re-enable it for the preview to refresh.

Example

Note also that the filter can be copied just like other style attributes. So, if you've applied it to one image, you can do Edit > Copy, then select another image and do Edit > Paste Style to apply the same filter.
Answer: Two more options:

Pattern:

Select the image,
do Object > Pattern > Convert to pattern,
and apply the stroke afterwards.

The object will now be filled with a repeating pattern, but as long as you don't change the object's size or move the pattern handles, you won't see that.

Additional Rectangle:

Select the image,
copy it to the clipboard.
Draw an arbitrary rectangle (without a stroke).
Edit > Paste Size > Paste Size (of the image to the rectangle).
Set a stroke on the rectangle,
and make it twice as wide as the border you need.
Select both rectangle and image.
Align them with Ctrl+Alt+keypad 5.
Comment: The use of a pattern is a really nice idea. I'd never have thought of that! +1


Disable Modern UI on SharePoint on-premise

Question: How can we disable Modern view completely on SharePoint 2019 On-Premise?
Answer: Pelase run the following PowerShell command to disable Modern experience view in the SharePoint 2019.
<code>#Site Collection Level
Add-PSSnapin microsoft.sharepoint.powershell -ea 0
$site = Get-SPSite http://sp19:81/sites/sitename/

#Disable modern Lists and libraries at the Site Collection Level
$featureguid = new-object System.Guid "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4"
$site.Features.Add($featureguid, $true)

#Re-enable the modern experience at the site collection Level.
$featureguid = new-object System.Guid "E3540C7D-6BEA-403C-A224-1A12EAFEE4C4"
$site.Features.Remove($featureguid, $true)
</code>

Refernence:

How to disable the modern experience in SharePoint 2019


Are passwords generated from sine vulnerable to certain attacks?

Question: A friend mentioned that he used the sine of a number, i.e. sind(54), to generate long passwords. This way he only has to remember sine 54 and have a calculator to get his password back. I am wondering if this is secure. It can easily generate a long password, but because the numbers are not random would it be vulnerable to some type of attack if they new the numbers were generated using sine?
Comment: @StephenTouset Correction: -90 through 90. sin(1)=sin(179).
Comment: Yes, easily. Calculate `sin(x)` for 0 through 179. Try six through twenty digits for each of them, plus try including and removing the decimal. 5,400 guesses, and I have the password. In fact, now that *you* know this, you could easily script up something to figure out his password. Worst of all is that this results in the same password for every site.
Answer: If someone knows your password creation method, the only hope you have of foiling an attack is if the method has a lot of entropy - roughly, if there are a lot of different passwords you could have with that method (it's not quite the same if some passwords are more likely than others, but it's a good heuristic). If the method is "sine of an integral number of degrees to some precision," this is a fairly weak method. Assuming it's in a base between 2 and 36 (i.e. 0-9 and a-z), and that you only use an integer number of degrees (which means an attacker need only consider integers between -90 and 90), and that the number of digits is between 1 and 15, and that it starts on a digit between 1 and 5, the number of passwords is just $180\cdot 15\cdot 5\cdot 35=472,500$. With a bit of thought, we can guess he's most likely to use base 10 or base 16, and so you just have $180\cdot 15\cdot 5\cdot 2=27,000$ passwords. More thought will reduce the number of likely passwords even further (e.g. if he's doing this for laziness, which is likely, he'll have between 8 and 15 digits starting at the first digit, for 2,880 possibilities).
If the attacker can only try passwords via a web login page, you might not need too many passwords possible to be secure; a login page can lock out the account after 10 tries or similar things that slow down a brute-force. But if an attacker can do an offline attack, it's fairly easy.
Length of a password doesn't determine the security of the password against a smart attacker; entropy does. If I have two possible passwords ("the blue moon rises over the sunny beach" and "colorless green ideas sleep furiously") which I randomly pick between, then an attacker who doesn't know my scheme might have trouble cracking them. But it's better to assume the attacker can figure out your scheme, and only consider how much randomness you inject into each individual password, and in that case my scheme only injects 1 bit despite having long passwords.
Comment: In fact, by posting this question on SE, Steve may have inadvertently reduced his friend's password security to zero (if it wasn't zero to begin with).
Comment: As a follow up to entropy. So if his password is inherently less secure because despite it's length, it's entropy or randomness is very low. So would that mean it's even weaker to a brute force attack from someone that doesn't even know it's generated with sine?
Comment: @Steve Entropy is generally computed assuming someone knows the method you use to create a password. A lot depends on the specific attacker: if they assume your password is four English words, a sine-based password is immune from cracking; if they know the method you use, it's fairly weak. There's no such thing as the strength of a password in isolation, because it depends on what the attacker knows; strength is "if they know everything but the result of your RNG when you ran it to make this password, how hard is it to crack?"
Comment: @cpast Ah, I see. I guess the scenario in my head was something like a password leak/dump where the attack has hashes of passwords. Length seems to be your main strength from a brute force attack. Would creating the password from sine weaken a hash or leak information about the password?


Solr advanced StopFilterFactory

Question: I need advanced stop words filter in Solr.
We need stopwords to be stored in db and ability to  change them by users (each user should have own stopwords). That's why I am thinking about  sending stop words
to solr from our app or connect to our db from solr and use updated stop words in custom StopFilterFactory.
Also each user will have own stopwords list which will be stored in mysql db "stopwords" table. (id, user_id, stopword).
We have next index structure. This index will store data for all users.
<code>  <field name="user_id" type="int" indexed="true" stored="true" required="true" multiValued="false" />
  <field name="tag_name" type="text_general" indexed="true" stored="true" required="false" multiValued="false"/>
  ...
  <field name="tag_description" type="text_general" indexed="true" stored="true" required="false" multiValued="false"/>
</code>
I am not sure how to achive behaviour described above but I am thinking about writing own custom StopFilterFactory which will grab stopwords from db and use different stopwords for users while indexing their documents.
What you can suggest ? Is that possible ? Am I on right way ?
Answer: I don't think that querying a DB out of Solr to fetch stopword is a good idea.
Since Solr 4.8 there' a ManagedStopFilterFactory that might be interesting for you. It provides a REST API to manage stopwords.
See this blogpost and this Jira ticket.
I'd create a small cronjob or a service that queries the DB and pushes the stopwords into Solr using the above mentioned REST API.
Providing different stopwords for each user seems like an odd approach to me,
as you need either a separate index or field for each user.

Solr advanced StopFilterFactory


Removing screws from concrete

Question: My house's basement has wood shelves that are firmly attached to the basement's concrete walls. I need to remove these shelves (because of molding issues) but my drill is not strong enough to detach the screws.
Can anyone recommend a suitable type of drill for this job. Thank you so much.
Comment: How about some pictures?  Have you considered a rotary tool with a cutoff wheel, like a Dremel?
Comment: Some masonry screws have heads compatible with hex sockets as well as more common screwdrivers.  Post a close-up picture of the screw.
Comment: Thank you. I added photos of them. Some are Phillips and are flushed against the wood. Others have a flat head and are hexagonal. Those stick out. They have been in place many years. I tried the manual method described by crip659 but they didn't budge at all
Answer: Would use a hand screwdriver with a square shank that fits the head of the screw.  Can place a wrench on the shank to give more power to turn screws out.
If screws are lag bolts, a wrench should do it.  After screws are loosen, then drill can finish the job.
Comment: Thank you for the tip. I tried but the screws didn't budge at all. I think those shelves were out in place many, many years ago.
Answer: For the first one, an appropriate sized 6-point socket, and a ratchet (wrench)
For the second one, the correct size of Phillips bit (likely a #3) and a socket to fit that bit, and a ratchet.
i.e. not a drill at all.
Depending on age and corrosion, the screws may break rather than turning. In that case, remove the remains with a cutting disk in a grinder, doing so at a time when you will be present and awake for hours afterwards, lest a spark from cutting should lurk somewhere and start a fire.
The color and application suggest that these are Tap-Con® screws directly into concrete.
Comment: Thanks so much for the detailed answer! I'll try what you described

Removing screws from concrete


How and when do I use HMAC?

Question: I was reading HMAC on wikipedia and I was confused about a few points.

Where do I use HMAC?
Why is the key part of the hash?
Even if someone successfully used a "length-extension attack", how would that be useful to the attacker?
Comment: If anyone is curious what i wanted to know was hmac is a way to sign data using a **symmetrical** key. "Its more complex then hashing the message and key together which is not secure" is a bonus.
Comment: A friend of mine runs one of the largest "crypto currency" exchanges in the world. His API requires HMAC signing of all api calls with the users Private api key( it would be the "secret" you refer to in your question), which includes the public key in the hash. This is the basic use case, as an additional layer of security for API calls. In the cryptocurrency world, his is the only platform yet to be hacked, despite millions of attempts. HMAC is useful, just make sure you know how to use it. i thought i did, but didn't and paid the price in the form of a devastating API hack.
Comment: use this one to debug https://8gwifi.org/hmacgen.jsp
Answer: A message authentication code (MAC) is produced from a message and a secret key by a MAC algorithm. An important property of a MAC is that it is impossible¹ to produce the MAC of a message and a secret key without knowing the secret key. A MAC of the same message produced by a different key looks unrelated. Even knowing the MAC of other messages does not help in computing the MAC of a new message.
An HMAC is a MAC which is based on a hash function. The basic idea is to concatenate the key and the message, and hash them together. Since it is impossible, given a cryptographic hash, to find out what it is the hash of, knowing the hash (or even a collection of such hashes) does not make it possible to find the key. The basic idea doesn't quite work out, in part because of length extension attacks, so the actual HMAC construction is a little more complicated. For more information, browse the hmac tag on Cryptography Stack Exchange, especially Why is H(k||x) not a secure MAC construction?, Is H(k||length||x) a secure MAC construction? and HMAC vs MAC functions. There are other ways to define a MAC, for example MAC algorithms based on block ciphers such as CMAC.
A MAC authenticates a message. If Alice sees a message and a MAC and knows the associated secret key, she can verify that the MAC was produced by a principal that knows the key by doing the MAC computation herself. Therefore, if a message comes with a correct MAC attached, it means this message was seen by a holder of the secret key at some point. A MAC is a signature based on a secret key, providing similar assurances to a signature scheme based on public-key cryptography such as RSA-based schemes where the signature must have been produced by a principal in possession of the private key.
For example, suppose Alice keeps her secret key to herself and only ever uses it to compute MACs of messages that she stores on a cloud server or other unreliable storage media. If she later reads back a message and sees a correct MAC attached to it, she knows that this is one of the messages that she stored in the past.
An HMAC by itself does not provide message integrity. It can be one of the components in a protocol that provides integrity. For example, suppose that Alice stores successive versions of multiple files on an unreliable media, together with their MACs. (Again we assume that only Alice knows the secret key.) If she reads back a file with a correct MAC, she knows that what she read back is some previous version of some file she stored. An attacker in control of the storage media could still return older versions of the file, or a different file. One possible way to provide storage integrity in this scenario would be to include the file name and a version number as part of the data whose MAC is computed; Alice would need to remember the latest version number of each file so as to verify that she is not given stale data. Another way to ensure integrity would be for Alice to remember the MAC of each file (but then a hash would do just as well in this particular scenario).
¹  "Impossible" as in requiring far more computing power than realistically possible.
Comment: i find this a bit unclear and lengthy, though i definitely learned a bit
Comment: Can the `hmac` code be shared? It seems confusing to me - It is a hash but can't be shared.
Comment: @R11G I don't understand your question. Do note that "it is a hash" is not a useful way to understand HMAC. HMAC is a MAC. The fact that it's based on a hash is an implementation detail. There are other MAC algorithms that have the same security properties but don't use a hash internally, for example CMAC.
Comment: @Gilles Sorry. I meant if I log HMAC in my service logs - is it a potential security flaw?
Comment: @R11G That depends what it's the HMAC of and what security guarantee you're aiming for. You can't go back from the HMAC to the input without the key. Even with the key, you can only go back by guessing the input and checking it. However, if you see the same HMAC twice, you know it has to be the same input with the same key.
Comment: Why `HMAC` does not provide message integrity? Wikipedia and other answers say it does provide message integerity and I think so. "It may be used to simultaneously verify both the data integrity and the authentication of a message, as with any MAC." --- from Wikipedia
Comment: @Rick It's a subtlety that's unfortunately often left unsaid. Suppose you receive a message and a putative HMAC of that message from an untrusted source. You calculate the HMAC of the message with the applicable key and see that the correct HMAC is equal to the putative HMAC. What does this prove? It proves that the message was signed by an entity that knows the secret key, i.e. it proves the message's authenticity. But (unless there was only ever one message signed with this particular key) you have no way to know which of the signed messages you have. So this doesn't prove integrity. [cont.]
Comment: @Rick A different scenario where the HMAC does prove integrity is if you receive the HMAC value from a _trusted_ source and the message from an untrusted source. In this case, this does prove the integrity of the message. Note that in this scenario, a hash would have worked just as well.
Answer: HMAC is a computed "signature" often sent along with some data. The HMAC is used to verify (authenticate) that the data has not been altered or replaced. Here is a metaphor:
You are going to mail a package to Sarah which contains a photograph. You expect her to open the package and view the photograph. At some point in the near future you expect her to send you back the package with that photograph in it. It's vital that she put the same photograph back in the package. You need to be absolutely sure she doesn't send you back an altered photograph even a little bit, or replace it with a different one. You've got hundreds of these packages going out daily with different photos; you'd never remember the photo in such detail that you could tell if she changed a small bit of it (like if she airbrushed a small zit off her face).
Here's what you can do: Before you send her the package, place another copy of the photograph inside a small locked box. Keep the key. Place the small locked box inside the package along with the original photograph you are mailing her. Assume she knows she is not to remove the locked box from the package. When you receive the package back from her, open it, place the photo on the table. Open the locked box, remove the copy, compare the two. If they are the same, then she has not altered the photograph (it is "authentic"). If the locked box is not in the package or your key will not open it, then assume she has done something nefarious and throw the whole package in the trash. The beauty here is that you don't need to "remember" anything about what you originally sent her; everything you need to ensure legitimacy of the photo comes back inside the package.
In the example above, the small locked box represents an HMAC. Your key is the HMAC's key. The photograph is the data you are applying the HMAC to.
The above is a round trip metaphor where only you have a key. In a different situation, let's say you often send packages to Tommy. You're worried that the nosey mail carriers might be opening your packages and replacing the photographs or changing them. You do the same thing with the locked box, except in this case, you let Tommy have a copy of the key, so that when he receives a package, he can open the locked box included and compare the photos himself. If upon receipt he finds the photos differ, his key doesn't open the box, or the box missing, he knows something is fishy.
The above metaphors describe why HMACs are needed but not so much how they work. Let's change the metaphor again to get closer to how they work:
Let's keep the mental imagery of the package with the photograph: you want to mail it, then receive it back again like before, ensuring the photo was not altered or replaced by the receiver, or during the round trip.
Before you close the package and mail it, you make a copy of the photograph. No locked box this time, instead you brush over the copy with a concoction of liquid chemicals. Only you know the recipe (key) for this mixture, and anytime you brush over a copy, you use the exact same brush strokes. The mixture will swirl and blur the copy of the photograph into something resembling modern art; let's call it an HMAC. You're not exactly sure what it will look like after it dries, but you know that if you brush any two identical photos with the same recipe and the same brush strokes, the resulting HMACs will look the same. So you place the dried HMAC into the package along with the original photograph and send it off to Sarah.
When you get the package back from Sarah, it contains what you hope is the un-altered original photograph along with what you expect is the HMAC you created and included with it. Take the photograph out of the package, copy it, and create another HMAC with that copy (apply your mixture/brush strokes). Compare the HMAC you just created with the HMAC that came back in the package. If they are identical, then you can be sure Sarah and the mail carriers did not alter the photograph.
If Sarah had altered the photo, then the HMACs will not be identical.
If Sarah had altered the HMAC, then the HMACs will not be identical.
If Sarah had altered the photo, and tried to create a new HMAC, then the HMACs will not be identical (she doesn't know your recipe).
Thus you know if the photo (data) is authentic or not, which is exactly what HMACs are used for.
Comment: Thank you. I found your "swirled painting" explanation really helpful.
Comment: (Yes, I know I'm 5 years late.) Problem appears when Sarah has multiple photographs from you. She could send you back the wrong one, and since the "key" is common, you'd quite happily accept it. Additional checks might be required, or this risk accepted. Gilles above describes this problem.
Answer: The short answer is "HMAC provides digital signatures using symmetric keys instead of PKI". Essentially, if you don't want to deal with complexities of public/private keys, root of trust and certificate chains, you can still have reliable digital signature with HMAC. HMAC relies on symmetric key cryptography and pre-shared secrets instead of private/public pairs. The downside is the same as with symmetric key cryptography in general - you now need to worry about distribution and protection of your secret keys.
Comment: Thanks, I was trying to understand what scenarios you would use an HMAC rather than a public-key digital signature scheme, this seems to be a great example of why - you don't need a PKI
Comment: Important differentiation between symmetric and asymmetric keys
Comment: @PRVS Yes that is exactly right, HMAC does not require PKI.
Comment: You mean that HMAC doesn't needs a PKI?
Answer: 1 . You use HMAC whenever you want integrity of the data maintained (and authenticity)
2 . The key is part of the HMAC. Since it is a shared secret known between 2 parties only and only they can create the HMAC and no one else. (Ensures authenticity)
3 . Length extension attacks are not possible on HMAC. MACs on the other hand simply appends key to the message, which is susceptible to it. HMAC was introduced to overcome this attack on MACs.
Comment: +1 as I was confused why just concatinate the message and the key, and what difference a key has over just concatenating it. Although I'm still confused.
Answer:
HMACS are used when you need to check two "integrity" and "authenticity". For eg: consider a scenario where you are sent a piece of data along with its hash -- you can verify the integrity of the message by recomputing the hash of the message and comparing it with the hash that you received. However, you don't know for sure if the message and the hash was sent by someone you knew/trusted. If you had resorted to using HMACS, you could recompute the HMAC using a secret key that only you and a trusted party know, and compare it with the HMAC you just received -- in effect, serving the purpose of "authenticity".
Like I mentioned earlier, the secrecy of the key ensures that the HMAC was computed by a trusted party.
HMACS are not keyed hashes. Length extension attacks are possible when you used keyed hashes, not HMACS. For further reading you might want to check out this.

[EDIT]
Answer edited to answer comment below :- "I still don't understand why the key is in the message? Do I not know the public key of the party? If I know the public key then why is the key in the message rather me using the already known key? If I don't know the key then why would i trust that party?"

The key is not "in" the message. The key is used in generating the HMAC from a message. The key used for generating HMACS is not anyones "public key". Its more like a shared secret between two parties. You could check out the REST API authentication method for AWS stuff to better understand how HMACS are used for URL-signing.

How and when do I use HMAC?


What's the keyboard shortcut for OneNote page navigation?

Question: What is the keyboard shortcut to switch between Microsoft OneNote pages?
Answer: Ctrl+PgUP for one page up
Ctrl+PgDn for one page down
Alt+PgDn for last Page
Alt+PgUP for first page
Comment: This does not work for me in OneNote 2013 - has it been changed? Edit- the 2013 shortcut guide says it should work, but it doesn't for me. I'll just have to look a bit closer.
Comment: ah, you got there first :) +1
Answer: Ctrl + Page Up/Page Down
All One Note Hotkeys
Comment: BTW, full shortcuts list can also be viewed locally in the help menu (help > keyboard shortcuts).
Answer: Make to select the proper keys:

Go to the next page in the section.
Ctrl+PgDn (Page Down)
Go to the previous page in the section.
Ctrl+PgUp (Page Up)

When I was confusing with:

Move the insertion point up in the current page, or expand the page up.
Ctrl+Alt+↑ (up arrow)
Move the insertion point down in the current page, or expand the page down.
Ctrl+Alt+↓ (down arrow)

Keyboard shortcuts in OneNote 2013


Why would a child choose to sleep on the floor?

Question: My five year-old daughter has been sleeping on the floor lately.  We've asked her why, but this is one of those situations where she's not very self-aware, and you have to probe to get to the bottom of it.  Yesterday she used the string from her tinker kit to make a "trap" around her bed.  I realize I'm probably reading too much into it, and it's probably just for fun, but it's still curious.  Any ideas what might be behind this?
Comment: Are there any monsters, wolves or other hostile organisms in the area? (in her imagination). Tinkering kit looks great BTW!
Comment: I used to do that, too... up through around 19yo.  Just found it more comfortable that the thing I was sleeping on was solid and didn't change shape. Amazing how the perception of comfort changes over time!
Comment: I too did this as a child. My abusive father criticized and shamed me for it. Thanks pops!
Comment: My daughter insisted on this several years ago (probably six or seven years ago). To this day she refuses to sleep in her bed. Very frustrating and confusing. I suspect it is OCD related to some extent. Anyway, if you can stop it please try. Otherwise, wind up several years later wondering what you should have done differently.
Comment: I used to do this as a kid. It felt cosy because I could wrap the blankets and sheets around me.
Answer:
Something's scary up there. While typically the imaginary monster is under the bed, sometimes you can trick it by sleeping somewhere else. (If I were a scary monster and couldn't find the kid I was planning to eat, I'd look on the floor next to the bed... luckily, monsters are stupid and rarely read Parenting.SE.)
Generally I'd expect/hope that she'd describe this imaginary scary thing when asked, although her building a trap makes me slightly more suspicious. Perhaps asking "what are you going to catch with that?" would lead to a clue. It's also entirely possible she just felt like it, though. (Pillow forts, e.g., aren't built to plan for warfare, they're built because they're fun.)
Change of pace. Sometimes the bed is boring and it's more fun to sleep on the floor. Alternatively, kids may shift pillows, toys, or blankets around. (I went through a phase as a child where I truly believed switching ends was the only thing that would really help me relax. I still try it occasionally when I can't sleep, despite knowing that bed-polarity is irrelevant.)
Discomfort. Sometimes my middle child likes ALL THE THINGS (extra pillow, stuffed toys, books) to be around him in bed, sometimes he flings off everything (pillow, blanket, stuffed toys) and is found in the morning curled up in the middle with a thin sheet wrapped tightly around him.
Comment: Nice answer. I used to love sleeping in other places and other positions: upside down on the bed, under the table, ....


Is there some type of DNS server amplification attack possible by querying servers for non-existent domain names?

Question: In working with Bind DNS servers, which are not open resolvers and do not perform recursive queries, I see a great mumber of incoming DNS query requests, that are denied or refused, that focus on domain names that list the DNS servers as being authoritative for the domains being queried, but are no longer configured with any zones for the domains.  These domains are attributable to third parties who have moved their domains, and years later have never updated the listed DNS servers at their registrar.  Why do these apparent DDoS UDP attacks focus on non-configured domains or zones?  I haven't measured the network traffic to see if there is some type of amplification occurring, but there is a definite focus on non-configured zones.
Comment: Bots pull down root server and zone data over a long period of time and hold on to that data for a long time.  I still get queries for domains I havent had for 15 years.  I also get MX queries for records I havent had for over a decade.  That's why I have about 50 domains with bogus MX records that rotate to random names hourly.  To answer your question, unless you are seeing gb/s of traffic, it isn't an attack.  Its poorly designed and managed bots.
Comment: This may not be an attack, per se, but more like a probe to try and find resolvers that do provide recursive lookups an that may be vulnerable to other forms of exploitation.
Comment: Yes "random qname attacks" exists. see https://indico.dns-oarc.net/event/21/contributions/283/attachments/268/488/OARC_Everyday_Attacks_final.pdf for example
Answer: We've seen similar questions from users who acquire IP space that were previously used for DNS servers. Suffice it to say that you don't even have to be listening on port 53, if your IP has ever held a DNS listener in the past (authoritative or recursive) you are going to be seeing stale queries for domains that your IP is not authoritative for.
Just ignore the stale traffic. If you need reassurance that you aren't being successfully leveraged in an attack, look at your ratio of sent to received traffic. If your average outbound traffic is more than double your input traffic, something is probably going on.


Intel Dual Band Wireless-AC 7260 issues in Ubuntu 18.04

Question: I have a laptop with with the Intel Dual Band Wireless-AC 7260 and am running Ubuntu 18.04 (although the problem existed with 17.10 and I presume this is a general problem).  At home the Wifi works well, however, on some networks it will intermittently disconnect.  Using Gnome network manager and turning the Wi-fi off and back on could fix the issue, but not always.  This could happen numerous times a day.
Comment: Thanks psiphi75, your fix is good. Works for me on Ubuntu 18.04.1 LTS. vi /etc/default/crda. Set to proper REGDOMAIN vi /etc/modprobe.d/iwlwifi.conf
Add this options iwlwifi bt_coex_active=0 swcrypto=1 11n_disable=8
Answer: After much research and reading the Kernel documentation on this, I found that making all the following changes work.
Change the wi-fi country code (thanks to this post). As root edit /etc/default/crda and set the following to your country code:
REGDOMAIN={ISO COUNTRY CODE}

Disable Bluetooth, although this is a dual-band adapter, it's not good at handling Bluetooth and wi-fi at the same time. From the Kernel documentation:

For users of these devices who have problems when Wi-Fi and Bluetooth
  are running concurrently, we suggest to disable BT Coex by loading
  iwlwifi with bt_coex_active=0 as a module parameter.

Also from the Kernel documentation also discusses that the device does not handle 2.4 Ghz noise very well and recommends the following:

- Disable Wi-Fi's power save (prevent the PCIe link to go to power save): power_save=0 module parameter for iwlmvm
- Disable USB3 in BIOS (if possible), it not, just stop using it
- Disable 40MHz on 2.4GHz: cfg80211_disable_40mhz_24ghz module parameter
- Use 5GHz band (on devices that support 5GHz operation)

In a nutshell, I did not disable USB3 in BIOS. But did the others, to implement these changes add the following line to /etc/modprobe.d/iwlwifi.conf:
options iwlwifi bt_coex_active=0 swcrypto=1 11n_disable=8

UPDATE: Thanks to @chili555, the Kernel driver page appears to be out-dated/incorrect, the power_scheme value does not exists and appears that we should use power_save=0.  Documentation updated.
A good resource for debugging the iwlwifi driver is https://support.system76.com/articles/wireless/
Comment: Please check: `modinfo iwlwifi`. I think you mean power_level or power_save. power_scheme is not an available parameter. If you mean for this parameter to apply to iwlmvm, then it needs its own conf file:`options iwlmvm power_scheme=1`
Answer: You can fix this issue temporarily by running this code (The selected Country should support Dual-band 5Ghz US/DE/...):
 # iw reg set US

or add this as a permanent solution:
echo "COUNTRY=US" > /etc/sysconfig/regdomain

And these code as check:
 # iw reg get
 # iw list


Spherical magnet inside a solenoid

Question: When passing a bar magnet through a long solenoid why is it that the induced emf when the magnet is in the middle of the solenoid is zero? And if a spherical magnet is put inside the solenoid, will the emf produced have discontinuities because occasionally the magnetic field lines are parallel to the windings of the solenoid?
Comment: Can you give reference for your claim?
Comment: Sure, http://www.physics.usyd.edu.au/~khachan/PTF/magnet_and_solenoid.pdf
Comment: Maybe this is better: http://peda.net/veraja/kuopio/lyseonlukio/kurssit/fysiikka/opetus4/valineita/solenoidi
Answer: [about a bar magnet inducing current in a solenoid as it passes through, axially]
The magnet both has a north pole, and a south pole.   At the center of the solenoid, the
symmetry of the situation means that the 'leading' north pole and the 'trailing'
south pole give rise to equal and opposite EMF.   So, it's zero for the sum.
Why would the shape of the magnet matter?
Answer: No.There will not be zero emf.
Induced current depend on the rate at which the magnetic flux through solenoid changes.
If the magnet is just placed in the middle of the solenoid then induced current in the solenoid is ofcourse zero as no magnetic flux changing through the solenoid.
But if the magnet is just momentarily is at the middle and is about to move then induced current will not be zero.
Comment: I just went through leading a bunch of undergrads through a magnet drop lab and I can assure you that the EMF drops to zero in the middle of the solenoid.
Answer: Faraday's law gives that
$$e = -\frac{\textrm{d}\phi}{\textrm{d}t}$$
With $\phi$ the flux of the magnetic field created by the magnet through the solenoid.
As one could not possibly get a higher flux than when the magnet is in the middle, $\phi$ reaches a maximum. Hence, the emf is zero when the magnet is in the middle.
I think the shape of the magnet doesn't matter.
Answer: When the magnet, spherical or rectangular, is introduced very slowly (quasi-statically) anywhere inside the solenoid and kept there at rest then there will be no emf.. as a magnet has to move to induce emf.

Spherical magnet inside a solenoid


Is there a word for someone who helps others for their own benefit?

Question: So, say you have a situation where a man helps someone else in order to forget all of his own problems in the world. Is there a word for something like that?
Edit 1: I'm asking about the man who is also doing the act.
Comment: This question lacks detail, research and a sample sentence which would help users provide the best possible answer. The way the question is currently formulated, it is only going to attract thesaurus-like answers. Please [**edit**](https://english.stackexchange.com/posts/462195/edit) your post, tell us which words you discarded and why, and supply a sentence where you would use this term.
Comment: The question title asks about "someone", then the question asks about a "situation" and if there's a word for "something like that". I'm not sure if you mean the person or the act.
Answer: In general psychological terms, it could be a form of avoidance.
The person is trying to avoid dealing with his own problems, so focuses on something else as a distraction. This distraction could be any number of things, but in this case it just happens to be helping somebody else.
From an excerpt of Developmental-Behavioral Pediatrics on the ScienceDirect website:

Avoidance can be understood as denial: it is as if the person has decided that there is no stressor, and therefore there is no need to change behavior, perception, or emotional response. In this situation, the only way the individual can deal with it is to "forget" it or distract oneself from trying to deal with it.
Answer: Would a word as simple as

distraction

fit your case? The man engages in altruistic activities in order to distract himself from his own problems.
Answer: The dictionary defines the word interested as 'influenced by personal or selfish motives' (fourth definition). More detailed information can be found here.
Answer: Egoistic altruism could be used as a term to describe this.
It is very nicely explained in the video below:
https://www.youtube.com/watch?v=rvskMHn0sqQ


Wet cloth or dirty cloth smell

Question: I have this problem with my beer and I couldn't find any answer from my friends, experts, or web pages. Following primary fermentation (1 week) I move the green beer to a food grade plastic container inside a refrigerator (25 F). Following a few days of maturation a strange smell (less in flavor) like wet cloth or dirty cloth comes up. I have found this smell in the Brooklyn's Summer Ale, in fact my beer is a summer ale (blond ale) made mostly with pale malt.
Parameters:
OG 1048
FG 1011
IBUS 20
ABV 4.9%
Answer: One thought I have is it's due to incomplete fermentation.  Cold crashing a beer after a week will not necessarily make the best beer.  Try leaving it in primary for 3 weeks and see if it improves.
Comment: Don't forget that after cold crashing a beer that was still in primary fermentation that you may need to 'awaken' the yeast to finish fermentation. Otherwise you will have an incomplete brew that didn't reach it's full ABV potential.
Answer: As Denny Conn suggests in his response, the simple answer is to leave the beer on the yeast for longer.
During the secondary fermentation stage, the yeast is still working.  part of this includes "cleaning up" some undesirable by-products of fermentation.  I would guess that it is some of these compounds you can smell.
Dropping the temperature to 25F / -4C will almost certainly make the yeast go dormant.  This means they're all falling out of solution, and not finishing the fermentation properly.
In this case, take your beer out of the refrigerator, just the movement might be enough to re-incorporate some of the yeast (do not splash, you don't want more dissolved oxygen at this stage) and leave it for a week.  If you don't want to just "leave it", then regularly take a sample until you're happy with the flavours.
It's not necessary to move the beer off the yeast as soon as primary fermentation finishes.  It's OK to not even check beers until 2 weeks have past.  If you must do it, ensure good sanitation and try to prevent any excess contact with air, as you do not want oxygen in you beer at this stage.
Further Reading:  What Happens During Secondary Fermentation

Wet cloth or dirty cloth smell


Where is the samples setting for the Cycles render

Question: Where can I adjust the amount of samples Cycles uses?
Comment: Render settings. Are you using Cycles?
Comment: Just double checking, as it has been an issue before
Comment: Why do people downvote questions like this. Yeah, you can spend 20 minutes trying to find the answer in the manual, or 10 minutes clicking through everything and guessing and checking, or you can spend 25 seconds looking it up on S.O. If it takes me 2 minutes to answer someone's question that they could answer themselves in 10, there's a substantial net time savings between me and that one person. And if a bunch of other people find the answer useful, that's a boat load of time saved. Please, folks, don't be annoyed at someone for trying to save themselves and others a little time.
Comment: @NᴏᴠɪᴄᴇIɴDɪsɢᴜɪsᴇ  He tagged Cycles.
Comment: Ok, the guy sounds frustrated, which isn't really appropriate for this kind of  Q&A reference, so I've submitted an edit to eliminate that.
Answer: You can change the number of samples for Cycles under the Sampling rollout of the Render Properties panel.  The Render spinner adjusts the number of samples used for the final render, and the Preview spinner adjusts the number of samples used for viewport rendered mode.
Comment: Thanks for your answer! I love the red marker. Did you just ms paint?