How do you write a character with goes from A to Z and back to A realistically?

Question: How do you write a character with goes from A to Z and back to A realistically? Let's say the characters is extremely in love, then wants to murder the person she was in love with and then go back to being completely in love. How do you do that realistically without resorting to cheap tricks like amnesia, magic and other similar things? I don't think this can be done realistically at all.
Comment: Does the character stop being love at the point she wants to murder? It could be a case of "we can only be together in death", i.e. murder/suicide.
Comment: Given enough time, anything will happen. If there is enough time between all of these events, anything can happen.
Comment: This is a variant of [Hero's journey](https://en.wikipedia.org/wiki/Hero%27s_journey). Hero makes a journey and then returns. In your case, it can be a real journey or just transition through different psychological states.
Answer: For Z to have value, then there is no going back to A. The path is instead

A -> Z -> B

where B is similar to A but includes the added experience from Z.
In your example, the character is madly in love, she then finds out that she has been deceived, hence the murderous anger. The love interest then shows a deep repentance, guiding MC to feel the love she felt initially. This new stage is however one in which she has more experience, the love is more 'mature', less blind, and hardened by the now confirmed trust.
On the other hand, a true path like

A -> Z -> A

tells the reader that Z was of no importance and all the time they invested in the story was merely a blip that could be reset with no consequences. This may be negatively received.
Comment: +1. I'd add that in OP's example, both the POV character and the love interest should have a character arc. It's not just that the POV character gives the love interest another chance, it's that the both of them have been affected by the journey to where they are, and the *new people that they have both become* seem compatible.
Answer: I think the question is wrong to put extreme love and murderous intent at opposite ends of a spectrum and to suggest that there is a substantial distance between them.  I think in fact that they are both expressions of intense emotional involvement with another, and you only have to read the newspapers occasionally to see how closely related murderer and victim generally are.
But therein lies a solution to OP's problem.  I'll explain:
P and Q are lovers, totally devoted to each other and, both inwardly and outwardly the epitome of extreme love.  P sleeps with R (not entirely sure why, that's something for the writer to figure out), Q finds out and flies into a murderous rage (hasn't got to actual murder yet so maybe it's really only a not-quite-murderous rage).  This is a previously-undiscovered flaw in Q's character (another hook to hang part of the plot from).  But P and Q haven't had to travel far to get from where they started to where they are now.
The journey back is likely to be a bit harder, and to take a bit longer.  Somehow P is going to have to acquire Q's forgiveness (or Q is going to have to accept that P's intense love does not entail fidelity), and Q is going to have to learn how not to fly into a murderous rage.  I don't think these emotional journeys for P and Q require any of the cheap tricks you are (rightly) keen to avoid, I think they are well within the experiences of many people.
Answer: Let's call our girl Alice, and her love interest is the naive Jack. We totally frame Jack. In her eyes, Jack is guilty as hell, over the top, she trusted Jack with her life and Jack destroyed it. Hard. It is because of Jack she lost her fortune, lost her job, even lost her parents in an accident, whatever.
But, Jack did not really do any of that. He is intentionally framed, by the real villain, Jill, a sociopath evil genius Alice was casually hooking up with, but ultimately broke up with, not because Jill was evil, but because Alice was in love with Jack.
So out of spite, Jill sets about methodically destroying Alice's life, and making sure all the blame falls on Jack. And it works.
Alice hates Jack. By mid-story Jack gets prosecuted, wrongly convicted, and Alice is happy about that. But then Jill resurfaces. She comforts Alice. And Alice accepts, they hook up, Alice and Jill are back together, and all looks like roses to Alice.
But then Jill slips up. She knows something she cannot have known about what Jack did to Alice. (We plant this secret incident early, of course). And Alice grows suspicious, she starts secretly pulling this thread, and finds Jill's fingerprints everywhere.
Alice realizes that Jill framed Jack. she was gaslighted. She secretly goes and talks to Jack, who is still in love with her. The more she looks, the more she realizes that every evil thing she thought Jack did behind her back was all Jill. Jack was just a naive patsy, conned at every turn by Jill's minions.
Alice is ashamed, but Jack is a saint, he forgives Alice. With all guilt erased, they entrap Jill. She is found out for the sociopath fraud that she is, and in the end, Jack and Alice have rebooted their love relationship.


Windows Server 2008 Sleep at night

Question: I have a Windows Server 2008 home server, that i'm going to sleep during the night. It's BIOS does not support scheduled boot. Can i use some kind of task in the Scheduled Tasks to make it sleep at 10PM and wake it again at 8AM in the morning?
Please help with this problem, I truly appreciate it
Best Regards,
Erik
Comment: You would think that the ServerFault Stack Exchange would be the place to ask questions about servers, but you're probably going to be told to ask this on SuperUser instead because it doesn't fit the community definition of "professional".
Comment: Ok, I'll try to post it there:)
Answer: You can create a shortcut to <code>%windir%\System32\rundll32.exe powrprof.dll,SetSuspendState 0,1,0</code> which will put your computer to sleep. Add that to your Task Scheduler to automate your sleep time.
This tutorial explains how to create a scheduled task to wake from sleep. You'll need to make sure that wake timers are enabled.
I know that these work on desktop, their usefulness on a server is not something I've tested.

Windows Server 2008 Sleep at night


How to calculate $E_b/N_0$ for a 8-PSK?

Question: How to calculate $E_b/N_0$ for a 8PSK? My BER is given. But I don't understand how to calculate $E_b/N_0$ as it is inside a Q function.
Comment: Your question is not very clear. Are you saying that you have $$\text{BER} = \beta \text{Q}\left( \sqrt{\alpha \frac{E_b}{N_0} } \right),$$ where you know BER, $\alpha$, and $\beta$, and you want to find $E_b/N_0$? If that is the case, you're looking for Matlab's `qfuncinv` (or similar in other packages).
Comment: I have added an image, in the slide I don't understand how to calculate Eb/N0
Answer: Assuming that you have the correct formula for the BER (which is probably based on the assumption that a Gray code is used), then - as mentioned by MBaz in a comment - you would have to invert the $Q$ function, which is a problem for which no analytic solution exists. You can use numerical methods implemented in Matlab and probably in other software packages, but you can also just estimate the required value of $E_b/N_0$ from a graph of the bit error rate. I would assume that the latter is what you're supposed to do if that's a homework problem.
Simple approximations (actually bounds) of the $Q$ functions exist, but inverting them will very likely result in very inaccurate estimates of $E_b/N_0$.
Comment: Thanks for the reply, but I am not sure how to invert the Q function?
Comment: @Cynthia: That's what I tried to explain in my answer, you can't do it analytically. You can use some package (such as Matlab) that does it numerically, or you just estimate it from the graph.
Answer: The Q function is simply the tail probability for a standard normal distribution (i.e. zero-mean, unit variance Gaussian), defined as:
$$
Q(x) = 1 - \Phi(x),
$$
where $\Phi(x)$ is the cumulative distribution function (CDF) for a standard normal.
The function $1 - \text{CDF}$, for any distribution, is sometimes referred to as the "complementary cumulative distribution function" (CCDF) or the "survival function" (SF). What we are trying to find is a way of evaluating $Q^{-1}(x)$, the inverse survival function (ISF) for the standard normal distribution.
If you don't have access to MATLAB but have a copy of Python/SciPy installed (free), you can use the function norm.isf in the scipy.stats module, documentation found here.  This function is the inverse survival function for the normal distribution.
EDIT:
Try It Online!

How to calculate $E_b/N_0$ for a 8-PSK?


what would happen to flowing electrons in a vacuum if they are not giving any exit point?

Question: Lets say theoretically electron flow is captured in a vacuum and not allowed to exit then where would they go? I do not want to know the practical impossibilities of it. And also what would happen if that vacuum was in a glass container?
Comment: The electrons will repel each other and scatter towards the edges of the box, so the shape of the edges will influence their distribution. If the box was metallic the current of electrons would create induced currents that slow down the flow of electrons.
Comment: You should clarify your question a bit. Do you mean an infinite vacuum or inside of a box ? If it is a box, the awnser depends on its shape and the material the walls are made of. Also, are your electrons at rest initially or not ?
Comment: No they are not at rest. And how would the shape matter ? lets assume the material to be glass
Comment: That's called space charge and it can do all kinds of nasty stuff. In experiments one usually tries to avoid it, which is pretty hard, actually... so your assumption that it is something hard to make is pretty much the opposite of reality... if you have a vacuum and any kind of electrical activity, you usually have a space charge problem.
Answer: That's essentially what particle accelerators are doing (even a symple cyclotron). You need magnetic field to curve the path of a moving electron into a circle.
Of course, once the electron is allowed to touch the surface, it's over. So you need to keep it in there. Yes, electrons feel repulsive forces, but moving electron beams also produce magnetic fields and self-focus (they attract laterally) - this is called plasma pinch and is what makes the lightning bolt so narrow and concentrated. When you have a lot of electrons stored in a vacuum ring (or a Tokamak, if you're building a fusion reactor -- although, plasma also contains positive ions, so at least repulsive forces aren't that big of a problem), they themselves are creating a lot of complex electrogmanetic field, and adaptive control is a good idea to keep things confined.
Comment: @user104591: Electrons will sit on insulator surfaces and move around in electric field, producing very hard to control electric fields themselves. That's why it's a bad idea to have perfect insulators in vacuum. One will usually try to make the surfaces semiconducting, so that any charges on them can flow to either ground or a specific potential (like a positive getter electrode).
Comment: what happens when they touch the non metallic or insulator surface?
Answer: The old style tv tubes with an electron gun and a phosphorescent screen had to have a conducting path from the screen to earth to prevent the build up of negative charge on the screen.  If this was not done a reduction of picture brightness would result. Even with this return path for the electrons charges did accumulate on the screen with the result that dust particles were attracted to the outside of the screen.


Content search web part is not displaying any result

Question: I'm using business version of office 365 sharepoint 2016. The content search web part is not displaying any results.
I want the content search web part to pull the result from the list library on the same page. The only thing I see is the label "Content Search" on my page. Please suggest as to what I need to do.
Thanks in advance!
Answer: Please Go through with this link
Create a search scope and give URL for your specific document library only in the rule.
Update: you need to create a Results Source and configure query to search in particular library only and configure your Search Results Web Part to use your Results Source.
For More and clear Help


What is the best method to determine file size resource usage in SenseNet?

Question: In order to charge appropriately for resource usage, i.e. database storage, we need to know the size of our client's files. Is there a simple way to calculate the resource usage for client's Workspace?
Answer: If you just want to know the size of the files in the workspace, you can use the funciton below, although total resource usage is likely much higher.
Calculate file size -- useful, but not close to total storage.
public static int DocumentFileSizeMB(string path)
{
    var size = 0;

    var results = ContentQuery.Query(SafeQueries.TypeInTree, null, "File", path);
    if (results != null && results.Count > 0)
    {
        var longsize = results.Nodes.Sum(n => n.GetFullSize());
        size = (int)(longsize / 1000000);
    }

    return size;
}

To get a better idea of storage space resources, call the SenseNet function GetTreeSize() on a node. However, this doesn't give the full resource usage due to other content that is related to the node size calcuation, but not stored beneath the node, such as Index tables, Log entries, etc.
A better method, but still not the full resource usage.
public static int NodeStorageSizeMB(string path)
{
    var size = 0;

    var node = Node.LoadNode(path);
    if (node != null)
    {
        size = (int)(node.GetTreeSize() / 1000000); // Use 10**6 as Mega, not 1024*1024, which is "mebibyte".
    }

    return size;
}


Current in a purely inductive circuit

Question: To maintain the current in the purely inductive circuit why is the applied alternating voltage is equal and opposite to the induced e.m.f in an inductor .
I'm unable to understand this point
Why isn't the net e.m.f of the circuit becomes zero
What is meant by to maintain the flow of current in the circuit
In what conditions the current will flow or not
Answer: The alternating current will flow as long as you have your voltage source connected. If it is really a (theoretical) ideal inductor, you will not spend energy.
but maybe i did not understand your question and you try to make it more clear.
Answer: The electrical-mechanical analogies are useful to understand this type of doubts.
A pure inductive circuit is like a mass. An external voltage is like a force.
Applying an oscillation voltage is like push and pull an object on a surface without friction. (Friction is the equivalent to electric resistance, and we are considering pure inductive circuit, without resistance).
The fact that there is no friction doesn't mean that an oscillatory force is not present. The force produces acceleration, what for an electrical circuit translates as: oscillatory voltage produces oscillatory current.
That is more here than the other analogies with water circuits, because this mechanical systems are described by the same types of differential equations of the electric circuits.

Current in a purely inductive circuit


Automatic URL rewrite after deleting a product

Question: Is there any way in magento to make an automatic url rewrite to the category of the product, after deleting that product?
Answer: i think you should try reindexing
goto terminal cd /opt/lampp/htdocs/magento/shell
then type
/opt/lampp/bin/php   indexer.php reindexall

OR
you can do it from the backend
system->indexmanagement

Comment: Thanks for your reply, but I tried reindexing that only makes an url rewrite if the url of the product changes.


How can I use my Android 5.1 phone as an external USB Speaker?

Question: I have a rooted android 5.1 phone and a Acer Apsire 7520 running windows Xp. Can I use the phone as a USB speaker. The laptop doesn't have an audio out or speaker (doesn't work). It does have WiFi and USB connection. But I prefer using USB instead of WiFi.
Answer: This android app should actually do this for you seeing that you have WiFi. Soundwire Install the windows program downloadable from their website run it and set what audio you want to output to your phone you'll be assigned a server address. Input this into your app on your phone and your golden.
Comment: I like your idea, but I have tried it and found it doesn't run parallel to the incoming sound. In other words sort of incompatible.


