How can I dynamically load the correct sprite from a sprite sheet?

Question: I am making a simple card game in unity. The game is based on a standard 52-card pack, with identical backs for unique faces. In my particular game different cards are worth different values and have various special abilities. The game will have 52 cards on the table (on the draw position or in the face-down deck or in someone's hand) at all times, so this number won't change.
I thought that making a Card prefab and instantiating 52 of these manually would be a bad idea. Even doing it in code, I thought, would be a bit OTT, and that I should just instantiate visual cards when they are face-up to the player.
I have a sprite sheet of the 52 cards and the back, which is imported as a Sprite in multiple mode, sliced in to a grid containing all the cards needed to play the game.
The problem I now face is that, through my GameController script I want to generate a shuffled pack of cards, deal some to each player and then show those cards to a player. However, I am not sure of the best way, or even if it's possible, to do this dynamically with the sprite sheets as they are. For instance if I have the following:
private CardRank rank;
private CardSuite suite;
private GameObject visualCard; // the card in the scene

private void Start()
{
    this.rank = CardRank.Ace;
    this.suite = CardSuite.Spades;
}

This class would be instantiated by the game manager. I would have 52 of these in code.
Whenever I have to visually show a card in the scene, I would use a card prefab, which is essentially a game object with a SpriteRenderer on it. I would need to dynamically load the correct sprite for this object from the sprite sheet. Something like this:
SpriteRenderer spriteRenderer = this.visualCard.renderer as SpriteRenderer;
spriteRenderer.sprite = ...

The sliced sprites from the sprite sheet actually have names in the format AS (Ace of Spades), 7H (Seven of Hearts), etc - though this was a manual thing I did myself of course.
I have also tried various alternative solutions, including creating animations, having separate sprites not in a spritesheet and having an array of available sprites in an array with a specific index for each card, but none seem as elegant as trying to load the correct sprite at runtime, as I'm trying to.
So, how do I load a specific sprite from a spritesheet at runtime? I'm open to suggestions, even those that make me think differently about how to approach the problem.
Comment: Add your voice to the [feature request](https://feedback.unity3d.com/suggestions/allow-access-to-sprite-packer-atlas-to-retrieve-sprites-by-name).
Answer: my approach will be almost similar but I will prefer to use a full sprite sheet of cards to avoid the extra naming problems.
Before we get started here is the link to the sprite sheet.
https://i.stack.imgur.com/gnv4Q.jpg
We need to create one script named Card which can hold its value and type.
It should look like this:-
using UnityEngine;
using System.Collections;

public class Card : MonoBehaviour
{

    public enum Suit { Hearts = 0 , Spades , Diamonds, Clubs };
    public Suit mySuit;
    public enum Value { Ace = 0 , Two , Three , Four , Five , Six , Seven , Eight , Nine , Ten , Jack , Queen , King };
    public Value myValue;

}

Now import the image into resources folder and slice it using default grid option.
You will get nicely numbered sprites which we can use :)

Note that the enum in Card script are arranged as per the order of sprites in the sheet.
We need one prefab to be stored in Resources folder which will have a Sprite renderer and the Card script

The last part is the core logic to populate the cards.

Load the Sprites into an array from resources folder.
Run 2 nested for loops for the cards.
Make it a child of the current game object (optional)
Assign the card sprite , use i and j to calculate the index
Assign the enums for Suite and Value.
Then finally the name :) (optional)

Code:-
void PopulateCards()
{
    Sprite[] card_sprite = Resources.LoadAll<Sprite>("Cards");

    for(int i = 0 ; i < 3 ; i++)
    {
        for(int j = 0 ; j < 13 ; j++)
        {
            GameObject prefab = Resources.Load ("Card") as GameObject;
            GameObject card = Instantiate(prefab, Vector3.zero, Quaternion.identity ) as GameObject;
            card.transform.parent = this.gameObject.transform;
            card.transform.localPosition = Vector3.zero;

            card.GetComponent<SpriteRenderer>().sprite = card_sprite[(i*13)+j] ;
            card.GetComponent<Card>().mySuit = (Card.Suit)i;
            card.GetComponent<Card>().myValue = (Card.Value)j;
            card.gameObject.name = ((Card.Suit)i).ToString()+"_"+((Card.Value)j).ToString();

        }
    }
}

Comment: Nice solution, thanks! Noob question: would it be possible to move any of this (i.e. the `Resources.Load()`) out of the loop(s) to save on load time?
Comment: Yes you can. What you do is drag and drop the card prefab inside the main game object and duplicate it 52 times. Make an array variable of Card[ ] cards. And in start assign it by cards = GetComponentsInChildren();  and in Populate function for loop assign card = cards[ i ]; so that you don't need to instantiate.
Answer: Using Unity SpriteEditor cut out the sprites from the texture. In your script, add:
public Sprite[] cardSprites;

In script inspector set the size of 52. Then just fill it with sprites. You do that by going to project window and mouse-moving all sprites from sprite sheet. Now you have all your sprites individually.
Having said that, you absolutely shouldn't be having 52 scripts, each for a card. One script is enough. Have sprite list in your manager and just make a function GetSprite(CardRank, CardSuite) which will return sprite you want. You can use int values from enum to make it painless, like:
public enum CardSuite { Spades = 0, Clubs = 1, Hearts = 2, Diamonds = 3 } // enums get assigned ints from 0 automatically but it's nice to have them written down so you know you depend on it

public Sprite GetSprite(CardRank rank, CardSuite suite)
{
    // suit goes 0-3, rank goes 0-12
    return cardSprites[((int)suite + 1) * (int)rank]; // probably not correct but you get the point
}

You just have to place the sprites in inspector in a sorted way, like you have your enums.
Answer: You could Create one Sprite Card Object.  Give it the the four suit textures, face card textures, and card background texture.  Example : for the 7 of spades you would draw the spade texture at 7 different locations with a white texture of a card in the background, and use DrawString to Draw the 7.  That way you could (in your game class) say Card card = new Card(7,spades), and it would then create an instance of a Card class you set up, and draw 7 spades on the card, with a 7 in the top right and bottom left upside-down.


Source code purchase

Question: I am planning to buy the source code of business that is currently making revenue. How can I be sure that the seller does not have a copy of the source code that they can use later?
Answer: You cannot. You would need to check every computer that may contain a copy of the code. In other words, you would need to check the entire Internet. (Well, maybe something like that will be possible with quantum computing, I am not an expert in that.)
The only thing you can is to make a legal agreement with them. The agreement (if they would be very favorable to them) could contain their permission for you to spy on them to check it. If you know they violated, you could sue them.
I am not a lawyer.

Source code purchase


Symbolizing by color names in ArcMap?

Question: I have a shapefile with two fields, lets call them shape and color. I want to symbolize each point based on both of those fields. Each field is stored as a string. Example: "Square, Blue". I want to symbolize each point with the shape listed in shape, and the color listed in color. So my example would show up as a blue square. I have tried symbolizing by categories: unique values, many fields, but I have too many possible combinations to do this. I can manually choose a shape for each "shape" field, but I would like it to dynamically change the color based on the "color" field
Comment: I would replace points by simple geometry polygons with size suitable for scale map, e.g. Square, circle, star and symbolised them by color. Relatively easy thing to do, I'd start with buffer and modified ones that are not circle
Answer: I don't think there is a way to do this without some programming.  Most likely ArcObjects.  The only symbology parameters you can set with fields seems to be Size and Rotation.

Alternatively, you could try creating a style for each possible combination (though you indicated that there were too many).  You'd have to merge your two fields into one as your value field:

Symbolizing by color names in ArcMap?


Name for Monospace vs Proportional fonts?

