Do all offset printers print spot colours too?

Question: I was wondering if all offset printers print CMYK + Pantone ?Or just some models do print Pantine colours?
Thanks
Comment: If you're talking about the hardware--the machine that actually prints the ink--it doesn't care what color the ink is you put into it. If you're talking about the business or person that runs said hardware, that'd be up to them. I imagine *most* will print any color you want, but I don't think anyone can say 'all' with certainty.
Answer: The color
All offset printer can use chocolate mousse to pint if you feed it with that... well probably no, but it does not matter what is the color of the ink you feed.

Some Machines can print just one color at the time. That is one head printer. For aditional colors you need to clean the machine and feed the paper again.

Some machines can print 2 colors at the same time. Again if you need a color selection you print for example the cyan and the magenta, wash it, and then print yellow and black. If you are doing a letterhead for a known pizza brand, you use just red and blue.

If the machine can print 4 colors at the same time normally the company does not waste it in printing strange colors, and use it to print color selections, this is a CMYK print, so they do not need to wash it every job. Each head is used again and again with just 1 color. This is not becouse it can not print a spot color, it is for practicity and production times. But if they choose can use it to print 4 metalic colors, or fluorescent ones or whatever... Again it does not matter what you put it. If the cost-benefit is good, they will do that job for you.

There are 5 head printers. They can choose to use it to put perhaphs a varnish after printing the color selections or a spot color. If the varnish needs some modifications it will be only used it for that.

Some 6 head printers can do a CMYK + 2 spot color or 1 spot color and a varnish.

It is not used anymore but there was a 6 ink printing process called hexacrome by pantone, that used CMYK and a green and orange to have wider gamut. It is not used very offen now.
Size matters
So, all offset print machines can be feeded with cyan, magenta, etc. inks.
But not all machines can print a CMYK work.
If the machine is too small, for example it is only 1 head, and can only print a tabloid or A3 sized paper, it probably does not have the required mechanisms to assure a good registration and uniform ink ammount, so yes, you can change the plate and change the ink, but the quality of the print will be very bad. This kind of machines are used to print cheap 1-2 ink flyers where you do not need a good registration.
Comment: Yes you can print cmyk + 7 spot colors... if you want to pay 3 times more and you want to waste your money. But I think you need to ask a new question on the forum, becouse I feel that you are assumming things and you will have a lot of problems if you do not ask the specific case you have.
Comment: Hexachrome like printing is still here, its just not called hexachrome. Some like HP indigo digital presses from hp use this kind of tech so you could still do this kind of stuff
Comment: Most of the vendors I have used have a 6 color press. Usually, this means CMYK + 1 spot + 1 varnish. If someone requests more than 6 colors, they rerun the paper through the press again (or the two color press etc) is possible.
Comment: @joojaa Hexacrome was a trademark of pantone for this process CMYK+GO. Yes, there are a lot of digital printers that uses hexa-six-crome-colors, like cmyk + light cyan and light magenta, other can include grey ink. But you know how patents and trademarks work. Thoose are not hexacrome but hexa-crome :o)
Comment: @Yorik yeap you are right. I'm sure the varnish is way more requested than an aditional pantone.
Comment: So I can not send an artwork to printer with CMYK+ 7 spot colour? it should only be CMYK+ 1(or2) spot?
Answer: In fact, the issue you could face is that a lot of small printers only print in Pantones and not in CMYK because they have 1-2 color small presses.
In other words, their presses can only have 1-2 plates for each pass. In that case, they will do a good job in Pantone but really not in CMYK process because the CMYK separations might not be well aligned since they're not printed at the same time.
Usually a printer that prints in CMYK will print any Pantone as well, unless your are using an online printer or getting some economical process printing by having your project printed at the same time as other projects.
By default, you can assume that a printer who does CMYK printing can use at least 4 different Pantones for each pass. But you can get more if you need it; either the printer will do extra pass (eg. print again the sheets with the extra Pantones) or simply use a press that can use more plates!


REST API URL parameters not working with apache server

Question: The title pretty much says it all, if I try eg. /wp-json/wp/v2/posts?id=1, I get all the posts as response. URL parameters are not working as they should. According to the REST API Handbook, the server is not configured properly to detect URL parameters. There's a common solution given for nginx servers, but I use apache, so I have no idea how to solve this.
Answer: You're using the wrong endpoint. Look at the documentation. id is not one of the parameters for the posts endpoint.
The correct way to retrieve a post with the ID of 1 is:
/wp-json/wp/v2/posts/1


System-level, compiled, modern C/C++ replacement

Question: I would like recommendations for a modern programming language for system-level developing. By system-level I mean for developing a kernel from scratch, drivers, embedded firmware, boot-loaders, etc. I am only interested in new, modern languages that attempt to be a better C/C++. Must be a compiled language, and run on Linux and Windows. Thanks
Comment: I'm not sure what the best place is for this question. I understand how this might be off-topic here, but sites like Stack Overflow tend to discourage recommendation questions. In any case, the other major choice in this problem space besides Rust is [D](http://dlang.org/).
Answer:
The Rust Programming Language

Check out Rust. It has similar syntax to C++, and is meant to modernize the semantics in an attempt to improve speed and prevent software crashes. Not only that, there's a great tutorial on system-level coding!
As the official site tutorial describes it:

"Rust is a programming language with a focus on type safety, memory
  safety, concurrency and performance. It is intended for writing
  large-scale, high-performance software that is free from several
  classes of common errors. Rust has a sophisticated memory model that
  encourages efficient data structures and safe concurrency patterns,
  forbidding invalid memory accesses that would otherwise cause
  segmentation faults. It is statically typed and compiled ahead of
  time."

To get you started, here is a quick "30 minute" introduction.
And here is the link to the tutorial on booting into your RUST code.
Rust's Official Site
Note: system level design is NOT simple and I'd recommend getting a book and taking a course on it, after working yourself up to that level of skill. That said, messing with system level is a great way to learn, just don't be too disappointed if you find yourself hitting a wall based on knowledge - it is a great way to learn what you don't know! (Also, computer hardware devices are much less documented / standardized then one would expect.)
Comment: Can you actually program an OS with Rust?


Choosing balls from boxes

Question: Consider $3$ boxes,each containing $10$ balls,labelled $1,2,...10$. Suppose one ball is drawn from each of the boxes. Denote by $n_i$ ,the label of the ball drawn from the $i$-th box, $i=1,2,3$. Then the number of ways in which the balls can be chosen such that $n_1 < n_2 <n_3$ is?
Comment: $\sum_{i=3}^{10}\sum_{j=2}^{i-1}\sum_{k=1}^{j-1}1$. This summation is the answer and think about its meaning.
Answer: HINT: Say that a draw is good if $n_1<n_2<n_3$. Each good draw produces a subset $\{n_1,n_2,n_3\}$ of $\{1,2,\ldots,10\}$ with exactly $3$ members. Suppose that $T$ is any set of $3$ distinct members of $\{1,2,\ldots,10\}$.

How many good draws result in the subset $T$?
How many such subsets $T$ are there?
Answer: A neat way to do it is, consider all combinations which $n_1\neq n_2 \neq n_3$, this is easily counted by $10\times 9\times 8 =720$.
Now think of this, for all choices of $n_1\neq n_2 \neq n_3$, there is only one  ordering of these 3 numbers such that $n_1\le n_2 \le n_3$. There are $3\times 2\times 1 =6$ orderings for each choice of $n_1,n_2,n_3$, thus the required number of combination is $720 \div6=120$.
Comment: expanding on your approach I came up with the following solution,its a brute force method,I would love to hear your input.So I am trying to determine all possible triplets  Lets start with the first possible combination ,i.e (1,2, _)  Now _ can be filled in 8 ways,again the next combination (1,3, _) where _ can be filled in 7 ways ,so going on like this we get 8+7+6+...+1=36 ways for (1, _, _)  Now for (2, _, _) we get 7+6+...1=28 ways  Same way,we get 36+28+21+15+10+6+3+1=120 ways in total.  (the last case being (8,9,10).  So,is this correct?
Comment: Great, your direct counting is absolutely correct and most straight forward.

Choosing balls from boxes


In that scenario, how will the editor handle my academic paper (a revision)?

Question: I submitted a paper to the Elsevier journal and got positive feedback from the editor and two referees with only 8 comments. However, after I submitted the revision, one of the referees declined (or ignored) and another accepted the invitation to the second round but didn't upload any review report. So, how will the editor handle this paper???
Answer: What happens if, after revision ...

A reviewer declines to review the revision (or does not respond). The editor has several options. They can 1) check the revision themselves, might not be possible if they lack the subject expertise; 2) invite another reviewer; 3) make a decision anyway.

Accepts the review invitation but then goes incommunicado. Same as previous, with an extra option 4: wait.
Comment: Thank you for your kind answers. The editorial board has withdrawn the review invitation and hasn't sent extra invitations. Perhaps, they might check the revision themselves.


For an inequality, how do you get the inverse?