Verify that the electrostatic potential satisfies the Poisson equation

Question: I'm reading Sect1.7 of Jackson's classical electrodynamics but I have trouble following his argument. Could someone help explain how exactly the Laplacian is evaluated in 1.30? Is it calculated with respect to the spherical coordinate? If so, where did the $\theta, \phi$ terms go? And why "it has a volume integral equal to 4$\pi$ for arbitrary a"? Also, I'd really appreciate it if someone could help me walk through the taylor expansion and the integration.
Comment: I suspect that if you're having troubles with these aspects of the text, you may be a bit over your head continuing onwards. You may want to consider shoring up your vector calculus before proceeding further in the text.
Answer: FWIW,
$$\lim_{\varepsilon\to0^+}\frac{3}{4\pi}\frac{\varepsilon}{(r^2+\varepsilon)^{5/2}}~=~\delta^3(\vec{r})$$
is a well-known representation of the 3D Dirac delta distribution. It is straightforward to derive using test functions, cf. e.g. my related Phys.SE answer here.
Answer: The Laplacian is 1.30 is calculated in spherical coordinates. In the absence of $\theta, \phi$ dependence, the Laplacian is just $ \frac{1}{r} \frac{\partial^{2}}{\partial r^{2}}r$ and this does evaluate to the result given.
The volume integral is $4\pi$ because there is no $\theta, \phi$ dependence in the integrand and hence $\int_{0}^{2\pi} \int_{0}^{\pi}\sin(\theta)\, d\theta\, d\phi = 4\pi$.
Answer: The expression for $\nabla^2 f$ in spherical polar coordinates is
$$ \begin{equation}
\frac{1}{r^{2}} \frac{\partial}{\partial r}\left(r^{2} \frac{\partial}{\partial r}f\right)+\frac{1}{r^{2} \sin ^{2} \phi} \frac{\partial^{2}}{\partial \theta^{2}}f+\frac{1}{r^{2} \sin \phi} \frac{\partial}{\partial \phi}\left(\sin \phi \frac{\partial}{\partial \phi}f\right)
\end{equation}$$
If $f(r)$ depends only on the radius, as is true for the bracketed term in (1.30), then this reduces to
$$ \frac{1}{r^{2}} \frac{\partial}{\partial r}\left(r^{2} \frac{\partial}{\partial r}f(r)\right) $$
since partial derivatives of $f$ with respect to variables upon which $f$ does not depend vanish. In this case
$$\frac{1}{r^{2}} \frac{\partial}{\partial r}\left(r^{2} \frac{\partial}{\partial r}\frac{1}{\sqrt{r^2 + a^2}}\right) = - \frac{1}{r^{2}} \frac{\partial}{\partial r}\left(\frac{r^3}{(r^2 + a^2)^{3/2}}\right) = - \frac{3 a^2}{(a^2 + r^2)^{5/2}}$$
which is what Jackson has.

