Use the functionality available in the unknown DLL

Question: Consider I have got a DLL file which contains some functions and classes that I am not aware of. It might be lack of documentation, or the unwillingness of the programmer to provide the documentation after the release. I want to know, how can I study an unknown DLL file and utilize it in my projects? ( Of course the programmer gives such permission )
Answer: I can't post comments for now, since I'm new on this forum
I'm not sure I fully understand your level of understanding here. Do you know some basic stuff in reversing field ?
If so, you should load your DLL in OllyDbg (for example) then click on Debug > Call DLL export to locate the API you're interested in.
Then it's classic reversing session.
Otherwise, if you need more specifics, I strongly recommend you to buy "Secrets of reverse engineering - Eldad Eilam" book, in which there is a fully detailed example of a DLL reverse session.
Comment: Well, that's a long process and explaining it here would take some time. I suggest you first write your own little simple programs, such as a printf, then load it into ollydbg, and try to understand the asm.
Regarding the input arguments, assuming stdcall calling convention is used, you can see the "return" statement at the end of your function, followed by a number. This number indicates the size of the stack that needs to be cleared (i.e. calling arguments). Knowing that sizeof(arg) >= 4 bytes, you have at least this number/4 arguments sent to your prog. I have 1 char left to keep writing !
Comment: EXE files using functions you are interested in can be useful, especially if you have access to the source code of these programs (I know you knew !). The important thing to remember is that reversing takes some time, and the more you have information about something you want to reverse, the best. If you can't gather everything you want by only reversing the DLL (maybe you won't know what type of variable are used), then reversing the .exe could be some useful help, since you have a context and you can guess when and why is this API used. Hope it gives you some usefule pieces of information !
Comment: I am newbie in Reversing field. By the way, if I export the functions of interest, how can I know what parameters they exactly use? How can I gather some pieces of information on their usage? In addition, I have got the EXE file which utilizes that DLL. Is that EXE file an advantage? How can it be one? I am already reading the mentioned book but takes time to reach that topic.


Conditional branch instruction

Question: How is a conditional branch instruction implemented in hardware? The instruction checks the sign bit, how does it decide to load pc with the branch address or increment pc to the next sequential address?
Answer: A modern processor will first check whether it knows the value of the condition or not. For example, if you had a C statement "if (x / y > 3) ... " then it will take quite a while until the value of the ">" condition is known. If the condition is known, then the processor knows what to do.
If the condition is not (yet) known, then things get complicated. You don't want to wait until the condition is known. The processor will therefore use branch prediction to decide whether the branch is likely to be taken or not. For example, if this branch has been performed five times before, and each time the condition was true, then the processor will guess that the condition will be true again.
However, the guess might be wrong. Therefore all the following instruction are marked as "guessed", so the processor can undo the actions of each instruction. At the same time, the processor watches the condition: In the example, once the division x/y is complete, and the comparison x/y > 3 is complete and the condition is known, the processor will know whether the guess about the condition was right or wrong. If it was wrong, then the processor undoes all the effects of instructions that were performed but shouldn't have been. If the guess was right then the processor marks all the instructions back to "not guessed". One thing that cannot be undone is storing results to memory, so while the condition was guessed, nothing has been stored to memory. All those store instructions are now started.
Comment: Do you have any documentation to back up what you say. This doesn't seem true.
Comment: Conditionnal branch instruction is implemented as flags registers which are checked against to determine if a condition is true or not after a cmp instruction.

You basically have circuitry which is going to check the number and register you compare using the cmp assembly instruction. If the cmp is true then PC changes otherwise it is incremented to point to the next instruction.
Comment: User123: Download intel x86 manuals, or ARM manuals, or POWER manuals. It's simplified (branches within predicted code are more complex), and POWER loop instructions may always "know" whether they are executed or not, and execute as if you had unrolled the loop.
Comment: User123: I can't remember ever having seen a processor where a compare instruction produced true and false. I can remember a processor where compare+branch were combined in one architectural instruction.
Comment: A cmp instruction changes some registers/flags that it will then use to jmp or not jmp when it reaches a conditional jmp.

Conditional branch instruction


Do I not have any alleles from my mom's mom & my dad's dad?