Question: for the inequality$$x+4 > 2$$
if you take the inverse you get$$\frac{1}{x+4} < \frac 12$$
The sign switches when you multiply or divide by a negative.
My question is, what are you multiplying or dividing the expressions by?
All I can see is e.g. $$2 \times \frac 14 = \frac 12$$
but 1/4 is positive, so the sign shouldn't switch yet it does, leading me to think something else is going on.
Thanks
Comment: Divide both sides by $2(x+4)$ which we know to be positive.
Comment: Hint: It takes *two* steps to get from $a>b$ to $\frac{1}{a} < \frac{1}{b}$.
Comment: Does this answer your question? [If you take the reciprocal in an inequality, would it change the $>/< $ signs?](https://math.stackexchange.com/questions/1849081/if-you-take-the-reciprocal-in-an-inequality-would-it-change-the-signs)
Comment: No, I read that thread before asking this question.
Comment: @Joe That's a wonderful way of viewing it.
Answer: As mentioned in the comments, it effectively takes two steps (or the nice combo-deal shown by @lulu):
$$x+4 > 2 \implies 1 > \frac{2}{x+4} \;\text{ (this is OK because we know $x+4 > 0)$}$$
$$\implies \frac12 > \frac{1}{x+4}\;\square$$
So the sign didn't move at all and no negatives were involved :)
Comment: I'd like to point out that the implication above is really only an implication. For $x <-4$, the left hand side has no solutions, while all $x < -4$ are solutions of the right hand side. So if you want to solve an inequality, you will very often need to make case distinctions, as user2661923 did below. The core of the problem is that multiplying by something that is not $0$ is equivalent only for equations, but needs to be $> 0$ for inequalities.
Comment: where does the denominator 1 + x come from?
Comment: @Rolomoto -- nowhere -- it was a typo -- fixed :)
Comment: @Ingix -- correct -- I kept this very straightforward here and took advantage of the positivity of the LHS, hence my use of $\implies$ and not $\iff$
Comment: @Ingix What are you referring to when you say for <−4, the left hand side has no solutions? $x + 4 > 2$?
Comment: I was talking about the left and right side of the implication, not any inequality. $x+2 > 4$ has not solution in the interval $(-\infty,-4)$ (written more easily as $x<4$), while for the right hand side $1 > 2/(x+4)$ **all** values in that interval are solutions. The **implication** is still correct, but it is far from an equivalence.
Answer: Alternative approach:
Let $y = x+4.$
Then $~y > 2 \iff ~$ both of the following are true:

$\displaystyle y > 0 \implies \frac{1}{y} > 0$
$\displaystyle\frac{1}{y} < \frac{1}{2}.$
This follows, since
$\displaystyle ~y \times \frac{1}{y} = 2 \times \frac{1}{2}.$
Therefore, if $~\dfrac{1}{y}~$ was $~\geq \dfrac{1}{2},~$ then (since $y > 2$), you would have that
$~y \times \dfrac{1}{y}~$ would be greater than  $~2 \times \dfrac{1}{2},~$ thus generating a contradiction.

Therefore,
$$x + 4 > 2 \implies 0 < \frac{1}{x+4} < \frac{1}{2}.$$
Comment: @Rolomoto That portion of my answer was designed to prove that if $y > 2$ then $0 < (1/y) < (1/2).$  I used the concept that if $p > s$ and $q \geq t$, with $p,q,s,t$ all positive then $pq > st$.  This was a proof by contradiction.  In other words, with $p,q,s,t$ all positive, if $p > s$ and $pq$ **equals** $st$, then you **must have** that $q < t.$
Comment: I don't get the part: y(1/y)= 2(1/2). I mean if y<2 you could still use the same formula and get the same result, 1=1.


Planet where fungi exist but plants don't

Question: Could a planet, with life, exist without plants, but instead with fungi? How large could these fungi get? What would all of the conditions involved be?
Comment: Possible duplicate of https://worldbuilding.stackexchange.com/questions/59033/is-a-food-chain-without-plants-plausible
Answer: Fungi, like animals, are heterotrophs, which means that they need to consume another organism in order to obtain their energy and nutrients.
Autotrophs, such as plants, are organisms that can utilize energy from a primary energy source and process nutrients in the environment in their raw form. They are the basis of a food chain and nothing can exist without them. If there are no plants then there needs to be some other type of autotrophic organism for the fungi to feed on.
My understanding is that we only know of two autotrophic mechanisms: photosynthesis which uses light and chemosynthesis which uses chemicals. So the pickings are slim unless your world has naturally occurring methane oceans and oxygen or some vast deposits of some other chemicals that can be reacted to release energy (which would probably count as chemosynthesis). The first examples of chemosynthesis we discovered earth react hydrogen with sulphur that comes out of geothermal vents.
I think most examples of chemosynthesis that we have found are closely tied to geothermal energy, but my understanding is that these organisms use the chemicals from the geothermal vents rather than the heat from the vent itself. Theoretically, I suppose an organism could evolve to directly use the heat differential from the geothermal energy and I guess these would be thermotrophs. I guess it is also theoretically possible that an organism could use the radiation produced from the decay of naturally occurring deposits of radioactive materials which would classify them as radiotrophs. But if they use the heat from the decay rather than the radiation itself then these would be thermotrophs.
EDIT:
One thing that I think is theoretically plausible that the answer in DWKraus's link mentioned is electricity. I suppose if you had very large rocky deposits of the right material bridged by an ocean of the right composition it could form a giant battery with ions and electrons moving in the currents.
Reading the answer that DWKraus pointed to also made me think of an potential issue related to size which seems to be what you are interested in: Organisms start evolving small so if the energy gradient is spread over a wide area, the tiny originator organism cannot span enough of the gradient to obtain enough energy to survive unless the gradient is very intense. You would almost need an organism to evolve using an energy source effective over small gradients until it got larger and then evolve into a different energy source that was only effective over large gradients.
Comment: We've had a few questions with organisms harvesting energy from wind and other stuff, too. https://worldbuilding.stackexchange.com/questions/46564/how-could-non-photosynthetic-non-chemotrophic-autotrophs-create-usable-energy/51247#51247
Comment: @DWKraus Wind is interesting. I guess you can throw in stuff like gravity tides as well but I guess a problem with these (as well as thermotrophs) is that the energy gradient is spread over a large and organisms start evolving small so unless the gradient is very intense, the organism is not large enough to span enough of the gradient to exploit the differential. Electricity is also interesting if you had solid deposits bridged by liquid oceans that formed just right to form a massive battery.
Comment: Piezoelectric would be practical; I've seen other answers that talked about it. Here is what I personally have looked at https://atelierdna.com/portfolio/windstalk/ of course, this is artificial.
Answer: Could a planet, with life, exist without plants, but instead with fungi?
As long as you have some replacement for the autotrophic functions of plants, sure. Fungi can easily perform the structural functions of plants in building biomes.
How large could these fungi get?
As big as plants get. So, pretty much as large as you want.
What would all of the conditions involved be?
Since fungi don't perform photosynthesis, you would have to rely on bacteria / algae analogues for that, to provide the foundation to the food web. If you posit a scenario like early Earth, but in which vascular plants merely happen not to evolve, algae and bacteria will face the same kinds of competitive pressures to shade each other out for access to more light. And since they can't grow tall structures themselves, they will have to hitchhike on tall-growing fungi. Turns out, there are already extremely common examples of symbiotic relationships between fungi and bacteria and algae on earth: lichens. Earth lichens are small and slow growing, but without competition from vascular plants, they could easily fulfill all the same functions.
On Earth, plants rely on symbiosis with fungi anyway, with the plants providing the above-ground structure and feeding sugars to soil fungi, while the soil fungi extract mineral nutrients to provide to the plant. Your planet will simply shift the structural balance, with the fungal component forming the bulk of the structure and hosting photosynthetic symbiotes in its stems and leaves, rather than hosting nutrient-extraction symbiotes in its root systems.

Planet where fungi exist but plants don’t


How to determine the Average and Worst Case Space Complexity of Bucket Sort