Next consider the volume integral of the bracketed expression, with the volume measure again in spherical polars:
$$\int_0^{2\pi} d\phi \int_{-1}^1 d\cos(\theta) \int_0^\infty dr\, r^2 \frac{3 a^2}{(a^2 + r^2)^{5/2}} $$
The integrand has no $\phi$ or $\theta$ dependence so those integrals may be trivially carried out to give $4\pi$, leaving
$$ 4\pi \int_0^\infty dr\, \frac{3 a^2 r^2}{(a^2 + r^2)^{5/2}} = 4\pi \int_0^\infty d\tau \, \frac{3 \sinh(\tau)^2}{\cosh(\tau)^4}$$
where the $a$ dependence has been eliminated by an $r = a \sinh(\tau)$ substitution. From here one can proceed by rewriting the integral as
$$\DeclareMathOperator{\sech}{sech} 4\pi \int_0^\infty d\tau\, 3 \tanh(\tau)^2\sech(\tau)^2 = 4\pi \int_0^1 d\tanh(\tau) \, 3 \tanh(\tau)^2 = 4\pi \left.\frac{3 \tanh(\tau)^3}{3} \right\rvert_0^1 = 4\pi$$

The Taylor expansion appears to have already been asked about on this site, with an answer available at https://physics.stackexchange.com/a/58107/250824. The general idea is that you should carry out a normal multivariate Taylor expansion and then adapt it to polar coordinates. You will find that the linear term vanishes on integration, leaving the constant and quadratic terms that Jackson has.


Remove Ubuntu and install windows 8.1

Question: I uninstalled Windows 8 completely and then installed only "Ubuntu". Now I want to uninstall ubuntu and reinstall Windows, I dont have a live cd of ubuntu. I have my genuine windows in a flash drive (USB). Does the installation work if I format the drive from Disks option in Ubuntu?, what would be the consequence of formatting from there. Assist me with best possible solution.
Thanks in advance.
Answer: It is not possible to format a hard drive you are currently booting from. You would need to use the Ubuntu live cd/usb.
You should also be able to format through the Windows installer. I've actually only once or twice in my life installed Windows so I actually have no idea about if the Windows installer has this feature but I would be seriously surprised if it doesn't.
Comment: thank you Johannes. I did uninstall using Gparted formatting the partition creating a live Ubuntu ... :) It worked. Now I have installed Win10 preview, hopefully it works fine ;). Thankyou once again.
Answer: If you want to install any Windows, you should use only your Windows' installation media. No pre-formatting using any of Ubuntu's tools should be required.
Moreover: if you made the "genuine Windows in a flash drive" on your own from a pre-installed system using the Win8 backup utility, you may realize that you are not able to reinstall your Windows after formatting the drive in the past because of destroying the hidden partition on the HD.
So be careful erasing your Ubuntu, you may end up with a dead computer and without any installation media.
Comment: Hi Theo, Formatting was done using Gparted creating a live Ubuntu. It worked fine and re-installed Windows.

Remove Ubuntu and install windows 8.1


Message re-delivery and error handling in Message Listeners

Question: We have producer which is producing message at a rate faster than cosumer can consume. We are using Spring JMS integration as the consumer side technology stack. Currently we are using AUTO_ACKNOWLEDGE mode.
In the onMessage() method of the listener, upon the receipt we are to planning submit the client side job to a job queue and return from the onMessage() method. This means if a) processing fails or b) our server goes down while processing there is no way for us recover.
We looked at the option of using CLIENT_ACKNOWLEDGE, but this means acknowledging a message with higher timestamp automatically acknowledges all the messages with a less timestamp. This is clearly not desirable for us because a successful processing a message with newer timestamp no way means that all the messages with older timestamp are processed completely. In effect we are looking on per message acknowledgement. However, I read somewhere that this means there is some design flaw.
The other option is to use a SessionAwareMessageListener interface provided by Spring. The contract of using this interface says that if a JMSException is thrown from the onMessage the message will be redelivered. However, I was not completely sure how to use this for our purpose.
While I dig more myself into this, any help from you guys will be greatly appreciated.
Answer: Session aware message has following onMessage prototype:
 onMessage(Message message, Session session)

Invoke session.recover() for the message redelivery. Upon session.recover() will send all the unacknowledged messages back to the jms destination.


What is script_expr?

Question: The RPC for querying big maps mentions script_expr, but no where else in the Tezos Developer Documentation is it mentioned.

What is script_expr?
Where can developers learn more about it?
What libraries support it?
Answer: script_expr in this RPC means any Michelson expression. It is used to specify the key of the big_map that the RPC queries.
Comment: Assuming from your comment that your big map is indexed by keys of type `pair address nat`, you can build the expression as follows: `$ tezos-client convert data 'Pair "tz1KqTpEZ7Yob7QbPE4Hy4Wo8fHG8LhKxZSx" 3' from Michelson to JSON`.
Comment: What is the expected format of `script_expr`? I don't imagine it is going to read `PUSH nat 3; PUSH address "tz1..."; PAIR`? And where can developers learn more about it?
Answer:
What is script_expr?

Prior to the Babylon protocol, a contract could only have one big map. This big
map had to be located in a storage structured like this: or (big_map ...) ....
There is a deprecated
route
to query a big map in the location.
Since Babylon, a contract can have multiple big maps. Each of these big maps have a unique
id (an integer). Using this route,
you can query the key of a particular big map. However, you must prepare the key data in
a particular format of Michelson called script_expr.
It is the Blake2B hash of packed data that is then encoded into Base58.
Here is an example copied from this answer.
We want the script_expr for an address KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn.

Pack the key (this is available in the RPC, the tezos-client and various libraries).
050a0000001601a3d0f58d8964bd1b37fb0a0c197b38cf46608d4900

Hash it with Blake2B hash and digest size of 32.
d8a60c00b3c8f62cc2b3b8006b1858a621b5b74e06d3c82916659beaa24c8f67

Prepend "0d2c401b".
0d2c401bd8a60c00b3c8f62cc2b3b8006b1858a621b5b74e06d3c82916659beaa24c8f67

Base58 encode the result with checksum.
exprvAHu1SyoiSzyh9w7GPfifvyrNiMb442y7Q2MA8tcPCGPajxRH6

From the command line you can do:
tezos-client hash data '"KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn"' of type address

Script-expression-ID-Hash: exprvAHu1SyoiSzyh9w7GPfifvyrNiMb442y7Q2MA8tcPCGPajxRH6

Where can developers learn more about it?

This first part should cover most of what a developer needs to know about
script_expr if they need to implement in a library. However, if you
need more information it is best to start looking at the source code.
You need to understand how pack works. Blake2B in the tezos source code comes from digestf which
is an OCaml wrapper around the High Assurance Cryptographic Library.
Then you can see where script_expr is defined.

What libraries support it?

These libraries all support packing and have Blake2B and Base58 tools as
dependencies. You can follow the example in the first section.

ConseilJS

taquito

pytezos

What is script_expr?


Linux file access monitoring

Question: Is there any way in unix to find out who accessed certain file in last 1 week? It may be user or some script ftp it to some other place. Can I get a list of user name who accessed certain file? How can I find out who is accessing particular file??
Answer: Unless you have extremely unusual logging policies in place, who accessed what file is not logged (that would be a huge amount of information). You can find out who was logged in at what time in the system logs; the last command gives you login history, and other logs such as /var/log/auth.log will tell you how users authenticated and from where they logged in (which terminal, or which host if remotely).
The date at which a file was last read is called its access time, or atime for short. All unix filesystems can store it, but many systems don't record it, because it has a (usually small) performance penalty. ls -ltu /path/to/file or stat /path/to/file shows the file's access time.
If a user accessed the file and wasn't trying to hide his tracks, his shell history (e.g. ~/.bash_history) may have clues.
To find out what or who has a file open now, use lsof /path/to/file.
To log what happens to a file in the future, there are a few ways:

Use inotifywait. inotifywait -me access /path/to will print a line /path/to/ ACCESS file when someone reads file. This interface won't tell you who accessed the file; you can call lsof /path/to/file as soon as this line appears, but there's a race condition (the access may be over by the time lsof gets going).

LoggedFS is a stackable filesystem that provides a view of a filesystem tree, and can perform fancier logging of all accesses through that view. To configure it, see LoggedFS configuration file syntax.

You can use Linux's audit subsystem to log a large number of things, including filesystem accesses. Make sure the auditd daemon is started, then configure what you want to log with auditctl. Each logged operation is recorded in /var/log/audit/audit.log (on typical distributions). To start watching a particular file:
  auditctl -w /path/to/file