Question: If one wants to classify all fonts as either monospace (fixed-width) or proportional (variable-width), then how should this property of a font be called?
Comment: [The specification for OpenType uses a flag called "proportion"](http://www.microsoft.com/typography/otspec/os2.htm#pan), which maps to "a monospace / proportional flag".
Comment: The names for Monospace vs Proportional are 'Monospace' and 'Proportional'
Comment: Is "width" not appropriate?
Comment: @Brendon: Generally, "width" is a horizontal measurement of something. A font has a stable height, also called the size of the font, but widths of individual characters vary in  proportional fonts -- so "width" of a font is a misnomer. "Widthness" may be appropriate, but that doesn't sound like a real word...
Comment: @KitGrose: thanks Kit, this is the actual answer I was looking for!
Answer: Everything that I've ever seen which deals with fonts assumes that they are proportional width fonts unless they are called "monospace" fonts, and without resorting to technical terms that only font creators are likely to know, there isn't a common term for that property.
So for the sake of clarity I would call them "monospace" and "non-monospace" fonts in the same spirit of "serif" and "sans-serif" where "sans-serif" literally means "without serif".
If you need to list the property in a table or something similar, I would call the property "monospace" and label it as true/false, yes/no, or ticked/unticked whichever best matches the style of the rest of the table.
Comment: The common terms are, indeed, monospace and proportional.
Answer: EDITED - Correcting myself, I had suggested that property could be letter-spacing or Kerning but its wrong. Letter-Spacing and Kerning represent spacing between font-characters and not width of characters which is being asked here.
Comment: -1 Letterspacing is the space BETWEEN letters. Monospace and Proportional refers to the widths of each glyph (or, more accurately, the bounding box of each individual glyph)


Pidgin status icon in 13.04 / Raring Ringtail

Question: I upgraded from Ubuntu 12.04 to 13.04.
Looks great, but the Pidgin status icon does not appear in the upper right corner.
How can I fix this?
Answer: Starting 13.04, applications will have to integrate into the indicators and can no longer have their own status icons in systray in Unity. (This may change in future.)

The Unity systray whitelist has been removed, so you can no longer whitelist applications to allow them to use the notification area in Ubuntu 13.04 Raring Ringtail. However, Java and Wine applications have been hard-coded as the only software still able to use the notification area so this change only affects some old applications that don't come with AppIndicator support. And since Qt applications systray icons are automatically converted to appindicators thanks to sni-qt, this change shouldn't affect too many applications.

Source: http://www.webupd8.org/2013/04/ubuntu-1304-raring-ringtail-final-beta.html
Answer: The functions of the former Pidgin icon are integrated into the messaging icon, which then will turn blue instead of white when new messages have arrived. But it is impossible to distinguish at a glance between new chat messages and new email (e.g. from Thunderbird, XChat, Empathy...).
If Pidgin does not work with the messaging icon in 13.04, this one from a similar question at "Ubuntu 13.04 Pidgin Tray" may hold the solution: Because when using the Pidgin icon with previous Ubuntu versions, you or someone else may have deactivated the libnotify plugin on purpose, which is needed for support of the messaging icon. If that is the case, this is the quick solution:

Find the "libnotify Popups" plug-in in Pidgin (Tools menu)
activate it
configure what kind of popups you want to see (probably none)
restart Pidgin.

(It is not necessary anymore to add a developer repository for Pidgin's libnotify plugin, as suggested in "How do I enable the pidgin system tray icon?" - that problem is fixed.)
But for everyone who still wants Pidgin to have its own original system tray icon, I do recommend the alternative repository for 13.04 of webupd8.org as suggested Peter Paldan in another answer on this page here. It will replace some binaries concerning the Gnome panel where the whitelist in dconf at com.canonical.Unity.Panel is still functioning as it should.
Answer: There is "HOW TO GET THE SYSTRAY WHITELIST BACK IN UBUNTU 13.04" which look working so far for me:
sudo add-apt-repository ppa:timekiller/unity-systrayfix
sudo apt-get update
sudo apt-get upgrade

http://www.webupd8.org/2013/05/how-to-get-systray-whitelist-back-in.html


NSF sponsoring scientist already having postdocs under their supervision

Question: This question seems reasonably focused and of interest, but is perhaps unanswerable. I'm a mathematics student graduating and would like to apply for the NSF postdoctoral fellowship. I wanted to know whether choosing an NSF sponsoring scientist who already has postdocs under their supervision damages one's chances of obtaining the fellowship. I'm not as interested in the question of whether such a sponsor will do as good a job in their role. I'm especially interested in answers which provide some evidence which bears on the matter. This seems slightly(very?) field specific, so answers from people with experience in mathematics or related fields are preferred.
Thank you!
Comment: You could ask the people in charge of the program directly.  They have no reason not to give you a straight answer.
Answer: I am not directly familiar with the NSF scheme, but for the NIH NRSA scheme choosing a PI with previous post docs is a huge benefit. In fact, from what I have heard from young colleagues, if the PI does not have current or previous post docs, the NIH likes to see a more experienced co-supervisor listed.


How do I ask a professor for a summer research project?

Question: I am a student of IT in India.  I'm in my fourth semester and want to work on some project during summer.  How should I write the email to the professor asking for the same?
Answer: I get many letters of this kind, and I now summarily delete them without replying. Let me explain why.

Money: it's never clear in these letters what kind of support the student wants/expects. The default assumption is that I would pay for them, and as an academic with limited resources, I have very little incentive to pay for an undergraduate to travel  from India to the US to work with me, especially when it's unlikely they'll be able to do much in three months. Which brings me to
Project timeline: most letters of this kind are of the form "I'm interested in BROAD TOPIC A and want to work with you because you're interested in NARROW TOPIC B". For a three month internship to work, a project has to be very focused, and set from day 1. There's no time to explore.
Self-interest: There's very little gain for me here, or at least none that's mentioned in the letters. If I want to hire an undergraduate, I can do it locally. I can even get financial support (sometimes) for doing that. I can't do that with a student from abroad, and I can't even vet them in advance.

So any successful letter needs to address these three issues very effectively and quickly (because I delete these emails without reading more than a few lines).
Having said that, I know of at least one example where a student came from India to work with a colleague and that summer project turned into an application to grad school. The student is now at my university.
Comment: But is there any indication that the student wants to travel to the US? Perhaps they want to apply with a professor at their home university?
Comment: What if the student is really strong and has great potential but he is from a fairly unknown institution? I think that there are (some) strong students at many unknown institutions who are self-motivated. Wouldn't you like to attract any of those to your lab for graduate studies?
Comment: What is there for you to gain in such situations? What would you like to gain from an undergraduate project like this one? I am asking because I would like to know what a professor can gain in such situations.
Comment: The only potential gain for a professor is if they are able to attract an undergrad from a strong institution, build a relationship, and then have that undergrad come to their university for grad school. There really is no other gain.
Comment: I would for graduate studies. But for a summer internship ? that's a long shot gamble.
Comment: But with a summer internship you may attract him to your group. Moreover you will find out whether you want to get this student in your lab for the next 5-7 years, or not. Is the cost that high for a few months (2-3)? (Does this include university fees etc.?)
Comment: yes. there's a risk-reward calculation here that I estimate to not work out in my favor. if either the cost or the risk estimate changes, then my opinion would change as well :)
Answer: How about something like the following.

Dear Professor X,
I enjoyed your course on letter writing and would like to learn more about it. Would it be possible to do a summer project with you?
Sincerely,
Your student of IT in India

If you didn't do a course with him, there must be something that singled him out amongst the other 50 professors at your IT institute (and I don't mean his new glasses).
Alternatives might be:

I enjoy topic X [your professors specialty] and have used it to program a simple program ...
I tried to read your paper "Letter writing for IT students" ...

You asked for a letter, but allow me to suggest to go and talk to him directly. Make sure you know why you want to do a project with him. From a short conversation, you should be able to tell, whether he is willing to invest time into guiding you through a summer project. (He might be away on conferences or other business.) If he seems like he might be very busy, you might consider doing a project with someone else. (If your professor is too busy to meet with you every few days, anyone, even me, can give you a research project: "Research about topic X as much as you can and let me know what you found".)
Say that you have never done a summer project before, and ask him how much time he expects you to put in (per day) and how often he might be able to meet with you.
All of this can be settled in a short conversation of 5 minutes. Via email, this all might take well over a week, or the professor might just not care to reply.
Comment: From my home university, I understand that "summer project" means roughly guided pseudo-research for undergraduates in their free time and without pay. If you are asking for free time of your professor plus money, you will probably have to make a more compelling case.


How to package blackberry libraries

Question: I have developed a UIApplication that uses another project of type "library".
How do I package the Application and the library together in one package?
Comment: First question - what is the package? Distribution, one cod files or something else? Could you also say why do you want to have them in one package? And what are you using JDE, Eclipse or BB Ant tools?
Comment: 1- I want to package them into .code file to upload to Appworld.
2- The library project is Auto-run in startup.
3- My main application contacts with the library throw RunTimeStore
4- I am using Eclipse.
Comment: I never submitted app to AppWorld. Is it possible to submit several cod files? If yes, you need to submit your cod file and library cod file.
Comment: Yes, It's possible to submit several cod file, Thank you
Answer: You can set the Build Configuration path of the application in the application settings to include the library you want to package with your application.
I hope this helps

How to package blackberry libraries


What do you call a function that calls itself (is this called recursion)?

Question: I am trying to figure out what you call a function that references itself. Is this termed recursion? Or is it simply a self-referencing function?
Comment: If it never *calls* itself then I'd argue it's just silly code ;-) Otherwise, see the answers. A recursive function is one that *calls* itself. Direct recursion is the *act* of *calling* itself. Therefore, if nothing is ever *called* (but the function, say an anonymous function, still has a reference to itself) then... ;-)
Answer: It is a recursive function. Direct recursion is when a function calls itself.
Answer: A function that calls itself is, as you suspect, called "recursive".
Answer: Recursive or self recursive is what I usually refer to it as.  Just be careful so you don't get stuck in a loop calling yourself, eventually blowing the stack.
Also keep in mind your variable's scope.  Declare variables as static if they are needed to be shared throughout all recursion levels (or declare them outside the function).  Pass variables to the function if you need to specific information passed from one level to the next.  And finally, use local variables in the function that are needed to keep state for a current level of recursion.  Local variables will make a copy on the stack for each recursion level you call, and pop back to the previous values for each recursion that unwinds.
Comment: I think the OP was just fishing for a homework / online test question answer :)


Pre Big Bang knowledge

