PT transformation of a spinor

Question: By demanding the the Dirac equation be invariant under general Lorentz transformations, we get an equation for the transformation matrix of a Dirac spinor,
$$ S^{-1}(\Lambda) \gamma^\mu S(\Lambda) = {\Lambda^\mu}_\nu \gamma^\nu, $$
such that the spinor transforms as
$$ \psi \quad\stackrel{{\Lambda^\mu}_\nu}\to\quad S(\Lambda)\psi $$
If we go through this three times for
$$ {(\Lambda_P)^\mu}_\nu = {diag(+1,-1,-1,-1)^\mu}_\nu \\ {(\Lambda_T)^\mu}_\nu = {diag(-1,+1,+1,+1)^\mu}_\nu \\ {(\Lambda_{PT})^\mu}_\nu = {diag(-1,-1,-1,-1)^\mu}_\nu $$
the relevant equations can be solved by
$$\begin{align} S(\Lambda_P) &= \pm\gamma^0 \\ S(\Lambda_T) &= \pm\gamma^1\gamma^3 \qquad\leftarrow\text{(wrong! see answer below!)} \\ S(\Lambda_{PT}) &= \pm\gamma^5 \end{align}$$
Naively, I would expect that since $P\circ T=PT$, we would also have $S(\Lambda_P)S(\Lambda_T)=S(\Lambda_{PT})$. This is obviously not the case. Why?
Answer: I find that your $S(\Lambda_T)$ should be  $\gamma^1\gamma^2\gamma^3$ as that flips the $\gamma^0$ three times, but flips the other three gammas twice.
But be careful the actual action of $T$ on  spinor  fields and states works differently:
On fields
$$
{\mathsf T}^{-1} \hat \psi(x,t) {\mathsf T}= \eta_T {\mathcal T} \hat \psi(x,-t)
$$
where $\mathsf T$ is antiunitary and ${\mathcal T}$ is a unitary matrix obeying   $$
{\mathcal T} \gamma^\mu {\mathcal T}^{-1} =(\gamma^\mu)^T
$$
The form of ${\mathcal T}$ in terms of the gamma matrices depeneds on the representation because if  $\gamma^\mu\to S\gamma^\mu S^{-1}$ then ${\mathcal T}\to S^T{\mathcal T} S$.
On the  wavefunction $\phi(x,t)= \langle 0|\hat \psi(x,t)|\phi\rangle$ of a single-particle state $|\phi\rangle$  we have (in four dimensions where ${\mathcal T}$ is skew symmetric)
$$
\phi(x,t)\to - \eta_T^* {\mathcal T}^{-1} \phi^*(x,-t)
$$
Comment: There is little connection between your def of $S(\Lambda)T)$ and what is called "time reversal".Your def would  work  for  *time reflection* in   Euclidean siganture, but that operation  turns particles into antiparticles. What is called "time reversal" today adds  an extra charge conjugation to  time reflection so as to undo this, and then adds a complex conjugation in changing to Minkowski signature. P&S formula is basis-dependent are most such textbook expressions. That's why I gave the transformation formula.
Comment: Thank you for your answer! I still have a question: QFT books like Peskin&Schroeder or Schwartz use $\mathcal T=\gamma^1\gamma^3$, which does indeed fulfill your second equation. But where does it come from? And why does it work differently for $S(\Lambda_T)$?
Comment: Oh wow, thanks for clearing that up. To be sure, let me try: 1) $\mathcal T = K \exp(\pm i\pi S_y)$? 2) Time reversal ($\mathsf T,\mathcal T$) = time reflection $(\Lambda_T)$ + charge conjugation ($\mathsf C,\mathcal C$) + complex conjugation ($K$)? If so, 3) where does your second equation (transformation formula) come from? and 4) why is $(\Lambda_T)$ time reflection in *Euclidean* space?

PT transformation of a spinor


How to model a roll against a "difficulty roll" in AnyDice?

Question: I'm working on a custom ttrpg system and I've noticed a lot of answers to questions in here regarding AnyDice. You would roll two die (such as a d6 and a d8) against a third die of any size up to a d12. The third die determines difficulty. Having at least 1 die meet or exceed the difficulty is a minor success, while both meeting or exceeding is a major success. Any help on how to set this up would be appreciated.
Comment: Welcome to RPG.SE! Take the [tour] if you haven't already and see the [help] or ask us here in the comments (use @ to ping someone) if you need more guidance. Good Luck and Happy Gaming!
Answer: The main trick you need here is to make two comparisons to a single row. The way to do this is to cast it to a function. Then we just get to treat our variables as an outcome of a roll, not dice.
We then just compare the result each of the two dice with the result of the target die. Resulting the sum means 1 means a minor success and 2 a major.
<code>function: roll A:n B:n against T:n {
  result: (A>=T)+(B>=T)
}

output [roll 1d8 1d6 against d12]
</code>
Comment: It might be worth noting that the `A:n B:n` part of the definition causes each of the first two rolls to be summed into a single number even if there's more than one die in each rolled pool. If you defined the function using `A:s B:s`, the rolls would be converted into sequences instead, which would let you do e.g. `[roll 2d8 3d6 against d12]` and get a count ranging from zero to 2 + 3 = 5 of all the dice in 2d8 and 3d6 meeting or exceeding the random d12 target.


How to display weather script update autometically in php?

