Leibniz is famous for claiming that this is the best of all possible worlds. Did he explain how it is that we keep making it better via technology?

Question: In his "Theodicy" (if I am not mistaken), Gottfried Leibniz famously claimed that this is the best of all possible worlds. Doesn't that imply that making the world a better place by inventing new technology is impossible? Did Leibniz respond to that? If so, how?
Comment: In L time science in the modern term was in its infancy and technology was far away.
Comment: "Optimists believe we live in the best of all worlds. Pessimists know we do."
Comment: It's the best of all possible worlds at the current time, which is not contradictory with the idea that it can be improved (or made worse) in the future.
Comment: I think Leibniz should've spent a bit more time in the children's ward in the hospital.
Comment: When Leibniz refers to 'this world' he is not thinking of a snapshot of the world at the current time, but the world as a whole across all times. Leibniz thinks that God has actualized the best world that it is possible for there to be. Not perfect, but better than the alternatives. There is more information in the answers to this question: https://philosophy.stackexchange.com/questions/8821/what-did-leibniz-mean-by-saying-this-is-the-best-of-all-possible-worlds?rq=1
Answer: In Theodicy, Leibniz sets forth a universal argument. Appropriate to his Zeitgeist, the argument centres around the justification of God, however, it might well be read with a non-theological rearrangement, and actually, such a reading is what makes it relevant to the contemporary philosophy.
While particular manifestations of existence vary, they all are subservient to a unique universal rationality in all their aspects. Together they make up the actual world chosen out of the possible ones through "supreme reason" (Theodicy §8):

I call 'World' the whole succession and the whole agglomeration of all
existent things, lest it be said that several worlds could have
existed in different times and different places. For they must needs
be reckoned all together as one world or, if you will, as one
Universe. And even though one should fill all times and all places, it
still remains true that one might have filled them in innumerable
ways, and that there is an infinitude of possible worlds among which
God must needs have chosen the best, since he does nothing without
acting in accordance with supreme reason.

There is an overarching rational determinism binding whatever there are in that world (ibid., §288, emphasis in the original):

For it must be known that all things are connected in each one of the
possible worlds: the universe, whatever it may be, is all of one
piece, like an ocean: the least movement extends its effect there to
any distance whatsoever, even though this effect become less
perceptible in proportion to the distance. Therein God has ordered all
things beforehand once for all, having foreseen prayers, good and bad
actions, and all the rest; and each thing as an idea has contributed,
before its existence, to the resolution that has been made upon the
existence of all things; so that nothing can be changed in the
universe (any more than in a number) save its essence or, if you will,
save its numerical individuality.

The phrase "numerical individuality" signifies "individual and numerically one". Hence, we have made out three key concepts of Leibniz's metaphysical view of the world: Rationality, determinism and individuality. As for individuality, we can deem Leibniz's view as a moderate streak of nominalism.
Leibniz seems to envisage the order of the world resembling the modern diagram of truth tree familiar to us from logic (caveat: I do not suggest this literally) such that there is a root which defines the rational order and the world actually emanating from the root (diagram borrowed from Logic Matters maintained by Peter Smith):

The development paths against rationality are not allowed, otherwise, the states of affairs take place as determined by the pre-established order.
Thus, the world changes —essentially, neither towards the worse, nor towards the better (that is, with respect to the questions of rational order, for instance, the problem of evil), simply according to the order, since it is already the best of the possible worlds. Then, the perennial question raises itself: What about the freedom of will? Leibniz thinks that the determinism he has depicted and the free will are compatible (see McKenna and Coates' SEoP article Compatibilism for a general discussion of the idea). He mentions three criteria: Spontaneity (in the sense of Aristotle's conception, i.e., absence of coercion), intelligence (the faculty to choose the good) and contingency (non-necessity). About them, he says:

I have proved that free will is the proximate cause of the evil of
guilt, and consequently of the evil of punishment; although it is true
that the original imperfection of creatures, which is already
presented in the eternal ideas, is the first and most remote cause. M.
Bayle nevertheless always disputes this use of the notion of free
will; he will not have the cause of evil ascribed to it. One must
listen to his objections, but first it will be well to throw further
light on the nature of freedom. I have shown that freedom, according
to the definition required in the schools of theology, consists in
intelligence, which involves a clear knowledge of the object of
deliberation, in spontaneity, whereby we determine, and in
contingency, that is, in the exclusion of logical or metaphysical
necessity. Intelligence is, as it were, the soul of freedom, and the
rest is as its body and foundation. The free substance is
self-determining and that according to the motive of good perceived by
the understanding, which inclines it without compelling it: and all
the conditions of freedom are comprised in these few words. It is
nevertheless well to point out that the imperfection present in our
knowledge and our spontaneity, and the infallible determination that
is involved in our contingency, destroy neither freedom nor
contingency.

From Leibniz's overall discussion, we understand that we have freedom of will that the determinism inclines us to enjoy rationally and we can follow our own course so far as we do not hit the bounds of rationality (viz., become contradictory).
Answer: If Leibniz had made this claim say in 1700, "this is the best of all possible worlds"wouldn't have referred to the world of 1700, claiming it was better than both the world of 1699 and the world of 1701. It would have referred to the world over a much longer time span.


Interpret orthogonal design

Question: I am dealing with orthogonal matrices in regressions, so every regressor has
$x_j'x_k=0, if  \ j \neq k \\
 x_j'x_k=1, if  \ \ j=k $
The first one told us that the correlation between two predictors is zero, but what told us the 2nd requirement?
It should something similiar as an standardization where all predictors ar on the same scale. But the latter requirement should differ a bit from standardization (in case of Interpretation).
Answer: The second equation tells you that the feature (or covariate) has variance (or standard deviation) 1.

Interpret orthogonal design


How do I transfer my village to another ID on the same device?

Question: I'm using a friend's Apple ID and playing COC from it. Now that I've created a new Apple ID for myself I want to transfer my COC account to my new Apple ID on the same device without losing my village.  How can I do this transfer?
Comment: Check out [this](https://gaming.stackexchange.com/a/329985/208941) answer and let me know
Answer: First it needs to be connected to the Game Centre.

Open Clash of Clans on both of your iOS devices.
Open the in-game settings window on both devices.
Press the 'Link a device' button.
Select OLD DEVICE on the device you would like to move your village FROM.
Select NEW DEVICE on the device you would like to move your village TO.
Use the device code provided on your OLD DEVICE and enter it on your NEW DEVICE.

Note: Because this is the same method as transferring to a Google Play account, it means you will not be able to transfer to one.


I cant login to phpmyadmin as root

Question: i downloaded installed WAMP and i could not login to Mysql. i got frustrated with trying different solutions from the internet. I had to uninstall the app, now i have installed xampp and having the same issue, i created a password in config.inc but it wont login, i changed my hosting to localhost but could not  login. someone should help me, i am losing interest in web development because of this.
Comment: I would like to know the exact error you have Maybe it is https://github.com/phpmyadmin/phpmyadmin/issues/14220
Answer: WAMPServer installs MySQL with the root account but is has  NO password set.
So in phpMyAdmin set Username = root and leave the Password field EMPTY then press the GO button.
Once you are into phpMyAdmin, you can use it to SET a password on the root account. Then logout and login using the new password.
i created a password in config.inc You should not add the password to this file, you shoudl enter the password onto the phpMyAdmin login page.
Anyhow if you do, it is used by phpMyAdmin to login to MySQL. It is not used to set the root accounts password.

I am fairly sure XAMPP also does this

I cant login to phpmyadmin as root


Explain htaccess rules?

Question: I have made this .htaccess file over the last hour through searching, copy and pasting etc.
It does work how I want it to.
However I do not understand it.
Could someone please put it down step by step what is happening here in layman's terms for me.
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]

RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

And if there are any tips please throw them in there.
Answer: RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

^www\.example\.com$ The anchors ^$ mean this is the complete string in HTTP_HOST, nothing before or after. Therefore, if the domain name passed with the request matches www.example.com exactly, the entire URI (.*) is redirected to example.com, thereby stripping off the www. from the front.

RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^/?(.*)$ /$1.php [L]

A -f flag to RewriteCond tests if the first argument is a file that actually exists. In this case, it tests for the value of REQUEST_FILENAME, which would be the last part (file) of a URI like example.com/directory/file exists as a PHP file, by adding a .php extension onto the tested argument.
So, if file.php actually exists, the request for the non-existent file is here rewritten silently into its corresponding PHP file with $1.php.  So if /directory/notexists did not have a corresponding directory/notexists.php file, it would not be rewritten.

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]

THE_REQUEST contains the complete GET/POST request the browser originally sent, like GET /index.php.  So what has been matched here is similar to the previous block.

^[A-Z]{3,9} first matches the verb GET or POST, etc. but doesn't capture it for reuse
the /([^\ ]+) then captures everything following / and up to the next whitespace, like the index in GET /index.php.
The \.php is literally matched

Ok, then the following RewriteRule takes that index captured into %1 with the above condition, and actually redirects the browser to remove the .php extension so the browser's ending URL looks like /index.
In other words, if the browser requests /directory/file.php with the .php extension, it redirects the user to /directory/file to strip off the .php.

RewriteCond %{THE_REQUEST} ^.*/index
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

And this one matches anything containing /index in the original request, but it need not be at the start of the URI. In other words, /directory/index would match, as would /directory/subdir/index.php.  No matter what it matches, it is redirected to whatever comes before the index part.  Let's break it down:

^(.*) matches whatever comes at the start into $1
index.php .. comes after whatever was matched above

That is then redirected just to the $1 component, so a URL like /directory/subdir/index.php if directly requested by the browser, would be redirected to point to the cleaner URL: /directory/subdir/ without the index.php appearing in the address bar.
Comment: A very well defined and informative answer, I now completely understand the code I am using and now feel like I can use it. Thank you
Answer: Added in-line comments to your .htaccess code.
# If URL contains "www."
RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
# remove it for ALL request
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]

# If adding ".php" to the URL points to a file
RewriteCond %{REQUEST_FILENAME}\.php -f
# Serve the PHP file
RewriteRule ^/?(.*)$ /$1.php [L]