Question: Can someone tell how the average and worst case SPACE complexity of Bucket sort is found?
Comment: Possible duplicate of [What is the worst case complexity for bucket sort?](https://stackoverflow.com/questions/9792132/what-is-the-worst-case-complexity-for-bucket-sort)
Comment: [first google result of "bucket sort"](https://en.wikipedia.org/wiki/Bucket_sort#Worst-case_analysis)
Comment: They talk about time complexity and not space complexity.
Comment: Space and time complexity are calculated the same way; you're merely using a different resource.
Comment: Possible duplicate of [Big O, how do you calculate/approximate it?](https://stackoverflow.com/questions/3255/big-o-how-do-you-calculate-approximate-it)
Answer: Well first off we need to understand how bucket sort works:

Create an empty array
Loop through the original array and put each object in a bucket
Sort each of the non-empty buckets
Check the buckets in order and then put all objects back into the original array.

This makes bucket sort a great algorithm for big lists that need to be sorted. The average time complexity is O(n+k) where n is the number of your buckets. The worst time complexity is Θ(n^2). The reason for that is because bucket sort is useful when input is uniformly distributed over a range since whenever there are keys that are close to each other they are probably going to end up in the same bucket otherwise we would need a bucket for each key in the original array.
The worst case space complexity is O(nk).
Space complexity is a measure of the amount of working storage an algorithm needs. That means how much memory, in the worst case, is needed at any point in the algorithm. As with time complexity, we're mostly concerned with how the space needs grow, in big-Oh terms, as the size N of the input problem grows.
I hope that helped!


Aruch HaShulchan on not saying certain phrases in hallel when davening alone

Question: The Aruch HaShulchan 422:9 says someone davening alone should not say "ki l'olam chasdo" after "yomar na yisrael."  Then he seems to say the same, that one shouldn't say "ki l'olam chasdo" after the other phrases in that section.  Is he saying that a yachid would still say the phrases before the phrase "ki l'olam chasdo"?  But in that case it wouldn't really make sense, because he is just saying that these people are saying "blank" and not saying what they are saying.  Can someone who reads Hebrew please read Aruch HaShulchan 422:9 and tell me exactly what he says?   https://www.sefaria.org/Arukh_HaShulchan%2C_Orach_Chaim.422.9?lang=bi&with=all&lang2=en
Comment: Actually forget what I wrote.  I think he is actually just saying the yachid doesn't say "hodu laShem ki tov."  But he would say "ki l'olam chasdo" after each phrase.
Comment: But would a yachid according to the Aruch HaShulchan still say "hodu laShem ki tov ki l'olam chasdo" at the beginning of that section, since that is the first posuk in that section?
Comment: He's saying not to say the responses. Like how when you say Kiddush for yourself you don't say amen.
Comment: @DoubleAA are the responses "hodu lashem ki tov ki l'olam chasdo"?  And would you still say that phrase as the first verse in that series of verses, but you just wouldn't repeat it?  And if this is what he is saying, why does he mention "hodu lashem ki tov ki l'olam chasdo" last, when it is the first in order?
Comment: The customary way in European based communities to say Hallel publicly is for the leader to recite each of the first four verses of psalm 118 aloud for the congregation, and for the congregants to recite הודו לה' כי טוב כי לעולם חסדו as a response to each. Without a leader to say the main text on your behalf, you say it yourself and skip the responses, just as you would with Kiddush alone.
Answer:
דבר פשוט הוא שכשאומר הלל ביחיד לא יאמר בהודו אחר יאמר נא ישראל ויאמרו נא בית אהרן ויאמרו נא יראי ד' הודו לד' כי טוב דזה אינו אלא בציבור או לפחות כשהם שלושה דאחד אומר יאמר נא והשנים משיבים ולא כשהוא יחידי ואפילו שנים אינם כלום אלא אם כן הם שלושה שאחד אומר והשנים משיבים
It is an obvious matter that when one says Hallel alone he should not say in "הודו" after "יאמר נא ישראל" and "יאמרו נא בית אהרן" and "'יאמרו נא יראי ד" [the refrain of] "הודו לד' כי טוב", because that is only with a congregation, or at least when there are three [people], for [then] one would say "יאמר נא" and the [other] two would respond. But not when he is alone, and even two [people] do not count, unless there are three [people] where one says and two respond.

In other words, when praying with a congregation, the leader would recite the line "יאמר נא ישראל" and the congregation would respond to that with "הודו לד' כי טוב". The Aruch Hashulchan is saying that this only works when there is a congregation (or at least three people) such that one person can say the main line and the rest can respond with the "הודו" line. But if you're praying by yourself you don't respond to yourself, so you would just say "יאמר נא ישראל" and then go on to "יאמרו נא בית אהרן" without saying "הודו" in between.
Comment: Would a yachid still say the first line, which is "hodu lashem ki tov ki l'olam chasdo"?
Comment: @talk he says all the lines but none of the responses.


insert into a MySQL database on a different server

Question: Using PHP and MySQL in a script run on mysite1.com I'm trying to copy all rows and columns from a table on mysite2.com into an identical table (that has already been created) on mysite1.com. First I connect to both the databases (I've already set up remote MySQL connections on mysite2.com).
$con1 = mysql_connect("mysite1.com", "username1", "password1");
if (!$con1) {die('Could not connect: ' . mysql_error());}
mysql_select_db("database1", $con1);

$con2 = mysql_connect("mysite2.com", "username2", "password2");
if (!$con2) {die('Could not connect: ' . mysql_error());}
mysql_select_db("database2", $con2);

I can't figure out how to format the "INSERT INTO" sql string so it will get the data from mysite2.com and put it in mysite1.com. Does anyone know how to do this?
INSERT INTO my_table1 SELECT * FROM my_table2

Comment: Just export the data to an sql file, and then import into the server.
Answer: Can't be done the way you're thinking.  You could set up a federated table and copy from that.  Probably simpler just to use mysqldump and then load the file it creates though.
Third option is to read the data through php and generate INSERT statements, but that'l be the slowest of the three options.
Answer: $con1 = mysql_connect("mysite1.com", "username1", "password1");
if (!$con1) {die('Could not connect: ' . mysql_error());}
mysql_select_db("database1", $con1);

$result = mysql_query('SELECT * FROM `some_table`', $con1);
$query = array();
while ($row = mysql_fetch_array($result, MYSQL_NUM)) {
    $query[] = '('.implode(',', $row).')';
}

$con2 = mysql_connect("mysite2.com", "username2", "password2");
if (!$con2) {die('Could not connect: ' . mysql_error());}
mysql_select_db("database2", $con2);

mysql_query('INSERT INTO `some_table` VALUES '.implode(',', $query).';', $con2);

Answer: MySQL makes a migration assistant tool that will do this.  This functionality might be folded into the Workbench now.
You might also consider doing the following:
from mysql1 connect to mysql1:
SELECT * FROM table INTO OUTFILE filename
from mysql1 connect to mysql2:
LOAD DATA LOCAL INFILE filename INTO TABLE table
This will be pretty fast, but it won't be a perfect copy if you're doing inserts into mysql1 while this is going on.
If you need these to stay synchronized, replication is definitely the answer.
Answer: A mysql connection handle can't be shared between different servers. It's specifically tied to the server you opened it on, and that's where it'll stay.
There's a couple options. bemace mentioned federated tables. There's also replication.
Of the two, replication is probably the easiest to maintain, though it is somewhat of a pain to get up and running. Once it's up, it'll handle all the updates to the replicated tables/databases transparently, and you don't have to worry about it.
With federated tables, you have to run your queries at least twice. One for the "local" table, and one for each "remote" table. And you'll run into problems with transactions: they're not supported at all on federated tables.
Answer: You could use a 3rd party database synchronizer such as http://www.quest.com/toad-for-mysql/ (free)
Comment: Quick note on this: not free anymore. A free trial is available though.
Comment: @H2ONOCK Hmm, yea Dell bought out Quest. I think it is still freeware, but you might have to sign up to get it.
Answer: Try this:
// origin
$dblink1=mysql_connect('mysite1.com', 'user1', 'password1');
mysql_select_db('db1', $dblink1);

// destination
$dblink2=mysql_connect('mysite2.com', 'user2', 'password2');
mysql_select_db('db2',$dblink2);

$res_from = mysql_query("show tables", $dblink1);
if($res_from === FALSE) {
    die(mysql_error()); // for error handling
}

while($table = mysql_fetch_array($res_from)) {
echo($table[0] . "
"); // optional, only for show the name tables

$table=$table[0];

$tableinfo = mysql_fetch_array(mysql_query("SHOW CREATE TABLE $table  ",$dblink1)); // retrieve table structure from mysite1.com

mysql_query(" $tableinfo[1] ",$dblink2); // use found structure to make table on mysite2.com

$res_to = mysql_query("SELECT * FROM $table  ",$dblink1); // select all content from table mysite1.com
while ($row = mysql_fetch_array($res_to, MYSQL_ASSOC) ) {
    $sql_error = "";
    mysql_query("INSERT INTO $table (".implode(", ",array_keys($row)).") VALUES ('".implode("', '",array_values($row))."')",$dblink2); // insert one row into new table on mysite2.com`enter code here`
    $sql_error = mysql_error($dblink2);
}
if ($sql_error) {
    echo $sql_error;
}else {
    echo "copy table ".$table." done.
";
}
    flush();
}

mysql_close($dblink1);
mysql_close($dblink2);

IMPORTANT! make sure you have a user with all privileges in the mysql of mysite1.com
In any case, you can make one so:
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword'; GRANT ALL ON *.* to myuser;


Does Bhagavad Gita say anything about whether a person should eat Vegetarian or Non Vegetarian food?

Question: Does any shloka of Gita say anything about what a person should eat. I am mainly concerned with whether it say anything about Vegetarian or Non Vegetarian diet.
Comment: @UdayKrishna Please have a look at Chapter 15 Shloka 8 I think it says that at the time of death the consciousness created by living being carries him to the next body. So does it imply that if a person eats non veg he is bound to take form of the animal he is eating. I am reading Srimad Bhagvad Gita for first time. Please forgive my ignorance
Comment: @UdayKrishna I just quoted what was written in "Bhagvad Gita as it is " by Mr A C  Bhaktivedanta Swami Prabhpada. I usually read from this book. I would be grateful if you can suggest me some books. I have original Bhagavad Gita but that is too hard to read as I do not know sanskrit. I am looking for some good translations which are unbiased and leave reader to have his own conclusions. Thanks a lot
Comment: @StammeringMathematician Another version I just found yesterday is highly searchable: https://bhagavadgita.io/ I haven't read through it entirely, but it seems very good so far. Of course, self-translation will become the most helpful in future.
Comment: @StammeringMathematician I use the Winthrop Sargeant version which is wonderful for beginners. As you start to understand key Sanskrit terms, though, there will be better translations which keep those terms in tact. This is useful because they can have different meanings depending on the context. But, often we are meant to see the multiple meanings or plays on words. I'll quote my version, then give my understanding of it below. "BG 15.8. When the Lord acquires a body, and also when He departs from it, He goes, taking them along, like the wind blowing perfumes from their source."
Comment: So, when a baby is born, Brahman inhabits that person as their ātmán (True Self). When they die, Brahman, as their ātmán, departs the body. The shloka explains that this is not by our action, but by His. I don't think it has anything to do with the things we eat. Unless it is still alive, the ātmán is gone.
Comment: Its linked to guna. Vegetarian food is Satvic keeping body light and able to do Spiritual practices while Non veg is Tamsic causing person to sleep and feel sluggish. Nothing other than that
Comment: There are lots of detailed explanations (bhashya) of Geeta like guru geeta. They explain these things like what/how to eat? How to sit? when to wake up and sleep etc.
Comment: The BG says something about food but no reference is made to tamas, rajas or sattva food. People make that reference but it is not clear from the BG. From other scriptures like the manus smrito it is a sin to eat meat and fish.
Answer: Here's the most specific dietary "guidelines" I could find in Śrīmad Bhagavad Gītā,

BG 17.8: Those foods which promote longevity, strength, health, happiness, and satisfaction;
Which are juicy, oleaginous, nourishing, and pleasing to the stomach, are dear to those flourishing in sāttva (bright righteousness).
BG 17.9 Those foods which are bitter, sour, salty, very hot, pungent, dry, and overly-piquant;
Which produce pain, grief, and sickness, are dear to those caught in rajas (passion).
BG 17.10 Those foods which are stale, bland, putrid, and toxic;
Which is ort or unfit for sacrifice, are dear do those drowning in tamas (dark destruction).

So, we can dissect this to get a little more clarity on specific foods.

tamas foods: Foods unfit for sacrifice include donkeys and camels as well as anything which is expiring. Ort are the scraps left over from preparing the meal: the chopped-off ends of vegetables, certain peels & skins, etc. Toxic foods are anything that harm the body. As for stale and bland foods, I believe this includes many meats because we don't like to eat them without first spicing them up.
rajas foods: I think these are pretty clear. You can tell if something is too bitter, too sour, too salty, too hot in temperature, too pungent, dry-tasting, or too piquant ("spicy" like chilies). If you end up on the toilet after a meal, something was rajas. Personally, I consider pork to be rajas because, if I eat it after a prolonged absence from eating it, I feel very nauseated.
sāttva foods: Juicy foods include most fresh fruits and many fresh vegetables. Oleaginous foods are often pressed for their oils. This includes most nuts & seeds as well as some other things like olives.

Of course this is no definitive list, but it's hard to be very precise without delving into interpretation. Other than the above, the only other mention of foods in the Bhagavad Gītā is in reference to ceremonial sacrifice or the below quotes.

BG 6.16: Yoga is not eating too much, nor is it not eating at all;
neither is it sleeping too much, nor not sleeping enough, Arjuna.
BG 3.13: The saintly, who eat what remains of the sacrifice, are released from erring;
but the erring, who cook only for their own sake, consume their own impurity.
BG 9.27: Whatever you do, whatever you eat, whatever you sacrifice, whatever you gift to others;
and whatever austerities you undertake, Son of Kunti, all that you offer to Me.

So, keeping in mind BG 17.8~10, I think you can discover for yourself which things are fit for eating, and which aren't. Just don't forget BG 9.27 & 3.13; when you eat, remind yourself that it is a sacrifice to God within you. And also per BG 6.16, eat in moderation.
Comment: Also, when in doubt, it is safer to not eat something questionable than to eat it, isn't it? So, while vegetarianism or veganism may not be proscribed, such diets aren't going to increase your māyā or sense of suffering.
Comment: Religious wisdom is distilled pratical wisdom by seers looking far into the past and future. Since you are interested in history the iron sword inventing Hittite (Suppilliliuma etc )civilisation which overpowered Babylon( Nabu- kudiri-usur etc) bronze age, itself was possibly destroyed by an infection from infected animal.  Maybe that caused the late bronze age collapse.  Also the Assyrian attack on the first temple of Jerusalem, was destroyed by dead infected animal projectiles by catapult.
Answer: As per Bhagavad-gītā, food is of three kinds: Sattvic, Rajasic and Tamasic. This classification is defined in 17.7 to 17.10.

आयुःसत्त्वबलारोग्यसुखप्रीतिविवर्धनाः।
रस्याः स्निग्धाः स्थिरा हृद्या आहाराः सात्त्विकप्रियाः।।17.8।।
कट्वम्ललवणात्युष्णतीक्ष्णरूक्षविदाहिनः।
आहारा राजसस्येष्टा दुःखशोकामयप्रदाः।।17.9।।
यातयामं गतरसं पूति पर्युषितं च यत्।
उच्छिष्टमपि चामेध्यं भोजनं तामसप्रियम्।।17.10।।
17.8 Foods that augment life, firmless of mind, strength, health, happiness and delight, and which are succulent(juicy), oleaginous, substantial and agreeable, are dear to one endowed with sattva.
17.9 Foods that are bitter, sour, salty, very hot, pungent, dry and burning, and which production pain, sorrow and disease, are dear to
  one having rajas.
17.10 Food which is not properly cooked, lacking in essence, putrid(emitting a bad smell) and stale, and even ort and that which is unfit for sacrifice, is dear
  to one possessed of tamas.
~ English Translation By Swami Gambirananda

As per the properties defined in above verses, Non Vegetarian food falls under Tamasic category. And by this narration, it's clear that the food people eat influences their guna (nature) and vice versa. So, it is advised to eat sāttvic food (as much as possible) as other food causes rajo or tamo guna.

Related
What are Tamasic, Rajasic and Sattvic foods?
Is consuming non vegetarian food allowed in case of survival?
Comment: "As per the properties defined in above verses, Non Vegetarian food falls under Tamasic category." I think that's going a step too far. Many meats fall into that category, but not all. What about deer & antelope, for example. They are not bland, are fit for sacrifice, and furthermore, were eaten by the heroes of our epics.
Comment: @RubelliteYakṣī IMHO, still they are not Sattvic food..leave about meats, many vegetarian foods such as garlic and onion are also not considered Sattvic...
Comment: Okay. I understood your claim. But, what is its basis?
Answer: The only occasion where Lord Krishna gives specific and explicit food recommendation is Bhagavad-gita 9.26:

If one offers Me with love and devotion a leaf, a flower, a fruit or water, I will accept it.

Those are, obviously, vegetarian foodstuff because Lord Krishna does not accept non-veg food.
Those who aspire to become devoted souls surrendered and dedicated to Lord Krishna will offer him only that kind of food which is recommended to his devotees (his bhaktas) to offer him. As far as I know Hindu scripture recommends bhaktas of Lord Krishna/Vishnu to offer him only vegetarian food. There is no recommendation to offer him meat, eggs and fish. If we browse scriptures for examples of food which is accepted by Lord Krishna from his devotees (bhaktas) we can find only examples of veg food such as those in the Bhagavad-gita verse I mentioned, or such as those like we read in the Bhagavatam 10.13.11:

Kṛṣṇa is yajña-bhuk — that is, He eats only offerings of yajña — but to exhibit His childhood pastimes, He now sat with His flute tucked between His waist and His tight cloth on His right side and with His horn bugle and cow-driving stick on His left. Holding in His hand a very nice preparation of yogurt and rice, with pieces of suitable fruit between His fingers, He sat like the whorl of a lotus flower, looking forward toward all His friends, personally joking with them and creating jubilant laughter among them as He ate. At that time, the denizens of heaven were watching, struck with wonder at how the Personality of Godhead, who eats only in yajña, was now eating with His friends in the forest.

To my knowledge there is no mention anywhere in Hindu scripture that Lord Krishna is offered roast chicken, pork, bacon, fish and eggs, or similar like non-veg food.
Comment: @Uday Yeah, thanks for that, the translation for that Bhagavatam verse 10.81.4  is available at https://www.vedabase.com/en/sb/10/81 In Hindu scripture we don't find recommendation of a non-veg food to offer to Lord Krishna or Vishnu.
Comment: Krishna never said I don't accept non-veg from my devotees. He never gave forbidden list of food that we can't offer to him. So, IMHO Krishna will accept anything that being offer with love.
Answer: bhagavad gItA indirectly points to vegetarianism:
In BG 6.46, kruShNa advices arjuna to become a yogI:

tapasvibhyo 'dhiko yogī jñānibhyo 'pi mato 'dhikaḥ karmibhyaśh chādhiko yogī tasmād yogī bhavārjuna
A yogi is superior to the tapasvī (ascetic), superior to the jñānī (a person of learning), and even superior to the karmī (ritualistic
performer). Therefore, O Arjun, strive to be a yogI.

Now all throughout shAntI parva and anushAsana parva, only vegetarian items are mentioned as diet of yogI, eg: in shAnti parva SECTION CCXV, bhIShma in presence of kruShNa describes yogI's food:

Indeed, one engaged in the practice of yogA rules should do all those acts by which one's conduct and disposition may become pure. one
should rather live upon broken grains of corn, ripe beans, dry cakes
of seeds from which the oil has been pressed out, pot-herbs, half-ripe
barley, flour of fried pulses, fruits, and roots
Comment: Very helpful, thx !
Answer: Simple logic, Lord rama and krishna are non vegetarians by themselves. So non  veg is allowed to eat. But certain animals meat is not good for health so v have to avoid it.
Comment: ON WHAT BASIS DO YOU CALL RAMA AND KRISHNA NON-VEGETARIANS?
Comment: Anyone who reads valmiki ramayanam can understand that Rama is non vegetarian ..there are slokas expaling where Sita processing meat for food...and non veg is prohibited for Brahmins as they have to chnat mantras and their tounge becomes thick if they eat nonveg...
Comment: These are only misunderstood meaning for the Sanskrit words Check duplicate questions on the topic.


Books on cosmology

Question: I have finished Carroll's general relativity book, Spacetime and Geometry. I am specifically interested in cosmology, so is there any book which goes more in depth into cosmology? I prefer a mathematically rigorous book, which goes beyond the cosmology chapter in Carroll's book. The Big Bang and inflation theory should be dealt with in depth.
Comment: GR book recommendations: http://physics.stackexchange.com/q/363/2451 , http://physics.stackexchange.com/q/15002/2451 and links therein.
Comment: If you're interested in the big bang and inflation, I would recommend Gorbunov and Rubakov's Introduction to the Theory of the Early Universe (two volumes).
Comment: Sad that this didn't get any proper answer. For those interested, Ryden's *Introduction to Cosmology* contains an Annotated Bibliography with lots of interesting recommendations.  Free copy [here](http://atlas.physics.arizona.edu/~kjohns/downloads/lsst/Ryden_IntroCosmo.pdf).
Answer: As far as cosmology is concerned, the book which I consider to be THE best for a mathematical treatment of cosmology, is AK Raychaudhuri's "General relativity, astrophysics, and cosmology". It is excellently presented, Raychudhuri doesn't shy away from the math, and the old-school style makes it all the more elegant. So, I would STRONGLY recommend it.
I also suggest Narlikar's book on cosmology, it is beautifully written. As other users pointed out above me, Weinberg is also an excellent choice. In case you want an extremely mathematical book with astrophysics on the side, go for Straumann. But, for me, nothing beats Raychaudhuri's book. Good Luck!
Comment: Is there an edition of Raychaudhuri more recent than 2003? The field has been changing rapidly, so 2003 is pretty old.
Answer: In addition to Weinberg's fantastic book which does cover things pretty well, a good companion book is "Relativistic Cosmology" by Ellis, Maartens and Maccallum, which covers a lot of stuff Weinberg doesn't and is in general a good book on Cosmology.
Aside from the standard introduction to FLRW cosmology, inflation, thermodynamics etc, it covers an additional range of topics in cosmology such as the role of Modified Gravity, Models of Dark Energy, Anisotropic cosmologies and Inhomogenous models.
You will need a good grasp of GR, some differential geometry and statistical mechanics if you want to grasp all of the material properly but it is worth putting the time in.
Comment: Ellis is fairly recent (2012), which is good, but it's $186.
Answer: Books

Steven Weinberg - Cosmology: Great book, it covers a lot of topics in a very rigorous way, at least for physicists, it can be hard to follow sometimes, as usual when talking about Weinberg this is not an introduction to the subject
Coles and Lucchin - Cosmology; the origin and evolution of cosmic structures: It's not a new book but it's one of the easiest introduction I know of. It's not complete and it's not up to date but the standard parts are very well written.
Viatcheslav Mukhanov - Physical foundation of cosmology: another great book in my opinion, differnt from the two mentioned above, more pedagogical than Weinberg, more physical than Lucchin, probably less complete than both, but a comparison on completeness is flawed cause they treat different topics. Surely worth read. I especially liked the chapters on inflation.
Scott Dodelson - Modern Cosmology: Not as complete as Weinberg but better than any other book I've read in certain topics: basically all the second part, the part that is  devoted to the non homogeneous universe is in my opinion the best place to start studying it.

There's another book which I think could be very good for an expert physicist who wants to approach cosmology and astrophysics, it's by Tanu Padmanbhan and it's called Cosmology and astrophysics through problems. It's not an easy book at all, it's basically a book of exercises (some of them very hard) that builds complete knowledge of astrophysics and cosmology at least at a starring PhD level. There is a detailed solution for every exercise. There may not be many advanced research topics, but if you're able to go through the book you will surely have a solid base to start research in cosmology, I'd say more solid than a guy with a maser degree in these topics.
There are other books I can't review cause i didn't read much of them but I've heard good things about, so taking a look at them and see if one likes them can be useful. These books are:

Kolb and Turner - The early Universe
John Peacock - Cosmological physics
Tanu Padmanabhan - Structure formation in the universe: I know a bit more about this book. It focuses more on structure formation but there is a good introductory part on the basics of cosmology before dwelling in the interesting field of structure formation, often ignored by theorists.

Lecture Notes
Daniel Baumann - Cosmology: you can find them here. These are the only lecture notes I know, and I think they are the best place to start studying cosmology. They are rather complete for an introduction and they are easy to follow. I like the structure and the approach in these lectures.
One can find other lecture notes and videos of Baumann in this page

Books on cosmology


How to customize pallet_contracts?

Question: We have our own chain where we've added pallet_contracts pallet for writing and deploying smart contract. We just want to give permission to upload smart contract for few users only. Someone please gives some advice how can we implement this features?
Answer: That's is a very interesting feature, I would like to see cool approaches and ideas in the responses of this question.
I don't think you can get this functionality with the current pallet_contracts (But I might be wrong). Anyone (or any program) that has tokens of the chain can upload a smart contract without requiring permission using this pallet.
I can think of two options here:

The first one and the less recommended is to copy the code of the pallet into a new pallet custom_pallet_contracts and modify the code to let only authorised users upload the contract. For that you only need to create a new storage where you keep a list of all the users with permissions to upload contracts, and modify the upload_contract extrinsic in order to check that the origin is in that list.

The second option is a bit more complex but definitely is the one I recommend to go. Create a new pallet that acts a "wrapper pallet" for the pallet_contract where you can add additional logic like check if the origin can upload the contract.
The idea is not mine, is from Sergei and Shawn, and they created a tutorial about it 4 years ago: Extending Substrate Runtime Modules.
You can see the code of this "wrapper pallet" here: Sudo Contract .
The tutorial is amazing but is outdated so you won't probably be able to use the same code, but you will get the concept and understand the logic and the steps needed:

In your new pallet expose the same extrinsic calls as the pallet_contracts (in your case at least the upload_contract) and forwards those calls to the real pallet_contracts.
Before forwards those calls to the real pallet_contracts, add your  authorization checks logic.
In your node make the pallet_contracts pallet "Un-Callable" so the upload_contract extrinsic has to be called within your "wrapper pallet"

Another example of this concept of extending functionality of a current pallet is the NFTs Royalty Pallet, which is a "wrapped pallet" that manages a royalties for the nft_pallet, locking the transfer in the nft_pallet and forcing users to make the NFT transfers within the nft_royalties_pallet that has some extra logic on top of it.

How to customize pallet_contracts?


Why do high frequency radio telescope observations require precise localization?

Question: Why do high frequency radio observations, particularly of transient phenomenon such as Fast Radio Burst and Pulsars, require increasingly precise localization with increasingly high frequency?
Comment: Why would you know if the signal was transient if you couldn't aim the antenna back at a particular position?
Comment: I'm sorry— to clarify, why do higher frequencies require more precise localization (I.e. the higher the frequency the more precise the localization must be).
Comment: The word "require" in this question is interesting. Is there a particular reason that you think that high frequency radio observations wouldn't be _possible_ without precise localization? In my experience, the reason that high-frequency radio observations are often _accompanied by_ more precise localization is because it's easier to localize high-frequency radio signals (they don't diffract as much as lower-frequency signals), and localization is itself a desirable quality in an astronomical instrument.
Answer: Here is why.
Astronomical objects produce radiation across a broad range of frequencies, depending on which physical mechanisms are in play at any given time. One of the most important tools that astronomers have in doing their work is the ability to look at one object in a range of frequencies- the radio, microwave, infrared, visible, ultraviolet, x-ray and gamma ray bands- which furnish clues to what is happening.
To enable this, your radio wave observatory has to be able to precisely locate a sudden blip it detects so that those coordinates can be quickly handed off to the visible light people, so they can point their telescopes right away in the right direction to see that same object before it goes dim again.
To precisely locate a radio object, you need an antenna that can be pointed precisely, which is easier to do with high frequency radio waves than it is with low frequency radio waves. This is because the low frequency waves require gigantic antennas that cannot be swiveled around. The higher the radio frequency, the smaller the antenna needs to be, and the easier it is to aim it.
That said, to pick up weak signals requires a large collecting area or "aperture" which means that even very high frequency radio dishes have to be made as large as possible.


Payfast payment gateway ITN rersponse in php

Question: I have integrated  payfast payment gateway. I did not get any response from payfast after redirecting success page and notify page. What are the response parameters and how to store transaction details in the database?
Comment: Does your notify_url return a 200 response?
Comment: @Daniel_ZA how can we check the status for notify_url?
Comment: @PathikVejani You can perform a post to the page using Postman or any other similar tool, and then view the response thereafter.
Answer: PayFast will return their return variables to your system via the ITN callback after a successful payment has been made.
These return variables will only be returned to your notify_url if it returns a header 200 response as per their documentation.

Receive the payment information from PayFast and then tell PayFast that this page is reachable by triggering a header 200, the payment engine will make a few attempts, one immediately and then one after 10 minutes again, then exponentially at longer intervals, until it receives an OK 200 from your web server.

You will be able to access the returned values via the $_POST variable and use these to update your database.
// Notify PayFast that information has been received
header( 'HTTP/1.0 200 OK' );
flush();

// Posted variables from ITN
$pfData = $_POST;

//update db
switch( $pfData['payment_status'] )
{
 case 'COMPLETE':
    // If complete, update your application, email the buyer and process the transaction as paid
 break;
 case 'FAILED':
    // There was an error, update your application
 break;
 default:
    // If unknown status, do nothing (safest course of action)
 break;
}

You can view the PayFast sample PHP ITN code here.
Comment: Hi Daniel. A fellow SA'n here. I'm implementing Payfast in codeigniter framework and WAMP localhost environment on my laptop. Now it doesn't seem to resolve the PF source IP addresses, returning "Source IP not Valid" (using the PF code on their dev page. Do you think it's because it's on a "localhost" that I'm trying to achieve a return? (just to mention if relevant, my signature logic does match/validate, so I've gone beyond that point). Appreciate any input, thank you.
Comment: Hey Mario, PayFast will not be able to reach your local host machine when trying to post back the return variables to your notif_url. You can use a service such as Ngrok to set up a tunnel to your local host machine.
Comment: In the meantime I copied my script to my live server d-base.co.za and it came back with the same error. But, I did notice the script on PF's web page is slightly different to the version I got last year (the cURL portion). I'm just going to go through it and see if I spot something in the changes. I appreciate your reply. Will let you know, out of interest, if I find the issue. Thanks for responding buddy. Appreciated.
Comment: Now I'm confused and not sure if it's correct. when I dump `var_dump($_SERVER['REMOTE_ADDR'])` on screen, it comes back with my local router ip address, and the script is on my remote server. You can see it here [link](https://d-base.co.za/Payfastonline.php). I'm assuming this is correct? Also, I created a tunnel with your suggested Ngrok and the remote_address it returns is "::1". I'm not sure what to try.
Comment: I've never got this going. I tried Ngrok but always get `Bad source IP address`. PayFast support said to add their IP addresses to IP whitelist in Ngrok, but trying to find out where to manage that is a fruitless google search and Ngrok docs has no search. So I am still stuck using the return_url to trigger my database transactions. This really sucks.


How to fetch ETH/USD price from the coinmarketcap api

Question: I want to fetch the current ETH-USD price from this api (https://api.coinmarketcap.com/v1/ticker/ethereum/?convert=USD). How do I fetch just the price into a variable in PHP for reuse on my application?
Answer: You're going to have to access the url, read the contents of the url, and then turn the contents into an object or array (in this case it'll be an array).
<code><?php

  $url = 'https://api.coinmarketcap.com/v1/ticker/ethereum/?convert=USD';
  $data = file_get_contents($url);
  $priceInfo = json_decode($data);

  echo $priceInfo[0]->price_usd;

?>
</code>
The price_usd can be changed depending on what data you want to grab. For example, this code would give you $463.531.
Comment: The coinmarket api has been migrated to new api. You need api keys now to access the api. There is a free base plan as well. You can find more details here : https://pro.coinmarketcap.com/migrate/
Answer: Coinmarketcap is starting to charge for API. Perhaps you could have a look at CoinGecko API instead: https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&ids=ethereum
Here is the api docs: https://www.coingecko.com/api/docs/v3


Microsoft Remote Desktop Bandwidth Usage

Question: I am wondering how much bandwidth in terms of bytes sent/received is consumed by a typical remote desktop session. I need to know this because our ISP enforces a cap on monthly bandwidth usage (i.e. the total amount data in GB that can sent or received in a month). So just wondering like how much KBs or MBs are transferred per hour in an average RDP session.
Comment: I suggest you get a bandwidth monitoring program, and measure it.
Answer: With the recent advancements to the Task Manager, incorporating Resource Monitor, you can easily see the bandwidth usage from Terminal Services.
In short, it all depends on the settings you have used and what you're doing in the remote session. More actions require more repaints. Below are two shots I've taken while in an RDP session to a Windows 2008 R2 server.
The first screenshot, only Resource Monitor open (~3.6KBps):

The second, a YouTube video streaming (~951KBps):

Hourly bandwidth consumption at rates like these can vary from ~12M to 3.4G+. Unless you are watching video over RDP, the higher end of the ladder is highly unlikely. For normal activity at 1024x768 resolution with standard settings I'd estimate about ~25M per hour.
Answer: It depends on which version of RDP you are using and what settings you have. Take a look at this 2008 test report by Microsoft.

Table 11 and Chart 11 show the bandwidth consumption (in KBps) between
  a Remote Desktop Connection client and different server operating
  systems. The tests were conducted at 16-bit color depth with themes
  turned off.
Answer: RDP uses around 80kbps (or more if printing or sound is included)
Answer: Depending on your settings (color-depth, etc...) anywhere between 2-10 Kbps.  RDP is actually quite efficient.
Comment: RDP was developed by Citrix for Microsoft. Citrix products should have similar performance characteristics.
Comment: MS originally licensed the RDP technology from Citrix back in the Windows 2000 days, but both companies have been expanding and improving it on their own.  I'm not sure how much "cross-pollination" exists between the two, but my understanding of the situation is that Citrix is measurably more efficient than RDP.


Fold until next HTML tag

Question: If my cursor is somewhere on an HTML tag, I'd like to invoke a custom command that folds until the closing tag if it finds it, else returns "0" or something.
Should I make a function in VimScript or something?
I imagine it would work something like this:

Scan left until opening angle bracket is found. If none found, you are not on an HTML tag; return 0.
Scan right until closing angle bracket tag is found. If second character is backslash, you are on a closing tag; in that case, seek opening tag in next step.
Search forward (backward) for the matching closing (opening) tag.
Now fold between the two lines containing those tags.

This also assumes that the HTML tags are spread out on newlines, which for now I am comfortable with.
The main question I have to get started is if I need to track the cursor with an index or if Vim functions are enough to do it. I could search backwards for "<", enter "v", search forward with "/" for ">", maybe use some copy function to save that string? Or just save it as a variable? There are many such questions that make it hard for me to see the details.
Thanks very much
Answer: I think you might want to try zfat or zfit, which create a fold around or inside the current tag. Then you can manipulate the fold as usual.

Fold until next HTML tag


When to create your own dll what should be in it

Question: I as of yet, have not had a need to create a dll in .NET as my programs tend to be distinct from one another (and I haven't programmed for too long). However I am starting to gather a library of regularly used methods now which tend to have copies in lots of my programs (or similar methods that could be made more generic).
As I understand it a dll should be created to share common methods between programs.
So I can put my methods in the dll, what about things like custom dialog boxes and common forms. I currently have a custom error form and a print preview dialog which are used in almost all my programs. Is it good practice to put these in a dll?
Answer: "Good practice" in this case really relies on how much code-duplication you're cutting down on. If these dialogues are used throughout a lot of your programs and they take up a lot of code, then yes, it's probably a good idea to move them to a shared space.
But don't be tempted to throw everything in there. You'll find yourself having to override it and by that point you're probably writing more code than you were before. Keep things simple. Keep them generic. Keep them useful.
Before you start, though, be aware that you are creating a dependency tree. If you update your library chances are you'll have to put in some time maintaining your apps that use it... But this is no different from using a third-party lib.
Answer: To create a new dll, you just add new project (library) to your solution, and add it as a project reference to your main programme.
It is possible to put anything you want to this project. All dialog boxes, user controls, etc. are just classes, so you can share them as easily as any other class. I think it is good practise to share as much as possible.
Answer: Sure why not?
What you're building here is actually a small framework, pretty much like the .Net framework itself. Everything that you think is common between your applications can be put in the assemblies: forms, methods, business logic, exceptions, common data access.
When your framework grows you might want to split up that common DLL. For example if you have common forms in a DLL and you also develop batch applications then they don't need to reference to the DLL containing the WinForms specific classes.
Answer: Alternatively you can put the source files for these methods in a common place and just add them as links when you include them in your project/solution.


Data Modeling for consumer goods

Question: A company is trying to build a system that breaks down consumer goods (soft drinks, detergents, beauty products, etc.) down to the very basic components. The aim is to be able to break down all the characteristics of a product into as many enumerable quantities as possible. For instance, a soft drink will have the properties flavor, calories, color, cost, etc. Do note that the products will come from a huge variety of segments and not all properties will be applicable to all products (detergents don't have calories) and similarly sounding properties are not similar (detergents with a lime fragrance is different from a lime flavored soft drink). Also, search is expected to be fast and the database needs to understand relationships between products. Suggest only a data model for the same.
Answer: The feature you highlight, that not all properties describe all products, is a classic feature of a class/subclass situation.  Or, if you prefer, type/subtype.
Dealing with just that feature of the problem, I'm going to call your attention to the EER  (Extended Entity Relationship) model if you want to model your understanding of the subject matter.  The EER has a way of depicting what it calls a generalization/specialization pattern.  That's a good search term to find detailed descriptions of it.  This will adequately depict what you've said you're after.
A word of caution, however.  The majority of ER models you'll see here in SO are design models, not conceptual models.  That is, they reflect the intent of designing tables made up of columns and rows, with keys and foreign keys,  to contain the relevant data.
What I'm recommending is the EER model for a very different purpose.  It's to depict the way the data looks to the subject matter expert, not the way the data looks to the database designer.  That distinction is lost on those who have never learned the difference between analysis and design.
If your project is a major one, it's worth spending an appropriate amount of time on a detailed analysis of the subject matter before moving on to design.  Understanding the problem before you try to solve it is key to successful work on big projects.
Once you have a good conceptual model that captures the analysis, the choice of a data model to reflect the design will depend on what kind of database you've decided to build.  It might be relational, it might be multidimensional, it might be unstructured.  It depends.  The analysis, however, will be more useful if it's implementation independent.

Data Modeling for consumer goods


Why is $S_5$ generated by any combination of a transposition and a 5-cycle?

Question: Why is $S_5$ generated by any combination of a transposition and a 5-cycle? Is this true for any prime $p$ (in this case $p=5$)?
Answer:
Proposition. $S_n$ is generated by a transposition $\tau=(xy)$ and an $n$-cycle $\sigma$ if and only if $|\rm{i}_x-\rm{i}_y|$ is coprime to $n$, where $\rm{i}_m$ denotes the index of $m$ as a letter in $\sigma$.

Proof. Let $\tau=(xy)$, $\sigma=(x_1x_2\ldots x_n)$, and assume w.l.o.g. that $x=x_a$, $y=x_b$ with $a<b$.  We may then relabel $1,\ldots, n\longrightarrow x_1,\ldots ,x_n$, so that $\sigma=(12\ldots n)$ and $\tau=(ab)$.  Therefore, it suffices to consider an arbitrary transposition $\tau=(ab)$ with the $n$-cycle $\sigma=(12\ldots n)$.  Throughout this proof, take all letters modulo $n$ unless otherwise specified.  Set $d=\operatorname{gcd}(n,b-a)$.
We begin with $d=1$.  Observing that $\sigma^{k}(i)= i+k$, we see that $\sigma^{b-a}(a)= b$, and thus $\sigma^{b-a}$ is an $n$-cycle $\sigma^{b-a}=(ab\ldots)$.  Thus again we may suitably relabel $1,\ldots, n$ so that $\tau=(12),\sigma^{b-a}=(1\ldots n)$. We know that conjugating $\tau$ by $\sigma^{k(b-a)}$ yields the transposition $(k,k+1)$, and it is not difficult to see that $\{(12),(23),\ldots,(n-1,n)\}$ generates $S_n$, so we see that $\langle \tau, \sigma^{b-a}\rangle=S_n$.  Because $\operatorname{gcd}(b-a,n)=1$, $\sigma^{b-a}$ generates $\langle \sigma \rangle$, and thus we conclude that $S_n=\langle \tau,\sigma\rangle$.
To prove the converse, we will consider the induced action of $\tau$ and $\sigma$ modulo $d>1$, then apply our observations to find an element of $S_n$ which cannot be in $\langle \tau, \sigma \rangle$.
Define $\theta:\langle \tau,\sigma \rangle\rightarrow S_d$ by $\theta(g)=\theta_g$, where $\theta_g(i)=g(i)\mod d$.  We must verify that $\theta$ really is a function, that is, that $\theta_g$ is a well-defined permutation in $S_d$ for every $g\in\langle \tau,\sigma \rangle$.  By closure in $S_d$ we have that if $\theta_g$ and $\theta_h$ are well defined, then $\theta_g\theta_h=\theta_{gh}$ is as well, so it suffices to check only $\theta_\tau$ and $\theta_\sigma$.  In the former case, the assertion is obvious, as $b\equiv a \pmod{d}$ by definition of $d$ and vice versa.  In the latter case, we observe that because $d\mid n$, $$i\equiv j \pmod d \Leftrightarrow i+1\equiv j+1\pmod d.$$ Thus $\theta$ is in fact a function (and, moreover, a homomorphism) into $S_d$.
We now use make use of the assumption that $d>1$.  Pick a transposition $(ij)\in S_n$ where $i\not\equiv j \pmod d$.  By design, $\theta_{(ij)}$ fails to be well-defined, so we must have that $(ij)$ is not in the domain of $\theta$ - that is $(ij)\notin \langle \tau,\sigma \rangle$.  In particular, this means that $\langle \tau,\sigma \rangle$ is proper in $S_n$.

Corollary. $S_n$ is generated by any combination of a transposition and an $n$-cycle if and only if $n$ is prime.

Proof. If $n$ is prime, everything's coprime to $n$.  Conversely, let $p$ be a prime factor of $n$ and apply the proposition to $\tau=(12),\sigma=(a_1a_2\ldots a_n)$ with $a_1=1$ and $a_{p+1}=2$.
Comment: Let $n=4$ and $d=2$, $\theta$ as in your post. Consider $(i\,j)\in S_n$ for $i=1,j=2$. They are not equivalent modulo $d=2$. Your post claims $\theta_{(i\,j)}$ is ill-defined as a member of $S_d=S_2$. However, the map is, to my mind, perfectly well defined with the bijective function signature: $$\left(\begin{matrix}1\\2\end{matrix}\mapsto\begin{matrix}2\\1\end{matrix}\right)\in S_2$$So I must be misunderstanding. Or perhaps you made some small omission - what would be the fix?
Comment: Ah. I think I see what you meant now. While $1\mapsto2$, we also have $3\mapsto3$ and, taking equivalences modulo $d$ **on both sides**, that gives $1\mapsto1$, an ambiguity. Is that how you meant $\theta$ to be defined?


what to use: bring or take

Question: To understand the meaning of the usage of bring and take: is it correct to say 'I was picked up from the hospital and was brought home.' and 'My husband picked me up from the hospital and took me home' Thank you in advance!
Comment: You actually have two different things going on with those sentences at the same time. One is the difference between *brought* and *took*; the other is the difference between passive and active.
Comment: Both sound OK to me
Comment: Yes I realise this now. Thank you for pointing this out!
Answer:
'I was picked up from the hospital and was brought home.'

this sentence is in the passive voice. The agent who did the picking up and bringing home is not specified. Otherwise, we would see "I" (first person subject) become "me" (first person object); "Someone picked me up and took me home."
Note also that in keeping the sentences more parallel, you could have written, "I was picked up... and was taken [took?] home."

'My husband picked me up from the hospital and took me home'

The subject clarifies here (my husband), and the first person objective, me, appears. Note that given the nature of expressions, you pretty much have to force repetition in this instance. My husband picked up and took me home from the hospital reads awkward to me.
So the difference is semantic, namely, perspective or actor. Both sentences are grammatical.
Comment: Assuming your husband came home with you, but the taxi driver didn't. _Bring_ is the causative of _come_, and _take_ is the causative of _go_; that is, _bring_ means 'cause to come' and _take_ means 'cause to go', so they contrast in the same ways that _come_ and _go_ do. This is not as simple as you may think -- see the [Deixis Lectures](http://www.umich.edu/~jlawler/Deixis.html), especially "May We Come In?" and "Coming and Going".
Comment: Thank you so much! So it should me either 'My husband picked me up from the hospital and brought me home' or 'The taxi driver picked me up from the hospital and took me home'.

what to use: bring or take


Choosing correct BMS for 12V lithium battery pack with 39 cells

Question: I have 39 lithium cells, I want to make a 12 V battery pack with as much AH as possible. From what I've read, all BMS are only for cells connected in series. So for example, all 12 V battery packs are always 3S BMS and have three cells? Can I have multiple 3S BMS battery packs connected in parallel? Can I charge them from one charger? In short, how can I use all my batteries for a 12 V battery pack and is it at all possible?
Comment: We don't know which BMS you have and can them be paralleled. We don't know what charger you have if it supports charging multiple packs in parallel. Using 13x3 cells would make make a 12V pack but we don't know if your BMS supports it, of your charger supports it, or if it is even a good idea to short 13 cells in parallel - if one shorts out the rest of the 12 will surely push some serious current into it. It does not seem very good idea.
Comment: @Danny In English, there is no space before question marks and punctuation. This may be helpful for you: https://lrdgcampus.com/blog/capitalization-rules
Comment: This answer covers the topic in some detail [Do I need BMS within parallel connections?](https://electronics.stackexchange.com/questions/289586/lithium-battery-pack-do-i-need-bms-within-parallel-connections)
Answer: Easy:

Connect 13 cells directly in parallel to form a block
Make 3 such blocks
Connect them in series
Connect the balance wires of the 3S BMS to the block of cells

The BMS doesn't know or care whether each block is a single large cell or 13 small cells in parallel. Electrically, they are identical.
(By the way, for 12 V, you don't want three LCO cells at 3.6 V each. You want four LFP cells at 3.2 V each. That's adds up to a nice and nearly-constant 12 V.)


how to use the transaction created using. cardano cli to be signed by a wallet in frontend

Question: If we create a transaction body in the backend using cardano-cli for example, and only for signing the transaction would like to get the frontend wallet to sign it, how is this done in the best possible way ?
Answer: Basically, there are two ways:

After getting the transaction in the frontend, load the CBOR to CSL (cardano-serialization-lib), and proceed from there.

The workflow would be: build the transaction with cardano-cli, sign it with some random wallet stored in backend, send the signed transaction CBOR to frontend, deserialize the CBOR to CSL Transaction object, remove the witness you signed with in backend, call any wallet extension (eternl, nami..) injected signTx() method and get current user witness, add it to the CSL Transaction object and submit it with submitTx() wallet method.
This worked fine for me with Alonzo era and simple transactions, but had some problems with complicated (inline datums, plutusV2 scripts, etc.) Babbage era transactions. You kind of need to dig deep into CSL to make it work. So I chose the second, easier approach.

Build the transaction using cardano-cli, send it to the frontend in order to retrieve a witness, return both transaction CBOR and witness to backend, assemble the transaction and submit it.

In depth steps:

cardano-cli transaction build-raw --babbage-era --cddl-format ...

build instead of build-raw also works. Do not forget to add --cddl-format flag, in order for frontend sign() method to understand the format. Also you do not need to sign the transaction, only build it.

Send built transaction CBOR to frontend

encodedTxVkeyWitnesses = await window.signTx(cbor, true)

Call signTx() wallet method with received CBOR as a parameter. You will get the encdoded witness, which is basically a proof that user signed the transaction. The resulting hex string will look like this: a10081825820cccfe2be401c85342497f6e1e4a241629790b0fb7f2af5f18441779d11f25b1f5840c38a93d63faac9335ecc2f24ead7ca2d46a6637f354ee707bb06eb8192af2fa6a676fb72f8772cd1c42b491ec6dfc798c76b61c55dc4eecab362e71ffab26305

await handleSubmit(cbor, encodedTxVkeyWitnesses)

Call your backend from frontend, and pass the very same transaction CBOR you received from backend and recently acquired witness CBOR.

$witnessCbor = substr($encodedTxVkeyWitnesses, strpos($encodedTxVkeyWitnesses,'825820'), (strlen($encodedTxVkeyWitnesses) - strpos($encodedTxVkeyWitnesses,'825820')));

Note: example is in PHP. signTx() method returns a bit different witness structure than required by cardano-cli. You basically need to strip first 6 chars from the string. They represent data structure, in this case some nested arrays and stuff. You can look at structure differences here, by comparing both stripped and not stripped hex witness CBOR strings: https://cbor.nemo157.com/
6.
transactionCborFile = '
        {
            "type": "Unwitnessed Tx BabbageEra",
            "description": "Ledger Cddl Format",
            "cborHex": "<transaction CBOR here>"
        }
    ';
    $witnessCborFile = '
        {
            "type": "TxWitness BabbageEra",
            "description": "Key Witness ShelleyEra",
            "cborHex": "<stripped witness CBOR here>"
        }
    ';

Create two files as described above containing transaction and witness CBOR, as cardano-cli assemble command require files as parameters.

cardano-cli transaction assemble --tx-body-file <transaction_cbor_file_path> --witness-file <witness_cbor_file_path> --out-file tx.assembled

Use cardano-cli assemble command to combine both transaction and witness CBOR in order to receive a signed transaction. At this point, transaction is signed and is ready to be submitted.

cardano-cli transaction submit $MAGIC --tx-file tx.assembled

That's it!
Comment: I cannot thank you enough I have spent 2 days trying to solve this problem using every permutation I could think of and then I stumbled upon this post after being at my wits end. Thankyou!
Answer: I have a different type of example that might be helpful to anyone looking for ways to sign (and build) transactions using both a browser wallet and a server side private key.   Code is here https://github.com/lley154/helios-examples/tree/main/nft-multisig
And video https://youtu.be/CSd9ev_XH5w


How can I make a plane's edges taper inwards?

Question: How can I deform one edge or multiple edges of a plane or cube so they are tapered in and rounded equally?
Answer: While in Edit mode, select the plane and subdivide it, by pressing W>Subdivide. You can press F6 to adjust the number of cuts. Then, use the Proportional Editing tool, enabled by pressing O, or by going to the 3D View header, and set it's falloff to Sphere.

Now, select the center face/vertex and scroll the mouse so the circle doesn't contain the corner vertices and scale to taste.
Comment: it's what i want but it dose not give smooth rounded edge even when i increased the division points better results if i just subdivide olny the edge but still no smooth enough.
Answer: Alternatively if you want it done with actual curves

Add a new plane object
Enter edit mode
Subdivide it with W > Subdivide only once
Convert it to a curve with Alt + C
Change the curve type to Bezier in the tool shelf
Change it to 2D type curve in the properties window
Select the central vertex in the middle of the sides only
Change their handle type to Auto
Now scale them  down towards the selection center and adjust as desired
Comment: Added image for clarity
Answer: As an alternative to the answers above you may do it using subsurf modifier and edge crease tool.
Add a plane and subdivide it once with W-->Subdivide. Scale some vertices to create the desired shape. Give it a subsurf modifier with some subdivisions. In Edit Mode select all the edges around the plane and press Shift+E,1 to crease them.


Index finger too pointy for guitar?

Question: I recently got a guitar and can't seem to hold down a string without touching another. With the shape of my finger, it doesn't feel possible. Will my nail recede as I practice or am I doomed?
Comment: Please be more specific about the guitar - classical, acoustic, electric...?
Comment: I'm not a guitarist, so maybe one can confirm, but I suspect when you need to, for example, fret one string and also play the next highest string open, you might angle your hand so the finger approaches the fret "from behind," rather than parallel, letting you press the string down firmly without also contacting the adjacent string.
Answer: Disclaimer: talking about classical guitar below. Other types might require different advice.

You should make your left-hand nails as short as possible. Cut, clip or file them as much as possible without feeling pain. Finger shape doesn't matter, but if your fingers are really large, you will be inconvenienced. And if they are really really large (unlikely), you are doomed.
I usually file my nails almost every day. If I don't play for many days in a row and the nails manage to grow long, I cut them and then file them.
You don't need your nails to recede, you only need them short enough so they don't get in the way.
Comment: I agree. I expect the nail is causing the OP to rotate (under-rotate?) the finger.
Comment: It's an electric guitar but yep, cutting that little bit of white off has definitely made it easier. I guess I'll have short nails from now on.

Index finger too pointy for guitar?


Debian Updates need to find what has installed

Question: I have a nifty server that does our updates by a specialized script. The problem is the main admin of this is part time and rarely here.  I have Debian functioning as a device OS.  When updates get applied I need to be able to see when they got applied on the device.  I did a dpkg -l and it shows a lot besides that.  We also checked the dpkg.log in /var/log and it only shows us the date when the updates were last installed.
Comment: Might want to examine/monitor `/var/log/apt/history.log` to see when what was installed
Comment: Nothing exists in the var/log/apt directory.  How can I make sure that this gets created by my devices?
Comment: If your Debian is real pure Debian then all apt-get, etc. logs should be there.  Of course, your log rotation, etc. can all effect this...
Answer: sudo apt-cache pkgnames | tee "$(date +"%Y-%m-%d")_pkg.log" provides a terser list, and you may compare it against the last time you ran it to see what's new.
Comment: Many thanks for a prompt answer.  I  do that I get the same output as sudo apt-cache pkgnames which is all the packages installed but with no dates.
Comment: Right. Run it every time there's an update. Then, you can compare it against the previous run (which is why I stuffed the ANSI formatted date into the logfile name in my example) and see what's new.


Orthogonal Latin Square 6*6

Question: I need to make remarks about Tarry's Proof for the nonexistence of 6x6 Latin Squares as part of my final exam for a class I'm in. Problem is, I can't find it ANYWHERE on the internet. I can only find minor comments about it that don't explain what he did. Does anyone know where I can find it online? Or does anyone know where I can find a detailed explanation of his proof? if you have other proof for this question please share that... i need to proof of this question
Comment: If you have any more Latin squares questions, please make sure to tag them [latin-square].
Answer: Since your after remarks, here's some.

It's easy enough these days to prove the non-existence on a computer.  There are only $12$ main classes to exclude (ref.).
There's a short proof of this result:

Stinson, A short proof of the nonexistence of a pair of orthogonal latin squares of order six, J. Comb. Theory A, 36 (1984) 373-376

There's a recent graph theory proof of the non-existence of self-orthogonal Latin squares (Latin squares that are orthogonal to their transpose) of order $6$; see:

Burger, Kidd, and van Vuuren A graph-theoretic proof of the non-existence of self-orthogonal Latin squares of order 6, Disc. Math. (2011) 311, pp. 1223-1228.

PS. If you're desperately after the paper, I suggest you email either Brendan McKay and/or Ian Wanless.  They're the most likely people to have obscure papers on Latin squares.
Answer: Tarry's paper is available in digitized form at the online French National Library, http://gallica.bnf.fr/ as well as many volumes of 19th and early 20th century scientific journals.
Here is a link for the first page:
http://gallica.bnf.fr/ark:/12148/bpt6k2011936/f175.image
It is quite a long paper (34 pages) investing potential cases sorted according to various conditions. He starts from general 6x6 latin squares and recognizes that the 9408 individual cases ("permutation carrées" = square permutations = latin squares) can be sorted into 17 types. He coins several names such as "écusson" (small shield, with an heraldic meaning) as a way to present the type of permutations (in term of cycles) of the rows and columns of latin squares. He finds 16 different possible "écussons" and he sorts the 17 types into 3 classes,  depending on presence of cycles of order 2.
Hope it will get you started.
If you have trouble with the french, or with using Gallica to download the whole article do not hesitate to ask specific questions.
Answer: How about you read the paper that he wrote!
Tarry, G. Le probleme des 36 officiers.
Comptes Rendus Assoc. France Av. Sci.
29, part 2: 170–203,
1900
Comment: It's quite clear that the OP knows what the reference is, and is having trouble accessing it.
Comment: See my answer for a link on the original paper. A physical copy of the journal of the French "Association for l'Avancement des Sciences" is not so easy to find outside France (where most University libraries have it).

Orthogonal Latin Square 6*6


Difference between a "mode" and a "state" in quantum mechanics?

Question: I am studying the book Introductory Quantum Optics by Gerry & Knight at the moment and as a reader, I stumble upon their seemingly interchangable use of the tems "mode" and "state". As far as I understand it now, a mode is related to frequency, while states involve energies and particle numbers. Could anyone elaborate on the general difference between these terms in quantum mechanics?
Answer: Imagine with that we have a standing electromagnetic wave inside a cavity, as on page 11 in the book by Gerry & Knight.
This cavity supports electromagnetic field modes of many different frequencies, which satisfy the given boundary conditions.
Now suppose that we look at a specific frequency $\omega$ i.e. a specific standing wave which is called a mode of the field.
The state that the single-mode field is in, is denoted by the number state $|n\rangle$. Where the number $n$ corresponds to the number of quanta or loosely speaking "photons" in the single-mode field.
More general, for each frequency or "mode" $\omega_k$ in the cavity we have a corresponding state vector $|n_k\rangle$, that corresponds to the state that the mode $\omega_k$ is in. And using the state vector $|n_k\rangle$, we can for example calculate the mean energy $\langle E_k\rangle=\langle n_k|\hat{H}|n_k\rangle$ for the mode $\omega_k$.
I hope that you see the difference now between state and mode and how they are related.
Comment: Thanks! So as I get it now, there can in fact be different states (corresponding to e.g. different photon numbers and energies) for a single mode (characterised by a frequency or a wave vector).
Comment: Yes, exactly, as you're saying.


Using gmail for login through asp.net?

Question: I have searched in this site but more of gmail login were related to php.
my problem is connecting gmail login to the website written in C# and asp.net. so the user can enter the website by gmail account. I dont talk about sending email and these areas. its just login in with gmail account! should I write it myself from the beginning? or there is some ready APIs / plugins ??
Thanks
Answer: Please see the following link which details the login API for using their Google accounts https://developers.google.com/accounts/docs/OpenID
Answer: You might want to try http://www.dotnetopenauth.net/
look the following thread for more details
OpenID and Google.GData.AccessControl.dll in C#
How to do login to my asp.net app using Facebook (or other ID)?

Using gmail for login through asp.net?


Shower without a door and something that could serve as a door and restraint waters

Question: In a shower that is open i.e. it has a glass panel on the side but no door, is there something sold that helps restraining the waters during the shower i.e. mimic a small door?
Comment: A shower curtain?
Comment: @SolarMike: I am not sure it is possible because the one side is the glass panel and the other side is a tile wall. So I don't think it is possible to support it
Comment: A photo would help. The shower rod could be to the side or adjacent to the glass wall. With out seeing the space it is just a guessing game.
Comment: @AlaskaMan: It is like this except for the big shower that is vertical https://s3-production.bobvila.com/articles/wp-content/uploads/2018/08/Doorless_Shower_Tall.jpg
Answer: U can actually get a specialty shower rod or even a regular shower rod and put you up a shower curtain they make shower curtains that are for walk in showers they also make plastic accordion doors that can be used and they can actually work well and relatively cheap
Comment: Do you have an example I can check? E.g something in amazon or any other store?
Comment: Does this mean that they have to be attached on the side?


Query Strings and Woocommerce

Question: I've got a wordpress website and am using WooCommerce to sell registrations for applications that I develop.  To streamline the registration process, I would like users to be able to click a registration button in the application and be taken directly to my WooCommerce checkout page with the registration product already loaded in the cart and a username (generated by the application) entered automatically in the checkout page's username field (which I've added).
What I've got so far is, when the user clicks on the applications registration button, the application sends the user in their browser to a URL that looks like:
http://www.example.com/checkout/?add-to-cart=532&username=myname

In my function.php file I'm redirecting to the checkout page when adding to cart, so this opens the checkout page with the product id = 532 already in the cart.  Perfect.
To make the username variable public, I added the following to my functions.php file:
add_filter( 'query_vars', 'add_query_vars_filter' );
function add_query_vars_filter( $vars ){
   $vars[] = "username";
   return $vars;
}

To capture the username from the query string and enter it in a created username field, I also added the following to my functions.php file:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
    $thename = get_query_var( 'username', 'defaultName' );
    $fields['billing']['billing_username'] = array(
        'label'     => __($label, 'woocommerce'),
        'placeholder'   => _x($placeholder, 'placeholder', 'woocommerce'),
        'required'  => true,
        'class'     => array('form-row-wide'),
        'clear'     => true,
       'default'    => $thename
    );
 return $fields;
}

Unfortunately, defaultName is entered in the username field.  If I remove the add-to-cart=532 from the URL, then myname is entered. I think that the problem is that by the time the checkout page opens, username=myname is stripped from the URL.  It seems I have to use $thename = get_query_var( 'username', 'defaultName' ) earlier in the process of opening the checkout page (and one of the problems is that I don't fully understand this process) and somehow make it accessible in the custom_override_checkout_fields function in my functions.php file.  So the question is how do I accomplish this?
Answer: I think that I figured this out.  In my functions.php file I had the below function to redirect to the checkout page when a product is added to the cart.  So I captured the username variable there and then added it to the redirected URL:
add_filter ('add_to_cart_redirect', 'redirect_to_checkout');
function redirect_to_checkout() {
    global $woocommerce;
    $checkout_url = $woocommerce->cart->get_checkout_url();
    if ( ! empty( $_REQUEST['username'] ) ) {
        $thename = $_REQUEST['username'];
        $checkout_url = esc_url( add_query_arg('username', $thename, $checkout_url ) );
    }
    return $checkout_url;
}

Curiously, neither get_query_var('username') or $wp_query->query_vars['username'] worked. I'm not sure why.

Query Strings and Woocommerce