How important is castling? How much is it worth?

Question: Are there some statistical values for the worth of castling? Are there some numbers, for example in centipawn that can represent the value of castling?
Comment: Notice that in general there is no objective value of things, it all depends on the position. If you castle into your opponent's rooks on open file, then of course it is not a good move, for instance.
Comment: I think i interested in both answers. But my question is a little bit more related to the chess engines
Comment: I am thinking about it, because I want to know when if should concetrate on development if there is a good possibility to destroy opponents castling. Maybe for the cost of 1 pawn or 2-3 moves
Comment: Do you want how much it should worth in chess engine or are you are interested in chess itself? Your response will define your answer.
Comment: @GennaroTedesco Your statement is wrong. Castling is an engine parameter and is well defined in chess engine programming. It does have objective value.
Comment: @SmallChess  I see nowhere in the question the statement *"what is the numerical value associated to castling in position X for software Y?"*, unless of course you want to interpret it as such.
Comment: @GennaroTedesco Yes... the question says "centipawn". Centipawn is the numerical value... ......
Comment: @SmallChess Different engines use different values. And as far as I understood, OP wants to evaluate if messing with his opponent's castling is "worth it", so he needs a value relative to how much the engine thinks a tempo etc. is worth - not an absolute, "objective" one.
Comment: @SmallChess Yes, but unless you specify what programme you are looking at, different softwares use different values. Again, there is no "one numerical value" attached to things, that is my point.
Comment: You may be interested in this: https://www.chess.com/forum/view/game-analysis/point-value-of-castling and https://www.chess.com/forum/view/game-analysis/how-much-is-castling-worth .
Comment: Another possible insight would be to make an engine unable to castle for one side; does that change the engine's assessment? For instance set up some silly moves like 1.f4 d6 2. Kf2 e6 3. Ke1.
Comment: Leela Vs Stockfish with Castling banned => Both Artificial engines ended up castling Artificially
Answer: Yes there are some numbers that can (sort of) represent the value of castling.
If you let Stockfish or any other strong engine analyze the starting position, it will generally come to the conclusion that White has roughly a +0.50 advantage. But if you use an opening book (1. Nf3 Nf6 2. Rg1 Ng8 3. Rh1 Nf6 4. Ng1 Ng8 5. Nc3 Nf6 6. Rb1 Ng8 7. Ra1 Nf6 8. Nb1 Ng8) which lets Black castle but not White, the advantage actually flips around, and the starting position advantages Black.
Check these games out:

Stockfish-Xiphos. The starting position, except White can't castle while Black can. Stockfish's starting eval at depth 31/48 is -0.20. (Yes Stockfish wins anyway, but it is Stockfish, the strongest conventional engine in the world, playing)
Xiphos-Stockfish. The reverse game. Xiphos plays 1. Nc3 evaluating the position as 0.00, while Stockfish is -0.84 at depth 36/52.
AllieStein-Stockfish. Played from the opening position with both sides able to castle. AllieStein gave 0.43 advantage to White at depth 18/57.
Stockfish-Alliestein. The reverse game, Stockfish gave White a 0.47 advantage in the opening position at depth 38/59.
Answer: If you think of castling as an efficient way to play, say, Ke1-f2-g1 and Rh1-f1, then castling takes one tempi vs. three tempi to castle by hand. Therefore castling is worth three tempi.
Comment: I don't think you can approximate it like that. Castling by hand puts the king in an even less safe spot temporarily (f2/f7 is a weak point that the opponent can usually attack relatively easily) and also requires the f pawn to be moved (a fourth tempo spent on a move that permanently weakens your position more often than not)
Comment: Hmm. The difference between one tempo and three tempi is two tempi, isn't it? So the right to castle is worth two tempi? But your calculation applies only when the rook's final destination is the f file. If we compare Ke1-f2-g1 & Rh1-e1 vs. O-O & Rf1-e1, castling only saves one tempo.
Answer: Chess has one particular tactic or theme which cannot be ignored and that is king safety.
Since the rule is that if the king is lost, or checkmated, the game is lost; so the value of king is the most essential. I do not say that castling is the only answer to a safe king since there are many noteworthy games which have been won without castling, but castling is a standard procedure in many openings, and middlegames, since the king goes inside the high walls protected by its own soldiers, and gets the rooks connected.
The value of Castling increases because beside the King the Queen and the minor pieces are developed somewhere else in the Game . What I mean is playing with White the King's Bishop is developed on b5,c4,e2 or g2 mostly . The Knight is developed frequently on f3,e2 or a3 sometimes and we put our e and d pawns on e4 and d4 in most cases . The Queen leaves the stand from d1 and gets developed to some other Square .Now when it happens if the King remains in Centre it becomes exposed and susceptible to attack . No minor pieces are there to protect it .
When the King remains in the Castle then the Knight on f3 , the Pawns on f2,g2 and h2 serve as a barrier and the Rook stays besides as if the King is riding on a high elephant . Sometimes with the g pawn on g3 the Bishop stays on g2 . The King is protected and then the Forces can be coordinated on a particular area of the board for an attack . So Castling makes just too much sense .
Comment: I don't think this answers the question. The question is very specifically about assigning a _number_ to the worth of casteling. It's possible you think that the OP's motivation is a bad one, but that would mean you upvote the other answer saying so.
Answer: I would check this by trying some experiments with a chess program to see how it evaluates positions.  For example you could put in a position where one side is not castled and then the same position, if it is possible given the position, with the same side castled and compare the evaluations.  You could do a similar test with the original position where the one side is not castled, but is able to castle, versus the same position but where the one side is not able to castle - because the king or rook already moved.  Of course the evaluations would depend on the initial positions.  If the positions are closed and not much is going on, you'd probably get a more stable value for castling from the experiments.
Comment: Yes! Computers _literally_ assign centipawn values to casteling. Therefore this intrinsically answers the OP's question "Are there some numbers, for example in centipawn that can represent the value of castling". This answer also acknowledges that there's no single number to rule all positions.
Answer: The answer is a round no (sadly, this answer is highly subjective).
The reason for this, however, it is not because castling is dependent on the position. The argument that castling cannot have a value because it can lead to getting mated or because it can lose you the game is essentially flawed since for this same logic a queen cannot have a value because saving a queen can also lead to get mated or lose you the game. My reasoning for this lies on the following statistic of utilization of squares by chess Grandmasters. It is quite obvious that using both white and black, Grandmasters tend to castle in almost every game: g1 as white and g8 as black have almost always a value greater than 1, meaning that the king is usually tucked in the corner for safety. Thus I would say that castling is, in average, a borderline indispensable tool that ensures the king safety.
Protecting one's king and checkmating the opponent's is the objective of the game, meaning that there is no need to assign a numerical value to the king because losing it means that the game is lost. Similarly, taking away one's option to castle severely hinders the safety of the king and, as seen above, is used virtually in every game. Hence castling cannot have a numerical value assigned since virtually every strategy to defend one's king uses it.
Comment: `Hence castling cannot have a numerical value assigned `. You're literally wrong. Computers do this in positions. The option of casteling has a number assigned to it. If it's the highest, that move is done. If not, it's not done. In addition to that wrong statement, I fear this answer has too many illogical non-sequiturs in it; For example: just because I plan on casteling at some point, doesn't entail that there's never, ever a reason to assign a number. For example, should I castle _now_ in move 3 and lose a pawn? or wait to castle later and save it? This is a real decision we often face.
Comment: Read my answer again. I use an example to say why some logic is flawed, I never say that you should stop assigning values to pieces. Also, since the OP is asking for *statistical* values, he wants a fixed one in the same way there is a fixed statistical value for the pieces. What computers do are evaluation functions that *change*, they do not assign a fixed value to castling, it depends on the position. Your comments are exactly the reason why I added the preface of flawed logic to my answer.
Comment: This is a very insightful answer.  I'd add that protecting the king is the most important aspect of castling but not the only aspect.  Because the king ends up tucked away on completion a side benefit of the 1-tempi move is that a powerful but marginalized piece (rook) is brought front and centre where he can go on to dominate centre columns.  This secondary benefit goes on to shape all subsequent game play (so no incidental benefit)
Comment: Wow, Judit Polgar *really* likes 1.e4 openings.
Comment: In all honesty, are you advocating that I _never_ dare to assign the number ever to anything? If so, you are too extreme for me to consider correct. You say: `... is essentially flawed since for this same logic a queen cannot have a value`. That _sounds_ like you're saying that I should stop assigning "9" to a queen in all positions. Again, acknowledging complexity doesn't mean we get extreme.
Comment: Agree with everything except "sadly". It's fortunate that chess is a compliated game
Answer: I am conducting some runs right now with some fairy armies battling each other and FIDE. I am thinking of taking away castling as an option from the slightly overpowered armies to better balance the games. Slightly overpowered armies are fairy armies with win% greater than 50% but less than 60%.  The error rate of the samples is high, even at 200+ games, so it is difficult to calculate the true mean with precision, but I bet this will make the difference. I am betting half a pawn.
Comment: Wow. Just did it yesterday and it made a big difference, at least a pawn's worth of value.  To be clear, I removed castling as an option from one of the armies, and the formerly dominant army consistently began to lose from that one small change.  When I have time, I will check it on a standard game and get back...
Answer: The rule is you have to castle in the first 10 moves, otherwise you will leave your king unprotected.
Most amateur players launch an aggressive attack and leave the king sitting there without any protection. If you study games from professional players, you will notice that they castle early in the opening.
Comment: ... except when they don't. Professional players know when castling is less important than other urgent matters.
Comment: "Centralization and development are worthless as opening principles unless they are complemented by and abiding solicitude for KING SAFETY." from The Secrets of the Russian Chess Masters: Fundamentals of the Game book.
Comment: To back up the point of @Glorfindel, you can take as an example many lines in the Najdorf Sicilian (specifically the English attack) where Black plays ...h5 and doesn't castle at all - or the famous Poisoned Pawn variation, all worked out to be at least equal for Black.
Comment: No. I'm not a professional player, but I like castling. Why first 10 moves?? Professional players don't castle early. I give this answer -1.
Comment: @SmallChess ..except when they do. In some openings, professional players castle as early as in the fourth move (spending the first three for the minimum requirement of moving a pawn and the minor pieces out of the way) - for example, the modern Giuoco or the Nimzo Indian. The rule is that there is no rule (and certainly none with a fixed number of moves). Castling early is beneficial on average, but, as Glorfindel wrote, there are situations where other things are more important.
Comment: And there are situations where NOT having castled is advantageous, because early exchanges are leading to an endgame.
Comment: This does not even answer the question. I know this person values casteling a lot. But the question is if you can _assign a number_ to its value.