If you put a watch on a directory, the files in it and its subdirectories recursively are also watched.
Comment: Hey, you could create a nice circular loop with this: `syslogd access log file /var/log/audit.log at 10:01\nsyslogd access log file /var/log/audit.log at 10:02\n...`
Comment: Thank you Gilles.. I have this dat file created by the script. I just want to know what happens to that file after it is being created.. non of the other scripts are picking it for further process so I want to see if someone is manually accessing that dat file
Comment: @Jack: It's hard to say without knowing a lot more about your setup, but as long as nothing removes or renames the file, it'll be there for the other scripts to pick it up, whether or not someone else is accessing it. From your comment, I think you should be looking at what happens when you run your scripts.
Comment: `inotifywait` call should probably be `inotifywait -me access /path/to` *(note the `m`)*. Otherwise it will exit after the first event.
Answer: The previous answer is not the best practice for doing what you ask.
Linux has an API for this. The inotify API http://linux.die.net/man/7/inotify

You can write a C program to do what you want just calling the inotify API directly
You can use kfsmd, http://www.linux.com/archive/feature/124903 a daemon that uses inotify
If you want something that works across platforms (inotify is Linux specific) and you are using Java, JNotify works across platforms(Linux, Mac, Windows), abstracting the native OS' underlying API.
Comment: [Welcome to Stack Exchange](http://unix.stackexchange.com/about). Answers are not presented in chronological order, so "previous answer" doesn't convey which answer you mean. I wonder which of the other two you're referring to anyway: one doesn't have anything that looks like good or bad practice, and the other one does mention the inotify API.
Comment: As explained in https://unix.stackexchange.com/a/12251/20336 inotify API does not provide info about *who* accessed a given file. Plus inotify really does not help figuring out who accessed the file last week. You need audit features for that, which requires using software called `auditd` (however, even this does not help figuring out who accessed the file last week unless you had `auditd` already running last week).
Comment: Most probably Glen refers to the answer above with default vote sorting. Indeed the most popular answer fails to present a solution to the question. There may be a number of reasons for which one might need to see how many times a files gets accessed for a given time frame.
Comment: Your link to the kfsmd article is broken. It probably moved to https://www.linux.com/news/use-kfsmd-keep-track-changes-your-filesystems/
Answer: Above example with inotifywait should be one of (see man page for more info):
inotifywait /path/to/file
inotifywait -e open /pat/to/file

Or with monitoring mode and timestamp:
inotifywait -m --format '%w:%e:%T' --timefmt '%F %T %Z %z'

Comment: This is an easy and effective way, but it doesn't show who (which process) was accessing the file. Am I missing something?
Answer: This is not, in general, feasible. I have seen file systems with enough auditing to make it possible one way or the other, but it is not a general Unix thing, no.
Answer:
Is there any way in unix to find out who accessed certain file in last 1 week?

strictly doing what you ask:  one specific file, yes.
configure /etc/audit/audit.rules properly and service enable auditd and have the auditing service running and logging to /var/log/audit/audit.log
By default I think for most linux distributions auditing is on but the rules file is basically empty so you get very rudimentary items in the audit.log.  You have to manually add rules as you see fit to your audit.rules file.  Also peruse auditd.conf to get a full understanding of what is going on.
This is likely not the only way to do what you ask, but here is a rule that should do what you ask.
Web search more on linux audit watch file
-w /etc/passwd -p rwxa -k WATCHTHIS

-w is the stating the watch rule
/etc/passwd we are watching this file, change this accordingly
p the permissions filter, you have a combination of 4 total choices: read, write, execute, or append.
k optional, a filter key that is placed in audit.log whenever this audit event is triggered, highly recommended otherwise how are you going to find this event in audit.log; change this accordingly make something unique that is easily searchable in a billion lines of audit.log.

The var/log/audit/audit.log entries, one per line, there will be many, each will have a timestamp in epoch time format that you will have to convert to human readable month/day/year/hr/min/sec.  Search for a line having WATCHTHIS or whatever you made the key, and the uid= and gid= is what you are after.
# cheat sheet:

systemctl list-unit-files | grep audit

systemctl enable auditd.service
service auditd enable

service auditd start

# ----------------------------------------------------------------

# sample /etc/audit/rules.d/audit.rules file
# used in rhel/centos 7.9

## First rule - delete all

-D

## Increase the buffers to survive stress events.
## Make this bigger for busy systems
# -b 8192
# set from 8k to 1mb

-b 1048576

# in case of audit failure
# 2=shutdown, 1= goto runlevel 1, 0=no affect

-f 0

# add your desired rules

-w /scratch/somefile.txt -p rwxa -k WATCHTHIS

Comment: this was asked in 2011, the other answers in this post were likely true back then.  But now in 2020 and the linux audit system has come a long way, I believe using the linux audit system used in this manner is probably the best way to do what was initially asked.

Linux file access monitoring


Ambiguity on Matthew 5:32 and 19:9

Question: In Mathew 5:32 it says if a man divorces his wife except for the cause of fornication he will make her adulterer. (So in this context the adulterer will be the woman and the man who marries her after the divorce).
In Mathew 19፡9 it says if he divorces his wife except for the cause of fornication and marry another, he will commit adultery (so in this context the adulterer will be the husband and the one who will marry the divorced wife. The woman is free)
Which one did really Jesus spoke?
Comment: Why can't it be both?
Comment: It means the same thing. Sin of divorce and remarriage here should be understood as doing imperfect or not living the perfect life. Also the deliberate faulthy divorce is necesarily a sin.
Comment: I think the crux of it relates to the scripture that Jesus spoke, "what God has joined together, let not man put asunder". Adulterate means to make impure. So adultery in this case means any impurity added to what God originally joined together. And this is probably because God does not unjoin them because one, the other, or both, have a problem. This joining together was meant to be permanent, and that close joining comes from the fact that they were originally one flesh in the garden, when God took the Rib from the side of Adam, and fashioned Eve from it.
Comment: I personally believe that God also took some of Adam's spirit, and put that into Eve so that they would need each other, complement each other, and fit together perfectly. Since the fall, they do not fit together as perfectly.
Answer: For the sake of this discussion, let us denote the original couple/marriage as consisting of Man A and Woman A which we denote as MA+WA.  When they get divorced, and marry others we will have two different couples, namely, MA+WB and MB+WA.
Now to the two occasions in Matthew where Jesus records His teaching about marriage.

Matt 5:32 - But I tell you that anyone who divorces his wife, except
for sexual immorality, brings adultery upon her. And he who marries a
divorced woman commits adultery.

From this verse we discover that in the absence of sexual immorality:

If MA divorces his wife, WA, this causes his ex-wife, WA, to commit adultery because in Jesus' day, it was almost impossible for a woman to live alone; therefore when her husband divorced her she faced an invidious choice - prostitution or remarriage - both made her guilty of adultery.
When MB marries WA, MB also commits adultery.
This says nothing about whether MA is guilty of adultery of not.

Matt 19:9 - Now I tell you that whoever divorces his wife, except for
sexual immorality, and marries another woman, commits adultery."

From this verse we discover the following in the absence of sexual immorality:

When MA divorces divorces his wife, WA, and marries WB, MA commits adultery.
This says nothing about whether WA or MB commits adultery or not.

Since these two discuss the two sides of the remarriage, they do not conflict.  However, the combination of the two says that it is NOT the divorce that is the problem (consistent with Paul's teaching in 1 Cor 7:10, 11, see appendix below), but the remarriage after the divorce.
Again, Matt 5:32 and Matt 19:9 do not conflict because each addresses different parts of the same problem.
APPENDIX - 1 Cor 7:10, 11

A wife must not separate from her husband. But if she does, she must
remain unmarried or else be reconciled to her husband. And a husband
must not divorce his wife.

Note that both Jesus and Paul say that it is not the divorce itself that is the primary problem (bad as that is when a marriage collapses) but the remarriage after the divorce that creates the adultery.

Ambiguity on Matthew 5:32 and 19:9


Logging using Microsoft account

Question: I would like to create WordPress website with forum where people will be able to login with Microsoft account. I would like to do this to authorize their GamerTags from Xbox Live. Is that even possible?
Answer: With the Janrain plugin, you can have users sign on with Microsoft accounts. Try it, and if you have any issues let us know.
Edit:
By us I mean the stack exchange community. I have played around with this plugin, so when I saw this question it popped into my head to see if Janrain supported Microsoft accounts.
I am going into ninth grade, and am not affiliated with Janrain.
Comment: Do you have an affiliation with this plugin?

Logging using Microsoft account


Controller/Transmitter for Canon 580EXII + Godox AD200

Question: Is there one transmitter like Godox XProC (for Canon 5D MarkIV) to control Canon 580EXII and Godox AD200? If not what is the best way to do it?
Comment: Radio or optical? How much control do you want? To fire in sync? To set power from transmitter? HSS? TTL? something else?
Answer: The Godox XProC will work fine, but you will need a Godox X1R-C receiver to attach to the 580EXII hotshoe. This will give you full control (HSS, TTL, ...) over both the AD200 and the speedlite.
Answer: Godox has several transmitters in their 2.4 GHz radio system that can trigger and/or control the AD200:

Flashpoint R2 Pro II-C
Godox Xpro-C
Godox X2T-C
Godox X1T-C
Flashpoint SPT single-pin transceiver (manual trigger; no TTL/HSS/power control)
XT32 (manual trigger with HSS/power control)
XT16 (manual trigger with power control)

The 580EXII, however, does not have radio triggering built-in, and would require an X1R-C receiver to be attached to its foot to be triggered and controlled by the Godox transmitters. And unlike the built-in radio triggers in Godox's own lights, the X1R-C does not support cross-brand TTL, so the 580EXII can only be a TTL/HSS radio slave to a Godox "-C" Canon version trigger on a Canon camera hotshoe.
The ideal way to add an off-camera speedlight to an AD200 would probably be to purchase a Godox speedlight (V1, V860II/TT685, V850II/TT600, etc.) and use that instead, as all the Godox speedlights have built-in radio triggers which simplify setup/packing vs. add-on triggers.


How can I create a DNS record for an external site?

Question: I am a de-facto IT Dude at a small company running on a LAN governed by a machine running Windows Server 08 R2. Our web sales and logistics director has asked me if I can create something internal to our company network where if you type in 'shipping' it goes to a Google Docs form that gets submitted back to him. Now, I understand how to 'name' a host, ascribing to an IP a string you can type into the address bar of a browser; I did it for our phone system and the printer at my boss' request. But how can I extend that to also resolve to the URLs of external web pages? Is that even possible?
Answer: As others pointed out, a DNS record can't point to a URL. But what you can do (and what I do) is run an internal Apache server and create a virtual host on the Apache server for that name.
Say you create a DNS entry for "sales" and point that to the IP address where you run Apache.
Create a virtual host as in
<VirtualHost *:80>
  ServerName sales
  RewriteEngine on
  RewriteRule ^(.*)$ http://example.external.site.com/mysalesform [R,L]
</virtualHost>

Comment: +1 - Using a virtual host with a rewrite rule and a CNAME is an easy way to accomplish this without complex dependencies. You could get even simpler and use a virtual host that serves static HTML documents with meta http-equiv rewrites in the header.
Answer: You cannot make a record point to an URL.
What you can do is create a CNAME so that an internal name example.internal resolves to another name example.com.
The record will look like this:
example.internal. CNAME example.com.
You can then type http://example.internal/restofURI to access the external site. Note that this may cause trouble with SSL certificates due to the non matching hostname.
Comment: also, this will probably not work if the destination webserver is using name-based virtual hosts.
Answer: You could use a CNAME to resolve one name to another, but that won't get you the full URL.  DNS cannot resolve to complete URLs, just to host/domain names.
In order to do what you are being asked, you will need some type of application that performs an HTTP redirect.  This is essentially how URL shorteners like bit.ly and goog.le work:

User enters in shortener.com/shipping
shortener.com web app looks up "shipping" in its database of shortened URLs
shorterner.com redirects the user to the appropriate full URL

My company runs its own internal URL shortening service for exactly this purpose, using a short version of our corporate domain name.
Comment: Can you point me to any specific software, or was it developed in-house?
Comment: YOURLS is an open source one in PHP: http://yourls.org/.  Ours is in-house, and frankly it's a super easy little app to develop, just a little CRUD work and some HTTP redirects.  Also if the stuff you are shortening is authenticated or if it's okay to do so, you can also just use a public URL shortener like goo.gl.
Comment: Also if it's just for literally one thing, this "shipping" example, something like the answer from @ETL will work just fine.  Using a URL shortener allows you to do it for arbitrary URLs in the future without much additional fuss.
Answer: In the DHCP set up you can set up dns suffixes to append that will be pushed to all the clients on the network.  You can also set this up manually on each box in the nic ipv4 properties. under the DHCP tab.
if you put "external.com" for example in there at the top it will try shipping.external.com first.
However, you cannot really mess with the path portion of the url that way.  I'd recommend the first part and then use bookmarks.


SharePoint 2007 passwords stop working

Question: My work uses an old SharePoint 2007 site. Periodically, it will start rejecting some users' passwords, but not all. Currently, our SharePoint is linked to our Active Directory. So, it's my understanding that the users' SharePoint passwords should just be the same as our e-mail passwords, and stay that way. But that's not what is happening. Randomly, a user's password will just no longer be recognized by the site, and he/she must have it reset. I suspect it has to do with the fact that we are still using SharePoint 2007, but everything else has been migrated to Microsoft 365. Has anyone heard of anything like this before?
Answer: SharePoint dont have such thing which can stop the accepting the user's password.
Possible issues:

check if users account's password expired?
or User's account locked?
once sharepoint reject the login.then restart the PC/laptop and try to login on the laptop, may give you a clue.
what authentication method you are using?
Comment: I believe it's microsoft single sign-on. i think their passwords are expiring. Thanks for the advice!

SharePoint 2007 passwords stop working


Hibernate criteria with subquery in join

Question: Is there any way to use the Criteria API sub query in join clause.
I have SQL Like this
<code>select ud.email as email,ul.last_login as last_login,
ul.login_count as login_count, fb_count, m_count from user_details ud
left outer join user_logins userlogins1_ on ud.user_id=ul.user_id
left outer join
(select count(feedback_id) as fb_count,user_id from user_feedback group by user_id) as uf
on ud.user_id=uf.user_id
left outer join (select count(mapid) as m_count,user_id from maps group by user_id) as m
on ud.user_id=m.user_id order by ud.email asc
</code>
I saw some where that Criteria do not support Subquery in join but support only in select or where clause. Is this True?
I am not finding a way form the above to rewrite some other way.
Please help/suggest me how to proceed
Answer: Simple answer is: you can't. The problem with doing this is that hibernate does not know how to map the resultmof the join since it didn't created it.


When running a Unity HoloLens program from Visual Studio, when an exception is thrown how do I get the line numbers in the stack trace?

Question: Currently when an exception is thrown from within my Unity script while using my HoloLens the Debug Output in Visual Studio shows the stack trace without the line numbers.
How do I get the line numbers along with the stack trace? I'd be fine with it being logged somewhere else other than the Debug Output.
Here's some example output in Visual Studio:
Exception thrown: 'System.NullReferenceException' in Assembly-CSharp.dll
NullReferenceException: Object reference not set to an instance of an object.
   at NewBehaviourScript.Update()
   at NewBehaviourScript.$Invoke6Update(Int64 instance, Int64* args)
   at UnityEngine.Internal.$MethodUtility.InvokeMethod(Int64 instance, Int64* args, IntPtr method)
(Filename: <Unknown> Line: 0)

And the corresponding Unity script (I made a Cube and attached a NewBehaviourScript component):
public class NewBehaviourScript : MonoBehaviour {
    // Update is called once per frame
    void Update ()
    {
        object a = null;
        a.GetType();
    }
}

I tried changing the build from Release to Debug doesn't give the line numbers.
I tried googling, and it looks like it's not showing the line numbers for others, as well: http://answers.unity3d.com/questions/1315985/null-reference-in-line-0.html
I tried asking on Microsoft's forums, but didn't receive any useful replies.
Answer: I don't think you would get the line number since it does not exist anymore. You get it in Unity editor because you are not running a full build of the application so Unity still has access to the non-compiled code. When you run on the device, it sends debug commands to the VS console about the printing and the errors but all the code is binary at that point, so there is no reason nor possibility to provide a line number.
Actually this is not specific to Hololens, but you would get the same in Android or iOS. Once build, the code is no longer the same, it does not even match one to one as the compiler performs optimizations.
What you can do is placed Debug commands to see where it happens.
public class NewBehaviourScript : MonoBehaviour {
    // Update is called once per frame
    void Update ()
    {
        object a = null;
#if DEBUG
        if(a == null)
        {
            Debug.Log("[NewBehaviourScript] Running update with null a object");
        }
#endif
        a.GetType();
        Debug.Log("[NewBeahviourScript] if this line prints, method did not crash");
    }
}

In this example, you can use the DEBUG macros if you would have code running only for debug purpose. This way you can easily exclude it on export. The second call for Debug is not required in the macro since the build process will discard it when you set the build to Release or Master.


Estimating in R "between" effect on time-invariant predictors and time-variant dependent outcome

Question: I am currently working on my dissertation project regarding media usage trends and would like to receive some clarification on panel data model that uses time-invariant independent variables and time-variant dependent outcome.
Firstly, summary "mean graph" of 24 months worth of data revealed that there is a general decline among customers in usage of TV. In other words, live TV is becoming less and less popular.
Now, my main interest using PLM regression in R is to find out which variables or variable categories drive that change. For instance, one would think that young adults during 24 months period drastically changed their behaviour because they are more keen in exploring and using new media technologies, such as, video-on-demand, whereas, perhaps, older generations are more in favour of continuing to use traditional media consumption channels, such as, live TV. Therefore, young adults should be strong predictors of changes in TV consumption when compared to elderly.
So far, I've run the following command to produce desired results:
library(plm)
tv_usage_trend <- plm(tv_volume ~ age_group + gender + control_variable + control_variable + control_variable, data = total, index =c("id", "date"), model = "between")
summary(tv_usage_trend)
It can be seen that I used "model = between" function in the PLM package due to my time-invariant predictors, which means that I cannot measure "within" effects and can only look at "between" effects among individuals. The snapshot of my results is as following:
Estimate Std. Error  t-value  Pr(>|t|)
(Intercept)                                    384.455   2498.529   0.1539  0.877711
AGE_BANDING65 - 74                             479.638    157.961   3.0364  0.002396 **
AGE_BANDING55 - 64                            -577.320    191.700  -3.0116  0.002601 **
AGE_BANDING45 - 54                           -1487.911    197.152  -7.5470 4.574e-14 ***
AGE_BANDING35 - 44                           -2332.972    211.404 -11.0356 < 2.2e-16 ***
AGE_BANDING25 - 34                           -2466.860    229.941 -10.7282 < 2.2e-16 ***
AGE_BANDING18 - 24                           -2193.473    307.055  -7.1436 9.291e-13 ***
My reference category in here was (Age_BANDING (75+). The results look as expected - young adults significantly differ from the oldest group (at least one * next to the category means significant relationship). However, when investigating the results closer and plotting best fit lines for each category over time I noticed that actually AGE_BANDING (75+) group also changed their behaviour - they are much less likely to watch TV as well.
In other words, this means that there should be no significant difference between the reference category and some of the younger adults categories, but that is not the case. I believe the model does not account for over-time effect on the dependent variable and only compares overall tv_volume means across age groups, which of course then tells the story about which groups are more or less likely to watch TV in general rather than which groups are drivers of TV consumption change.
Any ideas on how I could solve this? I would really really appreciate any help.
Thanks,
Klaudijus
Answer: interaction between X (independent variable) and Time variable was the way to build the model.


Where does static classes/members allocate?

Question: it's being a long time since i'm trying to find out the truth about static classes. my point is: value types are allocated in stack, reference types in heap, when using the new operator. but a nature of a static class is that you can't make an instance of it, and sure it's not a value type. so i have a question when and where does the CLR allocates a memory for static content? about when...i'm supposing during compilation, when an assembly is built, but i'm not sure. and about where...while i was trying to find out i read J.Richter's "CLR via C#", and he wrote, that static method of an instance-class is allocated in heap when you're creating an instance of that specific class(together with type object pointer and sync block index). but i don't get it. it's static. it shouldn't depend on any state of object. so please, lighten me.
Comment: There's a difference between static members and constructors (to which I believe the text you cite is referring) and static classes.  Are you aware of this distinction?  If so, which are you specifically asking about?
Comment: It's not true that value types are *always* allocated on the stack.
Comment: well...the difference i know is not in memory allocation, is it?
here, i'm asking about memory allocation of static classes. i spoked about static method, only because of an example in Richter's book. but if there's any difference between allocation of static class and static members of instance classes, i'd like to know it.
Comment: of course, but it's not the point of this question.
Answer: The CLR maintains several heaps associated with an AppDomain, collectively called "loader heaps".  They are distinct from the garbage collected heap since they don't contain collectable objects, mostly type related data.  The kind of data that's around for the lifetime of an AppDomain.
Space for static variables is allocated in one of them, the HighFrequencyHeap.  The JIT compiler makes the allocation, the code it generates directly references the memory location. Background info is in this MSDN Magazine article.
Answer: As well as user heap memory, the CLR keeps various bookkeeping information & metadata on the heap. This includes the actual code for methods you execute, as well as a Type object for every type loaded into the AppDomain - it's name, overloads, whether it's abstract or sealed, and a list of all the methods (both static and instance) defined on the type.
When you execute a method, the CLR looks up the method information in the corresponding Type object on the CLR-only part of the heap and executes that method. The only difference between instance and static methods is that instance methods include an extra 'this' pointer in the method arguments pointing to the instance the method is executing on.
So, the static information is stored on the heap along with everything else, but it is not associated with any particular object instance.
Comment: yeah, that makes a good sense! thank you! so, all this instance-and-static classes thing looks deceptive. it's just an extra "this" pointer, but it's all kept in same place...same way. thanks very much


Why do the sons of Jacob "deceitfully" agree to intermarry with the Hivites after circumcision (Genesis 34:13-17)?

Question: The Israelites could have simply refused the Hivites' suggestion that the tribes be combined, demanded Dinah back, and made other plans to exact justice from the Hivite prince, Shechem. Why did they agree instead?
Answer: The brothers (no spokesman is named) begin with perfect honesty: Dinah has been violated; the Lord commands that our daughters marry only circumcised men. Then begins the lie: if the Shechemites will circumcise themselves, then the two clans will intermarry and "become one people." (Gen 34:16) The lie is that the brothers have no intention whatsoever to do this.
Now, a first-time reader who missed the word "deceitfully" might think nothing amiss at this point in the story. But with this one word, our author plainly asserts that the Israelites are making this offer dishonestly, hiding their true intentions and, it seems, the suppressing their anger.
So why do they not simply refuse the Hivites? The narrative itself makes this clear enough: if the men of the city of Shechem do go ahead and circumcise themselves, they will wound themselves and then the brothers can more safely rescue Dinah; and some might have harbored an intention to take their revenge at least upon Shechem.
Now, let us be very clear. The Israelites were fully aware that they could not intermarry with the Hivites. Abraham, whose story must have been well known to the brothers, was told that the Canaanites would all in time be extirpated from the land. The sign of circumcision marked the descendants of Abraham as separate from the people among whom they lived. Joining with them would be disgraceful for that reason alone.
This too was the attitude of Abraham, Rebekah, and Isaac, as we can see from several supporting verses, as Matthew Henry well points out:

Abraham instructs his main servant, who goes to Haran to fetch a wife for Isaac, "And I will make thee swear by the Lord, the God of heaven, and the God of the earth, that thou shalt not take a wife unto my son of the daughters of the Canaanites, among whom I dwell." (Gen 24:3)
The wife that servant found, Rebekah, later tells Isaac, "I am weary of my life because of the daughters of Heth: if Jacob take a wife of the daughters of Heth, such as these which are of the daughters of the land, what good shall my life do me?" (27:46)
Finally, as if to underscore his wife's attitude, Isaac instructs Jacob, "Thou shalt not take a wife of the daughters of Canaan." (28:1)

Thus, while Jacob's parents and grandfather do not specifically cite the signs given by the Lord, they seem to have taken it to heart. But note that the Israelites have no intention whatever of intermarrying with the Hivites: they are being deceptive about something quite serious. Why?
Well, first we should discuss who actually deceived the Hivites. Why would the brothers other than Simeon and Levi endorse a deception if they were not prepared to act on it? There are two possibilities.

The Israelites all actually plotted their revenge in advance.
Either Simeon or Levi was the spokesman, and while that pair plotted their revenge, the rest of the family thought the pair were being sincere, and actually went along with the stated plan.

But the second of these possibilities is very implausible. If two of the brothers were murderously angry, the others would be at least angry enough to explicitly reject the offer of marriage; and, for reasons just stated, they would probably all be disgusted at the notion that they combine their clans. Indeed, it is hard to see how one or two brothers could speak deceitfully without all the rest, and Jacob as well, partaking in the lie. And if they did, why would they, except to rescue Dinah and perhaps to revenge themselves on this arrogant, disgusting prince?
This does not require that they be prepared to murder all the men of the place, however; that need not have been a part of the general plot to deceive the Hivites. Perhaps it was not even Simeon's and Levi's original intention.
But there is another possibility. As Allen P. Ross says in the Bible Knowledge Commentary, perhaps the Israelites "assumed that Shechem and Hamor would never consent to their males being circumcised as a condition for intermarriage." That seems very plausible.
There is one last aspect of this topic that needs explaining. What would be the ostensible reason why Jacob's sons would propose that the Hivites of Shechem be circumcised? In other words, how might Jacob's sons go about explaining their request to the Hivites? In short, circumcision is essential to being one of the tribe of Israel: "And the uncircumcised man child whose flesh of his foreskin is not circumcised, that soul shall be cut off from his people; he hath broken my covenant." (Gen 17:14) On this basis, a man could become a naturalized (i.e., "proselyte") Israelite through circumcision: "And when a stranger shall sojourn with thee..let all his males be circumcised...; and he shall be as one that is born in the land" (Ex 12:48).
Thus, though the latter law was not yet established, Jacob's sons correctly inferred something like it from the covenant already in place. And this made the deception a serious act of wrongdoing, one that it is extremely unlikely the Lord would have approved.
Answer: It didn't go very well for Simeon and Levi in Jakob's testament, Genesis 49:5-7.
The blame was put on the two tribes, not all of the tribes of Israel.
The event left hardly a trace other than in Jakob's testament and negative history: Simeon got a remote area that disappeared from history and Levi got nothing.


Can linear momentum convert into angular monetum?

Question: Let say there a rod pinned down tightly to the floor with no friction between the pin and rod. If a ball was to move at the same velocity and collide and stick together with the rod at some radius perpendicular to the position, would the linear momentum be converted all into angular momentum after the collision?
Comment: It might be better to re-phrase the question to something like, "How much angular momentum would a non-rotating, stationary sphere of radius R and uniform mass density $\delta$ acquire if it were hit tangentially by a mass $M$ moving at speed $V$ relative to the sphere's center of mass, and the mass stuck where it first touched?"  Often, when you think through a question carefully enough to express it clearly, you may see how to answer it yourself.  Do not cut and paste this into your question!
Answer: They are different physical quantities with different dimensions and thus different units. As such, they cannot interconvert. In your example, there was angular momentum before the collision as well as after.
Answer: Both quantity have different dimension, you can cannot convert time into distance, now although there exist a relation between linear and angular momentum which is related to their velocity $v=wr$, you can use both angular momentum and linear momentum conservation in this problem. Or best you can use energy conservation which holds here.
Answer: Yes, it would.  At the instant when the ball touches the rod, it coukd be thought of as having angular momentum in the form of mrv.  It is intuitive to think it would make no difference if the ball was rotating around the center or following a tangent linear path if it would impact the same place at the same instantaneous speed.  Thus, think of the ball in terms of its speed and distance from the center of rotation, and think of its mass as its moment of inertia given the center of rotation.
Also, conservation of momentum is a corrolary of Newton's Third Law, so it will always hold.


How should I store my HDDs?

Question: I have a few HDDs which contain backup data. I want to store them in a secure place. I know some good practices like storing them in a different building so if there is, let's say, a fire, you can still restore the data. But I am more concerned in the degradation of the HDDs, for example by humidity. Should I store them in a plastic bag? Is there any special way to store the HDDs so they can not be damaged by the enviroment?
Comment: Given options of cloud backup and magnetic tape, I don't think hard drives should be a first choice for disaster recovery.  It like storing milk instead of water for emergencies at home; water you can just keep anywhere anyhow where milk you have to keep it cold and it goes "bad much faster than water.  Hard drives do not store as well even if you you go through the trouble and go "bad" faster than tapes or cloud storage.  This is aside from the fact the HDD's can be expensive compared to other options when you have that many copies of data.
Answer: For the case, I see it would be beneficial to consider 3-2-1 rule with RTO and RPO in order to get planned Backup and DR sites.
For a backup and DR boxes, I am using 2x Synology, so I can suggest you to take a look what they got. Veeam Backup software is used to backup/move data to backup NAS and then to DR one (that is in other building).
I found the hardware solution from aclouda that seems to be more beneficial for your caser. I see it allows to use cloud storage as local SCSI drive thus it allows to run backup jobs to cloud as it would be local drive.
Answer: Hard disk isn't designed to store data for some reasonably long period of time. For vaulting you need disk -> tape and use something like Iron Mountain and similar services. Companies who need to mess with regulatory requirements do this for years.
Answer: Don't store your backups in off-site hard drives. That sounds like a dangerous and inefficient way to store off-site backups.
I'd store your on-site backup on a professional NAS or SAN with disks in RAID (based on whatever you can afford) and then use a cloud service for off-site storage. A cloud provider like Backblaze (no, I'm not affiliated with them in any way) is really quite a cheap way to store an off-site backup when you consider the costs of purchase hard disks, upgrade, and maintenance. You would just upload your off-site backups.
Should you stick with hard drives off-site, store them the way they should be stored, in an off-site server in a RAID configuration and upload to that from your primary site. Moving mechanical disks on a regular basis isn't a good idea.
Comment: I was thinking about it. I will probably go for a NAS, even though this is for a really really small company. Anyways I think the question could be interesting for people who just want to store their personal backups in a secure way.
Comment: I know companies that store their backups on magnetic tapes which they store off-site. Thought it's worth to be mentioned.
Comment: Yeah, I think it's an interesting question for small business too (I up-voted it). Look at a QNAP or something for off-site backups if required. They are reasonably reliable and cheap for small business. If you can justify the expense you should aim for raid 6, raid 5 if you can't justify the expense. In all honesty though, cloud off-site backups are probably even cheaper than a cheap off-site NAS.
Comment: In today's RAID environment never do RAID 5 or 6.  RAID 10 is the only way to go.  If you cannot afford 4 or more drives, RAID 1 will do but is not as reliable.  With the larger size hard drives out now RAID 5 is too dangerous to use considering the rebuild time.
Answer: I agree that a NAS is always the best answer for external storage.  If you truly want "Off site", I would recommend a safe deposit box.  If you are looking to store this long term and only touch it in the event of a catastrophic event, you could use a zip lock bag or even vacuum seal it before storing it in the safe deposit box.  If you use any sort of on site media rated (class 125) safe, you will need to include some sort of desiccant in that safe to keep the humidity to a minimum.
Another lower budget option that is accessible would be to put a NAS in a different physical building with a network connection that is either fiber or point to point wireless.

How should I store my HDDs?


Under what set of transliteration rules is кс rendered as the latin x?

Question: I have followed a couple of different methods (Iso 9 and Passport 2010) and have looked at others which are mentioned on this wiki page, but no matter what I do, something like the name Александр ends up getting rendered in Latin as having ks instead of x.  I am quite happy with rendering that name as Aleksandr, but in the end I need to compare the transliteration with say the way the name is printed in English language newspapers.  I am just wondering where one gets the x from?
Comment: This is offtopic here as English language transliteration rules have little to do with Russian language and usage.
Comment: You are wrong. There is a set of rules like GOST R 52535.1-2006, that strictly defines transliteration rules for Russian names and families used for foreign passports. This transliteration based on English form. Prior to 2000s was used another form based on French language (language of international post and document exchange). And Александр Пушкин in old notation would be Aleksandre Pushkine. In new notation it should be Aleksandr Pushkin, but there is no strict control at immigration office and Aleksandr may be written in passport as Alexander or Alexandr, it is up to you.
Comment: Under nothing but author's wish to use `x` instead of `ks`. Some people like to use it, because it's shorter and prettier in some sense.
Answer: On the whole, I do not believe there are strict rules about when кс should become x and when it should become ks.  Most of the times, the transliteration will either follow some traditional rules or just be whatever the person writing it decides.
Specifically, Russian name Александр and English/Latin name Alexander both originate from Greek name Αλεξανδρος.  Greek letter ξ (Xi) is pronounced as ks in Greek.  Because in English (Latin), there's letter x, which is pronounced (in most cases) as ks, the English writing of the name is more closely conforms to the original Greek writing. In Russian (Cyrillic) there is no such letter, therefore sound combination ks has to be indicated by the closest possible way, which is letter combination кс.  Thus, comparing transliteration rules from Russian into English in this case isn't particularly useful.
Comment: Is there really an occurrence in English where x is not *ks*?
Comment: @Alenanno As far as I can think, when transliterating from English into Russian, _x_ will always become _кс_ in Russian.  When transliterating from Russian into English, you will sometimes see _кс_ transliterated as _x_ and sometimes as _ks_, often on the same word.
Comment: @Alenanno In some cases, English letter _x_ may correspond to _кз_ in a related Russian word, for example _exam_ is _экзамен_.
Comment: Wait, I think you meant there were ks words in English, not Russian. :)


What would cause Mysql database entries to be truncated to 253 characters?

Question: Randomly seeing database entries truncated to 253 characters on a php site and can't figure out why or if it could be malicious or a corruption issue.  Any thoughts would be appreciated.
Comment: What do the column definitions and character set configuration look like?  I'm thinking storing utf-8 data in a latin1 column, perhaps?
Comment: I know historically that inserting a string longer than the size of the field specified in the table definition in MySQL would silently truncate the data and succeed, whereas most normal RDBMSs return an error. What's the table definition you're inserting to? Specifically, what's the column datatype for the field that's being truncated?
Answer: If not configured (by adding strict_trans_tables to your sql_mode settings) to throw errors when presented with invalid data, such as a character value that is longer than the definition of a VARCHAR column allows, MySQL truncates it to fit, and only throws a warning.
My guess is that you've got a VARCHAR(255) column and at some point in the process, there's an inconsistency in character set configuration, and you have some UTF-8 characters that at some point in your system are being treated as latin1, causing the system to misinterpret the number of characters and truncate the value.
Wait, what?  How is the number of "characters" different than the number of "bytes?"
In UTF-8 encoding, character values from 0x7F (decimal 127) downward are still encoded as their 1-byte ASCII equivalent.  Larger values are encoded as 2 or 3 bytes.  Common symbols like © (ASCII 169 0xA9) and ® (ASCII 174 0xAE) are encoded as two bytes, 0xC2 0xA9 and 0xC2 0xAE respectively.
When fully configured for UTF-8, MySQL understands this; using "®" as an example:
mysql> SELECT LENGTH('®'), CHAR_LENGTH('®'), HEX('®');
+--------------+-------------------+-----------+
| LENGTH('®')  | CHAR_LENGTH('®')  | HEX('®')  |
+--------------+-------------------+-----------+
|            2 |                 1 | C2AE      |
+--------------+-------------------+-----------+

The LENGTH() function returns the number of bytes, while CHAR_LENGTH() returns the number of characters.
A VARCHAR column restricts not the number of storable bytes but the number of characters you can store in it, regardless of the byte-width of each character... so a VARCHAR(2) column could actually end up containing 6 bytes of data (plus requiring 1 byte of storage overhead) if the two characters happened to be both 3-byte-wide characters.
However... 0xC2 and 0xAE are both codes for valid characters in the default latin1 character set, so if you were configured with latin1 but sent those characters in their 2-byte unicode encoding, the server would interpret that single unicode character as if it were two characters -- both valid -- thereby reducing the number of printable characters that could be stored in the VARCHAR(255) column by one character for each 2-byte encoding, or reducing it by two characters for each 3-byte encoding.
In the example above, all of my character_set_* values (except character_set_filesystem, which is set to BINARY) were set as utf8, and the CHAR_LENGTH() of a 2-byte character was correctly reported as being "1."
Now, I'll change these settings, to illustrate:
mysql> set character_set_client = latin1, character_set_results = latin1;
Query OK, 0 rows affected (0.00 sec)

mysql> select CHAR_LENGTH('®');
+-------------------+
| CHAR_LENGTH('®')  |
+-------------------+
|                 2 |
+-------------------+

Note that I didn't actually change anything about my actual client's behavor -- each time the "®" symbol appears, the character was UTF-8 encoded and there were two bytes being sent and received over the wire.  All that changed is that I only told MySQL that what I was sending and what I expected to receive should be interpreted as being sent to the server (character_set_client) and returned to me (character_set_results) as latin1.
http://dev.mysql.com/doc/refman/5.1/en/charset.html


Classification algorithm with multiple output for a set of features

Question: I want to build a classification algorithm that will predict multiple values for a set of features. For instance, lets say I have a customer demographic data like Income, age, sex, city and I want to predict 5 top products they will buy: like if a customer is male, has income less than 30k, lives in Tier1 city and has age 20-35 years--then the output is: 1. Mobile 2. Car 3. Furniture i.e., there are three outputs which means they would most probably buy Mobile, Car and Furniture with decreasing value of probability.
Which algorithm will be best suited for this problem?
Comment: This is either **multiclass**, and you're interested in retrieving probabilities, or **multilabel**. What would your training data look like?
Answer: Your problem can be considered as multiclass classification problem. So, you have a dataset of features X and the predictor y. Where X contain Income, age, sex,etc. and y is an item that one customer will buy with higher probability.
To achieve your goal and predict the probability of a customer you can use any classifier from scikit-learn Library (if you use python) and call the method predict_proba after you fit the classifier, as shown in the following example:
from sklearn.datasets import make_classification
from sklearn.ensemble import RandomForestClassifier

# Make a random multiclass classification problem
X, y = make_classification(n_samples=1000,
                           n_features=10,
                           n_informative=10,
                           n_redundant=0,
                           n_repeated=0,
                           n_classes=5,
                           random_state=0,
                           shuffle=False)

# Fit any classifier
rfc = RandomForestClassifier(n_jobs=-1,max_features= 'sqrt' ,n_estimators=50, oob_score = True)
rfc.fit(X,y)

# Prediction for one example
one_example = X[10,:].reshape(1,-1)
outcome     = rfc.predict_proba(one_example)

The outcome of this problem with 5 classes is
array([[0.76, 0.12, 0.02, 0.06, 0.04]])

Which represent the probability of each class for this example (or customer in your case)


What keyword is driving traffic to a PDF

Question: Is it possible to figure out what keywords are driving a traffic to a particular page?  Our's for instance is a PDF file that is not being tracked by GA.
Answer: In Google Search Console, click on Search Analytics, then select Pages. You can use an include only filter for <code>.pdf</code> files or specific one, or select from the table below.
Then, go back to Query, and now you can see which keywords directly drove traffic to your PDFs.
You can also track PDFs in Google Analytics.
Here you can find 2 complete answers about tracking PDFs in Google Analytics:
Tracking PDFs properly on our website
So, you can use Events or Virtual Pageviews. Your choice.
Remember that keyword data for analytics is very limited and you'll have only a small spectrum of them. But it can be interesting because now you can see the path your segmented audience can take before reaching a PDF, even when PDFs are not "landing pages".
Answer: This is not possible using Google Analytics, unless you implement a server side proxy script, that sends a request to Google Analytics before sending the PDF file to the browser. See https://developers.google.com/analytics/devguides/collection/protocol/v1/
I would suggest that you use Google Webmaster Tools, which allows you to see search requests from Google (but not other search engines unfortunately) for certain pages, so you would be able to see which keywords were used before downloading your file. This is visible under "Search traffic" -> Search requests and then clicking the "Popular pages" tab.
Answer: Yes, As Olivier said, it is not possible. Workaround method would be, "Put up a intermittent redirect page (blank with GA Code embedded and appropriate delay which allows GA pixel to fire) where you can capture the information you require".


What does "putting someone on" mean?

Question: Like in this example:

He was worried that X was putting him on.
Answer: In this case it means to tease someone, meaning 2 below (from Answers.com).

put-on n. Slang

A deceptive outward appearance.
The act of teasing or misleading someone, especially for amusement.
Something, such as a prank, intended as a hoax or joke; a spoof.

Note that this link is for the noun form, but the verb ("to put someone on") has the same meaning.
Sample usage:

Bill said he was going to help me fix my car, but it turns out he was just putting me on.
Answer: Briefly, related sayings might include:

Are you having me on? (To kid or mislead someone )
Are you taking the mickey out of me? (Teasing or making fun of someone)
He's pulled a fast one. (To trick or mislead someone)
Answer: He was worried that X was playing a trick on him, or setting him up for a little prank; in American English usage it's generally used to indicate that X is trying to get him to believe something extremely improbable (and not actually true), and at the point where he finally accepts the truth of the improbable thing, X could say "No, I was just putting you on."
Answer: The NOAD describes put someone on as informal for deceive, hoax.
Answer: Put on here means "pretending" or "play-acting".
Comment: The usual infinitive form of the latter is "play-acting".
Answer: The English English equivalent being "taking the piss" -is that fair?

What does "putting someone on" mean?