# If a URL request contains ".php"
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^\ ]+)\.php
# Redirect to the same URL but without ".php"
RewriteRule ^/?(.*)\.php$ /$1 [L,R=301]

# If the request points to index.php
RewriteCond %{THE_REQUEST} ^.*/index
# Remove and redirect to "/"
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

Explain htaccess rules?


How to analyse user survey results

Question: I have performed a user research survey on a website and received over 100 results. I now need to analyse these results and report back the findings to the business and the users. Does anyone have any advice on the best approach to analysing this data, things to be looking out for, particular areas to be focusing on etc... All advice is really appreciated.
Comment: Next time you do this try doing a small sample survey so that the full survey is focussed around issues you have already identified. It makes analysis easier as the larger survey is providing more data on the issues you've already identified.
Answer: This is a very open ended question. I assume your question is not about statistical analysis.
Start by Categorizing your answers
To start I would read through the responses and notice the categories the responses fall into especially those that are relevant to the initial questions you were trying to answer as "findability, choice,  availability, beauty, etc"
After you've compiled categories review the comments and categorize the results.
Some responses will fit into multiple categories.
You then have some "answers" to your question.
Rinse and repeat as your analysis brings up more questions.
Comment: This a quite a common problem - a qualitative survey can produce a lot of very useful information and if you categorise you'll get some basic descriptive statistics ( % doing x versus % doing y etc ). However you will also understand a lot more about your users.
Answer: First, you should know what proportion of the population you have sampled. 100 responses for most of my surveys, where there were millions of people in the population, would mean that I likely had not gotten enough data draw any kind of inferences from the numbers. In that case, I would focus on qualitative responses in the analysis. You could also report some summary statistics (such as average, max, min), but be clear that it is only describing who actually took the survey and not the population.
If your population is 100 and you have sampled all of them, then the descriptive statistics could be more helpful and also accurate (obviously).
If you want more details on how to analyze your data, you should provide more detail about the types of questions that were asked.

How to analyse user survey results


Did Judas play an important role for God's salvation?

Question: In reading the bible, we see Judas as the great enemy who betrayed our Lord Jesus. But looking in a different perspective, was his role gave benefit for the fulfilment of death and crucifixion of the Saviour Christ. Without Judas, would there still be a death and crucifixion?
Answer: In Acts 2 Peter addresses a Jewish crowd and says that the death of Jesus was both the act of humans and the plan of God:

Acts 2:22-23 NIV: Fellow Israelites, listen to this: Jesus of Nazareth was a man accredited by God to you by miracles, wonders and signs, which God did among you through him, as you yourselves know. This man was handed over to you by God's deliberate plan and foreknowledge; and you, with the help of wicked men, put him to death by nailing him to the cross.

This reflects the traditional compatibilist view that two things are simultaneously true: that God's will is completely sovereign, while humans have real wills.
If Judas had not desired to betray Jesus we can conclude that Jesus's death would have gone ahead according to God's plan. Indeed, even within the Gospels it's not really clear that Judas accomplished much; the Jewish leaders knew who Jesus was and he wasn't trying to hide from them. Perhaps all that Judas accomplished was alerting them to where Jesus was at a time when they could arrest him without the whole city observing, so that he could be killed in time for Passover.
Comment: Thanks for your answer. I just get confuse about free will and predestination. To tell you the truth, I do feel sorry for Judas, because if he truely knew what he was doing, he will not betray our Lord.
Comment: @KayleeA That's true for all of us, and yet we still sin.
Comment: Yes, I do not want to be put in that position and no one does. For me it is a struggle to pass this trial while I'm on this flesh. While we live in this world, it is a matter of survival. Self interest and greed always kicks in.
Comment: @KayleeA Do not feel sorry, because Judas only betrayed their "friendship",Jesus is the one who commanded Judas to accomplish his desire for money, as Jesus said, "go, do it quickly". If you were Jesus and you know Judas will end up in hell, would you still allow Judas to go? It would be better, if Jesus said, "please stay here, do not betray our friendship". That's why Jesus still called Judas His "friend" after his kiss. And Jesus lay down His life for his friends. The true candidate for "betrayer" was Peter & the rest of Apostles because they professed their "oath", while Judas did not.
Comment: @KayleeA If we read the gospel, although Judas sold Jesus for thirty pieces, it coudl have been prevented if Jesus say to Judas, please do not push thru with your betrayal because I could not save you if you do that. But instead, Jesus is the one who even commanded Judas, to go quickly and accomplished his betrayal Have you thought about this?
Comment: Yes, you have a good point. We have our own freewill and you pay for the consequences. It is only through Jesus mercy and forgiveness and His death on the cross that could bring us to salvation.
Answer: Jesus set the example for his disciples. He knew intimately who he chose and each one learned from Him so this raises a point: Judas did what he had to do.
As an example, consider Jeremiah. God knew Jeremiah before he was conceived, and He created Jeremiah for a specific purpose. From Jeremiah 1:

4 The word of the Lord came to me, saying,
5 "Before I formed you in the womb I knew you,
before you were born I set you apart;
I appointed you as a prophet to the nations."

From this I understand that God created Judas to do what he did as an act of love, for us. Jesus knew of this from the beginning, and His love for him was special. Judas suffered more than any of the other disciples for what he did and Jesus could not tell the others, save one, about Judas or what he had to do. The one Jesus told, wrote about it.
I can't conceive worshiping a God that would create a life to be used for condemnation and hated, and then cast it aside. This is not what Jesus taught. Jesus sent Judas to do what he had to do (John 13:27) and he did it. Judas was an instrument of God that was used to give God's children a way back to Him.
I see great love in the the events that led to the crucifixion of Jesus Christ. There is great love shown through John 21, and John, through the guidance of God's Spirit, captured it perfectly.
I know what I've shared is not what is taught about Judas, but this is what my studies and prayers have shown me.
Jesus has Risen!
Answer: Did Judas play an important role for God's salvation?
The answer is a big YES!
Although Judas was tempted to sell Jesus for thirty pieces of silver, Jesus could have prevented Judas betrayal easily, how?
Let's compare Peter and Judas and the action of Jesus Christ, when He knew that Satan was the one behind them.
When Peter, spoke the things that Satan wanted to say, Jesus immediately rebuked him, and said, "Get behind me Satan"...

But Jesus turned and said to Peter, "Get behind Me, Satan! You are a stumbling block to Me. For you do not have in mind the things of God, but the things of men." -Matthew16:23

While in the case of Judas, it was clear in the scripture, that Judas was in the "state of sin", it was a mortal sin. But, the question is, why would Jesus gave Judas the consecrated bread dipped in wine, as Catholic Church teaches, the consecrated bread and wine, is the body,blood,soul and divinity of Christ himself, and must be receive reverently. And so, when Judas received the holy eucharist from the hands of Jesus Christ, it was an entry point for Satan.
Have you wonder why Jesus, in the case of Peter, He immediately rebuked Satan, but in the case of Judas, when Jesus saw Satan enters the soul of Judas, He did not rebuke it, but instead, commanded Judas to go on with his betrayal?

And when Judas had taken the morsel, Satan entered into him. Then Jesus said to Judas, "What you are about to do, do quickly." -John13:27

Instead of rebuking Satan, Jesus let go of Judas, and also, He was the one who commanded Judas to fulfill his betrayal, why?
Because, Jesus has a saving plan for Judas, as He knew that He can save Judas even in hell, as He will descend into hell to free souls who are in prison, including Judas.
The simple question is, if you were Judas, and you saw Jesus preaching the gospel of salvation in hell, offering the infinite mercy of God, will you come to Jesus and say...forgive me my Lord, I had betrayed you and not look upon you as the "Son of Man", but now, I believe that you are truly the Messiah, Son of the Living God.
Will Jesus say to Judas in hell, seeking His mercy, will Jesus say, away from me, I do not know you! Remember, Judas is a friend of Jesus, and Jesus laid down His life for His friends, but His friends are the one who followed His commands.
And Judas followed, Jesus commands to go quickly and betray Him..

Greater love has no one than this, that he lay down his life for his friends. 14You are My friends if you do what I command you. -John15:13-14