Question: So, I have an XX, & I got an X from my mom, & an X from my dad. My dad would have gotten his only X from his mother, & my mother could have gotten the X I got from her father or mother. That would mean I did not get either X gene from either my mom's mom or dad, or my dad's dad - does that mean that I have "less" of their genetics in me? Say I got my mom's dad's X, would that mean I have less of my mom's mom's genetic traits?
Answer: Speaking of your DNA in general, you have alleles from all four of your grandparents.  The 22 pairs of autosomes (non-sex chromosomes) can receive DNA from all four with random mixing.  On a few chromosome pairs you may be missing alleles from one of your grandparents due to the randomness, but on average you will have about a quarter of your autosomes from each of them.
The X (and Y, for males) chromosomes are special, though.  The X you inherit from your mother will have alleles from both your maternal grandparents.  The X that you, as a female, get from your father has no alleles from his father, so that grandfather's X alleles are always missing from your genome.
Because of the random mixing, you will have slightly varying amounts of DNA from each of your grandparents: it won't be exactly 25% for each of them.  Because of the special X inheritance, your paternal grandfather will on average contribute slightly less than the other three grandparents.  (Because of another quirk, mitochondrial inheritance, your maternal grandmother will contribute on average a very small amount more than the other three grandparents.)
Comment: Regarding your second paragraph, you should consider recombination between the pseudoautosomal regions of the X and Y chromosome.
Comment: Nice summary. Sex chromosome inheritance is interesting, for instance that paternal grandmothers are on average more closely related to their granddaughters than their grandsons: [Fox et al. 2009. *Grandma plays favourites: X-chromosome relatedness and sex-specific childhood mortality*. Proc. Roy. Soc. B](http://rspb.royalsocietypublishing.org/content/early/2009/10/27/rspb.2009.1660.full)


Exporting glb from Blender creates a "Seperate RGB" node

Question: I'm looking to export a GLB from Blender to eventually upload into Unity. Unity reads the materials very differently than Blender exports it. Unity wants the textures to be packed into specific channels, Metallic in RED, Smoothness in the ALPHA etc. but when I export my model as a GLB from Blender it automatically creates a "Separate RGB" node and assigns the Metallic into the Blue channel and the roughness into the Green channel. This won't look right in Unity, how do I go about overriding this so that I can pack the textures myself?
I do use Substance Painter and can use the preset "Unity Universal Render Pipeline (Metallic Standard)" which works perfectly but again Blender will override my setup and mix things around.
Thanks in advance!
Comment: Can you solve it with a Swizzle Node in Unity's Shader Graph?
Answer: Blender glTF exporter adhere to glTF standard, and stores in the red channel whatever texture you connect to a custom node group that has to be named "glTF Settings" with an input named "Occlusion"; in the green channel whatever texture plugged into the roughness input of a BSDF Shader; in the blue channel whatever texture plugged into the metallic input of the BSDF Shader.
So you can Hack this setup forcing it to save your textures in a way that Unity will adopt correctly (i.e. plug your metallic texture into the occlusion custom node group).
Another way is to use the compositor to import the generated glTF texture, swap its channels as desired and save the swapped image to overwrite the texture.
Probably you will have to invert the roughness to smoothness.
Don't forget to use "NonColor" texture node color space and a straight unpremultiplied alpha channel (like PNG RGBA does).
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html?highlight=gltf


Linear regression from data that don't represent a function

Question: I have $(x,\ y)$ pairs with a strongly suspected linear correlation. So I want to fit the "best" linear function in order to make predictions for unknown $x$'s. These pairs don't represent a function, i.e. there are many different values of $y$ for some $x$. I want to know if there is an issue with that considering this as a machine learning problem. Should I use some unique "representative" (average, maximum, minimum, most frequent, etc.) and convert the input data in a function or it is OK to work with the data as it is?
Answer: If you perform linear regression on your raw data using Ordinary Least Squares to estimate the model parameters you will get a model that estimates the conditional mean of $Y$ given the observed value of $X$. I.e. $\hat{f}(x)=E[Y|X=x].$ Since your model outputs the conditional expectation of the response it wouldn't be necessary to convert your $Y|X=x$ into a descriptive statistic prior to your analysis.
Comment: OK. I see that. But now suppose that I have to evaluate how good are the estimated parameters of my linear model with, let's say, MAE or MSE. I want to do that with cross-validation. So I take my evaluation set and do all the predictions with my model and I want to compare it with the "real" one. Which value should I take as the "real" one given that the input data is not a function?
Thanks for your answer!
Comment: You're right that your validation method wouldn't make much sense. Since you said, "there are many different values of y for some x," you know that there is no "real" value of $Y$ at a given level of $X$, i.e. the relationship isn't deterministic. Using linear regression with OLS estimators you can predict $E[Y|X=x]$, so you could compare these predictions to the average Y value at a given level of X to determine how accurate your model is. The regression output should provide you with diagnostics to make checks similar to this.
Comment: You may also find prediction intervals useful to determine the range within which the model assumes most observations would fall at a given level of X.
Comment: Thanks tjnel! I really appreciate your answer. Can you please suggest me a technique to "find prediction intervals"?
Comment: @MartinChaia if you are using statistical computing software to perform your analysis you can check if it supports prediction intervals for regression.


Submitting data from Infopath 2010 to SharePoint 2010?

Question: I have published a Infopath form as Document Template of the document library, the Infopath form has so many fields(~200) however I would like to map few fields(~5) to SharePoint List columns on the library. Means that whenever the form is saved, it has to save the entire form in the document library along with the mapped column values.
Comment: Also would like to have a people picker control on the Infopath which should work like a people picker control in SharePoint..The idea is to map the infopath field to SharePoint site column..
Answer:
Go to Form Options -> Property Promotion
Add the fields you want to be promoted to the list.
Re-Publish the form.


Illustrator Exporting REALLY small 300 dpi PNGs

Question: I keep trying to export 300dpi PNGs from Illustrator, on a 1500x1500 px artboard, and they keep turning out really small and pixelated, not big, beautiful, and vector-like as usual! Help!
Comment: Why would it matter what the DPI is if you speficy that the image is 1500 px x 1500 px?
Comment: Are you sure you are using px? I don't see how you would have a 1500 square pixel image, save it and then look like that...
Comment: DPI only refers to printers and output devices. There are no "dots" in raster images, only pixels, so pixels per inch (ppi) is the image resolution measurement, not DPI. Your confusion about this might be part of your problem with understanding what's happening.
Answer: Don't use Export, use "Save For Web" which lets you preview and specify the exact pixel dimensions to output.
If you want to base it on your art board then make sure that option is checked. Of course start with 300 DPI.
Answer: You can also select the element and copy it to your clipboard. Then Alt+Tab to Photoshop and choose new CMD+N. From there change the width and height units from pixels to a unit of measurement. Alter the resolution to your liking. Click create then paste just paste your artwork to the new artboard.


Normal approximation of a mixture of normal distributions

Question: I have noticed that sometimes mixtures of normal distributions can be approximated very well by a simple normal distribution. For instance, the mixture of the normal distributions $\mathcal{N}(0,1)$ and $\mathcal{N}(1,1)$ (with both distributions having a weight $w_i$ of 0.5) is well approximated by $\mathcal{N}(0.5,1.2544)$; the density functions of both distributions differ by about 0.004 or less over the whole continuum. My question is, under which conditions is such a normal approximation of a mixture of normal distributions possible?
Comment: It is always possible, since the mixture will have a mean and variance  ($\frac12$ and $\frac54$ in your example). The real question is when is such an approximation *good* for a suitable definition of *good*
Comment: A 50:50 mixture of two normal distributions for which the absolute difference between the two means is less than twice the common SD is unimodal. (See the Examples section of the Wikipedia article on 'mixture distributions'.) Roughly speaking, normal approximations to mixture distributions work best when the mixture is unimodal (for central values) and the components have a common variance (for values in tails).
Answer: Continued Comment: Single samples of size $n = 1000$ from each of three mixture
distributions illustrate three possibilities:
$U$ is a 50:50 mixture of $\mathsf{Norm}(10, 2)$ and $\mathsf{Norm}(12, 2).$
According to a Shapiro-Wilk test, my sample is consistent with normal: P-value = 0.134.
$V$ is a 50:50 mixture of $\mathsf{Norm}(10, 2)$ and $\mathsf{Norm}(16, 2).$
Judged clearly not normal: $\;\;$ Shapiro-Wilk P-value < 0.0005.
$W$ is a 50:50 mixture of $\mathsf{Norm}(10, 2)$ and $\mathsf{Norm}(13, 6).$
Judged clearly not normal: $\;\;$Shapiro-Wilk P-value < 0.0005.
Different samples from these distributions may give somewhat different
results, but the idea survives: mixtures of distributions with approximately
equal means and equal variances are better approximations to normal.
The graphs below show my three samples along with the density functions
of the three mixture distributions.

Note: Heights of humans are often modeled as approximately normal.
They are close to a 50:50 mixture of women and men, whose average heights
differ by perhaps 3-4 inches, which is smaller than two standard deviations.
Heights might be more closely modeled as normal by looking at women and men separately.


Can I do raw TCP/IP over port 80 or 8080?

Question: I have an application in mind which needs to communicate with an external (internet facing) "server".
The protocol itself is going to be really simple, and I was planning on doing everything over TCP/IP via Port 80 (or 8080) in order to hopefully pass seamlessly through firewalls. My "server" will be listening on port 80 (or 8080) for requests from my application. It will not actually be a web server (i.e. not expecting any HTTP traffic).
I have control over the network setup of the "server", but not the client environment. I will be coding both the client and server applications, so have control over those.
I have not really attempted any TCP/IP communication out of  a LAN environment before, am I missing something obvious? I suppose my question is more like this: my client app is going to be run on all sorts of customer networks, of which I have no access to. Is this a sensible approach?
I would be most grateful for any hints/tips/gotchas.
Answer: For your use case, I think a better idea is to use http tunnel, because some firewalls will block non-HTTP traffic even if you are using port 80/8080.
Comment: Hmm, I don't really want to introduce anything complicated! Perhaps I should just use "proper" http commands in my protocol?
Comment: Yes, in case you want your traffic can pass most of firewalls


How should I fill in the form of a UK Visa for my wife when I have a valid visa?

Question: I was traveling alone to the UK 2 months ago, and my visa is still valid (6 months). Now, for the second time, I want to travel with my wife and daughter, but I wrote in my form, my dependent people will not travel with me to the UK.
Can I request a visa now for my family and go to the UK with them?
What should I write in my wife and daughter's form for this question: "How much do you want to spend on your travel to the UK"?
Comment: You can mention in their applications that they are travelling with you and that you already have a visa. There are specific questions for that
Answer: You have a valid visa and, with that, you're able to travel to the UK. For your wife and daughter to accompany you, they need to apply for their own visas. As part of her application, your wife will be asked about her partner, you, and for your information, including your passport number.
If you are the one underwriting the trip for the whole family, your wife would identify you as that person and include your financial documents showing that there are sufficient funds available, just as you did in your visa application.
You might want to review the UKVI guide to supporting documents to make sure you have all your bases covered, before submitting their applications.
Comment: Make sure you include a copy of her visa.
Comment: @greatone who do you mean? She, the wife, doesn't have a visa, nor does his child. He, the husband, does, and doesn't need to include it in the wife's application, as the husband's passport details, which do need to be included, reveal his visa status in the UKVI system.


IE flickering input in jQuery overlay

Question: I'm utilizing the jQuery UI Library to create an overlay.
For simplicities sake, they live on the page (not being pulled in via an AJAX call) and are initialized via an onclick.
When they are shown, in IE 6 and 7, when you click inside any text inputs (input type text or textarea) the cursor flickers sporadically.
Of note also, when I hover over the overlay using the developer toolbar, the "blue border" flickers like mad as well.
I'm figuring this is a redraw issue (due to the flickering) but I cannot figure out for the life of me why it's a redraw issue (unless the jQuery UI library is giving faulty math, as this is my next step, I'm hoping SO can cut down on my debugging and tell me I'm an idiot or say I'm on the right track).
Comment: Can you please provide the javascript code that is initializing the overlay?
Answer: Needs more specifics but perhaps try changing your css so that the element has cursor: text; ..http://www.w3schools.com/css/pr_class_cursor.asp

IE flickering input in jQuery overlay


Poincaré's last geometric theorem

Question: Which problem in celestial mechanics led Poincaré to his conjecture about fixed points of area preserving maps of the annulus to itself? I believe he was working on some differential equations. What was the problem and what was the differential equations he was working on?
Answer: Poincaré was studying the circular restricted three-body problem, where two bodies in a binary system revolve around their barycenter and a third test mass moves in some orbit around them. Birkhoff acknowledges this in his proof of the theorem, Proof of Poincaré's Geometric Theorem. Specifically, Poincaré was looking to prove that this third body may have periodic orbits.
John Franks is quoted in Steve Nadis' A History in Sum as describing the annulus as "a two-dimensional slice of three-dimensional space". If a planet moves from a point on the annulus to the rest of the space and then back, this must be a fixed point, and there must therefore be periodicity. In fact, Poincaré's theorem states that if there is one such point there must be a second point; one of the two describes the third body.
Poincaré was not considering any differential equations, but instead the Jacobi integral $C_J$, which here takes the form
$$C_J=-\frac{2H}{m}=-\left(\dot{x}^2+\dot{y}^2\right)+\left(x^2+y^2\right)+2\left(\frac{1-\mu}{r_1}+\frac{\mu}{r_2}\right)$$
for Hamiltonian $H$, test mass $m$, coordinates $(x,y)$, masses of main bodies $1-\mu$ and $\mu$, and distances to those bodies $r_1$ and $r_2$.

Poincaré's last geometric theorem


Does Azerbaijan charge customs on personal perfume collection

Question: I am currently living in Malaysia and will move to Azerbaijan, but I have a perfume collection of over 60 perfumes and raw materials as I am a collector and I do this as a hobby, will Azerbaijan customs stop me at the airport and charge me customs?
Comment: Because this is long-term relocation, not short-term travel, this question should be moved to [Expatriates](https://expatriates.stackexchange.com).
Comment: How long might you stay in Azerbaijan?
Comment: @DavidSupportsMonica Im going for work so probably over a year
Comment: @DavidSupportsMonica thanks i will post it there
Answer: From information for travellers page of the Azerbaijani custom, we can find "Fiziki şəxslər üçün ümumi məlumat" (general information for individuals) pdf. Section 1.2 says, (my translation)

1.2. The usage purpose of goods crossing the customs border by individuals shall be determined by the customs authorities on the basis of their properties, quantity, as well as the regularity of crossing the border, taking into account all cases of the individual's visit. An individual shall have the right to move 2 (two) identical and (or) same-kind goods across the customs border without paying customs duties within the limits established by sub-item 2.2 for the purposes of personal use and consumption by himself and his family members. If the quantity of identical and (or) homogeneous goods crossing the customs border by an individual exceeds 2, the quantity of goods crossing the customs border without payment of customs duties shall be determined by the customs authorities on the basis of the features specified in this paragraph. Customs payments shall be made for the same and (or) homogeneous goods sold in excess of the specified amount, without taking into account the limits provided for in sub-items 2.2 and 2.4.

2.2. Limit of 800$ for one person for each calendar month when carrying stuff himself.

2.4. Limit of 300$ for one person for each calendar month when delivering via post.

So, in your case you have 60 perfumes. If custom officials determine that

a) your have no more than 2 identical/same-kind items, and

b) you can present a cheque showing that their total value is less than 800$

then you won't pay any custom taxes. But I wouldn't rely on custom officials, aka the bandits, agree with both a and b. I mean why would they? Their literal job is to steal your stuff and moni. You need to convince them somehow that non of your perfumes are for commercial use but I don't know how, given that they have identical/same-kind clause.
So, all the perfumes that they deem to be for commercial use, they will tax. Oh, and they will tax a lot. Here our thieving custom "service" has a page in english (wow!) that shows how much. Under "Essential oils and resinoids; perfumery, cosmetic or toilet preparations" → "Perfumes and toilet waters" → "perfumes", you can see 15% import tax + 18% vat.
I'm rooting for you so that you don't pay any custom taxes to our government (or any government in general). So, good luck.
Comment: Note that most countries have *different* rules for people who are moving to a country than they do for regular travellers.
Comment: Azerbaijan isn't one of those. But since "regularity of crossing the border" is also mentioned, maybe OP can build their case accordingly. Bottom line, you're at the mercy of the bandits.
Comment: I am living in azerbijan and yes I can confirm that you have to pay around 33% on what's on top of your limit, one question tho are the perfumes new or used , are they on package or opened ?
Comment: @MadyanMalfi the perfumes are all used and opened except for 1 which is still sealed
Comment: aha I think you have better luck since they are opened, @gdrt maybe can give you more info as I cant understand azerbaijani.
Comment: Yeah, that probably increases the chances.
Answer: It is mostly not based on the number of bottles but the amount (often mentioned in centiliters rather than liters) which you can import without having to pay tax on it.
Waiting till you pass through immigration and customs and only then find out what you can bring and how much you need to pay on the extra is not right. The worst will be going through 'nothing to declare' and selected for further inspection, as it is likely that you will have to pay a fine as well as not being allowed to bring any into the country.
If you declare it at entering the country you may still not be allowed to bring it in, you will not be fined on top of it. But as you do want to keep your collection it is still not be the best way of handling. It is well possible that you 'just pay the taxes' and are allowed to bring the parfum and ingredients in, but that amount of tax may be a lot if you have a lot. An other problem might be that the officers on duty do not have the right knowledge and my delay you or your collection and you may have to return on an other day to handle the rest of it.
If you have more than the allowed free amount, best search for how to import them officially and how to pay the required taxes on that load. It might be that sending by a courier or package company is better than keeping it in your luggage while flying.
I do not have numbers for you but this was getting too long for 'just a comment'.
As @jcaron points out in a comment, if the right procedures are followed, by moving countries you have different rules and costs/taxes as visitors and returning from travel citizens.
Comment: Note that OP is actually moving to the country, not visiting or returning. There are usually substantial exemptions  in that case, **provided the correct procedures have been followed**.


Can you determine where a pillager captain spawns in a pillager outpost?

Question: AFAIK they spawn on the top level of a pillager outpost all the time (not 100% sure). But is there maybe a single spot where he "respawns"? This doesn't seem to be tackled in any of the wikis.
Answer: According to Minecraft wiki:

Both regular pillagers and pillager captains can continuously spawn around the structure.
In Bedrock Edition, they spawn at or below a particular location in the outpost; specifically, they choose the northwest corner of the highest opaque block with a non-solid block on top.


Do extension tubes enhance magnification on a 105mm macro lens?

Question: I have a Nikon 105mm macro VR lens and I am quite happy with it. This is a true macro and gives me 1:1 magnification. If I put an extension tube with this macro lens, will the image magnification increase? I am asking this question because most of the manuals of extension tubes details only for 50mm lens.
Comment: It's worth noting that the 105 VR will accept teleconverters, which will also let you increase magnification.
Answer: Well, the principle of extension tubes it to shift the focussing distance range closer : just for the sake of example, instead of say [1m, infinity] you'd get [0.5m, 5m] (because you're shifting the focal plane of your lens farther away of the imaging plane - sensor or film -, but I won't dwell on the optics/maths | EDIT : actually already available here on Photo.SE).
So you can put your lens closer than its "normal" minimum focussing distance, therefore you'll get a higher than 1:1 magnification.
However, there are some points to note (possible issues... or not ?) :

depending on the length of the tube you'll lose some light in the process, around 1 stop for ~12mm, 2 stops for ~20mm.
the depth of field is reduced also, because you're closer to your subject (if at the same aperture), getting your subject in focus might become tricky (without specific/heavy/inconvenient gear)
the gain of minimum focussing distance effect decreases as the focal length increases (less "efficient" on 100mm than on say 50mm)
you risk blurring because of camera movement (even very small movement at high magnification ratio, even on a tripod)
you risk squishing your subject (if it's an insect) because the distance between your front lens and subject becomes smaller (and see Nick Miners's comment below)
on a low quality (low price) tube you may lose AF (although it doesn't really matter for macro...), aperture because the lens contacts are not passed through
although no additional glass is involved, using the lens to focus closer than it was intended can degrade iamge quality
Comment: Although the front element on the Nikon lens doesn't extend, it should be noted that on some macro lenses (e.g. those from Sigma) the lens gets considerably longer when close-focusing, so adding an extension tube may push the front element out further than the focusing distance. Something to be aware of.
Comment: @NickMiners I have never seen this issue, but that's an excellent point !


Set Specific Record as default in Record Choice Set in Flow

Question: My flow starts by searching for a specific contact, then on the next screen there is a multi select picklist which lists all of the contacts at the account of the first contact. The thing is, I want to have the initial contact that was searched for selected as a default option, and then the user can select more contacts if they need to. But with the record choice set there isn't a way to select a specific record from within the set. Is there a good way to get around this?
Answer: Yes, you need to first make sure the contact doesn't show up in the record choice set, then create a separate choice for your record and add it to the picklist and make it default.
The first contact you are search for name {!varContact}.
When defining the Record Choice Set, you can make it include Contacts where AccountId = {!varContact.AccountId} and Id Does Not Equal {!varContact.Id}. This makes it so that the original contact is not in the record choice set.
Then create a new choice and use {!varContact.Name} and {!varContact.Id} or whatever else you want as the label and value. Add this new choice to the list of choices in the multi select picklist and you will be able to make this one default.


GPU memory consumption and inference time is higher for first inference

Question: It is noticed that gpu memory consumption and inference time is much higher for first inference than subsequent inferences. I have set batch size = 1. E.g. Performing inference on 9 samples is giving this inference time and memory consumption. For memory consumption I reset peak memory stats at every iteration of dataloader and use max memory allocated after the inference to get the gpu memory consumption for each inference. For inference time, I simply use time library and get the difference of start and end time.
Here is the code snippet:
    with torch.no_grad():
        for shape_index, (file_path) in enumerate(tqdm(dataset.file_paths, desc='eval', ncols=0)):

            torch.cuda.empty_cache()
            torch.cuda.reset_peak_memory_stats()

            data = np.loadtxt(file_path).astype(np.float32)
            start_time = time.time()

            # model inference
            inputs = torch.from_numpy(data).float().to(configs.device)
            vote_confidences = F.softmax(model(inputs), dim=1)

            time_consumption = (time.time() - start_time)
            memory_consumption = (torch.cuda.max_memory_allocated())

Here are the inference time and memory consumption.
memory_consumption: [10448984064, 1206454272, 1206454272, 1206454272, 1206454272, 1206454272, 1206454272, 1206454272, 1206454272]
time_consumption: [4.7059266567230225, 0.8842918872833252, 0.9028427600860596, 0.8580131530761719, 0.862271785736084, 0.8550527095794678, 0.8648409843444824, 0.8601820468902588, 0.8670477867126465]
Is there any specific reason for this observation?
Many thanks
Answer: that's completely normal. During the first inference or forward pass your GPU has to allocate the necessary buffer memory for each output Tensor at each level (which costs time).


How to query the video ram size of a ATI card on Linux?

Question: I want to know the physical video ram size in my application. I can get the same information of Nvidia card by using "nvidia-settings -q -t VideoRam".
I can use amdcccle to find this information, but it's an GUI app, so can't be used in my application. I wonder if there is a way to get this by command, function, or config file?
I'm using RHEL 5.4.
Hi, I can't get any information about my video card through dmidecode.
The output of lspci:
40:00.0 VGA compatible controller: ATI Technologies Inc Unknown device 68d8 (prog-if 00 [VGA controller])
    Subsystem: PC Partner Limited Unknown device e151
    Flags: bus master, fast devsel, latency 0, IRQ 130
    Memory at c0000000 (64-bit, prefetchable) [size=256M]
    Memory at d0400000 (64-bit, non-prefetchable) [size=128K]
    I/O ports at 1000 [size=256]
    [virtual] Expansion ROM at d0000000 [disabled] [size=128K]
    Capabilities: [50] Power Management version 3
    Capabilities: [58] Express Legacy Endpoint IRQ 0
    Capabilities: [a0] Message Signalled Interrupts: 64bit+ Queue=0/0 Enable+
    Capabilities: [100] Unknown (11)
    Capabilities: [150] Advanced Error Reporting

But my card have 1G video Ram on it, so the result here seems incorrect.
Answer: Untested for now, but parsing the output from querying dmidecode may yield the results you are looking for.
Another option would be parsing the output of lspci.


Integral of Bessel function of a square root

Question: Any idea how to calculate the following integral?
$$
\int_0^{2\pi} K_1\left(\sqrt{r^2+r'^2-2rr'\cos\theta}\right)d\theta
$$
This integral appears when using perturbation theory for the electron-electron interaction in cylindrical coordinates, and should have been addressed by someone in the literature, but somehow I cannot manage to find anything related. Any ideas?
Thanks!
Answer: Leafing through Gradshteyn & Rizhik, I found 6.684:
$$
\int_0^\pi (\sin x)^{2\nu}
\frac{J_\nu\big(\sqrt{\alpha^2+\beta^2-2\alpha\beta\cos x}\;\big)}
{\big(\sqrt{\alpha^2+\beta^2-2\alpha\beta\cos x}\;\big)^\nu} \;dx
= 2^\nu\sqrt{\pi}\;\Gamma\left(\nu+\frac{1}{2}\right)
\frac{J_\nu(\alpha)}{\alpha^\nu}\;\frac{J_\nu(\beta)}{\beta^\nu}
$$
and something similar with $Y_\nu$.
But that doesn't seem to help with yours.


Ubuntu Default language midnight commander

Question: Please help me to change default language in midnight commander from ru to en, now, to start mc in english i have to write LANG=en_EN.UTF-8 mc in terminal, but it's too long, i want mc in english by mc ty:)
Answer: From ru.stackoverflow.com in russian
Try to make alias like:
alias mc='LANG=en_EN.UTF-8 mc'

Author says not a best way, but helped
Also you need  source ~./bashrc or logout to apply changes
Comment: It's always a good idea to append `$*` at the end of an alias, i.e. — `alias mc='LANG=en_EN.UTF-8 mc $*'` in case you want to pass the arguments to the process, then it will still work as expected for example when you call `mc ~/bin`.
Comment: @ccpizza No need for that `$*`, aliases forward the arguments anyway. And even if they didn't, `"$@"` (double quotes and dollar-at) would be the only correct way of forwarding them even in presence of embedded spaces.
Answer: I stumbled over this thread trying to change my Midnight Commander on macOS Sierra away from French and since macOS is unix and since using an alias did not really suit me, this is what I added to my ~/.bashrc:
export LANG="en_EN.UTF-8"

then I sourced .bashrc and all was well (i.e. ran source ~/.bashrc in the terminal).
Please note that this might affect other applications as well. But I have not discovered any - in any case that is exactly what I want. Further note that I have only tested this on a mac, yet it should work just as well on Ubuntu or other *nix's.
Answer: This is good answer, yet there's no clear reason why MC uses other than English in my case. I noticed it happens whenever I have another language in Systems Preferences -> Language & Region -> Preferred languages, even if English is set to Primary.


How is ATC handed for private rural airstrips?

Question: In rural Australia there are farms that have private airstrips. My question is when an aircraft wishes to land at such a strip (for example a flying doctor) who handles the landing aspects of ATC.  Things such as reporting on wind speed and direction, air pressure, ensuring that the strip is clear, advising on glide slope?
Comment: Welcome to aviation.SE! [This question](https://aviation.stackexchange.com/q/35576/62) might help, it isn't specific to Australia but it's fairly general. If you're new to the site, the [tour] might also be helpful.
Answer: I can't speak for Australia, but in the United States there are thousands of uncontrolled airports throughout the country, both privately and publicly operated.  Larger, better equipped public uncontrolled airports have good facilities such as paved runways and taxiways, instrument approaches, automated weather reporting stations, pilot controlled airport lighting, FBOs, fuel and maintenance depots, etc. but many uncontrolled airports are simply grass, gravel or dirt strips with little or no facilities, particularly in back country or mountainous areas.
Typically the decision to go into these kinds of airports is at the pilot's discretion and the pilot alone must make the final call as to whether they can safely take off and land at these locations.  Bush pilots departing from said locations will typically carry small handheld weather stations used by mountaineers for determining local atmospheric conditions, winds, etc.  Remote airports will use a standard left hand traffic pattern flown at 1000' AGL, but many do not due to nearby terrain and are one way in/out.  If a CTAF is not published for the airport, pilots will use the MULTICOM frequency of 122.9 MHz to announce their position and intentions.
Condition of the airport and runway are often not monitored and it is up to the pilot to determine if they can be used.  Arriving traffic will often make a low, slow pass over the airfield to determine runway condition and look for obstacles which could impede landing.
All types of aircraft can and do use such airports but most often the aircraft operating from them are specially build bush aircraft with good STOL flight characteristics plus beefy landing gear and tires for operating from unpaved strips or off field operations.
Comment: I can speak for Australia and can say that these procedures are almost exactly the same here, except FBOs are virtually unheard of. You've got to do everything yourself.
Answer: There is very little air traffic control for such airstrips* precisely because there is very little traffic.  Even a popular semi-backcountry strip, say Smiley Creek in Idaho, might see a dozen or two planes on a summer weekend.  You just use your eyes, and monitor the CTAF and announce your intentions.  Other places I might land and camp for several days without seeing another plane.
As far as weather &c goes, it's pretty much seat of the pants.  You look at the wind sock if there is one, or other indicators such as sideways drift when you try to fly a straight course - say when you're making a low pass over the runway to check on condition, and scare deer, cows, antelope, or whatever.  (Probably kangaroos in Australia :-))  Then you make a judgement call as to whether you can handle it or not.
As for glide slope, if you're flying a light plane in VFR conditions, you eyeball it. Larger but still uncontrolled may have luxuries like VASI/PAPI, or even pilot-controlled runway lights for night landings, but smaller strips don't.
*At least in the US: I'm not familiar with Australia, but don't see any reason why it should be different.
Comment: `As far as weather &c goes` typo?
Comment: @kevin nope, just an older way of [writing "etc."](https://en.wiktionary.org/wiki/%26c.)
Comment: @FreeMan: Not so much older, but one that frustrates simple-minded typesetting algorithms that can't tell the difference between the period of an abbreviation, and the one at the end of the sentence.
Comment: Pardon me, "more obscure". :) Your point is excellent, however, about avoiding the autocorrect autocapitalizing the word after an abbreviation - I hadn't thought of that one. I don't often text "etc", but I will use "&c" from now on (when I remember) to avoid that minor annoyance. (Or, I'll just skip the period as I did there without realizing it.)


Automated Shutdown through Batch File

Question: so Im administering 100 desktop PCs at a local university in the pacific (dot in the map) and my boss has told me to write a script to carry out an automated shutdown of all computers at 10pm. I've created a batch file with the "shutdown /s" command but the only automated solution I have found so far is Task Scheduler and honestly doing the Task Scheduler settings on every computer is not very feasible. Is there any other more efficient way to write a script with scheduled configs to run the bat file. Sorry if this sounds very simple to you all or maybe Im posting in the wrong group or if this is a duplicate, please point me towards the right direction. Solutions are very welcome.
Answer: Can you not use the /m switch on shutdown to remotely invoke this in a loop of the machines you want to shutdown, something like
for /F "tokens=*" %%A in (names.txt) do shutdown /m \\%%A /s

where yourfile.txt just contains the machine names. You'd need to be on a domain and have admin rights on the machines though. Then invoke this from task scheduler on a machine still running at 10pm using your credentials
You could accomplish the same in PowerShell via piping Get-ADComputer [some filter string here to find your machines] | invoke-Command { shutdown /s}
These both assume you are on a domain.

Automated Shutdown through Batch File


Why does the tank circuit of a Colpitts oscillator produce 180° phase shift?

Question: I would like to understand how a Colpitts oscillator works. This link says that the tank circuit of a Colpitts oscillator produces 180° phase shift. I don't understand how a combination of a coil and two capacitors produces a 180° phase shift. Would you explain it, please?
Comment: Are your two questions somehow related to each other? If they are, could you make the connection more clear? If they aren't, please post the second one as a separate question.
Comment: The two questions was related to each other but I deleted the second question to prevent confusion. I will know the answer of it, if the first question is answered.
Answer: You must discriminate between Colpitts oscillators in common base or common emitter configuration, respectively. And - most important - you must realize that the LC tank contains a capacitive divider circuit.
The mid point between the two capacitors is either grounded (common base) or is connected to the base node (common emitter). In the first case (common base without signal inversion) the LC tank - indeed - produces 360° phase shift and this signal is fed back to the emitter.
In the second case (common emitter with signal inversion) the frequency dependent circuitry could be seen as a third order low-pass that consists of an first order RC low-pass followed by an LC low-pass. Such a third-order low-pass produces 180° phase shift at the desired frequency. The remaining 180° are produced by the inverting characteristic of the common emitter amplifier (between base and collector).
(Comment: The first RC lowpass function is produced with the help of the finite output resistance at the collector node. For op-amp realizations (zero output resistance) you must, therefore, add a an additional resistor. Sometimes, this resistor is forgotten in in some papers).
Answer: You have two caps in series + in parallel with the inductor so that gives you an overall phase shift of 360 deg / 0 deg (whatever you wish). The transistor is common emitter which means the output is 180 deg. out of phase in relation to its input.
Comment: But you didn`t mention in your answer any additional 180deg phase shift (You only spoke about 360deg). As I have explained in my answer - there is a third-order lowpass producing additional 180deg.
Comment: In total, this would result in a phase shift of 180 deg. - and the circuit would NOT be able to oscillate.
Comment: @LvW ?!? The common emitter's output is 180 deg. out of phase and the additional phase shift resulting in the capacitors || inductor contributes an extra 180 deg. needed for oscillation.
Answer: There is an easy way to understand.

from the view of complex impedance.
To resonate, the total impedance of inductor and capacitors must be 0.
Let's assume C1 = C2 = -j100, L1 = +j200. According to the impedance division concept, Vout = Vin*(Z_C1)/(Z_C1+Z_L1) = Vin*(-j100)/(-j100+j200) = Vin*(-j100)/(+j100) = Vin*(-1)
=>Vout = -Vin. This means the LC tank circuit provide 180 degrees phase shift with amplitude remaining the same.
However, in this case, we assume 0 source output impedance and infinite load impedance. Therefore, real condition will be different but close to the result.
Answer: This is a good question. A CLC pi filter driven by an ideal voltage source will approach a 180 degree phase shift, but will never reach 180 degrees.

simulate this circuit – Schematic created using CircuitLab
(This simulation has a 100 mOhm resistance in the inductor. Otherwise the simulation gets "too close" to 180 degree phase shift for the difference to be noticeable.) Here is the frequency response.

So, how does the PI network in a Colpitts oscillator provide 180 degree phase shift? The answer is in the output impedance of the circuit driving the PI network. If we modify our model by providing a resistor between the voltage source and C1, we have an RC low pass network cascaded into a LC network, like so.

simulate this circuit
With the added input resistance to our PI network, we can clearly see the phase shift crossing the -180 degree line.

Note that the frequency where the phase shift crosses over the -180 degree line is higher than the resonant frequency given by the values of L, C1, and C2. Usually, the formula given for the oscillation frequency of a Colpitts oscillator is the approximation:
$$f = \frac{1}{2 \pi \sqrt{LC_T}}$$
where \$C_T\$ is the "total" capacitance, given by
$$C_T = \frac{C_1 C_2}{C_1 + C_2}$$
This formula gives the natural resonant frequency of the PI network in isolation. However, because there is a "hidden" RC filter, the actual oscillation frequency of the Colpitts oscillator will be somewhat higher than given by the above formula.
Comment: This becomes most evident when Rs and RL are both greater than Zo = sqrt(2L/C), where the network resonates with a modest or higher Q factor.  (The transfer function will have a more symmetrical phase response, and a strong amplitude peak.  For the most subtle case, of a lowpass filter of desired response, the coefficients (L and C, relative to Lo = Zo / (2 pi Fo) and Co = 1 / (2 pi Zo Fo)) depend on the ratio Rs/RL and desired sharpness of the response (i.e. Butterworth, Chebyshev, etc.).)


Cannot convert type via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion

Question: class SessionHelpers
{
    public static trnUser CurrentSessionUser
    {
        get
        {
            return HttpContext.Current.Session as trnUser;
        }
    }
}

Comment: I'd have expected you to access something *within* the `Session` object, rather than trying to use it directly as a `trnUser`, whatever that might be.
Comment: Are you trying to cast http session to your custom object !! Or want to retrieve an object from the session ?
Comment: Hint: [`HttpContext.Current.Session`](https://msdn.microsoft.com/en-us/library/system.web.httpcontext.session%28v=vs.110%29.aspx) returns a [`HttpSessionState`](https://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate%28v=vs.110%29.aspx), and unless you have an implicit conversion operator from a `HttpSessionState` to `trnUser`, that won't work.
Answer: error is because of the code line HttpContext.Current.Session as trnUser and it's pretty self explanatory which is telling that there is no relation between HttpContext.Current.Session and your custom composite type trnUser and so you just can't perform a casting operation between them.
Comment: What if there's an implicit conversion operator?
Comment: @WaiHaLee, that's a speculation/assumption made by you cause none is mentioned in OP. even there is way to bypass the compilation error and cast it by means of casting it to `object` first like `(HttpContext.Current.Session as object) as trnUser` but that won't be fruitful


How to place author's name below her/his text?

Question: Is there an elegant way to place the name of an author blow her/his poem or text (in an anthology of different authors)? The name should be flushed right, have vertical space (e.g. 1em), should not be break over pages and should not be a widow (last paragraph of the text and the author's name should keep together).
Answer: You don't say how you are typesetting the poems, but the verse package includes the following suggestion for attributing the author :
\newcommand{\attrib}[1]{%
  \nopagebreak{\raggedleft\footnotesize #1\par}}

This prevents a page break and typesets the author name flushright, in footnote size.
It is used as \attrib{The author} immeadiately after the verse. You might want to remove the \footnotesize.
Widows may not be a problem.  But to avoid widows generally, the first approach is to do something like
\widowpenalty=300

or some larger value (up to 10000, usually too severe, the standard value in the article class is 150).  This can be localised to a part of the document by enclosing the relevant section (including paragraph endings) in brackets { ... }, or by switching backwards and forwards between different values.  You can see the standard value in your class by writing \showthe\widowpenalty and reading the infomation this prints in the .log file.
Addendum The above will not give surefire solution though.  It only suggests to LaTeX that breaks in these places are not to be prefereed.  A good discussion of keeping things on one page can be found in the TeX FAQ.  If you can package you poem with attribution in to a minipage, that will work well.  The FAQ has discussion of the samepage environment of LaTeX, which is not infallible, and the use of \needspace, which requires some manual intervention to count a relevant number of lines.
Addendum 2 Experimenting shows that the suggested code works best inside the verse environment e.g. as
end of poem\\*
\attrib{The Poet}

and the macro definition can include vertical spacing:
\newcommand{\attrib}[1]{%
  \vskip2ex\nopagebreak{\raggedleft\footnotesize #1\par}}

The catch is that this attribution is now flush right with the poems margin.
Comment: Thanks! I use your solution. Widows could be a problem if the poem is not typeset on a single page or in the case of usual Texts – right?
Comment: Yes, the widows problem is only if the poem (including attribution) spreads on to another page.  Note the verse environment has the `\\*` line option, which also prevents line page breaks.

How to place author’s name below her/his text?


Why do people discourage using Tor with a VPN?

Question: Why do Tor experts discourage using Tor and a VPN at the same time? Is it because of the network fingerprint, latency, or that there is no point to it?
Comment: This question is likely to be answered with opinions rather than facts and citations. It should be updated so it will lead to fact-based answers.
Comment: @RomeoNinov I initially thought the same - however this is actually a bad question.  It incorrectly or naively assumes Tor experts discourage using tor and a VPN at the same time.  In fact, this iis nuanced, but can be authoritatively answered!
Comment: @davidgo, the question is very unclear and OP show no research about the subject. So my opinion is question expect opinion based answer.
Answer: I believe your premise is wrong.    In the logical case of using TOR over a VPN (ie connect a VPN, then connect to TOR through the VPN) -
https://support.torproject.org/faq/faq-5/ links to https://gitlab.torproject.org/legacy/trac/-/wikis/doc/TorPlusVPN  (ie its authorative) which has a lot more nuance and states (bolding mine):

You can very well decrease your anonymity by using VPN/SSH in addition to Tor. (Proxies are covered in an extra chapter below.) If you know what you are doing you can increase anonymity, security and privacy.
Most VPN/SSH provider log, there is a money trail, if you can't pay really anonymously. (An adversary is always going to probe the weakest link first...). A VPN/SSH acts either as a permanent entry or as a permanent exit node. This can introduce new risks while solving others.
Who's your adversary? Against a global adversary with unlimited resources more hops make passive attacks (slightly) harder but active attacks easier as you are providing more attack surface and send out more data that can be used. Against colluding Tor nodes you are safer, against blackhat hackers who target Tor client code you are safer (especially if Tor and VPN run on two different systems). If the VPN/SSH server is adversary controlled you weaken the protection provided by Tor. If the server is trustworthy you can increase the anonymity and/or privacy (depending on set up) provided by Tor.
VPN/SSH can also be used to circumvent Tor censorship (on your end by the ISP or on the service end by blocking known tor exits).

In other words the risks change, but it could be beneficial if you know what you are doing - I guess the question is do you trust your VPN or the TOR entry nodes more, and how well do you understand what VPN's, TOR and your routing stack does?
Apparently, it is possible to run a VPN over TOR - this would not be a good idea in most cases - because this would slow down your connection while quite possibly bringing more scrutiny to your traffic and giving you very little - if any benefit from using Tor.   There are a few niche cases this might be useful to get around firewalls, but by-and-large is a bad idea.
Comment: What is the difference between the times when it decreases your a/s/p and the times when it increases it?
Comment: Ot depends on the threat vector - and a lot of it is theoretical anyway- and I'm not qualified to answer this (but have some understanding) - nor (based on your question) you to understand it.   It would require a co-ordinated government level and realistically you would be screwed either way.


Irregular (branched) cover

Question: I need to know the definition of an irregular (branched) cover. I heard this somewhere but I am not able to find any definition on the internet.
Answer: According to this text, branced covering $p:Y\to X$ is called irregular, iff the covering $(Y/\textrm{Aut}\,p)\to X$ is not homeomorphism. Here $\textrm{Aut}\,p$ is the group of all homeomorphisms $Y\to Y$ over $X$.
In other words, automorphisms group acts non-transitive on the fiber of $p$.

Irregular (branched) cover


Why do Setters jump before setting the volleyball?

Question: Every time when the Setter is just about to set the ball he jumps and then sets the ball.
What is the rationale behind jumping?
Answer:
The setter is higher. That means that the way of the ball from the setter to the attacker is shorter
If the setter is frontrow he is able to score directly on second.
The setter has a wider range of the timing when he is setting the ball.
The receivers can put the ball for a perfect reception closer to the net
Answer: There are multiple good reasons:

Allows more angles and directions when setting
It helps the attacker to align himself better to the ball and the opponents field
Surprises the opponent's mid-blocker due to less predictable play


Hamachi alternatives or just the best option?

Question: Hamachi is a great way to connect behind a firewall when using Raspberry Pi, but it seems that we must pay to play now. What alternatives exist that work for a replacement? How could I set up my own version if I have access to a static IP server?
Comment: How about port forwarding and noip? That seems to be what a lot of people use.
Comment: I was just wanting to find something that I could make and control.
Answer: Depending on what you have on the static server you can use:

SSH port forwarding
Iptables port forwarding
Self-installed OpenVPN server

I'd also take a look into your internet router (ie cable modem) and check if port forwarding and DMZ options are available there. Configure your router to forward a specific port from home network or surface all ports from a specific home IP using DMZ (DMZ's security risk is higher as you expose more). Then configure "Dynamic DNS" in your router to automatically register roter's public IP in DNS using free services like dyndns.org, freedns.afraid.org or noip.com
Comment: For the router there's also the possibility to configure a DMZ, which forwards all unknown traffic to a specific device on the LAN.
Comment: Good point, Fred - added to the answer


Does the aim of enlightenment equal the aspiration of the end of all life?

Question: In my understanding suffering -- craving and aversion and all which it results in -- exists in living beings to help sustain procreation, evolution, and life. Can the ideal of all beings attaining liberation, enlightenment, and thereby ending existence, then, be equated with the aspiration of the end of all life?
Answer: It certainly seems that the cravings & aversions that result in suffering are also the instinctual or underlying tendencies ('anusaya') that exist in living beings to help sustain procreation, evolution and physical life. This seems to be why the biological life of both animals & people involve the struggle for survival, the merciless devouring of the weak, wars & emotional heartbreaks, such as mothers mourning for their lost sons, children & family members killed in war.
It may seem like a contradiction but the Buddhist way of life has its foundation in harmlessness & thus the preservation of life. Where as the biological evolutionary life that includes cravings & aversions (but which also must include love & social co-operation), as already mentioned, often demonstrates a scant respect for life.
For example, in fables for children that later appeared in cultural Buddhism, there is the story of the Buddha in a past life deliberately & compassionately feeding his body to a starving tigress (female tiger) that had just given birth to offspring. The female tigress devoured the Buddha-To-Be without a thought. This shows how the craving tigress cared less for (another) life than the cravingless Buddha-To-Be.
Therefore, the idea of attaining liberation & enlightenment cannot be equated with the aspiration to end life because the sole goal of Buddhist practise is to improve life by ending both mental suffering & animalistic cruelty. Buddhism is about spiritual/wisdom evolution rather than biological evolution.
What is called 'liberation' in Buddhism means 'liberation from suffering' (rather than liberation from life). To quote:

This unshakeable deliverance (liberation) of mind is the goal of this holy life, its heartwood and its final end (culmination). Simile of the Heartwood

To quote again:

I have been baselessly, vainly, falsely, and wrongly misrepresented by some recluses and brahmins thus: 'The recluse Gotama is one who
  leads astray; he teaches the annihilation, the destruction, the
  extermination of an existing being.' As I am not, as I do not
  proclaim, so have I been baselessly, vainly, falsely and wrongly
  misrepresented by some recluses and brahmins thus: 'The recluse Gotama
  is one who leads astray; he teaches the annihilation, the destruction,
  the extermination of an existing being.'
Monks, both formerly and now what I teach is suffering and the cessation of suffering. MN 22

To quote again:

How can a fool gain gain the human ('humane') state...when there is no conduct guided by the Dhamma, no righteous
  conduct, no wholesome activity, no meritorious activity...where there
  prevails mutual devouring, the devouring of the weak...when they have not seen the Four Noble Truths...leading to the cessation of suffering. SN 56.47

In fact, enlightenment is equal to a higher or better way of "life", which is why, as shown in the first quote above, it is called "this holy life". Dhammapada verse 21 clarifies this:

21. Heedfulness is the path to the Deathless. Heedlessness is the path to death. The heedful die not. The heedless are as if dead
  already.

This is why a synonym for enlightenment is 'The Deathless'.

The destruction of lust, hatred and delusion: this is called the final goal of the holy life. SN 45.20
The destruction of greed, hatred, and delusion: this is called the unconditioned. SN 42.1
The destruction of greed, hatred, and delusion: this is called the deathless. SN 45.7

To quote again from MN 140 about the Deathless:

By overcoming all conceivings, bhikkhu, one is called a sage at peace. And the sage at peace is not born, does not age, does not die;
  he is not shaken and does not yearn. For there is nothing present in
  him by which he might be born. Not being born, how could he age? Not
  ageing, how could he die? Not dying, how could he be shaken? Not being
  shaken, why should he yearn?

To conclude,  the ideal of attaining liberation & enlightenment cannot be equated with the aspiration to end life.
As for the ideal of all beings attaining liberation (which would probably end human life but not all life), this is only found in Mahayana Buddhism and did not exist in the original Pali Buddhism, as shown in the Uttiya Sutta. From the very beginning, the Buddha never believed all beings could reach enlightenment.

Out of compassion for beings, I surveyed the world with the eye of an Awakened One. As I did so, I saw beings with little dust in their eyes
  and those with much, those with keen faculties and those with dull,
  those with good attributes and those with bad, those easy to teach and
  those hard, some of them seeing disgrace & danger in the other world.
  MN 26
Comment: Thank you. Just two additional questions:
1) I take the Buddhist respect for life to be tantamount to "life matters, but my life does not matter, except insofar as I can do good"; like the Buddha-to-be feeding his body to the hungry tigress. How does one negotiate this point of view with the prescription to take care of oneself, otherwise one cannot help another? Would the Buddha-to-be have been able to help or save the lives more people had he remained alive, and had helping people been more valuable than saving the tigress and her cubs? Where is the line between sacrifice and suicide?
Comment: 2) "As for the ideal of all beings attaining liberation (which would probably end human life but not all life)": you mean that it would end all human and animal life?
Comment: The tigress is just a story. However, if we take the story to be true, then, in the story, the Buddha-To-Be was not enlightened. He was unenlightened & the action of feeding himself to the tigress was an unenlightened action. I just used the story to make an illustration.
Comment: 2) Buddhism will not liberate all beings. For example, today there are 7 billion people in the world and only a tiny fraction are possibly enlightened. The probability of Buddhism ending all life by making people so happy that they will not have sex is so much more lower than the probability of a nuclear war ending all life. Also, today many unenlightened non-liberated non-Buddhists choose to not have children. In summary, Buddhism will probably not be the cause that ends all life.
Answer:
Can the ideal of all beings attaining liberation, enlightenment, and thereby ending existence, then, be equated with the aspiration of the end of all life?

I think the above presupposes that this is an ideal: that all beings should be liberated. Moreover, we don't really know how life springs -- thus, perhaps it may always do so regardless if there is already life or not.
And if we consider Buddhism doctrine alone, apparently the only known "exit door", the only way out of it is nibbāna. So, another way of seeing an ideal is that, ideally, the path to the "exit door" should always be there for whatever being that comes to be to choose to finally rest.
Answer: The aspiration to end life violates the first precept and therefore cannot be right view


What is an element's "weight" when talking about "elements heavier than iron" being formed in supernovae

Question: I always hear that elements heavier than iron are formed in supernovae. But, what is taken as an element's weight? I had always believed that this meant any elements with an atomic number greater than iron [and I was happy to believe such a simple explanation]. However, I then found a graph that said Sr 38, Y 39, Zr 40, and even La 57, and Ce 58 are fused in "large stars." Some of these elements more than double iron's atomic number of 26. So, what's the deal? Is this graph wrong and I can be happy again. Is there some other measure of an element's weight? [I've already checked the atomic weight and density, at least for the first three elements mentioned, and they are all still considerably heavier than Fe in those respects as well.] Or is there something else I am missing entirely?
Comment: Generally speaking, if the pressure is sufficient to overcome the coulomb barrier of Iron, you can get Iron Nuclei fusing with other Nuclei - forming heavier than Iron.  It's a loss of energy, but there's lots of energy in the star, so the loss of energy isn't a deal breaker.   Similarly, if two Nuclei come into contact and the product is unstable, it can split into smaller nuclei.   It works similar to an equilibrium - but with more parts. - that's my layman's understanding anyway.
Comment: http://physics.stackexchange.com/q/3833/  and http://en.wikipedia.org/wiki/S-process
Comment: Reading BowlOfRed's answer, I think I have to say my answer seems to have a lot wrong. . . . oops.
Answer: The "weight" must surely refer to the atomic weight which is just the sum of the number of protons and neutrons. i.e. for Iron it is (usually) 56.
Many of the chemical elements heavier than iron are formed inside giant stars via the s-process. This is the slow neutron capture onto iron-peak seed nuclei. It is normally termed "neutron capture", but I suppose technically it is a kind of fusion since you are adding one thing to another.
We know this works because these elements can then be mixed to the photospheres of such stars and are seen in their spectra.
About half the elements heavier than iron are produced by the s-process and not in supernovae. The details of stellar nucleosynthesis, including the s-process, are all detailed quite well on this wikipedia page and following the links therein.
Comment: Link please, so we can become informed better?
Answer: In this context (as in many other contexts) the mass of a nucleus is incorrectly but very commonly also called its "weight". This is not precise, but in many cases you can just let it slide...
In this case, however, the answer to your question has not so much to do with the mass of the nucleus than with the nuclear binding energy of the nuclei.
The nuclear binding energy depends strongly on the mass of the nucleus (via the number of nucleons $A$). In good approximation it is given by the Bethe–Weizsäcker formula. This semi-empirical formula takes into account effects like the Coulomb repulsion of the protons or "surface tension" that vary with the number of protons and neutrons in the nucleus. With this formula one can make some important observations. Plotting the binding energy per nucleon against the number of nuclei on obtains the following curve

from Wikipedia's article on nuclear binding energy. One can see that for light elements the slope tends to be positive. This means that light nuclei tend to be more strongly bound after the addition of further nucleons. As a consequence, the fusion of two light nuclei releases energy.
Heavy elements, on the other hand, decrease their nuclear binding energy with the addition of further nucleons and they become more unstable. For massive nuclei it is energetically more favorable to release nuclei (via radioactivity or fission). If you want to fuse a heavy nucleus with another one you have to put energy in.
The turning point between these two regions is at Iron. It is the element with the highest binding energy per nucleon. Energetically it doesn't gain anything neither by fusing, nor by fissioning. If you start with light elements you can go to more massive elements with nuclear fusion in a star. The energy release keeps the process going. Until you reach Iron. From then on the fusion to heavier elements consumes energy and the fusion process would stop. To create elements beyond iron you need to put energy in. This happens in the enormous energy release in a supernova explosion.


Is it safe to delete the 32-bit Intel code from apps using a tool like Monolingual?

Question: Using the application Monolingual, is it safe to remove the Intel architecture on a Late 2010 MacBook Air and just leave the Intel 64-Bit architecture?
Answer: Yes, but...
You may develop problems updating certain apps as removing parts of the app using Monolingual can render the code signing of the application incorrect.
From Switcher's Blog

OS X 10.5 Leopard brings a new Code Signing security feature that helps verify the integrity of an application. Applications are signed by their creators before being distributed using their private key, and then can be verified on the customer's machine using the companies public key.

That's for third party apps. I really wouldn't tempt fate by doing this to system files.
Comment: No, it is not safe actually. Some drivers and kernel extensions still rely on them. Not to mention the odd program (like iTunes' mobiledevicehelper for example). That's for a global removal. As for the removal of independent apps, it is also not safe as it may likely break components. It also results in very little space saving.
Comment: The only thing that is really affected seems to be the Apple Firewall.


restarting apache http server without interrupting http downloads

Question: if I have large file downloads served with apache server, is there a way to restart/reload the http server(eg. with new httpd.conf update) without interrupting ongoing file downloads? or at least provide a way for clients to resume downloads?
Answer: A normal download happens in a single tcp connection, there is no 'generic' way to restart apache and maintain that single connection.
BUT if you run
apachectl -k graceful

or if you send a USR1 signal to your apache master process, then it will reload gracefully, this means that it will complete serving the requests currently in progress and then reload.
On the http protocol level it is possible to request just part of a file.
The client can send a HEAD request for the given file to the server. If the server responds with Accept-Ranges: bytes and a Content-Length header, the client can then proceed to send a GET request using a Range: bytes=... header to receive whichever part of the file it wants. The server will respond with partial content of the file and put a 206 status on its response.
Internet Explorer and Firefox are known to do this for normal downloads when you ask the browser to resume a download.
Comment: so a graceful restart will likely not cause any interruption if downloads are done via browser, right?  what about wget? would it be interrupted?
Comment: with graceful restart, downloads should not get interrupted at all, regardless of who is downloading.


Which problems led Newton to three laws of motion?

Question: How did Newton come up with the three laws of motion?
Are these laws are true of newton, or they are of Galileo.
Comment: Please read [Wikipedia's history section on Newton's laws of motion](https://en.wikipedia.org/wiki/Newton%27s_laws_of_motion#History). The first law is vaguely attributable to Galileo, the second to Huygens, and the third to Newton himself. But it is treating them as a whole and building a system of physics around them that's Newton's main contribution, even if he did not come up with a single one of them. By the way, in the original drafts [Newton had five or six laws](https://hsm.stackexchange.com/questions/2454/what-were-newtons-six-laws-of-motion).
Answer: The nature of the surviving evidence makes it hard to tell 'how Newton came up with his laws of motion':  much of the evidence is in the successive verbal formulations of Newton's successive drafts, which often don't reveal much of his background thinking. Also, in the 'Principia' the laws of motion have the alternative title 'axioms'. One of the curiosities about them is that even though in retrospect they have been recognised as a highly original compilation, Newton did not seem to claim much by way of authorship of them: thus he concluded the statement of the axioms or laws of motion with a 'scholium' beginning: 'The principles I have set forth are accepted by mathematicians and confirmed by experiments of many kinds. ....' and he went on to acknowledge work or books by Galileo, Wren, Wallis, Huygens and Mariotte. There is a body of opinion tending to the view that Newton was being unduly modest about this, and it is worth looking at R S Westfall's "Force in Newton's Physics : the science of dynamics in the seventeenth century" (1971) to see why.  It devotes chapters to detailed studies of the dynamics (or kinematics) of Galileo, Descartes and Huygens among others, as well as to Newton.
(This is the kind of question on which wikipedia is sometimes not at its strongest, better to trust the linked sources than the wp article itself, which in this case doesn't cite Westfall's work and begins by anachronistically mis-stating the laws themselves.) Better to read the laws as Newton wrote them, plus their explanatory passages, directly from 'Principia' iself, for which there's a good 1729 English translation free of copyright restrictions. The wikipedia article on the Principia (https://en.wikipedia.org/wiki/Philosophiæ_Naturalis_Principia_Mathematica) has plenty of links to different parts of it, such as (https://books.google.co.uk/books?id=Tm0FAAAAQAAJ&pg=PA19) for the laws of motion themselves, but please read on to cover the references to 'accelerative force' etc.
Answer: The problem of the motion of the planets and satellites. Moon, first of all. Also comets. To justify the inverse square law, Newton had to develop mechanics. His three laws summarize in a short, clear and elegant form what was known on mechanics. Then he could combine them with the gravitation law to compute the orbits of the planets, satellites and comets.
Comment: Dear Alexandre Eremenko, I am not aware of your and others reference for Newton's laws of motion, But there are very strong documents (like books published around 10-12 AC century) that claims that Newton's laws of motion is a word by word copy of laws of motion stated by Persian-Arab scientists. And I think the story of "Apple, gravity, satellite and etc are said for justification of Big lie.
Comment: I will appreciate if you give a reference on a 10-12 century book that "claims that Newton's law of motion is a word by word copy...". Newton was born in 17 century, so I will be really surprised to find a reference on him in 10-12 century:-)
Comment: Sure, But it is in Arabic and its expressions is hard for me to understand. I heard that Europeans about the renaissance translated all Persian-Arabic scientists books into English. probably you can find it in old and big libraries if you are interested in En-version. The book name is "Al-Isharat wa al-Tanbihat" by Ibn Sina (known as Avicenna in Europe [because, as I heard, Spaniards claim that he is a Spanish scientist!!]) You can find retyped online version in Arabic [here](https://lib.eshia.ir/73004/1/69) if you trust that it is same as its original. There, there is the first law of motion.
Comment: There are other books by other scientists that the statement of newton laws is there. if you interested I can mention their name here. but as I said these are so heavy for me to understand. [form Wiki:](https://en.wikipedia.org/wiki/Tabula_Rogeriana) *Written in Arabic and Latin and accompanied by maps, it presented the world as a sphere. It calculated the circumference to be 37,000 kilometres (22,900 mi) — an error of less than 10 percent — and it hinted at the concept of **gravity**. *
Comment: I do not believe that Newton's three laws of motion were stated in 10-12 century. If some modern scientist claims this, yes I would be interested in seeing exact reference. In the end of your remark, you mention something about "world as sphere" and even its circumference, but what relation does this have to Newton's laws of motion??
Comment: I mentioned just a hint to indicate that this was also known before Galilei, and the notion of gravity also were known but not exactly same as nowadays. in 11 AC on on one of books goes something like this: earth is like a huge magnet and heavier bodies tend to fall on the earth fasten than lighter ones.
Comment: [This](https://fa.wikipedia.org/wiki/%D8%A7%D9%84%D8%A7%D8%B4%D8%A7%D8%B1%D8%A7%D8%AA_%D9%88_%D8%A7%D9%84%D8%AA%D9%86%D8%A8%DB%8C%D9%87%D8%A7%D8%AA#/media/%D9%BE%D8%B1%D9%88%D9%86%D8%AF%D9%87:%D8%A7%D9%84%D8%A7%D8%B4%D8%A7%D8%B1%D8%A7%D8%AA_%D9%88_%D8%A7%D9%84%D8%AA%D9%86%D8%A8%DB%8C%D9%87%D8%A7%D8%AA_.tif) is the original first page of that link ("Al-Isharat wa al-Tanbihat") as you can check line by line.
Comment: https://books.google.com/books?id=RgcpOQ444vgC&lpg=PA106&dq=Ibn%20Sina%20Avicenna%20first%20law%20motion&pg=PA106#v=onepage&q=Ibn%20Sina%20Avicenna%20first%20law%20motion&f=false


Hot Neutral Wires after breaker off

Question: I'm in the U.S.  I was working on a light that is part of a 4-way switch.  The particular box I was working on was a 3-way switch with line coming in from the panel.  In the box was the black line wire, two travelers, ground, and 4 white wires all bundled up.  I turned off the circuit breaker for that particular light.  As expected the light turned off.  The black line wire was no longer hot but the 4 neutral wires were hot.  I am new to this stuff but I did not expect that.  What is going on here?  Is this normal?
Comment: Is the branch circuit in question part of a multiwire branch circuit?
Answer: It sounds like a multiwire branch circuit.
A multi wire branch circuit is when 2 breakers share a neutral.
current code requires the breakers to be handle tied or use a double pole breaker.
To find out if it is a MWBC trace the conductor back to the cable entering the box (service panel or breaker box) if a red black white and green, follow the other wire back to its breaker and turn it off to do the work (both off). These breakers should be on opposite legs or one a even number slot and the other an odd number slot and not a single tandem breaker that would overload the neutral.
Installing a handle tie or a double pole breaker eliminates this issue and the NEC has required ties for ~ 4 code cycles individual states 20 or more years.
If you have conduit there could be 2 hots for 1 white, and current code requires the wires to be bundled to make identification of the associated wires possible as you could have 4 hot and 2 white going to 4 breakers.  There is no requirement on using different colored hots in this case but most electricians do use colors to keep things straight.
Comment: Yup, yup, yup...

Hot Neutral Wires after breaker off


How to travel with large amounts of cash?

Question: I know it's required to fill FinCEN 105 for $10,000+ flying internationally. However, I was wondering about my particular situation.
I live in the US and plan to sell my art/merch in foreign countries at events/concerts when they eventually reopen post-COVID. I should fill the FinCEN form returning to the US but if I'm stopped and questioned about how I obtained the money, I would answer truthfully that I sold my art but is that something that could be deemed illegal or suspicious?
Comment: Do you have a business established (do you sell in the US as well)? Does you visa in the other country/countries allow you to operate a business there? Can you show that you paid the appropriate taxes on those overseas earnings? Those would all establish that you have a bona fide business. You are still better using appropriate international banking methods to move the money around though.
Comment: Bear in mind that you will be importing goods to other countries to sell. You will have to declare them to Customs at the time of importation and pay all applicable taxes. The Customs allowances are applicable for goods for your personal use and not goods for a commercial purposes.
Comment: Is there a specific reason to use cash? Nowadays, the normal way to conduct business is to use bank transfers, credit cards, or other digital means. Using lots of cash just raises a lot of red flags about where the money is coming from and where it's going to.
Answer: IANAL and it is best for you to confirm with a lawyer since this answer is not legal advice.
Yes and no. You are indeed allowed to bring a large amount of cash and you are obliged to disclose it. Doing so is therefore legal but the reason they ask to disclose large amounts of cash coming into the country is that this is often related to suspicious activity.
When you declare the amount, you will be thoroughly questioned and it is the custom officer who decides what proofs to ask and whether to escalate the disclosure. Bear in mind that, even if you pass through customs with minimal hassle, you are likely to be questioned every time you cross the border in the future even if you do not declare such amount on subsequent trips because this will be in your history. I know people for which this has been happening after making just one such declaration.
It is better to not fly with the actual cash and do a wire transfer. You will still be importing the same amount but there are fewer suspicions with traceable transfers than cash. An accountant should be consulted to know if you will have to pay taxes on your gains. This varies by jurisdiction but usually there is a threshold below which no tax is claimed and above that a lot of factors apply.
Comment: Note that when you import the money via wire transfer, it will be the bank doing the FinCEN declaration...
Answer: You must be prepared to justify your possession of the cash, i.e., demonstrate that the cash is the result of legal activities. Paperwork (ledgers, account books, bank statements, etc.) will be more persuasive than words. But it is impossible to predict whether whatever documents you carry will be enough to satisfy the authorities; there are too many variables.
Guessing wrong will have really bad consequences. Thus, it'd be best to not carry cash. If you guess wrong, and they think you're trying to pull the wool over their eyes, the currency could be seized by any of the border authorities you encounter.
You're much better advised to transfer funds in another manner.


Identifying commutative graded $k$-algebras

Question: Let $k$ be an algebraically closed field. We know that $k[x_1,\cdots,x_n]$, with $x_i$ algebraically independent over $k$, is a graded commutative $k$-algebra. Is it true that any graded commutative $k$-algebra can be identified as $k[x_1,\cdots,x_n]/ \mathcal{I}$, where $\mathcal{I}$ is some ideal of $k[x_1,\cdots,x_n]$?
Comment: Every commutative algebra can be made into a trivial graded algebra by defining the grade of everything to be $0$. So your conjecture is a rather strong claim; essentially it says that all commutative algebras are finitely generated.
Comment: For example $k[x_1,x_2,\ldots]$ has a natural grading by degree.
Answer: The claim is not true. For example, $k[x_1,x_2,\ldots]$ has a natural grading by degree, however there is no $n$ such that $k[x_1,x_2,\ldots]\cong k[x_1,\ldots,x_n]/I$ for an ideal $I.$
Answer: You are almost correct though : Any finitely generated commutative $k$-algebra is isomorphic to a quotient of the form $k[x_1,\ldots, x_n] / I$.
If $a_1, \ldots, a_n$ are generators for your $k$-algebra $A$, use the 1st isomorphism theorem on $k[x_1, \ldots, x_n] \to A$ which sends $1 \mapsto 1$ and $x_i \mapsto a_i$. Moreover, the grading of the quotient $k[x_1, \ldots, x_n]$ will induce a grading on $A$, which however, may not coincide with the initial grading of $A$, if there was one on $A$.
It would be interesting to see what happens, if someone can tell more about this, i.e., if every fin.gen. graded $k$-algebra is isomorphic to such a quotient.


How to get a live preview for material library?

Question: I'm a completely noob to blender, I was looking for materials in material library and found out I have to select a material and click on "preview material" to see what it's appearance is like. Is there any option to get an instant preview of the material instead of clicking on both names and preview option? I've seen some guys having materials with previews at the bottom portion of their blender window on some youtube videos! (ps I was using Keyshot, that's why I found its very disturbing to do 2 clicks and waiting for preview of each material just to find out how does it look like.)
Answer: When you press Z, you'll see the 4 viewport options (render, solid, wire, and material), select the material option and boom, you'll be able to preview your materials in the 3D viewport. You can also hold Z, hover your mouse the viewport you want to view, then let go of Z (that's a faster way if you are always quickly switching between viewports).


RDC drops at "estimating connection quality" - Terminal Server, Remote Desktop

Question: When trying to connect to our Win 2012 R2 Terminal Server via RDC, the connection process gets to the "estimating connection quality" step and just disconnects.
The Terminal Server was working all okay until the host died. We since then migrated the Terminal Server VM onto a new host, from which this issue appears to have started to happen.
Have tried re-isntalling VMWare Tools and removed then re-added the network interface but no such luck.
Also migrated a different Windows Server VM to the new host and can confirm RDC still works on that VM as expected, so i don't believe it has anything to do with the actual host..
Wondering what other trouble shooting steps i can try? (Terminal Service licensing looks all good as well)
Answer: ahh, the resolution was very easy - make sure your server time is in sync and correct!
Incorrect date & time can cause various issues, especially with servers that are talking to Active Directory.
Comment: Some explanation as to how to do this would make a better answer.


Is it possible to install solaris 11 with zfs root file system in virtual box guest?

Question: I want to test zfs file sharing capabilities using a virtual machine. Is this possible because I don't seem to get a prompt during installation to select a zfs file system.
Answer: Solaris 11 does not ask you if you want ZFS root because it has no other choice - only ZFS root is supported for Solaris 11 installs - UFS is relegated to supporting data disks only.
See Oracle Solaris 11 File System Changes for more details.
Comment: Yup, I eventually figured that out... A bit like looking for your glasses when they are on your face !


English Grammar: When+past simple

Question:
Can you please explain me how can 'shone' be after 'when' ?
Or another example. When added to a liquid,antifreeze lowers the freezing temperature of that liquid'
Comment: It is a subordinate clause in the passive voice, a shortened version of "When (it is) shone through a prism, a beam of white light beaks..."
Answer: This is best understood as ellipsis - when shone is essentially a shortened version of when it is shone, with the pronoun referring to the subject of the principle verb. You simply need to insert the appropriate pronoun and form of to be. For example:

When stood straight, I am 5'11" tall.
  When I am stood straight, I am 5'11" tall.
When hungry, the dinosaur could eat twice its own bodyweight in a day.
  When it was hungry, the dinosaur could eat twice its own bodyweight in a day.
When angry, Bob had a mad gleam in his eyes.
  When he was angry, Bob had a mad gleam in his eyes.
Answer: Not simple past but the past participle.
Compare

When eaten too quickly, ice-cream can give you "brain-freeze".

With many verbs the simple past and past participle look the same.
Answer: "Shone" here is not being used as the simple past, but rather as a perfect participle.

It shines through a prism, a beam of light breaks ...

is wrong because "when" is missing. Without the "when," the intended connection between event and result is not specified. So

It is shone through a prism, a beam of light breaks...

is wrong for the same reason.

When shines through a prism, a beam of light breaks ...

is wrong because "when" coupled with a verb forms a subordinate clause that requires a subject. We see the correct form in

When it is shone through a prism, a beam of light breaks ...

Here we have a subject, the pronoun "it" referring to "beam of light," and a verb in the present tense, namely "is shone." Verbs in the passive voice are constructed through some form of the verb "be" used as a modal plus the perfect participle of substantive verb. In that case, the tense is indicated by the modal. So "is" creates a present tense for the verb in the passive voice.
However

When shone through a prism, a beam of light breaks ...

also is correct because the participle "shone" is being used as an adjective to modify "beam of light." (Alternatively, as pointed out in another answer, it can also be interpreted as an ellipsis.)
The past perfect participle for most verbs can be used by itself to form the simple past in the active voice, with a modal to form verbs in the passive voice for any tense, and as an adjective.
EDIT: There are two subtleties that I have somewhat skipped over. One is why the passive voice is somewhat preferable to the active voice in this particular case. The other is the difficulty of explaining when an ellipsis is permitted in English. That latter reason is why I prefer interpreting the correct answer as the adjectival use of the participle. But that is a matter of pedagogical preference, nothing more.
Comment: I think you meant "shone" instead of "shown" - first word and others ;)

English Grammar: When+past simple


Axis ticks misalignment and labeling in ggplot2 using scale_y_log10()

Question: I am attempting to make a figure similar to this:

with log ticks on the y axis and not the x. I've been able to produce this with the following code:
setwd('/Users/marleyjarvis/Desktop/')
CompMero=read.csv("CompMero.csv")
library(ggplot2)
library(scales) #for the trans and format functions
attach(CompMero)

ggplot(CompMero, aes(x=station, y=Mean)) +
geom_errorbar(aes(ymin=Mean-StErr, ymax=Mean+StErr), colour="black", width=.1) +
geom_point(size=3) +
xlab("Tow station with respect to foam line and front") +
ylab(expression(paste(Mean~no~per~m^3))) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
) +
scale_x_continuous(breaks=c(1:3), labels=c("Inshore", "Foam line", "Offshore")) +
annotation_logticks(sides = "l") + #log ticks only on y!!!!
scale_y_log10(breaks = trans_breaks("log10", n=6, function(x) 10^x),
          labels = trans_format("log10", math_format(10^.x)),
          minor_breaks = log10(5) + -1:3) +
coord_fixed()

which results in the following figure output:

MY PROBLEM:
There are two things about the fig that I haven't been able to figure out how to change (despite hours of searching the docs, web, etc)

I would like the Y-axis numbering to NOT be in exponents:  i.e. I would like the y-axis labels to read "100", "1000" etc rather than "10^2", "10^3".  I've tried reading ?trans_breaks and ?trans_format and searching for math_format() syntax as well as experimenting with changing 10^.x but haven't had any luck.  I will be producing these graphs for multiple sets of data with different y-axis ranges, so I would like to write this into the code to reflect the y-data range rather than simply changing the labels to "100" "1000" etc. I hope that makes sense.
The "half-way" tick labels and outer ticks do not match up with the inside halfway ticks. In other words, the "10^2.5" label, which I'm refering to as the half-way tick between "10^2" and "10^3", has an outer tick mark that does not match up with the inner tick mark that it should.  Instead, this outer tick mark is located physically half the distance between "10^2" and "10^3", which is positionally incorrect with the inner tick marks (which I want the outer to match).  From what I understand from reading recipe 8.15 "Adding ticks for a logarithmic axis" in the R Graphics Cookbook, the minor_breaks = log10(5) + -1:3) line in my code should solve this problem, but I must be doing something wrong.  I haven't been able to figure it out.  Alternatively (and perhaps preferably for my final end product to publish) I would like to simply remove these halfway ticks and labels all together.  I'd like to learn how to do the above (line up the halfway ticks) as well though.

My sample data:
sample data: CompMero
edit: sample data is in columns with names = stationID, station, Mean, StErr
station ID: Foam line, Inshore, Offshore
station: 2, 1, 3
Mean: 3419.401, 35.56681, 70.47807
StErr: 1888.509, 11.55935, 40.04964
Thank you VERY much for any help or pointers.  I've spent quite a bit of time reading docs and help files and searching past questions and haven't been able to solve these two issues.  I'd really appreciate it if someone could point me in the right direction.
Answer: In case anyone else stumbles across this question and might benefit, I've worked out the axis labeling and got rid of those pesky "half-way" ticks that were misaligned using the following code:
ggplot(df, aes(x=station, y=Mean)) +
geom_errorbar(aes(ymin=Mean-StErr, ymax=Mean+StErr), colour="black", width=.1) +
geom_point(size=3) +
xlab(NULL) +
ylab(NULL) +
theme_bw() +
theme(
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()
) +
scale_x_continuous(expand=c(.2,0), breaks=c(1:3), labels=c("IN", "FL", "OFF")) +
annotation_logticks(sides = "l") + #log ticks only on y!!!!
scale_y_log10() +
theme(axis.text.x=element_text(size=16))+
theme(axis.text.y=element_text(size=16))