Get visitor's Optimizely A/B test and variation

Question: When I run an experiment on my website, I want to be able to find out which test and variation the current visitor sees. I can't find how to do this from the Optimizely Javascript API.
Comment: Have you checked the section of the API documentation that mentions referencing the data object? You can see the variations you are currently cookied to with optimizely.variationIdsMap and optimizely.variationNamesMap
Answer: You can get the ID of the first running experiment (assuming you have one), and then the variation index (e.g., 0, 1, 2), name, and ID:
<code>var experimentID = window['optimizely'].data.state.activeExperiments[0];
var variationIndex = window['optimizely'].data.state.variationMap[experimentID];
var variationName = window['optimizely'].data.state.variationNamesMap[experimentID];
var variationID = window['optimizely'].data.state.variationIdsMap[experimentID];
</code>
Comment: Is there any possible way to get the **actual** experiment ID?

**Actual** meaning the experiment that contains the the code that is trying to access it.
Answer: To expand on Kevin Borders' answer. It's possible that you are running more than one experiment on a page. I've included a code snippet below, demonstrating how to return an array of active variation IDs:
<code>// Return a list of active Optimizely variation IDs
function activeVariations(){

  // Multiple variations may currently be active
  var activeVariations = [];

  // Get state settings from optimizely object
  var state = window['optimizely'].data.state;

  // For each of the active experiments:
  for (var i = state.activeExperiments.length - 1; i >= 0; i--) {

    // Current experiment ID
    var experimentID = state.activeExperiments[i];

    // Current corresponding variation ID
    var variationID = state.variationIdsMap[experimentID];

    // If we have an active variation, add it to our array
    if (variationID) { activeVariations.push(variationID[0]); }
  }

  // List of active variations
  return activeVariations;
}
</code>
Comment: Is there any possible way to get the **actual** experiment ID?

**Actual** meaning the experiment that contains the the code that is trying to access it.
Comment: @SilverRingvee Can you expand on your question? Perhaps provide an example. I'd like to help, but I'm not exactly sure what you're trying to get?
Comment: For example if I try to access experiment ID in experiment Javascript. So the same function would return different ID for each each experiment that contains that function. Same should work in Variation JS as well..

I hope I explained myself better now and you can help me.
Comment: The optimizely object contains an "active experiments" key:

``optimizely.activeExperiments`` - this will return a list of all experiments currently running on the page for that visitor. Is this what you're looking for?

Source: https://help.optimizely.com/hc/en-us/articles/205670207-The-console-data-object-and-Optimizely-log
Comment: No this is not what I am looking for. I need the exact (ONLY ONE) experiment ID. Something that I can write either in Experiment JS or Variation JS and would return the value for THAT experiment ID.


How can I do an animation of an object approaching the camera?

Question: I am new to blender. I am trying to produce a small 2 second animation of an object approaching a camera and been able to modified to do it from different angles and with different objects (texture, size, shape). Thank you for the answers.
Comment: Path animation could suffice maybe but you should provide an example of what exactly you are trying to achieve in your question.
Answer: From your description, path animation comes to mind. Here is a simple example. Please clarify if this is not what you have in mind.

To set this up, add a curve object to your scene. Shift + ACurve> Bezier (or any other curve object).
Next, edit the curve to fit the path you want your object to follow as it moves toward the camera. Here is what my example above looks like from side view.

Finally, parent your object to the curve with Ctrl + P>Follow Path . By default, this will give you 100 frames. If you need to make adjustments, you can do so in the curve properties in the properties panel.

From here, Alt+A to play the animation, and  then if needed, make any necessary adjustments.


Bias of single blind journal

Question: I have submitted my manuscript to a single blind high quality journal. My idea is novel and based on an idea published in their journal. After two weeks, it got desk rejected because the data seems not interested (there is no restriction on the used data by the journal)! I have sent it to another journal and got rejected with many mistakes by the reviewers. Then, I have submitted it to double-blind journal, it got interesting comments, as the idea is excellent but not within the scope of the journal and ask me to follow their comments and submit it to another more relative journal. My paper is accepted now and got published. My question is: is single-blind bais? Do the reviewers judge the paper based on the author index or region?
Comment: What you have gone through seems normal, and that you have misjudged the quality or scope of your work with respect to a journal.   Submitting to a journal takes experience.  You need to tick all the 'boxes'; i.e., your article must look like it belongs.   It is like sending a half cooked meal to a customer, and asking the customer for comments.
Answer: The short answer to your question is that there is no way to know whether or to what extent bias was a factor in the rejections.
There is literature on the bias problem, using data on many submissions to many journals, but it would be hard to claim (and document) any single instance.
I'm glad your paper found a home.
Answer: No one can speak for all reviewers, but, at a reputable journal, that shouldn't happen. Single blind reviewing is to prevent pressure put on reviewers by authors, especially those with powerful constituencies.
You don't speak about the "quality" of the various journals, other than the first. There may have been different reasons for rejection. The first, for out of scope has nothing to do with the authors.
The bigger danger in single blind reviewing is when the author is a "friend" of the author. That should be revealed to the editor (by the reviewer) and they should probably decline the review.
Certainly, the system isn't perfect, but mostly it works as intended.

Bias of single blind journal


Orbital mechanics- 2 objects, different mass same trajectory

Question: I have a multi-ring space station built around an asteroid, but not physically connected.  Station has significantly more mass than the asteroid.
As the two approach a star and swing around it, will the station need to do anything to maintain the same relative position and trajectory to the asteroid? Will they gain the same velocity?
Comment: Suggest that this question is a better fit on Physics SE - I am not seeing the worldbuilding issue, just a physics problem.
Comment: I agree with @KerrAvon2055, this is a straight-up math problem and you'll find more people who can answer it off the top of their heads over at [physics.se] than here. You should be prepared to define the relative masses and shapes of the different components, because I can imagine that there are lower and upper limits to the ratios of mass. But, if you want to leave it be for a bit, we can see if perhaps HDE 226868, our resident celestial machinist, is around.
Answer: If the two bodies are gravitationally bound, they will follow the same trajectory as long as the tidal forces do not exceed the gravitational binding.
Just look at our planet and its moon: they have different masses but they keep following the same orbit around the Sun without any adjustment maneuver.
Answer: Your concern shouldn't be about orbiting the star - that's the easy part. You just need the centre of mass of the station-asteroid system to be at the right place moving with the right velocity.
Your concern should be about the dynamics of the station-asteroid system itself.
A ring with a body at its centre is in an unstable equilibrium, and even small perturbations will lead to the two bodies colliding. The gravitational potential of the asteroid will increase towards the centre of the ring, meaning it will want to fall towards the ring where it will collide with it. The symmetry prevents it from doing so if set up perfectly, but a passing micrometeorite will modify the potential enough that it is now slightly off the peak of the potential and will inevitably fall off it into the ring.
This is easiest to show for a ring, but similar results apply to almost any sort of enclosing structure.
A perfect sphere does not suffer from this (it has a completely flat potential within it), but maintaining a perfectly isometric distribution of mass as people move around and live there daily lives would be next to impossible.
What you're going to need are a lot of station-keeping engines attached to the station that keep the asteroid in the proper place relative to the station.
Essentially, this works the same way as an acrobat balancing a pole on their forehead. Making smaller adjustments more often takes much less energy than making large adjustment less frequently. If done well, it shouldn't have any impact on the overall orbit, just as the acrobat can take whatever path they choose whilst keeping the pole vertical.
Ships arriving and departing may make things a little trickier, so station-keeping may require good information on the mass of all ships as they arrive and leave, as well as good monitoring of their velocity so it can properly account for whatever momentum they impart when they dock (or take as they leave).
If the asteroid is orbiting the station, this isn't an issue and you're basically all clear.
Note: I have not discussed tidal forces. If the asteroid and station are orbiting each other the station-keeping necessary to keep the asteroid on the gravitational potential peak will handle that just fine; if the asteroid is orbiting the station you'd need tidal forces greater than the attraction of the asteroid to the station for it to pose a problem, at which point you don't have an asteroid orbiting the station anyway, just two bodies orbiting the star in very close orbits.
Answer: It's complicated. The issue is, any tiny drift of the asteroid relative to the ring will tend to grow.
The path a finite sized object takes in an orbit is affected by the details of its shape. These effects are somewhat smaller than the general scale of the tides. If the mass of the asteroid is not spherical, for example, it will want to follow a slightly different path. This is because the parts that are farther away from the star want to lag behind the parts that are closer.
Tides will do weird things also. The space station is based on rings. When the rings are edge-on to the star, the tide acts parallel to the plane of the ring. But as you orbit past the star it may be a challenge to keep that true. If the ring is in the same plane as the orbit you may be able avoid having tides flip the ring around. Otherwise, as you pass the star the tides will want to flip the rings around.
If the asteroid is at all "egg shaped," meaning it has one axis longer than the others, it will have a preferred direction under the effects of tides. As you orbit past the star this will change. The asteroid will tend to swing around to point at the star. As it does it will tend to have very small changes in its orbit. If it manages to get even a little off center then tides will tend to grow that larger and larger.
So what you want is to shape the asteroid to be as nearly spherical as possible. And orient the ring to be in the same plane as the orbit you are following.  And you want to make sure the asteroid is as perfectly centered as possible.
Then some tiny little correcting jets would probably still be required to adjust for the effects of solar wind. The rings probably feel a different level of that to the asteroid. Even a minute difference may off-center the asteroid. And the orbit past the star will be months giving this tiny force a long time to act. Talking about a tiny little thruster about the strength of an aerosol can.


How can I select faces by color with Python?

Question: I have imported a VRML model into Blender 2.74 with concentric shells made of polygon faces, each layer of shell is a distinct diffuse color. I am hoping to select faces by their color, then apply translucency or transparency to partly reveal the shell of another color within. I thought python would be a good approach, but when I try bpy.ops.object.select_... I don't see a method to select by color.
Answer: You don't need python here. Go to edit mode select a face with your desired color, press SHIFTG and choose Material.
Alternatively you can also choose a material in the properties editor and hit select below, to select all faces assigned to that material.
Comment: This is answering a different question than the one which was asked.
Answer: Well, I that's not the case. It's selecting the same material, not the color in a material.
What I'm saying is that assign a material to the object, and add a image node to the diffuse color of that material. and u paint on that image texture. Then, u wanna select certain color face. If do the SHIFT-G--->MATERIAL, it's actually gonna select the whole face becasue the whole face is using the same material....


