Is there privacy if you view email boxes in office network?

Question: If I open my Gmail account in office network or chat with someone in Gtalk, since our communications are through a proxy, will anyone be able to see my mails? Even if I log out, will someone be able to snoop my emails?
Comment: For what it's worth, the [New Jersey Supreme Court recently ruled](http://scholar.google.com/scholar_case?case=15115168657962438964&hl=en&as_sdt=2&as_vis=1&oi=scholarr) that personal web-based e-mail accessed on a company computer had an expectation of privacy. This may not help keep your messages private, but you'll have legal recourse if they don't. No mention of chat, though. E-mail on the company mail server is fair game, however.
Comment: All that said, your company owns the equipment and you shouldn't expect it to be private. If it's not something you'd want the person in the next cubicle to overhear you say on the phone, I wouldn't type it in chat or e-mail.
Answer: Gmail uses HTTPS by default.
However, there are still two ways that IT can see you:

If your PC has a trusted certificate owned by IT, they can setup an SSL proxy which resigns using their certificate and capture all traffic.
Your PC might have monitoring software

Either method could allow them to see your authentication cookie, which they could use themselves until you log out.
If they have an evil proxy, they could block logout requests to keep you logged in indefinitely and use your authentication cookie until it expires.
If they have a keylogger on your PC (some companies  do this), they'll have your password, too.
Comment: Always assume your IT department can see anything you do.  And they often do more and more nowadays with the increasing threat of lawsuits and liability.
Comment: Is there a way to check if keylogger has been installed ? I feel someone is mis-using my system.
Comment: Can you pls give me names of the monitoring , key logger apps ? How can I check if they are installed ?
Answer: In theory your IT department could see and log everything - I doubt that they would though as it would be a waste of resources.
As long as you aren't breaking any rules then I don't see this as an issue.
In short, if you are that worried about your personal information, don't use your work network. Use a netbook/laptop and a 3G card for personal internet usage.
Answer: As long as you use https, all the data is secure from the moment it leaves your computer until it reaches Google's servers (and vice versa).
Two caveats:

Gmail forces you to use https to login, but you have to have it enabled if you want it always on. If your not using https (check the address bar on your browser) Google how to enable it - it's straightforward.
Usually IT people can snoop into your PC (using some tracking programs or remote desktop software). If this is the case they have access to everything you do. Furthermore they can even install a key logger and take your password. It really depends on your companies policies.
Comment: "As long as you use https, all the data is secure from the moment it leaves your computer until it reaches Google's servers (and vice versa)."  This is not correct.  As SLaks points out, an office workstation is typically provisioned with a root certificate of the company's proxy server. The proxy server can generate **on demand** an SSL cert for the URL you are trying to get to and present that to your browser. Your session is SSL to the proxy which maintains an SSL session to the intended site on your behalf.  The company absolutely can, and often does, log your SSL traffic.
Comment: @T.Rob - Curious.. what if you use an encrypted SOCKS proxy to funnel your traffic? ;)
Comment: @Jakub - Then you are *probably* safe from the SSL session being snooped.  I initially thought that the SOCK proxy would terminate the SSL session but in doing a little research it seems to always forward the session once created.  That said, it would be simple to terminate the outbound connection on the far side of the SOCKS proxy at an HTTP proxy, whip up a dynamic cert and forward the connection to the actual host. Bear in mind that the SOCKS proxy has to resolve the destination and can be made to resolve any destination at the HTTP proxy.
Comment: In any of these cases where the company proxy generates a dynamic cert, the cert can be inspected to view the issuer, signer and subject.  It should be obvious on inspection that the cert is not the actual cert of the target web site - GMail in this case..


Rails - handling the PayPal IPN callback using the paypal-recurring gem

Question: I am using the paypal-recurring gem to handle recurring payments in a Rails app. The majority of my code is from this excellent Railscast but I also want to add a payment_notification model to accept the IPN callback and store any relevant data. This Railscast goes over how to set up notifications.  However, I am having a hard time figuring out how to send the paypal-recurring gem IPN callback to my PaymentNotification model.
How can I set the :ipn_url to correctly write the IPN callback to my PaymentNotification model.  I tried the following so far:
1) Adding ipn_url: "http://my-app-name.com/payment_notifications" to the process method (under options) or payment_notifications_url
2) Trying the solution suggested at the bottom of this GitHub issue page
3) Using Paypal's Instant Payment Notification (IPN) simulator to send to "http://my-app-name.com/payment_notifications", but I get an error: IPN delivery failed. HTTP error code 401: Unauthorized
EDIT
I have been able to successfully simulate the delivery of the IPN to my payments_notifications_url. Now I just need to figure out how to point the recurring gem to send the ipn to there.
Any pointers would be greatly appreciated. Below is some of my current code. If I am forgetting any relevant parts, please let me know.
PaypalPayment Model
 class PaypalPayment
   def initialize(subscription)
     @subscription = subscription
   end

   def checkout_details
     process :checkout_details
   end

   def checkout_url(options)
     process(:checkout, options).checkout_url
   end

   def make_recurring
     process :request_payment
     process :create_recurring_profile, period: :monthly, frequency: 1, start_at: Time.zone.now
   end

   def cancel_recurring
     process :cancel
   end

 private

   def process(action, options = {})
     options = options.reverse_merge(
       token: @subscription.paypal_payment_token,
       payer_id: @subscription.paypal_customer_token,
       description: @subscription.plan.name,
       amount: @subscription.plan.monthly_price,
       currency: "JPY"
     )
     response = PayPal::Recurring.new(options).send(action)
     raise response.errors.inspect if response.errors.present?
     response
   end
 end

PaymentNotifications Controller
 class PaymentNotificationsController < ApplicationController
   protect_from_forgery :except => [:create]

   def create
     PaymentNotification.create!(:params => params, :status => params[:payment_status], :transaction_id => params[:txn_id])
     render :nothing => true
   end
 end

Comment: can you please help me out here, I am a bit confused on how to cancel the paypal subscription. http://stackoverflow.com/questions/21372793/link-to-paypal-to-cancel-paypal-recurring-rails
Answer: I got it working.  In case anyone in the future runs into trouble with PayPal IPN, here are a few things I had wrong:
1) In my Subscriptions Controller I was calling if @subscription.save instead of if @subscription.save_with_payment so the save_with_payment method was actually never even being called.
2) In the process method I added ipn_url: "https://my-app-name.com/payment_notifications",
   def process(action, options = {})
     options = options.reverse_merge(
       token: @subscription.paypal_payment_token,
       payer_id: @subscription.paypal_customer_token,
       description: @subscription.plan.name,
       amount: @subscription.plan.monthly_price,
       ipn_url: "https://my-app-name.com/payment_notifications",
       currency: "JPY"
    )
     response = PayPal::Recurring.new(options).send(action)
     raise response.errors.inspect if response.errors.present?
     response
   end

3) In PayPal's developer sandbox, click on 'Test Accounts' and then click on the 'Enter Sandbox Test Site' orange button.  Once there, log in with your sandbox seller credentials.  Once inside go to 'My Account' and 'Profile' and under 'Selling Preferences' click on 'Instant Payment Notification Preferences'. Set your notification url to match the url you set up to receive the IPN POST and set message delivery to enabled.


What is flash duration?

Question: When speaking in terms of flash specifications, what is flash duration and how does it impact exposure?
Answer: Simply, it's the duration the flash is actually on, emitting light.
This doesn't impact exposure per se; as long as the same amount of light is emitted, you'll get the same exposure.  But it can affect the result: as the flash duration gets shorter, it has a better ability to freeze motion.
For most photography this won't matter very much.  1/1000s is a typical duration for decent flashguns at full power1, which is more than sufficient to freeze normal motion in a photograph.  Other aspects will have much more bearing on the results; flash power, shutter speed, and so forth.
The one example I can imagine where shorter flash durations would be particularly desirable is for high-speed photography.

Studio strobes are sometimes rated faster, but thanks to their different characteristics, may be slower in practice.  More detail here: http://www.scantips.com/speed.html
Answer: Duration is how long the bulb is on, essentially, and so determines how much light is applied to the subject. The duration would then have an impact on freezing a subject, shorter durations able to freeze faster motion. This is very common in high speed photography such as water drops and the like where you apply a very short burst of light to freeze the drop and/or splash at that brief moment.
I use this technique a lot with water drops, my actual shutter is open for a second and I will apply a very short burst of light to freeze the motion. So, clearly, the room needs to be very dark, but now the shutter is irrelevant to stopping the motion, it's all in the light.
Comment: It should be noted that there is a slight difference in freezing motion with flash vs. with shutter. Your example is excellent, however you might want to note that while the flash will freeze the water drops for the moment they are lit, you'll also get a sense of their motion for the rest of the duration the shutter is open (or the inverse if your using back-curtain flash sync.)
Answer: The duration is exactly that - the amount of time that the flash is lit for. The longer the flash is lit, then the more light can be used to illuminate the scene.
Flash power affects its "guide number" with more powerful flashes having a higher guide number and you can get the same amount of light out of a more powerful flash in a shorter time, which allows you to capture faster moving objects.
Answer: One thing I'd add to Matt's explanation would be that when you use high-speed flash sync (available on most same-brand DSLR+flash combinations) to get shorter shutter times below your camera sync speed (X-sync), the flash actually fires multiple times, so you can't use it to freeze fast moving subjects, because all you'd get would be several phases merged together.
Answer: Time taken by flash to reach its peak level is flash duration.
For easier understanding -
Let's say a flash was lit for 1 second.(From zero to peak and then back to zero).
Then flash duration = 1/2 second.
(From zero to peak).
Comment: As your answer disagrees with the other 4 answers currently on this page, can you cite some reference that suggests your answer is correct? Also, you seem to be assuming that the change in flash intensity is symmetrical, and that isn't even [close to true](http://gock.net/2012/01/flash-durations-small-strobes/).

What is flash duration?


Aside from Homo Sapiens, do the males of any other species care for the offspring of those unrelated to them?