Question: I want to weather information in my website which should be autometically updated daily could you please help me script for weather information?
Answer: I made a Weather API available on mashape, and they have a ready to use simple PHP SDK.
This api is really simple to use because we use the cool standards that are available nowadays, like JSON and REST.
If you like it please give it a try on mashape
Answer: Go to Weather.com and sign up for a Weather Widget.  This is a javascript script that you'll place on your page and is independent of the server side language used.  Note also that you won't have to update the weather daily at all: the script will always just pull the current weather forecast.  You will have to provide information about the area for which you want weather (e.g. zip/postal code).
Comment: You are welcome.  I'd appreciate it if you could upvote the answer and mark it as accepted if appropriate.
Answer: If you want data automatically updated on a schedule, look into cron (on Unix systems) or its equivalent.  If you're using a commercial web host, they should have a way to schedule programs; otherwise, look into your own system's documentation for scheduling scripts.
Next, you want to write a script that downloads the weather information at that moment.  Allow this script to translate from the "source" format to your own format.
Have the scheduler run your script once a day.
Answer: An alternative to Weather.com is Weather Underground. This is a successful weather forecasting site that cover most of the world (you don't say where you need the forecast for). They have something free called Weather Stickers which offer live feeds of the current observed weather situation. You just embed an image in your page. Like this:

(source: wunderground.com)
They also offer weather forecast XML feeds and API.


''Want" vs "Need" Which one would be correct?

Question: Context:
'I don't need help from you' as I found at many places written this.
So, can I write this as I don't want your help?
Answer: Don't need and Don't want mean different things, most of the time anyhow.

I don't need help from you

means that I do not require your help. I can manage without it.
But it's not usual to add from you unless it's specifically from the person addressed that you don't need help. And it sounds a bit pointed, as if you dislike the person or regard them as incapable. It would depend on the way you said it, whether you emphasised from you.

I don't want your help

means that I don't desire it. It makes clear that although you may require help, you definitely don't want it from the person concerned. It's a clear rejection of an offer of help that implies your dislike or poor opinion of the person offering it.
Comment: Additional thought: "I don't want your help" could also mean that although the person could benefit from help, they would prefer to do it themselves because doing it themself is important to them (no reflection on the other person).
Answer: Although these are simple sentences, they may carry a great many different meanings, and in speech these would be distinguished by different emphases. My attempts below do not exhaust the possibilities, which would probably be further refined by tone, gesture and facial expression.
1."I DONT want your help" = stop bothering me, Ive already told you.
2."I dont WANT your help" = I prefer to do it myself, or I have to do my homework without help.
3."I dont want YOUR help" = I dont think that help from you would be much use, or I resent your condescending attitude.
4."I dont want your HELP" = I dont see how you can help, but some sympathy would be nice.
In most cases, both want and need would work. In case 2, though, "I dont NEED your help" could mean "Thank you, but I'm OK, I can do this myself" and could be said in a friendly way, where "I dont WANT your help" is more likely to express irritation.
I think this simple sentence displays a great deal of subtlety that in conversation would be conveyed non-verbally. In writing, it would benefit by being expanded in some way Thank you, No thank you, Ive already told you, I dont need any help from you, etc., etc. In either case, getting it right, and achieving the proper emotional tone, would indicate real mastery of the language.
Answer: Wants and things that are not necessary for your livelihood essentially, so if you say, "I don't need your help." You are saying that my help is not necessary.
However, if you were to say, "I don't want your help." That refers to a desire, such as I want cookies. That means you do not desire my help.


Is it possible to calculate capacity of a battery using a resistor

Question: Is it possible to measure the capacity of a battery if the discharge curve of the battery utilizes a resistor as the load? For example, if a 100 ohm resistor is connected to a battery and then the battery is discharged, would it be possible to calculate the capacity of the battery, based on this curve with this particular resistor (as the load)?
Answer: In terms of energy I'd say kind of yes. Let's say you have the 100 ohm resistor, you can take the voltage reading every minute or so. Then, you can record this over time for the duration of discharge. Now, since resistance is constant, by using Power = V^2/R, you can get power at that moment and graph the power over time or just get the voltage graph and divide the whole ting by resistance. Since energy is power integrated over time, you can take the area of the curve you drew and you can say that's the energy that came out of the battery. Though, to get the actual energy, there's things like ESR and other factors but it should be a decent estimate.
Comment: Oh, and another thing, you don't want to do this for every battery especially rechargeable batteries. If it's like a duracell throwaway go ahead, but if it's something like a lithium ion batteries, fully draining the battery can seriously damage the batteries cycle life.
Comment: I disagree. Hence in our replies to @user5139637 we have advocated a constant current load. Unless your purpose is for your battery to power a constant resistance load, eg a simple torchlight. The results will not be meaningful to anyone wishing to use your battery with a boost converter for example. Until you work out what your battery is to be used for you are wasting our time.


RFID software for windows, linux and Mac

Question: I want to learn how to play with RFID... Read it, write it, scan for it.
I need the software to do this as well as the hardware.
I'm not 100% sure what my end goal is. So, the more sources is get, the better. Keep the comments coming.
Answer: The actual hardware to read tags is not so complicated. You can get a reader like this one that can read tags fairly simply. The scanner just sends a unique 10 byte code every time it reads a tag, and you can handle that in just about any software fairly trivially.
I have never written tags because I have never found a need to. You can get tags for under a dollar each, and they all have a unique key. I just record them into my system and store them.
I use rfid for a basic entry control system on my front door, using an arduino controller to send the codes to my central server, and then to open an electronic lock. My setup is sort of similar to what is described here. My server allows me to remotely access it, and to set up specific time based access restrictions for individual tags. The microcontroller is not strictly required, but it allows me an easy way to interface with various hardware elements.
Comment: http://www.gumbolabs.org/2009/10/17/parallax-rfid-reader-arduino/ also gives a pretty good idea of what kind of protocol you are dealing with. Its really quite simple.
Answer: I think you have these options to use for your requirement:
Tikitag RFID Programming Kit http://www.jeremyperson.com/tikitag-rfid-programming-kit/ or this RFID Programming Kit http://www.phidgets.com/products.php?category=14
I hope that helps!


32-bit pointer overflow in 64-bit gcc code - fails in compile

Question: I am compiling a very large legacy Fortran 90 code (screamer) with gFortran on a Mac (2.2 GHz Intel Core i7) running Yosemite. (gFortran V5.1.0) I have 16 GB of RAM. The code is memory intensive and I am trying to increase array sizes to solve larger problems. I have maintained the code for >10 years and rewriting 200,000 lines of code right now is not an option. As I carefully increase the size of the 2-D matrix (am(max_nodes, max_nodes)) and several 1-D vectors (RHS(max_nodes) and a(max_nodes*2)) by varying the integer "max_nodes" I eventually get to a 32-bit pointer limit (4 byte unsigned integer limit) during compilation. See below.
final section layout:
<code>__TEXT/__text addr=0x100001390, size=0x0006B9CB, fileOffset=0x00001390, type=1
__TEXT/__text_startup addr=0x10006CD60, size=0x00000041,    fileOffset=0x0006CD60, type=1
__TEXT/__text_exit addr=0x10006CDB0, size=0x00000031, fileOffset=0x0006CDB0, type=1
__TEXT/__stubs addr=0x10006CDE2, size=0x00000252, fileOffset=0x0006CDE2, type=28
__TEXT/__stub_helper addr=0x10006D034, size=0x000003EE, fileOffset=0x0006D034, type=32
__TEXT/__cstring addr=0x10006D428, size=0x0000CFCB, fileOffset=0x0006D428, type=13
__TEXT/__const addr=0x10007A400, size=0x00008F00, fileOffset=0x0007A400, type=0
__TEXT/__eh_frame addr=0x100083300, size=0x0000DCF8, fileOffset=0x00083300, type=19
__DATA/__got addr=0x100091000, size=0x00000060, fileOffset=0x00091000, type=29
__DATA/__nl_symbol_ptr addr=0x100091060, size=0x00000010, fileOffset=0x00091060, type=29
__DATA/__la_symbol_ptr addr=0x100091070, size=0x00000318, fileOffset=0x00091070, type=27
__DATA/__mod_init_func addr=0x100091388, size=0x00000010,  fileOffset=0x00091388, type=33
__DATA/__mod_term_func addr=0x100091398, size=0x00000008, fileOffset=0x00091398, type=34

__DATA/__const addr=0x1000913A0, size=0x000007C8, fileOffset=0x000913A0, type=0
__DATA/__static_data addr=0x100091B68, size=0x00000003, fileOffset=0x00091B68, type=0
__DATA/__data addr=0x100091B80, size=0x000003E0, fileOffset=0x00091B80, type=0
__DATA/__bss4 addr=0x100091F60, size=0x00000018, fileOffset=0x00000000, type=25
__DATA/__bss5 addr=0x100091F80, size=0x00020000, fileOffset=0x00000000, type=25
__DATA/__bss3 addr=0x1000B1F80, size=0x00000028, fileOffset=0x00000000, type=25
__DATA/__pu_bss2 addr=0x1000B1FA8, size=0x00000008, fileOffset=0x00000000, type=25
__DATA/__bss2 addr=0x1000B1FB0, size=0x00000024, fileOffset=0x00000000, type=25
__DATA/__pu_bss5 addr=0x1000B1FE0, size=0x0000024C, fileOffset=0x00000000, type=25
__DATA/__pu_bss4 addr=0x1000B2230, size=0x00000018, fileOffset=0x00000000, type=25
__DATA/__common addr=0x1000B2260, size=0x000020D8, fileOffset=0x00000000, type=25
__DATA/__zo_bss3 addr=0x1000B4338, size=0x00000021, fileOffset=0x00000000, type=25
__DATA/__huge addr=0x1000B4360, size=0x984EB80C, fileOffset=0x00000000, type=25
</code>
ld: 32-bit RIP relative reference out of range (2147639505 max is +/-4GB): from _main_loop_ (0x10000E120) to _a.4206 (0x180034380) in '_main_loop_' from screamer64.a(main_loop.o) for architecture x86_64
collect2: error: ld returned 1 exit status
In this error message main_loop is the core solver subroutine in screamer that populates and solves the large matrices. In this subroutine the large real*8 matrix and real*8 vectors are defined.
This Register Instruction Pointer (RIP) error is noted many times on the web. So far this available information has not helped me solve my problem. Note: the signed 4 byte integer limit is 2,147,483,647 so the error seems to be directly related to the use of a 32-bit pointer.
The gFortran compiler options include -mcmodel=medium that should take the pointers to 64 bits. -m64 has no effect. The total memory used by the primary matrix and vectors when the pointer limit is reached is greater than 2.4 GB. The confusing thing is that the code is fully 64 bit so I was not expecting 32-bit pointers. See below for 64-bit check.
rbspielman$ file screamer64
screamer64: Mach-O 64-bit executable x86_64
The primary matrix and vector are all real*8 (64-bit). All large arrays in declared directly in this one subroutine and are not placed in common.
All other variables in common are ordered by size. real*8, real, int, char.
Simple test programs demonstrate that there is no fundamental memory limit. I can easily define static arrays to > 10 GB without a problem. Larger arrays also work but end up using virtual memory and slow down as expected.
Clearly there is some sort of memory or pointer size limit but I just cannot figure it out. The code matrix solvers are massive and more realistic test programs would be tedious.
(I also compile screamer in Ubuntu LINUX without a problem up to the same array limit as the Mac. Compilations in Windows 8 fail at the usual 2 GB memory limit NOT at the pointer limit.)
Suggestions would be appreciated.
Comment: You didn't provide any code for us to analyze, so the only thing that comes in mind right now is that you might be still using some 32-bit variable to store the value of pointers, like `int my_reference = (int)some_pointer`, and therefore truncating its value.
Comment: The code is a bit long and complex to analyze. Even this specific subroutine is tedious. Is there some way to identify the pointer in question? Can we narrow down the possibilities. I don't think I truncated the pointer with a integer definition. I define over 50 variables as integer but few are used as pointers. I define most variables in header files that are common to nearly all subroutines. Should the pointers be real variables?
Comment: I did some search, and it seems the problem is related to MacOS. Try to link it with `-no_pie` active.
Comment: If you place -mdynamic-no-pic in the gFortran compile statement and -no_pie in the linker you do not get the error above but you get the following error ld: file too small (length=0) file 'screamer64' for architecture x86_64
collect2: error: ld returned 1 exit status
 and a blank executable.
Comment: More information: I have compiled screamer with the -Wall switch on and the code compiles with no warnings. The batch files below:
Comment: rm *.o *.a MTRX RHS
gfortran -m64 -O3 -Wall -mcmodel=medium -c *.f
ar crv screamer64.a *.o
rm *.o
ranlib screamer64.a
g++ -m64 -O3 -mcmodel=medium -c cprog.cpp
g++ -m64 -O3 -mcmodel=medium -o screamer64 cprog.o screamer64.a /usr/local/lib/libgfortran.a /usr/local/lib/libquadmath.a /usr/local/lib/gcc/x86_64-apple-darwin14.4.0/5.1.0/libgcc.a
Comment: subroutine main_loop

      include 'zdemmax.h'

      real*8 a(max_a), am_band(max_am,max_am), rhs_band(max_am)
      integer iptold, iptime, jdiv, nk, nzz

        call screamermatrix(a)

c max_am is 8190
c
      nk = ntot*2

      call bandmatrix(a,am_band,rhs_band,nk,nr,
     &                indexb,nadd_array,nb,topbranch,max_am)

c Solve the linear system using modified Gaussian elimination

      call solvermdgauss(am_band,rhs_band,nk,max_am,nadd_array,nb,nr)
      return
      end
Comment: Use tag [tag:fortran] to get more attention.
Answer: I just ran into the same problem with GNU Fortran (GCC) 5.1.0 in a Mac running 10.11.5 but the solution offered by the OP did not work for me.
However, I did find a solution: after systematically pruning my rather pedestrian legacy code, I found that every array has to be explicitly filled with something. You can't start filling it within your code. I know it sounds silly, but once I initialized every "real" array (32 bit, it is legacy code) with 0.0 before I did any I/O or other work, it linked without complaint.
And, yes, as with the OP, my code worked until I changed the size of an array.
The reason why this worked may be in the contents of this bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63793 but I am not good enough to tell you how to come up with a better workaround. My only guess is that initializing every array at the beginning favors the GOT instead of the RIP. (When will this be fixed? I just don't know how to push this up the line and the bug report is dated 2014-11-09)
Comment: This is not going to be fixed, it is old and has status UNCONFIRMED. It receives no attention now. You can try to give it some attention there if you think it is a legitimate bug.


How to create more notes like TODO in Android Studio, for example CHECK or TEST?

Question: Does anybody know how to create new tags similar to the "TODO" in Android Studio? I mean so that they would highlight as well and appear in the list of issues.
I'd appreciate any tip or suggestion.
Answer: Yes, this is possible. Android Studio is based on IntelliJ and you can find a instruction on how to add a new pattern here:
https://www.jetbrains.com/help/idea/defining-todo-patterns-and-filters.html
From the link:

In the TODO tool window, click the Filter TODO Items icon (Filter TODO Items) and then click Edit Filters to open the TODO dialog.
To add a pattern for the OPTIMIZE items, click the Add icon (Add) in the Patterns section of the TODO dialog, and type the following pattern: \boptimize\b.* Then click OK to save the new pattern.
To add a filter with the new pattern, click the Add icon (Add) in the Filters section of the TODO dialog, specify a name for the new filter, and select the new pattern to be included in this filter. Then click OK to save the new filter.
Click OK to apply changes in the TODO dialog.
To apply the new filter, in the TODO tool window, click the Filter TODO Items icon (Filter TODO Items) and select the necessary filter.
Comment: Great! Thank you Nils.
Comment: In addition to Nils solution, you sould use the same name as the one specified in the pattern \b{name}\b.*. Meaning if you use \bOPTIMIZE\b.* , your filter must be named OPTIMIZE.
Answer: FWIW - While playing around with this I found that you can also bundle the keywords.
For example:
If you create a pattern like \binfo\b.* it will be for the //INFO tag.
Then start the comment like:
//INFO: it will show in the TODO list as //INFO:
If you start the line with //INFO TODO: it will show in the TODO window as //INFO TODO
It will also show as //INFO TODO:
so it shows up twice with different patterns bolded.


How to add tokens in an text-area in the contact module?

Question: In contact module there is an text-area of auto reply in which I want to add tokens to it. Could anyone give solution for above issue.
Answer: That is not a supported feature right now, you would have to implement that yourself using the token API, e.g. through a hook_mail_alter().
But there are a lot of details involved after that and you won't get a detailed answer here that you can just copy & paste. You could open a feature request for http://drupal.org/project/contact_storage
Answer: I have not yet try Contact module.
But if that is text area and can be applied a Text format, you can add Token filter module then edit the text format to Replace token with actual value.


How could Hal fire his own boss in "Company Picnic"?

Question: In the Malcolm in the Middle episode "Company Picnic", Hal was nervous to meet his new boss at the company picnic, but when they met everything went well. Surprisingly, the new boss called him a different name and then after a while, Hal told him he is fired... I'm lost at this point. What happened? How could Hal fire his own boss?
Comment: I haven't seen the episode in a long time, but if I remember correctly, Hal's new boss was under the impression that Hal was in fact *his* boss, which is why he was calling him the wrong name. Hal was too embarrassed to simply point out that his new boss was wrong, so instead he tried to get out of the situation by firing his own boss.
Comment: ooh .. I see .. thus, this explains why Lois told him he should go and make things right with the new boss .. but still, at some earlier scene the new boss introduced him to give a little speech to his colleagues, seemed like he knows already that he is his new supervisor ..  hmmm ..
Answer: As Dr R Dizzle correctly said, Hal's new boss was under the impression that Hal was his boss. After panicking and firing him, the new guy decided to quit because he didn't want to work for a guy like that


Can I use 2-1/2" metal studs to hang 1/2" drywall?

Question: I am in the process of remodeling my basement, & it's ready for studs; the basement is small, so to maximize as much space as possible I was thinking of using 2-1/2" metal studs opposed to the 3-5/8" studs; I'm using 1/2" drywall & I'm unsure if the 2-1/2" stud can support the weight of the drywal.
Comment: While it will likely support the drywall, you should also consider how much insulation you want to get in these walls and if there's any load you want to hang from the wall (e.g. flat screen TV's or shelves).
Comment: Indeed.  If it were me I would reconsider the 1/2" Drywall decision for future-proofing.
Answer: I'm not sure it would be worth making any stud that couldn't take drywall. For walls, the drywall creates an axial load on the stud which it should easily support. But interior walls must also support an arbitrary lateral load, 5 psf in the US. This combined with the axial load is what would do it in. The manufacturer of the studs should publish span tables that tell you the maximum height wall for which you can use each style of stud under varying conditions.
I've little doubt you can find a 2.5" stud that works, but I'm not sure the proper gauge. That's where the span tables come in. Sorry I can't give you a final answer. All I can say is there's reason for hope.


How to add field attribute values from line features to polygon features they pass through using ArcPy?

Question: I have a set of polygons and I want to add a field with the name of the streets (from another feature class of streets) that are within each polygon.  Using Select Features by Location, I select streets that are within the polygons, but I can't think of a way (using python) to automate the process of populating each polygon with the name of the street that falls within it.  I don't have a matching field for either feature class to base a join on.  Is this possible or is it something that would have to be done manually?
Comment: What software package are you working with?
Comment: What are you wanting to see when "populating each polygon with the name of the street that falls within it"?  I could show you how to add the streets in a polygon as a comma delimited list but I would imagine that could be a very long field if there are hundreds of streets in some polygons.  Alternatives could be to use a spatial join to create a table listing for each street what polygon(s) it is in or to do an Intersect which can pull the polygon attributes onto the streets that pass through it.
Comment: arcmap ..........
Answer: Try something to do with this, it is the idea, but it mostly untested, but i am sure it good and it's should work:
This "your_streets" and "your_polygons" are your feature classe.
cursor=arcpy.SearchCursor(your_streets)
for street in cursor:
<code>name_of_street=street.Name
ID_line=street.OBJECTID

if arcpy.Exists(street_layer):
    arcpy.Delete_management(street_layer)
arcpy.MakeFeatureLayer_management(your_streets,street_layer)
arcpy.SelectLayerByAttribute_management(street_layer, "NEW_SELECTION", "\"OBJECTID\" = "+str(ID_line))

if arcpy.Exists(polygons_layer):
    arcpy.Delete_management(polygons_layer)
arcpy.MakeFeatureLayer_management(your_polygons,polygons_layer)

arcpy.SelectLayerByLocation_management(polygons_layer,"WITHIN",street_layer)

cursor_1=arcpy.UpdateCursor(polygons_layer)
for polygon in cursor_1:
    polygon.Name_street=name_of_street
</code>
Answer: The analysis that you want to do, might be a bit strange, as you may have lots of streets passing trough your polygons, and it might be complicated put all that in a single field, but I do not know your dataset, so it might be perfectly reasonable.
A quite easy way would be to use the following algorithm that you can process in a Python Script:

Use Spatial join using Polygons as "Target features" and street as
"Join Features", set the merge rule for streets field name to join (use ", " as separator) and intersects in the "matching";
Make Feature Layer from your Polygons
Add Join between Polygons Layer and the output of the Spatial Join using the
original FID
Add field Streets_Name (text 255)
Calculate Field Streets_Name from the joined table Join_Street_Name Field
Remove Join
Delete (Management) Spatial Join Output

Remember that if the join of the street names from any polygon is bigger than 155 character you will have problems...


Plugin architecture for rails cms

Question: I'm working on a cms and wanted the ability to offer custom extentions for certain accounts. Like having a plugin with custom code that is only available or only used by that account. These custom extentions would be specific to the business needs of an account and perhaps unlikely that any other accounts would need it, but maybe.   Is there a way that this could be done and to be loaded without having to restart the whole app, thereby creating downtime for the other accounts?
Answer: In terms of per-client plugin code, you could store the code in a data model and then eval() the code to dynamically execute it. (Of course you would want to do some serious sanity-checking / scrubbing on update to ensure the code does not contain malicious calls). Another approach could be to develop a custom tag library, much along the lines of what the Radiant CMS developers have built ... and then let your users "program" their behaviour using the tags provided. This gives you more control and better security at the expense of less flexibility.
In terms of the downtime question, if you are using a modern rails deployment approach I don't see how this should be an issue. The eval() approach above doesn't require a restart (unless your custom code calls "include ..." on libraries that are not installed at the time of the last boot - but getting these libraries installed is also an "out of band" problem that you would need to solve.
Passenger gives you the restart.txt file that you can touch to force a refresh. Similarly there are recipes for mongrel (like see saw) that allow you to progressively restart your mongrel stack to avoid downtime. I would pull these two issues apart mentally if I were you, as the dependencies between the two are not that great. Hope this helps.
Comment: I think this is a pretty good solution (even though eval() is pretty scary) because I'm the one that would be developing the code, not the users.  Of course if there was a mass-appeal module then I could just build it in as normal and restrict access to it.  The specific instance is for per-account customization so I think this would work best.
Answer: I built a cms and added plugin support for it.  Best thing you can do is have it be all database driven, the plugin exists for everyone, technically, but you can only make use of it if you've "purchased" it, or some other way of turning it on.. Which is really just a db record.
That'd be 0 downtime. :)  Then again, I have no idea what the rest of your setup looks like.  I'd think your solution is going to be pretty specifically tailored to your cms system design.
Answer: how long would this downtime be really?  i mean running migrations and stuff would be a pain for a system that allows any tom dick or harry to upload a plugin. You'd have to verify that the migrations were set up correctly etc.  if you aren't getting that 'fancy' and just allow them to do something 'neat' in js, then i guess it's a question of restarting passenger, which is what 5 secs?
I'd check out other 'famous' CMS like radiant or something to see if/how they do it, personally. good luck.
Answer: Im not if this is exactly what you are trying to achieve, but have you checked out pancake?
Pancake is a tool & framework to let you stack and loosely couple Rack-based webapps.
http://www.rubyinside.com/pancake-rack-webapps-stacking-2863.html

Plugin architecture for rails cms


Premiere Pro CC: Multiple instances of a panel in the workspace?

Question: I've worked with Premiere Pro for a while now and created my own workspace based on the panels I need most frequently. I have but one problem: I would like to have multiple instances of the Effect Cotrols Panel within my workspace. This is possible with the Project Panel, however I couldn't find an option to multiply other panels. Is there a way to accomplish this?
Answer: Unfortunately, there isn't a way to do this in Premiere in my experience. As far as I know, the only panels you can have multiple of are the Project and Sequence panels.
Comment: Hmmmm...yeah, that's a good point. The only thing I can think of is to have 2 different workspaces, one with the big Effects Settings and one with the small Effects Settings, and just switch between them as needed, though admittedly this is a bit obnoxious.
Comment: Accepted. Don't like it, but at least I know that it's not possible now. Well, maybe Adobe will add that feature sometime ... thanks anyway °v°
Comment: Just out of curiosity, for what purpose did you need multiple Effects panels?
Comment: Well I generally like my workspace, however sometimes the Effect Settings panel is to small for acurate adjustments. In this case, I need to drag it somewhere else or expand it, which becomes quite a bother over time. So I wanted to have two instances of the panel, one larger than the other, so that I could use whichever seemed fitting ...


Moving on in Candy Crush

Question: In playing the mystery quest game in Candy Crush Saga to unlock level 36, I understand it as I have to play and win 3 games, one game a day. If I don't win, say the first mystery quest game the first time I try, can I keep trying until I win that day or do I have to wait 24 hours before I can play that game again? In other words do I get one shot at it each day?
Answer: You can try as many times as you like, but once you complete the level, you need to wait.
I literally just posted an answer on how to get full lives instantly.  The same concept would apply here...If you wanted to play multiple quests per day, you can change the date to tomorrow in your Date & Time settings and you will be able to do multiple mystery quests. Just make sure to change the date back.  Hope this helps!

Moving on in Candy Crush


Can I run an Arduino off 8 x AA batteries?

Question: Can I run an Arduino off 8 x AA batteries? The documentation says it can run from 5-12v which is in the limits of the the specs.  I wanted to ensure I had more than enough power for anything else I wanted to drive through it.  Would it be better to run the Arduino off a 5v regulator from the 8 battery supply then draw anything else off the power supply directly?
Comment: What regulator IC does your Arduino use?
Can you post a link?
Comment: The UNO uses the MC33269D-5.0 which has a maximum \$V_{in}\$ of 20V.
Comment: @Mech Software - Can you please confirm: / The requlator used / the Arduino you are using and preferably links to both, but [MC33269D-5.0 data sheet here](http://www.onsemi.com/pub_link/Collateral/MC33269-D.PDF) . | Note that if the regulator is 5 volts out then it needs 1.25V headroom at 500 mA and 1.35V at 800 ma. So Vin min = 5V + 1.35V = 6.35V.6 cells are getting marginal.  8 are OK.
Answer: The first thing the power jack goes to inside the Arduino is a 5V regulator.
This can (for the UNO at any rate) supply a maximum of 800mA.
Any more than that and you will have to use the external power.
How much current the AA batteries can supply depends on the chemistry.
But yes, you can run (and many people do) off 8 AA batteries.
Answer: What regulator IC does your Arduino use?
 Can you post a link?

Yes, you can PROBABLY run you Arduino from 8 x AA batteries.
There is a small risk that brand new cells will cause problems - see below.
If you care about battery life you can get a useful gain in lifetime using a buck regulator to step the voltage down. If your Arduino regulator will really accept 5V then you may get 50%+ xtra battery life by using a buck converter to convert battery voltage to 5V

IF the Vin min spec is really 5V then you would be better off using 6 x AA.
 This allows operation per battery down to 5V/6 = 0.8333 V. That is essentially flat for all cells. An alklaine cell has a very tiny % of total energy left.
If you only use a linear regulator then using 6 cells instead of 8 has very little downside and you need 6/8 as much battery capacity.

If the spec is 5 - 12 V in then you will exceed that voltage using new AA Alkaline batteries !!!
 That is PROBABLY OK but you want to check the Arduino's 5V regulator spec.
 Note that some regulators have a low Vio max (12V or less in some cases) and exceeding it even slightly MAY cause damage.
An Alkaline battery will typically provide 1.55V when new.
 8 x 1.55 = 12.4 Volt.
 The 0.4 Volt seems like a trivial amount to worry about, and it probably is unimportant - but in electronics you should always be wary of exceeding data sheet rating sby even the very smallest amount.
 It MAY be OK to do so.
 You MAY choose to do so.
 But you MUST check and know what you are doing and why and what the  implications may be.
 Failure to do this will mean you end up with "designs" like those that most people produce :-).
Worst case an Alkaline  cell can produce 1.6V or slightly more.
 1.6 x 8 = 12.48
 Not a lot different.
A Nickel Zinc cell produces 1.6% V or more when new.
 1.65 x 8 = 13.2 V
 Definitely getting into the "better check the requlator" territory.
An Alkaline cell is dead dead dead flat at 0.8V, and dead flat at 0.9V
 8 x 0.8V = 6.4V so lots of headroom.
NimH or NiCd should not be discharged under 1.0V and have a max voltage just after charging of about 1.3V + - so inside Alkaline range at both ends.

It has been suggested by @Majenko that the regulator is a MC33269D-5.0
If so, the regulator outputs 5V and needs a MINIMUM of 6.35V to be guaranteed to operate at 800 mA under all temerature conditions. Slightly ove 6V in may be OK in most cases.
MC33269D-5.0 data sheet here
If this is the regulator used it is 5 volts out an needs 1.25V headroom worst case at 500 mA and 1.35V at 800 ma.
So Vin min = 5V + 1.35V = 6.35V.
 6 cells would need to make 6.35/6 = 1.06V each to operate this worst case.
 In practice it will usually be able to be somewhat lover than this.
So, 6 cells are getting marginal BUT you get reasonable but not complete  utilisation of cell energy.
8 cells will be OK.
 Vin max is 20V so no problem there.
If this IS the regulator IC then the spec should be about 6.6V - 20V.
For higher Vin's energy losses get severe. A buck regulator or similar would make much sense.
Energy loss as heat = (Vsupply - Vout) x Iout.
 At 800 mA and say 10V in and 5V out
 energy loss = (10-5)*0.8 = 4 Watts.
 A substantial heatsink would be needed on the Arduino regulator.
Comment: We haven't considered heat. I've hooked up an Arduino to 12V with a Zigbee and ethernet module on it. I can tell you, the regulator is getting very hot (too hot to touch). 'Very hot' is not something I actually measured, but it may be that 12V can damage the regulator if it's operated at high loads.
Comment: A NimH that reaches 1.8V under charge is being grossly abused. At 1C charge they terminate under all typical termination methods (negative delta V, delta Temp, absolute temp) at almost exactly 1.45 V almost always. I have often watched terminal voltage at end of charge on many many charges and never seen any healthy call get as high at 1.5V. (I've been involved with 1 - 2 million NimHs in products the last few years. That's not my main focus but I've played with quote a few along the way. NiCd I can't say as much for BUT see no reason for them to be vastly different.
Comment: @Hans - The regulator on most Arduinos has thermal overload protection, so you won't damage the regulator or circuit.  It could cause the device to shut down, which might be problematic, but it won't burn anything up.
Comment: It's not that we haven't considered heat, it's that the user has asked a question that has less data than could be provided. So far requests for extra data have not produced answers. Could be a time zone issue and having to work to make ends meet. At 12V in at max regulator current Pdiss =~ (12-5)*0.8 = 5.6 Watt. A goodly amount.  Whether the Arduino has a heat sink to handle anywhere like this I know not.
Comment: I've been told by manufacturers in the past that NiCd can possibly reach 2.0V while charging and NiMH can reach 1.8V while charging.  Have not personally seen them go that high (more like 1.45V), but those are what I'd consider the safety limit numbers - have you seen the same thing, Russell?  Not so much a consideration if the product does not charge the battery in place, e.g. you have to remove AA cells to a separate charger.


Why did FDR decide to implement a maximum wage through taxation rather than a simple ceiling?

Question: In 1942, President Franklin Delano Roosevelt (FDR) asked Congress to implement a 100% tax on all incomes over $25,000 (around $375,000 today). This was backed by the unions and a clear majority of the voting public. In fact, such a tax was not wholly implemented. It reached a maximum of 94% in 1944 and hovered around 90% for the next two decades! This suggests it was a popular measure. This, in essence, is a proposal for a maximum wage. Why was it implemented through the tax code rather than simply stipulating a simple ceiling?
Comment: Not mentioned in this question are the crazy loopholes that people could exploit. In reality, the effective rate was something like 38% (varied, but you get it) which is only a few points higher than what we have today. The idea that the US had a real, practical, effective rate of 90% is absurd. Sure, there was a 90% bracket but nobody *actually* paid that.
Comment: If it *had* worked as advertised, imagine what it would be like near the end of the year when most of the highly paid professionals (e.g. surgeons) had reached their limit and decided to take a long vacation until January.
Comment: @acpilot I think you're confusing not paying it with not being effected by it. Sure, high income people didn't pay 90% of their income in taxes, but that's just a function of how marginal tax rates work. If the IRS comes to take 90% of your paycheck after 400k and thus you work fewer hours to come in at just above 400k. The article you linked to doesn't describe loopholes for high income folks, just high income people responding to incentives. A real, practical, effective rate of 90% is absurd, JFK understood that and helped increase revenue by cutting tax rates.
Comment: What was the objective behind having a 90% tax bracket if there were loopholes to get around it? Were these loopholes known/were there attempts to close them?
Comment: https://taxfoundation.org/taxes-rich-1950-not-high/
Answer: Federal spending
Obviously, a tax has the significant advantage of providing money to the government, something that a ceiling simply does not do. Unsuprisingly, many presidents would prefer to have more money to allocate to their preferred budgetary purposes. In Roosevelt's case, this was World War II. Roosevelt all but said this explicitly in his April 27, 1942 fireside chat:

Are you a business man, or do you own stock in a business corporation?
Well, your profits are going to be cut down to a reasonably low level
by taxation. Your income will be subject to higher taxes. Indeed in
these days, when every available dollar should go to the war effort, I
do not think that any American citizen should have a net income in
excess of $25,000 per year after payment of taxes.

As always with politicians, it's difficult to say what his true motivations were. However, though Roosevelt is largely remembered for his social programs, he also was very dedicated to the American war effort, so this wouldn't have been out of character for him.
Inflation was also a concern. Roosevelt's treasury used this as an argument for the tax:

In late 1943, Treasury Secretary Henry Morgenthau asked Congress for
another tax increase. He framed his appeal, in large part, as an
anti-inflation effort. The new act, he argued must help stop
inflation. "[N]othing in the economic field can interfere with the war
effort as much as an uncontrolled rise in prices," he told the House
Ways and Means Committee. "An inflationary price rise is a source of
grave social injustice. It undermines morale and impedes war
production. It strikes at random without consideration of equity or
ability to bear the hardships which it imposes. Once it has acquired
momentum, inflation is extremely difficult to control, and leaves a
heritage of post-war stresses and strains that will haunt us for
decades."

Now, if a direct wage ceiling were imposed, companies, unable to spend that money on attracting more highly-paid CEOs, might spend it on competing for labor lower on the company totem pole. This would lead to more money in the pockets of somewhat lower-paid workers, which might be a nice thing for reducing income inequality, but could lead to excessive spending and spur on inflation. I'm not sure how plausible this justification is, though: since the taxes were intended to be put back into the economy through military spending, it's possible they could have had the same effect.
Comment: @Joe - That's true, *if* CEO and other salaries are being set by fair market competition. If, on the other hand, CEOs are being overpaid, and this prevents companies from having enough money to pay non-CEOs whatever market supply and demand would otherwise determine, then a CEO pay cap might free up money to pay non-CEOs closer to the market rate.
Comment: This is a good answer because it highlights FDR's publicly stated justifications. The possible benefits of a ceiling seem dubious however; companies would more likely switch to non-monetary compensation for their CEOs instead of pay more on low wage workers. A ceiling doesn't change the relative scarcity of the skills possessed by CEOs and low wage workers, and pay is largely determined by that scarcity.
Comment: If there's anything wrong with the economics, please tell me so I can correct it.
Answer: If he just wanted to have a maximum wage of $1,000/hr, he probably could have just passed a law stipulating it.  However, FDR was trying to create a maximum income, not a maximum wage.  The government liming the total of dividends from stocks, interest from bonds and appreciation on homes via a legal maximum would be confiscatory and therefore unconstitutional.  However, the government does have the ability to tax due to the 16th amendment.
This is also why Obama (and the Congresspeople working with him) did not add a fine for not buying healthcare - they created a tax (the Shared Responsibility Payment).
I'll leave aside questions about whether it's prudent to have such a measure in place.  If you want to discuss that (and you seem to), I recommend creating another question.
Answer: There are multiple reasons, which I could think of, for not implementing such a move in any country.

People will stop working hard, once they reach the max level.
Companies growth just stagnates over a period.
Fraud will be the final output from a nation.
No Role models for upcomming generations.

If a capable gifted worker reaches the maximum earning threshold, the government rules ensure he doesn't produce any more. This is a negative for the country as a whole. If such an individual is allowed to grow further, he would venture into other areas and will take additional risks to produce better products. In the process, he will spend more on infrastructure and other goods, causing a natural growth in demand throughout the economy.
Companies cannot hire better management executives. There is no incentive for people to accept additional challenges, upon reaching the earning threshold. This stagnates the movement of skilled people venturing into unknown territories. Innovation takes a hit as people grow complacent to changes.
If a person reaches earning threshold, he starts to conceal some of his income, to save some additional money from the Tax Man. This causes lots of money being moved into the black market, essentially encouraging under the table transactions everywhere. There won't be any invoices for goods purchased or sold. The whole society moves into No invoice system. No one will pay any taxes. All business people will deal only in cash. Essentially encouraging to commit financial crimes to have what you earned legitimately.
Those who are slightly ethical will immediately start a company on his family members names and starts to move income to their partners/children's names/companies. Essentially, trying to escape from enforced threshold levels legitimately. Determining such actions is extremely complex and consumes a lot of resources, and often with family members being partners in crime, they aren't going to lose. People will find new ways to break the enforced threshold levels. (Not applicable for salaried people, but for those who are in business)
Cheating & fraud will be the only game in town, to survive. The one who cheats is allowed to grow more and the one who is honest will have to stay low. What message does it convey to the others of the nation? Cheating and fraud will propagate every nook and corner of the economy. If such a move happens, there isn't a way back to honesty. For-ever.
Ceiling one's income through taxation will have similar outcomes unless you let the individual keep some of his legitimate earnings.
If you don't let people grow, Musk would have ended his career at PayPal. There wouldn't be a "Tesla", or a "Solar City" or a successful space program. No Auto-pilot cars, etc. Today, he is a role model to millions. If you enforce ceilings on income, There wouldn't be any role models for future generations to emulate. There will be only fraudsters.
Comment: Do you have any references that these consequences ever happened (anywhere in the world)? If so, please refer to them in your answer.
Answer: There's actually very little functional difference between a high marginal tax rate and a wage ceiling. The Laffer curve is an idea in economics that stems from the idea that at a tax rate of 100%, no one works and that at a tax rate 0% everyone works what they naturally would, but somewhere in the middle people start to work less (fewer hours, less risk, less education, less hard) to make less money since it's not worth it. The curve is a relationship between government revenue and tax rate. At 0% tax rate revenue is 0. As tax rates increase, revenue increases, but at some point tax rates get too high and too many people start not working so revenue decreases. Eventually at 100% tax rate revenue is again zero. People on the left and right agree with the rough shape of the curve, but sometimes disagree with where exactly increasing taxes starts to reduce government revenue. Below are some possible shapes for the curve:

In an effort to maximize revenue, every country in the world currently has a top marginal tax rate of below 60%. Even very egalitarian nations like Sweden don't want rates so high that they reduce the money available for public spending. A 90% top tax rate results in people taking home just a quarter of the money they would receive compared to the highest tax nations on earth today. A 90% top marginal tax rate severely disincentivizes people making money past the cutoff, to the extent that it functionally acts almost the same as a wage ceiling.
Answer: It was most probably easier.
Setting tax rates is something that governments do all the time.
Yet, setting a maximum limit on the wage you could be paid-out, is a very tricky proposition. Especially in the US with its traditional high evaluation of individual freedom.
I guess it would have been legally straight impossible for FDR do impose a wage cap on private businesses.
I am interested in any more in-depth views of people who actually know the US law.
Answer: Because there is a difference in income in regards to income tax and wages in regards to a job. Going with the $25,000 and 100% tax rate that was suggested at the time. I will give an example of differences between the proposed idea and a cap on wages.

Tax rate increases at $25,000

Case 1: 1 job at $50,000 results in $25,000 in extra taxes
Case 2: 2 jobs both at $25,000 for a total income of $50,000 results in $25,000 in extra taxes

Wage cap of $25,000

Case 1: 1 job at $50,000 results in a pay cut which results in lower tax revenue in general.

It could also result in the job being split into two jobs for the person to get around the wage cap such as in case 2.

Case 2: 2 jobs at $25,000 results in no changes to taxes
Answer: A number of answers here analyse the effects through the supposed behaviour on the employee.
A much-neglected purpose of high taxation is to penalise competition for scarce forms of labour, and encourage employers to engage in workforce planning and redesign of jobs and organisations to reduce reliance on scarce labour.
It achieves this purpose by ensuring that for each unit of money wage granted to the employee, the employer effectively has to pay a massive surcharge to the state which is a large multiple of the wage granted to the employee.
The reason a hard wage ceiling is not imposed (save perhaps during wartime) is because this allows the market mechanism still to work, and still allows corporations to solve urgent recruitment problems by paying swingeing amounts of tax.


Using Nginx as a reverse proxy for a PHP site using Apache with URL rewriting

Question: I'm trying to use Nginx as a caching reverse proxy for Apache running a PHP site. It's kind of working but the problem comes when trying to rewrite the URL to the Apache setup, it doesn't work as I would have hoped. Here's the setup.
I have a Joomla based PHP site running on Apache, ports 8080 (http) and 44343 (https) - this works fine and there's no problem here. I have removed  the Joomla .htaccess file as I assume Nginx will do the rewriting to index.php itself and take  care of caching the necessary PHP files.
Joomla rewrites the URL like this example.com/page1 => example.com/index.php/page1
I have Nginx listening on ports 80, 443. Below is the site config
server {
   listen 80;
   listen [::]:80;

   server_name    www.example.com
   return         301 https://$server_name$request_uri;
}
server {
    client_max_body_size 100M;
    autoindex off;

    listen 443 ssl;
    listen [::]:443 ssl;

    server_name www.example.com;
    server_name_in_redirect off;

    ssl_certificate /example.com/ssl.crt;
    ssl_certificate_key /example.com/ssl.key;

    root /var/www/site;

    index index.php index.html index.htm default.html default.htm;

    location / {
       try_files $uri $uri/ /index.php$uri;
    }

    # Reverse Proxy and Proxy Cache Configuration
    location ~ \.php {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $host;
        proxy_pass https://127.0.0.1:44343;

        # Cache configuration
        proxy_cache reverse_cache;
        proxy_cache_valid 3s;
        proxy_no_cache $cookie_PHPSESSID;
        proxy_cache_bypass $cookie_PHPSESSID;
        proxy_cache_key "$scheme$host$request_uri";
        add_header X-Cache $upstream_cache_status;
    }

    ...
}

So this loads the site but no matter what page I go to, it always loads the homepage. It doesn't appear to be sending the $uri to index.php as expected in the try_files part.
The only way I can make this work is by modifying it in the following way:
    #location / {
    #   try_files $uri $uri/ /index.php$uri;
    #}

    # Reverse Proxy and Proxy Cache Configuration
    location / {
        ...
    }

This just sends the entire request to Apache, and I have to bring back the .htaccess file which allows Apache to do the rewriting.
The site loads as expected, but the problem is that no PHP files are cached (as checked in /var/cache). So Nginx will have to do the rewriting in order to know which PHP files are cached for which request.
Any idea how I can do this?
Answer: Just a suggestion, but your upstream app may also require the query string together with the original URI. You could try modifying your default URI as either:
try_files $uri $uri/ /index.php$request_uri;

or:
try_files $uri $uri/ /index.php$uri$is_args$args;

The nginx variables are documented here.


Does SAP Business Objects 4.1 version support Snowflake cloud database?

Question: We are upgrading database from Teradata to Snowflake cloud database. We have SAP Business Objects BI Platform 4.1 Support Pack 8 Patch 3 Version: 220.127.116.118. Is this version of SAP BO compatible with snowflake or we must upgrade to SAP BO 4.2 ? Upgrading is not part of our original plan, hence need definite answers so that I can tell the same to client
Answer: According to this blogpost (https://blogs.sap.com/2020/03/12/snowflake-for-sap-businessobjects-4.2-sp08/) only SAP BI 4.2 SP8 or above is able to connect to Snowflake with a Snowflake specific driver.
But you can still try to use JDBC: https://blogs.sap.com/2018/11/20/how-to-set-up-sap-businessobjects-with-snowflake-using-jdbc/
Comment: You can also use Generic ODBC for BI4.1.


Is a response rate of a population considered the sample?

Question: Let's say my survey population size is 1000 and I send a survey to all 1000. And only 200 responded. Is the 200 considered my sample size? If yes, can I calculate a margin of error on the questions in the responses?
Comment: You conducted a census with a 80% non-response rate. In your place, I'd be worried about participation bias and volunteer bias.(See https://en.wikipedia.org/wiki/Participation_bias https://methods.sagepub.com/reference/encyc-of-research-design/n492.xml ). If your question is if it's reasonable to simply ignore this non-response problem and treat it like a random sample without giving a thought about it, then unfortunately it's probably not. There may be ways to deal with this issue, but it's difficult to suggest something without more info about the survey and the population.  (cont'd) .../...
Comment: .../... For example, do you have some other relevant information about the whole population (gender, age...), that would allow for a comparison with the respondents? What are some of the questions you asked and the answers the respondents could give? etc.
Answer: Good question. I think it depends on what you are planning to do with that data. For a regression model or hypothesis tests, you'd probably consider 200 as the sample size as you are not including these non-responses in the model.
On the other hand, if you are using something like a decision tree (or any machine learning extension like random forests), you might include missing responses as an explicit outcome (probably not for 800 out of 1000, but in principle you might). I believe in your use-case it would be 200.


Detect Mob between 5 and 10 blocks away from you

Question: I am making a lightning sword. I want to strike lightning on a mob that is within 10 blocks, but at least 5 blocks away from me. Is there any command that can do that (Multiplayer friendly)?
Comment: Have you made any attempt to solve this yourself? Arqade works better when askers show effort to solve their own problems; we see that you have a problem you've worked on, and answerers respond to that. You also get a more specific answer that's tailored exactly to the part you're stuck, and Arqade gets a very specific question. Everybody wins!
Answer: What you need to do is to chain the execute command, and use the r and rm target selector arguments. The latter denote maximum and minimum radius distance from the execution point, respectively.
First, you have to execute on every player triggering the lightning sword. For this command, I'll assume those players have a triggerLightning score of 1 (How or when you set the score is beyond the scope of this question/answer.)
At the location of this player, we start looking for a (single, c=1) entity between 5 and 10 blocks away (r=10,rm=5).
At the location of the entity, we summon the lightning bolt.
execute @a[score_triggerLightning_min=1] ~ ~ ~ execute @e[r=10,rm=5,c=1] ~ ~ ~ summon LightningBolt


What is a good lens for a Canon 5d for birds/wild life with a budget of 1500 dollars

Question: I am planning to buy a Canon 5d mark III, for landscape, wild life and bird photography.  What would be an ideal lens with a budget of 1500-2000 dollars?  And specifically, what is your opinion on the Canon EF 100-400mm f/5.6?
Comment: If this is your main goal, consider a 7d. Since the cropfactor is pretty neat for long lenses.
Comment: Specifically "What is your opinion of XYZ" lens is off topic here. See our FAQ on how to ask question: http://photo.stackexchange.com/faq
Comment: I'm not gone repeat what Michael Clark and chuqui voiced out that 100-400mm is great lens. I just gone say I was in same situation as you not long ago. I took it slowly, I got my self first 100-400mm, then replaced second hand Tamron 75-300mm with 70-200mm and year later got my self 24-70mm. In 2 weeks I'm off to workshop with Ross Hoddinott and I just rented 17-40mm to see the performance. If you can rent or borough from friend before you buy then do it. It is worth it
Comment: I own a 7D and I would recommend against it compared to the 5DIII. What you gain in crop factor you lose in sharpness to noise reduction, and you can buy a lot of shutter speed with the two stops of *usable* ISO you gain with the 5DIII. The focus system of the 5DIII, shared with the 1D X, is far more consistent than the 7D. The 7D focus system looks good on paper and is very configurable, but none of that matters when it consistently back focuses on one frame, front focuses on the next frame and hits close to focus on the third frame of a three shot burst.
Answer: AT 400mm, where you would use the EF 100-400mm f/4-5.6L the most, the EF 400mm f/5.6 is noticeably sharper, especially at mid frame and on the edges. It also costs about $300 less. You give up Image Stabilization (IS) and the ability to zoom out to 100mm.
For birding and wildlife, IS is not a huge consideration because you're going to need to use fairly fast shutter speeds to freeze the motion of your subjects anyway. IS only helps reduce camera motion. It does nothing for subject motion.
For most typical landscape photos, 100mm is still a little long, so you're likely going to need another lens for that role regardless of what you choose for your long telephoto birding/wildlife lens. Unfortunately, there's not a real good FF standard zoom lens for the $660 left in your budget if you were to purchase the EF 400mm f/5.6L, much less the $300 left in your budget if you purchase the EF 100-400mm f/4-5.6L IS. The closest would be the EF 24-105mm f/4L IS that runs around $1,150.
Comment: the 24-105 is the wide angle zoom I use, and it's a nice partner to the 100-400. you can pick it up for $800-850 used in good condition from places like KEH. I recommend being really careful about buying a 100-400 used, because it's design makes it susceptible to bumps and bruises, but I bought my 24-105 used and it rocks.
Comment: I disagree with the idea that IS isn't a huge consideration for birding and wildlife. It's the difference between handholding a 400 or 500mm lens and having it put on a tripod and gimbal. With the big (heavy) glass, it does make a significant difference in usability in many situations.
Comment: You are certainly entitled to your opinion, but more members of this community seem to feel otherwise. Some of us feel that anything longer than about 300mm needs to be supported by a tripod or at the very least a monopod. Gimbal mounts aren't cheap, but I feel they give better results than hand holding a 400mm or 500mm lens, even one with IS. The 100-400 has both many fans and many detractors. Personally, I've never cared for push/pull zooms (otherwise known as *dust pumps* ).
Answer: The 100-400 is a good lens to get started with and in your budget.
I've talked about this configuration in the past -- try here: What size lens is recommended for flying bird photography?
Comment: thanx !! your such a detail n descriptive comments about birding photography was helpful..


How to find orthonormal basis function in the following digital communication problem?

Question: I'm trying to express the following set of signals on orthonormal basis functions. These signals are to be transmitted using a 4-ary modulation scheme.How do i write ψ1(t)and ψ2(t) for the same. Also how to find orthonormal function set for given set of signals.
Comment: You need to apply the Gram-Schmidt algorithm, which is probably described in the same textbook the problem came from. If you have a specific problem applying the algorithm, please add it to your question.
Comment: Hey! Thanks. This is a problem I found in old notes of my senior. Can you pls name the book you are referring to? B. Sklar?
Comment: I'm sure it's in Sklar, but I don't have it at hand right now. It's also in Wikipedia.
Comment: Here is [a note](https://courses.engr.illinois.edu/ece461/spring98/book1/Signal_Space.pdf) (hopefully accessible world-wide) that I wrote a long time ago describing the Gram-Schmidt process.
Answer: Let's call your $4$ signals $f_0$, $f_1$, $f_2$ & $f_3$.
Just by eyeballing you could have a basis of two function where
b0 = f0, for 0 < t < Ts/2, 0 otherwise and
b1 = f0, for Ts/2 < t < Ts, 0 otherwise and

So you basically have a one first half ramp up in the first half and one second half ramo down. The signals can be expressed simply as
f0 =  b0 + b1
f1 = -b0 - b1
f2 =  b0 - b1
f3 = -b0 + b1

So it's clearly a base. It's also orthogonal since $b_0  b_1$ is zero for all $t$. It's probably not normal but could be easily made so by proper scaling.
Answer: Even more simpler than @Hilmar's answer, the signals $f_0$ and $f_2$ are
orthogonal just by eyeballing the pictures and recalling basic ideas about
integration giving the area under the curve. Thus, the signals are
$f_0, -f_0, f_2, -f_2$ with respect to the orthogonal basis $\{f_0, f_2\}$.
The basis could be made a orthonormal basis (unit-energy basis signals) if
absolutely needed.
Interestingly, the above description shows that the four signals are a
bi-orthogonal signal set -- a $4$-QAM signal set rotated by $\pi/4$ in signal
space --  for which the symbol error probabilities and bit error probabilities
have been studied and documented throroughly. The bi-orthogonality is not
as easily noticed with the basis used in Hilmar's answer.
As a minor note, if we use the Gram-Schmidt orthogonalization procedure
(as suggested by @MattL in a comment) starting with $f_0$ and continuing with $f_1, f_2, f_3$, we end up
with $\{f_0, f_2\}$ as the orthogonal basis for this set of $4$ signals.


Can I split the feed to a duplex 20 amp receptacle from different capacity circuits?

Question: Is it possible to split-feed a 20 Amp receptacle with one receptacle using 15amp and the other 20amp circuits?
Comment: Smells like an XY-problem. What are you really trying to solve here?
Comment: Why are you trying to do this?
Comment: Your question is a little unclear.  We need more details and need to understand the problem you are solving.
Answer: No, you can't feed a split receptacle from circuits with differently-sized breakers. Here's why:
You can, but you have to meet certain conditions:

The National Electrical Code now requires that the two hot wires in a split receptacle must be connected to a double-pole circuit breaker, so that when the breaker is shut off, the action will automatically disconnect both receptacles. That way, the outlet will be safe to work on.
source: The Spruce

To my knowledge, handle-tied double breakers with different current ratings don't exist. However, as ThreePhaseEeel points out, you may be able to find UL listed handle-ties for your breaker brand. This would require that they be mounted adjacent. Or you could reduce the 20A circuit to 15 Amps and use the same wire.
Comment: You could use a 15A and a 20A single pole with a handle tie connecting the two...
Answer: I'll be darned.  You can do it.
The crux of the issue is supplying a 20A NEMA 5-20 receptacle (T-shaped neutral) on a 15A breaker.
Since you will only have one socket on the entire circuit, this applies.

210.21(B)(1) Single Receptacle on an Individual Branch Circuit. A single receptacle installed on an individual branch circuit shall have an ampere rating not less than that of the branch circuit.

So a solitary socket on a 15A circuit must be at least 15A.
What if the circuit had more than one socket?
However, if this 20A circuit supplied other receptacles, then you wouldn't have a solitary outlet. Table 210.21(B)(3) would apply, and 15A receptacles would be allowed on a 20A circuit -- but 20A receptacles would not be allowed on a 15A circuit.

How do you breaker this thing?
Because you have a single yoke with two separate circuits on it, the circuits must have common maintenance shutoff.  Having two breakers with different values can be accomplished by using individual 1-pole breakers and identified (listed) handle ties.
Answer: Isherwood raises the most relevant point I think, but another issue is that you would only be able to use an outlet (with the tabs removed) with maximum 15A rating.  This pretty much negates any advantage of having a 20A circuit (presumably with 12G wire run) anyway.


can a single SQL Server connection be shared among tasks executed in parallel

Question: Can a single SQL Server connection be shared among tasks executing in parallel? Each task would dequeue an item from a ParallelQueue, instantiate a SqlClient command, and insert a row into the table. Or does each command-instantiating-task require its own dedicated connection to the database? Can the connection(s) be instantiated and opened at the top of the method and then closed when the parallel tasks have been completed, or should each task instantiate, open, and close its connection?
Answer: A SQLServer Connection can be shared by multiple tasks executing in parallel, e.g. threads in a C# program or requests in an app server. But most use scenarios would require you to synchronize access to the Connection. A task will have to wait for the connection if another task is using it. By the time you build a shared connection mechanism that does not break or become a performance constraint for your parallel tasks, you have likely built a connection pool.
Another way to look at it is, yes you can share a pool of connections among a set of threads and let the connection pool handle dispensing connections and connection state cleanup. Microsoft's .net data access had very capable connection pooling as of 3 to 4 years ago when I last used it. With connection pooling you don't have to spend a lot of extra time opening and reopening connections. You don't have to hold open more connections than you actually need to use in a large long running application. You reuse connections when they are available, and automatically open a new connection when needed, automatically close them when they are no longer needed, e.g. after an inactivity period.
Connection Pooling may be a good answer. Just holding a connection for each task may be a good answer.
Answer: Usually an enterprise application server would have a datasource configurable through which an API could make requests. For example, WebSphere servers have a datasource which can be called via a defined JNDI name from a persistence framework (JPA, Hibernate, ...) within EJBs which handle threading on their own.
So yes. However, I would highly recommend utilizing a framework to do this.


meaning of 百日のつもり

Question: I am reading a book and found this paragraph that I don't understand
小生の命も後百日のつもりその間身のすりきれるほど働くつもり
I am getting that he intends to live what is left of his life working until his last breath.
I am not sure what 百日のつもり means. I have searched and found that 百日 means lots of days is that correct or there is an old meaning for this word?
Answer: It consists of two sentences (where copula is omitted in both)

小生の命も後百日のつもり
その間身のすりきれるほど働くつもり

In the first, 小生の命 is the subject to 後{あと}百日{ひゃくにち}. It literally means (The rest of) my life is (only) another hundred days. Since it is appended by のつもり, the speaker says s/he would pretend as if her/his life would end in 100 days.
Comment: sorry to ask again here is the full sentence 彼我戦力の差は益々歴然 たるものあり もはや最終 的段階と申すべき事態に突 入致し小生の命も後百日の つもりその間身のすりきれ るほど働くつもり」would you please share with me what he means by it? Does he mean he will work hard as if his life will end soon?
Comment: @JAM Freely translated, it means *Now that the difference in power between us and enemy is obvious, we are in the final stage. I'd assume I have only 100 days left for my life. I'll work to the end, till I'm worn down*. Is it a note of a WWII fighter or something?
Comment: Thank you, this is what I have understood but was not very sure about the hundred days and why specifically 100 days, Yes it's part of Yamamoto Isoroku's diaries during WWII
Comment: @JAM Re 100 days, I guess it is just a random easy number, but he expected that  Japan couldn't fight more than a year (see [here](https://ja.wikipedia.org/wiki/%E5%B1%B1%E6%9C%AC%E4%BA%94%E5%8D%81%E5%85%AD#%E7%AC%AC26%E4%BB%A3%E9%80%A3%E5%90%88%E8%89%A6%E9%9A%8A%E5%8F%B8%E4%BB%A4%E9%95%B7%E5%AE%98): 初め半年や1年の間は随分暴れてご覧に入れる。然しながら、2年3年となれば全く確信は持てぬ) so it could be that 100 days is just more or less literally what he thought (*I really have to finish the war in 100 days from now*).

meaning of 百日のつもり


Would like to know if US patent 5,714,464 is still a valid Patent?

Question: Would like to know if the US Patent, 5,714,464 is still a valid Patent?
Answer: It appears the patent owner did not pay the 12th-year maintenance fee that was due by 2/3/10 with a surcharge.  The USPTO's PAIR site indicates "Patent Expired Due to NonPayment of Maintenance Fees Under 37 CFR 1.362."


JMX connection to cloudfoundry

Question: I have an app deployed to Cloudfoundry that I've exposed JMX MBeans interfaces for our logging levels.  I'd like to connect to the cloudfoundry instances with jconsole.  Is this possible?  How do I make this happen?  What if I'm running more than 1 instance of Tomcat, how do I connect to a specific instance?  or does it matter?
Answer: There is currently no way to connect to once specific instance of an application or for that matter any port other than http port via the main Cloud Foundry router.
Answer: In the platform we use an app deployed alongside the Login and UAA components (https://github.com/cloudfoundry/identity-tools/tree/master/varz).  It gives read-only access to selected MBeans through a CF-like REST interface.  It is opinionated about the most important MBeans to expose and may break on complex object graphs, but you can adapt it if you want.  You could rip out the controller and use it in your app or do the same as we do in the platform with a standalone app, deploying your own war and the varz in the same container.
Also see Jolokia for a generic JMX REST wrapper.

JMX connection to cloudfoundry


accelerated turns in helicopter

Question: In flight Manual of Russian Mi-17 helicopter, it is give that "max bank permitted in accelerated turns is 45 deg up to 1km altitude". At the same time it also mention max bank permitted is 30 deg up to 1km altitude.
What do we mean by accelerated turns and why difference between max bank permitted values ?
Comment: Can you provide a link to the document that you're quoting from?
Comment: Sorry Ralph,  I don't have soft copy with me.
Thanks for time n effort.
Answer:
What do we mean by accelerated turn

If "we" is intended to refer to the aviation community as a whole, rather than to the authors of the Mi-17 flight manual--
The term "accelerated turn" has no generally recognized meaning in aviation, and doesn't really make sense.  All turns are a form of acceleration, namely, centripetal acceleration.  Meaning that the net force acting on the vehicle cannot be zero in turning flight.1
My interpretation of the content at the top of page 2-5 of the Mil-17 flight manual is that it is trying to convey that there is a certain speed range (120-250 kph) where, if at low altitude and not above normal operating weight, the helicopter may be banked more steeply than otherwise be permissible.  The choice to apply the specific label "accelerated turn" to this particular situation may be somewhat arbitrary, and may not reflect a standard terminology in the rotorcraft context.2
Footnotes:

In relation to winged aircraft (rotorcraft dynamics may be different), one could concoct a definition of "accelerated turn" that meant that the wing was producing more lift than the aircraft's weight, so that the G-loading was greater than one.  If the aircraft was then brought to the stall angle-of-attack while holding the G-loading constant, a stall entered from this condition would produce an "accelerated stall", where the stall speed was greater than the aircraft's normal straight-and-level stall speed.  Conversely, if the wing was producing less lift than the aircraft weight, so that the G-loading was less than one, a stall entered from that condition while holding the G-loading constant would produce a stall at an airspeed lower than the normal 1-G stall speed.  It is possible to turn with a G-loading of less than one, but (at least in the context of coordinated flight rather than "knife-edge" maneuvers where the airflow is striking the side of the fuselage and creating a lifting force) the flight path will always be curving earthward due to insufficient lift.  And therefore such maneuvers may only be sustained for short time scales.  (The "top" part of a steep-banked, exaggerated "wingover" is an example of such a case-- the G-load may drop well below 1 G, and the airspeed may drop below the normal 1-G stall speed, but neither condition can persist for long.)  But even in a turn that was "non-accelerated" according to this made-up definition, the net force on the aircraft would be not be zero and the aircraft would be in fact undergoing a centripetal acceleration-- as well as, in most cases, an acceleration component along the instantaneous direction of the flight path.  So let's throw this made-up definition into the garbage bin.

Thanks to this related answer for bringing this page in the flight manual to our attention.
Comment: @RTO-- good point; my footnote was addressing the airplane situation.  I don't have much knowledge about helicopters.  Will edit to clarify.
Comment: Thanks quite flyer
Answer: The Mi-17 flight manual shows those limitations on pages 2-4 and 2-5, but under different circumstances.
The normal bank angle limitations have weight and altitude limitations.
The statement of allowed bank angle in accelerated turns states turns up to 45 degrees are allowed in accelerated turns at up to 1000 meters altitude,  airspeeds between 120 and 250 km/h and "normal or subnormal gross weight".
Essentially, the flight manual is telling you the limits during normal flight ops, but also what the limits are if you need to engage in extreme maneuvers, like getting out of the way of a missile about to come up your rear, for example.
Answer: I would interpret an accelerated turn in contrast to a steady turn.
A steady turn is one that can be conducted without losing energy -- speed and altitude.  It is fundamentally a power limit.
Turns can also be limited by stall or structural limitations.
If (at a certain flight condition) you turn at greater than the max steady turn rate (but still within stall and structural limits), you will have to bleed off speed and/or altitude to continue the turn.
Of course, the other way to have an accelerated turn (i.e. a turn that is not steady) is to turn at a rate that is less than the steady turn limit (while at full power) -- in that situation, the aircraft would be able to climb or increase speed during a turn.  I don't think this is what they're talking about here.
Comment: In other answers on ASE, I'm pretty sure I have seen the word "stationary turn" used to describe what you are calling a "steady turn".  So it seems you are suggesting that what might logically be called a "non-stationary turn", is what the manual is calling a "stationary turn".  But-- in relation to the loads that the helicopter structure can tolerate-- why would it really matter whether the aircraft is losing energy or not?
Comment: I'm largely using fixed-wing language when I say steady turn and then extend to accelerated turn.  The structural limit does not care about whether the aircraft is losing energy.  I read all this to mean that the energy maintaining turn limit is 30 degrees, but if you're willing to lose energy, you can structurally go up to 45 deg.
Comment: Re your last sentence above-- if that's what the manual intends to convey, I'd say that it's poorly written--

accelerated turns in helicopter


Is it possible to track time while tracking a polyline using QField

Question: I am tracking my footpath using QField. However, it looks like it is not possible to get any automated information as time etc.
Is that correct or is there any way to automatic track some information as times etc.?
Comment: not sure about qfield but there are a lot of apps to create a gpx trace, where you could find times and positions.
Comment: yes sure, but qfields brings some advantages for our workflow when digitalizing in the field. The tracking option is just a addon we would like to use. So if you know some apps for digitalizing in the field which are better than qfieds please let me know and we may try them.
Comment: you could use an automatic timestamp that would track time of creation of a feature or time of last modification.
Answer: In Vector Properties > Attributes Form tab, you can select a field that you'll use for the timestamp. In the default Value Box, write this expression:
now()
now everytime you'll create a feature, the function will be called and the time of creation will be written in the chosen field.
Comment: Great thanks, that works. Actually when I read your answer I thought that it is not the solution as I am interested in the timestamp at the beginning and not at the end, but in QField it saves the expression before editing. There I get exactly what I want.