Sell cc0 images

Question: Is it legal/ right if I create a texture pack of about 20 downloaded textures and 20 normal maps, and then sell it on an online store? All the textures are CC0 licensed.
Comment: Are the normal maps also under the CC0 license, along with the textures? (This may be obvious to someone with 3D modeling experience, but it is not obvious to me.)
Comment: The normal maps were generated from those images so they are also CC0
Answer: CC0 is a mechanism for an author to give up as many rights in a work as possible, in order to cause a work, virtually or actually (if possible), to enter the public domain. It either releases a work into the public domain by waiving copyright, if that is a valid action in a given jurisdiction, or else licenses the work with extremely broad permissions.
Assuming that all of the works have been validly licensed (or surrendered into the public domain, as applicable) by their copyright holders, then you may treat the work as if it were in the public domain. That means that you may include it in a collective or derivative work, and redistribute it, at cost or for free. Note, however, that someone who buys the CC0-licensed textures is also free to redistribute them further, since the same lack of restrictions applies to them as it does to you.
If you modified the CC0-licensed textures before distributing them, then you hold a copyright in your modifications in the resulting derivative work (assuming your modifications are sufficiently creative and substantial to qualify for copyright), so you could enforce copyright in that case.

Sell cc0 images


Why does the cosmic comoving horizon expand with time?

Question: Since the comoving distance is unchanged by cosmic expansion, why isn't the comoving horizon constant?
Answer: The comoving horizon (I'm used to calling it the 'particle horizon') is the furthest distance a particle can have travelled since the beginning of the Universe. The fastest a particle can travel is the speed of light, so the particle horizon is defined as $c\eta$ where $\eta$ is the conformal time:
$$\eta(a) = \int_0^a\frac{1}{a'H(a')}\frac{{\rm d}a'}{a'}$$
$a$ is the scale factor and $H$ is the Hubble parameter.
The particle horizon in comoving coordinates is always expanding because as time passes a particle moving at the speed of light always travels further. Physically how far it gets depends on the expansion history, but it must always keep moving, so in comoving coordinates the horizon expands.
Answer: The best paper to follow the different horizon descriptions I've seen is at https://arxiv.org/abs/astro-ph/0310808. It's got some very nice graphics and explanations. It was written to try to clarify the confusion about the different horizons.
It's a confusing thing, almost always, so the best thing to do is to keep a few things straight in your head.
You have the comoving distance right, if you mean the coordinate distance.  So your question is a good question. It is always fixed. Unfortunately the comoving horizon is a little confusing, best to think of it as the particle horizon, i.e., the max physical distance that we can still receive light (signals or information) from. It is the comoving coordinate distance times the scale factor. I guess it's meant to mean the horizon for the further comoving object we can see - but that still means physical distances. So though comoving distance to it is fixed, the physical distance keeps on increasing due to the expansion. It is where something is now, from which we see light it emitted. The light we see is indeed old, not what it is emitting now. Best way to think of it is to think of it as the particle horizon. See the wiki article for different horizons at https://en.m.wikipedia.org/wiki/List_of_cosmological_horizons
EDITED SLIGHTLY TO ACCOUNT FOR @Kyle Oman's comment below. The issue is a bit tricky and easily confusing. By comoving coordinate distance (now inserting the word 'coordinate' in the answer to be exact and explicit) the OP meant just exactly that. It is what in the arXiv paper referenced, in Eqs 15 and 16, they call $\Xi$. It is unchanged for two objects (like galaxies or clusters) that are comoving, i.e., moving with the Hubble flow, or the expansion of the universe. In those coordinates they are not moving. If you know their value (which we don't in an atlas say, it has to be calculated, and later in the arxiv paper it shows how), then indeed you just multiply by scale factors. See Eq. 15 in the paper. Something to watch for, is the calculation of the coordinate distance from eg it's redshift z, or other parameters - see Eq. 24 and 27. The final point to make is that Figs. 1 and  3 shows the different horizons, and particularly the particle horizon.
Comment: It sounds like you say the particle horizon = comoving distance * scale factor. It's a bit unclear what that means, and I don't think it's correct in any case.
Comment: I'll check the exact correct statement and edit.


Help with planning cut while incorporating bodybuilding and muay thai

Question: I'm eager to get rid of belly fat and love handles while building lean muscle. While I plan to maintain a calorie deficit, I'm curious about the role of cardio. Is it necessary for achieving these goals, and if so, how often should I incorporate it into my routine? Additionally, I'm planning to start practicing Muay Thai. How should I balance gym workouts and Muay Thai sessions in a week for optimal results? Just for your information I am 5'11 and 70kg right now with 28% body fat and aiming to get to 15%.
Comment: @Luciano - I meant it more like '10% is only necessary if you're a pro and working towards 6% or less.'
Comment: First question like this that I've seen with a reasonable target. People often think they need to get down to 10-12%, but that's just too low unless you're planning on actually competing in bodybuilding.
Comment: @Ethan indeed 15% is a great target for regular people, but for bodybuilding it's usually way below 10%
Answer: Do you like cardio?
That's all that matters really.
All that's necessary to lose weight is a calorie deficit, so expending more calories in a day than you consume. That can be cheived my increasing the calories going out (exercise) or decreasing the calories coming in (dieting). Physical exercise really doesn't burn as many calories as you may think, so if your priority is weight loss, focus on your diet. Exercise does have it has its advantages, building muscle increases BMR helping to keep the weight off.
If you don't enjoy cardio there's really no upside to it. Firstly, if you don't enjoy what you're doing, you're more likely to procrastinate and find excuses not to exercise. Also, some studies have shown that doing cardio increases you appetite, making you eat back the calories you have burned, if not more, thus in fact having an adverse effect on your weight loss.
Regarding how to plan your workouts, I'd recommend having 1-2 rest days a week. With weight traing the most important this is having adequate recovery time for each individual muscle group I.e. Once you train chest, wait at least 3 days to train chest again and you're all good.
Comment: "If you don't enjoy cardio there's really no upside to it." There are numerous weight-independent health benefits to cardiorespiratory fitness…
Comment: Yeah, that may have been a bad way to put it. Of course there are benefits, I just meant purely from a fat loss perspective.


Optical Activity and Quantum Mechanics

Question: Is the problem of molecular chirality been addressed completely? i.e, why one enantiomer rotates plane polarized light in one direction and the other one in the opposite direction? I would like to know whether quantum mechanics has furnished a proper explanation for this? What is the inherent property in the molecule that changes its behavior towards plane-polarized light?
Comment: The inherent property of the molecule is the chirality - since the molecule has a rotation (with handed-ness) built in to the structure, it will interact with left vs right circularly polarized beams differently. So, it interacts with plane-polarized light by rotating the polarization.
Comment: Do you know the classical case of dipole scattering a la Jackson? Calculate the expected dipole moment in the ground states of each molecule.
Answer: Yes. It boils down to the orientation-averaged polarizability of the molecule, which is a perfectly calculable property of the molecule and it has been accessible to quantum-chemistry methods for many decades.
In essence, you take the molecule in its ground state (or in some thermal ensemble, as appropriate) $|\Psi_\mathcal O\rangle$ corresponding to some orientation $\mathcal O$, you add a linearly polarized light field, you calculate the resulting time-dependent dipole moment
$$
\mathbf d_\mathcal O(t)=\langle\Psi_\mathcal O(t)|\hat{\mathbf d}|\Psi_\mathcal O(t)\rangle
$$
using first-order time-dependent perturbation theory, and then you calculate the orientation average of $\mathbf d_\mathcal O(t)$, which ─ for chiral molecules ─ can point in some other direction than the original polarization even after the orientation averaging. This can sometimes entail some heavy calculation, depending on how big your molecule is, how many electrons you want to include in the calculation, how precise you want to be, and how OK you are with taking computational shortcuts, but it is all perfectly accessible to quantum mechanics as formulated in the late 1920s and early 1930s and there is no mystery about it.
Answer: The subject was already mainstream enough in 1937 that a review appeared in Rev. Mod. Phys. [1] Here is a quick summary. The phase $\psi_r$ (resp. $\psi_l$) of a right (resp. left) circularly polarised wave after traversing a depth $d$ of the material is
$$\begin{aligned}
\psi_r &= 2\pi\nu\left(t-n_r \frac{d}{c}\right)\\
\psi_l &= 2\pi\nu\left(t-n_l \frac{d}{c}\right)
\end{aligned}$$
where the refractive indices, $n_r$ and $n_l$, are therefore different for the two polarisations. Then, one introduces the mean difference of phase $\delta = \frac{1}{2}(\psi_r - \psi_l)$: the right polarised wave is advanced by $\delta$ whereas the left polarised wave is retarded by $\delta$. The result of their superposition is then a linearly polarised wave whose plane of polarisation is turned by an angle $\delta$. The rotation per unit of path length, $\varphi=\delta/d$, is also called the rotatory power. This is the quantity to compute using Quantum Mechanics.
Assuming all molecules are in the same quantum state $a$ to simplify the exposition,
$$\varphi \propto \sum_b \frac{R_{ba}}{\nu_{ba}^2-\nu^2}$$
where $b$ is another quantum state, $\nu_{ba}$ is the frequency of the light absorbed in the transition $b\to a$, $\nu$ is the frequency of the incident light, and $R_{ba}$ is a constant. Condon shows that
$$R_{ba} = \mathop{\mathrm{Im}}\left\{\langle a|p|b\rangle\langle b|m|a\rangle\right\}$$
where $\mathrm{Im}$ stands for the imaginary part, and where $p$ and $m$ are respectively the electric and magnetic dipole moments of the molecule. Since for a molecule with an inversion center, $p=0$, only chiral molecules can lead to any effect. Since the inversion transfors $p$ into $-p$ and leaves $m$ invariant, this shows that a molecule and its enantiomer have nearly exactly opposite values for all $R_{ab}$'s, and therefore for $\varphi$. I wrote "almost" because there is theoretically a very slight difference between the quantum states of $|a\rangle$ and $|b\rangle$ for the molecule and its enantiomer, but this is not significant for the level of precision of polarisation experiments and applications.
[1] E. U. Condon. Theories of optical rotatory power. Rev. Mod. Phys., 9:432–457, Oct 1937.
Comment: I don't understand why this (correct) answer got downvoted.