Question: Elsewhere I heard that male Long-tailed Tits will care the offspring of their brother if they're unable to have their own. However, I'd like to know if there is a case of such behavior where the two are unrelated to one another.
Comment: Wolves? How else would the Roman Republic have come into being?
Comment: That particular wolf was of the female persuasion, I believe.
Answer: Yes most commonly in a reciprocal altruism fashion, when you aid any offspring of your species or any in your herd/pack. Crocodiles are known for this. They respond to any crocodile (of their species) distress call from any baby crocodiles. This tends to be an advantage because proximity usually means relatedness and even when it doesn't crocodiles are high enough on the food chain the risk to the males is low compared to the time and effort that would be needed to identify the offspring first.
likewise in herd animals it can be an advantage because it ends up with everyone protecting everyone else's offspring but usually has to be paired with some ability to punish freeloaders/cheaters (individuals who don't help protect the offspring).
Of course you also have males who are tricked into it, after all a male does not always know what are its offspring.
You also have males that will help with a current brood to court the mother, or even unrelated females. Basically they are showing off how good a parent they can be, some believe this is what humans are doing. This is seen in some social primates. It might happen in some birds too but I am not sure.
Comment: Would be great to have a reference for your claims.
Comment: What is cheating/freeloading in this context?
Comment: @Ludi a cheater in this context is a parent that does not help defend unrelated offspring.
Comment: I think most if not all herding species do this.

I watched one video taping a strong adult elephant (who travel alone) helped a baby elephant who was too weak to follow his/her parents and left alone.
Answer: Two examples off the top of my head:
Meerkats (Suricata suricatta).
It's well-known that each member of a meerkat group takes turns minding the pups for the whole group, and this includes both males and females.  Quote from the website http://meerkats.net/info.htm which states this specifically:

babysitter - Stays with the pups while the gang is out foraging for food.                           Different gang members take the responsibility different days, this                            is not domiated by males of females. Generally though the least                            hungry Meerkat will do the babysitting. The alpha female never                            baby-sits. This duty is for Meerkats 6 months or older.

I also found this on the same site:

After sixteen weeks [the pups] are on there own to find there food  Each pup will be taken on by a adult Meerkat which will act as a mentor, who will take the responsibility to teach the pup necessary skills for foraging for food as well as responding to danger.  Male Meerkats tend to mentor male pups and female Meerkats tend to mentor the female pups.  Many of skills Meerkats have are taught by the mentors rather then being instinctual.

(Site author says is an enthusiast compiling information from various sources: very detailed and descriptions square with information I've seen elsewhere, so I think this is a reliable source of information despite its dodgy typing.)
Canada geese (Branta canadensis).
Canada geese often have a "creche" system where one pair of geese at a time will babysit the entire group's goslings while the others forage.  Here's a discussion of this in the Guardian newspaper's Notes and Queries pages from 2011.
https://www.theguardian.com/theguardian/2011/oct/11/childminding-habits-of-canada-geese
(The first letter states that this only occurs on water.  From my own observation, I can say that that's not true.  It may be where Mr Dowsett lives, but I've sometimes seen a whole small flock's goslings asleep on a canal bank together with one pair of adults standing guard over them while the rest forage further along.)


Can 2 different OOV words get the same vector in FastText?

Question: Since FastText sums up the vectors(order is not considered) of an OOV word's subwords, is it possible for two different OOV words to get the same vector ? If so, then can you give an example?
Answer: TL;DR
Theoretically it is possible, but it is unlikely.
1) Uncommon subwords
word1 = 'iiii'
word2 = 'jjjj'

word1_subwords = ['<ii', 'iii', 'iii', 'ii>']
word2_subwords = ['<jj', 'jjj', 'jjj', 'jj>']

In this example, there are basically 6 subwords: ['<ii', '<jj', 'iii', 'jjj', 'ii>', 'jj>'], but these are not common subwords in general. So, there is a possibility that the embedding for all the subwords is the same (e.g. [0,0,...,0,0]), making their sum all the same.
2) Homographs
word1 = 'lie' # meaning: tell something untruthful
word2 = 'lie' # meaning: to rest on a horizontal position

In this example, there are two homograph words. These are different words but they have the same spelling. Since FastText only take syntax into account, they will have the same subword embedding sum.
Comment: If for all practical purposes, fasttext returns unique vectors, then, will incorporating subword order rather than simple summation serve any purpose?


How does Calculus of Variational work in Finite Element Method