Question: I have read that no one knows what preceded the Big Bang, but is this true?
The Big Bang process (with or without inflation) followed known rules which "existed" prior to time zero. For example, some of the obvious rules of the game included: mathematics, conservation laws (symmetry), thermodynamic laws (energy conserved, entropy increases), quantum mechanics (uncertainty principle, locality, and probability waves), special relativity ($c$ constant, $E = mc^2$), and general relativity (equivalence principle). Thus, we know a lot about the environment which set the stage for our universe. I have read the previous answer to this question but do not think it is adequate.
What am I missing?
Comment: There was no time before the Big Bang, so it's rather pointless to talk about anything existing before it.
Comment: What is the previous answer you're referring to?  Please include a link.
Comment: @HDE226868 I think your statement is a little too strong, no? It's not that there definitely was no time before the Big Bang, it's that it's *unclear* if there is any sense in which there was a "before", or if such a "before" could affect this universe in any way. I might be wrong, but I don't think that there is a consensus on this one way or the other. I agree with you're conclusion though, no sense in talking about it until we are sure we are talking about something real.
Comment: Discussing what comes before the Big Bang is no different than discussing theories supporting a multiverse, a subject that receives significant attention. I am attempting to define another level of detail surrounding the Ultimate Multiverse (all mathematical possibilities) proposed by Max Tegmark in his recent book. Comments?
Comment: Interesting title. I almost read it as pre bang knowledge. Other than that, a time before the big bang may have been whats called a big crunch. Or what like HDE 226868 said.
Comment: The concept of a multiverse might exist either within an actual multiverse, or within a single universe (non-multiversal by omission of the capitalization suggesting a "local" one), where it might exist only as a concept, in print and other media.
Answer: All the "rules" you listed, which describe the Big Bang process and subsequent universe, are concepts of how forces of nature interact.  The forces of nature themselves - strong nuclear force, weak force, electromagnetism, and gravitation - may have emerged, along with time itself, from the Big Bang process.  Without time, the rules would make no sense.
Phase transitions in the early universe (prior to the first 0.01 second) may help explain how the four fundamental forces of nature defined themselves by a process of symmetry breaking.  Prior to that, the rules you list may not have existed, contrary to what your question assumes.
However, if by Big Bang you mean the hot phase that was followed by expansion and cooling, it may have been preceded by pure vacuum energy which inflated extremely rapidly, cooling in the process, and producing a condition in which the potential energy of the vacuum was converted into the kinetic energy of matter and radiation.  This scenario was proposed by Alan Guth in response to two problems with the Big Bang, the flatness problem and the horizon problem.
This inflationary universe would have been caused if a state of vacuum energy density was in a "false vacuum" or temporary vacuum, and suddenly fell to a state of lower energy density. The change could have been triggered by a quantum fluctuation.  The result of transition to lower energy density would have been equivalent to expansion.  When the false vacuum decays, the energy in it is released to form a hot, uniform soup, and this is where the Big Bang begins.
But this begs the question of where the false vacuum came from.  Were the rules you describe applicable to whatever it came from?  This question may seem like peeling layers from an onion, and never coming to a core.  In order to find the elusive core, James Hartle and Stephen Hawking proposed the idea that, in effect, there is no core.  Their No-Boundary Proposal said that very near the beginning, time emerged from space, and that the universe is finite but has no boundary.  It seems to me impossible to describe this adequately without the mathematics, but here is a link to Stephen Hawking's lecture on the beginning of time.
The problem with Hartle-Hawking is that it needs a closed universe to work, and observations don't seem to agree with a closed universe.
Sean Carroll, a theoretical physicist at Cal Tech, wrote that the Big Bang, or the state of vacuum energy density that may have preceded it, is a "plausible hypothesis".  There is no certainty about what the Big Bang arose from.  Inflation is the most accepted theory.
Comment: The previous answer was; http://physics.stackexchange.com/q/41501/  I am responding to answer soon.
Comment: Thanks for the Hawking reference. His following quote is one answer to my question."Since events before the Big Bang have no observational consequences, one may as well cut them out of the theory, and say that time began at the Big Bang. Events before the Big Bang, are simply not defined, because there's no way one could measure what happened at them. ….the Big Bang is a beginning that is required by the dynamical laws that govern the universe. It is therefore intrinsic to the universe, and is not imposed on it from outside." Rest to follow in next comment.
Comment: However, analogous to fine tuning the 30 dimensionless parameters in physics and cosmology, I was attempting to take an extreme high level view and make the "intrinsic laws" optional, treating them as parameters. Say for example no quantum mechanics or no symmetry breaking existed in the laws, then the big bang would most likely produce a chaotic universe. Thus, are these laws may not be intrinsic.
Answer: The comment by the late Stephen Hawking (cited by Jim Johnson on Sept.6, 2015) may sound plausible to many of us, but his frequent mathematical collaborator, Sir Roger Penrose (knighted several years ago for his many contributions to physics), would've eventually disagreed.
Although not a proponent of any "multiverse" in spacetime, Penrose's Conformal Cyclic Cosmology (developed in 2010) provided for past- and future-eternality through separation of the "aeons" of a true universe by "timeless" intervals, within each of which all matter would've previously evaporated into energy:  During the periods between aeons, the lack of rest mass would've prevented the formation or construction of any form of natural or artificial clock.  This facilitated acceptance of his "Weyl Curvature Hypothesis", which preserves angles but not lengths in dynamic applications of geometry, and consequently might, without possibility of observational contradiction, provide for the thermodynamic equilibrium of one aeon to become the "Big Bang" of the next:  If the usual assumption that the BB was subsequently (and very rapidly) expanded throughout our observable region (and, hypothetically, extremely far beyond it) can be accepted for  its simplification of baryogenesis and other advantages over the Steady State Theory which had preceded it, Penrose's enhancement of the Big Bang Theory is hard to resist.
Its own observational proof, described in a collaboration of Penrose with Meissener, An, and other noted physicists, lies in several spots of "significantly raised temperature" in the Cosmic Microwave Background radiation:  These spots have been convincingly interpreted by that collaboration as representing Hawking Radiation of the aeon preceding our own.  The final version of their paper was released shortly before the Nobel Committee's award, which was officially based on Penrose's work (much of it in collaboration with Hawking) on the nature of black holes.  (Black holes are not at all hypothetical:  The existence of more than 90, initiated within the gravitational collapse of large rotating stars, has been inferred from the elliptical orbits still followed by their former partners in binary pairs, and the formation of an especially large one by a somewhat different process--the collapse of a large amount of interstellar "dust", in Sagitarrius A--was recorded astronomically only a few years ago.)
Penrose was awarded a Nobel Prize in physics in 2020 for his work on black holes, shortly after revision of his collaboration's work.
Comment: In addition to correcting my misspelling of Meissner's name, I should add this link to the last preprint of the paper which may have put Penrose "over the top" for receipt of 2020's Nobel Prize:  That paper's freely visible on Cornell University's Arxiv site, at https://arxiv.org/abs/1808.01740 , and the prize was awarded to him about 7 mos. later.
Comment: As the no. of views since posting of my answer suggests that its acceptance may've run afoul of creationism (which isn't needed in Penrose's model, but which may leave many educators predisposed against any denial of it in the most populous of the countries--all English-speaking--that are serviced by PSE), I'm obligated to point out two facts: First, I've seen no claim, by Penrose or anyone else, that his model is necessarily incompatible with that theological doctrine; second, although his model's compatible with past- and future-eternality, past eternality cannot be proven.
Comment: Re my last comment, I have to clarify that the sense in which past eternality cannot be proven is, inherently, only observational or experimental: It follows logically from Penrose's model, and, if his model's correct, the supportive evidence for it will tend to increase with the expansion of spatial exploration and the development of larger gravitational wave detection apparatus, as gravitational entropy tends to balance thermodynamic entropy within that model.
Comment: Occam's Razor is the logical factor eliminating creationism from the most economical description of Penrose's model, but, as a Creator would not necessarily have to be economical, the possibility that They would have initiated a first one of the intervals without mass (perhaps as a test of faith for reality's eventual occupants, for example) would exist, and the possibility that previous intervals without mass might've existed might have to be ignored by those faithful to that Creator.
Answer: Ancient logic says the universe always was and always will be, never created or destroyed, otherwise, at some time ... there was nothing. But nothing is by definition...well nothing. Nothing is defined by the condition that nothing can never produce anything. Since there is something, this theorem implies the universe is immortal, since nothing cannot embed something,, or it would be something, it implies the universe is infinite.
Immortality implies oscillation of density from max to min, always infinite in extent.
Comment: All I know is that nothing in this answer is physics.
Comment: Laws of nature (universal rules, laws of physics, and symmetry) are all required pre-requisites for Big Bang theories (inflation theory, a cyclic "immortal" theory, or a multiverse theory). Some source of energy conformed to these laws generating the universe. Thus, I propose that the intrinsic laws of nature establish the universe's design (forces and strength, particle types, etc.). They existed prior to the energy source which started the Big Bang, reference   http://viXra.org/abs/1604.0212?ref=10215241  Jim Johnson
Comment: Everything is physics... natural philosophy.
Answer: The Big Bang hypothesis is just the inflation of something that is already there.There has to be something to inflate for the big bang to happen. So if the Big Bang were true, there would have to be something there before it happened.
Comment: This is just false based on currently accepted physical theory.

Pre Big Bang knowledge


Difference between __asm__ volatile("jmp 0x0000") and ((void(*)(void))0x0000)()?

Question: Is there anything slightly different between the two calls? Which is the "better" version?
Comment: What does the C version compile to? You aren't comparing like for like.
Answer: One specifically performs a JMP instruction, and the other treats it as a function call.
Depending on the chip you're programming for it will most probably use a different instruction than JMP, and it will most probably alter some registers in some way that the JMP wouldn't.
For instance, on MIPS, it would use a JAL instruction (Jump And Link), and the return address would be placed in $ra.
Answer: You don't say which microcontroller you are using, but that looks to me very much like a jump to a reset vector, causing a software reset on the device. The first form injects an assembly language opcode that creates a (blind) jump into that address, causing the control flow to immediately divert to the beginning of address space from the function it's written in.
The second form creates a function pointer to a void function, and calls that function (the last parentheses). Instead of jumping blind to address zero, this mechanism creates a new stack frame and at the very least pushes a return address to the stack so that the code can return from any function that is compiled to address zero or vectored from address zero.
If the address zero is indeed a reset vector on the target microcontroller, then diverting the program flow in any way to that address will run the startup routines, which resets the stack and very commonly also initializes any initialized variables in the system. So in that case it really makes no difference if the caller has created a return stack frame or not - the system will just reset and never return to the caller.
In the other case, if the microcontroller doesn't start its execution from address zero, then that address could contain any function or vector to a function, that conceivably might return. In that case it's important to write the call as a function pointer. A good example of this kind of system would be a microcontroller that has program RAM at address zero and program ROM at some other address such as 0x8000. At hardware reset the software execution might start at address 0x8000 instead of 0x0000 and the address 0x0000 might contain for example a zero pointer call trap, an old programming trick used to detect function calls to missing methods or to methods of uninitialized objects.
The reset case is the more common case, and the real difference (and the reason to use the function pointer style) might be that the C compiler doesn't support the asm keyword. But any C compiler will be able to compile the function pointer, so that style is also more portable.
Answer: The first statement will perform a jump to address zero; the second might perform a call to address zero, but it could just as well do something else.  For example, an implementation might define a method NULL_DEREFERENCE_TRAP() with a default implementation while(1);, and have any attempt to call a null pointer invoke that function rather than actually jumping to location zero.  If the processor has a watchdog, the while(1); loop may result in the watchdog triggering and restarting the system, but the system might hang for a second or so first.
Additionally, depending upon how system initialization code is written, it would be possible that startup code might check whether certain things which hardware would normally force to a certain state on reset are in fact in that state, and use the fact that they aren't as an indication that the system is being "soft-restarted".  Triggering a watchdog could prevent such mechanisms from working as intended.
Finally, one should be aware that there is no requirement that the storage format for ((void(*)(void))0x1234) have any relationship to the storage format of the number 0x1234.  If a system wanted to trap null-pointer accesses, but still provide a means of creating a pointer to a hardware register at address zero, and if no legitimate address had bit 31 set, it could legitimately (from the standpoint of the C standard) say that the bit pattern stored for any pointer will be the address xor'ed with 0x80000000.  In such a system, casting 0 to a pointer would yield an invalid pointer (as it should), but trapping null access would require that a pointer to physical address zero be constructed by some means other than casting an integer zero.


"Site Offline" message can't be disabled

Question: We installed a plugin to show our site offline for a few days during an update. But after finishing the update we cant remove the "Site offline" message. Finally we uninstalled the plugin, but the frontpage still shows "Site offline". Any suggestions om how to get the site "online" again? ( no, plugin developer does not answer our emails..)
Comment: Show link to repo.
Comment: delete the plugin folder via ftp or file manager. Also post your site url.
Comment: Or at least the url to the live site
Comment: No one can really help unless you post a URL.
Comment: We definitely need to know **Exactly what "Maintenance Mode"** Plugin you used, either with a link to the Plugin's listing in the WPORG Plugin Repository, or a link to where you downloaded the Plugin.
Answer: Check for a .maintenance file (if so, delete it) in your wp root and also check your .htaccess file
Comment: Again, check for a `.maintenance` file in the root of your wordpress install!!
Comment: The plugin folder is deleted, but it does not help, and .htaccess seems to be fine
Comment: and make sure hidden files are showing your FTP client
Comment: no .maintenance file, and I cant find any hidden files. ( I turned on "Force showing hidden files" in Filezilla
Answer: I could be that the plugin added some wired thing as DB-option that gets autoloaded. Please check your DB-Options table for unknown keys/values. Then do cross file searches inside the plugins folder for the key.
Comment: I am afraid I dont know what keys/values that are unknown in my installation


Getting into a meditative mindset for yoga

Question: I've done yoga several times, but am not really big into it.  I'd like to get more into it.  The problem is, I'm the type whose mind is always running.  Trying to simply stop and feel my inner self, or feel the posture, or whatever seems very hard.  Is this something someone picks up as they progress, or is there a trick to it?
Comment: Voting to reopen because I feel that it is viable to get an answer to this.
Comment: Agree to opening.
Comment: Yoga classes typically starts with meditative exercises like pranayama which purpose partially is to prepare the mind for Asana practice.
Answer: Concentration on your breathing during any posture is one of the primary thing you can start with. Bring your mind on your body part(s) where you feel more stretch (or pain at initial time) during any yoga posture. ie. observing the posture along with normal breathing.
Over the period of time (3 to 6 months ), gradually you will feel that your mind will be coming under your control


Bluetooth outgoing files log

Question: I had let someone use my phone and they had bluetoothed some files to their own phone and im trying to find what they had sent so i know whether or not to worry about any private stuff being exposed.. my phone is an lg optimus f60 running 4.4.2
Answer: In my Android 4.2.1 the default Bluetooth share app records the sent/received files in a history which can be accessed by launching Bluetooth app → tap Menu key and choose Show received files. There you can see all the Downloaded as well as Uploaded(sent from your phone) files.
My Bluetooth app doesn't provide any option to delete those entries so I'm rest assured to know what was sent/received using my device's Bluetooth, unless the data was cleared from Settings → Apps.

That said, the solution is demanded for Android 4.4.x, and in this case the solution is bit lengthy.
BT share app in my Android 4.4.2 and 5.0  records the sent/received files in a database file.
If you've root access:

Download an SQlite viewer/editor from Play Store (I prefer SQLite Editor),

Launch it and find BT share or whatsoever the name is in your Android under Apps tab,

Choose the database (btopp.db in my device),

Open the tables there (btopp in my case). One of the tables would be having the entries of sent/received files,

If the device is really yours then you would know by a mere look  what was sent/received from and into your device. Anyhow, the value 0 in column Direction indicates Sent and 1 indicates Received.
There's more here. Received file entries start with content: in the Name column while Sent ones start with file:.

If you don't have root access:

Take a backup of BT Share app using adb backup <PARAMS>,

Extract the backup using Android Backup Extractor and locate the .db file under databases in the extracted content.

You can either follow the aforesaid steps 1-4 with exception of using Files tab and not Apps tab in step 2, or

You may download a software like DB Browser for SQLite and follow aforesaid (under root access section) step 3 and 4 .

We're good to go!
Comment: Note that nothing in the solution would possibly work if that user cleared data from **Settings -> Apps**.

Bluetooth outgoing files log


Iterate every month with date objects

Question: So I have two ruby Date objects, and I want to iterate them every month. For example if I have Date.new(2008, 12) and Date.new(2009, 3), it would yield me 2008-12, 2009-1, 2009-2, 2009-3 (as Date objects of course). I tried using range, but it yields every day. I saw step method for Date however it only allows me to pass number of days (and each month has different number of those). Anyone have any ideas?
Answer: Here is something very Ruby:
first day of each month
(Date.new(2008, 12)..Date.new(2011, 12)).select {|d| d.day == 1}

It will give you an array of the first day for each month within the range.
last day of each month
(Date.new(2008, 12)..Date.new(2012, 01)).select {|d| d.day == 1}.map {|d| d - 1}.drop(1)

Just note that the end date needs to be the month after your end range.
Comment: really? is 4000 years a large enough date range? Benchmark.measure {(Date.new(1, 1)..Date.new(4000, 12)).select {|d| d.day == 1}}
=>   1.170000   0.000000   1.170000 (  1.181518)
Comment: And inefficient for large date ranges
Comment: (Date.today.beginning_of_month..x.beginning_of_month).select {|d| d.day == 1}    <<< Includes the first month
Comment: What is the difference? A new Date object without the day defaults to the first day.

Date.new(2009,3) == Date.new(2009,3,1)
Comment: I guess the only other problem is that it doesn't include the first month unless you create Date objects like you do here that start on the 1st.  I like it though.
Comment: The question says that it should return the first date, not the beginning of the month of the first date
Answer: I find that I need to do this sometimes when generating select lists of months. The key is the >> operator on Date, which advances the Date forward one month.
def months_between(start_month, end_month)
  months = []
  ptr = start_month
  while ptr <= end_month do
    months << ptr
    ptr = ptr >> 1
  end
  months
end

results = months_between(Date.new(2008,12), Date.new(2009,3))

Of course, you can format the results however you like in the loop.
months << "#{Date::MONTHNAMES[ptr.month]} #{ptr.year}"

Will return the month name and year ("March 2009"), instead of the Date object. Note that the Date objects returned will be set on the 1st of the month.
Comment: this is the only valid answer here since it explains `Date#>>`
Answer: I have added following method to Date class:
class Date
  def all_months_until to
    from = self
    from, to = to, from if from > to
    m = Date.new from.year, from.month
    result = []
    while m <= to
      result << m
      m >>= 1
    end

    result
  end
end

You use it like:
>> t = Date.today
=> #<Date: 2009-11-12 (4910295/2,0,2299161)>
>> t.all_months_until(t+100)
=> [#<Date: 2009-11-01 (4910273/2,0,2299161)>, #<Date: 2009-12-01 (4910333/2,0,2299161)>, #<Date: 2010-01-01 (4910395/2,0,2299161)>, #<Date: 2010-02-01 (4910457/2,0,2299161)>]

Ok, so, more rubyish approach IMHO would be something along:
class Month<Date
  def succ
    self >> 1
  end
end

and
>> t = Month.today
=> #<Month: 2009-11-13 (4910297/2,0,2299161)>
>> (t..t+100).to_a
=> [#<Month: 2009-11-13 (4910297/2,0,2299161)>, #<Month: 2009-12-13 (4910357/2,0,2299161)>, #<Month: 2010-01-13 (4910419/2,0,2299161)>, #<Month: 2010-02-13 (4910481/2,0,2299161)>]

But you would need to be careful to use first days of month (or implement such logic in Month)...
Comment: Well, the only "rubyish" approach that comes to my mind would be defining "Month" class (by inheriting Date), defining succ method and using Range on it.
Comment: Thanks Mladen!  This all_months_until method was exactly what I was looking for.
Answer: I came up with the following solution. It's a mixin for date ranges that adds an iterator for both years and months. It yields sub-ranges of the complete range.
    require 'date'

    module EnumDateRange
      def each_year
        years = []
        if block_given?
          grouped_dates = self.group_by {|date| date.year}
          grouped_dates.each_value do |dates|
            years << (yield (dates[0]..dates[-1]))
          end
        else
          return self.enum_for(:each_year)
        end
        years
      end

      def each_month
        months = []
        if block_given?
          self.each_year do |range|
            grouped_dates = range.group_by {|date| date.month}
            grouped_dates.each_value do |dates|
              months << (yield (dates[0]..dates[-1]))
            end
          end
        else
          return self.enum_for(:each_month)
        end
        months
      end
    end

    first = Date.parse('2009-01-01')
    last = Date.parse('2011-01-01')

    complete_range = first...last
    complete_range.extend EnumDateRange

    complete_range.each_year {|year_range| puts "Year: #{year_range}"}
    complete_range.each_month {|month_range| puts "Month: #{month_range}"}

Will give you:
Year: 2009-01-01..2009-12-31
Year: 2010-01-01..2010-12-31
Month: 2009-01-01..2009-01-31
Month: 2009-02-01..2009-02-28
Month: 2009-03-01..2009-03-31
Month: 2009-04-01..2009-04-30
Month: 2009-05-01..2009-05-31
Month: 2009-06-01..2009-06-30
Month: 2009-07-01..2009-07-31
Month: 2009-08-01..2009-08-31
Month: 2009-09-01..2009-09-30
Month: 2009-10-01..2009-10-31
Month: 2009-11-01..2009-11-30
Month: 2009-12-01..2009-12-31
Month: 2010-01-01..2010-01-31
Month: 2010-02-01..2010-02-28
Month: 2010-03-01..2010-03-31
Month: 2010-04-01..2010-04-30
Month: 2010-05-01..2010-05-31
Month: 2010-06-01..2010-06-30
Month: 2010-07-01..2010-07-31
Month: 2010-08-01..2010-08-31
Month: 2010-09-01..2010-09-30
Month: 2010-10-01..2010-10-31
Month: 2010-11-01..2010-11-30
Month: 2010-12-01..2010-12-31

Answer: MonthRange.new(date1..date2).each { |month| ... }
MonthRange.new(date1..date2).map { |month| ... }

You can use all the Enumerable methods if you use this iterator class. I make it handle strings too so that it can take form inputs.
# Iterate over months in a range
class MonthRange
  include Enumerable

  def initialize(range)
    @start_date = range.first
    @end_date   = range.last
    @start_date = Date.parse(@start_date) unless @start_date.respond_to? :month
    @end_date   = Date.parse(@end_date) unless @end_date.respond_to? :month
  end

  def each
    current_month = @start_date.beginning_of_month
    while current_month <= @end_date do
      yield current_month
      current_month = (current_month + 1.month).beginning_of_month
    end
  end
end

Comment: For beginning_of_month you need ActiveSupport (is from rails)
Answer: Date.new(2014,1,1).upto(Date.today).map {|date| "#{date.to_s[0..-4]}"}.uniq

Will give you a string representation of each month including it's year.
Answer: As a helper method:
def iterate(d1, d2)
  date = d1
  while date <= d2
    yield date
    date = date >> 1
  end
end

Usage:
start_date = Date.new(2008, 12)
end_date = Date.new(2009, 3)
iterate(start_date, end_date){|date| puts date}

Or, if you prefer to monkey patch Date:
class Date
  def upto(end_date)
    date = self
    while date <= end_date
      yield date
      date = date >> 1
    end
  end
end

Usage:
start_date = Date.new(2008, 12)
end_date = Date.new(2009, 3)
start_date.upto(end_date){|date| puts date}

Answer: Welp, after lurking 15 years nearly this is my first stack overflow answer, I think.
start_date = Date.new(2000,12,15) # day is irrelevant and can be omitted
end_date = Date.new(2001,2,1). #same

(start_date.to_datetime..end_date.to_datetime).map{|d| [d.year, d.month]}.uniq.sort

# returns [[2000,12],[2001,1],[2001,2]]

(start_date.to_datetime..end_date.to_datetime).map{|d| Date.new(d.year, d.month)}.uniq.sort

# returns an array of date objects for the first day of any month in the span

Answer: def each_month(date, end_date)
  ret = []
  (ret << date; date += 1.month) while date <= end_date
  ret
end

Iterate every month with date objects


Auto bed levelling with Rumba board - Servo not deploying

Question: Has anyone succeeded in installing the auto bed levelling on a Rumba board with Marlin firmware?
I have the last stable version 1.1.0 RC6.
I would appreciate some direction especially about:

How and which pin to activate for the servo?
How to test it with G-code before I move to settings of the probe sequence?

I have only installed the hardware for now (5 V servo) connected to Ext. 3 (EXP3):

Pin 2 (+5V);
Pin 4 (GND), and;
Pin 6 (PWM),

but I cannot move it with the G-code command M280 P0 S180. I have no idea where to put my hands on firmware to get this going. However my ultimate goal is to set the ABL.
Comment: To have two Z min switches you would have to wire them in parallel so that if either are triggered the board would see it, but this is not the standard way of implementing auto leveling, and you will want to ensure under normal operation that the mesh leveling switch will always hit first, and maybe set the second switch .5 mm lower, so there would be a light but not detrimental collision with the bed, It will be nearly impossible to get them both to trigger at the same time and still get the benefits of mesh leveling.
Answer: For future reference.
My issue about the servo not moving was caused by a wiring mistake.
The Exp. 3 has 14 pins has per this diagram.

However when phisically looking at the board, what you see is this:

I took the first 2 pins on the right of such connector and the 3rd one of the first row thinking that I was connecting pins 2-4-5 of Exp. 3.
I was wrong, because the first 2 (1-2) pins are not part of Exp. 3.
The right way to connect the servo is as following:

Then use PWM1 (pin 5 Ext.3)
I decided to leave trace of this issue and the relevant solution for someone that may experience the same issue.
Answer: General note, I do not have this board so I cannot test these steps myself, read the documentation in configuration.h, it is very detailed and should guide you pretty well. I am specifically looking at Marlin 1.1 RC7 on Github, so the lines below may vary slightly from what you see.
As to the pins to connect on the board for the servo, pins_RUMBA.h is where they are defined/mapped. For other boards, there is a pins_[your_board_name].h that will define the pins for any given board.
The default Servo pin for Rumba is:
#define SERVO0_PIN         5

Pin 6 appears to be used for a third extruder heater.
#define HEATER_2_PIN        6   // EXTRUDER 3

In configuration.h you must uncomment (delete the slashes "//" at the beginning) the lines and fill in your stow and deploy angles in the second line for the servo. Find these lines under the Z probe options heading.
//#define Z_ENDSTOP_SERVO_NR 0
//#define Z_SERVO_ANGLES {70,0} // Z Servo Deploy and Stow angles

Define your probe offsets from your extruder nozzle:
#define X_PROBE_OFFSET_FROM_EXTRUDER 10  // X offset: -left  +right  [of the nozzle]
#define Y_PROBE_OFFSET_FROM_EXTRUDER 10  // Y offset: -front +behind [the nozzle]
#define Z_PROBE_OFFSET_FROM_EXTRUDER 0   // Z offset: -below +above  [the nozzle]

Based on your comment for using two z end stop switches, there is an option you must enable to use the standard end stop switch for homing, and only use the probe end stop for mesh bed leveling type operations. The config.h file has a lot of information on this, please read it for your own and your printers safety.
Uncomment this line:
//#define Z_MIN_PROBE_ENDSTOP

and comment this line:
#define Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN

Then set the carriage height to allow the z probe room to swing down and move:
#define Z_PROBE_DEPLOY_HEIGHT 15 // Raise to make room for the probe to deploy / stow
#define Z_PROBE_TRAVEL_HEIGHT 5  // Raise between probing points.

For autobed leveling uncomment:
//#define AUTO_BED_LEVELING_FEATURE // Delete the comment to enable

Then set probe points corners:
#if ENABLED(AUTO_BED_LEVELING_GRID)

#define LEFT_PROBE_BED_POSITION 15
#define RIGHT_PROBE_BED_POSITION 170
#define FRONT_PROBE_BED_POSITION 20
#define BACK_PROBE_BED_POSITION 170

#define MIN_PROBE_EDGE 10 // The Z probe minimum square sides can be no smaller than this.

Set the number of points to probe in each direction (x and y), default is 2, so it will probe 4 locations, the other common choice is 3, so it will probe a grid of 9 locations.
// Set the number of grid points per dimension.
// You probably don't need more than 3 (squared=9).
#define AUTO_BED_LEVELING_GRID_POINTS 2

That should be everything you need for a basic setup, although there are more options that I did not go through. Please look at all the documentation comments in configuration.h file as it is very comprehensive, even if it can be a bit confusing.
I hope this helps!
Comment: Thanks for your answer. The main issue I am experiencing is to get the servo to move. If I connect it as per my question it does not move. Reading your answer looks like I should connect it to 2, 4 and the PWM to 5 and then use Servo0 in the config and in the Gcode. Is this what you mean? I have added a pic in my question showing the ext.3 diagram.
Comment: Yes, the best I can tell you should connect the signal line to pin 5, which is pwm1.
Comment: I have done everything as per your answer. I had also to activate the servo support where I have defined the SERVO NR 1. I have checked the servo functionality with an arduino board and it is fine. However when I send the Gcode M280 P0 S90 the servo does not move! Not sure about what to do.
Comment: What angle is your servo currently at? If it is already at 90 it will not move, you can try another angle to check. Also are you sure the servo index starts at 0 on that board? Try M280 P1 S80, and M280 P0 S80. Between those two commands it will check both of my suggestions. Other than that I think I've gone as far as I can to help without having ever used the Rumba board.
Comment: Thanks for your help. Since I had to defined the number of servos in the section Servo support, I used 1, if I give a P1 it returns "servo out of range" while with P0 nothing is happening. Not defining the servo number, the firmware does not compile and returns the error "define number of servo". I have tested the servo again with an Arduino and it is fine. I tried both pins 6 and 5 ext. 3, but it does not move. If I run G29, the printer execute the ABL but the servo does not move. I moved it manually in an intermediate position to avoid having it already in the end position. Nothing!
Comment: I have not resolved my issue about the servo, however you have given me a good answer in reply to my question and therefore you have deserved the bounty. Thanks for the effort.


How to make LC circuit just using Capacitor and Inductor?

Question: I am experimenting with inductor so I am looking for a simple circuit that will blink the LED with oscillator circuit. Basically turn on and off LED and finally diminish. How can I do so? For power input, I am using Raspberry Pi - 5V. Here is my circuit? what am I missing here?
Comment: This will likely get you a blown LED.
Comment: "Is my circuit wrong?" Probably. But we don't know what exactly you want to do apart from "finally diminish". Try to describe in several, preferable simple, sentences what you want to happen. Like: *"Press button: LED on. Release button: LED off after 2.65 seconds, Run from 3.7V Battery etc."*.
Comment: I sense XY problem!
Comment: 270mH is a quite big inductor, there's a reason these aren't used directly for energy storage.
Comment: how do I calculate the required value? Is my circuit wrong?
Answer: I assume you try to get use of the fact that in source free RLC circuit energy will flow back and forth between capacitance (C) and inductance (L) and therefore will blink your led. Well, this is not going to work because led is diode and diode as you may know conducts current in only one direction. So what may happen at best is your diode will slowly go off. However your did not limit led current so it may already be dead.
Below circuit on the other hand will blink the leds for you with frequency determined by RC time constant:

How does it work? Assuming capacitor were discharged and left transistor were ON first, the left bulb will be ON while right OFF. But when left trasistor is ON it also cherges its capacitor and when it is full charged it turn right tranistor ON. When this happens the base of left transistor goes negative due to right hand capactor discharge and therefor now only left bulb lights. The whole process repeads indefinetely.


Directory Nodes Over Cloud Databases

Question: Why does Tor use multiple directory nodes instead of something like multiple cloud databases? Because then DDoS attacks couldn't take place on the directory nodes, as there aren't any, and cloud services like Google Cloud support concurrent requests onto cloud databases; wouldn't this be easier than having directory nodes that have to always stay online?
Answer: First of all, read about all of the things that directory servers do:
See Sections 6.3 and 7 of the Tor design document.
I think the most cogent things are:

Directory servers aren't just any old servers that are randomly
picked, they are trusted servers.
One of the possible attacks that concern the Tor developers is, an attach that will "Trick the directory servers into listing a
hostile [Onion Router]. Our threat model explicitly assumes
directory server operators will be able to filter out most hostile
ORs."

Your question assumes that the Tor developers could possibly trust a service like Google Cloud to be a good and trustworthy holder of the kind of data that could bring down the entire network. I don't think anyone who cares about the Tor network would outsource that kind of responsibility. When you also read about the other things that the directory services do, you would still need those services anyway.
Answer: Well, if something Truly decentralized - like a PoW blockchain registry - is used, then current architecture of the Tor network is not a bit worse in comparison with a cloud databases: we must either eliminate a centralization totally, or accept a trusted portion of it. Cloud databases - to be able to be successfully queried from any place and without any pre-seeded consensus will be the same centralized case

Directory Nodes Over Cloud Databases


Advantages of 4-2-3-1 formation

Question: Barcelona has clearly been one of the most dominant sides in European football in the past few years. They often play a 4-2-3-1 (or sometimes 4-3-2-1) formation. Is the primary advantage of this formation just that most other sides are still playing with 4-4-2 and so a 4-3-2-1 allows for more presence and control of the midfield?
Comment: To answer the question on places to read about football strategy, I would highly recommend [Zonal Marking](http://zonalmarking.net/).
Comment: Zonal marking is great for in depth analysis of a particular game. For a more historical perspective, can also read "Inverting the Pyramid: The History of Football Tactics", by Jonathan Wilson.
Answer: Well for one, you have the advantage of not being over run in midfield. For example, if you play 4-2-3-1 against a classic 4-4-2 then you have 3 central midfielders (2 defensive, middle of the attacking three) against the 2 central midfielders of the 4-4-2.
Additionally, in a 4-2-3-1 the 2 defensive midfielders can concentrate on providing the defensive shield in front of the back 4, while converting defense into attack, yet not usually getting caught in highly advanced positions, thus leaving the team exposed on the counter. Think of players like Xabi Alonso and Sergio Busquets, who make a living out of playing these positions.
Answer: Actually Barcelona uses that formation only on paper. They rarely have 4 players playing as defenders, they kinda use 3 (two central defenders and one full back pass the ball between them and the keeper). Playing like this allows them to have a greater number of players in front (where two of the attacking players sit very wide on the pitch) which is extremely useful if the other team is pressing.
About 4-2-3-1. I guess it's a very good formation because it allows you to use a large type of players on every compartment depending on your needs. In fact this formation is played by teams with a bigger squad (which has very good defenders, 2 or 3 defending midfielders and very skillful attacking players - see Barcelona, Real Madrid, Manchester City, Borussia Dortmund and Bayern's tactics and depth of squad).
It is also a good formation because it allows a larger number of players run freely.
All this information are from talk shows and math analyses.
Comment: +1 on Barcelona, they played a 3-3-4 moreover a 3-3-3-1 with Sanchez the furthest in attack with messi behind in the 10 role.

Advantages of 4-2-3-1 formation


LinkFilename - display text from other field

Question: I have document library with column LinkFilename which renders link to document, where text is the name of the file. Is it possible to modify column is such way, that it will still render link to document but the text will be coming from another field (eg. MyTitle)?
Answer: Yes it is possible, when you select a field and go to further properties [as shown in the below article], you can choose which field should make the link and which to appear as text... These options are available when the field is supposed to work as HyperLink
Data View Web Part, The Basics - Add a Hyperlink
I hope this helps
Answer: It could be accomplished by customizing the Rendering of a Field on a List View using XSLT
Below is described solution using SharePoint Designer (SPD).
Solution
In SharePoint Designer (SPD) open view page (AllItems.aspx) in Designer Mode. Select list item in List View that have to be customized (Name column) and then click Customize Item as shown on picture below

Switch to Code Mode and find template code for rendering LinkFilename generated by SPD
<xsl:template match="FieldRef[@Name='LinkFilename']" name="LinkFilenameNoMenu.LinkFilename" mode="Computed_LinkFilename_body" ddwrt:tag="a" ddwrt:dvt_mode="body" ddwrt:ghost="show">
...
</xsl:template>

Inside template replace the line for rendering FileLeafRef value:
<xsl:value-of select="$firstname.lastname@example.com" />

with the following one:
<xsl:value-of select="$thisNode/@MyTitle" />

Note:
  Custom field with internal name MyTitle is used here

After you save your changes your page should look like this one:

Comment: Only works when Mytitle is also in the view, else its not a part of thisNode.


Is a 20 ft by 12 ft workshop a good size for a woodworking shop?

Question: I'm in the planning stage of building a shed. I would like to be able to use a table saw and various other tools (drill press, router table, compound miter saw, etc). Would a 20x12 shed be big enough? I would like room to grow a little but space is a limiting factor.
Comment: This is the type of thing that can't be definitively answered, so not a good fit for the SE format. But in basic outline 20x12 is *more* than adequate for a home shop.... to give you some context this is 3 times more floor space than a typical/average workshop over here just a short while ago, and I personally know many (including numerous TS users) whose workshops are much smaller than this.
Comment: Yes, definitely "opinion-only" type question. But, honestly, the answer to this question is _always_ a resounding "yes!". _Any_ size shop is good enough. Just make it work.
Comment: If the community decides this isn't a good fit so be it. I've answered this anyway because it is a pretty clear and common question for hobby shops. And, while this is my opinion, it is shared by a great many folks out there.
Comment: Follow-on to my Comment under @jdv's Answer, in terms of tools that one feels are must-haves but actually aren't, not a few would class a table saw that way (although yes, hugely useful, all its tasks can be done another way which don't require that size of footprint being taken up permanently in a prominent position). But a better example is the compound mitre saw, absolutely not a key purchase! Heaps of woodworkers don't own one and many would try to talk anyone setting up a home shop out of one as a needless waste of money and space (even more so due to the infeed & outfeed requirements).
Comment: Yeah, a mitre saw for finer woodworking (as opposed to to trades work) is not recommended. That would be last tool I'd ever considering buying.
Comment: I already own a compound miter saw that I bought for my late father.
Answer:
Would a 20x12 shed be big enough?

Yes! You can do woodworking in almost any sized space, but 20x12' is practically king-sized compared to what some of us have. There is no reason you can't have a shop in a corner of a garage that you share with a car, or a part of a basement.
My advice is to start slow. Don't buy equipment just to own it. Have your projects earn that equipment. Start with hand tools and some common useful power tools. Use those tools to build some tool storage and work areas. Learn how to design to maximize your workspace. Figure out how to put stuff on wheels.
There are scads of "small hobby wood shop" sites on the internet and YouTube. See what others are doing. There are all kinds of free plans out there that you can use to turn almost any small space into a functional shop. There has never been a better time to dive as deep as you want into woodworking! Don't let some notion of square footage and the dream of what tools you want tomorrow interfere with the chips you can make today.
Comment: +1 Couldn't agree more with the second paragraph. *"Have your projects earn that equipment."* Yes! A similar thought with somewhat the same motivation I've read a few times is a tool should earn its place right from the start. Either way, it helps counter (and then hopefully conquer) the inclination to have tools because they're just something one has in a workshop.
Answer: It should be very adequate along with jdv suggestions
Suggestions 1) insulate and heat (maintain 50* or so temp) your building (and cover the walls) for your comfort and a stable environment for your tools* and supplies 2) a minimum of an 8' ceiling 3) all of your equipment on wheels and the same table height if possible 4) DUST Control!! 5) ability to lock the building 6)look for used equipment 7) lots of lighting
*I used to use an unheated garage and had problems with rust on cast iron and wood warpage.


Java TrayIcon message close button

Question: The real question here might be if there's a better way to display desktop messages in Java.  However...
I'm using the Java trayicon to display messages to a desktop user.  Because they want to keep certain messages up until the user clicks on them, in order to use the 'displayMessage' feature, I have to keep displaying them until the user clicks on them and I get an action command.  However, if the user clicks on the little close button, I don't get an action command.
I'm developing this on linux, but the users are on windows, which complicates the testing.  Also, obviously this isn't what the trayicon functionality was designed for, so if there's a better way to do this, let me know.
Thanks in advance.
Answer: What about just using a dialog window, e.g. java.swing.JOptionPane.showConfirmDialog(...)?
Here's an article about it: http://download.oracle.com/javase/tutorial/uiswing/components/dialog.html

Java TrayIcon message close button


Shadow Catcher blocks background image in 2.8

Question: I'm pretty new to blender, and as I was getting used to 2.79, 2.8 landed and confused me ever more. I was wondering why the Shadow Catcher blocks the background image I set even if I checked transparent under Film.
Answer: Found out an answer. I should've just searched tutorials instead of troubleshooting forums instead.
Here's the link that helped.
https://www.blendernation.com/2017/04/17/use-new-blender-shadow-catcher/
So I apparently just needed to hit render and mix up some nodes in the compositor.
Thanks to the people who took their time to correct my post as well!


"With Editor" for more than forty days

Question: Is it normal for a journal submission to show "With Editor" for more than forty days?
Answer: Short answer: yes
Longer answer: there is probably a line of papers before you, so takes a while before the editor sees your paper. Remember, that editors typically do this as volunteer work, so they have to fit this next to their normal duties. Then they need to find reviewers. They have to give them time to agree to review or not. When not they need to find another reviewer. All that adds up.
My advice: just forget about that paper until you hear from the journal and instead focus on your next paper.
Comment: Good answer. One might add "even more so in the middle of a pandemic". From what I've heard, it's harder to find reviewers than ever.

"With Editor" for more than forty days


Is empirical evidence different from evidence?

Question: Is it superfluous to say "empirical evidence" instead of just "evidence"? How are those two different? Is there such a thing as evidence that is not empirical?
Comment: "Empirical" simply means "based on experience/observation/experiment".  The antonym of sorts is "theoretical" or "logical".  I could, eg, use some mathematical theorem as "evidence", based purely on the fact that it's been "proven" mathematically, without any sort of practical test.
Comment: There is also [_anecdotal evidence_](https://en.wikipedia.org/wiki/Anecdotal_evidence).
Comment: Good point there.
Comment: While it is only one definition of empirical  (websters https://www.merriam-webster.com/dictionary/empirical) "3. capable of being verified or disproved by observation or experiment" is what I think the distinction being made when empirical is used to modify evidence.  My experience (opinion, why I'm not making this an answer) is that the idea that the evidence can be "reproduced" accompanies that use.  I do not believe a fingerprint is typically called "empirical evidence" but something like "we have empirical evidence that to make a skid mark 50 feet long, ~a~ car must be traveling Xmph
Answer: It isn't superfluous, but it might be unnecessary. People do tend to mean empirical evidence when they talk about evidence. Empirical evidence is the evidence of the senses, of direct observation or measurement. Compare that to rational evidence, which is evidence that is the result of deduction or other reasoning, or anecdotal evidence which comes from personal testimony (which may be reliable or not).
For example, here we have Bob, and a dead man with a knife in his back.

The knife has bloody fingerprints on it.
The blood is tested and found to be the dead man's blood.
The bloody fingerprints match Bob's fingerprints.

Individually, these are all empirical evidence. Together they justify the claim that Bob handled the knife, after touching the man's blood. They might also be referred to as "forensic evidence," meaning (empirical) evidence gathered or used in the scientific investigation of crime.

Bob owns a knife.
Bob's knife is missing.
The knife in the dead man's back is the same kind of knife as Bob's missing knife.

Together, these form rational or circumstantial evidence that justifies the claim that the knife in the dead mans' back is Bob's knife.

Sue says her mom used to say that someone who owns knife and isn't a cook is probably a murderer.
Jack says he's never seen Bob chop a vegetable in his life.
Bob's neighbors say he was "the quiet type" and "you know how that is."

These statements are anecdotal evidence that Bob is probably a murder. As is often the case, this evidence should be treated with skepticism unless supported by some other kind of more reliable evidence.
Comment: I believe that a fingerprint or a bloody knife would be described as "physical evidence" or "forensic evidence" rather than "empirical evidence" even if "empirical evidence" could technically apply.  I believe that the choice of the word "empirical" would relate more to the idea that a fingerprint can be matched to an individual by any expert, in a replicate-able fashion .. 2 cents for what it's worth if someone is grasping for words for different sorts of evidence
Comment: @Tom22, I think you're right. But I think that when we say "forensic evidence" we are using shorthand for "(empirical) evidence that supports the forensic (science-based) approach to investigating crime") So, I would say that, generally, forensic evidence is empirical (sensible, measurable) evidence. As you suggest, which term an author uses would depend on what emphasis is desired.
Answer: A good example would be:
A workplace has loud equipment working in it. This poses a risk to the workers. There are prescribed maximum levels of noise beyond which it has been proven to be damaging to hearing.

There is empirical evidence (through medical observation) that exposure to 85 decibels is damaging.
Manager X arranges for noise surveys  (measured using detecting equipment) of the workplace. The results range from 65 to 75 decibels. He has empirical evidence that the legal exposure limit of 85 decibels is not being exceeded.
Comment: I don't think you've addressed the difference between empirical evidence and just 'evidence'.


Infragistics Windows Grid

Question: I'm using the Infragistics WinForms UltaGrid control and I'm setting the RegexPattern property.  How do I get the grid cell I'm setting the RegEx for to actually use that pattern to restrict entry?  Or am I misunderstanding how the RegexPattern property works.
Jeff
Answer: RegexPattern property for the column is used for cell value validation. So if you set this property and your user tries to edit a value in the column, it will be validated against this Regex, after he is done.
Answer: Which version of NetAdvantage are you using? There is no RegexPattern property of the UltraGridCell class in NetAdvantage 2008.
However, if you are refering to the RegexPattern property of the UltraGridColumn class it will do what you want. The value of the cell must give exactly one match or else the validation will fail.
Answer: The Regex property only validates after a users clicks out of the cell. It does not restrict the initial entry. I would try modifying the UltraGrid.KeyDown event if you want to apply the RegexPattern to the key value as they are entered.

Infragistics Windows Grid


Visual Studio 2012 RC + jQuery UI = Bug?

Question: I'm at my wits' end! I'm trying to do something that (I believe) is a VERY simple jQuery UI process, but I can't get it to work. I'm not sure what to pin down as the variable that's causing the issue.
It could be:

My code
Visual Studio 2012 RC
jQuery UI 1.8.22

What I'm trying to do is create a jQuery button and put an icon on it. The icon I want is the plus-thick icon.
Here are the css and js "imports" for the page (is their order incorrect???):
<link rel="stylesheet" type="text/css" href="Content/Default.css" />
<link rel="stylesheet" type="text/css" href="Content/themes/cupertino/jquery-ui-1.8.22.custom.css" />

Here's the code I'm using to attempt to do this:
$('.headerButtonsDiv > a')
.button()
.button("option", "icons", { primary: 'ui-icon-plus-thick' })
.click(function () {
    var text = $(this).text();
    alert(text + ' clicked!');
    return false;
});

This was my first try (same result as above, by the way):
$('.headerButtonsDiv > a')
.button( { icons: { primary: 'ui-icon-plus-thick' } } )
.click(function () {
    var text = $(this).text();
    alert(text + ' clicked!');
    return false;
});

There are three buttons that are affected by this code.
Here are the results:

The  elements are correctly converted into jQuery buttons.
Each of the buttons correctly has an icon on the left side of the button.
Each of the buttons INcorrectly has the carat-1-n icon instead of plus-thick.

When I go into the page inspector (using IE and/or Chrome), I drill down to the button (converted  element) and see it and its 2  sub-elements. While the  element for the icon DOES HAVE the ui-icon-plus-thick class applied to it, it DOES NOT HAVE any background-position applied.
So, although the class IS present, it's not actually being applied. When I manually add the background-position attribute (background-position: -32px -128px;), "magically" the correct icon appears ;-).
I think I can figure out a workaround whereby I create the button and then attempt to select the correct  sub-element and then "manually" apply the background-position myself, but isn't that exactly what the jQuery library is supposed to do?
In any case, if anyone can see where I've gone off the rails, I'd really appreciate it! This truly is a small issue, but if I can't get THIS to work, I'm not confident about the more complicated issues.
Answer: I'm glad I saw this answer before anyone else could point out my stupidity!!!
The class I ACTUALLY wanted is: ui-icon-plusthick.
What I USED was: ui-icon-plus-thick.
I stared at this for 2 hours and never noticed the difference of a single dash ("-").
Arrrrrrrghhhhhh!!!!!


Relativity and Momentum of photons

Question: I read somewhere that as the speed of a particle approaches c, its mass tends to infinity. Light is composed of particles (photons). If that is the case, then why don't we feel an enormous weight whenever light falls on us?
Comment: I would like to simply comment that the statement "a particle's mass tends to infinity as its speed approaches c" is a relic of one of the worst conventions ever created by modern physics, the "relativistic mass." This mass is defined as the Lorentz factor times the rest mass. It is far, far better to think of mass as an invariant quantity and simply write γm everywhere, for the invariant mass m. You will then not have the problem you asked about.
Comment: Strongly related or perhaps a duplicate: https://physics.stackexchange.com/questions/2229/if-photons-have-no-mass-how-can-they-have-momentum
Answer:
as the speed of a particle approaches c, its mass tends to infinity.

This statement is true only for particles with a non-zero rest mass $m_0$.
If such a particle moves with velocity $v$ it will have the total mass
$$ m = \frac{m_0}{\sqrt{1 - \frac{v^2}{c^2}}}  \tag{1} $$
From this formula you can indeed see, that for $v$ approaching the speed of light $c$,
the mass $m$ goes to $\infty$.
But for photons the situation is different, because they have rest-mass $m_0 = 0$.
Then equation (1) yields $m = \frac{0}{0}$ which is mathematical nonsense.
But you can at least rearrange equation (1):
$$ m \sqrt{1 - \frac{v^2}{c^2}} = m_0  $$
For photons you can set $m_0 = 0$ and $v = c$, and you get
$$ m \cdot 0 = 0$$
This simply means that a photon can have any mass $m$.
But it does not mean $m = \infty$
Comment: This answer is largely misleading. Photons don't have any mass, i.e., their mass is simply zero. It is totally incorrect to say that they can have any mass $m$. Also, the kind of "re-arrangement" you are proposing is not allowed. First and foremost, even $m=\frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}$ is not a legal formula. The concept of relativistic mass is banned in physics for good. [...]
Comment: [...] Nonetheless, for massive particles, you can write $E=\frac{m_0c^2}{\sqrt{1-\frac{v^2}{c^2}}}$ (where I shouldn't be writing $m_0$ to denote the invariant (rest) mass, I should only be writing $m$ as that is the only legal mass in physics). But, this is strictly a formula only for massive particles. For massless particles, you simply cannot write such a formula. The "analogous" formula for massless particles is simply $E=pc$ with no reference to mass whatsoever.
Comment: @DvijMankad I agree that the old nomenclature of rest mass and relativistic mass
has been abandoned in physics by now, and for a good reason. But nevertheless it still persists in popular science literature. The statement quoted by the OP is obviously using this old wording. That's why I continued to use this wording, to solve his question. Using the new meaning of mass here, in my opinion would have added more confusion than enlightening.
Answer:
as the speed of a particle approaches c, its mass tends to infinity.

While statements like this appear frequently in the literature (pop-sci and textbooks),
it needs more modern terms and a more precise description of the limiting process.
Consider this energy-momentum diagram of a particle with rest-mass $M$.

The tip of the 4-momentum (at P) of a massive particle lies on a particular hyperbola [called the mass-shell], where the rest-mass is constant.
The tip of the 4-momentum of a massless particle, like the photon, lies on the null-cone [along the cyan-dotted line].
To get from this massive particle with rest-mass $m=M$ to a massless particle $m=0$,

one could try to "make the particle move faster" by following the "fixedm" sequence along its mass-shell, while keeping its rest-mass constant.

This is actually your first sentence.

As others have mentioned, "mass tends to infinity"
implicitly uses an archaic and deprecated term "relativistic mass"
(which is perhaps-mistakenly attributed to Einstein,
although Einstein distanced himself from it ---- [see ref]).
A modern interpretation of "[relativistic] mass tends of infinity"
is that the "relativistic-energy tends to infinity",
which amounts to increasing the upward component in the plot above
(say
by following the fixedm process).

But this won't achieve a massless particle because you are always on this mass-shell (keeping rest-mass $m$ constant with value $M$),
which asymptotically approaches the null-cone (in any frame)
but never reaches the null-cone [where $m=0$].
one could try to follow "fixedE" to the null-cone,
which is sequence of faster particles with decreasing mass but increasing relativistic-momentum, but all with the same relativistic-energy in this frame.
In this limiting process,
one reaches the null-cone and results in a massless particle with the same relativistic energy as the original massive particle.
one could try to follow "fixedp" to the null-cone,
which is sequence of faster particles with decreasing mass and decreasing relativistic energy, but all with the same relativistic-momentum in this frame.
In this limiting process,
one reaches the null-cone and results in a massless particle with the same relativistic momentum as the original massive particle.
or one could try some other sequence with varying velocity $v$ and varying $E$, $p$, and $m$ to reach the null-cone.

So, I think that one should really spell out the limiting procedure,
accompanied with a physical model of how to take that limit.

(This reply elaborates on a similar post I made at
https://www.physicsforums.com/threads/massless-photon.900960/page-3#post-5842652 )

ref:
Einstein Never Approved of Relativistic Mass
The Physics Teacher 47, 336 (2009); https://doi.org/10.1119/1.3204111
Eugene Hecht
The Concept of Mass in the Einstein Year
https://arxiv.org/abs/hep-ph/0602037
L.B. Okun
On the Abuse and Use of Relativistic Mass
https://arxiv.org/abs/physics/0504110
Gary Oas

Relativity and Momentum of photons


Does "apparent frequency" mean the Doppler effect is not an actual physical effect?

Question: When discussing the Doppler effect, we use the word "apparent frequency". Does that mean that the frequency of sound is still that of the source and that it is some physiological phenomenon in the listener's ear that gives rise to Doppler effect? Is this different for the observer approaching the source and for the source approaching the observer?
Comment: If the Doppler effect were physiological, then it likely wouldn't happen to *all* sounds for *all* people ;). But since it does, it follows that it is a *physical* phenomenon, no?
Answer: The word "apparent" means "as observed at a particular point X". Different observers will observe different frequencies depending on their relative velocity to the source. This doesn't change the frequency of the sound that is generated; just the frequency of the sound that arrives at the ear of the observer.
Comment: This is the only answer (at this moment) that gets at what I think is the critical issue, which is that in physics the word "apparent" does _not_ mean that something is a purely psychological effect, nor that it is not real.
Answer: Think of a car stopped with it's siren or  horn or radio (playing the same note)  turned on,  it has a certain fixed frequency.
Then the car moves towards you, it's siren stays exactly at  the same frequency as when it was stopped , but  this frequency is apparently higher only to you. This is because more waves are entering your ear per second than when the car was stopped.  To the car driver, he/she does not notice any difference in frequency. So that's the source approaching the observer.
If the car stopped and you approach it, at high enough speeds, (in another car), you will still get the same effect, an apparent increase in frequency, but still only apparently higher to you, not the first car driver.
Last case, the car drives towards you and, at the same time , you drive away from the car.  The apparent frequency you hear will depend on the difference in the two car,s speeds.
Answer: The Doppler effect is a real physical effect that derives from the relative motion between a wave source and an observer.
Say I'm driving along, playing a recording in my car of a steady F# tone. Since I am in the car traveling along with the speakers, I hear the tone as F#. My friend is standing on the curb with his boom box playing the same tone, and hears F# from his speakers as well. This happens because there is no relative motion between me and my speakers, or between him and his speakers.
There is, however, relative motion between me and the boom box, and between my friend and my car; so as I drive toward him we each hear the other emitting a G tone.
That's the perspectival approach to it: the physical explanation of why that happens is that as the wave source (the speakers) move through a still medium (the air) they are "catching up" to the emitted waves ahead of them and "leaving behind" others. Let's say the tone is such a pitch that the wavelength is 1 meter when the speakers are stationary. Then we emit them from a vehicle travelling 0.5 m/s:
The waves moving in the direction of travel would normally have a wavelength of 1m, but because the emitter is "catching up" to them the wave crests are only 0.5m apart, so the frequency doubles.
The waves traveling away from the back of the car are likewise "stretched out" to a wavelength of 1.5m, so the pitch lowers compared to the still tone.
This is a better generalization of the phenomenon since some waves (electromagnetic, for example) do not travel through a medium that can flow and thus independently alter the wavelength.
Answer: It has nothing to do with physiology and everything to do with physics. If you were measuring the frequency with an entirely electro-mechanical system you would see the same effect. That was the whole point of Einstein's reasoning about light and relative motion that he used when developing the Special Theory of Relativity. The phrase "apparent frequency" is misleading. It should be something like "frequency measured in observing frame moving relative to the emitting frame" or just "measured frequency" once the conditions have been described.
Answer: Imagine,you have some balls and you are throwing the balls towards your friend and your friend is catching them.
Suppose you throw 1 ball per second and then your friend will also receive 1 ball per second if you both are at rest with respect to each other.
Now if you have some non zero relative velocity with respect to  your friend then you will still throw 1 ball per second but your friend will not recieve 1 ball per second,he will recieve X balls/sec and X depends on the relative velocity.
The similar is the situation with waves.here is the calculation,http://hyperphysics.phy-astr.gsu.edu/hbase/sound/dopp.html
your friend really will not  recieve 1 ball/sec.
AND ITS NOT AN ILLUSION.
Answer: for source moving it is real frequency ,
it is actually true that air has frequency which is different than from source releasing it
but for receptor moving source at rest it is apparent
air has same frequency as that of source but receptor detects it different
well it is one of short question in hcv
Comment: You are absolutely right about the facts but write the same answer with an explanation if you can. Use mathjax feature to write readable equations. To learn more about mathjax, [click here](http://physics.stackexchange.com/help/notation).


Compact embedding and fractional Sobolev spaces in unbounded domain

Question: It is known that there exists a compactness results involving fractional sobolev spaces in bounded domain. What about unbounded domain? More precisely, Under which conditions, we can extend the compact embedding between the fractional sobolev space $W^{s,2}(D)$ and $L^{2}(D)$, with $s\in (0,1)$ to an unbounded domain $D$. Could you provied me by some references contain such conditions and examples.
Thanks.
Answer: To the best of my knowledge, the more advanced results in this field are in the last sections of the book of Adams and Fournier. Don't seem to be very easy to apply tough. Anyway, they introduce a class of domains they call "quasi-bounded" and show that quasi-boundedness is a necessary condition for compactness of the imbedding.


Two blocks, two transactions, same hash

Question: Would a block containing a transaction with an identical hash as a previous transaction be considered valid? That is, if someone made a transaction for generating Bitcoins and solve two blocks with the same coinbase transaction, would the second block using that transaction valid?
Comment: Related: https://bitcoin.stackexchange.com/questions/26910/duplicated-hash-values-in-mining-reward
Answer: The transaction would be valid - there is nothing in the protocol that forbids this.
This is also the cause of the "duplicate coinbase" bug in the Satoshi client which I discovered a few months ago. If you create a block with a duplicate coinbase and that block then becomes orphaned it will cause the both the original and duplicate tx to be removed from the database.
Comment: @MaxSan: A miner could have, in the past, intentionally triggered this bug. It's very, very hard to do that now, since the mining difficulty is so much higher. Essentially, though, it's just an attack on themselves. They've carefully created coins they can't spend with, and which won't be accepted by, the standard client.
Comment: They can use it to make other people's coinbase transactions unspendable as well. For example If I mine a copy of the genesis transaction and that block was orphaned it would make the genesis transaction unspendable (from all clients with the corrupted database). When P2SH hits the problem will be exacerbated as you can mine a block which you can pretty much guarantee will be orphaned.
Comment: Isnt the probability in this happening make it almost not worth consider fixing? Not that im saying any bugs are a good thing. Just others should have priority.
Comment: Seems counter productive. More fool them I guess.
Answer: That's valid (and has happened) for coinbase transactions and transactions built off of coinbase transactions. Other than those strange cases, putting the same transaction in the chain twice isn't allowed.
Coinbase duplicates are only allowed due to an oversight. It will be corrected soon.
Comment: "Other than those strange cases ... isn't allowed" -> It is allowed, just incredibly hard to do (preimage attack on SHA256).

Two blocks, two transactions, same hash


QGIS Offset Points by value

Question: I've got one layer with a line (e. g. a road) and one layer with points (e. g. trees along the road). So far, the points are placed right on the line, but the attribute table of the point layer has a column called "distance", that lists the distance of the trees to the middle of the road. So is there a possibility to automatically offset the points from the line by the individual distance value?
Comment: This should be perfectly doable using `translate geometry` with data defined override incorporating Pythagoras after adding the line angle to the points.
Comment: Is there a relation between roads and trees? I.e. does the tree layer have the road id as attribute?
Comment: @geozelot: Yes, the road ID is another attribute of the tree layer.
Comment: ...and is there a relative side attribute or rule? E.g. 'to the right, in direction of the linestring'?
Comment: Yes, if the number is positive, the tree stands at the right side, left is negative
Answer: You can use the Expression String Builder on the Offset X, Y of the Label Placement using something like Array("distance",0). If the distance is in meters use Meters at Scale for example.

EDIT: Miss-read your question and I thought you want to place the label. So if you want to place the symbol based on the distance offset you can do something similar and use the Offset property of the Single Symbol.
Comment: Wow, thats much easier than I expected! It works perfectly, thank you very much! :-)

QGIS Offset Points by value


Placing an image inside of a text field with HTML/CSS/JS?

Question: Is there any way to place an image inside of a text field with HTML/CSS/JS, not using the image as a background? The image needs to be clickable and positioned on the right of the field, too. Thanks.
Answer: Other than having the image floating over the text field via positioning and z-index and adding padding to the text field to prevent the content to get underneath the image, I can't think of any other way to achieve that.
Answer: Do you mean a small image inside of a form text field? Generally you can use the placeholder attribute but the only attribute value placeholder can have is text. If/when they add in additional values for the attribute (plus not all browsers support placeholders) then you would be able to specify the opacity, float, etc in the css stylesheet.
I think it would be better if you put a small icon to the right of the text field, it would more easily and recognizably accomplish the same thing.
While you could use a z-index I think that would be a lot more work than it would be worth, kwim?
EDIT TO ADD: This was bugging me so I did a little poking around and found this link: http://www.jankoatwarpspeed.com/post/2008/11/26/Make-image-buttons-a-part-of-input-fields.aspx
I don't know how user friendly this is to you, but perhaps it's worth taking a look at!


Asp.net - Could not load type 'MyNameSpace.Reporting.UI._Default'

Question: I have one aspx page (Project.aspx) and one aspx.cs code (Project.aspx.cs). This website is installed on Client side, this works fine at the before time. But nowadays this cannot work and throw yellow page as following:

Server Error in '/mywebcom' Application.

Parser Error

Description: An error occurred during the parsing of a resource required to
service this request.
Please review the following specific parse error details and
modify your source file appropriately.

Parser Error Message: Could not load type 'MyNameSpace.Reporting.UI._Default'.

Source Error:

Line 1:  <%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeBehind="Project.aspx.cs" Inherits="MyNameSpace.Reporting.UI._Default" %>
Line 2:
Line 3:  <%@ Register Src="controls/Search.ascx" TagName="Search" TagPrefix="uc1" %>

Source File: /myweb/tool/reporting/Project.aspx    Line: 1

Version Information: Microsoft .NET Framework Version:2.0.50727.5448; ASP.NET

Version:2.0.50727.5456

Please help me something.
Thanks so much.
Answer: Thsi bit:
Inherits="MyNameSpace.Reporting.UI._Default"

In your page directive is looking for a codebehind class called _Default.  Change this to match whatever the codebehind class is called.
Comment: Thanks for your answer,
but these names are same, class name is _Default also.