Optical Activity and Quantum Mechanics


LTspice three phase rectifier simulation

Question: I am interested in creating from scratch a regulator rectifier for motorcycle. I struggle to comprehend the ground placement in the simulator. I cannot find instructions about tree phase simulation. The difference between the two is the additional ground that there is on the schematic on the right. I probed different angle phase on each so you can see clearly. In the second case each phase does not go under 0V when in the first case on the left the sine is as expected. Could you tell me how to simulate this properly as eventually when a battery, load and regulator come into play it will be a common ground with the diodes. I guess my error is in the phase representation. I hope my question is clear.
Comment: You can't have the ground point as shown in the circuit to the right, the diode will conduct right across the source during one half cycle.  Tie the three sources together in a "Y" configuration without connecting to ground, and then you can put the ground as shown in your circuit on the right.  If the simulator complains, put a 10Meg resistor from the common point of the sources to ground.
Comment: Is the generator a delta or Y configuration?
Comment: @JohnD thanks but I get similar results with this solution
Comment: @VoltageSpike It is Y configuration.
Answer: It's important to note that a rectifier's positive and negative outputs are the highest and lowest voltages from the input respectively.  That mean that the negative output isn't ground.  By grounding the negative output in the right circuit, you short any input that has a negative voltage.
You can still use the circuit on the left but you need to set the negative output as some sort of virtual ground.  Connecting the two grounds will cause a short circuit, and the two grounds will oscillate with respect to each other.  The easiest thing to do is ignore the ground from the generator, so you treat it as a delta source rather than wye.
Comment: I suspected this would be the case, it is just when the rest of the circuit is being added it becomes a mess as the measurements the simulator gives are confusing, I wish I had an actual alternator or a guinea pig motorcycle and all this would not had been necessary.
Comment: I recommend setting the negative output of the rectifier as the actual ground.  Tie the negative terminals of the three sine sources together but don't connect it to ground.  That should make the rest of the circuit a lot simpler.
Answer: The stator phases aren't grounded. They should be tied in the middle together in a wye configuration, with each phase feeding the rectifier. So replace the three grounds on your voltage sources with a single net, but don't ground it.
You effectively do that on the right-hand schematic so long as you don't also ground the (-) output of the rectifier. The left-hand one fails because you're shorting out the stator wye common to ground.
See this diagram:

From here: https://www.electrosport.com/pages/technical-resources-how-motorcycle-charging-system-works
Try a Falstad sim here: 3-phase regulator sim
Comment: Just to be on the safe side, simulation-wise, the center of the Y connection could be tied to ground through a high enough resistor, `1meg...1g` or so.
Comment: @hacktastical Thanks for the Falstad sim, this is what I need as I cannot do that with LTspice, that was exactly my problem, I know that the alternator is not connected to the ground but LTspice needs to do that, it does not have AC generators or I haven't found them, this was my question anyway: if it is possible to simulate the alternator like Falstad does. If I do the schematic in LTspice like a real Y alternator (without ground)  it does not simulate properly.
Comment: The AC sources are two-terminal, so you should be able to tie them. No need to provide a return path.


Arduino Uno power input - is 5 V at 1 A enough?

Question: I have a Arduino Uno board and phone power bank
Power bank details

Capacity - 8000 mWh
Input  - DC 5 V and 1 A
Output - DC 5 V and 1 A

Can I give the power to Arduino Uno using this power bank, through the Arduino Uno USB?
Comment: Already answered https://arduino.stackexchange.com/questions/39041/powering-an-arduino-with-more-than-5-v/39043#39043
Answer: I dont see why not - YES you can!
I regularly use usb powerbanks to power projects for testing. so long as you dont ask for too much current (unlikely but project specific) you will be fine!
Answer: Short answer:  Yes.
It depends on how you are feeding the power into the Uno and what you are trying to do with it.
My Unos use right at 0.35 amps, as measured by my USB volt/amp meter, until I begin adding things like DHT-22 temperature sensors and maybe a DS3231 RTC, then it will go up a bit.  I can generally just run from USB power.
Feeding power via USB is not a long-term solution in general, since most other USB sources are current-limited to 500 mA.  You could end up building a circuit that works fine on your power supply but not when running on just computer power.
Through testing using metered laboratory power supplies feeding into the barrel connector I am confident that 5V/1A is OK for light work.
And if you are POSITIVE that it is EXACTLY 5V then you can run it directly  into the 5V pin and avoid the regulator, which drops the voltage some.
(Of course, without the regulator you put the board at risk.)
Note that If you are trying to run an anemometer you need 9-12V for power for it.
Also, if you want to run a 432 MHz serial radio you will likely need more than 1A to make them work since they need a couple of hundred milliwatts just for the radio.  1A might work, but USB power certainly will not - (they won't even try to work with just USB power).
In any case, it sounds like you are set up nicely to fire the thing up and start programming.
Have fun!
Comment: Rendeverance , SDsolar    Thanks a lot for your information
Comment: By the way, the Uno has a really cool way of telling you if it needs more power - it quits working.  Ha!  But it won't hurt it to try.  1A should be good.


Supported codecs for .m4r file?

Question: What codecs can be used by iOS ringtone files (.m4r). I know only about AAC and ALAC, is there anything else? I can't find any official information on this question.
Answer: I dont know if this will help you at all but I use DBPower Amp Converter and batch converter for all my sounds. It has a lot of codecs to choose from not sure if this is what you need but give it a shot maybe it;ll work.

Supported codecs for .m4r file?


In US with multiple entry tourist visa. Can I go to Mexico and come back without issues?

Question: I am an Indian Citizen currently visiting US on a Multiple Entry tourist visa. I am planning a short ( 6 days) trip to Mexico and then return to US. Do I need a Mexican visa? Will there be any problem while re-entry to US?
Answer: According to Timatic, you will not need a visa for Mexico, since you already have a valid US visa.

Visa required, except for Passengers with a valid visa issued by
  Canada, Japan, USA, United Kingdom or a Schengen Member.

Will there be any problem while re-entry to US?

This shouldn't be a problem either. That's what "multiple entry" means. Of course, as a foreign national you may always be subject to some scrutiny at the US border, and you're never guaranteed to be allowed entry. However, in this case it will be your second entry on the visa, and you should not be worried. As long as you follow all rules and don't do anything to attract negative attention, there shouldn't be a problem.


Cleaning inner self-intersections

Question: I'm making a model of curved tube which have some self-intersections and wondering how to clean inner mesh in this area.
Inersect(Knife) tool with Self Intersect Source highlights the outer vertexes but they are non-closed so still need some work.
Maybe there is some semi-automatic way to clean it and leave only the outer shell?
Answer: The reason it doesn't cut clean is because this kind of curved tube has self-reverting faces in the corners :

You can fix it by using the knife, adding vertices and merging the closest vertices in those areas until you get this kind of result :

Then you should be able to select the self-intersected part of the tube with Ctrl+L :

I don't think there's any automated way to do this.

Cleaning inner self-intersections


Private members in Python

Question: How can I make methods and data members private in Python? Or doesn't Python support private members?
Comment: For anyone wondering: Guido van Rossum just explained the lack of "true" private Variables in Python: https://plus.google.com/115212051037621986145/posts/7wpbQTPRWft In a nutshell: Because practicality beats purity
Comment: See also: [What is the meaning of single and double underscore before an object name?](https://stackoverflow.com/questions/1301346/what-is-the-meaning-of-single-and-double-underscore-before-an-object-name)
Answer:
9.6. Private Variables
"Private" instance variables that
cannot be accessed except from inside
an object, don't exist in Python.
However, there is a convention that is
followed by most Python code: a name
prefixed with an underscore (e.g.
_spam) should be treated as a non-public part of the API (whether it
is a function, a method or a data
member). It should be considered an
implementation detail and subject to
change without notice.
Since there is a valid use-case for
class-private members (namely to avoid
name clashes of names with names
defined by subclasses), there is
limited support for such a mechanism,
called name mangling. Any identifier
of the form __spam (at least two
leading underscores, at most one
trailing underscore) is textually
replaced with _classname__spam, where
classname is the current class name
with leading underscore(s) stripped.
This mangling is done without regard
to the syntactic position of the
identifier, as long as it occurs
within the definition of a class.

So, for example,
class Test:
    def __private_symbol(self):
        pass
    def normal_symbol(self):
        pass

print dir(Test)

will output:
['_Test__private_symbol',
'__doc__',
'__module__',
'normal_symbol']

__private_symbol should be considered a private method, but it would still be accessible through _Test__private_symbol.
Comment: @appusajeev: don't document them. if they use them it's their problem.
Comment: "We're all adults here"
Comment: Methods that begin with one or more underscores won't be documented, i.e., they won't show up when using `help()` on the class in the interpreter. Your client could still technically use them, but it's their own problem if they do.
Comment: @appusajeev: What does "better abstraction" mean?
Comment: but what if i dont want my client to use certain methods?(ie methods that are of no concern to the client,like methods used for provding a service to a public method but is of no use being public)
Comment: @SilentGhost i was wondering if i could provide a better abstraction
Comment: @appusajeev Check this answer. http://stackoverflow.com/questions/2064202/private-members-in-python/42031894#42031894  It raises an exception if a private method is called from outside.
Comment: Official Python Built-in method `dir()` documentation: https://docs.python.org/3/library/functions.html#dir.
Answer: The other answers provide the technical details. I'd like to emphasise the difference in philosophy between Python on one hand and languages like C++/Java (which I presume you're familiar with based on your question).
The general attitude in Python (and Perl for that matter) is that the 'privacy' of an attribute is a request to the programmer rather than a barbed wire fence by the compiler/interpreter. The idea is summarised well in this mail and is often referred to as "We're all consenting adults" since it 'assumes' that the programmer is responsible enough to not meddle with the insides. The leading underscores serve as a polite message saying that the attribute is internal.
On the other hand, if you do want to access the internals for some applications (a notable example is documentation generators like pydoc), you're free to do so. Onus is on you as a programmer to know what you're doing and do it properly rather than on the language to force you do to things it's way.
Comment: "rather than on the language to force you do to things it's way."

What about indentations? :)
Comment: @BorisMilner I think the response to that would be: Indentation makes code readable and helps with understanding, so it becomes a good practice. Limiting access to members does no such thing. If anything, it goes a little bit into the opposite direction, because you'd have to state which members are private and which are not, adding visual clutter.
Answer: There are no private of any other access protection mechanisms in Python. There is a convention documented in the Python style guide for indicating to the users of your your class that they should not be accessing certain attribute.