Creating a map cache without ArcServer?

Question: Is there a way to create a tiled map cache without using ArcServer? I have aerial photography in .sid format that takes a while to load, whereas cached jpeg tiles will load much much faster. Any way I can work around this issue?
Answer: in tiling world there are some ways for caching tiles. in my application i am using gdal which is an excellent tool for both conversion and tiling. with sid files you can translate it to tif and then with gdal2tiles.py will help you to tile your data....
some example codes:
gdal_translate -of GTiff -co "TILED=YES" some.sid some.tif
gdal2tiles -title "Sid Photo" -z '0-12' some.tif sidFolder

usage of gdal2tiles.py
gdal2tiles.py [-title "Title"] [-publishurl http://yourserver/dir/]
          [-nogooglemaps] [-noopenlayers] [-nokml]
          [-googlemapskey KEY] [-forcekml] [-v]
          input_file [output_dir]

if your gdal not support sid file (you can learn with : gdalinfo --formats | grep -i mrsid ) you should add MrSID support into GDAL...
Adding mrsid support read this file : How to add MrSID support into GDAL
for tiling you can look SafeFME, Global Mapper too...
i hope it helps you
Comment: Aragon - Out of curiosity - Can you specify your tiling scheme using GDAL, or will it always generate tiles based on the google maps tiling scheme?
Comment: @Gshock i am using TMS standart scheme for my app. which is the same as google maps tiling scheme

Creating a map cache without ArcServer?


Store - Show Total Amount Sold

Question: We need to be able to show the total amount of items sold for a specific item.  How would we go about doing this?  So basically the amount that have sold in the past, this is more so for our own reporting reasons.
Answer: If this is just for your own reporting then you can make use of the Reports section by navigating to Store > Reports and going to the Products Sold section. Enter in your custom date range (which can go back to the first purchase) and the items can be ordered by SKU. You can then view this report online or export it as a CSV or PDF which will contain the total number of products sold per SKU for a specified date range.
Comment: Thank you for this.  Is there anyway to code custom reports.  For instance we have 3 levels of "inception" haha.  We have a Collection that then has dates that then has 1-4 different items for that date.  For instance:  Clothing > November 1st> Design 1, Design 2, Design 3

Store - Show Total Amount Sold


Parse JSON as easily as XML can be in Python 3

Question: In Python 3 it is easy to find a given tag in an XML file via etree.
Using JSON, I've found there isn't a function to do that. Is there a library that does so efficiently? Is it worth my time to have a tree constructed from some JSON?
I'm having to use woeid = data["places"]["place"][0]["woeid"] where with XML I could simply use tree.findall("\\woeid"), though I'm assuming there's a significant overhead for the latter.
Answer: jsonpath is an XPath for JSON.


"Augur" : Is it an "Oracle" or "data-source" ? which one?

Question: If we define following three entities (as defined HERE):
(1) data-source

(2) query

(3) the oracle/oracle network

Then, as this article says, is "Augur" a data-source ? Or it is an "Oracle" ?
Comment: A data-source, I'd say
Answer: The premise of this question is Oraclize's definition which doesn't really match how people have historically used the term. On their definition Augur would be a data source, and you don't need an oracle.
What people normally mean by "oracle" is more like "a black box that gives you information somehow", in which case Augur is an oracle and a data source.
Their definition of the "query" is even further from normal English: To non-oraclize humans a query is the content of the request, not the "formula". If it was a formula, I suppose Augur's query is the human language you ask the question in. But to the rest of us, a query is the content of the question, ie the thing you're trying to find out. This sometimes encompasses a particular way of structuring that thing.
Answer: I don't think it is really fair to describe Augur as only one of the 3 items. Just like Oraclize, I think Augur has all 3 aspects in their "decentralized oracle".
In Augur you have:

data-source: Users who use Augur, report the outcome of events, and participate in the prediction markets
query: The market created for a particular event
the oracle/oracle network: The Augur smart contract which manages the market life-cycle and disputes with outcomes


Search and replace within files

Question: I found the following awesome little script at link

$ find /home/bruno/old-friends -type f -exec sed -i
  's/ugly/beautiful/g' {} \;

But I really do not understand the final bit

{} \;

Could someone please explain??
Thanks!
Answer: This is not exactly a sed syntax problem, it's a find syntax problem.
The {} is a container that will replace the name of the file being processed by the sed command.
If you use find like this:
$ find . -type f -name *.py -exec head {} \;

This will find Python scripts and show you the head of each file. If you have three scripts in the current directory:

1.py
2.py
3.py

The {} will contain each file name and execute the head command on each file.
The -exec argument needs a ; at the end so it can recognize the end of the command arguments (sed in this case) but, in order to protect ; from expansion you need to escape it with the \.
Remember that you can execute several commands at a time if you use the ;:
$ ls; pwd;

This will list directories (ls) and print your working directory (pwd). The -exec argument also needs the ;. But since you don't want to confuse the ; that separates commands with the ; that is part of the -exec argument of find, you need to escape it with the \.
Alternatively, you can use quotes around the ;:
$ find /home/bruno/old-friends -type f -exec sed -i 's/ugly/beautiful/g' {} ";"

I hope I made myself clear
Answer: I have been using an about.com Linux page for a while that covers

find - search for files in a directory hierarchy

as a reference for a while and it covers the part of the command you are asking about.
find . -type f -exec file '{}' \;

Runs `file' on every file in or below the current directory. Notice that the braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though ';' could have been used in that case also.
So I think your command should have semicolons around your braces just to be safe.
Reference Links:
Article explaining the find command
Answer: With exec (and not xargs), the {} has to be included as it gets replaced by name of the file that is targeted by the find command; it is a placeholder that is normally quoted so that if any target files have spaces in them, the command will still run successfully on all the files. The semicolon has to be included as it ends the command, just like when separating multiple commands on the command line. It has to be escaped in this case so that the find command receives it from the shell unexpanded (as a literal).
There are many tutorials about this online, see, for example, this useful article.
Another excellent, and indeed essential, article is that on the Wooledge site that explains extremely well the find command, exec, and the importance of quoting various elements in your command or script. I have found that article and the site as a whole very useful for learning bash and bash scripting.

Search and replace within files


How to convert to HTML code?

Question: Are there any scripts that can convert between text (e.g. <hi>) and the html entities version (<hi>) like this website does? Or at least a PHP file?
Comment: I'm not sure what "html entities version" means. Can you elaborate on how this differs from regular html conversioni? If you just want a text to html coverter, a quick search shows http://txt2html.sourceforge.net/.
Answer: The perl CGI module has a escapeHTML function that makes it pretty easy:
perl -e 'use CGI qw(escapeHTML); print escapeHTML("<hi>\n");'

Or to do an entire file:
perl -p -e 'BEGIN { use CGI qw(escapeHTML); } $_ = escapeHTML($_);'  FILENAME

Answer: The recode utility supports HTML as one of the encodings. (You can even specify an HTML version.) In the text-to-entities direction, it will also recode non-ASCII characters into entities; you need to specify the correct input encoding (e.g. ASCII, latin1, utf-8, …).
recode utf8:html <input-file.txt >output-file.txt
recode l1..html file-to-recode.txt

Answer: xmlstarlet can do it both ways:
echo 'Ampersands & angle brackets need to be encoded.' |
xmlstarlet esc |
xmlstarlet unesc

Comment: That fails to encode the &. If just esc is used then all the less than and greater than characters are also encoded as < >
Answer: I'm not sure of your original goal/purpose, but if you are wanting to show PHP source to someone --
You can rename the file to *.phps extension and (in many Apache/PHP configurations, but not all) it will not parse the PHP when serving the file to the user; it will show the source directly.
Comment: I don't think this is what he wants; he wants either a command-line tool or a PHP script that will take text input and escape HTML entities
Answer: For anyone interested: I wrote a well documented easily readable open-source bash script that converts accented letters in HTML entities. You can find it here:
http://www.lugato.co.uk/silvio_dwl.html
It is easy to understand so it can be easily modified to convert additional characters in HTML entities ;)
Enjoy it!
Silvio
Comment: Welcome to Unix & Linux! Whilst this may theoretically answer the question, [it would be preferable](//meta.stackoverflow.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.

How to convert to HTML code?


What does "Ich wusste, dass aus dir mal was wird" mean?

Question: I was watching a German Netflix show and I cannot understand this phrase. I searched the internet and this is not an idiom. Can someone explain why the phrase, specifically the "dass aus dir mal was wird" part of the sentence was translated by Netflix as "I always knew something would become of you".
Comment: *something special* – that's all conveyed in the *was*. Typical German pokerface expression – may mean anything.
Comment: @gerrit Your suggestions don't work, but it is possible to say *dass aus Dir mal was werden würde*. The Phrase in question is fine to us Germans as well. Maybe you can ask this as a question and some grammer guru will shed llight on the difference.
Comment: Is that actually grammatically correct?  How is *wusste* in past tense but *wird* in present tense?  Shouldn't this be either *wurde* or (better) *würde*?
Comment: @Javatasse https://german.stackexchange.com/q/52160/13615
Comment: I knew there was going to come something special from you sometime. Or to become something special of you.
Answer: It's more a set phrase than an idiom. "I always knew that you would develop into a successful person" might be a better translation. That success may refer to wealth, a professional level, or even just the character of that person.
Another example would be "Was soll nur später mal aus dir werden?!" (maybe said by a parent to a rebellious or lazy teenager), loosely meaning "what are you going to do with your life" or "how are you going to achieve anything to be successful in your later life / as an adult".
Answer: Perhaps the most direct translation would be

I knew something would come of you

which is also used in English in the sense of

I knew you would become something [special, good, etc.]

The sentence would formally be

Ich wusste, dass aus dir [ein]mal [et]was wird

of which the literal translation would be

I knew, that from you once something became (would become)
Answer: I agree with Connum about the meaning of this phrase.
"I knew there was going to come something special from (or of) you at some time."
Maybe it helps us a bit more if we try breaking it down:

wusste - knew
dass - that
aus dir - from or of you
'was - short for "etwas" = something (probably special)
wird (kommen?) - wird alone just means would, implicitly meant is probably kommen, to come : would come from (or of) you.


Driving a high-side N-channel FET

Question: I'm currently using a LM5109B to attempt to drive a high-side N channel mosfet in a particular setup. I want to drive it independently of the low-side driver. I'm aware that the provided IC is used for H-bridge configuration. As expected, when there is no load and HI is pulled low, the HS is floating and the gate is driving. When I put a load with HI low, the gate doesn't drive. Is there any solution to ensure that HS isn't floating in this particular situation? Is there any High-side gate driver that can be used for this particular application?
Thanks
Comment: As in answers below: You can use 555 charge pump to create voltage higher than supply.
Comment: Have you tried a single-channel high-side driver? Many h-bridge/half-bridge drivers refuse to switch without both switches present.
Comment: I didn't try yet, but this was the next step. thanks for your reply
Answer: That chip uses bootstrapping and, bootstrapping requires that the load voltage goes high and low quite frequently. If this does not happen then the bootstrap capacitor loses its charge and you will be unable to drive the HO pin above the level of voltage on the source of the upper MOSFET. And, that means you can no longer activate the high-side MOSFET.
If you want a solution you should use an isolating DC-DC converter that can apply a voltage higher than Vin to the upper driver circuit.
Answer:

simulate this circuit – Schematic created using CircuitLab
As mentioned in another answer from Andy aka, a bootstrap driver will not work unless the load switches high and low. He describes using an isolating DC-DC, which is the circuit I've drawn up. You will also need to make sure that the driver you use is an isolated driver. I used an isolated 5v to 15v DC-DC in this example, but you can find ones that have different input and output voltages based on what you need.

Driving a high-side N-channel FET


How to use NTSC Xbox in Europe

Question: I just bought myself an original Xbox (NTSC) and I currently live in Europe (Germany). I have a question regarding NTSC/PAL:
What can I do about the voltage difference of the sockets in germany (230V) and the voltage the console needs (110V). I am pretty sure if I just plug it in my console it will get fried. And as far as I know the socket also puts out 50Hz and the Xbox needs 60Hz (like the socket output in the US) if I am not mistaken.
Comment: Could you take a couple pictures from the cable and the place on the Xbox where you would normally plug it in (without anything else plugged in)? That could help me in determining possible options.
Comment: What are the output video options on the Xbox, and what are your input options (hardware connectors) for your intended display?
Answer: If you want to know the voltages accepted by you Xbox unit, just look at the sticker right next to the power port. It will list the required amps as well as frequency.
The voltages should also be listed in the Xbox manual.
Comment: I checked that, it's what I wrote above. My question is what I do about the difference... I think I can buy a converter to turn down the volts, not sure about the frequenzy doe
Answer: NTSC and PAL are analogue TV standards and you don't have to worry here - all modern TVs (actually even most of the old CRT ones) have no problem between understanding those two.
When it comes to the power - well from what I've read it seems that XBox power supply is not as universal as for example PS4 one - while the latter one would accept 100-240V, the former is either built only for 110 V or 230 V. Read PRECISELY what is written on the power supply.
If you can, just buy an European power brick for your XBox.

How to use NTSC Xbox in Europe


detecting proxy

Question: say u host a website and people come and place orders with you while your away, u come back and see the orders have been placed by somebody, how will you find out if the person who placed the order used a proxy or not..??
Answer: A website is hosted in a web server, perhaps you meant that your web server is a Windows server but it sounds like you at home use MS Windows. Just to be clear, what you yourself use to browse to your website does not affect how others reach your website.
Depending on the proxy they may or may not set the X-Forwarded-For header, which would give away that the request is being forwarded.
Another option is to check the IP and try to match it to a database of proxy IPs, for example http://yaph.sourceforge.net/

detecting proxy


How to track a specific player with compasses in Minecraft 1.15 Java Edition

Question: I have seen the videos of Dream and GeorgeNotFound filming a Minecraft hunting event. I want to replicate this but I am not sure how to create a tracking device in Java Edition. I want to know how I can do this with command blocks but I'm not very good at it.
Answer: Here are the commands:
Repeating Command Block: execute at <SPEEDURNNER> run setworldspawn ~ ~ ~
Repeating Command Block: spawnpoint <HUNTER> (COORDS FOR HUNTER TO RESPAWN)
It doesn't matter where you put these command blocks, it just matters that they are on "Always Active".
Comment: "SPEED*RU*NNER"?


Are there any reasons why we should not block unencrypted service ports for mail such as 25,110 & 143?

Question: I want to block smtp 25, pop 110 & imap 143 and only use secured smtps 465, pop3s 995 & imaps 993. Are there good reasons to let port 25,110,143 open?
Comment: More detail. Block what from what and from whom?
Answer: Actually the ports you mentionned, 465, 995 and 993 are deprecated and should no more be used.
See RFC2995 section 7

imaps and pop3s ports

Separate "imaps" and "pop3s" ports were registered for use with SSL.
Use of these ports is discouraged in favor of the STARTTLS or STLS
commands.

A number of problems have been observed with separate ports for
"secure" variants of protocols.  This is an attempt to enumerate some
of those problems.

Separate ports lead to a separate URL scheme which intrudes into
the user interface in inappropriate ways.  For example, many web
pages use language like "click here if your browser supports SSL."
This is a decision the browser is often more capable of making than
the user.

Separate ports imply a model of either "secure" or "not secure."
This can be misleading in a number of ways.  First, the "secure"
port may not in fact be acceptably secure as an export-crippled
cipher suite might be in use.  This can mislead users into a false
sense of security.  Second, the normal port might in fact be
secured by using a SASL mechanism which includes a security layer.
Thus the separate port distinction makes the complex topic of
security policy even more confusing.  One common result of this
confusion is that firewall administrators are often misled into
permitting the "secure" port and blocking the standard port.  This
could be a poor choice given the common use of SSL with a 40-bit
key encryption layer and plain-text password authentication is less
secure than strong SASL mechanisms such as GSSAPI with Kerberos 5.

Use of separate ports for SSL has caused clients to implement only
two security policies: use SSL or don't use SSL.  The desirable
security policy "use TLS when available" would be cumbersome with
the separate port model, but is simple with STARTTLS.

Port numbers are a limited resource.  While they are not yet in
short supply, it is unwise to set a precedent that could double (or
worse) the speed of their consumption.

Regarding port 465 for SMTPS it was even re-assigned by IANA to a different usage:

urd   465     tcp     URL Rendesvous Directory for SSM

Source : http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?&page=9
Specifically for SMTP , a mail server should (in most case) accept uncrypted communication, since it will likely received email from server that will not propose TLS.
However it is also advise to use port 25 for server to server mail transfer and use port 587 for mail submissions from clients.
See RFC2476
Extract:

Message Submission

3.1.  Submission Identification

Port 587 is reserved for email message submission as specified in
this document.  Messages received on this port are defined to be
submissions.  The protocol used is ESMTP [SMTP-MTA, ESMTP], with
additional restrictions as specified here.

While most email clients and servers can be configured to use port
587 instead of 25, there are cases where this is not possible or
convenient.  A site MAY choose to use port 25 for message submission,
by designating some hosts to be MSAs and others to be MTAs.

Regarding POP3, IMAP, and mail submission on port 587, you can enforce encryption on the standard ports 110, 143, 587 by configuring you server to refuse connection not encrypted with TLS. (and it is strongly advised to do so).
Comment: It's not the port that is secure or insecure, it's what you run behind. As stated in my answer you CAN and should refuse non-TLS-encrypted connection.
Comment: While quite true, the attitude shown in this RFC has set back email security by decades. This was written when many people still had no idea the NSA even existed, let alone does what it does today. It's the _insecure_ ports which should be deprecated, analogous to the "HTTPS Everywhere" movement for web sites.
Answer: Since STARTTLS can be issued within plain session there is no reason to use ports other than standard 25/110/143.
If the other side can use TLS - let there be TLS.  If no, then a plain unencrypted session will occur.
Answer: Ports 110 & 143:
If i let open 110 (pop3s) & 143 imaps, it means that users can download mails in plain text to their clients.
Port 25:
If i block the port 25, users will be unable to send mails in plain text.
But there is something i have just tested now. The mail server will be unable to receive mails because mails will not be able to be received. In fact, mail servers communicate through port 25.
Comment: @FalconMomot And it is worth noting that SMTP with opportunistic TLS uses port 25 juts like unencrypted SMTP.
Comment: It's not a conspiracy; it's just legacy.  Many relays and MTAs support opportunistic TLS, but not all, so (as you've found) you can't really require it.
Comment: @FalconMomot for sure, on port 25, TLS is not mandatory. You are right, i have seen in raw headers of some mails that there were no TLS. On the other hand, i have checked with gmail & hotmail and there is always something like  (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128) in raw headers.
Comment: Yes, major providers usually support it, but all kinds of people don't.


Quantum Espresso calculation for Deuterium

Question: I am a new user of Quantum Espresso. I have to use Deuterium instead of Hydrogen for my work in DFT studies. Hydrogen Pseudopotential file is available in QE website. Please clarify what parameters I have to set in the QE input file in order to simulate Deuterium in QE.
Comment: @TristanMaxson it's really more an issue of the presentation of the post. My intent was to encourage them to format the post and to formulate an actual question beyond "give me this file". I'm fine with adding that as answer and reopening, but I want to encourage users (especially ones who have used the site for a while) to take some care with their posts rather than just a "do this for me, thanks" without further elaboration of what the actual problem is and how they have tried to address it. Closing a question early gives a user a chance to edit with out downvotes piling up.
Comment: @Tyberius I am not sure why this question is closed, you successfully answered it in a comment.  The question probably doesn't need more details and this is a really common question for people to ask as they start investigating MD methods.  We should reopen and you should answer more or less the same as your comment.  PP is not affected by isotopes in practical applications, it's just a mass parameter.  Maybe someone more physics heavy can answer if this is technically completely true though.
Comment: Could you clarify what you mean and format your question? As written, it's tough to read and it's not obvious what you have already tried to resolve this issue. It looks like you have a pseudopotential for hydrogen and since deuterium is just an isotope, I would expect it's electronic properties to be largely the same. You may need to set other parameters in QE to do a calculation with deuterium.
Answer: The main difference between deuterium and hydrogen is the mass, so you need to set the mass of the "hydrogen" so that it matches deuterium. I'm not a Quantum Espresso expert, but I think you do this by setting the ATOMIC_SPECIES card, see:
https://www.quantum-espresso.org/Doc/INPUT_PW.html#ATOMIC_SPECIES
However, you need to be clear about what effects you are wanting to simulate, because many common simulation tasks are not affected by the nuclear mass at all.
The pseudopotential doesn't care about the nuclear mass, so you don't need to change anything. For the same reason, the electronic ground state will be identical between hydrogen and deuterium, since Quantum Espresso uses an adiabatic approximation to decouple the nuclear and electronic  wavefunctions. If you look at the "electronic" Kohn-Sham equations, the nuclear mass doesn't appear at all.
The optimised geometry of your material or molecule will also be the same; this is because Quantum Espresso optimises the structure at zero Kelvin and treats the atoms semi-classically, so there is no quantum delocalisation/zero-point motion for the nuclei - essentially, there is no nuclear kinetic energy term. If there is no temperature and no nuclear quantum effects, then the nuclear mass doesn't enter any of the equations and deuterium will give the same answer as hydrogen.
The mass will affect molecular dynamics and path-integral/ring-polymer molecular dynamics, and it will also affect any vibrational properties such as phonons (though the force constant matrix will be the same as for hydrogen). Other nuclear properties might be relevant for some kinds of simulations, such as the nuclear spin (e.g. for NMR chemical shifts).
Comment: Thank You for the detailed information of isotopes in Quantum Espresso


Changing flavors on Ubuntu

Question: Which is the easiest way to change flavors in ubuntu?? Thanks I'm a newbie just trying new things.I haven't tested any out right now running ubuntu 20.04
Answer: You have 2 options:
-Installing the Flavour as your new OS.
-Using the terminal to install the flavour's desktop
I will give you the instructions for this last option.
Open the terminal and install the flavour's desktop you want with this command (e.g. Budgie):
<code> sudo apt install ubuntu-budgie-desktop
</code>
Please bear in mind that this last option will only give you the graphical interface of the flavour, if you want to use the flavour as your main OS, you need to install it the same way you installed Ubuntu.

Changing flavors on Ubuntu


What is the difference between Restricted Boltzmann Machine and Artificial Neural Network?

Question: In the deep learning course I took at the university, the professor touched upon the subject of the Restricted Boltzmann Machine. What I understand from this subject is that this system works completely like Artificial Neural Networks. During the lecture, I asked the Professor the difference between these two systems, but I still did not fully understand. In general, there is an input layer and a hidden layer in both, and the weights are updated with forward-backward propagation. Can someone explain the exact difference between them?
Answer: A Boltzmann Machine is a probabilistic graphical model which follows Boltzmann distribution:
$$p(v,h) = \frac{e^{-E(v,h)}}{\sum_{v,h} e^{-E(v,h)}}$$
where $E(v,h)$ is known as the energy function.
An RBM is a Boltzmann machine with a restriction that there are no connections between any two visible nodes or any two hidden nodes, which gives it the structure similar to a 2-layer Artificial Neural Network.
The difference is that RBM, being an unsupervised model, is trained by minimizing the energy function. While an artificial neural network can have many hidden layers along with an output layer, and is trained by optimizing the loss between the values of output layer and the values of target variable.
A special case of RBM which has binary visible nodes and binary hidden nodes, also known as Bernoulli RBM has an API available in scikit-learn. They have also documented the learning algorithm here. In this example, they show how Bernoulli RBM can be used to perform effective non-linear feature extraction which can be fed to the LogisticRegression classifier for digit classification.
Answer: You can find in this paper that RBM is a specific type of artificial neural networks. Hence, the term Artificial Neural Network is more general than RBF.

It is an important property that single as well as stacked RBMs can be reinterpreted as deterministic feed-forward neural networks. Than they are used as functions from the domain of the observations to the expectations of the latent variables in the top layer. Such a function maps the observations to learnt features, which can, for example, serve as input to a supervised learning system. Further, the neural network corresponding to a trained RBM or DBN can be augmented by an output layer, where units in the new added output layer represent labels corresponding to observations. Then the model corresponds to a standard neural network for classification or regression that can be further strained by standard supervised learning algorithms. It has been argued that this initialization (or unsupervised pretraining) of the feed-forward neural network weights based on a generative model helps to overcome problems observed when training multi-layer neural networks.

Of course, we have other types of neural networks like Recurrent Neural Networks expressing them as an RBF is not straightforward.


Why does the axis of spinning tops rotate about a vertical axis?

Question: I have noticed that when we make a top spin, the top itself rotates about it's own axis and at the same time its axis of rotation will be moving in circles. How to explain this? Why can't it simply rotate vertically and then fall suddenly when its energy is completely dissipated?
Answer: This answer elaborates on the earlier answer by use Krishna.
As user Krishna describes: if the top is constructed in such a way that it can remain upright statically (which of course means that it needs a foot that is wide enough), then if if spins sufficiently close to vertical it will slow down to the statically upright position.
But of course the general case is that the spinning top has a very small contact patch with the ground, so it cannot stay upright statically.
Given the natue of gyroscopic precession the decay will always be gradual, it cannot be sudden.
When the top is spinning fast a slow rate of precession is enough to provide sufficient torque in the direction that sustains fairly upright orientation.
As the spinning top slows down a larger rate of precession is required to provide the same amount of upright-maintaining torque. Increase of rate of precession goes at the expense of height. That is, the center of mass of the spinning top will drop a little.
As the spinning/precessing top tilts more and more away from vertical the torque from gravity increases, increasing the need for upright-acting torque. Visually this stage is where the decay speeds up; the decay is now reinforcing itself.
For a discussion of the mechanics of the onset of gyroscopic precession see my physics.stackexchange answer to a 2012 question titled What determines the direction of precession of a gyroscope


waAgent integration on custom Linux :- Troubleshoot interaction between waAgent and Fabric

Question: I am trying to integrate waagent in our custom linux based on centos 6.5
At present, I can upload vhd image of my custom linux and deploy it on Azure without waagent
I can connect to this VM in Azure using SSH
But since waagent is not integrated, Azure will show deployment status as as "Deploying" for long time and finally changes the status to "Failed"
So decided to integrate waagent to my customized Linux.
waAgent is also required as I need to publish my image in the Azure Market Place.
Since my VM is customized, I cannot simply install waAgent and start using it
Wherever waAgent has a chance to fail, I modified waAgent code in such a way that it won't fail and send success message to Fabric
Once my new VM (VM with waAgent) is deployed in Azure, I will manually connect to it using ssh and start waagent.
Through tcpdump, I verified that waagent is sending message to Azure Fabric that VM provisioning is "succeeded".
But still Azure portal does not change status from "Provisioning" to "Succeeded"
To proceed further I thought I need to find out what is missing in the communication between waAgent and Azure Fabric.
But there is no easy way to get tcpdump of success case so that I can compare the success tcpdump with my failure tcpdump.
Following are the options are tried to get tcpdump of success case.

Deployed Centos image from market place.
Since there is no way to start tcpdump before waAgent triggers, I followed this way.
Connect to VM using SSH
Ran "waagent -deprovision",
Now start tcpdump and run "waagent --daemon"
But waAgent fails to mount CD rom as Azure provides CD ROM during boot time only
Use 'user defined routes' to divert traffic from one VM to another VM.
This way traffic between waagent and fabric can be captured in another VM for a success case
But 'user defined routes' do not divert traffic to another machine if packets are designated to Azure Fabric
Thought to have Azure stack in data center so that both client and Fabric is in my control.
But learnt that protocol that is used in Azure stack is not same as that of Azure

Questions

How I can get tcp dump for success case tcpdump of waAgent so that I can compare the my failure case tcpdump with it
If I am not in the right direction, what is the easy way integrate waAgent in customized OS versions ?

Thanks
John
Answer:
If I am not in the right direction, what is the easy way integrate
  waAgent in customized OS versions ?

Azure supports install waagent on CentOS 6.5. More information about prepare a CentOS-based virtual machine for Azure please refer to this official article.


HELP with wireframing 3d artwork

Question: I want to create this but im having trouble with creating it with extruding. Any recommendations? I want to fill the font and leave the bottom transparent exactly like this
Answer: Illustrator's classic 3D extrude effect can help you to make something resembling. An example:

I left out the background image, I have the default black wireframe and brown face fill color to make it visible on the white artboard. The colors could be adjusted easily as one likes.
I started by writing something. In the right it has got some envelope distortion just for fun. The text was outlined and the envelope distortion is expanded. Everything could be kept as well editable in images this simple. Illustrator can work to some degree without suffocating also if the effects are kept alive for future edits.

The distorted version got classic 3D effect Extrude & Bevel. At first the shading was "wireframe" and good watching direction + extrusion depth were adjusted. After it the shape was duplicated.
The 3D effect of the duplicate was opened in the appearance panel and the shading was changed to "no shading". The extrusion depth was changed to zero. The viewing angle was kept intact. Both versions are in the next screenshot:

The final version was got by aligning the versions. They snap easily if the 3D effects are fixed at first by applying Object > Expand Appearance.
The version with zero expansion depth is needed. The version which got only the envelope distortion wouldn't fit.

HELP with wireframing 3d artwork


analysis question

Question: Suppose $f(x) \in \mathbb{R}[x]$ is such that $\operatorname{deg}{f(x)} = 2011$, then $\exists \: c \in \mathbb{R}$ such that $f(c) = f'(c)$. How can I prove/disprove the above statement. Any hints?
Answer: Consider $g(x) = f(x)-f'(x)$. Now apply the fact that an odd degree polynomial has at-least one real root.
Answer: Chandrasekhar's answer is boss, I wondered what would happen if we replace 2011 say with 2010.
But note that any polynomial $f = \sum b_i z^i \in \mathbb{R}[x]$ can be written as $p - p', p = \sum a_i x^i \in \mathbb{R}[x]$ (set $a_n$ to be $b_n$, where $f$ is degree $n$, then just inductively solve $a_i - (i+1)a_{i+1} = b_i$ for $a_{i}$), so this being true for $f$ of even degree is equivalent to $\mathbb{R}$ being algebraically closed o_O!

analysis question


Why is the DOMSubtreeModified event deprecated in DOM level 3?

Question: Why is the DOMSubtreeModified event deprecated and what are we supposed to use instead?
Answer: If you scroll down a bit, you see:

Warning! The MutationEvent interface was introduced in DOM Level 2
  Events, but has not yet been completely and interoperably implemented
  across user agents. In addition, there have been critiques that the
  interface, as designed, introduces a performance and implementation
  challenge. A new specification is under development with the aim of
  addressing the use cases that mutation events solves, but in more
  performant manner. Thus, this specification describes mutation events
  for reference and completeness of legacy behavior, but deprecates the
  use of both the MutationEvent interface and the MutationNameEvent
  interface.

The replacement API is mutation observers, which are fully specified in the DOM Living Standard that supercedes all of the DOM level X silliness.
Comment: @ TJ - no down. The one above is *DOMNodeRemovedFromDocument*. :-)
Comment: Replacement will come in DOM Level 4 http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#mutation-observers and it seems there is some progress in Chromium https://bugs.webkit.org/show_bug.cgi?id=73851
Comment: A great hack to replace the `MutationEvent` interface is [`animationStart` and some CSS](http://stackoverflow.com/a/13835369/237285).
Comment: The problem of the animationStart being, it only works for insertion of nodes. Not for node removal, attribute edition or text changes. It's also single-node, where `DOMSubtreeModified` allows watching a whole tree from a root node.
Answer: I think the replacement will be mutation observers: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
var whatToObserve = {childList: true, attributes: true, subtree: true, attributeOldValue: true, attributeFilter: ['class', 'style']};
var mutationObserver = new MutationObserver(function(mutationRecords) {
  $.each(mutationRecords, function(index, mutationRecord) {
    if (mutationRecord.type === 'childList') {
      if (mutationRecord.addedNodes.length > 0) {
        //DOM node added, do something
      }
      else if (mutationRecord.removedNodes.length > 0) {
        //DOM node removed, do something
      }
    }
    else if (mutationRecord.type === 'attributes') {
      if (mutationRecord.attributeName === 'class') {
        //class changed, do something
      }
    }
  });
});
mutationObserver.observe(document.body, whatToObserve);

Comment: I fail to understand the improvement that this makes. The code needed for achieving the same result seems to be bigger and less intuitive, and I don't get the internal benefits of how it works.


How to recover lost add-ons in Firefox?

Question: When I upgraded to Firefox 7, all my add-ons (except for a few) were lost.  Is there any way I can recover those add-ons (or at least find out what add-ons I had installed before the upgrade broke them)?  I have tried upgrading to FF 7.01, and using the add-on recovery dialog, and neither of those have worked.
Comment: is the extensions folder also deleted? Have you looked up your recycle bin for this folder? Dont forget to install FEBE addon next time
Comment: Yes, the only extensions that are still there are the ones that still remained after some of the extensions went missing.
Answer: Firefox doesn't delete the non-compatible add-ons, it just disables them. You should see a list of all your add-ons, working and not-working in the 'add-on' tab. You can get to the Add-ons Manager by typing "about:addons" in the location bar. Firefox should also have checked to see if newer versions were available and installed them for you automatically too.  If it didn't, either you told it not to, or there aren't any working (or compatible) versions available.
If there are no compatible versions available, you CAN make them work by editing the version limits in the 'install.rdf' file within the add-on/extension.   This is not recommended, but CAN work, although by doing this, you automatically agree that we don't have to help you fix things if it goes bad. :)  No, I won't explain how.
Comment: It was not a compatibility issue.  Firefox actually deleted the add-ons.  They are not in the add-ons manager, and they seem to be gone from the computer (the add-ons folder) as well.
Answer: AFAIK, if the addons, and the folders they were in are gone, then there is no way to recover the addons you had. But i can suggest a way to prevent it from happening again.
In firefox, you can actually create "collections" of your favorite addons, so you can then install them elsewhere, or simply share them.
more info here:
https://addons.mozilla.org/en-US/firefox/collections/
Basically, you are going to add any addon you want, and save them to a personal page, then you can make the collection public if you want.
There was an addon itself that let you automatically make collections of your currently installed addons, and it updated itself any time you installed a new addon. But i cannot find it. It may be no longer available.
Of course, this method will not save your addons preferences, is just a way to "bookmark" your addons, so you can access them any time later (from any computer).
If you want to backup the addons AND their preferences, then they are other ways to do it, like FEBE mentioned in a comment before.
Answer: You could also use Firefox Sync (likely started since this question was asked). You create an account and can set what to sync, and one thing you can sync is addons. If you are signed in on multiple devices, your addons are "backed up".
Answer: This is an old question, but users of Firefox 57 may have similar issues as it finally removed deprecated, legacy add-on APIs.
For users of Firefox 57 ("Firefox Quantum"), the list of previously installed, incompatible add-ons is visible in the new "Legacy Extensions" tab of the add-on manager, available at about:addons.

How to recover lost add-ons in Firefox?


How Proof-Of-Learning can be implemented?

Question: Seen a paper on Proof-Of-Learning and wanted to know-how the consensus works and how to implement it in ethereum?
Answer: I will try and summarize this for you shortly:
So currently POL, Proof Of Learning, is supported on a coin named WekaCoin.
And POL is based on machine learning.
The WekaCoin nodes, called trainers, also operate in a peer-to-peer network
just as in most blockchains, but instead of submitting a nonce for example, they submit machine learning models for specific layed out tasks that were previously published by other nodes in the network, called suppliers. (This is then their submitted "answers" to the "block problem".) Note that these models are executed
on data that was not observed by the trainers during training
and ranked in a distributed fashion according to a performance
metric determined by the task supplier.
The trainers, which can be compared to validators on Ethereum or miners on Bitcoin, are randomly selected nodes of the network in charge of ranking
models and proposing new blocks to the chain. The trainer
owning the best model is rewarded by the supplier with a
certain amount of WekaCoins.
The trainers are also evenly compensated with a transaction fee paid by the task supplier as well as with new WekaCoins.
"This whole process is used to validate blocks of transactions in a blockchain. The
resulting blockchain is a distributed and verifiable database of transactions plus an open repository of machine learning models and experiments used to verify them.
Proof-of-Learning establishes a symbiotic relationship be-
tween two complex and unrelated tasks: 1) validate transac-
tions in a distributed ledger, and 2) storing machine learning
models and experiments in a distributed database.
The idea
of aligning two different tasks is inspired by reCAPTCHA
[4], a mechanism that allows detecting whether a web user is
human (for security reasons) while assisting to digitize printed
material."
Direct Reference: https://www.researchgate.net/publication/330753314_Proof-of-Learning_A_Blockchain_Consensus_Mechanism_Based_on_Machine_Learning_Competitions


Resize an image by dragging and dropping in Photoshop

Question: Ss there anyway to select a section of an image in Photoshop and drag it to resize. You can do this in Microsoft Word and other programs, so there must be way to drag and resize in Photoshop.
Answer: Use the marquee tool (hotkey M) to select the portion of the image you want to resize, then use the Transformation tool hotkey: Ctrl+T (somewhere in the edit menu, but I always use hotkeys). This will bring up the transformation tools you want. When you are done, press Enter, or the check button on the option bar along the top.
Also, if you want the section you are resizing to not deform or stretch, hold down Shift while resizing will constrain the aspect ratio of the image.
Comment: this seems to resize the selection (the dotted line) but not my image.  any suggestions?
Comment: I misunderstood your question. I have posted another answer giving a solution to resizing the image the way you wanted.
Comment: You should put both answers into a single one instead of doing 2.
Comment: I'm not sure your two answers are mutually exclusive.  The image can't exceed the canvas, so that part of your other answer is needed.  Once the canvas is large enough, can't you select the entire image and do what you describe here?
Answer: Oh, you want to edit the entire image. That was unclear to me when I posted my first answer.
To resize an entire image, there is no way (that I know of) to do that graphically.
The way to do it, though is with the two menu items Image > Image Size and Image > Canvas Size. Image Size will change the size of the image, and you have to put it a new dimension either in pixels, inches, percent, or a few other units. Canvas Size will change the size of the canvas, without changing the image it self. So your art won't change, but you will have more room to draw.
Answer: Mike Cooper is correct but just wanted to make one point explicit.  The only thing that was missing was after you select your image, you must click (or double click) on the image or it will just change the selection without actualy affecting the underlying image.  Once you click it seems to grab the image.
Comment: You should mark his answer correct then and either comment on his answer, ask him to add it to his answer, or edit his answer yourself. He answered your question correctly, not you.
Answer: You have to transform the image if you would like to resize it within the layer. Select the image and press Ctrl+T and resize the image and press Enter to apply your changes to the image.


Reconstruct the original symmetric matrix given Eigen values and the longest Eigen vector

Question: I want to reconstruct the original $3\times3$ symmetric matrix (namely $D$) whose all Eigen values ($\{\lambda_1,\lambda_2,\lambda_3\}$) and only the first Eigen vector ($e_1$} corresponding to the first Eigen value ($\lambda_1$) are given. If we know that these Eigen vectors are perpendicular to each other (really, these would be the unit vectors after normalization in different coordinate), is it possible to reconstruct the $D$ (the original $3\times3$ matrix)?
I tried to apply the Least Square minimization method to estimate $D$ through $D . e_1 =\lambda_1 . e_1$, and again estimate $e_2$ and $e_3$ based on this estimated $D$ however this could not reconstruct a reliable matrix because it was not symmetric and $\dots$
In my problem $D$ is a tensor that represents a $3D$ ellipsoid whose Eigen values and only the longest Eigen vector (the main direction of the ellipsoid) are given. Now I need to reconstruct the original tensor matrix.
Thanks in advance (Khosrow)
Comment: I don't see a question.
Comment: I think you're saying you know $\lambda_1,\lambda_2,\lambda_3$, and $v_1$, and also know that $v_1,v_2,v_3$ are all orthogonal. Now you want to reconstruct $v_2,v_3$. It's impossible: you can pick $v_2$ to be any vector orthogonal to $v_1$ (and then choose $v_3$ orthogonal to both). Many of these will be different.
Comment: For instance, assume that $v_1$ is the first coordinate vector $e_1$. You could have a diagonal matrix, if $v_2=e_2$ and $v_3=e_3$. Or you could have a nondiagonal matrix, if $v_2=e_2+e_3$ and $v_3=-e_2+e_3$. There are many other possibilities.
Comment: Thanks Ian, Really I wanted to define the matrix A given Eigen values and the longest Eigen vector namely e1 where e1,e2 and e3 are my new coordinate while e2 and e3 are also other Eigen vectors relating to the matrix A (we are looking for) and their Eigen values ( which are known).  Thanks again...
Comment: If what you wanted, 221702, is not what's in your question, then I recommend editing your question so it asks what you actually wanted. Maybe then someone will be able to answer it.
Answer: Can't be done. Exercise: find two distinct symmetric $3\times3$ matrices, each of which has eigenvalues $1$, $2$, and $3$, with eigenvector $(1,0,0)$ corresponding to the eigenvalue $3$. One such matrix is $$\pmatrix{3&0&0\cr0&2&0\cr0&0&1\cr}$$ but it shouldn't be hard to find another; all you need is a $2\times2$ symmetric, nondiagonal matrix with eigenvalues $1$ and $2$.
Comment: Thanks a lot Gerry, but since we can compute the original matrix through equation $D=E.\Lambda.E^{-1}$, and also we know that the first Eigen vector is perpendicular to a surface (a circle maybe) including orthogonal vectors $e_2$ and $e_3$ the remaining things is that how we can find $e_2$ and $e_3$ ? is it also impossible? (Khosrow)
Comment: Well, why don't you do the exercise, and then see what the eigenvectors are?
Comment: Ok, but I am looking for a mathematical model not solving an example .. I have a set of unit vectors that each one would be the Eigen vector that we say is known (such as $e_1=[0.2161;  -0.0103; -0.9703]$) and the Eigen values are fixed that are   $\{\lambda_1=0.002 , \lambda_2=0.0003, \lambda_3=0.0003 \}$ always. I did the exercise but actually I did not understand how doing the exercise can solve my problem. I need a mathematical model...
Comment: The exercise was intended to show you that given $e_1$, $\lambda_1$, $\lambda_2$, and $\lambda_3$, there are infinitely many possibilities for $e_2$ and $e_3$ and the matrix $D$.
Comment: So, do you understand the situation now, 221702?
Comment: Are you still here?


How can I block incoming SMS from certain senders?

Question: What is a good app for blocking incoming SMS? I want it to be easy and able to add numbers from contacts and not require to many privileges (probably only some storage and intercepting SMS).
Answer: 'Call & SMS Filter'. I've not used it but description matches what you are after & very good comments.
I believe Handcent SMS also has block options.
Required privileges on both are greater than your preference though.
Answer: I found SMS Filter, that only intercepts messages and requires no privileges. It doesn't allow to add number from contacts though.


Can I claim unemployment benefits if I already have a new job lined up?

Question: Imagine that I live and work in Massachusetts. I am being laid off by the end of the year. I already have a new job but it won't start until a few months after the end of my current employment. I know that collecting unemployment benefits requires me to be "able, available, and actively seeking work" (see here). Does this mean that I am no longer eligible for unemployment insurance benefits?
Comment: Are you going to look for short-term work for the time in between?
Comment: @NateEldredge I hadn't planned on it, no
Answer: The MA page on eligibility for unemployment and the linked page on weekly benefits both say that one must be

Actively looking for work (3 work search attempts made on 3 separate days)

New Jersey, where I twice applied for and received unemployment benefits, has an almost exactly similar rule. I can tell you that in NJ, an applicant must be able to provide the names and addresses or telephone numbers (or other contact info, such as email addresses) of at least three potential employers who s/he approached in some way each and every week that s/he claim benefits, even after the applicant had already has a contingent offer of employment with a start date. If the applicant does not certify three attempts to look for work on the weekly application, no benefits are authorized that week. If the applicant does certify but cannot provide the names on request, that is considered a false application, and incurs a penalty, over and above denial of benefits.
An "approach" can include sending out a resume, answering an ad, going to a job fair, or telephoning a possible employer, or other methods of contact. It is a good idea to maintain a log of all your contacts, because if the state decides to review your case (which they can do for any of several reasons) they may ask you to provide your contacts for any or all of the weeks you claimed benefits.
Answer: Generally, most unemployment benefits programs require you to be actively seeking work. If you aren't planning on continuing your job search, then no, you would not be eligible. For MA it appears to be a two step process, applying for unemployment benefits and then requesting weekly payments. While you may be eligible to apply, you would then fail the weekly request because you did not seek employment. See the state's relevant website here.
Comment: Thanks. Can you please provide a source for your answer?
Comment: You can check MA's eligibility requirements on their website: https://www.mass.gov/service-details/check-eligibility-for-unemployment-benefits
Comment: Thanks. I would upvote your comment but don't have the reputation to do so.
Answer: Having a job lined up doesn't need to stop someone from looking for work in the interim. Although I doubt it's actually necessary, continuing to blast out applications in the in-between period should be enough to protect those benefits.
Comment: I don't know what's necessary for the letter of the law, but the spirit would suggest that you ought to send carefully prepared applications in good faith, to jobs for which you are qualified, attend interviews if you get them, and take a job if it's offered.
Comment: @NateEldredge "and take a job if it's offered" could be the sticking point if the person has already accepted another offer of employment.
Comment: Interesting -- my take would be that the spirit requires less. The benefits are meant to provide some income in the period between one job and the next, not to prevent every hour in the interim from going unworked. Assuming the applicant has found suitable permanent employment that begins within a reasonable amount of time, I'd be surprised if the administrators expected him to continue hunting for a different job to fill that gap.
Comment: Interesting debate. Presumably if you find and accept a job during your unemployment-insurance-sponsored job hunt that starts in 2 weeks you will still receive benefits for those 2 weeks as such a short time period can be considered normal "friction" that is included within the spirit of unemployment insurance. However, if you are consciously "holding out" for your dream job that starts several months later, then it's less clear that your community (in the form of unemployment insurance) should be on the hook for that.
Comment: @ bdb484 be surprised, they expect exactly that, and some of the officials seem to have the attitude that most applicants are probably cheats until proved otherwise. They wilt insist on compliance with the letter of the rules. , user21872 it is often possible to neither refuse nor accept a job offer ("I've got to consider that") for a short period.  You cannot count on an examiner caring about the 'spirit" or "purpose" of the program. Some will, many will not, speaking from experience.


What is the AeroVironment Helios' Kármán line?

Question: If it's true that the NASA/AeroVironment Helios maintained level flight 96,000 ft above sea level at a maximum airspeed of 23.5 kts (43.5 km/h) I assume it must have a very high Kármán altitude, the altitude at which it would have to fly at orbital velocity (15,100 kts) in order not to stall. By contrast the SR-71 Blackbird e.g. couldn't even fly at 23.5 kts near sea level. Is there a way to figure out the Helios' Kármán line, or any plane's for that matter? Known is only that of the X-2 which is 57 mi (91.7 km) according to Von Kármán's calculations himself. The X-2 flew  at 2,000 mph (3,200 km/h or 1,740 kts).
Comment: [Related](https://aviation.stackexchange.com/q/52416/62)
Comment: This shouldn't move to Space.SE because it's about aerodynamics: how thin must air be for Helios to need 15,100 knots to get enough lift to support itself;  then, how high that is.  This may be for a fictional Helios, though, because its solar panels might not give enough power, and its propellers might fall apart at that many RPM.
Comment: This ***really*** looks like a better fit for Space.SE, to my mind.
Comment: I've always felt that the principle of the Kármán line is somewhat flawed; at orbital velocity an object can maintain altitude without any aerodynamic life at all, so a little below this speed it would need to generate only a small amount of lift.  My understanding of the Kármán line principle is that this is the altitude at which an aircraft couldn't generate enough lift to support its *stationary* weight, which of course it wouldn't need to when moving at best-orbital speed.  In the case of Helios the situation is rather clearer cut, since the aircraft travels at a speed far below orbital.
Comment: Mach Limited Airframe.
Answer: There are no different Karman lines between the two aircraft. The Karman line starts at ~62 miles (327,362 ft) above MSL, an altitude neither aircraft can attain.  In addition the Aerovironment Helios had a wing loading of 0.69 lbf/ft^2 whereas the Blackbird's wing loading is 84 lbf/ft^2.  As such, I'm not surprised at all that a Blackbird cannot maintain level flight at 23 KIAS but a Helios can.
Comment: @Betternottell No, the line is not different for each aircraft. Check [the wiki](https://en.wikipedia.org/wiki/Kármán_line): "*The Kármán line (or von Karman line) is an attempt to define a boundary between Earth's atmosphere and outer space*". Further along in the article one can read that he used the X-2 to illustrate an example of division of lift & Kepler force. He did *not* state that the calculation was specific to the X-2 only, it is indeed a singular line for all aircraft.
Comment: @Betternottell Eh - no. As can be clearly distilled from any article on this topic.
Comment: @Betternottell, your last two comments appear to be diametrically opposed…
Comment: Do you have a reference for your claim that it depends on stall speed? Because I'm new to the term, but that doesn't mesh with common sense in context with the definition I have read. And there are people here whose answers I respect who disagree with you…
Comment: The 62 miles are actually a rounding of the FAI's 100 km (62.14 mi / 328,100 ft) line which they established as "the" Kármán line. In fact, the line is different for each aircraft and varies by other factors as well. Von Kármán himself determined 91.7 km (57 mi) for the X-2 as stated. These are theoretical values because it's clear no plane can fly horizontally at those altitudes, only the Space Shuttle and the Buran could during reentry.
Comment: @Betternottell The X-15 got to almost 315,000 ft.
Comment: @Koyovis No, it's dependent on the stall speed at altitude of each aircraft.
Comment: @Koyovis When they talk about the Kármán line they usually mean exactly 100 km (62.14 mi), the number established by the FAI.
Comment: You guys are all wrong here. You're confusing a predefined Karman line with Von Karman's  attempt to calculate a maximum theoretical altitude of an aircraft could fly at.  There are two totally different things, as the wiki article points out.
Comment: @MichaelHall In the 2nd comment I wrote about what the FAI refers to as "the" Kármán line. There is not a single Kármán line, for it depends on the stall speed of the plane in question. Von Kármán determined a 57 mi (92 km) value for the X-2 while the 100 km value has been made up by the FAI. They wanted a nice round number so they rounded, but in the wrong direction as they should have rounded to 90, not to 100 km. Or should have used nautical miles (50 nmi) which would be closest.
Answer: Pic from the wiki
The Helios is a slow moving aeroplane, while considerations regarding the Karman line are about very fast moving aeroplanes. From this link:

...the Karman line is determined by calculating at what elevation the Earth's atmosphere becomes too weak to support flight. At the Karman line, the atmosphere is too thin to support flight, and the plane must go fast to stay aloft. The Karman line is situated above the Homopause, and above this point, the atmospheric gasses are not well-mixed.

So the Karman line is the line of orbital velocity where very little to no lift force is contributed by aerodynamics. Orbital velocities are very high, and high speed is not something that the Helios is capable of, it can remain aloft by aerodynamic lift only. Discussions about Helios and Kármán line are incompatible.

The orbital velocity at any altitude of any aeroplane or circulating object is purely a function of its maximum speed. Considering a simplistic situation (homogenous spherical earth etc.) in the above pic, the centrifugal force F$_c$ must be  equal to gravitational force F$_g$:
$$F_c = \frac{m \cdot V^2}{r} = \frac{m \cdot V^2}{R + h}$$
$$F_g = m \cdot g_h = m \cdot g_0 \cdot \left( \frac{R}{R+h} \right)^2$$
With $R$ = earth radius, $h$ = altitude, $g_h$ = gravity at altitude
Equaling the two equations, and computing for several altitudes, results in:

There is no aeroplane that can fly that fast, not even the SR-71 or the X-2 which only reached about 1,000 m/s @ 24,000 m. They require aerodynamic lift!
So the Kármán line is not aeroplane dependent, it is the boundary where aerodynamic flight is not possible anymore by any aeroplane. From this site:

The Kármán line is based on physical reality in the sense that it roughly marks the altitude where traditional aircraft can no longer effectively fly. Anything traveling above the Kármán line needs a propulsion system that doesn't rely on lift generated by Earth's atmosphere — the air is simply too thin that high up. In other words, the Kármán line is where the physical laws governing a craft's ability to fly shift.
Comment: Did you think I thought the Helios or the SR-71 can enter an orbit? I wrote "would have to", not "has to". I'm asking on the altitude at which it _would have to_ reach orbital velocity, something the Helios isn't capable of.
Comment: @Betternottell Neither is the X-2. It was only used as an example to illustrate.
Comment: That's right, I'm doing the same here so don't claim I would think they can reach orbit.
Comment: @Koyovis it may be that Helios max altitude may have been limited by it Power available, as the wing may have been able to cruise a little higher while staying under Mach.  Hope they build another one.
Answer: The limitations of winged aircraft are far below the Karman line due to far lower air density and wastefulness of carrying the weight of a wing to those altitudes, in addition to practical sustained propulsion issues.

Lift = Density × Area × Lift coefficient × Velocity$^2$

Holding Area and Lift coefficient constant (to best Angle of Attack), a rough comparison of density to velocity$^2$ to generate Lift = Weight for various altitudes becomes possible.

Velocity$^2$ = k/Density

Since the IAS of Helios is known, let's plug in some density and velocity numbers, starting with sea level density.
Sea level:      23 knots$^2$ (TAS)    = 12574/23.77 (IAS = TAS)
10000 feet:     27 knots$^2$          = 12574/17.56
50000 feet:     59 knots$^2$          = 12574/3.64
150000 feet:   583 knots$^2$          = 12574/0.037
250000 feet:  4398 knots$^2$          = 12574/0.00065
Although it might be tempting to think at a very high altitude one might need only a little lift, the thought goes by the wayside when one realizes most of thrust in very high speed flight is involved with overcoming drag. At 4000+ knots, as the X-15 did, while still  in the atmosphere, a great amount of heat is produced, much like a meteor. Better to get above this and follow a suborbital ballistic path.
Amazingly, above most of the atmosphere, all objects will have a very similar Karman line altitude, because at those altitudes aerodynamic forces are very small, and speeds required to produce them approach orbital velocity (in theory). However, the exact point where "space" begins is debatable, as satellites in higher orbit still experience significant atmospheric drag$^1$.
To get anywheres close to the Karman line, the aircraft must overcome the sonic and thermal "barriers" if it hopes to survive for long.  Helios did neither, but did a fine job with a subsonic  True airspeed.
$^1$ see Karman reference under Alternatives to the FAI definition
Comment: What do you mean "above this"? If you're high enough / far enough from Earth air is too thin to cause heating. A suborbital ballistic path is any parabola whose perigee is within the Earth. Where do you have it from that the Helios' true airspeed is 400 kts; wouldn't Wikipedia mention that? You're above most of the atmosphere when you're above 18,000 ft (5.5 km) MSL btw but you actually mean mesosphere / lower thermosphere altitudes.
Comment: @Betternottell well, you're right, it need not be sub-orbital, it could be orbital, or going to Mars.  But the notion *aircraft* had any business doing this does not match the physics of lifting flight.  The Karman line is theoretical, extrapolated from a few (very dangerous) X-2 flights that didn't even come close in the 1950s.  At the altitude it did fly, it was barely controllable.  The X-15 *did* reach 100 km, but required rocket thrusters for control.  Helios TAS is easily derived using TAS calculator on the net.  Google it.
Comment: I know, but why do you think Wikipedia would mention IAS at record altitude only? If it mentions the maximum airspeed, then it would include sea level speeds probably, where IAS is the same as TAS. I mean the Helios ground-launched (near sea level), not mid-air.
Comment: @Betternottell it is somewhat dramatic to highlight its IAS, especially since NASA was into many wing mounted *solar electric* props (which greatly helped the *sustained propulsion* issue at those altitudes).  Really an amazing aircraft (yet another lost flown on a windy day!).


What is the densest known exoplanet?

Question: 55 Cancri e is said to be 60 percent larger in diameter than Earth but have 8 times, the mass, making it twice as dense as Earth, and almost as dense as lead.
https://www.space.com/11544-densest-alien-planet-55cancrie.html
According to those figures it would have 8 times the mass of Earth in 4.096 times the volume, or 1.953125 times Earth's density.  Since the density of Earth is 5.514 grams per cubic centimeter, 55 Cancri e should have a density of 10.769531 grams per cubic centimeter.  Lead has a density at room temperature of about 11.34 grams per cubic centimeter.
According to Wikipedia:

The mass of the exoplanet is about 8.63 Earth masses and its diameter is about twice that of the Earth,2 thus classifying it as the first super-Earth discovered around a main sequence star, predating Gliese 876 d by a year.

https://en.wikipedia.org/wiki/55_Cancri_e
With 8.396 Earth mass and twice the diameter of Earth 55 Cancri e would have 1.0495 times the density of Earth, or 5.7869 grams per cubic centimeter.

The radial velocity method used to detect 55 Cancri e obtains the minimum mass of 7.8 times that of Earth,2 or 48% of the mass of Neptune. The transit shows that its inclination is about 83.4 ± 1.7, so the real mass is close to the minimum. 55 Cancri e is also coplanar with b.

And the density is given as 6.66 grams per cubic centimeter, giving this as the source:
https://ui.adsabs.harvard.edu/abs/2018A%26A...619A...1B/abstract
Planet GJ 367 b is also considered to be very dense.

They found that the exoplanet has a radius about 72 per cent of Earth's and a mass just over half our planet's mass. With those measurements, they were able to predict its interior structure – it probably has an iron core that takes up about 86 per cent of its radius, similar to Mercury's strangely huge iron core.

https://www.newscientist.com/article/2299504-extremely-dense-planet-with-an-enormous-iron-core-has-an-8-hour-year/
According to those rough figures, the planet would have at least 0.5 of Earth's mass in about 0.373248 of Earth's volume, and thus about 1.33959 of Earth's density - 7.3865 grams per cubic centimeter. Iron has a density of 7.874 grams per cubic centimeter.
According to NASA, GJ 367 b has a mass of 0.546 Earths and a radius of 0.718 Earth, which would give it 0.3701462 the volume of Earth and a density of 1.475 Earth or about 8.13366 grams per cubic centimeter.
https://exoplanets.nasa.gov/exoplanet-catalog/8049/gj-367-b/
This report says:

GJ 367b has a radius of 0.718 ± 0.054 Earth-radii and a mass of 0.546 ± 0.078 Earth-masses, making it a sub-Earth planet. The corresponding bulk density is 8.106 ± 2.165 grams per cubic centimeter—close to that of iron.

https://www.science.org/doi/10.1126/science.aay3253
Wikipedia's list of exoplanet extremes lists the densest exoplanet as Kepler-131 c, with a highly uncertain density of 77.7 plus or minus 55 grams per cubic centimeter - between 22 and 132 grams per cubic centimeter.
https://en.wikipedia.org/wiki/List_of_exoplanet_extremes#Planetary_characteristics
It gives the source as:
https://arxiv.org/abs/1401.4195
On page 23 they discuss the two planets of Kepler-131:

Kepler identified two transiting planets with orbital
periods of 16.0 and 25.5 d and radii 2.4 and 0.8 R⊕

The RV measurements for Kepler-131 span 741 days
(Figure 30, top) and are listed, along with their
log R′
HK activity values in Table 18. The results consist
of an RV detection of the 16 d planet giving a mass of
16.1 ± 3.5 M⊕, and a density of 6.0 ± 2.0 g cm−3
. We
find a similar mass and density whether we fit this planet
by itself or with the second planet simultaneously. The
second planet shows up in the RVs only marginally. A
self-consistent fit of RVs and photometry yields a peak
of the posterior mass distribution at M = 8.25 ± 5.9
M⊕ and density of 78 ± 55 g cm−3
. The density is unphysically large, and hence the mass is too large, indeed
a detection at less than 2σ. We find an upper limit to
the mass of Kepler-131c from the 95th percentile of the
posterior mass distribution, yielding M < 20.0 M⊕ . Certainly the mass of Kepler-131c remains highly uncertain.
Table 2 lists all of the best-fit planet parameters.

Kepler-131 c should have a radius of about 0.8 Earth & thus a volume of about 0.512 Earth and so with a mass of 8.25 plus or minus 5.9 times the mass of Earth it should have a density between about 4.5898 and 27.6368 times Earth's density, 25.308 to 152.388 grams per cubic centimeter.
And since the calculated density of Kepler-131 c was so unbelievably large, I have to wonder if anyone has tried to measure its radius and/or mass again since 2014.
So what is the densest known exoplanet now in 2022, and are there any known  exoplanets which might possibly have higher densities?
Answer: Kepler-131c density is unphysically high.
A better candidate for most dense is kelt-1-b at  23.7±4.0 gcm−3
https://arxiv.org/abs/1808.04533

What is the densest known exoplanet?


How to say that numbers are not accurate

Question: Let's say there is a graph showing that the prices on coffee are going to grow with 5,00% anually. How can I specify that the growth might as well be 4,70% or 5,10%?
Comment: It would help to see a sample sentence. Do you mean something like "*The growth is ___ 5%*" or more like "*We ___ the growth numbers into integer percentages*"?
Answer:
Let's say there is a graph showing that the prices on coffee are going to grow with 5,00% anually. How can I specify that the growth might as well be 4,70% or 5,10%?

It would help to know how you reached your figure of 5%.
If this is an average or mean figure then you could state:

I expect the price of coffee to grow an average of 5% annually.

Or, if it isn't strictly a mathematical average, say for example it is a median figure (technically another kind of average, but perhaps not as widely understood) or you have estimated it based on some actual past growth figures, you could say:

I estimate that the price of coffee will grow 5% annually.

Another way of expressing this:

The price of coffee is expected to grow an estimated 5% annually.

Estimates are more likely to require some qualification; that is you might want to give some hint at how you reached that estimate so that people trust it. You could say:

Based on growth in previous years it is estimated that the price of coffee will continue to grow 5% annually.

Another useful word is approximation. This means a value is nearly but not exactly correct.
You might say:

The price of coffee is expected to grow approximately 5% annually.
Comment: Very minor criticism of a good answer. "Approximately" has more than one meaning. Informally, it does not preclude exactness. Saying that someone has an annual income of "approximately one hundred thousand" does not imply a certainty that the person does not have that exact income. It implies a lack of knowledge about the exact figure. And I like your points about estimates; wish I had mentioned them in my answer.
Comment: @JeffMorrow Interesting point, but by the same token an *estimate* can turn out to be correct. Saying something is an estimate, or an average does not mean it will not turn out to be the *actual* value. The word is used to describe how you *reached* that figure.
Comment: Astralbee I fully agree that an estimate may be exact. I did not mean to imply otherwise. My point is that the errors in many approximations may be exactly bounded 0 < |pi - 3.14| < 0.01. Estimates frequently are not so bounded. That is why your point that disclosure of the basis of estimatation is useful is such a good point.
Answer: There are several ways.
About 5%. Informal.
Around 5%. Informal.
Approximately 5%. Informal.
You must be careful with "approximate." It sometimes means "close to but not equal." For example, someone may say pi is approximately equal to 3.1416 to indicate, among other things, that pi is not exactly 3.1416.
Scientists and mathematicians have formal conventions about how to indicate the degree of accuracy in a reported number.


how can i add an additional action into woocommerce admin order page through my plugin?

Question: Currently I am building a plugin which I need to add an action button in order to print a pdf with admin order.
Answer: You can use this code to add an action on the admin order page:
<code>const CUSTOM_ACTION_CODE = "my-plugin__custom-action-code";

add_filter("woocommerce_order_actions", function ($actions) {

    $actions[CUSTOM_ACTION_CODE] = "label of the custom action";

    return $actions;

});

add_action("woocommerce_order_action_" . CUSTOM_ACTION_CODE, function (\WC_Order $order) {

    // here the code of the treatement of $order
    //...

});
</code>


should I code my data binary or take proportions?

Question: I am not very strong on statistics and I am having problem in deciding how to treat my data. I collected production data showing speakers a video and asking them to tell to another participant what they just watched. And I did this for Turkish and Dutch speakers. Each participant (20 per language group) produced several sentences but not equal amount of sentences. I look at subject arguments only (e.g. in a sentence like "the woman took a jar", 'the woman' is the subject argument). Now I want to know whether Dutch speakers are more likely to use pronouns e.g. 'he', 'she', 'they' but all these collapsed as one category, pronouns (my dependent variable) than Turkish speakers. Sometimes speakers used a pronoun, sometimes a noun e.g. the woman. But note that this was a free production data, and later on I grouped the utterances as noun and pronoun. What I want to know is whether I code the data in binary fashion (1 = presence of pronoun; 0 = absence of pronoun) or whether I take proportion of pronouns out of all subject arguments (= number of sentence) make a theoretical difference. I know the type of analysis I should use will differ according to the type of the dependent variable (proportion or binary), but I want to know whether one way of coding the data is better than the other. I should note that if I code the data in a binary fashion, I will have different number of data points across participants because each participant used different number of sentences and also different number of data points across the two language groups. If I go for the binary coding and perform binominal logistic regression, is it  a problem then that I have different number of data points per participant? If I take proportion of pronouns, I will have one data point per participant and 20 data points per language group.
Answer: Try examining each sentence individually, marking it as a $1$ if a pronoun is used, and $0$ if not.
Then if a subject speaks $3$ sentences, where he uses a pronoun in two of them, give him a score of $(1 + 1) / 3$. (Divide by the number of sentences spoken.)
You might also be interested in seeing if there is a statistical significance to the number of sentences spoken by each language user.
I will also say, however, that your first approach makes perfect sense.  If a subject uses a pronoun at all, give him a $1$, otherwise $0$.


Scrolling when idle?

Question: Can anyone point me to an example of code for a page that begins to automatically scroll when the user is idle for an amount of time? I think this is slightly beyond my skill set. I think JQuery or something similar might be appropriate but I just can't seem to figure it out. I'm designing a site for the nonprofit I work for and we don't have the money to hire a programmer. I wouldn't ask anyone to code anything for me, just to point me in the right direction. Thank you so much.
Julie K.
Answer: Here is something quick and dirty that will do what you want.  I currently have it set to 2 seconds idle time, but you can change that as you wish.
var now = new Date();
setInterval(function(){
    var nnow = new Date();
    if(nnow.getTime() - now.getTime() >= 2000)
        $('body').animate({scrollTop: '+=50'}, 2000, 'linear');
    }, 2000);
$(document)
    .mousemove(function(){ now = new Date(); $('body').stop(); })
    .keypress(function(){ now = new Date(); $('body').stop(); });

Edit: added .stop in mousemove and keypress events to stop scrolling immediately when user moves mouse or presses a key, rather than waiting for animation to complete.
Answer: jQuery would definitely help here.
You should handle the keyboard and mouse events to catch user activity.
Then, whenever you see activity, call setTimeout to make your code run 2 minutes after the activity.  Save the return value of the setTimeout call in a global variable, and call clearTimeout on it before setTimeout to clear the last timeout.
For example: (Using jQuery and the scrollTo plugin)
var timeout = false;
$(document.body).bind('keydown keyup mousemove mouseup', function() {
    if (timeout) clearTimeout(timeout);
    timeout = setTimeout(userIsIdle, 120000);    //120,000 milliseconds
});
function userIsIdle() {
    $(document.body).scrollTo('100%', 100000);
}

Comment: You should catch somehow the scrolling without mouse or keyboard. Otherwise readers with touch screens or voice control (Opera) are getting a hard time. ;)
Answer: you could use a plugin like this, and set it to use JavaScripts setTimeout() function to trigger it, which could reset every time you detect certain user actions, such as keyDown and Click.
Answer: First you have to define what you mean by IDLE, I will assume that the user is not moving mouse for x amount of time.
Here are the steps pseudo js.
 var lastTime=0;
var threshold=60000 ; // 1min
var howOftenToCheck = 1000;//1 sec
var inter = 0;
inter = setInterval(function() {
    var delta=lastTime-currentTime;
    if(delta>threashold){
        clearInterval(inter);
        window.scrollTo(xpos,ypos);
    }
}, howOftenToCheck);

This should give you a general idea.
Answer: I think onBlur event is what you're looking for, so you can do like this :

You can change the 0 to the vertical position where you want to scroll to.
Note: this will fire the scrolling when you go to other page or tab or where you can't see the page.
Answer: use the following jQuery functions to scroll the page's body
// Scrolling Down
$('body').animate({
scrollTop: '-=300px'
}, 2000);

// Scrolling Up
$('body').animate({
scrollTop: '+=300px'
}, 2000);

Scrolling when idle?


What happens when a GA pilot squawks 7500?

Question: If you were to put code 7500 into your transponder in a small general aviation aircraft, and you were in a rural area with no one around, and you did not have enough fuel to get to any city, what happens? Would they shoot you down? {edit what I meant was if you were being Hijacked and you on purpose sqacked 7500
Comment: Here is quite a "what-if" question. Are you asking about inadvertently squawking it or purposely squawking it? If you add more detail to your scenario or state why you are asking it, it may help people answer.
Comment: I know a guy who accidentally set squawk 7500 during a flight in a glider. He had turned down the radio, so no one could contact him. At some point, a helicopter was sent up to intercept him. Oblivious to the fact that he was squawking 7500, he just waved at the helicopter pilots as a greeting. After landing, I think he had a few missed phone calls to answer ... but he wasn't shot down!
Answer: Who would shoot you down and why? You are in the middle of nowhere. Who are you endangering? ATC would try to contact you to ascertain your actual condition. You may have accidentally put in the wrong code. They would then offer assistance if needed.
If it was a kidnapping situation, all they could do is follow or track you until you land. You are not going to get far. Even if you went to another country close by, you can still be tracked and local authorities alerted.
Answer: A distress code is not a 'shoot me down' signal.
ATC will see the code, and will try to establish contact. If the pilot wasn't with ATC already, they should be on the guard frequency at the very least.
For USA, the AIM (Distress and Urgency Procedures) provides the following:

If the pilot replies in the affirmative or does not reply, the controller will not ask further questions but will flight follow, respond to pilot requests and notify appropriate authorities.

Regarding the use of force, that is not the ATC's call or scope.

If it's an accidental 7500 (changing the code means the pilot is in touch with ATC, unless they're playing around), the AIM (Services Available to Pilots) provides information on how to avoid that:

When making routine code changes, pilots should avoid inadvertent selection of Codes 7500, 7600 or 7700 thereby causing momentary false alarms at automated ground facilities. For example, when switching from Code 2700 to Code 7200, switch first to 2200 then to 7200, NOT to 7700 and then 7200. This procedure applies to nondiscrete Code 7500 and all discrete codes in the 7600 and 7700 series (i.e., 7600-7677, 7700-7777) which will trigger special indicators in automated facilities. Only nondiscrete Code 7500 will be decoded as the hijack code.

Related: What prevents a passenger from hijacking a private jet?
And the Mountjoy Prison helicopter escape is the only incident I found where a light aircraft was hijacked.
Comment: There was an incident at KOJC several years ago where a bank robber took the bank employees hostage and attempted to hijack a small plane that was preparing to take off. I'm not sure if that was part of his plan or not but it didn't work and the police ended up shooting him. For some reason he had the hostages strip down to their underwear. Bizarre situation.
Answer: If you enter a 7500 code in a transponder, I'd expect the authorities would almost certainly intercept you with instructions as to where to proceed to and land.  They have no idea as to your particular situation other than you're transmitting an aircraft hijacking emergency code and they are not going to take chances.  As to using deadly force against you, it is an option, provided you are posing an immediate danger to the public or national security.  The most likely scenario is fighter interception followed by instructions as to where to go and land where ground based law enforcement can take control of the situation.