Judas was a friend of Jesus, and Judas followed Jesus commands. That's why Ab.Paglia said, "For a Catholic, to say Judas is in hell, is heresy"
Judas is not in hell, but most probably is now in Heaven.
And Judas, preach the evil of suicide better than all the Apostles and disciples combined.
Archbishop Paglia Says It's Heresy to Say Judas Is in Hell
Comment: **"For a Catholic, to say Judas is in hell, is heresy"** That is so not true: "Faithful Catholics are criticizing his comment, recalling how Our Lord spoke of Judas: "The Son of Man indeed goes, as it is written of him: but woe to that man by whom the Son of Man shall be betrayed. It were better for him, if that man had not been born." The Saints, Fathers and Doctors of the Church say unanimously that Judas is in Hell." - [Abp. Vincenzo Paglia contradicts the tradition of the Church](https://www.churchmilitant.com/news/article/vatican-official-claims-its-heresy-to-say-judas-in-hell)
Comment: @KenGraham Judas never look upon Jesus as the "Son of Man", so how can Judas betrayed Jesus as the "Son of Man"? Remember it is very clear in scriptures, and repeated by all the gospel writers, Judas only look upon Jesus as "Rabbi
nothing more nothing less.  And one more thing, Judas went into hell, but Jesus descended into hell too to preach the gospel of salvation, do you think Jesus wont look upon Judas, his friend, whom he gave the bread dipped in wine and the one He commanded to fulfill his betrayal quickly. Judas is in Heaven not hell. Be wise Ken. -Ave!

Did Judas play an important role for God’s salvation?


How to achieve this lighting?

Question: How to get this lighting? Is it due to camera or photo editing? It seems it is edited later.
Comment: What are you seeing in the image that you are describing as "this lighting"? There are several things going on here, and it's impossible for us to guess which you are concerned with. Please edit your question (including the title) to be more specific.
Comment: [Important information for asking "What's this effect?" questions](https://photo.meta.stackexchange.com/q/3881/15871)
Comment: [What's the best way to ask a "How do I achieve this effect?" question?](https://photo.meta.stackexchange.com/q/677/15871)
Answer: It's an on camera flash outputting at a higher color temperature (bluer) than the ambient lighting behind the two main subjects. The flash appears to be a typical 5500-6000K or so full spectrum light. The background appears to be more limited spectrum lighting centered on about 3700-3000K such as is typical with older tubular fluorescent lighting.
The camera appears to have been set to match the color temperature of the flash. This makes the ambient light look yellow/orange. If the color was adjusted to match the light source in the background, the two main subjects would appear very blue.
Comment: I'm voting this up, but I'm also waiting for the original poster to come back and say "huh? What are you talking about? I mean the shiny glow on the fabric, obviously. None of this color temperature stuff!"
Comment: @mattdm Don't hold your breath while you wait for the OP to update the question.
Answer: You can see from the shadows under the chins and the highlight reflections off the flat skin facing the camera, that there is a bright point-ish light a little above and left of the camera.  This by itself should immediately suggest a pop-up flash on a point and shoot camera.
The "snapshot" nature of the picture suggests a photographer likely to use a point and shoot camera.  These kinds of cameras often have integrated flashes.
The color analysis by Michael Clark also strongly points to a flash.
Answer: It could be that the building ends close to where the subjects are standing (ie. they are illuminated by daylight), but as Michael suggests a flash is most likely. It doesn't look like post production to me.

How to achieve this lighting?


How to pass rendered frames from OpenGL to DirectX 11?

Question: I have a dll that does some rendering using OpenGL.  I need to render it to a texture and use that texture in direct x 11.  My current attempt has been to render the OpenGL to a texture on one process, and then use Cuda to encode the texture to a h264 video stream, and then decode that stream on another process using cuda / directx 11.  However, I'm wondering if there is an easier way to get a portion of a scene rendered OpenGL to DirectX11.
Comment: This will never be particularly elegant; does it have to be cross-process, or are you doing it all in the same process? If so you could just map the GL texture and use the mapped bits to create or update the D3D texture. I don't think you can do it keeping everything on the GPU.
Comment: They can be on the same process.  Basically, we are porting an application from an opengl based engine to a directx 11 based engine, but there are some opengl dll's that we cannot port (because they were made by a third party and we don't have the source).
Answer: The ideal way to do this would involve OpenGL and D3D sharing the texture memory on the GPU. But there is unfortunately no practical way to do that (as far as I am aware).
Thus, you're going to have to shuffle the texture data around on the CPU. The process is fairly straightforward though. Once your render-to-texture has completed in OpenGL, map the texture to the CPU (via glGetTexImage or something fancier), which gives you access to the pixel data of the texture.
With that mapped information you can use CreateTexture2D and/or Map to create a D3D texture using the same pixel data.
If you're going to do this repeatedly you'll want to make sure you create both textures with the appropriate flags to suggest dynamic updates to the API.
Answer: Really the most elegant solution would be to replicate the functionality in Direct3d 11, but presumably this is unfeasable for you because of reasons™.
You could also consider whether using the dll is more trouble than it's worth, there are no easy solutions here.
If you really, REALLY need this you could :

Look into memory-mapping like Josh Petrie suggested
Use the underlying DXGI layer which is the infrastructure Windows uses for drivers to the hardware. I don't know enough to present a complete solution but can at least point you in the right direction.

Either way will probably require some serious low-level hacking so think really long and hard if you want to take that plunge.
Answer: You might want to look at the DX_Interop OpenGL extensions. Since the extensions were contributed by NVIDIA, they might not be available on every card, but since you mentioned using CUDA, you should be covered.
Comment: Going from DirectX to OpenGL is equally good. Just create the texture in DirectX, use the extension to create handles in OpenGL to that texture, and then render to it in OpenGL. The accepted answer will always have the overhead of transferring the texture to host memory, and then back to device memory for rendering. One should first check if the DX_Interop extension is available and use it like this answer has proposed, and use the accepted answer only as a fallback.
Comment: Can you elaborate about the usage?  Right now your answer is link-only.
Comment: Thanks.  I've looked into this.  From what I understand, the extensions allow you to go from DirectX to OpenGL, but I need to go from OpenGL to DirectX.


Colors for the date period

Question: I'm want to emphasise date period(2 dates: start and end) in table cell.
Usually it's green for start and red for the end, but I believe it'll be too distracting...
Comment: Can you add more detail to your question? Why do you think it'll be distracting? Can you provide a mockup?
Comment: Also, do you need to show if the start or end date has passed or is in the future?
Answer: The solution could be to use softer/lighter versions of colors. In your case, I would choose #BBFFBB for green and #FFBBBB for red. I used those exact colors on a couple of my websites. They are much easier on the eyes and also fit nicely on any modern-looking application. Alternatively, you can use Color Schemer to choose appropriate colors. In your case, choose a plain red/green color and then press the button Lighten Scheme until you get the wanted result. Good luck!
Answer: Is it just one instance (row) you want to emphasize out of many? If that's the case, perhaps just a text weight change (bold) could help, plus a light background to the cells in the table. Or even highlight the whole row itself.
If it's more than one row, then color could be a distracting element. Also, using red may clash with other elements designed to show errors/alerts. Are the dates being emphasized because the user needs to take action on these items?
If you have a mockup, it would be great to have a look.

Colors for the date period


How to change android device name used by NsdManager?

Question: I am using NsdManager to register a web service on the local network. My problem is that the device name is called "android", so I can access the phone as "android.local" from my laptop. How can I change that name? I would like something more unique.
Answer: You cannot change this (on non-rooted devices). "android" is the host name of the device, ".local" is the suffix added by the mDNS (see this article).


How to obtain an Earth Crystal in Stardew Valley?

Question: I've been playing Stardew Valley on my Xbox One for about a week or so, and I can't seem to get earth crystals. I see them commonly in the mines, but I have no clue as to how to actually get them as an item. I cant seem to use any of my tools on them (the same goes for quartz). I don't desperately need them, but it'd be nice to know how to get them, and if anyone knows how to please let me know.
Answer: Just pick them up like you would pick up a ripe vegetable on your farm.
Comment: If you're unable to pick them up, your inventory may be full. You can drop something else to make room, or buy the backpack expansions at Pierre's store.
Answer: They are found in the mines in level 1 to 50. you pick them up by clicking A on them or the green button while facing them.


Specifying Column Types when Importing xlsx Data to R with Package readxl

Question: I'm importing xlsx 2007 tables into R 3.2.1patched using package readxl 0.1.0 under Windows 7 64.  The tables' size is on the order of 25,000 rows by 200 columns.
Function read_excel() works a treat. My only problem is with its assignment of column class (datatype) to sparsely populated columns.  For example, a given column may be NA for 20,000 rows and then will take a character value on row 20,001. read_excel() appears to default to column type numeric when scanning the first n rows of a column and finding NAs only. The data causing the problem are chars in a column assigned numeric. When the error limit is reached, execution halts. I actually want the data in the sparse columns, so setting the error limit higher isn't a solution.
I can identify the troublesome columns by reviewing the warnings thrown. And read_excel() has an option for asserting a column's datatype by setting argument col_types according to the package docs:
Either NULL to guess from the spreadsheet or a character vector containing blank,numeric, date or text.
But does this mean I have to construct a vector of length 200 populated in almost every position with blank and text in handful of positions corresponding to the offending columns?
There's probably a way of doing this in a couple lines of R code. Create a vector of the required length and fill it with blanks.  Maybe another vector containing the numbers of the columns to be forced to text, and then ... Or maybe it's possible to call out for read_excel() just the columns for which its guesses aren't as desired.
I'd appreciate any suggestions.
Thanks in advance.
Answer: New solution since readxl version 1.x:
The solution in the currently preferred answer does no longer work with newer versions than 0.1.0 of readxl since the used package-internal function readxl:::xlsx_col_types does no longer exist.
The new solution is to use the newly introduced parameter guess_max to increase the number of rows used to "guess" the appropriate data type of the columns:
read_excel("My_Excel_file.xlsx", sheet = 1, guess_max = 1048576)

The value 1,048,576 is the maximum number of lines supported by Excel currently, see the Excel specs: https://support.office.com/en-us/article/Excel-specifications-and-limits-1672b34d-7043-467e-8e27-269d656771c3
PS: If you care about performance using all rows to guess the data type: read_excel seems to read the file only once and the guess is done in-memory then so the performance penalty is very small compared to the saved work.
Answer: It depends on whether your data is sparse in different places in different columns, and how sparse it is. I found that having more rows didn't improve the parsing: the majority were still blank, and interpreted as text, even if later on they become dates, etc..
One work-around is to generate the first data row of your excel table to include representative data for every column, and use that to guess column types. I don't like this because I want to leave the original data intact.
Another workaround, if you have complete rows somewhere in the spreadsheet, is to use nskip instead of n. This gives the starting point for the column guessing. Say data row 117 has a full set of data:
readxl:::xlsx_col_types(path = "a.xlsx", nskip = 116, n = 1)

Note that you can call the function directly, without having to edit the function in the namespace.
You can then use the vector of spreadsheet types to call read_excel:
col_types <- readxl:::xlsx_col_types(path = "a.xlsx", nskip = 116, n = 1)
dat <- readxl::read_excel(path = "a.xlsx", col_types = col_types)

Then you can manually update any columns which it still gets wrong.
Comment: Could you please elaborate on the notations you use? I would like to do something similar with the package xlsx, the function read.xlsx and the argument colClasses. Thanks!
Answer: I have encountered a similar problem.
In my case empty rows and columns were used as separators. And there were a lot of of tables (with different formats) contained in the sheets. So, {openxlsx} and {readxl} packages do not suit in this situation, cause openxlsx remove empty columns (and there is not parameter to change this behavior). Readxl package works as you described, and some data may be lost.
In the result, I think, that the best solution, if you want to automatically handle big amounts of excel data, is to read sheets without changes in the 'text' format and then process data.frames according to your rules.
This function can read sheets without changes (thanks to @jack-wasey):

loadExcelSheet<-function(excel.file, sheet)
{
  require("readxl")
  sheets <- readxl::excel_sheets(excel.file)
  sheet.num <- match(sheet, sheets) - 1
  num.columns <- length(readxl:::xlsx_col_types(excel.file, sheet =   sheet.num,
                                              nskip = 0, n = 1))

  return.sheet <- readxl::read_excel(excel.file, sheet = sheet,
                                col_types = rep("text", num.columns),
                                col_names = F)
  return.sheet
}

Comment: This solution will no longer work in `readxl` version 1.x since the internal function `readxl:::xlsx_col_types` has been removed. To solve the problem you see this answer: https://stackoverflow.com/a/46122161/4468078
Comment: with columnNames       loadExcelSheet<-function(excel.file, sheet)
{
  require("readxl")
  sheets <- readxl::excel_sheets(excel.file)
  sheet.num <- match(sheet, sheets) - 1
  num.columns <- length(readxl:::xlsx_col_types(excel.file, sheet =   sheet.num,  nskip = 0, n = 1))

  colNames <- readxl:::xlsx_col_names(excel.file, sheet =   sheet.num)
  return.sheet <- readxl::read_excel(excel.file, sheet = sheet,
                                     col_types = rep("text", num.columns),
                                     col_names = colNames, skip = 1)
  return.sheet }
Answer: Reading the source, it looks like column types are guessed by the functions xls_col_types or xlsx_col_types, which are implemented in Rcpp, but have the defaults:
xls_col_types <- function(path, na, sheet = 0L, nskip = 0L, n = 100L, has_col_names = FALSE) {
    .Call('readxl_xls_col_types', PACKAGE = 'readxl', path, na, sheet, nskip, n, has_col_names)
}

xlsx_col_types <- function(path, sheet = 0L, na = "", nskip = 0L, n = 100L) {
    .Call('readxl_xlsx_col_types', PACKAGE = 'readxl', path, sheet, na, nskip, n)
}

My C++ is very rusty, but it looks like the n=100L is the command telling how many rows to read.
As these are non exported functions, paste in:
fixInNamespace("xls_col_types", "readxl")
fixInNamespace("xlsx_col_types", "readxl")

And in the pop-up, change the n = 100L to a larger number. Then rerun your file import.
Comment: There are times when it certainly would useful to be able to control the number of rows scanned to determine datatype. In this problem, however, it might be necessary to scan very far down sparsely populated cols.  I think the main issue is a convenient way to specify the desired datatype of a few cols where the default behavior is not wanted.  In his answer to http://stackoverflow.com/q/6099243 Mikko appears to suggest a way of doing this for read.xlsx2 in the xlsx package. Maybe similar works for readxl. Thanks very much for checking the source for readxl_xlsx_col_types.
Answer: Reviewing the source, we see that there is an Rcpp call that returns the guessed column types:
xlsx_col_types <- function(path, sheet = 0L, na = "", nskip = 0L, n = 100L) {
    .Call('readxl_xlsx_col_types', PACKAGE = 'readxl', path, sheet, na, nskip, n)
}

You can see that by default, nskip = 0L, n = 100L checks the first 100 rows to guess column type.  You can change nskip to ignore the header text and increase n(at the cost of a much slower runtime) by doing:
col_types <-  .Call( 'readxl_xlsx_col_types', PACKAGE = 'readxl',
                     path = file_loc, sheet = 0L, na = "",
                     nskip = 1L, n = 10000L )

# if a column type is "blank", no values yet encountered -- increase n or just guess "text"
col_types[col_types=="blank"] <- "text"

raw <- read_excel(path = file_loc, col_types = col_types)

Without looking at the .Rcpp, it's not immediately clear to me whether nskip = 0L skips the header row (the zeroth row in c++ counting) or skips no rows.  I avoided the ambiguity by just using nskip = 1L, since skipping a row of my dataset doesn't impact the overall column type guesses.
Answer: The internal funcitons for guessing column types can be set to any number of rows to scan. But read_excel()doesn't implement that (yet?).
The solution below is just a rewrite of the orignal function read_excel() with argument n_max that defaults to all rows. Due to lack of imagination, this extended function is named read_excel2.
Just replace read_excel with read_excel2 to evaluate column types by all rows.
# Inspiration: https://github.com/hadley/readxl/blob/master/R/read_excel.R
# Rewrote read_excel() to read_excel2() with additional argument 'n_max' for number
# of rows to evaluate in function readxl:::xls_col_types and
# readxl:::xlsx_col_types()
# This is probably an unstable solution, since it calls internal functions from readxl.
# May or may not survive next update of readxl. Seems to work in version 0.1.0
library(readxl)

read_excel2 <- function(path, sheet = 1, col_names = TRUE, col_types = NULL,
                       na = "", skip = 0, n_max = 1050000L) {

  path <- readxl:::check_file(path)
  ext <- tolower(tools::file_ext(path))

  switch(readxl:::excel_format(path),
         xls =  read_xls2(path, sheet, col_names, col_types, na, skip, n_max),
         xlsx = read_xlsx2(path, sheet, col_names, col_types, na, skip, n_max)
  )
}
read_xls2 <- function(path, sheet = 1, col_names = TRUE, col_types = NULL,
                     na = "", skip = 0, n_max = n_max) {

  sheet <- readxl:::standardise_sheet(sheet, readxl:::xls_sheets(path))

  has_col_names <- isTRUE(col_names)
  if (has_col_names) {
    col_names <- readxl:::xls_col_names(path, sheet, nskip = skip)
  } else if (readxl:::isFALSE(col_names)) {
    col_names <- paste0("X", seq_along(readxl:::xls_col_names(path, sheet)))
  }

  if (is.null(col_types)) {
    col_types <- readxl:::xls_col_types(
      path, sheet, na = na, nskip = skip, has_col_names = has_col_names, n = n_max
    )
  }

  readxl:::xls_cols(path, sheet, col_names = col_names, col_types = col_types,
                    na = na, nskip = skip + has_col_names)
}

read_xlsx2 <- function(path, sheet = 1L, col_names = TRUE, col_types = NULL,
                       na = "", skip = 0, n_max = n_max) {
  path <- readxl:::check_file(path)
  sheet <-
    readxl:::standardise_sheet(sheet, readxl:::xlsx_sheets(path))

  if (is.null(col_types)) {
    col_types <-
      readxl:::xlsx_col_types(
        path = path, sheet = sheet, na = na, nskip = skip + isTRUE(col_names), n = n_max
      )
  }

  readxl:::read_xlsx_(path, sheet, col_names = col_names, col_types = col_types, na = na,
             nskip = skip)
}

You might get an evil performance hit because of this extended guessing. Haven't tried on really big data sets yet, just tried on smaller data enought to verify function.


How can be various frequencies in one place?

Question: How can we receive different radio shows in one place, they are coded in phase or frequency or amplitude of electromagnetic waves, but shouldnt elecreomagnetic waves interact each other, and all electric and magnetic vectors superpose, and in one point or space just have one electromagnetic wave with addition of several EMWs?
Answer: "but shouldnt elecreomagnetic waves interact each other, and all electric and magnetic vectors superpose?"
The answer to this is yes AND no. Yes the waves are "superposed" - but no they are not exactly "interacting." The word "interaction" is a tricky word because it means a lot of things in different contexts. In the case of electromagnetic waves, an interaction can often mean a process that is NOT just a linear superposition of the inputs. If you simulate two pulses that run into eachother, unlike balls of matter, which "interact" and bounce off eachother, E-fields (because of the superposition principle) simply pass through each other (and don't "interact").
(If you want a simple example of an interaction, imagine we send two frequences through a medium and the medium's atomic properties are sensitive to one of the frequencies. The properties of the medium might be changed by one of the frequencies, which causes a change in how the second frequency interacts with the medium. This causes an output that is not just the sum of it's individual parts - something we call an "interaction")
Just saying definitions isn't really that helpful, so let's try to look visually to get in intuition for your real question. How we are able to split up these different frequencies when they are superposed on top of eachother:
If I look at the E-field as a function of time for two frequencies, they would look like this separately:

But when I add them together, I will get something a lot "funkier":

Naturally this will look a lot messier when we add more and more frequencies to the mix. But since this is just a linear sum of different frequencies, if I take this output through an electronic device that finds the fourier-transform of the electrical signal, then I can obtain the fourier transform of this linear combination (which is simply the fourier transform of the individual frequencies). If we plugged this 2-frequency signal into this device (called a spectrum analyzer) - we will obtain a peak for each frequency (and an amplitude for each peak, associated with the strength of each frequency in the signal).  This is how we can encode information at multiple frequencies. We can change the amplitude of each individual frequency, and then this will be seen on our fourier-transform devices as moving an individual peak up and down!
Comment: Thanks, but then what about when two electromagnetic wave have interference, like at the double split experiment? I know light is not an easy thing, but we use EMWs in our life very very much, and i will be an electric engineer so i must know these, at the university these questiond are not explained i dont know why.
Comment: In the double slit linear combination also occurs, but the double slit has two main differences: the behavior of the light of the two slits spreads out and expands (called diffraction), we observe the square (intensity) of the E field. Maybe as a second question ask about this in particular.
Answer: Your radio receiver is frequency-selective. This means that frequencies different from the one you have tuned the radio to are rejected, so that any signals you do not wish to hear do not show up in the output.
In general, radio waves of different frequencies pass right through one another and do not interact as they travel through space. Your radio receiver is hence capable of separating out the signal you want from all the others, which will have no influence on the signal you want.


Rules Clarification Needed Please

Question: A friend and I were playing heads-up texas hold-em. She had $21 left in her stack. I had $229. The  blinds were $16/32 and she had the button and therefore had the small blind. She put in her $16 small blind and I put in my $32 big blind. She saw her cards and then pushed all-in with her remaining $5. She claimed that I was required to put in an additional $5 so that I'd have $37 invested into the pot even though she was all-in for a total of only $21 invested. She claimed that if she won the hand, she would get my $37 even though she had only begun the hand with a total stack of only $21. I disagreed and said that the most she could win from me was only $21 and that I'd be entitled to have the excess above and beyond my $21 "call" returned to me. She insisted that I would forfeit the full $32 big blind plus the additional $5 she had "raised" to go all-in. Who is right and who is wrong?
Answer: You are right and she is wrong. In Texas Hold'em, you can never win more from any one player in a hand than your starting stack for the hand.

Rules Clarification Needed Please


Randomly Selecting Balls Out of a Box Probability Computation

Question: Question :
In a box there are 50 red and 200 white balls. Somebody removes 10 randomly selected balls.What is the probability that no red ball is among these removed balls?Do we need any assumption to solve this problem?
Expected Answer :
using binomial distribution: $0.05631351$
using sampling without replacement : $0.05209363$
My approach :
To select no red balls, they should all be white that is:
$$C(200,10)/C(250,10) =  0.1025135$$
Which does not align with the answer
What kind of an assumption do I need to solve this problem?
How are binomial and sampling without replacement different?
Most importantly how to solve this problem?
Comment: What do you mean by "binomial distribution" as a method here?  If we were sampling with replacement or if you just make the simplifying assumption that each draw is independently white with probability $.8$ then the answer would be $.8^{10}=0.107374$  which is in line with your method.
Comment: I think the only "assumption" that matters is whether you are drawing with or without replacement.  As the problem is phrased I'd have assumed it was "without replacement" .
Comment: I don't understand either of the two proposed answers.  Your answer looks solid, trusting that "without replacement" was intended.
Comment: Your method and answer look good for the without replacement case. And with replacement it's simply $(\frac{200}{250})^{10} \approx 0.10737$, quite close to the other situation.
Comment: The exact solution is [Hypergeometric](http://mathworld.wolfram.com/HypergeometricDistribution.html) [distribution](https://en.wikipedia.org/wiki/Hypergeometric_distribution).
Comment: @lulu This question is a part of an assignment I have, I do not have the solutions but I have the answers. I put the 2 possible answers that were given by the professor in the the question. I'm confused why my solution does not work as well, hoping someone could clarify it.
Comment: @lulu then it's safe to assume the answer is wrong?
Comment: @LeeDavidChungLin can you elaborate the solution as an answer?
Answer: \begin{align}
&\frac{ (\text{choose 0 from 50 red}) \times (\text{choose 10 from 200 white})}{ \text{choose 10 from totally 250}} \\
&= \frac{C(50,0)\times C(200,10)}{C(250,10)} \qquad \text{or in U.S. notation} \quad\frac{ {50 \choose 0}\times {10 \choose 200}}{ 10 \choose 250} \\
&= \frac{1 \times 22451004309013280}{219005316087032475}\\
&\approx 0.10251351296007479218513634
\end{align}
This is the extreme case (zero red balls) of the discrete Hypergeometric distribution, one of the common distributions that sometimes gets forgotten.
For example, if the question asks for the probability of $3$ red balls among those $10$, the answer is
$$\frac{C(50,3)\cdot C(200, 7)}{C(250,10)}$$
In Binomial distribution, the trials (draws) are independent to each other and the "success" probability $p$ (here the fraction of red ball among all balls) stays constant. When handling finite population (number of balls) and without replacement, the Hypergeometric is exact, and we know that the $p$, the fraction of red balls, keeps changing after each draw (removal).
When the number of two types of items (red balls, white balls) are both large "enough" compared with the number of removal so that $p$ stays roughly constant, then the Binomial distribution is a good approximation (mathematically there's a limit theorem) to the Hypergeometric distribution.
Here, for example, the total number of red balls is $50$ (which is smaller then the $200$ for white), and $50$ is considerably larger $10$ so the Binomial approximation is sort of not too bad. The fraction of red balls remains roughly $p\approx 50/250 = 0.2$. One can check that the "worst" case is for $p$ to drop to $(50-9)/(250-9) \approx 0.17$
Comment: can you take a look at this question https://math.stackexchange.com/questions/3584282/what-is-the-log-likelihood-function-and-mle-of-uniform-distribution-u%ce%b8-5


How to see what softwares of my computer send to network?

Question: I need a software or a method to see all of data which is being sent to any outter network specially internet (data packets,Binary strings and formatted data like xml files) from my computer by a web based software or other applications.
to collect all of mentioned advantages in a single software is hard but i stress on formatted data ,desktop softwares and internet.
Answer: You can try the wireshark software which is a very powerfull free software for your need
Answer: In this case You can also use "nbtstat -v -b" on windows which displays tcp sessions with remote tcp socket including the file responsible on localhost for tcp session.Wireshark have very good packet filtering capabilities on per protocol basis ; you can find it on wiki.
Answer: you can find a nice example here http://gforgeek.blogspot.com/2005/04/simple-packet-sniffer-using-java.html .
You can use it by utilizing jpcap.jar from winpicap ( http://winpcap.polito.it/ )


Why do we monitor N2 speed rather than N1, when starting jet engine?

Question: I've just heard that N2 is the limit when starting jet engine, But I have no idea why it is.
I know that N1 is Low compressor speed, and N2 is high compressor speed.
So what makes high compressor speed more important when starting jet engine?
Answer: If it's a turbofan, N2 represents the core engine compressor/turbine spool that is creating the compress/burn/expand energy that drives the fan, and is exposed to the most energy, that is, velocity and heat.
N1, as the fan/free turbine RPM, is effectively just a windmill tacked on to the end of the core, driving the fan at the other end, same as a free-turbine turboprop, except it's a fan instead of a propeller.  You could jam a piece of wood in the fan to stop it from turing, and you could probably still start the core engine and run it at idle.  This is done with routinely with free-turbine turboprops, although not with turbofans.
In a turboprop or turboshaft, the engine core is called the "gas generator" and you have the same thing. You are concerned with the gas generator RPM while starting, where all the energy is being produced, not the free-turbine/propeller, which is just going along for the ride.
If it's a turbojet with no fan but two compressor/turbine spools, it's still the same thing in the end.  The interior spool that has the highest pressure compressor stages and turbine blades closest to the burner has the most critical parameters, so its speed will be part of the starting limitations, while the low pressure spool is helping but just doesn't have to deal with the same energy level and you can be sure that if the N2 is in limits the N1 will be also.
Answer: The N2 shaft is the actual jet engine proper, which has one job: turn fuel into thrust directly.  It is akin to the crankshaft on a gas/diesel engine.
The N1 shaft is an extra turbine put in the thrust stream so it can steal thrust and turn it into rotating shaft power.   It is akin to the transmission shaft on a car, or the Power Takeoff on a tractor.
So when you are starting a gas engine you care about crankshaft RPM not transmission RPM.  Same here.

And then, once the engine is running, other equipment somewhere takes N1 shaft rotation and turns it into something valuable:

for a generating plant, electricity
for a helicopter, rotor drive
for an Abrams tank, track motion
for a ship, propellor drive
for a turboprop engine, propellor drive
for a turbofan engine basically the same thing, but with a "compressor style vane" ducted fan, instead of an open propellor.
Answer: All correct answers here, N1 is the large fan at the front and suffers the same effects as turbo lag in a car. N2 does the main compression of the air before it enters the multistage combustion chambers and mixed with fuel. This then drives a series of turbines where one or two actually drives the N2 compressors and one drives the N1 fan. With this setup there is inherent lag between N2 stage and the N1 stage.


Database design help. many-to-many relationship

Question: I have four columns. All columns are varchar fields. Three of them are independent and distinct fields having many to many relation between them and the fourth one is dependent on the combination of first three. so for all the combinations of three columns there is different value for the fourth column. Now I want a design for data like this. Any help is appreciated.
Comment: if value 4 is dependent on the other columns then it becomes a computed or derived value.  Create some code/business logic to calculate it and do not store it at all.
Answer: Just have a table with a composite primary key on value1, value2, value2
If any of the 3 are restricted then have FK relationship on the column


problems with big drawable jpg image

Question: during a couple of days i've been looking here and on the Internet in many post for a solution on an issue im having loading or moving a large jpg image (located as a drawable reource by now) and I think it's time to ask myself altought there are many questions and solutions very related.
I'm developing a 3D terrain simulation with OpenGL and the problem is that I'm using as terrain texture a quite large jpg image ( 2048x2048 = 1,94 MB ).
Let's look at some workarround I Did:
1st:
Bitmap terrainBitmap = BitmapFactory.decodeResource(getResources(),
R.drawable.terrain, options);

This one crashes inmediately, probably because the image is too big
2nd:
Uri path = Uri.parse("android.resource://com.jgc.my_app/" + R.drawable.terrain);
URL ulrn;ulrn = new URL(path.getPath());
HttpURLConnection con = (HttpURLConnection)ulrn.openConnection();
InputStream is = con.getInputStream();
Bitmap bmp = BitmapFactory.decodeStream(is);

that one probably was a quite silly attempt
3rd:
Bitmap terrainBitmap = BitmapFactory.decodeFile("android.resource://com.jgc.my_app/terrain.jpg", options);

but I'm getting a very frustrating null bitmap as result...
Other workarrounds in mind are, as the drawable resources are "inside" the application, why not to move them to the sd card and decodefile form there, but, the solutions given to move a bitmap or a drawable to the sdcard that I've found always user BitmapFactory.decodeResource(getResources(), R.drawable.terrain, options);
I appreciate any suggestion, since then I'll be working arround other tasks in my proyect.
Thanks in advance
Answer: Ok, maybe I've been lucky, here is the n work-arround ind this workd for me:
private static BitmapFactory.Options terrainBitmapOptions = new BitmapFactory.Options();

...
// Set our bitmaps to 16-bit, 565 format.
    terrainBitmapOptions.inPreferredConfig = Bitmap.Config.RGB_565;

...
InputStream is = getResources().openRawResource(R.drawable.terrain);
Bitmap terrainBitmap;
try {
    terrainBitmap = BitmapFactory.decodeStream(is, null, terrainBitmapOptions);
} finally {
    try {
        is.close();
        } catch (IOException e) {
        // Ignore.
    }
}

I hope it helps anyone else...

problems with big drawable jpg image


What if you cannot pay the damages in a civil law suit?

Question: This question is in response to the defamation case between Mr Johnny Depp and Miss Amber Heard. Mr Depp claims that the defamation damages amount to 50 million dollars. Now suppose that the jury awards damages in the full amount asked. What happens if Miss Heard cannot find 50 million dollars to pay Mr Depp? Or in general, what happens if the defendant does not have enough money to pay a civil judgement?
Comment: And https://law.stackexchange.com/questions/19590/if-the-damages-from-a-lawsuit-force-the-defendant-into-bankruptcy-are-they-forg
Comment: Dupe: https://law.stackexchange.com/questions/6765/what-are-consequences-for-defendant-failing-to-meet-orders-of-civil-court
Comment: Second one is not a dupe. First is limited to bankruptcy.
Comment: @BlueDogRanch
 The second linked Question is not a dupe, it is about refusal to comply with an order, not about inability to pay. The first is closer, but talks only about consequences if bankruptcy results, which it normally does not. Besides which, a reopen vote already removed closure as a dupe to one of these.
Comment: It looks like the defendant will only pay the fine according to her net worth and not more than that, if she has assets worth 8 million dollars then that's it, Johnny gets those
Comment: @TechGeek, what is awarded in  a civil suit is "damages" and not a "fine". A fine is intended to punish, damages, at least in theory, are to make the other party whole.
Answer: Short Answer
If a judgment debtor is unable to pay the full amount of a judgment entered against the judgment debtor in a lawsuit, then the judgment creditor doesn't get paid until the judgment debtor is able to pay and the judgment creditor takes action to enforce the judgment at that time.
To the extent the a judgment debt has an ability to pay as determined from assets and income which are not exemption from creditor's claims under the relevant state law, there are a variety of court supervised means by which a judgment creditor can involuntarily have that those assets and that income turned over to the judgment creditor.
Many judgments are never paid in full.
Long Answer
Judgment Creditor's Rights, In General
A money judgment entered in a lawsuit is a right of a judgment creditor represented by a court registry entry or piece of paper to use involuntary debt collection methods to obtain property (defined broadly) from a judgment debtor.
Until the judgment is paid in full, the judgment creditor can continue to use these methods so long as there are assets not exempt from creditors, or income not exempt from creditors that the judgment debtor has available to them.
Judgment creditors can't collect from someone who has no assets or income that is not exempt from creditors claims (a complicated list that varies from state to state and can be different as a general rule, in bankruptcy, in probate, and for special kinds of debts like child support debts). When a judgment debtor has no non-exempt assets or income worth that are cost effective to collect, the judgment debtor is called "judgment-proof" and the judgment creditor has no ability to collect further until the judgment debtor ceases to be judgment-proof.
Despite the long list of options for judgment creditors set forth below, in practice, lots of judgments are paid voluntarily and lots of judgments expire before they are paid in full because the judgment debtor is judgment-proof or are discharged in bankruptcy.
Formal means of involuntarily collection discussed below are the exception rather than the rule.
This is, in part, because having unpaid judgments is horrible for your credit, in part, because collection activity is extremely disruptive to the judgment-debtor's life, and in part, because judgments accrue post-judgment interest which is often at a high interest rate so there is an incentive to pay it off sooner so that the judgment debtor owes less to the judgment creditor overall.
Another factor is that most people get judgments against them because they owe debts that they don't have an ability to pay (e.g. due to a lost job) and the existence of a money judgment against them doesn't create an ability to pay.
Voluntary compromises between judgment creditors and judgment debtors pursuant to agreed payment plans with judgment creditors not taking collection action way judgment debtors are current on payment plans are also very common, since they solve many hardships arising from formal collection for the judgment debtor and reduce collection costs for the judgment creditor.
The relevant law of creditor's rights and debtor's remedies, with the exception of bankruptcy and a few nationally mandated exemptions from creditors is predominantly a matter of state law.
For almost all practical purposes, the remedies available for failing to pay a federal court civil judgment are the same as those available for failing to pay a state or local court civil judgment.
Typical Collection Methods
Typically, a judgment creditor can:

Impose judgment liens on real property owned by the judgment debtor (subject to a homestead exemption) and foreclosed on that lien to get the property in full or partial payment of the debt. It is also possible to impose a judgment lien and refrain from foreclosing and instead to wait until property is sold and collect from proceeds at a closing upon that sale of property subject to a judgment lien. Judgment liens have a very high priority in bankruptcy once they have  been imposed on property and all formalities for doing so are completed.

Garnish bank accounts, wages, and other amounts owed by third-parties to the judgment debtor.

Set off money owed by the judgment creditor to the judgment debtor against money owed by the judgment debtor to the judgment creditor.

Seize tangible personal property (e.g. cars, gold bars) that are not exempt from the claims of creditors from a third-party, and also some intangible property (e.g. shares of stock in a corporation).

Compel the judgment debtor to disclose the judgment debtor's assets and income sources under oath to the judgment creditor.

Imposing a "charging order" on a pass through entity interest like an LLC.

Sue people to whom the judgment debtor transferred property without substantially equivalent value within the applicable time period to "claw back" those assets that were given away or sold in bargain sales within the applicable statute of limitations.

Assets subject to liens or mortgages can be placed in receiverships pending their seizure in foreclosure sale.

In unusual circumstances, a court can order that specific property be transferred or delivered by the judgment debtor to the judgment creditor in exchange for a specified credit against the judgment.

Additional remedies are available to child support creditors (and in rare cases certain other creditors). For example, denying child support debtors driver's licenses, professional licenses, seizing tax refunds, and throwing the judgment debtor in jail for willfully failing to pay child support when there is an actual ability to pay the child support debt. But, no debtor can be incarcerated merely for inability to pay, if this is established.

Collect from guarantors or sureties of the debt including insurance companies in the case of insured claims, and bonding companies in the case of bonded debtors for debts covered by a bond. Similarly, private sector employers are typically liable for all judgments entered in the course of lawsuits naming them against their employees for tortious conduct (e.g. accidents) in the course of their employment and can be a source of collection for a debt.

In certain circumstances, usually due to a voluntary mortgage-type agreement but also for certain kinds of debts related to property, a judgment debtor has a lien on real or personal property before the lawsuit is filed that can be enforced as a "secured debt" by seizing the collateral, often, even without finishing a lawsuit. But, ordinary lawsuit judgments usually don't have these rights.

Duration Of A Judgment
Typically judgments confer these debt collection rights for a fixed period of time, often six years in a court of limited jurisdiction (e.g. small claims court) and often twenty years in a court of general jurisdiction (which typically also has criminal jurisdiction over felonies).
Often, these deadlines for collection can be extended and renewed if payment is not made in full during that time period if the judgment creditor takes affirmative legal action to do so in the right time period near the expiration of the judgment.
Often a judgment debtor who is judgment proof when the judgment is entered may somehow gain assets (e.g. winning the lottery or receiving an inheritance) many years later at which point the judgment creditor can use the judgment to collect from the judgment debtor.
Geographic Scope Of Collection Rights
Initially, a judgment applies only in the state where it is entered, but it can easily be transferred to another state in most cases, with a basically administrative effort. The "full faith and credit clause" of the U.S. Constitution makes it easy to transfer a money judgment from one U.S. state to another U.S. state.
But, the process is trickier in a foreign country. Many U.S. tort judgments (including judgments for defamation) are not automatically recognized in most foreign countries and may have to be reproven to collect on a claim in a foreign country (at least in part and often with fewer damages) from assets only subject to the foreign country's jurisdiction. If a U.S. person diverts or transfers assets to a country where a U.S. judgment cannot be enforced, however, with an intent to harm that creditor or creditors in general, that U.S. person can often be held in contempt of court and incarcerated until those assets are voluntarily repatriated.
Voluntarily Repayment
A judgment debtor can voluntarily pay amounts owed on a judgment and often does so in order to reduce the amount of post-judgment interest that accrues on the debt.
The judgment debtor and judgment creditor can agree to payment plans or other resolutions in lieu of using the formal rights set forth above.
"Voluntary" in this sense, however, is a somewhat loaded term. In practice, the terms and amounts of "voluntary" payments of judgment debts are negotiated "in the shadow" of the judgment creditor and judgment debtor's formal legal collection rights and defenses, with the parties sharing in some kind of windfall arising from the fact that collection costs are reduced when there is a voluntary repayment rather than formal legal action.
Creditors Rights Related To Gifts And Third-Party Trusts
Judgment creditors generally can't collect out of benefits provided in kind for the benefit of a judgment debtor gratuitously by a third-party with no wealth or income traceable to the judgment debtor who has no duty to pay a third-party judgment.
For example, a judgment creditor can't collect from a house owned by a wife prior to marriage and titled in wife's name and not derived from husband's assets, in a non-community property state, where a husband lives rent-free and with food and health care provided free of cost, with his wife, if the judgment debt is not for household necessities).
Similarly, assets in a discretionary spendthrift trust set up by the parents of a non-disabled adult judgment debtor to which the judgment debtor did not directly or indirectly contribution, which makes distributions to the judgment debtor only by making purchase for the benefit of the judgment debtor that don't give rise to non-exempt property of the judgment debtor can't be reached by a judgment creditor.
Fighting Money Judgments
Judgment debtors can appeal a money judgment, or seek to have it set aside, for narrow legal reasons, most of which have short deadlines. Once there are no appeals left and the most common post-judgment motions have been exhausted, the judgment is final and there are far fewer ways to set it aside (usually, discharge in bankruptcy, expiration of the judgment for being too old, and the argument that the court didn't have jurisdiction to enter the judgment in the first place are the main ways to set aside a final judgment where the main deadlines have already expired. The relevant deadlines usually run from the date that the money judgment is entered even if the debtor was unaware that the money judgment was entered).
A judgment debtor, pending appeal, can post a bond for an amount greater than the amount of the judgment (125% plus anticipated appellate court costs in Colorado) to prevent the judgment creditor from collecting by these means pending appeal, from which the judgment is payable if the appeal is unsuccessful in whole or in part.
A bankruptcy also temporarily suspends collection efforts without court approval in order to allow for an ordinary liquidation and distribution of assets and/or reorganization of a debtor's financial affairs.
A "debt collector" as that is defined under state and federal law respectively, has various legal rules that the debt collector must follow when collecting debts that result in penalties (although rarely the loss of any ability to enforce a judgment debt) if not complied with, which can be enforced by debtors, in class action lawsuits, or by the relevant government officials (often the U.S. Justice Department and state attorneys-general).
Bankruptcy For Individuals
A judgment debtor can file for bankruptcy, if this option is available, in which case the collection of the judgment is handled in the bankruptcy process.
A Chapter 7, once assets available at the time of filing are distributed to creditors, discharges some, but not all, kinds of debts. Some kinds of debts (e.g. most intentional tortious conduct judgments including most defamation judgments) can't be discharged in bankruptcy if a timely objection to discharge of that debt is filed by the debtor in a bankruptcy case. More complicated kinds of bankruptcies are available for individuals under Chapters 11, 12 and 13, which usually involve payment plans and/or customized treatment of certain assets.
In most but not all bankruptcies (even under Chapter 7), an individual debtor must enter into a payment plan to creditors in addition to giving up all non-exempt assets.
Disposition Of A Judgment Creditor's Claims At Death
One a judgment debtor dies, if there is a judgment outstanding, the judgment creditor can file a claim in the estate of the judgment debtor and that is paid to the extent that there are funds available and not exempt from creditor's claims in order of priority under the law. But, next of kin are not responsible for a judgment debtor's debts.
Probate estates cannot file for bankruptcy, but a probate proceeding often has an impact on creditors similar to a Chapter 7 bankruptcy (although by no means identical).
Entity Debtors
The analysis is similar, but bankruptcy works differently and there are far fewer exemptions from creditors, in the case of a judgment owed by an entity that is a judgment debtor to a judgment creditor.
A full treatment of entity insolvency proceedings is beyond the scope of a reasonable answer to this question. Entities filing Chapter 7 bankruptcies and availing themselves of non-bankruptcy insolvency proceedings don't have their debts discharged, but become shells with debts, but not assets since all of their assets get distributed to creditors.
Entities that reorganize under Chapter 11 can arrange to pay creditors less than the full amount that they are owed subject to some basic ground rules which usually entitled creditors to at least as much over the duration of a Chapter 11 plan as the creditor would receive in a Chapter 7 liquidation bankruptcy.
Comment: thanks for your deep and comprehensive answer @ohwilleke
Comment: The jury ruled ordered Mr. Depp to pay 2 million dollars and Heard to pay 10 million dollars, why not order Heard to pay 8 million dollars and Dep not to pay anything?
Comment: @TechGeek Juries are given very simple jobs - their verdict forms call for them to evaluate one claim at a time against one party at a time and assign a number (or zero if there is a defense verdict) to each. Everything else is left to the judges and lawyers. There are a variety of reasons this is preferable. For example, damages caps often apply on this basis (pre-setoff) and insurance policies may cover some claims but not others. Likewise, some but not other claims may be overruled or modified on appeal.


Nginx. Using redirects with regular expressions

Question: I'm a newbie to nginx.
I have the nginx before Apache and I'm having problems.
I seem to need 2 rules in the config:
Rule 1) if we have url "/my_path" we don't touch it but user goes to "/my_path.php"
Rule 2) if we have url "/my_path.php" we change it to "/my_path" and user goes to "/my_path.php" BECAUSE we revert to rule 1.
I think this is necessary for SEO?
My configuration, for example is this...
server {
    listen 8080;
    server_name my_apache_server;

    location / {
        proxy_pass http://my_apache_server/;
    }

    location ~^\/(.+)$ {
        rewrite ^\/(.+)$ /$1.php break;
        proxy_pass http://my_apache_server/;
    }

    location ~^\/(.+)\.php$ {
        proxy_redirect http://my_apache_server/$1 http://my_apache_server/error.php;
    }

    ...
}

But nginx shows an error:
nginx: [emerg] "proxy_pass" cannot have URI part in location given
by regular expression, or inside named location, or inside "if" statement,
or inside "limit_except" block

As I understand it, the proxy_pass can't be used with regular expressions. Is this correct?
I am thinking my config is wrong?
Can anyone help?
Thanks for your help in advance.
MY SOLUTION - it works
    # index page
    location / {
        proxy_pass http://my_apache_server;
    }

    # redirect(301) real "name.php" file to "name"
    location ~ ^/([A-Za-z_]+).php$ {
        rewrite  ^/([A-Za-z_]+).php$  /$1  permanent;
    }

    # not existen a-z file name to name.php
    location ~ ^/([A-Za-z_]+)$ {
        proxy_pass http://my_apache_server/$1.php;
    }

Answer: Can't proxypass to a URI, this would make for a double slash after the URL (http://my_apache_server//$.php).
Try:
location ~^\/(.+)$ {
  rewrite ^\/(.+)$ /$1.php break;
  proxy_pass http://my_apache_server;
}


The behavior of electromagnetic waves in matter

Question: In vacuum, the $\vec{E}$ and $\vec{B}$ field are always perpendicular, in phase, and they travel at the speed of light $c=3\times 10^8 \text{m/s}$. I would like to know what happens in matter ? Do the same rules apply ?
Comment: Electromagnetic waves will always have perpendicular $\vec E$ and $\vec B$ components traveling in phase. For the value of $c$, you may want to read about [Refractive Index](https://en.wikipedia.org/wiki/Refractive_index).
Answer: The wave equation $$\frac{\partial^2 \mathbf E}{\partial t^2} = c^2 \frac{\partial^2 \mathbf E}{\partial \mathbf x^2}$$ can be obtained from the Maxwell equations, for no charges or currents.
In vacuum, $c^2 = \frac{1}{\mu_0\epsilon_0}$.
For a transparent and isolant material as glass, with no free charges or currents, the same derivation is possible.
The only difference is that $\mu_0$ is replaced by $\mu$ and $\epsilon_0$ by $\epsilon$. So the wave speed changes, and is smaller than $c$.


USPTO part re-submission

Question: I decided to file a utility patent application myself without an attorney after watching hours of boring youtube videos about the patent and patent process (I don't know how you guys stay awake). I filed a US utility patent using EFS-Web myself online and it was smooth. I got a letter from USPTO after a few weeks saying that I -- accidentally -- omitted the description of a single image under the Description of Drawings.  I was asked to submit the description for it.  No issue in that regard but my question is that do I resubmit the whole application with the correction, or a sheet of paper with updated Description of Drawings section of the application, or just a single paragraph with the description of that single image?  Thanks in advance.
Answer: Here is an excerpt from USPTO example. The cross-outs didn't come over in my cut and paste so do look at the link.

Amendments to the Specification: Please replace paragraph [0021] with
  the following amended paragraph:
[0021] In the construction of the bucket of this invention, various
  materials have been selected [[and]] which offer a number of diverse
  properties [[ , ]] and allow for varied functions of the article.  For
  caustic solutions, the bucket can be made of a durable polymer plastic
  material.  Where an aesthetic appeal is desired, the bucket can be any
  [[of]] one of many attractive colors.  The following listing list of
  properties serves to define possible uses for the buckets.

USPTO part re-submission


Searching for cable which links Senheiser headphone directly to computer over 3.5 mm jacket

Question: I have a Senheiser HD 559 which comes with a cable that has an 6.3 mm jack connection. Now I wanna connect this heaphone to a normal PC with a 3.5 mm female jacket. Unfortunately every (and with every I mean high quality brands product and cheap brand product) sell 6.3mm Female Plug to 3.5 mm Male Jack Stereo Adaptor, which always have a loose contact. So I wanna buy a cable that connects my heaphone and has a direct 3.5 mm male jacket which can be connected to any device directly.
Comment: Are you simply looking for a 3.5mm to 3.5mm M-M lead?
Comment: No, I'm searching for a 2.5 mm to 3.5 mm M-M lead. I bought one cable for another similar headphone model from senheiser, but it's not here yet. I will see if it will fit.
Answer: You don't say what type of connector is on the other end, but my guess would be it's a 4-pin 2.5mm jack. Those are sometimes used for balanced headphone signal. The cables are not very common, but knowing what plug it is you should be able to find and order one.


Advantages of cubic spline interpolation over cubic Hermite interpolation?

Question: So far I have studied cubic Hermite interpolation has a less computational cost and does not have issues like undershoot and overshoot as compared to cubic spline interpolation. My question is what are the advantages of cubic spline interpolation over cubic Hermite interpolation? And in what situation/data application of cubic spline interpolation will be more suitable?
Answer: Cubic spline interpolation of a function $f : [a,b] \rightarrow \mathbb{R}$ produces an approximation $p : [a,b] \rightarrow \mathbb{R}$ which is two times differentiable and $p''$ is continuous. This is particularly useful when you need to fool the human eye. In the cinema the audience expects the spaceship's position, velocity and acceleration to wary continuously as it moves across the screen.
Cubic Hermite interpolation produces an approximation $q : [a,b] \rightarrow \mathbb{R}$ that is differentiable with a continuous derivative. Cubic Hermite interpolation is useful when generating continuous output when solving ordinary differential equations $$x'(t) = g(t,x(t)).$$ It uses the local position ($x$) and velocity data ($x'$) that is naturally available in this context and it matches the accuracy delivered by the classical 4th order Runge Kutta method. Cubic Hermite interpolation allows us to rapidly solve event equations of the type $$h(x(t),x'(t)) = 0.$$ This allows us to determine when, say, an artillery shell reaches the apex of its trajectory or impacts the ground.


How to find all db objects containing string in Sybase

Question: Sometimes I need to find some strings inside DB usually it is just host-name or ip address.
Is there any script which finds string in all Sybase db objects  (or at least in all tables) that I have access to.
Answer: The query on sysobjects + cursor + EXECUTE works. kinda sorta.

sp__map_object 'SELECT * FROM %O where name like "bar%"', 'foo_%'

There are so many bugs/issues/worries in the code that I am reluctant to post it but I have a certain amount of sympathy for a fellow Sybase sufferer.
Rob Verschoor has a bunch of nice stored procedures at
http://www.sypron.nl/new_ssp_dwn.html
pjjH

289:1> ? sp__map_object
(1 row affected)
/*
 *
 * BE CAREFUL WHEN RUNNING THIS!!!
 *
 * See list of dire warnings in sp__map_db.sql
 *
 * Run the given command on the stored procedure for each object
 * matching @object_pat and replacing the first instance of %O with that
 * name.
 *
 * Just do this in Perl. Or refactor the sql so that it works for some sane
 * cross-product of users,logins, databases and objects.
 *
 * Paul Harrington
 *
 */
CREATE PROCEDURE sp__map_object
  @sql             VARCHAR(255) = 'sp__help',
  @objpat          VARCHAR(32)  = NULL,
  @type            VARCHAR(2)   = 'U',
  @do_it           INT          = 1,
  @verbose         INT          = 0
AS
BEGIN
  SET NOCOUNT ON
  DECLARE object_cursor CURSOR
  FOR
    SELECT DISTINCT name
    FROM   sysobjects
    WHERE  name LIKE @objpat
      AND  type LIKE @type
  DECLARE @munged_sql VARCHAR(255)

  DECLARE @object_name varchar(64)
  OPEN object_cursor
  FETCH object_cursor INTO @object_name
  WHILE @@sqlstatus = 0
  BEGIN
    IF CHARINDEX('%O', @sql)  0
    SELECT @munged_sql = SUBSTRING(@sql, 1, CHARINDEX('%O', @sql) - 1) +
                  @object_name +
                  SUBSTRING(@sql, CHARINDEX('%O', @sql) + 2, 255)
    ELSE
      SELECT @munged_sql = @sql

    IF (@do_it = 0 OR @verbose = 1)
    BEGIN
       DECLARE @msg varchar(255)
       SELECT @msg = @munged_sql
       SELECT @msg
    END

    IF @do_it = 1
        EXECUTE(@munged_sql)
    FETCH object_cursor INTO @object_name
  END
  CLOSE object_cursor
  DEALLOCATE CURSOR object_cursor
  SET NOCOUNT OFF
END

go
Answer: None that I know of natively.  You could perhaps roll a procedure which queries the system tables to get a listing of objects, and then have a cursor go through and query those objects for your given search criteria.


New to Umbraco, where should i start?

Question: im new to Umbraco , i have been looking for a book or cbt to start learning it but no hope ! , any one can point me to where should i start ?
any book ?!  any compelete material ? any place where i can start learning ?
Answer: There's multiple places, the most important one is: http://our.umbraco.org which features the wiki with a lot of articles.
Then there's the 5 free video's about Document Types (one of Umbraco's building blocks) at http://umbraco.tv/documentation/videos/for-site-builders/foundation/document-types
These videos also shows you all of the other sections that you will be accessing to create a simple website.
If your familiar with .Net usercontrols and want to use them in Umbraco, there's 5 more free video's about that at:
http://umbraco.tv/documentation/videos/for-developers/foundation/using-net-user-controls
For an example of how to install Umbraco easily, watch this screencast:
http://www.cultiv.nl/blog/2010/2/1/screencast-installing-umbraco (this is my blog and feature some other Umbraco articles that could be of use).
Comment: http://umbraco.com/help-and-support
Answer: The official Umbraco page: http://umbraco.org/documentation
They have books, videos, the API documentation and a forum.  If you're willing to pay, they also offer professional training and certifications.
That page will keep you busy for a while.
Comment: The documentation section is free.. But this is the old documentation, it has since moved to the wiki at: http://our.umbraco.org/wiki
Comment: Actually i was looking for something for free at the moment, but thanks any way

New to Umbraco, where should i start?


Why do each of my 3-way switches have a hot lead?

Question: I have a light controlled by two "three-way" switches. It has worked properly for many years. It started getting a little flaky. I noticed that one of the switches needed to be pushed up a little harder for it to work. I replaced that switch (I checked the continuity of the old switch, and it was flaky). I got some of the functionality back, but not all. Then I pulled the other switch and it was bad as well. I replaced it and still did not get total function back. So, I pulled both switches off, and with no wires connected in either box and with the power on, found power going to each of the switches. I am baffled at how this could ever have worked. Is there any explanation other than I have some sort of short in my wiring?
Comment: And you're sure you did not confuse the common with the travelers? That happens a lot befause people expect screw position to be not *different on every switch...*
Comment: What did you "find power" with? [False positive from a non-contact voltage tester?](https://diy.stackexchange.com/questions/85399/false-positive-from-a-non-contact-voltage-tester). If it worked fine before, there's a 99% chance you messed up the travelers - partial functionality is indicative of this.
Answer: There are three systems for multiway switching, though one of them has been banned in the USA for a very long time.

The "conventional" system. Power is fed to the common of one switch, which switches it between two travellers. The second switch then switches which traveller is connected to the light.

The "California" or "Coast" system. All three terminals of the switches are linked together. Power is fed in on one non-common terminal, the light is connected to the other.

The "Carter" system. The switches are wired to switch between hot and neutral. If the light gets two hots or two neutrals it is off. If it gets one of each the light is on. This is a bad idea for multiple reasons and was apparently banned in the USA about a hundred years ago but still you should be aware that it exists.

If you are finding hots at both switches I would suspect you most likely have the "Coast" system, though there is a remote possibility of the Carter system.


What is a prophet in Judaism?

Question: When can one be considered a prophet in Judaism? What do they have to do to achieve the title of prophet? Do they have to make a predication about the future?
Comment: https://judaism.stackexchange.com/questions/26350/what-are-signs-of-a-prophet-mentioned-in-tanach https://www.jewfaq.org/prophet.htm
Answer: Mishneh Torah Hilchot Yesodei Hatorah 10:1-2

Any prophet who arises and tells us that God has sent him does not have to [prove himself by] performing wonders like those performed by Moses, our teacher, or like the wonders of Elijah or Elisha, which altered the natural order.
Rather, the sign of [the truth of his prophecy] will be the fulfillment of his prediction of future events, as [implied by Deuteronomy 18:21]: "How shall we recognize that a prophecy was not spoken by God?..."
Therefore, if a person whose [progress] in the service of God makes him worthy of prophecy arises [and claims to be a prophet] - if he does not intend to add [to] or diminish [the Torah], but rather to serve God through the mitzvot of the Torah - we do not tell him: "Split the sea for us, revive the dead, or the like, and then we will believe in you." Instead, we tell him, "If you are a prophet, tell us what will happen in the future." He makes his statements, and we wait to see whether [his "prophecy"] comes to fruition or not.
Should even a minute particular of his "prophecy" not materialize, he is surely a false prophet. If his entire prophecy materializes, we should consider him a true [prophet].
We should test him many times. If all of his statements prove true, he should be considered to be a true prophet, as [I Samuel 3:20] states concerning Samuel, "And all of Israel, from Dan to Beersheba, knew that Samuel had been proven to be a prophet unto God."
(Touger translation)
Comment: Related: https://judaism.stackexchange.com/questions/113671/how-many-times-must-a-prophet-be-tested/113677#113677
Comment: Re: "Should even a minute particular of his 'prophecy' not materialize, he is surely a false prophet": Wait, does this mean that Jonah was a false prophet??
Comment: @ruakh No. In 10:4 he clarifies that this rule does not apply to prophecies about punishment, since it is possible for people to repent and for God to forgive.
Comment: Ah, OK; phew! ;-)
Answer: Just to add to Alex's answer. Before becoming a prophet, the person must work on refining himself, until he reaches a level where receiving prophecy is possible. From Mishneh Torah Hilchot Yesodei Hatorah 7:1

Prophecy is bestowed only upon a very wise sage of a strong character, who is never overcome by his natural inclinations in any regard. Instead, with his mind, he overcomes his natural inclinations at all times. He must [also] possess a very broad and accurate mental capacity.
A person who is full of all these qualities and is physically sound [is fit for prophecy]. When he enters the Pardes and is drawn into these great and sublime concepts, if he possesses an accurate mental capacity to comprehend and grasp [them], he will become holy. He will advance and separate himself from the masses who proceed in the darkness of the time. He must continue and diligently train himself not to have any thoughts whatsoever about fruitless things or the vanities and intrigues of the times.
Instead, his mind should constantly be directed upward, bound beneath [God's] throne [of Glory, striving] to comprehend the holy and pure forms and gazing at the wisdom of the Holy One, blessed be He, in its entirety, [in its manifold manifestations] from the most elevated [spiritual] form until the navel of the earth, appreciating His greatness from them. [After these preparations,] the divine spirit will immediately rest upon him.

What is a prophet in Judaism?


Correlation tables between irreps for f orbitals

Question: I want to define occupied orbitals in terms of IRREPs for tungsten which has f orbitals. The highest possible point group for $\ce{WF2}$ in MOLPRO is $D_{2\mathrm h}$. Unfortunately, one can't write $\Phi_{u}$ as a direct sum of IRREPS in $D_{2\mathrm h}$. How can I solve this?
Comment: You can use a table, but I'm not sure if it will give you the optimal configuration for that highly complicated triatomic. I think you'll have to try several and then pick the one that gives you the best results (for example, lowest CISD energies).
Comment: Related: https://www.molpro.net/info/2015.1/doc/manual/node165.html
Answer: The simplest way to check the correlation between $f$-type basis functions in a high-symmetry point group (say $D_{\infty h}$) and in its Abelian subgroup (say $D_{2h}$) or any other subgroup is to compare their character tables from http://symmetry.jacobs-university.de/
$D_{\infty h}$
http://symmetry.jacobs-university.de/cgi-bin/group.cgi?group=1001&option=4
$D_{2h}$
http://symmetry.jacobs-university.de/cgi-bin/group.cgi?group=602&option=4
Here's how the correlation looks like for the 7 spherical $f$-type functions.
Correlation table

basis functions
$D_{2h}$
$D_{\infty h}$

$z^3$
$B_{1u}$
$\Sigma_u^+$

$xz^2$
$B_{3u}$
$\Pi_u$

$yz^2$
$B_{2u}$
$\Pi_u$

$y(3x^2-y^2)$
$B_{3u}$
$\Phi_u$

$x(x^2-3y^2)$
$B_{2u}$
$\Phi_u$

$xyz$
$A_u$
$\Delta_u$

$z(x^2-y^2)$
$B_{1u}$
$\Delta_u$

So, you can write $\Phi_u$ as $B_{2u} \bigoplus B_{3u}$