_single_leading_underscore: weak "internal use" indicator.  E.g. from M import * does not import objects whose name starts with an underscore.
single_trailing_underscore_: used by convention to avoid conflicts with Python keyword, e.g. Tkinter.Toplevel(master, class_='ClassName')
__double_leading_underscore: when naming a class attribute, invokes name mangling (inside class FooBar, __boo becomes _FooBar__boo; see below).
Answer:
If the name of a Python function,
  class method, or attribute starts with
  (but doesn't end with) two
  underscores, it's private; everything
  else is public. Python has no concept
  of protected class methods (accessible
  only in their own class and descendant
  classes). Class methods are either
  private (accessible only in their own
  class) or public (accessible from
  anywhere).

Dive Into Python
Comment: Actually this is called name mangling and the variables do not become really private. http://docs.python.org/tutorial/classes.html#private-variables
Comment: but what if i dont want my client to use certain methods?(ie methods that are of no concern to the client,like methods used for provding a service to a public method but is of no use being public)
Comment: Then you're looking for "non-public" members, see answer by jbochi.
Answer: Python does not support privacy directly . Programmer need to know when it is safe to modify attribute from outside but anyway with python you can achieve something like private with little tricks.
Now let's see a person can put anything private to it or not.
class Person(object):

    def __priva(self):
        print "I am Private"

    def publ(self):
        print " I am public"

    def callpriva(self):
        self.__priva()

Now When we will execute :

>>> p = Person()
>>> p.publ()
 I am public
>>> p.__priva()
Traceback (most recent call last):
  File "", line 1, in
    p.__priva()
AttributeError: 'Person' object has no attribute '__priva'
#Explanation   : You can see  here we are not able to fetch that private method directly.
>>> p.callpriva()
I am Private
#Explanation  : Here we can access private method inside class

Then how someone can access that variable  ???
You can do like :

>>> p._Person__priva
I am Private

wow ,  actually if python is getting any variable starting with  double underscore are "translated" by adding a single underscore and the class name to the beginning:
Note : If you do not want this name changing but you still want to send a signal for other  objects to stay away, you can use a single initial underscore names with an initial underscore aren't imported with starred imports (from module import *)
Example :
#test.py
def hello():
    print "hello"
def _hello():
    print "Hello private"

#----------------------

#test2.py
from test import *
print hello()
print _hello()

output-->

hello
Traceback (most recent call last):
  File "", line 1, in
NameError: name '_hello' is not defined

Now if we will call _hello manually .
#test2.py
from test import _hello , hello
print hello()
print _hello()

output-->

hello
hello private

Finally  : Python doesn't really have an equivalent privacy support, although single
and double initial underscores do to some extent give you two levels of privacy
Answer: This might work:
import sys, functools

def private(member):
    @functools.wraps(member)
    def wrapper(*function_args):
      myself = member.__name__
      caller = sys._getframe(1).f_code.co_name
      if (not caller in dir(function_args[0]) and not caller is myself):
         raise Exception("%s called by %s is private"%(myself,caller))
      return member(*function_args)
    return wrapper

class test:
   def public_method(self):
      print('public method called')

   @private
   def private_method(self):
      print('private method called')

t = test()
t.public_method()
t.private_method()

Answer: This is kinda a l-o-n-g answer but I think it gets to the root of the real problem here -- scope of visibility.  Just hang in there while I slog through this!
Simply importing a module need not necessarily give the application developer access to all of its classes or methods; if I can't actually SEE the module source code how will I know what's available?  Some one (or some THING) has to tell me what I can do and explain how to use those features I'm allowed to use, otherwise the whole thing is useless to me.
Those developing higher-level abstractions based on fundamental classes and methods via imported modules are presented with a specification DOCUMENT -- NOT the actual source code.
The module spec describes all the features intended to be visible to the client developer.  When dealing with large projects and software project teams, the actual implementation of a module should ALWAYS remain hidden from those using it -- it's a blackbox with an interface to the outside world.  For OOD purists, I believe the techie terms are "decoupling" and "coherence".  The module user need only know the interface methods without being burden with the details of implementation.
A module should NEVER be changed without first changing its underlying spec document, which may require review / approval in some organizations prior to changing the code.
As hobby programmer (retired now), I start a new module with the spec doc actually written out as a giant comment block at the top of the module, this will be the part the user actually sees in the spec library. Since it's just me, I've yet to set up a library, but it would be easy enough to do.
Then I begin coding by writing the various classes and methods but without functional bodies -- just null print statements like "print()" -- just enough to allow the module to compile without syntax errors.  When this step is complete I compile the completed null-module -- this is my spec.  If I were working on a project team, I would present this spec/interface for review & commentary before proceeding with fleshing out the body.
I flesh out the bodies of each method one at a time and compile accordingly, ensuring syntax errors are fixed immediately on-the-fly. This is also a good time to start writing a temporary "main" execution section at the bottom to test each method as you code it.  When the coding/testing are complete, all of the test code is commented out until you need it again should updates become necessary.
In a real-world development team, the spec comment block would also appear in a document control library, but that's another story.   The point is:  you, as the module client, see only this spec and NOT the source code.
PS: long before the beginning of time, I worked in the defense aerospace community and we did some pretty cool stuff, but things like proprietary algorithms and sensitive systems control logic were tightly vaulted and encrypted in super-duper secure software libraries.  We had access to module / package interfaces but NOT the blackbox implementation bodies. There was a document management tool that handled all system-level designs, software specs, source code and test records -- it was all synched together.  The government had strict requirements software quality assurance standards.  Anyone remember a language called "Ada"?  That's how old I am!
Answer: PEP 8
Section "Method Names and Instance Variables" https://peps.python.org/pep-0008/#method-names-and-instance-variables

Use one leading underscore only for non-public methods and instance variables.
To avoid name clashes with subclasses, use two leading underscores to invoke Python's name mangling rules.
Python mangles these names with the class name: if class Foo has an attribute named __a, it cannot be accessed by Foo.__a. (An insistent user could still gain access by calling Foo._Foo__a.) Generally, double leading underscores should be used only to avoid name conflicts with attributes in classes designed to be subclassed.
Note: there is some controversy about the use of __names (see below).

Section "Designing for Inheritance
" https://peps.python.org/pep-0008/#designing-for-inheritance

Always decide whether a class's methods and instance variables (collectively: "attributes") should be public or non-public. If in doubt, choose non-public; it's easier to make it public later than to make a public attribute non-public.
Public attributes are those that you expect unrelated clients of your class to use, with your commitment to avoid backwards incompatible changes. Non-public attributes are those that are not intended to be used by third parties; you make no guarantees that non-public attributes won't change or even be removed.
We don't use the term "private" here, since no attribute is really private in Python (without a generally unnecessary amount of work).
Another category of attributes are those that are part of the "subclass API" (often called "protected" in other languages). Some classes are designed to be inherited from, either to extend or modify aspects of the class's behavior. When designing such a class, take care to make explicit decisions about which attributes are public, which are part of the subclass API, and which are truly only to be used by your base class.
With this in mind, here are the Pythonic guidelines:

Public attributes should have no leading underscores.

If your public attribute name collides with a reserved keyword, append a single trailing underscore to your attribute name. This is preferable to an abbreviation or corrupted spelling. (However, notwithstanding this rule, 'cls' is the preferred spelling for any variable or argument which is known to be a class, especially the first argument to a class method.)
Note 1: See the argument name recommendation above for class methods.

For simple public data attributes, it is best to expose just the attribute name, without complicated accessor/mutator methods. Keep in mind that Python provides an easy path to future enhancement, should you find that a simple data attribute needs to grow functional behavior. In that case, use properties to hide functional implementation behind simple data attribute access syntax.
Note 1: Try to keep the functional behavior side-effect free, although side-effects such as caching are generally fine.
Note 2: Avoid using properties for computationally expensive operations; the attribute notation makes the caller believe that access is (relatively) cheap.

If your class is intended to be subclassed, and you have attributes that you do not want subclasses to use, consider naming them with double leading underscores and no trailing underscores. This invokes Python's name mangling algorithm, where the name of the class is mangled into the attribute name. This helps avoid attribute name collisions should subclasses inadvertently contain attributes with the same name.
Note 1: Note that only the simple class name is used in the mangled name, so if a subclass chooses both the same class name and attribute name, you can still get name collisions.
Note 2: Name mangling can make certain uses, such as debugging and getattr(), less convenient. However the name mangling algorithm is well documented and easy to perform manually.
Note 3: Not everyone likes name mangling. Try to balance the need to avoid accidental name clashes with potential use by advanced callers.
Answer: import inspect

class Number:
    def __init__(self, value):
        self.my_private = value

    def set_private(self, value):
        self.my_private = value

    def __setattr__(self, my_private, value):
        f = inspect.stack()[1][3]
        if f not in ['__init__', 'set_private']:
            raise Exception("can't access private member-my_private")
        # the default behavior
        self.__dict__[my_private] = value

def main():
    n = Number(2)
    print(n.my_private)
    n.set_private(3)
    print(n.my_private)

if __name__ == '__main__':
    main()

Comment: It's not useful because it doesn't work.  Not only does this not create a private member, it actually doesn't work.  The constructor Number(2) doesn't work because even Number's own init function cannot set any members.
Comment: why is the answer not useful?
it will make the "my_private" member prive.
Comment: @CortAmmon you are right, I have corrected my answer
Answer: I use Python 2.7 and 3.5. I wrote this code:
class MyOBject(object):
    def __init__(self):
        self.__private_field = 10

my_object = MyOBject()
print(my_object.__private_field)

ran it and got:

AttributeError: 'MyOBject' object has no attribute '__private_field'

Please see:
https://www.tutorialsteacher.com/python/private-and-protected-access-modifiers-in-python
Comment: Value still could be accessed and  modified:
``print(my_object._MyOBject__private_field)``

Private members in Python


San Francisco Local Income Tax

Question: Reading https://www.tax-rates.org/california/san-francisco-income-tax it seems to suggest that my employer is liable to pay a 1.50% tax on my income due to me living in San Francisco despite the offices being in another location of the Bay. Will they pass down that cost to me by deducting the corresponding amount from my paycheck or is that illegal?
Comment: Probably better asked to your company's payroll dept.
Answer: The tax in question does not exist.
San Francisco does not have a local income tax. It used to have a 1.5 percent payroll tax, but that tax was repealed and replaced with a gross receipts tax in 2020.
Generally, though, an income tax is a tax on your income, and you are the only one receiving income in the transaction where your employer writes you a check.
The income tax is therefore your tax to pay, and the employer has no cost to pass down to you. It is merely obligated to withhold the tax from your paycheck and remit it to the government on your behalf, no different than the taxes that it withholds and remits to the IRS to satisfy your federal income tax obligations.
A payroll tax, on the other hand, is a tax on the employer's payroll, which the employer would not have been able to "pass down" to you, at least not directly by docking your pay. Indirectly, though, it is probably axiomatic that these taxes eventually get passed on to the employees one way or another. If the employer's costs go up, it is quite common for the employer insulate his own pay by not only increasing prices but by offering lower salaries, delaying raises, or reducing bonuses.
Comment: @A.Fenzry I can write anything in a comment and put it in quotes but that doesn't mean it's true. Please provide the source for your claim, and consider whether it's authoritative.
Comment: "The San Francisco local income tax is imposed on employers, not employees"
Comment: @A.Fenzry I've updated the answer.
Comment: bdb484, Could you please link to, or quote, a source for the fact that the SF income tax has been repealed. Also it is worth noting that something that is actually a payroll tax may be carelessly described as an income tax. This seems to have happened in the web page linked in the question.
Comment: The income tax never existed in the first place, as far as I can tell. For information on the payroll tax repeal, one can search for "Proposition E" and Proposition F."
Answer: An "income tax" is levied on employees; it may be directly withheld by employers from the employee's gross wages or may be paid directly by employees, but in either case it's the employee's money being paid, and the requirement to pay is generally based on the employee's circumstances (in particular, where they live and where they work) rather than, say, where the employer is incorporated.
A tax which is levied on employers based on how much they're paying employees, and not reflected as a deduction from gross wages, is generally referred to as a "payroll tax". However, some taxes which are deducted from the employee's gross wages, such as Medicare and Social Security contributions, are also considered "payroll taxes".
Comment: "The San Francisco local income tax is imposed on employers, not employees"
Comment: @A.Fenzry you're misreading that random, outdated web page.
Comment: so in layman terms, I'm liable for this tax myself and I need to make sure I properly pay this 1.50% tax if my company hasn't taken care of it originally?

San Francisco Local Income Tax


KDE - App activator on [Meta] key

Question: I'm using KDE now. In Unity, I could open Dash with Meta. I want to do the same in KDE - open Application Activator with Meta key, but I don't know, how. In this widget's properties I can't set it.
Answer: I don't have the Unity but this is of the Unity 2d: Is there a way to launch Unity Dash outside of Unity?
You could add those commands to the KDE Menu and assign a keyboard shortcut.
KDE Menu editor online handbook: http://docs.kde.org/development/en/kde-workspace/kmenuedit/index.html
Adding things to the K-Menu: Chapter 2. Adding a Menu Entry.
The advanced tab has the current shortcut key:

Current shortcut key:
You can assign a special keyboard shortcut to launch your program.

KDE - App activator on [Meta] key


Chromium background suddenly black - fonts low contrast and unreadable

Question: Turned off my Ubuntu 20.04.2 LTS box with Chromium Version 92.0.4515.107 and went on vacation.  When I return, the Chromium background is very dark grey, and many fonts are difficult to read as they are low contrast or the same color as the background.  Many elements don't show up unless you hover the mouse over them and they get highlighted.  Google prompt on a new Chromium tab is black,used to be white with black text, recently visited page icons on a new Chromium tab have black backgrounds behind the icons and low contrast unreadable text underneath.  None of this is a result of anything I did, as the computer was off for a week. I got no time for messing around with appearance and usually jsut leave backgrounds and themes at default.
Here is what I have tried:
Change background color by clicking on the "pencil" icon in the lower right hand corner of a new tab to Solid Colors:White.  The result is a light grey,not white, same color as many fonts, can't read many items on most pages.  Fonts don't show up unless I hover over the active element.  Same menu, change "Color and Theme" to "CLassic", this changes the tabs and top bar only not the page background.
Reload several themes using settings:appearance:themes such as classic.  These change the colors of the top bar and tabs, not the background and body of the page.
Software update wanted to update Chromium so I let it.  No difference.
Settings:Advanced:Reset Settings.  Big hassle reloading a couple of extensions and default web pages I use but no change in the colors.
Answer: Found the fix:
In the address bar, type Chrome://flags/
Force Dark Mode for Web Contents has somehow been turned on without my permission.  Disable this flag, all is back to normal.
More info here:


Cognos prompt functprompt function

Question: I'm using to paramters with following commands:
[BUSINESS VIEW].[All Business View].[STAGES] in (prompt('STAGES1','string','Arrival announced'))
and
[BUSINESS VIEW].[All Business View].[NEXTSTAGE] in (prompt('NEXTSTAGE','string','Arrival announced'))
As you see what i'm trying to do is set default value in case user didn't select one both of them are optional.
When running the report i get this error:
"XQE-DAT-0001
    Data source adapter error: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-440, SQLSTATE=42884, SQLERRMC=PROMPT;FUNCTION, DRIVER=3.63.123 - when processing query: SELECT

"COGNOS"."TERMINALNAME" AS "TERMINALNAME",
"COGNOS"."CCN" AS "CCN",
"COGNOS"."CIDENTIFICATION" AS "CIDENTIFICATION",
"COGNOS"."STAGES" AS "STAGES",
"COGNOS"."NEXTSTAGE" AS "NEXTSTAGE",
SUM("COGNOS"."TIMETAKEN") AS "TIMETAKEN"
FROM
"KAP"."COGNOS" "COGNOS"
WHERE
"COGNOS"."STAGES" IN (
prompt('STAGES1','string','Arrival announced') ) AND
"COGNOS"."NEXTSTAGE" IN (
prompt('NEXTSTAGE','string','Arrival announced') )
GROUP BY
"COGNOS"."TERMINALNAME",
"COGNOS"."CCN",
"COGNOS"."CIDENTIFICATION",
"COGNOS"."STAGES",
"COGNOS"."NEXTSTAGE"."
I keep trying all day to get to set default value to parameter in case user didn't select but didn't find a way to get it run successfully. Anyone had luck with that ?
Answer: [BUSINESS VIEW].[All Business View].[STAGES] in (#promptmany('STAGES1','string','''Arrival announced''')#)

and
[BUSINESS VIEW].[All Business View].[NEXTSTAGE] in (#promptmany('NEXTSTAGE','string','''Arrival announced''')#)

Cognos prompt functprompt function


How to derive formula from a exponential scattered plot

Question: I am doing some experiments and i got some results which i plot into a graph. The graph at small x values (x<15) gave random scatter plot but in large values more than 1000 it lookes like an negative exponential plot (similar to figure). How i can find equation for this scatter graph? can this method given in this tutorial can be used for finding equation in scatter graph?
Answer: Can you show a plot of the data? That looks like an exponential curve.
Anyway, there are a number of ways to fit $a e^{-bt}$ to data to get
values for $a$ and $b$. An easy way to start is to take the log of the
data and do a linear fit of whatever type you like
(least squares, $L_1$, ...). This can give you an initial estimate
for $a$ and $b$ which can be put into a
non-linear fitting routine to fit  $a e^{-bt}$.
If the initial data points are "bad", you can remove them when you
do the fitting.
Something I discovered many years ago (in the context of Newton's law of cooling)
 is that
if we have three equally spaced (in time) data points,
we can fit an exponential to them. Suppose the points
are $(t-d, p), (t, q), $ and $(t+d, r)$,
and we want to fit $a e^{bt}+c$ to them.
We have $a e^{bt}+c = q$,
$a e^{b(t-d)}+c = p$,
and $a e^{b(t+d)}+c = r$.
Subtracting the first two,
$q-p =a (e^{bt}-e^{b(t-d)}) =a e^{bt}(1-e^{-bd}) $.
Subtracting the last two,
$r-p =a (e^{b(t+d)}-e^{bt}) =a e^{bt}(e^{bd}-1) $.
Dividing these two,
$\frac{r-p}{q-p} = \frac{e^{bd}-1}{1-e^{-bd}}
$. Since we know $p, q, r,$ and $d$, we can solve for $b$.
We can then get $a$ and $c$.
(This is modulo any errors on my part.)


Images raster Mozambique

Question: I'm looking for a high resolution raster image for the province of Maputo in Mozambique. I need it to get the elevation and topography for the area of Moamba-RessanoGarcía.
Anyone knows any website where can I find and download this raster file?
Comment: Landsat on a clear day https://aws.amazon.com/public-data-sets/landsat/
Answer: It sounds like you're looking for a DEM.
There are several world-wide free (money, use) DEM files, including NASA's 30m resulution SRTM and JAXA's ALOS 30m (and even 12.5m) resolution.
Search for the tile/granule that covers your AOI and download it. Usually needs registration

Images raster Mozambique


UV's Changing from square to rectangular texture

Question: I want to maintain the number of pixels the UV map covers. so I used smart project and unwrapped a 20 foot cube onto the default 256 space. Then I want to open a bigger rectangular texture and move the UV's to were I actually want them mapped, but I want the UV map to stay the same size (number of pixels) and not occupy the whole texture. Can I 'freeze' or 'lock' the map so it does not resize?
Answer: The texture is mapped to the UV coordinates so that the lower left corner is on 0,0 and the upper right is at 1,1.
So if you extend your image you will need to scale the UV coordinates to match the new mapping coordinates. The scaling origin depends on how you have extended the texture. Place the cursor in the uv editor based of that and use the cursor as pivot for the scaling.
You can calculate the scaling by dividing the old texture size with the new.


How long are warrants actually kept?

Question: Are there warrants from 100 years ago? When do they assume the person dies? Does it go back to the digitization of records in the late seventies, or further back?
Comment: This varies greatly from state to state, and sometimes between courts in the same state.
Answer: The question is twofold: how long a warrent is valid for execution and then it's archivation.
Validity of warrents for execution depends on the crime, the jurisdiction and even the legal system it is under.
In western countries of bother Code Civil and Common Law origin, warrants come generally with an expiration date. This is generally given by the statue of limitations. However, this deadline can be extended for different reasons, like fleeing to a different country (which halts the statue of limitations for some crimes). Also note that some crimes, like murder, gave no statue of limitations.
Shari'ah law  has also a similar concept for the validity of claims, requiring for example that witnesses for adultery or theft need to come forth within a month of the act or the suit is dismissed. For drinking alcohol, the offender needs to still be drunk or reek of the stuff in the presence of a judge (making that possiblity the shortest statue of limitations possible with about 8-16 hours).
However, (physical) warrants issued by the court are also court documents. As such, they are to be archived and kept for posterity, for example to review the legal process. While they might be digitalized, access to them might be restricted due to privacy laws.

How long are warrants actually kept?


How can a detector distinguish between a photon and a gluon

Question:
Considering that both gluons and photons have no mass, no charge and spin 1, I was wondering how one can tell the difference, if they hit a detector after a collision at the LHC.
I know that gluons are supposed to have a color, but I have never heard, that someone measured the color. How can you measure the color of a gluon, which would certainly provide a way of telling the difference between a gluon and a photon?
Comment: Short answer: You can't measure gluons - since they are color-charged, they're confined.
Comment: http://en.wikipedia.org/wiki/Gluon#Confinement
Answer: Gluons are never found in isolation. If you had a way of directly detecting the mass, charge, and spin of particles, and detector finds something with no mass and no charge and spin 1, it's a photon, definitely not a gluon.
Besides, photons interact electromagnetically, whereas gluons don't. The way modern detectors are constructed, they typically have a silicon tracker in the center, which detects charged particles, surrounded by a layer of electromagnetic calorimeters, which detect electromagnetically interacting particles, and then a layer of hadronic calorimeters, which detect high-mass particles that weren't stopped by the EM calorimeters. Photons are the only particles that deposit energy in the electromagnetic calorimeter but don't register in the silicon tracker or the hadronic calorimeter. If gluons were able to propagate independently, they would probably barely register on any of the detector components because the strongly interacting parts, the atomic nuclei, are so small (of course, if gluons weren't confined, who knows if that would still be the case).
Answer: Indeed you cannot measure gluons, since the fact that they are color charged implies they are always confined. Thus, while photon may freely escape from the colission, gluons, like quarks, may not. That is the reason why you measure in your detectors hadronized matter, whose color content is "white".
Answer: A picture is worth a thousand words.

Three-jet event. Electronic display of an electron-positron collision in the ALEPH detector at CERN, the European particle physics laboratory near Geneva. The display shows a cross-section of the detector, with the beam tube in the centre (blue) surrounded by various detector components (blue and red). The electron and positron, accelerated to high energy in CERN's LEP collider, annihilate at centre to create a quark and an antiquark, one of which radiates a gluon (carrier of the strong nuclear force). Although too short-lived to be detected directly, the quark, antiquark, & gluon each decays into jets of hadrons that spread out through the detector.

The dark part is a Time Projection Chamber (TPC) that sees individual charged particles. This event is interpreted as a quark antiquark gluon jets. All jets are identified by the energy deposited, but further assumptions are needed to choose which is the gluon jet. The fact is that detectors measure the energy of gluon jets.
Photons, and they exist within these jets too, are identified if they deposit energy in the electromagnetic calorimeter, the first red circle, but no charged track (from the dark area) enters the detector where the energy is deposited.  The hadronic calorimeter is the second dark circle, it absorbs all the energy from hadrons.
You can see some photons on the top right and bottom left, where the TPC is dark, no charged tracks, and a signal exists in the electromagnetic calorimeter.


What does "hosts-modifier" tag in VirusTotal Intelligence means?

Question: I went through the help pages of VT and VT Intelligence, saw documentation about most tags, but couldn't find anything about the "hosts-modifier" tag, can anyone explain to me what does it mean?
Answer: It means the malware tries to modify the file named "hosts" (located inside "C:\windows\system\drivers\etc\"), in an attempt to alter the address the system will use to communicate with a specific DNS name.
For example, by adding the entry
<code>127.0.0.1   update.microsoft.com
</code>
your system will always know that the IP address for "update.microsoft.com" is "127.0.0.1", and it would not need to make requests to DNS servers for that domain address.
The DNS name he tries to put there is stated under "Behavioural information", as you may see in this example.


Can we get something on the ask question page to discourage grammar questions?

Question: The absolute number one close reason we have right now on Writers is that the question is an English grammar question which belongs on English.SE.  I know we won't have migration paths until we are a full site, but can we now, in the beta layout, get something (whether in the title box or the How to Format box) that discourages grammar questions?  Or do we have to wait for that until we've graduated?
Comment: This should also be added to the "What questions should I *not* ask here" section of the FAQ page.
Comment: Is it really such an issue closing them? How many do we have?
Comment: @John - it's not a huge issue, but appears to be becoming an issue a la the "recipe request" of SeasonedAdvice - and a bad intro for new users to the site.  I'd prefer they're warned in advance, you know?
Comment: @sjohn it was already there, and has been for at least 2 weeks, which tells you just how often that gets read.
Comment: @Jeff - Silly me, I checked the FAQ page before posting that comment...but it was the *meta* FAQ page.
Answer: Well the faq already contains this advice:

and [your question] is not about …

The strictly interpreted correctness of English grammar or syntax rules

… it is welcome here!

But, I can certainly improve the how to ask. Here's what I just changed it to:

How to Ask
Is your question about writing, copywriting, publishing or editing? If your question is about the strictly interpreted correctness of English grammar or syntax rules, please ask on English, not here. We prefer questions that can be answered, not just discussed. Provide details. Share your research. If your question is about this website, ask it on meta instead.read the faq »
Comment: thanks, that's exactly what I was hoping for - a nice, gentle reminder!


Is there an advantage to using WCF or WebAPI for mobile?

Question: I'm looking at doing my first mobile development using Mono Touch and Mono for Android.  I'd like them to communicate with an ASP.NET MVC 4 site I'm designing.  I've worked with WCF and WebAPI in the past but I'm wondering if there are any quantifiable advantages to using one over the other in this context?
Comment: Please just let WCF die.  Web api can do everything you need.
Comment: I'm not really sure that is fair to say, as Microsoft at a conference I just attended and one of there comments was to unify all the technologies.  So that the fractured fragmented nature that is present becomes irrelevant.  That way no one technology is not feasible or useable compared to another.
Answer: Here is a great article about that particular topic; hopefully this helps you out.

Is there still use for WCF? when should I choose Web APIs over WCF?
Recall my points from before - HTTP is a lot more than a transport
  protocol; use SOAP across the board and consider HTTP as no more than
  another way to pass messages.
If your intention is to create services that support special scenarios
  – one way messaging, message queues, duplex communication etc, then
  you're better of picking WCF
If you want to create services that can use fast transport channels
  when available, such as TCP, Named Pipes, or maybe even UDP (in WCF
  4.5), and you also want to support HTTP when all other transports are unavailable, then you're better off with WCF and using both SOAP-based
  bindings and the WebHttp binding.
If you want to create resource-oriented services over HTTP that can
  use the full features of HTTP – define cache control for browsers,
  versioning and concurrency using ETags, pass various content types
  such as images, documents, HTML pages etc., use URI templates to
  include Task URIs in your responses, then the new Web APIs are the
  best choice for you.
      If you want to create a multi-target service that can be used as both resource-oriented service over HTTP and as RPC-style SOAP service
  over TCP


Is there any way to get the validators signatures of the finalized blocks in substrate based chains?

Question: I need the signatures of the validators who have signed on the produced and finalized blocks.
For example, In cosmos-SDK based blockchains blocks contains the signatures(and validators addresses) of the validators who have voted on that block.
Is there some way to get this data from existing RPCs.
Answer: As for Polkadot these signatures are included in the justification, have a look at this detailed explanation. You can query this information with the RPC call -> grandpa -> proveFinality(blockNumber).


How do I slash command spawn Mobs?

Question: How do I spawn mobs via a command in Minecraft 1.5? I keep doing the command "/spawn 99 1" (Iron Golem) but I just get a message that says that it isn't a valid command. How do I do it?
Comment: Where did you learn of this command? I know this is a command in the mod Single Player Commands.
Comment: Do you have the mod for the command installed?
Comment: You can't spawn some mobs like iron golemns and snow golems, but you can make them.
Answer: That's because it isn't a command. In vanilla, or unmodded, Minecraft, there is not a way to spawn monsters or animals with commands. If you wish to spawn mobs, there are 2 options:
First:   Use unofficial mods to spawn mobs.
Second:  Use mob eggs to spawn mobs.

You can install the singleplayer mod SinglePlayerCommands then type:

/spawn  [Number of Mobs]
You can also use the common server mod "Bukkit" for spawning mobs via commands on multiplayer. Add the plugin Essentials to your bukkit server (or any other plugin that allows spawning of mobs via commands), and type
/spawnmob

In creative mode, click on the compass tab in your inventory, and scroll towards the bottom. You should see some "Spawn Eggs" with which you can use to spawn monsters; just right click a block while holding a spawn egg.

If you are in singleplayer mode but not in creative, click
Esc, Open to LAN server, Enable Cheats, then Create Server.
Type /gamemode 1          and you should be in creative mode.
Answer: If you have cheats enabled (if this is singleplayer), or if you are oped in multiplayer (vanilla multiplayer, you might have a slightly different command if you have Bukkit plugins installed), you can use /give @p 383 99 to get Iron Golem spawn eggs you can use. Hope this helps!
Comment: Does @p work outside of command blocks?
Comment: Yeah, you can use the all of the scripting features of 1.4 both in the command window and using command blocks.
Answer: Not totally sure whether this post is active at all, but with Minecraft 1.7+, you can use the /summon command to spawn in any entity you wish. The link leads to the Minecraft Wiki page for commands.
Answer: There isn't a vanilla command for spawning mobs.
You can do the following;

Install this mod. This will give you the /spawn command and much more
(Unsure about this one) Open the game as LAN game, and be sure you're in creative. Then you'll be able to use most of the commands implented in the vanilla version of minecraft.

I hope this will answer your question!
Have fun killing those creepers!
Answer: Try /mob (nameofmob) (numberofmobs) if you have WorldGuard or SinglePlayerCommands.
Answer: Originally posted by codeulike in comments:

Since 1.7 the /summon command has been added, it will spawn mobs one at a time with options like names and armour, and can be fired by a control block. See https://minecraft.wiki/w/Commands

How do I slash command spawn Mobs?


How to involve audience during a solo performance?

Question: What are the ways to involve an audience during a solo performance? And what do you do if you feel they are not interested in listening?
Comment: Would this be solo drums, vocal, piano, etc. There are some important details that need adding into your question.  What sort of audience - seated, dancing, 20 people, 1000 people? What sort of venue? Karaoke, pub, stadium, someone's lounge? All salient points missing!  Maybe your profile is a clue, maybe not...
Comment: If they're not interested, then either (1) they didn't know what kind of music was on the program, (2) your performance is weak, (3) it's just one of those days.  Ask any standup comic: sometimes you bomb; get used to it and prepare for a better night next time.
Comment: Sorry, but without extra information, I will vote to close this question as it cannot be understood what is being asked.
Answer:
Talk to them.
Tell some jokes.
Give them some anecdotes referring to the song sung.
Choose an audience member, and talk diectly to them.
Be self- deprecating.
Make eye contact with some members of the audience.
Do not stick to a set list - choose various different styles/songs to suit        what you think they may appreciate.
Try segueing several songs.
Stop playing at some point, and ask them what they would like - you may not get constructive answers, but at least you'll know!
If all else fails, find a different venue, with a different audience. It might just be the square peg in the round hole.
Comment: Be self-deprecating... you must be English!  JK, I do that plenty as well.  It certainly works for comedians, so it could easily work for a musician as well, however, I wouldn't overemphasize this aspect of things.
Comment: @Basstickler - English through and through! You wouldn't overemphasise it - I didn't . It was 10% of my answer...  If one can't take the rise out of oneself, then it's hardly fair to take it out of anyone else, and if one doesn't do it to oneself, someone else is going to do it for one...
Comment: Right, I certainly didn't think you were suggesting it should be the centerpiece of their performance banter, just thought I'd throw it out there.  My joke on being English and self-deprecation basically comes from John Oliver jokes.
Answer: Perform well, to an audience interested in your type of music.  Or, sometimes, accept that you're just background, they quite like the noise you're making but also want to drink, talk etc.  Just carry on, and don't try to force attention by turning up louder!   You got the gig, which suggests you may be doing what the management requires.
Oh, and don't take prolonged jazz solos, unless you're a guitarist playing to a guitar club.  Even then, don't kid yourself.  They're just pretending interest until it's THEIR turn.


Why did Kaneki eat Hide's face instead of any other body part?

Question: At the end of season 2 of the anime Tokyo Ghoul, Kaneki ate part of Hide's face as mentioned in the manga but eating a body part like his hand would have left Hide in better condition, so why did he specifically eat his lower face?
Answer: If Kaneki had eaten another part, I believe the damage to Hide would be much greater, possibly leading to his death.
Maybe the mouth was the best option
"Hide lets Kaneki eat his face to get back his strength. While it appeared at first that Hide had died in the process, he reappeared later as Scarecrow, an ally of Kaneki and the ghoul hunters."
"Kaneki had eaten the lower part of Hide's face and that's why his voice box was also eaten. He wasn't able to speak properly but he found an alternative for his voice box and you can see that on his throat."
I get these quotes from:
https://www.quora.com/What-happened-to-Hides-face-in-Tokyo-Ghoul-re-season-2


Windows Server DHCP vs. Cisco DHCP

Question: One of our contractors just tried telling my boss that we should be using our Cisco ASA to serve DHCP instead of our DC... Is there any merit to this? Or is he just, once again, blowing smoke.
Comment: If you're running AD, not a chance. But you should consider moving DHCP off your DC and onto another server.
Comment: In a Windows environment I don't see any benefit to using a DHCP server other than a Windows DHCP server. Did he give you supporting arguments or compelling evidence? A sure sign of a blowhard is that they're emphatic about their argument but they can't show evidence to support it.
Comment: These days I run DHCP on both domain controllers, assigning the full scope to each with collision detection and 2000ms delay on the secondary.
Comment: I am considering moving DHCP, but there are no problems with it at the moment so its not a big hurry.
Answer: DHCP is fine on the Windows server, on a DC or not on a DC.
I can think of no benefit to be had from moving it off Windows.
OK, more detail is requested.... here we go:
a) Administer everything in one place on windows (instead of needing multiple tools)
-- Especially useful if you have reservations and other dhcp config needs (you may not have em now,,, but in the future you might well!)
b) Avoid having multiple dhcp servers (this leads to chaos). Many of us find over time that we are plugging in various routers and things (often just to use em as hubs), and we find stations getting addresses we did not intend. This is a result of "dhcp server proliferation"
c) Windows dhcp works well
d) If you use dhcp on the router, you do want to turn it off on windows (for the reason above). Some network admin in future might well turn it back on (on the win server) and then the fun starts!
Other odds and ends:
1) If you need to delegate dhcp admin to multiple people, this can sometimes be a problem in Windows DHCP (unless you are OK with all of them being network admins)
--- I have never seen a situation that needed multiple dhcp admins... the whole goal of dhcp is config and forget...
2) dhcp doesn't replicate with AD (afaik). So if you want redundant dhcp servers, I believe the only solve is to split the scope across multiple DCs
Answer: I've done it both ways, running DHCP on my Windows Server and also letting the Cisco ASA handle DHCP.  I have no advantage/benefit/disadvantage in either scenario.  I usually like to keep DNS and DHCP together and if you are running AD then i'd probably leave those roles on the servers.
Answer: Last I looked, my Cisco ASA couldn't do stuff I use -- fixed IP for MAC and automatic DNS registration on DHCP registration, so that wasn't going to happen.
Maybe the reverse is also true, but I haven't seen the need yet.
Comment: True, Cisco ASA won't allow you to do IP Reservations which is another reason I ditch them in some cases.