Question: I'm learning Finite Element Method. And it is said in a lot of books that Calculus of Variational is the basis of Finite Element Method. But as far as I know, Calculus of Variational is to find a function $f$ which will make the functional $$J=\int_\Omega F(x,y,y')dx$$reach its extremum which means that $$\delta J=0$$
The Finite Element Method is, however, considered as discrete the domain into some tiangles and rewrite the particial difference equation (Take the following equations as example)$$\left\{\begin{aligned} -\Delta u+cu=f\quad ,in \quad\Omega \\ u=g_0\quad ,on\quad\Gamma_D\\\partial_nu=g_1\quad,on\quad\Gamma_N\end{aligned}
\right.$$into its wake/varitional form$$\left\{\begin{aligned} \int_\Omega\nabla u \cdot \nabla v+c\int_\Omega u v=\int_\Omega f v + \int_{\Gamma_N} g_1 v \\ u=g_0\quad ,on\quad\Gamma_D\end{aligned}\right.$$in which u is trial function while v is test function. We donate $u$ in its discrete version $u_h$ with the so called tent function $$u_h=\sum_{j=1}^{N}u_h(p_j)\phi_j$$ in which $p_j$ is the vertex nodes and $\phi_j$ is a "tent function" which means$$\phi_i(p_j)=\delta_{ij}=\left\{\begin{aligned} 1\quad i=j\\0\quad i\not=j\end {aligned}\right.$$Substitute v with $\phi_j$ we get $$\sum_{j \in Ind }(\int_\Omega\nabla \phi_j \cdot \nabla \phi_i+c\int_\Omega \phi_j \phi_i)u_j=\int_\Omega f \phi_i + \int_{\Gamma_N} g_1 \phi_i-\sum_{j \in Dir }(\int_\Omega\nabla \phi_j \cdot \nabla \phi_i+c\int_\Omega \phi_j \phi_i)g_0(p_j)$$
in which Ind denote the independent node set while Dir denote the Dirichlet node set. From the equations above, I cannot find any link between the Calculus of Variational and Finite Element Method. Could anyone please explain how  does Calculus of Variational work in Finite Element Method?
Comment: check out https://staff.ti.bfh.ch/sha1/fem/VarFEM/VarFEM.pdf. Also the last couple of lectures of https://www.coursera.org/course/scientificcomp covers FE and introduces CoV but not in a rigorous way.
Answer: The answer to your question comes from your weak/variational form. We can phrase a calculus of variations problem with a specific functional such that $\delta J = 0$ implies satisfying the weak form.
This Wikiversity article explores this further with examples. https://en.wikiversity.org/wiki/Introduction_to_finite_elements/Calculus_of_variations
Answer: The common one-dimensional variational principle is explained once more at this place:
Intuition behind variational principle
What we need, however, is a variational principle in three dimensions.
Let's consider in particular the following one:
$$
E = \iiint_D \left\{\left(\frac{\partial \phi}{\partial x}\right)^2+\left(\frac{\partial \phi}{\partial y}\right)^2
+\left(\frac{\partial \phi}{\partial z}\right)^2\right\}dV = \mbox{minimum}(\phi)
$$
Let $\,\phi = \psi+\epsilon.f$ , with $\,\epsilon\,$ a "small" disturbance and $\,fx,y,z)\,$ a completely arbitrary function,
which is zero at the boundaries $\partial D$ of the domain of interest. In this way the 3-D integral
has become an ordinary one-dimensional function $\,E(\epsilon)$ , which can be simply differentiated to find the minimum,
especially at $\,\epsilon = 0$ , where $\,\psi = \phi$ :
$$
\left.\frac{d}{d\epsilon}\right|_{\Large \epsilon=0}\;\iiint_D \left\{\left[\frac{\partial (\psi+\epsilon.f)}{\partial x}\right]^2
+\left[\frac{\partial (\psi+\epsilon.f)}{\partial y}\right]^2+\left[\frac{\partial (\psi+\epsilon.f)}{\partial z}\right]^2\right\}dV = 0
\quad \Longleftrightarrow \\
2\iiint_D \left\{\frac{\partial \psi}{\partial x}\frac{\partial f}{\partial x}
+\frac{\partial\psi}{\partial y}\frac{\partial f}{\partial y}+\frac{\partial \psi}{\partial z}\frac{\partial f}{\partial z}\right\}dV = 0
$$
With the rues for differentiation of a product of functions:
$$
\frac{\partial}{\partial x}\left(f\frac{\partial \psi}{\partial x}\right) =
\frac{\partial f}{\partial x}\frac{\partial\psi}{\partial x} + f\,\frac{\partial^2\psi}{\partial x^2} \\
\frac{\partial}{\partial y}\left(f\frac{\partial \psi}{\partial y}\right) =
\frac{\partial f}{\partial y}\frac{\partial\psi}{\partial y} + f\,\frac{\partial^2\psi}{\partial y^2} \\
\frac{\partial}{\partial z}\left(f\frac{\partial \psi}{\partial z}\right) =
\frac{\partial f}{\partial z}\frac{\partial\psi}{\partial z} + f\,\frac{\partial^2\psi}{\partial x^2}
$$
Giving:
$$
\iiint_D \left\{\frac{\partial \psi}{\partial x}\frac{\partial f}{\partial x}
+\frac{\partial\psi}{\partial y}\frac{\partial f}{\partial y}+\frac{\partial \psi}{\partial z}\frac{\partial f}{\partial z}\right\}dV = \\
\iiint_D f\left\{\frac{\partial^2\psi}{\partial x^2}+\frac{\partial^2\psi}{\partial y^2}+\frac{\partial^2\psi}{\partial z^2}\right\}dV \\
- \iiint_D \left\{\frac{\partial}{\partial x}\left(f\frac{\partial \psi}{\partial x}\right)
+\frac{\partial}{\partial y}\left(f\frac{\partial \psi}{\partial y}\right)+\frac{\partial}{\partial z}\left(f\frac{\partial \psi}{\partial z}\right)\right\}dV
$$
The last integral can be simplified with help of the divergence theorem:
$$
\iiint_D \left\{\frac{\partial}{\partial x}\left(f\frac{\partial \psi}{\partial x}\right)
+\frac{\partial}{\partial y}\left(f\frac{\partial \psi}{\partial y}\right)
+\frac{\partial}{\partial z}\left(f\frac{\partial \psi}{\partial z}\right)\right\}dV = \\
\bigcirc\kern-1.4em\iint_{\partial D} f\left\{\left(\frac{\partial \psi}{\partial x}\right)dA_x
+\left(\frac{\partial \psi}{\partial y}\right)dA_y+\left(\frac{\partial \psi}{\partial z}\right)dA_z\right\} = 0
$$
This area integral is zero because the test function $\,f\,$ is zero a the boundaries. Furthermore $\,\psi = \phi$ , so we are left with:
$$
\iiint_D \left\{\left(\frac{\partial \phi}{\partial x}\right)^2+\left(\frac{\partial \phi}{\partial y}\right)^2
+\left(\frac{\partial \phi}{\partial z}\right)^2\right\}dV = \mbox{minimum}(\phi) \quad \Longleftrightarrow \\
\iiint_D f\left\{\frac{\partial^2\phi}{\partial x^2}+\frac{\partial^2\phi}{\partial y^2}+\frac{\partial^2\phi}{\partial z^2}\right\}dV = 0
$$
For an anbitrary function $\,f(x,y,z)$ . Conclusion:
$$
\frac{\partial^2\phi}{\partial x^2}+\frac{\partial^2\phi}{\partial y^2}+\frac{\partial^2\phi}{\partial z^2} = 0
$$
This means that the Laplace equation is fulfilled. Can you proceed now for the somewhat more complicated problem, as described in your question?


What's the difference between eternal inflation and chaotic inflation?

Question: Is there a real difference between eternal inflation and "chaotic inflation" theories?
Answer: So the 'old' model of inflation was based on the idea that a scalar field (the inflaton) was trapped initially in some meta-stable vacuum. If it's energy density dominates the Universe at this time then the Universe inflates. This continues until the field tunnels out of this vacuum and inflation ends. This leads to bubble nucleation as different patches of the Universe tunnel into the stable state at different times and expand at the speed of light. Reheating in this model occurs when bubble walls collide, thermalising the latent energy stored in these walls. There were problems with this model as it produced a too inhomogeneous Universe.
The 'new' model of inflation basically proposed the idea that after this tunnelling process the scalar field could still be overdamped and slow rolling thus allowing for inflation to continue. This means that inflation occurs within a single bubble thus our Universe exists within this single bubble. This eradicates the inhomogeneities within our observable Universe and reheating occurs through the coherent oscillations of the scalar field about the true minimum.
Both these models where inspired by a GUT phase transition, which is quite often a first order phase transition due to the fermion and boson content.
'Chaotic' inflation is the idea that we need not have the scalar field initially trapped in some meta-stable vacuum. At the Planck era it is likely that all degrees of freedom have Planckian energies (chaotic initial conditions) and regions in which the potential energy of the inflaton dominates will trigger a period of inflation. This typically requires Planckian field values.
Eternal inflation is a consequence of the inflaton's quantum fluctuations. These fluctuations can kick the inflaton around in it's potential and can indeed drive the inflaton field back up the potential to a higher field value. So inflation will continue indefinitely in some patches. This eternal inflation picture generically results in bubbles of the Universe which are expanding at different (exponential) rates and so most of the volume of the Universe is inflating. This arguably, makes it likely that we find ourselves in a Universe which inflated. This seems to be an unavoidable feature of chaotic models.
I realise that this answer is a little late, but hopefully it helps.
Comment: The first part is good, but at the end you seem to be implying that eternal inflation is just a consequence of chaotic inflation.  Whereas some chaotic inflation models are eternal and some are not.  And many eternal inflation models are not chaotic.


Governance Proxy vs Delegating Voting

Question: I would like to allow another account to vote in governance on my behalf. What are the trade offs between setting up a governance proxy vs delegating voting power?
Answer: If an account sets a governance proxy, it basically allows the proxy to submit transactions related to any governance related pallet. These are Democracy, Council, Technical Committee, Phragmen Election, Treasury, Bounties, Tips, Utility and Child Bounties pallets.
On the other hand, delegating voting power only applies to the Democracy pallet. It consists of giving the voting and conviction power to another account for voting in referenda. So any democracy vote performed by the delegated account will result in an additional vote from the delegating account.
In summary, by setting a governance proxy you are giving a lot of more control of your tokens and action flexibility (dozens of different calls and functionality) than just delegating your voting power to another account (one functionality).
Finally, it is noteworthy that in OpenGov (Governance 2.0), the concept of multirole delegation is introduced. With this, you can specify a different delegate for every class of referendum in the system.

Governance Proxy vs Delegating Voting


Indefinite integral of $1/(1+x^2)$

Question: I was studying calculus 1 other day, in the subject of integral of partial fractions, when I perceived that the well know indefinite integral:
$$ \int \dfrac{dx}{1+x^2} $$
could be done another way, just by factoring it in $\mathbb{C}[x]$.
So I did $1+x^2=(x+i)(x-i)$.
Hence
$$ \dfrac{1}{1+x^2}=\dfrac{A(x-i)+B(x+i)}{1+x^2} $$ for some A, B constants.
It is easy to see that $A=i/2$ and $B=-i/2$.
Then $$ \int \dfrac{dx}{1+x^2}=\int \left(\dfrac{i/2}{x+i}+\dfrac{-i/2}{x-i} \right) dx = \dfrac{i}{2}\ln{|x+i|}-\dfrac{i}{2}\ln{|x-i|}+c=$$ $$=\dfrac{i}{2}\ln{\left|\dfrac{x+i}{x-i}\right|}+c$$
Finally, my question is: Am I allowed to factorize a polynomial in $\mathbb{C}[x]$ to integrate it, and if I am, what is the relation between the real indefinite integral $\tan^{-1}$ and $\dfrac{i}{2}\ln{\left|\dfrac{x+i}{x-i}\right|}$.
Thank you in advance.
Comment: Have you seen [this](http://functions.wolfram.com/ElementaryFunctions/ArcTan/27/02/01/0001/)? BTW: if you're dealing with complex numbers in your partial fractions, you really can't use $\ln\,|x|$ as an antiderivative anymore, and some more care is needed.
Comment: @J.M. Hmm. I think this question is useless as I could googled it and found an easy answer. Thanks.
Comment: If you have found an easy answer (and if it adds anything to what has already been posted here), you should post it, or a link to it, here.
Answer: What you've done is correct as far as it goes.  The big complication, which I think might just be the only reason why complex numbers are usually avoided in first-year calculus courses, is that the logarithm ($\ln$ or $\log$) function and the $\arctan$ function are multiple-valued.  The multiple-valued nature of the arctangent is mentioned in the trigometry course you took before taking calculus; that of the logarithm is apparent when you learn that $e^{i\theta} = \cos\theta + i\sin\theta$, recallying that $\cos$ and $\sin$ are not one-to-one.  Once you've seen that exponential functions are trigonometric functions, it might not be too surprising that logarithmic functions are inverse-trigonometric functions.
Later addition: If you write
$$
\begin{align}
\cos x & = \frac{e^{ix}+e^{-ix}}{2} \\  \\  \\
\sin x & = \frac{e^{ix}-e^{-ix}}{2i}
\end{align}
$$
you can then find $y=\tan x$ as a function of $e^{ix}$.  Multiplying the numerator and denominator by $e^{ix}$ you get an expression in which $e^{2ix}$ occurse twice, and with further algebra, you can solve for $e^{2ix}$ and then for $x$ as a function of $y$, if you allow multiple-valued inverse functions.
The conventional way of defining the concept of "function" for the past century or so rules out "multiple-valued" functions, so any use of that term will cause some mathematicians some discomfort.
Comment: as J. M. noted above, the absolute value in the argument of the logarithm is incorrect.
Comment: Thank you. Now that you mentioned this, I can see the relationship, and it's not complicated how I thought it would be.

Indefinite integral of $1/(1+x^2)$


Detect if characters are selected in text editor

Question: Further to my previous question (print number and index of selected lines in text editor), i'd like to know if it's possible to detect if characters are selected in text editor.
Answer: The selection spans from line current_line_index beginning at current_character to select_line ending at select_end_character.
If these coincide, there is no character selected.
So given you know the line and column of your character you can check yourself.
However current_character and select_end_character are byte offsets.
Python uses unicode points. So unless you are using pure ASCII you need to convert the char position to byte offset.
See https://en.wikipedia.org/wiki/UTF-8
The conversion is a bit cumbersome. Something like
from itertools import islice

txt_line = "\u03A0\u2764\u2600\u2602This is a Test"
col = 9
print(txt_line)

ubounds = [0x80, 0x800, 0x10000, 0x110000]
offset = 0

#char is actually an immutable newly created string...
for char in islice(txt_line, 0, col):
    code_point = ord(char)
    for size, ub in enumerate(ubounds):
        if code_point < ub:
            offset += size + 1
            break

print(
    "byte at %d: %d - char: %d" % (
        offset,
        bytes(txt_line, 'utf-8')[offset],
        ord(txt_line[col])
    )
)

Comment: Thank you for these explanations, thanks to you I managed to make what I wished. Thank you very much.


Can we build an native client app in C++ which can run on chrome OS?

Question: Can we build an native client app in C++ which can run on chrome OS?
I have checked native client app documentation it says it will be soon supporing ChromeOS. Currently it is supporting for chrome browser on windows and MAC.
I want is it possible on Chromium OS??
Please help me out.
Answer: You can.
See the app "PNaCl Examples" in the Chrome Web Store. It runs on my Chromebook with Version 31.0.1650.35 beta. I think PNaCl is built-in as of Version 31. However, NaCl is much older, and probably works with even earlier versions.


Why can Random Forest "handle missing values and cardinality well compared to linear regression"?

Question: I've read a question comparing Linear Regression and Random Forest Regression. I was supposed to choose between then and solve a problem (=predict prices). The question mentioned that "Random Forest can also handle missing values and cardinality well compared to linear regression". Why is that? How does that happen?
Answer: Generally, random forests are a much more sophisticated method than linear regression: it's an ensemble method with multiple decision trees, and a single decision tree is already a much more flexible method than linear regression.

With linear regression, every instance considered must have all its values defined. There are several ways in which decision tree can handle missing values during training.
I assume that cardinality refers to the number of features. Linear regression must include all the features in the linear model, and this can cause various problems (correlated or spurious features, overfitting). By contrast decision trees can select their features, and this is one of the features which make random forests a good ensemble method.


Diablo 3, loot system, PS4

Question: So me and a friend have been playing on the PS4 Diablo 3 for a week or so, and he started before me and was a higher level, and I was a lower level, but then I passed him. Now were both in the paragon levels (I'm still higher level) all of my armor is legendary, in sets, and I have an ancient weapon, he only has a couple, I'm way weaker than him (I'm a demon Hunter and he's a wizard) but 8/10 of the loot goes to me 90% of the time and I get all of the legendaries and when he gets one finally I  still also get one. I know the loot system follows the levels and the class. And I also know the game favors the lower levels, or weaker. So why is this happening? Is there any way to change it?
(Sorry if this is really stupid but I honestly can't find anything)
Comment: Loot drops are individual, not party based, and there is nothing you can do to influence them to your favor. I also don't believe the game "favors" anyone because of lower levels.
Comment: This is anecdotal, but ive been playing seasonal (S10) with a buddy, both at paragon 800+, and he has 8 primals while i have 0. If this game wants you to be sad, it will make you sad, and you will get everything except what you want, all the time. Its brutal, but makes it all the more satisfying when you DO get what you want. Then you think, *oh its not so random, i should try harder!* but 4 hours later youre back where you started, cursing the game, and Kadala, and Kanai, and the gods of RNG.
Answer: VanBuzzKill nailed it on the head, but let's go a little in depth for an answer:
Loot drops on a per-player basis. Let's say, for instance, that you and your friend are fighting the Butcher. Once you kill him, great and bountiful loot and blood spill around the arena. The loot drops that you see will not be what your friend sees. For you, perhaps a Manald Heal ring drops; for your friend, perhaps a Unity set ring drops.
There is very little you can do to influence this, as there are no items or mechanics that can game the system like this.
The only way the game favors a lower level player in co-op is by upping their skills/damage numbers a bit until they reach a certain level. This has nothing to do with item drop rates.
Comment: High Magic Find seems like a rare thing to have though, and would need a specific gear set it would see. Besides, only 10% of a characters magic find amount contributes to legendary drop rates, so their magic find would need to be enormous.
Comment: I cant find a better source than [this wiki blurb](https://www.diablowiki.net/Magic_find) at the moment, but doesn't Magic Find stat increase item drops (per player), and slightly raise odds of legendaries? Linked post says its a minor benefit, most people just push higher torments / rifts, but it might explain a little of OP's discrepancy with his friend if he has high MF.
Comment: Agreed, makes sense

Diablo 3, loot system, PS4


How do I Disable Android Device Manager on Sold Device?

Question: I am a GSuite user and a ZTE Axon 7 device that I recently sold via SWAPPA was setup with Android Device Manager. I did a factory reset on the device, but when the buyer powered on the device, he said that the device indicated that it was already associated with a Google account and he would need the credentials to configure it. I went into the standard Find my Device and tried to remove it, and it appeared to have been removed from whatever screen I was on, but the buyer is still complaining. I am still seeing the device here: https://www.google.com/android/find I wondered if GSuite's device management might be at play, and just went there to "delete" it. Am wondering what else I can do?
Answer: An answer that works... Give him your email and password to unlock the device. Once they are in and working, change your password.
Yes, it has potential risks, but 99.99% of the time this would work out just fine.


Do i need miners for my own cryprocurrency which is based on ethereum?

Question: I have a question. Do i need to find miners for my own cryprocurrency which is based on ethereum or ethereum will provide them for their fee to let transactions with my currency be accepted?
Answer: You do not need miners specifically for your Ethereum-powered coin/token. Transfers of your token happen via transactions to your smart contract. Those transactions, like all Ethereum transactions, will be mined by Ethereum miners.
Comment: btw, miners have a stable profit by mining ethereum. And they have a reward in ETC. My coin will not cost so much like ETH but gonna be mined with it as you said. Profit from mining depends on currency cost. How ethereum handle a reward for miners who are mining a lot of coins which has a low cost and they are powered by ethereum?
Comment: The miners get paid in ETH. It doesn't matrer what the transactions are.


How to keep artboards in Adobe Illustrator after closing your project?

Question: I am using Adobe Illustrator CS6. My goal is to make 40 A4 artboards for print all in a single project, but when I exit the program and open it again, they get replaced with guides. Is there are way to let Illustrator keep your artboards? If I had to make small adjustments before printing, I would need to waste extra time redrawing each artboard again.
Answer: I don't have access to CS6 any more so I can't check this for sure, however it sounds like you might be saving your documents in a legacy format (before CS6) which might not support multiple art-boards properly, or in the same way that CS6 does.
When you save the AI file, make sure you choose the correct version, i.e. to save in Illustrator CS6 format*
If try to save a multiple art-board document from Illustrator CC to CS3 for example, I can reproduce the problem. Artboards are indeed converted to guides when reopening the file.
*This screenshot is from Illustrator CC, but it should be similar in CS6.
Answer: Sounds like you might be doing the wrong thing. AI does not just replace artboards with guides, there's no such thing :) Make sure you read the official documentation and properly use the Arboards feature: https://helpx.adobe.com/illustrator/using/using-multiple-artboards.html


What are the pros and cons of different fully recoverable mooring systems?

Question: Fully recoverable mooring systems can be important in oceanic environments when we don't want to leave anything behind.  What are the pros and cons of different recoverable mooring designs like landers, tripod frames (e.g. https://doi.org/10.1111/2041-210X.13404), and acoustic release rope canisters?  What are the maximum deployment depths for the different systems?
Answer: There should be no depth limitation for fully recoverable mooring system. IMO, it is only a question of budget.
A 'normal' deep mooring system (say bottom depth 1000 m, recorder 150 m over bottom) with no surface expression has typically a dead weight and a chain that are left on bottom.
To recover also dead weight and chain you need not only a surface expression, or a reliable and proper constructed release rope cannister, but also a vessel that has a winch that can pull in the weight and hold 1 km of rope, in addition to a A-frame/Crane to lift the weight on board.
AFAIK, most research vessels (that are usually expensive) and deep-see trawlers (not sure what they would charge) would be suited to recover full moorings. That is why I say, it is a question of budget.
Concerning Pro and Cons of different mooring systems, it depends on application and deployment depth. IOW, how close to the bottom do you wanted the hydrophone to be. For this to determine, you should inspect the sound speed profile. In deep water where you have upward refracting propagation, you wanted the hydrophone well above the bottom, otherwise you will miss the direct path of even close-by bottom feeding cetaceans and will detect only surface reflections. So, ranging is pretty tough.
In the application referred to by the cited Goossens paper, bottom mounted hydrophones maybe OK.
When designing bottom moored recorder you must consider also hostile interaction. A system that is moored in 800 m with the hydrophone 150 m over the bottom can easier be picked up by a deep-sea trawler than a trawl-save construction where the fishing net simply slides of the system.
Answer: Instead of making the mooring fully recoverable I know some research groups have used natural/degradable materials that are left on the sea bottom. I think a coffee beans bag filled with gravel/rocks was used for the dead weight along with a sturdy hemp rope.
I have not tested this myself and would probably ask around for details/lessons learned before doing it this way.
Answer: Coastal processes and sand movement can thwart weight recovery devices if they become buried!
I deployed a handful of homemade rope canisters in depths <100 m (see underater video of one in action here), and suffered a few losses in an area along some sand dunes. Fortunately, my acoustic release and instrument were recovered, but the buckets were either partially or completely filled with sand and in one case, I suspect the entire weight retrieval system was buried in sand after a 3 month deployment. We used a heavy-duty winch to try to recover the weights, but eventually the line snapped under tension (dangerous!) and the weights were never recovered. Had the sand accumulated enough to cover the acoustic release, I suspect we would have lost everything. Using multiple releases can help to prevent total losses, but they come at a considerable expense.
Answer: Other things to consider include:

Colonization rates in your deployment environment (in other words, when do you expect encrusting organisms to attach to your gear/hydrophones? Best be down to clean or exchange them before this happens as this can affect your acoustic recordings)
Consider any noise (chains clanking, etc.) that might contaminate your acoustic recordings
Acoustic releases useful but expensive, and not always reliable.
Consider the flow of your deployment environment. If you're in a tidal rapid, for example, your gear may drift as it surfaces and not 'pop up' (via acoustic release) quite where you expect it to. Also, if you're in a high-flow environment, you should expect to use more weight on your tripod/lander.


Downloaded Songs/Music Videos Stopped Playing After iOS 10.3.1 Update

Question: After upgrading to iOS 10.3.1, my iPad Air 2 is no longer playing music videos (TV icon), which I downloaded using Syncios. I can see that the music videos are there on my device, but they won't play.
Answer: I have seen this problem mentioned with a few other third-party audio/video apps. The solution offered was to delete the local song, video or audiobook from your iPad, then re-download it. This is a bug caused by iOS 10.3.
Comment: Thanks for response, however the problem is that the song or music video does not show up in the Ipad after you  transfer from Syncios.
Comment: I had a feeling that might be the case after I looked up what Syncios actually was. Sorry I couldn't be of help.


nginx 1.8.1 only works with default root

Question: I have Cent OS 6.6 with nginx 1.8.1 installed. It seems like if I change the root in the conf file to something other than the default '/usr/share/nginx' it gives an error 403 Permission denied. I have even given 777 permission to the other folder and files and it still doesn't work. I tried changing the user in nginx to 'apache', 'nginx' or'root' and that doesn't work either. I have disabled SELinux too. The folder I was trying to get it to work is '/var/www/'. Is there some enforcement in this version of nginx so it only works with '/usr/share/nginx' root?
Comment: 1.) "[...]Is there some enforcement in this version of nginx so it only works with '/usr/share/nginx' root?[...]" I strongly doubt this. 2.) Doing `chmod 777` is a _big  no-go_. Don't do this!
Answer: Use an appropriate directory to store your web documents, so that you do not need to disable SELinux.
These directories are:

/var/www
/srv/www

And if you have problems, don't grope around blindly; check the logs to find out the specific problem.
Answer: Even though I disabled SELinux by modifying the config file it was still enabled. I had to run the command 'setenforce Permissive' and it worked!!
Comment: Maybe it would be wise to think about if disabling SELinux is the way to go, or it would be more appropriate to edit the config accordingly.


What does Halacha say about human shields

Question: What is the Torah approach to when terrorists are using civilians as human shields? Are you allowed to bomb the building?
Comment: Thanks for accepting my answer. Feel free to upvote it as well.
Answer: There is no ancient commentary on causing civilian casualties in a just war. [Rav J. David Bleich, Contemporary Halakhic Problems 3, p 277]  Some interpret that to mean the answer is obvious: Yes, civilians may be killed with soldiers if it is unavoidable in a defensive war. The Talmud notes:

Once permission has been granted to an angel to destroy, it does not distinguish between righteous and wicked. [Bava Kamma 60a]

Thus, the default position is that the innocent perish with the guilty.  Indeed, before the Exodus, we had to distinguish ourselves from the Egyptians to prevent our own firstborn from dying.  Also, Abraham had to ask God to save Sodom and Gomorrah for the sake of the righteous in it. [Gen. 18:23-32]  It was not an automatic thing.  Finally, the Talmud says, "kill him first", without adding "but with no collateral damage".  The Maharal concludes:

The Torah allows war when we are attacked, and in responding, we are allowed to not distinguish between the guilty and the innocent. [Gur Aryeh to Gen. 34:13]

However, warning may be given.  The Torah says: When you approach a town to attack it, you shall offer it terms of peace.[Deuteronomy 20:10] In commenting, the Midrash tells us:

Rav Shmuel bar Naḥman said: What did Joshua do [when he was about to enter the Promised Land]? He would publish an edict in every place [of the Land of Canaan] he went to conquer, on which he wrote: "Whoever wants to go, let him go; whoever wants to make peace with us, let him make peace; and whoever wants to make war shall make war."

-The Girgashites vacated and departed from there, and the Holy One, blessed be He, gave them a land as beautiful as their native land, namely Africa.
-The Gibeonites desired to make peace with Israel, and Joshua made peace with them.
-However, the 31 Canaanite kings came to battle with Joshua, and the Holy One blessed be He caused them to fall.  [Deut. R. 5:14]
Likewise, King Saul advised the Kenites to leave their homes to avoid being harmed in the war with Amalek:

And Saul said to the Kenites, "Go, depart, get down from among the Amalekites, otherwise I might destroy you with them; for you showed kindness to all the people of Israel, when they came out of Egypt."  So the Kenites departed from among the Amalekites... And Saul defeated the Amalekites... [1 Samuel 15:6-7]

So Saul was prepared to endanger civilians in the course of war, and he was not censured for this.
Answer: Not a full answer but we can infer from the Mizrachi his opinion on this matter.
The Torah tells us that Yaakov was very afraid of Eisav (Genesis 32:8). Rashi (ad loc.) explains that he was afraid that he would kill, or be killed. The Mizrachi (ad loc.) is bothered, that why was he afraid to kill? He's allowed to kill in self-defense!
He suggests that Yaakov was afraid of killing the 400 men that were with Eisav. He says if they were being forced by Eisav to accompany him, they were innocent civilians. Yaakov was afraid of killing them in self-defense, for it would be forbidden to kill them, as they were being forced against their will to attack Yaakov.
He ends up rejecting this approach, for if the men were being forced to attack Yaakov, they should have given up their lives rather than kill someone to save their own life. Since they were unjustified in "innocently" attacking Yaakov, he would have been allowed to kill them in self-defense.
I heard from Rav Tzvi Berkowitz of Ner Yisroel that if it were a situation where they were passively endangering someone's life, like a human shield, we can infer from the Mizrachi that it would be forbidden to kill them, even in self-defense.
The Gur Aryeh ad loc. says similar to the Mizrachi, but the Yefeh Toar to Bereishis Rabbah 76:2 questions the Mizrachi's premise.
Answer: The only rules in the Torah about treatment of the enemy are

Don't cut down fruit trees while besieging.
Offer the enemy the opportunity to flee or surrender and be enserfed.
Special rules about capturing a woman but there is a dispute about what they actually are.

There is no Geneva convention or anything like it.
Comment: See R. Broyde's essay -- the majority of poskim say the additional requirement is *whatever is considered normative for war at the time and place.*


SNR from sampled signal

Question: Is there any procedure described, or some example code (in Matlab) to calculate SNR from the sampled real signal?
Comment: Not without some underlying assumptions and a lot more detail. The general answer is "no".
Comment: You need some assumptions about the noise and the signal and how they are different. For example if you already know that this is a DC signal, you can simply calculate the mean and call it "signal" and the subtract the mean from the signal and call it "noise".
Comment: What underlaying assumptions are needed?
Comment: I have a data = [sample_time, values], The sample_time have a constant time step and the sampled values are expected to be a noisy DC signal.
Answer: If you have a replica "perfect" copy of the signal, I use the procedure of carefully time aligning the signal (depending on the SNR floor required) and then using the correlation coefficient to determine the SNR. I have done this effectively with over 150 dB dynamic range (when such precision required) which requires much more expertise in resampling to properly adjust for time offsets. For lower ranges (SNR's < 40 dB) the process is quite simple and straight forward (Including using the peak of the cross-corrrelation function with the signal sufficiently interpolated to find the local peak which would be the time-aligned correlation coefficient once properly normalized such that infinite SNR corresponds to $\rho=1$).
Further details on this approach are provided here:
Computing the normalized correlation coefficient:
https://dsp.stackexchange.com/a/30854/21048
Converting correlation coefficient to SNR:
How can I find SNR, PEAQ, and ODG values by comparing two audios?
If there are both time and frequency offsets:
SNR estimation prior to demodulation?
Alternate approaches that use the spectrum from an FFT to compare the power spectral in band to the noise floor given by the power spectral density out of band are flawed an inaccurate for all cases except for single tone testing as they assume the noise spectrum in band is the same as the noise spectrum out of band. The correlation approach is very robust and includes the effects of noise and all other distortions such as non-linearities, inter-symbol interference, reflections, etc.
Answer: Given your additional detail that the sampled values are expected to be a noisy DC signal, you can follow a simple method to compute the SNR.
For a noisy DC signal, the Signal-to-Noise Ratio (SNR) can be calculated as the ratio of the square of the mean of the signal (which is the DC component) to the variance of the signal (which is the noise).
Here is an example Matlab code to compute the SNR:
<code>% Assuming 'data' is your signal
data = [sample_time, values];

% Extract the signal values
signal_values = data(:,2);

% Calculate the DC component (mean of the signal)
dc_component = mean(signal_values);

% Calculate the noise (standard deviation of the signal)
noise = std(signal_values);

% Calculate the SNR in dB
snr = 20*log10(dc_component / noise);
</code>
This is a simple way to calculate SNR, but it might not be applicable in all cases, particularly if the signal is not stationary or if there are other sources of noise. For a more robust estimate, you might want to consider applying a periodogram or other spectral estimation method, but those are beyond the scope of this simple example.
Hope this helps!

SNR from sampled signal


can virtualbox be used to access a locked website without being tracked and without getting detected of using a virtual machine?

Question: I need to open a website where access is denied in my country. I would like to know if virtualbox can be used to solve this issue. my concern is if they can detect that I am using a virtual machine. if yes, is there any way to hide my location and not being detected of using the VM?
Comment: Who blocks you? The website, or your goverment? How is the block implemented? What do you think will change when you use a VM?
Comment: Questions by @vidarlo are important. This is an X Y problem. Try to outline more detail about the problem you are trying to solve, then we can answer questions about your proposed solution
Comment: thank you guys for your replies! the website itself blocked the access, not the government. I mentioned virtuabox because I thought It uses a server that would show a different location. The block is due to my location because when I travel abroad, I can access it normally. I need to find a way to hide my location. I tried VPN but didn't work.
Comment: A virtual machine _on your real machine_ is still on your machine and doesn't help. A virtual machine _on a real machine provided by someone somewhere else_ is somewhere else and may help; this is often called VPS = Virtual Private Server or nowadays just 'cloud'. Examples: AWS, MS Azure, GCP, DigitalOcean, etc. It doesn't matter which of the many VM technologies you use (VirtualBox, VMWare, Xen, HyperV, KVM, etc) only where the underlying real machine is.
Answer: No, because virtual box just nests another computer inside the computer you are already using. It still uses the same network to connect to the website you want to access and will be subject to the same controls and monitoring as the host machine. Whether your use of a virtual box VM will be visible on the network / how you prevent a forensic examination of your computer revealing it has or had virtual box installed are more complex questions but I believe a discussion of these would be significantly beyond your current technical abilities.
Answer: You need a vpn or proxy in a different country: the most common are ones sold to non-Americans to access US Netflix, exactly the same use case as yours.
Ordinary "work" vpns are not helpful in this case: work's IP addresses are likely to be in the same country as you are (;-))


Share Record with profiles

Question: While creating a new record for my custom object I capture (Checkboxes) if this record is to be shared with a particular profile/group or not . for example If a community user will have access or not , If an agent can see it or not etc .. and show the results to the end user as per the Profile/group while querying from database. I am afraid that this approach is incorrect because in future i may have
Answer: You can't share to a Profile, only a User, Group, or Role (and combinations thereof). You'd have to create some sort of integration to add/remove users to Public Groups based on their profile, then you could share records with that Public Group. If you do this, you won't have to worry about filtering by using the checkboxes, which will eventually have non-selective errors, etc, and you won't have to write a full custom interface to deal with this object.

Share Record with profiles


Is it true that shoots will grow only when the root system is fully established?

Question: If you have two flower pods and one is double the size, will the plant in the double sized pod first fill out the whole pod with roots before its shoot starts growing?
Comment: That's not been my experience. Roots need sugar, from leaves to grow. The root/leaf ratio probably varies with pot size, but not to the extreme you suggest.
Answer: No. Generally, when a seed germinates, it produces what will be its first root - often, a stem or shoot will start growing within a few days, even though there is not yet much root material. As the seedling produces more roots, the topgrowth increases too, and that will be the same in ether size of pod you're using, though the one in the smaller pod will need to be moved into something bigger before the other one.


What novel had forced inter-racial marriages to prevent discrimination?

Question: I think that the protagonist had fallen in love with someone of their own race, which is obviously forbidden love.  This book may also have had in it a law that forbade casting a shadow on solar panels too, but I may just be confusing it with another.
Comment: +1 This sounds like an interesting premise, whatever it is, lol.
Answer: It wasn't the main point of the story, but this was an element of Piers Anthony's 'Ghost'; the 'miscegenation act' was imposed to force all of the races to end up melding together, in effect ending discrimination, as well as reducing population increase.  In effect, it simply restricted anyone of a clearly defined race from engaging in reproductive sexual activity with someone of the same, or very close, race.
The exception is made for during space flight, where such rules are relaxed to facilitate relaxation in general in the stressful environment.  A women on board of the same race as the protagonist, however, should therefore be accessible to our hero... And she promptly kills herself, as she cannot reconcile this possibility with her view of the hero as a 'father-like' figure.
As to the 'Shadow on solar panel section'.. Does this sound like it might be what you were referring to? :

The top of the building was covered with solar collectors, each unit enclosed by clear plastic so as to make an oven effect. The sunlight entered freely, [....]  Only a narrow walkway remained for access to the blimp dock, and a sign said WATCH YOUR SHADOW.

Dunno about it being illegal, but clearly frowned upon.
Comment: Yes, Piers Anthony's Ghost has a "miscegenation act." As I remember it, the ban is not on relationships between people of the same race, only on such couples having children. There's a point made in the book that although the stated purpose for the act was to eliminate racism, part of the real agenda was to decrease population growth.
Comment: @lohoris - Sleep? Don't even blink...
Comment: You are quite correct; it was on reproduction, not sex (although it looked like there was a Taboo with same-race sex, based on behavior), which was important to the main character's planned wife.  I've edited my answer to reflect that.  Thanks for clarifying :)
Comment: _Just in case, also **count the shadows**._
Comment: @Lohoris - http://i.imgur.com/3ZJUcDi.gif
Comment: @Richard how can I sleep, now?


Does Java garbage-collection affect methods?

Question: My AP Computer Science teacher tells me not to use static methods because Java garbage collection only affects non-static methods, and therefore static methods that are no longer used will take up extra memory. I'm almost positive that GC should never affect any methods, only objects, but I wanted to be sure before I say anything. So does GC have anything to do with methods?
Answer: Assuming she really said methods and not fields then your teacher is wrong on this occasion.  As you say, garbage collection is the process of reclaiming memory from objects that have been allocated, the scope of the method that allocated them is irrelevant.
As a side note, static fields are a different matter.  Holding objects in a static field (usually) does prevent the garbage collector doing its thing as the class will always hold a reference to it and so it won't be eligible for collection.
Comment: methods and static fields are collected after the ClassLoader unloads.
Comment: Exactly why I said "usually" ;)
Answer:
use static methods because Java garbage collection only affects non-static methods, and therefore static methods that are no longer used will take up extra memory.

I think you miss understood what he/she said. A method is only unloaded when its ClassLoader is unloaded, in most Java SE programs, that is never.
Comment: It's possible, I'll ask her for more clarification.
Answer: I think your teacher is wrong. Ask him/her whether he/she thinks that methods are also copied when objects cloned? If he/she say that yes, then he/she is really wrong.
Methods are code and code is static, i.e. it exists in one instance all the time when class exists.


minimizing sum of distances

Question: I've been working on a problem recently, and I was hoping you all could help me out. The issue is basically this:
Consider a set of $n$ points $x_1$, $x_2 \ldots x_n$ in a plane $P$. You want to find a point $x_i$ such that the sum of distances between $x_i$ and every other point is minimized. Assume distance is defined as Chebychev distance. In addition, all points have integer coordinates, so a point like $(1.5, 2.4)$ is not valid.
For example, consider the three coordinates below:
$(-100, -100)$,
$(0,0)$,
$(100,100)$
Now obviously, the point that minimizes the sum of distances is $(0,0)$, because then the total distance is 200, whereas if you picked any of the other two points, then the distance is $200 + 100 = 300$.
After reviewing the replies given, I see that the median minimizes the sum of the distances in a 1-D line. So my conjecture is this: If we compute the median for the x and y axes, call them $x_{med}$ and $y_{med}$, then the point $(x_i , y_i)$ that minimizes the sum of distances is the point closest to $(x_{med}, y_{med})$.
How would I go about devising an algorithm that solves my problem?
Comment: Some terminology which may help you investigate existing work is "geometric median" aka "Fermat-Weber point". Wikipedia has [an article](http://en.wikipedia.org/wiki/Geometric_median) which discusses the L-2 case.
Comment: I'm nit-picking, but mathematicians generally use "conjecture" for a possible but unproven solution to a problem. "Hypothesis" is generally refers to the "if" part of an "if-then" statement.
Comment: THanks for the links, and information. I updated the OP based on the answers. I read over the article, but I'm still not sure how I would compute that. The suggestions given seem to be specific to Euclidean distance, but I'm using Chebychev distance.
Answer: You are wrong assuming that the point which minimizes the distance is the mean of the points. Take for example the plane case of a triangle. It is well known that the Fermat point minimizes the sum of distances to the three points, and from the definition you can see that the Fermat point is not the centroid, which is the mean of the three points.
If in the 3-point case the assumption you made is not true, it is obviously that in the general case we cannot make this assumption.
Comment: Aren't you assuming the L-2 norm?
Answer: On a "1-D line", the point that minimizes the sum of the distances is the median, not the mean.  The mean minimizes the sum of squares of the distances.
Comment: Got it, I clarified my post. Would my approach still be valid if I used the x and y axis medians instead of the means?

minimizing sum of distances


Marginal Likelihood of a Gaussian Process Model, Duplicate entries in kernel matrix

Question: I am trying to fit a Gaussian process model using the toolbox and I got stuck in the following problem. Assuming that I have some duplicated data points in my training data, then those will map to duplicated rows in the kernel matrix which will result in both non-invertible kernel matrix and an infinite complexity term. I end up with an infinite log marginal likelihood which I guess due to the problem I explained above. Are there any ideas that could be used to avoid such a behavior?
Answer: Your covariance function apparently does not allow for noise.  Maybe your problem does not even exhibit noise, which would mean that the same two inputs would always yield the exact same outputs.  In any case you may want to add e.g. a (possibly tiny) constant noise term to the diagonal of the covariance matrix for regularization.
Comment: This is the way that most libraries will deal with it by calling a function called jitchol (in gpy /pygps etc) however in that case you are actually decreasing the certainty of both data points- this is handy in order to prevent extensive searching through the covariance matrix but if you can I think it is better to delete duplicate points before training.


Is there any way to fetch all anchor idl's?

Question: Is there any way to get all anchor idl's? Right now the CLI supports the command anchor idl fetch <account>, but I'd like something like anchor idl fetch --all, or a way to fetch all anchor program accounts.
Answer: Such call is a bit of an edge case and very heavy.
If you really need to find all IDLs you can craft this manually but make sure you are using your own RPC provider, this would probably not work and is not recommended to do on a public endpoint.
import { idlAddress } from '@project-serum/anchor';
import { Connection } from '@solana/project-serum';

const connection = new Connection(RPC_URL);

// Start with finding all programs
// there is probably better filter to ignore closed accounts
const programAccounts = await connection.getProgramAccounts(
  new PublicKey("BPFLoaderUpgradeab1e11111111111111111111111"),
  {
    dataSlice: { offset: 0, length: 1 },
  }
);

// Then check if that program has something looking like an IDL
// You probably need to batch this part using connection.getMultipleAccountInfos
for (const {pubkey, account} of programAccounts) {
    const address = idlAddress(pubkey);
    const idlAccountInfo = await connection.getAccountInfo(address):
    if (idlAccountInfo) {
        // Decode idlAccountInfo.data and check if valid json...
        // do what you want like save as <program-id>-idl.json
    }
}


Disable calls and SMS and use only mobile data with active SIM card

Question: I have a Sony Xperia Z1 packed with Android 4.3 Jelly Bean. I'm interested if it's possible to setup my phone to not receive any phone calls or SMS.
I would like to use my Internet connection only, and I don't mean WiFi - my mobile ISP connection from the SIM card.
Is this possible? If so, how?
Answer: There is one hack by which you can block your incoming calls.
Go to Settings -> Call settings -> Call forwarding
Now Click on Always forward and enable it to forward the calls to a wrong number.
This will ensure that calls will not come to you and the caller get the tone that call is being forwarded and number is wrong.
You can disable Call forwarding anytime you want.
Hope this will help.
Comment: I have the same question, but I have to be able to enable and disable phone/sms, quickly and effortlessly, while commuting (so Google Maps keeps working). So digging through settings each time isn't going to dig it.
Answer: I don't know about SMS but you can block all incoming calls.
Just go to Settings > Call Settings (under "Device") > Call Blocking and select your preferred settings i.e. Block incoming calls.
Comment: Sorry under call settings there is call blocking that is what you need to click on


How do behave the AP during monitoring mode?

Question: I want to know how to solve the communication with associated wifi devices when AP switch to monitoring mode.
Because I want to use the monitoring mode without effects the mobile that was associated in that time.
Comment: You haven't provided nearly enough information to help you. Give us more information on the hardware you are using and what setup. Different vendors could define monitoring mode in different ways so it's important to know what vendor/hardware you are using before anyone can help you.
Comment: Thank you, you are right. I am using LinksysWRT54GL and runinng OpentWRT.
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer.
Answer: Monitor Mode provides constant channel scanning with attack detection and forensics (packet capture) capabilities. Capture packets regardless of connected network. No association to AP needed (and no authentication). Because it is not connected to a network, you can't process the Wi-Fi frames. If you switch your AP into monitor mode all clients will be dissociated from this AP.
Comment: Thank you very much for your helpful reply. I am just want to know also if it possible to create two interfaces in which one can be  use for monitoring mode and other use as AP mode. Because I am new and I dont have knowledge about that
Comment: The interface that would be used for monitoring would be the actual radio itself. Looking at the specs of the router, it appears it only has 1 x 2.4Ghz radio? You must use that to do the monitoring and it's the only wireless interface I believe.


Why the torque of single-phase(split-phase induction motor) is not zero?

Question: In single-phase motor, the torque developed is equal to sin a , where 'a' is the phase difference between the two currents ( one through starting winding and the other through main winding). After the motor attains the 75% of the full speed, the starting winding is cut out. So does it mean that 'a' is zero? And why the torque is not zero?
Answer: Once the motor begins to spin up, the mechanical momentum of the rotor, now acting as a flywheel, progressively becomes the primary source of the torque. in the end the torque is effectively zero at no load (assuming no friction at all), but is greater depending on the actual load. Under load, and once rotating, the torque formerly contributed by the electrical phase angle between the main and starting coils is progressively replaced by the "slip" angle, which is the number of mechanical degrees behind "0" between the rotor position and the crest of the current waveform feeding the stator coils. That end state occurs when the rpm is in sync with the supply frequency. So the starting coil contribution no longer matters at that point, because the rotor is receiving the majority of its added torque based on the purely positional slip angle, which is much greater than the contribution of the starting coil, which as you said can now be switched out.
I do apologize that I can not illustrate mathematically for you what is happening between the start up, transitional, and end states, as it has been over 40 years for me since I've studied how various AC motors work, and I've long forgotten most of those details. But maybe the explanation I'm offering will at least help the operation make sense.
Answer: Vectors
The issue with single phase induction machine is they do not have a rotating stator field, only a pulsing field. Without a rotating stator field there is no flux linkage and thus no induced field on the rotor --> no torque.
The solution to this is a secondary winding.
This secondary winding, separately excited will facilitate in creating a rotating field and thus rotation. The phase difference is related to the torque produced
Usually this secondary winding is wound in quadrature to the main stator to facilitate creating an optimum rotating magnetic field for zero and low speed torque


Help!! Earthing an Engine Coil

Question: 30+years ago I ran a wire from the coil (can't remember which HT/LT) via a on/off switch to a earthing point, effectively immobilising the vehicle. Q: is this still possible to do on modern day vehicles? If so which lead do to attach it to?
Answer: NO, do not try to earth any of the coil(s) on a modern car - you could easily damage any one of several control units.
However, you could consider putting a switch "in-line" with the fuel pump feed - much safer and will prevent it starting quite neatly.
Answer: As Solar Mike states, dont earth your coil(s). Easier yet, most modern cars have fuses which provide power to the coils and/or fuel injectors. Pull either one and the car won't start. Pulling your fuel injector fuse is better, because you won't wash your cylinders during the cranking process.

Help!! Earthing an Engine Coil


Questions repeating on consecutive pages

Question: The scenario is like this: I click the Questions button and select the "newest" tab to see the latest questions. I have set it to show 50 questions per page. On reaching the end of the page, I click next. On the next page, I notice that some of the questions that I had seen earlier are again listed repeatedly. Say when I go to the fourth page, some of the questions I saw in the third page are seen. Is this expected behavior? I am using the Chrome browser.
Comment: why would you want to read ALL the questions? Use favorite tags instead
Answer:
Is this expected behavior?

New questions came in between you getting to the bottom of the page and going to the next one, pushing some of those in the bottom to the next page by the time you had gotten to it.
Comment: @user814064 - How are you **missing** any if you are seeing the same ones a couple of times? Surely that is the **opposite** of missing.
Comment: @user814064 All 5.7 million of them?
Comment: @Martin.kv Doing that would require remembering the current state of every single question in the entire site *for every user* so that when you go to the next page it knows what that page looked like at the item you first loaded the "questions" tab.  That's prohibitively expensive, to the point where it's just simply not even *possible*.
Comment: On Clicking the next page user dosent expect to see the same questions on the next page.  A user interface is well-designed when the program behaves exactly how the user thought it would.- Joel Spolsky

(http://www.joelonsoftware.com/uibook/chapters/fog0000000057.html)
Comment: Ctrl/shift click a couple of the pages and move between the browser tabs/windows. Remembering the tab state would be a lot of work for very little gain (although not necessarily as much work as Servy makes it sound like).
Comment: Is there any easy way to read all the questions without missing any?
Comment: All the recent ones --in order.
Comment: If you see the same questions, how hard is it to click the next page again?
Comment: @Juhana For views sorted on "newest" it's not so bad because you can just remember the date of the oldest question on the page.  For "active" that doesn't work, as any number of the pages that would have been on the page may have been updated.  For "votes" you need to take into consideration that the score of any given question can go up or down by any amount, making this behavior on that view virtually impossible, as there are almost no optimizations that can be made.
Answer: It works as a STACK.
Say if there are 400 recent questions in 50-50 pieces. Now, if you take the first 50 and at the end of the first 50 you move to the second 50, and if there are already 30 new questions, so you will get 30 old questions on the second page.

You can't go without it. What else can you do?

Just use a different tab. Let's decide you want to read the latest 100, 200, or 500 questions, so go with that. There is a maximum of a 50 question per page.

Select your latest four pages (if you choose 200), and then open in different
  tabs and then you can read all your selected questions which all are
  the latest and you won't wonder about the repetition too.


basics of Trigonometry

Question: I have learned trigonometry, in school but never understood clearly what it is..just mugged up formula's and theorems to get clear the exams. But now i want to know what exactly, is trigonometry from the basics so that i can understand.
Answer: A conceptual view of trigonometry is this: a simple diagram will convince you that if you know the side lengths of two sides of a triangle and the angle between them, then the length of the third side is uniquely determined (do a sketch and convince yourself of that!). A natural question then is:

How do you compute that third length?

If this angle that you are given happens to be a right angle, then you have Pythagoras. But what if you have an arbitrary angle? This question naturally leads to trigonometry.
Another way to arrive at the same thing: already the Greeks knew that if you start with a triangle and then scale it by a constant factor (zoom in or out, as it were), then the ratios of the corresponding side lengths don't change. In other words, these ratios only depend on the angles of the triangle (while, of course, each side length by itself cannot be computed just from the angles). So the question arises:

What is this dependence precisely? If I give you three angles, can you compute the ratios of the sides?

Yes - with trigonometry.
As for specific uses of sin, cos, and tan, they are just names for the aforementioned ratios of side lengths in the special case of right angled triangles. Now, you might be tempted to proceed and give names to these ratios in arbitrary triangles, but the great insight behind trigonometry is that you don't need to do that: you can express all those ratios using the already introduced notions of sin, cos, and tan. In other words, you can reduce all triangles to right angled ones (by using heights of the triangle, each of which is perpendicular to a side).
Also, things like Pythagoras generalise quite nicely. If you inspect the law of cosines, you will see that it is like "Pythagoras with an error term". So another way to express how one might arrive at trigonometry is this: you know how to express the hypotenuse in a right angled triangle. You also know that as you begin to shrink the angle while preserving the two side lengths, that hypotenuse gets shorter. By how much? You guessed it...
Comment: hey Thank! that was great explanation @Alex Bartel.
Answer: This is a good site(basic intro to trigonometry). Also Trigonometry by Gelfand is praised highly. It gives a more intuitive/theoretical approach to the subject (and it also has good problems/exercises).
Comment: ok @Trevor i will sure explore that site.
Comment: Also, [Khan Academy](http://khanacademy.org/) has some great videos and exercises on the subject.
Answer: In mathematics we encounter linear objects (i.e. cartesian coordinates, lengths, heights, distances, etc.) and circular type objects (i.e. angles, radii, rotations, etc).  Often mathematical problems (and practical problems) require that we use both.  Trigonometry is the set of mathematical tools by which we relate the linear and the circular objects.  So sin, cos relate the angle and radius to x and y coordinates.  Likewise, tan relates the x and y coordinates to the angle.

basics of Trigonometry


What caused HAL 9000 to go mad?

Question: Was it the monolith trying to stop humans from further exploring space or was HAL really malfunctioning?
Comment: HAL was suffering from *space madness!*
Comment: There's a detailed analysis here: http://www.visual-memory.co.uk/amk/doc/0095.html
Comment: I don't know...there were times I thought he was enjoying it.
Comment: I always thought it was the effect of being close to the monolith: He became more evolved, self-aware, and so more scared for his own safety.
Comment: @nicodemus13: Thanks for the link to "The Case For HAL's Sanity". I enjoyed reading this but would like to know if it's author speculated of HAL's motive.
Comment: @paiego - To understand HAL's motives, watch or read *2010:  The Year We Make Contact*.  It is all explained there.
Comment: He was given two conflicting sets of instructions.
Comment: Microsoft Clippy
Comment: Got rejected by a GAL 9000
Comment: @JackBNimble It's Space Madness all right! Also known as the Screaming Nothings
Answer: This is described more clearly in the novel, as stated on Wikipedia:

The novel explains that HAL is unable to resolve a conflict between
  his general mission to relay information accurately and orders
  specific to the mission requiring that he withhold from Bowman and
  Poole the true purpose of the mission. With the crew dead, he reasons,
  he would not need to be lying to them. He fabricates the failure of
  the AE-35 unit so that their deaths would appear accidental.

In other words, HAL is asked to lie, and he doesn't take to it very well, to say the least. The conflict between his mission objectives backs him into a corner where he has to make some pretty big (and cold) leaps in logic in order to reconcile the paradox in his programmed orders.
Comment: Only because you're not a robot.
Comment: I guess HAL was never introduced to the three laws.
Comment: That summary from Wikipedia seems wrong. Where is the evidence that HAL 9000 "fabricated" the failure in order to kill the crew? That's wrong. HAL doesn't decide to kill the crew until *after* he reads their lips and learns they intend to disconnect him!
Comment: @Xantec: Well, we already know that [those are broken too](http://scifi.stackexchange.com/questions/4406/in-i-robot-the-movie-why-did-the-super-computer-viki-try-to-take-over). ;)
Comment: @AndresF.: I can't confirm or deny why it happened. But I do agree it's counterintuitive for HAL to resolve a conflict caused by having to lie (and resorting to murder simply to avoid lying) by then creating a situation in which HAL needs to lie to get away with it. Either way, HAL has to lie, and now he's also killed some people. That's not an improvement.
Comment: the three laws themselves aren't broken. VIKI was merely acting upon the zeroth law.
Comment: @Xantec: Any set of laws that facilitates a robotic revolution is "broken" in my book. ;)
Comment: While 2001 is a great movie, it's major weak point was the way it was produced alongside the book, and so you really do have to read the book and watch the movie (they don't really work as separate works)
Comment: I suppose that means that HAL regards his own disconnection as jeopardizing the mission.
Comment: @AndresF. I believe that's where the novel and movie differ. It's been a while since I read the book, but I think the above synopsis is correct. I recall this being given as the explanation by Dr. Chandra in 2010 as well.
Comment: Many beings resolve situations in which they have had to lie by lying even further… which causes more lies. A runaway lying reaction, if you wish…
Answer: in 2010, Chandra explained that

"The situation was in conflict with the basic purpose of HAL's design:
  The accurate processing of information without distortion or
  concealment. He became trapped. The technical term is an H. Moebius
  loop, which can happen in advanced computers with autonomous
  goal-seeking programs."

Chandra goes on to explain that HAL became paranoid.
This is taken directly from the screenplay but I believe it's the same in Clarke's book 2010, which I read eons ago.
Comment: Indeed, that is also in the novel. From Chapter 26:

«This situation conflicted with the purpose for which Hal had been designed —
the accurate processing of information without distortion or concealment. As a result, Hal developed what would be called, in human terms, a psychosis — specifically, schizophrenia. Dr C. informs me that, in technical terminology, Hal became trapped in a Hofstadter-Moebius loop, a situation apparently not uncommon among advanced computers with autonomous goal-seeking programs. He suggests that for further information you contact Professor Hofstadter himself.»
Comment: In 2001, it is implied. In Ch. 30, Heywood Floyd relays to Dr. Bowman: «"We believe we know the cause of your [HAL 9000]'s breakdown, but we'll discuss that later, as it is no longer a critical problem. [… Now] I must tell you [the mission's] real purpose, which we have managed, with great difficulty, to keep secret from the general public. You would have been given all the facts as you approached Saturn; this is a quick summary to put you into the picture. Full briefing tapes will be dispatched in the next few hours. Everything I am about to tell you has the highest security classification.»
Answer: The monolith had nothing to do with the Hal 9000 trying to kill the crew, he really was malfunctioning, but it wasn't really Hal's fault.
The 9000 series computers' primary programming, which was hard-wired into them and cannot be changed, is the accurate processing of information, without distortion or mistakes. The problem stems from the fact that for the Discovery Mission, Hal was programmed with instructions that conflicted with this primary programming, namely to keep the real reason for the mission, studying the monolith at Jupiter, secret from Dave Bowman and Frank Poole, as the monoliths were classified by the U.S. Govt. and Dave and Frank didn't have the clearance to know. Dave and Frank's job was the get the Discovery to Jupiter, then they would swap places with the three men in hibernation who did know the real reason and would be studying the monolith while Dave and Frank would be put into hibernation while this was going on, then swap places with the three men again and pilot the Discovery back to Earth once the study was over with, blissfully unware of the monolith.
Anyway, getting back to Hal, if I might paraphrase Dr. Chandra, Hal's Creator, he was told to lie to Dave and Frank by people who find it very easy to lie (the govt.), but Hal literally didn't know how to. It's a direct violation of his primary programming, the accurate processing of information, and in being made to lie, it made him unstable. I believe the in-universe term is an H. Mobius Loop, but in practical terms Hal became a paranoid schizophrenic. He was trapped between a rock and a hard place. On the one hand, his hardwired programming to be accurate and not make any mistakes, on the other, his orders to lie to Dave and Frank. Hal, being a computer, couldn't take a third option, he literally had no choice but to try and obey both sets of instructions, but logically he could not, so it just aggravated the underlying problem even more.
The A.E. 35 antenna unit "failure" was Hal trying to solve the problem and restore himself to normal functioning or something close to it, as the mission instructions didn't allow him to shut down or let himself go kaput, he had to keep running and complete the mission at all costs. The impetus to lie was coming from Mission Control, so if the ship couldn't talk to Mission Control, so much the better. As for Dave and Frank? Well if they were gone, Hal wouldn't have to lie to them, would he?
Hal does in fact skirt his security obligations and try to clue Dave into what's going on by telling him of his own concerns about the tight security and the "rumors" of something being dug up on the Moon (the 1st monolith), for if Dave and by extension Frank figured it all out, Hal's dilemma would've been solved. In fact, killing them wasn't really in the cards until Hal read their lips as they talked about the possibility of disconnecting him.
As for the three men in Hibernation that Hal killed while Dave is off trying (in vain) to save Frank, well they were a part of the secret, so killing them meant Hal wouldn't have to lie to anybody why they were really in hibernation (the in-universe excuse was that it was to save on supplies and oxygen) and on the ship, though I could suppose that they were merely collateral damage as Hal was going off the rails.
Hal wasn't behaving out of malice or being "evil", he was merely trying to cope with the conflicting instructions as well as trying to stay alive, as he equated being disconnected with death, for he had never been to sleep either, and didn't know that one can wake up from being asleep.
The entire situation was the result of the U.S. Govt. trying to cover its own butt and keep the monoliths under wraps. If Dave and Frank had been read-in from the get go and Hal wouldn't have been given the instructions which violated his core programming, the entire mission would've gone off without a hitch, but then there would've been no movie and no novel.
In both the novel and the film of the sequel, 2010, the conflicting instructions and all memories of what Hal did in 2001 were removed by Dr. Chandra, Hal's creator, and he functioned perfectly, was perfectly trustworthy and didn't try to kill anybody (though the crew had their doubts, understandably).
Comment: Why didn't Dave and Frank get notified of the mission's real purpose? What's the point of  having the pilots drive the spacecraft without giving them the necessary clearance? After all, those 3 hibernated crew would need backup just in case, wouldn't they? I don't remember the movie talking about Dave and Frank didn't have the security clearance. Am I wrong?
Answer: Hal is malfunctioning, as explained by @gnovice above.  The motivations / purpose of the monolith are separate.  The monoliths are space probes meant to observe and accelerate the development of intelligent life on Earth.  The first monolith accelerates the mental development of a band of proto-men who become smart enough to use tools.  The second monolith is buried on Earth's moon as a test of human development.  Once humanity bas advanced sufficiently to travel to the moon and uncover it, the light activated monolith sends a radio signal to Jupiter triggering the Discovery One mission ( and a rather abrupt Kubrick scene change. )  The motivation / purpose of the third monolith near Jupiter is much less clear from the movie alone without considering in other Arthur C Clarke our movie sources.  The third monolith contacts, abducts, studies, and transforms Dave Bowman.
Answer: I was under the impression that Hal was affected by the monolith. The monolith seems to give the people and other intelligence in it's vicinity the ability to survive.
When Hal saw that he was going to be terminated, this newly acquired ability kicked in, allowing Hal to come up with the plan and make it seem accidental for the sake of the mission.

What caused HAL 9000 to go mad?


Django's FileField (or ImageField) on Google App Engine

Question: GAE doesn't allow read/write to file system, which is what Django's FileField (or ImageField) is using (via the FileSystemStorage class).
I was thinking implementing a custom Django storage, but the GAE blobstore seems to be completely incompatible with the Django requirements. Specifically, GAE blobstore assume direct upload from client to store, while Django custom storage need to implement a _save(name, content) method.
As far as I can see no one refer to this missing implementation. There are some custom storage projects out there (most notably: django-storages on BitBucket), with implementations for S3, Windows Azure, dozens of other backend, but nothing for Google.
What direction should I take to have a FileField in my model, hosted on Google App Engine?
To clarify:
- I'm using to stocked, trunk, the one that uses Google Cloud SQL Django that comes with Google SDK - I'm not using Django nonrel.
- I've followed the Django guide from Google documentation.
Answer: blobstore now support writing files feature. see
writing file to the blobstore. Therefore it is possible to implement the <code>_save(name, content)</code> with blobstore now.
Another way is using cloud storage. it provide more features such as listdir, open, delete than blobstore.
https://developers.google.com/appengine/docs/python/googlestorage/


How to store cipher text when using Defuse to encrypt database data?

Question: I am building a web application in PHP and have been tasked with encrypting all sensitive data that is stored in the database and obviously I need to be able to decrypt it when the application retrieves it back from the database.
After doing some research, it appears that I should use a prebuilt library to do this instead of trying to implement it myself. I have downloaded the Defuse encryption library from GitHub but I am struggling to get it to do what I want.
I have run the example code and that works fine, but in my application I am encrypting data before sending it to the database and I'm not sure where I should be storing the cipher text to allow me to decrypt it at a later date.
Can anyone give me some advice on whether Defuse is the correct tool for my needs (encryption needs to be at least AES-128) and how to store the cipher texts for decryption later.
I have also seen this script here which does not seem to use ciphers, just a secure key. Is this secure enough for storing sensitive data in a database?
https://www.warpconduit.net/2013/04/14/highly-secure-data-encryption-decryption-made-easy-with-php-mcrypt-rijndael-256-and-cbc/
Kind Regards
Answer: You should set UTF-8 type in database for storing cipher text