Windows Server DHCP vs. Cisco DHCP


Author of Sefer Shulchan Shlomo

Question: The Mishnah Berurah sometimes quotes a sefer Shulchan Shlomo (e.g. 489:3 that women should not count sefiras haomer with a beracha since they will inevitably forget a day).
Does anyone know who the author of this sefer Shulchan Shlomo is (it cannot be R' Shlomo Zalman Auerbach (though he authored a book of that name) as he lived after the Chofetz Chaim) and/or where a copy of the sefer can be found?
Comment: 1. Just for the record, RSZA (1910-1995) was 23 when the Chofetz Chaim  (1839–1933) died. 2. RSZA did not write a Sefer called Shulchan Shlomo. (It's probably one of the post-mortem books written in his name.)
Comment: Hi Yaakov! What have you checked? Hebrewbooks.org has 4 books with that name, for instance.
Comment: Tangentially related: http://judaism.stackexchange.com/q/6970
Answer: Hebrewbooks.org has a book with that title by R Shlomo Zalman Mirkash containing the ruling you reference about women and counting the Omer (available here).
Comment: http://youngerlight.blogspot.com/2011/05/count-women-in-part-ii.html
Answer: The author of this Sefer Shulchan Shlomo was Rav Shlomo Zalman Mirkes zt"l.  He was the chief rabbi/av beis din of Mir in the mid 1700s. The sefer is quoted approximately 80 times in the משנה ברורה, ביאור הלכה, שער הציון.
I just noticed that there is now a very informative (Hebrew) article about him in HaMichlol (nothing yet on Wikipedia) with good links to check out.
Some brief additional info about him can be seen at the bottom of this answer re: the history of the Mir yeshiva (and earlier yeshivos there).
After leaving Mir in the late 1760s, Rav Mirkes moved to Koenigsberg (now known as Kaliningrad) where he passed away and was buried in the old Jewish cemetery there close to the kever of the Baal HaPardes, Rav Aryeh Leib Epstein.  Also buried in that cemetery were the authors of the Pischei Teshuva, Be'er Heitev and HaKsav VeHaKabalah.  Sadly, that old Jewish cemetery in the Tragheim section of Koenigsberg was built upon and now sits underneath a playground.
See approximate location here.
If you can handle the German, there is an old volume published by the chevra kadisha of Koenigsberg listing who is buried there.
Answer: There is an online shiur that deals with the author of that sefer.  It is the class dated June 15. http://www.webyeshiva.org/course/the-mishna-berura-and-its-sources/

Author of Sefer Shulchan Shlomo


Objects origin is not moving in edit mode

Question: I probably messed up some of the settings but I couldn't figure it out my selfe.
The problem is, that when I move the wohle mesh in edit mode the objects origin isn't moving with the object, but the pivot point is nevertheless still in the objects center.
And the reason I think the problem lies in the blender overall settings is because I started a new project and tried the same thing with the default cube. The problem is still the same.
Comment: No, that is intended, and important.  The object origin does not change with edit mode changes, only with object mode changes.  The reason that the center of edit-mode transformations change is because those are not centered on the object origin unless you use a cursor pivot, centered on that origin; they are probably using the median vertex position as the pivot instead.
Answer: Pivot Point and Object Origin are different things.  The Object Origin isn't meant to move in edit mode.  The Pivot point depends on the Transform Pivot Point setting.  Take a look at the top bar in the 3D window:
The second drop down sets the pivot point:
You haven't screwed up any settings.  You just have the Pivot Point set to "median point". Because you have selected a cube, the median point happens to be the center of the cube.
If you want to pivot along the object origin, change the drop down to "Individual origins".
To move the origin, in object mode, Right Click and select "Set Origin" from the popup menu
Comment: Would change this slightly to _"because you have selected **all vertices** of cube"_  .... as opposed to result of  (median point location) with one vert, one edge, one face selected etc.  (also individual origins will probably not be the object origin location)
Comment: Good point. I wasn't sure how much detail would be overwhelming.  One could write a longish essay on pivot points, coordinate spaces, and their interactions.


Could one make an asymmetric encryption scheme based on Sudoku?

Question: I was reading about a Polly Cracker encryption scheme based on the graph 3-coloring problem.  Aren't Latin squares just a form of the same problem?  If so, does this mean Sudoku can be used for public/private key encryption?
Comment: Yes, and I am sure it is even used as an example in one of the crypto materials that I read - I'll be danged if I know the source though. Of course, a 9x9 Sudoku would not work; you'd have to greatly expand the dimensions. My Sudoku solver program can solve any *evil rated* 9x9 Sudoku in 0.1 seconds, and that's just the startup time of the Java VM - not the calculation itself.
Comment: Dang, I would have liked to read your source :(
Answer: Sure. How efficient vs secure is another matter.
Look up Merkle's puzzles, as well. A latin square as a higher dimensional object can be related to differential properties of good mappings.
Comment: Would you have any sources that describe how to actually implement a Sudoku (or any Latin square) as an asymmetric encryption scheme?  I only have a vague notion of how it would work.


"this" within setTimeout self executing function is undefined

Question: I know that this within setTimeout will correspond by default to window, so I have been using bind and passing it through to the self executing function, but when setTimeout finally runs (it's fine on the first run, called by TeaBot._manageTeaRound(), but it's not fine when self executing) this is undefined. Here's my code, where am I going wrong? (I have deleted some lines of code which might not be relevant). Thanks for your help :)
TeaBot.prototype._manageTeaRound = function(originalMessage, channel){
    var self = this;
    self.teaMaker = this._getUserById(originalMessage.user);

    //now wait 3 minutes for people to send their order
    self._runTimer(self,channel);
}
TeaBot.prototype._runTimer =function(self, channel) {
    // do stuff
    console.log(self.teaMaker.name); //undefined

    var interval = self.interval,
        teaMaker = self.teaMaker;

    console.log("self.interval is " + self.interval);

    if(interval === 0){

        interval++;
        self.interval = interval;

        setTimeout(self._runTimer.bind(self, channel), 180000);

    }else{
        self.interval = 0;
    }
}

Comment: check out: setInterval / clearInterval . Maybe it's useful for you..
Answer: This line is problematic:
setTimeout(self._runTimer.bind(self, channel), 180000);

Function TeaBot.prototype._runTimer expects self to be the first param - Function.prototype.bind() first param is context (function's this). Try use it like this:
setTimeout(self._runTimer.bind(self, self, channel), 180000);

Or leave context empty, becouse you are not using this at all:
setTimeout(self._runTimer.bind(undefined, self, channel), 180000);

Comment: Thank you very much, I completely misunderstood how the first parameter is the context, regardless of parameters I need to pass to the function! Thank you it is now all fixed :)
Answer: This is because you are not using the value of this inside of _runTimer.  You are binding a value this, but _runTimer couldn't care less.
_runTimer cares about its two parameters.  The 1st being the context (self).  The way your code is structured, there's no reason to use .bind here.
setTimeout(function(){
    self._runTimer(self, channel);
}, 180000);

(Since you are passing the context (self) to the function, it makes no sense to have _runTimer be a part of TeaBot.prototype, since it needs a context passed to it.)

As an alternative, you can drop the self parameter, and have _runTimer reference this.  That's when you would need to use .bind().
TeaBot.prototype._manageTeaRound = function(originalMessage, channel){
    this.teaMaker = this._getUserById(originalMessage.user);

    //now wait 3 minutes for people to send their order
    this._runTimer(channel);
};
TeaBot.prototype._runTimer = function(channel) {
    // do stuff
    console.log(this.teaMaker.name);

    var interval = this.interval,
        teaMaker = this.teaMaker;

    console.log("this.interval is " + this.interval);

    if(interval === 0){

        interval++;
        this.interval = interval;

        setTimeout(this._runTimer.bind(this, channel), 180000);

    } else{
        this.interval = 0;
    }
};

Comment: Thank you very much for helping out, I've misunderstood how the first parameter for setTimeout IS the context! I set it to undefined and it's now all working :)
Comment: @mfujica: The first parameter to `setTimeout` is the function to run.  The first parameter to `bind` is the context. :-)


Resources for mathematics of cryptology

Question: I am an undergraduate student looking for resources (books or lectures) explaining mathematics involved in cryptography, such as number theory, elliptic curves etc.
I found the book 'A Course in Number Theory and Cryptography by Neal Koblitz' hard to follow.
Comment: It is a graduate book. Ideal, varieties, and algorithm by Cox at al. has some nice part for Elliptic curves, Elliptic tales by Ash and Gross. Any good number theory book should be enough. It is hard to say that any elementary number theory is not used in Cryptography.
Comment: Does it need to be a book? There are quite a few ECC primers on the internet that are worth looking at, e.g. the one from Certicom: An Elliptic Curve Cryptography (ECC) Primer. You can read those first and then look up more advanced mathematical books / papers.
Comment: No it doesn't necessarily have to be a book.
Comment: Not a book reference, but as you are an undergraduate student, probably, you've access to multiple resources that are otherwise under a paywall, these are for example: Springer(Link), Elsevier, IEEE and journals on information security and cryptography. There you can find multiple schemes based on multiple branches of mathematics like: group theory, (group) algebras over a field, linear algebra and modules, number theory and a large etc. Some provide the reader with a background in the theory, so my recommendation is to let yourself go. Arxiv and IACR's eprint are good sources to browse too.
Answer: I think
Johannes Buchmann, Introduction To Cryptography, Springer, 2nd Ed, 2004
is very nice and pitched squarely at undergraduates. You can see a preview here
https://books.google.com.au/books/about/Introduction_to_Cryptography.html?id=BuQlBQAAQBAJ&printsec=frontcover&source=kp_read_button&redir_esc=y#v=onepage&q&f=false
Its contents are:
Integers
Congruences and Residue Class Rings
Encryption
Probability and Perfect Secrecy
DES
AES
Prime Number Generation
Public Key Encryption
Factoring
Discrete Logarithms
Cryptographic Hash Functions
Digital Signatures
Other Systems
Identification
Secret Sharing
Public Key Infrastructures
It is broad, as opposed to very deep, but really well written.
Answer: Nigel Smart has written Cryptography Made Simple. If you have institutional access, the ebook can be downloaded for free from SpringerLink.
To quote the book regarding prerequisites:

The background I assume is what one could expect of a third or fourth year undergraduate
in computer science. One can assume that such students have already met the basics of discrete
mathematics (modular arithmetic) and a little probability. In addition, they will have at some point
done (but probably forgotten) elementary calculus. Not that one needs calculus for cryptography,
but the ability to happily deal with equations and symbols is certainly helpful. Apart from that I
introduce everything needed from scratch. For those students who wish to dig into the mathematics
a little more, or who need some further reading, I have provided an appendix which covers most of
the basic algebra and notation needed to cope with modern cryptosystems.

While I have not fully read the book, it has suitable references to (most) of the popular "advanced mathematics" underlying cryptography schemes. It in particular has sections on:

(Finite field) DLOG/Factoring based schemes
Elliptic Curves
Lattices

Steven Galbraith has written The Mathematics of Public-Key Cryptography.
This is written at a more advanced level (and mentions Smart's book itself as an intended pre-requisite), but is available free at the author's website.
As it is at a more advanced level I would not recommend it for your situation, but there are certain topics covered in it (Isogenies for example) which are often not covered in other books, so depending on your particular interests there are sections of it which may still be appropriate.
Comment: Thanks for the pointer to Galbraith's book!

Resources for mathematics of cryptology


Ubuntu 18.04.2 netplan basic wired network configuration

Question: Struggling tonight to find basic information on getting a machine back on the network. Wired dhcp no longer works and I can't figure out how to even do a static assignment. I have a wired and wireless card in this machine, installed basic minimal server install from ubuntu-18.04.2-server-ambd64.iso and network did not come up during install. I figured I could troubleshoot once I got it up. Any help on netplan howto / 101 / stupid simple config would be appreciated. I have never heard of it and don't have a lot of time to get this machine connected.
Comment: If you configure it in the installer, the configuration will carry over to the end system. There should be no meaningful difference between the installer environment and the end system, so configuring DHCP is expected to work (you say it didn't, perhaps the network was still converging after plugging in the wire?)
Comment: http://netplan.io/examples would be a good place to start for documentation and help.
Comment: No, it doesn't seem like the network was converging. I tried part way through the installer three times and finally just completed it assuming there was some esoteric driver issue. So if the config gets copied, then perhaps the issue is it does not auto configure from setup. Either way, this seems like a pretty ridiculous oversight. Why wouldn't the default even include the option commented out if the concern is about assuming too much about the target network. It just seems the most 80% case (60, 50?) should be covered in some better way.
Comment: Also, much appreciated to whoever down-voted. I'm not sure what issue you have here but this is a legitimate question, asked in a detailed and objective way about a common misunderstanding as people are exposed to a new default technology. I continued to research my question and answered it myself in the simplest possible fashion. I'm not sure what you might find objectionable other than suggesting the choice of this configuration is questionable. But thanks all the same.
Answer: Kind of unbelievable you have to go learn a new subsystem to get something so completely basic running. This seems like a terrible choice. Adding the ethernets: section to the default .yaml file and then running sudo netplan apply seemed to get an IP address assigned.
<code>network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: true
</code>
Comment: Configuration files should have come with a comment saying this is netplan and how to get more information. There should also have been a similar comment in /etc/network/interfaces. Are you saying this was not the case? If so, that would be a bug that needs to be filed so we can fix it.
Comment: It's not that the comment was not there, it's just that there is no efficient way to divine how to accomplish getting a basic network config set up from the system alone, without using the network that it can't connect to. I'm just surprised that the default setting requires configuration in the most basic of cases of scenarios of plugging in a wired network cable. It's been a couple of decades since that hasn't worked out of the box and not sure why the regression seems like a good idea.