Why does this NPN transistor operate differently if it comes before the switched element?

Question: I'm simulating turning an LED on with a transistor switch in LTSpice. To my bewilderment, the current through the LED in Circuit 1 is ~51 mA and the current through the same in Circuit 2 is only ~6 mA. The circuits are identical except for the placement of the transistor. In Circuit 1, the transistor's emitter is connected to ground and in Circuit 2, the transistor's emitter is connected to the load. What am I missing here?
Comment: In the second circuit (*emitter follower*), the voltage across R1 + D1 is Q1's Vb minus one diode drop. In the first circuit, it is V1 minus Q1's Vce.
Comment: C suffix is an invalid part number (missing Colour, but all appear to be GaAs old technology)  "SUPER BRIGHT 0402" = 35 mcd is NOT SUPER. 1000 mcd would be SUPER  ( Due to size and luminent density, it would be super glare)
Comment: What do you need to learn? I have 2 solutions that do not need 5V. Questions?
Comment: Did you have any questions from my answer?
Answer: Let me simplify the schematics a bit. I'm going to replace your \$3.3\:\text{V}\$ voltage source and the two resistors surrounding the BJT base with a single Thevenin equivalent voltage source and series resistance. And I'm drawing both your schematics together here:

simulate this circuit – Schematic created using CircuitLab
On the left side, it is possible for the collector voltage to be very near the emitter voltage if the base current is sufficient (and it is.) So almost all of the \$5\:\text{V}\$ can be applied to the series pair, \$D_1\$ and \$R_2\$ (given sufficient base current, which you do have.)
On the right side, the collector is locked at \$5\:\text{V}\$ and the base must be below \$3\:\text{V}\$ because of a small, unknown voltage drop across \$R_1\$. Further, the emitter has to be another diode drop below that, so nearing \$2.3\:\text{V}\$. This means that the collector-to-emitter voltage drop in this case must be around \$2.7\:\text{V}\$. So that much is being "thrown away" by \$Q_1\$, leaving only \$2.3\:\text{V}\$ left over to be applied to the series pair, \$D_1\$ and \$R_2\$. That's a lot smaller voltage, especially considering the fact that the LED will use up most of that, leaving only a small voltage drop across \$R_2\$ and therefore a much smaller LED current.
So the two cases are quite different. I get it that you just think of the NPN BJT here as a switch. And if so, that there should be no difference -- that you should be able to put the "load" on either side with the same effect. But that's just not the case.
Answer: In each circuit, the NPN has sufficient base drive available.
In circuit 1, with sufficient base drive, the transistor saturates and VCE is negligible (< 0. 2 V). Therefore the LED current is defined by its series R1 and V1. With ~ 2.2 VF needed for the LED, the current is (5-2.2)/54 = 51 mA.
In circuit 2, the NPN is not saturated. The base is driven to about 3.3 V by V2, and so the emitter is about 0.7 V below this -- e.g. 3.3-0.7 = 2.6 V. If the LED requires 2.2 V, this leaves only 0.4 V across the 54 Ω, for a current of 0.4/54 = 7 mA.
Note that this current is still consumed from V1, but the magnitude is not significantly affected by the value of V1 (as long as it is more than about 2.8 V).
Comment: Yes -- but it is a variable resistance ! This is exactly how a transistor works: If the emitter current is defined (i.e. controlled), and VCE > 0.2 V, the collector current will be beta/(1+beta) times the collector current.
Comment: In Circuit 2, what happens to the 5V voltage? We have +5V at the collector, 3.3V at the base and 2.6 V at the emitter. Does that mean there is an (invisible) resistance of dV/I=1.7V/6mA=2400 Ohms at the NP junction inside the transistor?
Answer: In Circuit 1 the NPN is wired as a common-emitter inverting driver. The voltage being applied to the LED and dropping resistor is about:

5V - Vce(sat) = 5V - 0.2V = 4.8V

This gives the best possible drive, and could even be used with a 3.3V supply for both the LED and driving source because Vce(sat) is small.
In Circuit 2, the NPN is wired as an emitter-follower non-inverting driver. The voltage being applied to the LED and dropping resistor is about:

3.3V - Vbe(sat) = 3.3V - 0.7V = 2.6V

The biggest difference is that the follower action limits the positive swing to 3.3V - Vbe(sat). This results in a much lower voltage being delivered to the LED + load resistor, and even worse, not enough voltage to reliably forward bias the LED in all cases (Vf is 2.0V nominal, 2.4V max.)
If you use 5V for the base drive in Circuit 2, things improve some:

5V - Vbe(sat) = 5V - 0.7V = 4.3V

But it's still not ideal, as Vce is 0.7V vs. 0.2V for the common-emitter configuration in Circuit 1.

If your goal is to have a consistent LED current, you'll need to compensate for the variation in the LED forward voltage. One way is to make a driver that has some negative feedback that senses current. That is, you need a constant current source.
Here's a simple current source that uses a fixed bias input to set a constant voltage across the 33 ohm emitter sense resistor. (simulate it here):

The high-gain emitter-follower pair tracks the output current through a 33 ohm sense resistor, which provides negative feedback. Variations in load resistance (and more importantly, LED forward voltage drop) are cancelled out by the voltage-follower action.
It's not super accurate, but it does a reasonable job of compensating LED Vf.
Comment: That's not a particularly good Circuit. The darlington and 10k's mean that the base is 3.3/2, and if the darlington VBE is 1.3 V, it will only allow 0.35 V across the 6.8 Ω. The problem is that any small change in the 3.3 V level or temperature (which changes VBE) will dramatically change the current.

You can remove the 10K to GND, also don't really need a darlington.
Comment: Yes, a better circuit would use an op-amp or a TL431 to add some gain for the feedback. That said, this is a classic emitter-degeneration approach.
Answer: Common Emitter (CE) is a saturated switch with resistance depending on chip size and Ic/Ib ratio controlled by Rc   if Ic/Ib<20 (Rated at 10)
Common Collector (CC) is a non-saturating current pump (Ic=hFE*Ib) with a Vbe, diode drop controlled by Rb.
When the Vbc becomes forward biased in the CE switch) hFE drops towards the rated ratio of 10 but typically you can use 10% of the linear hFE.
A picture is worth a thousand words.

Your 10k Rbase (R3) shunt is redundant but does reduce input current by 10%. It is not necessary to add this as it serves little or no purpose.  The floating base will not turn on the LED.
Locate on my simulation that "Your Design" agrees with your test results and my Design on the right shows how to choose a better operating point <=20mA with 2 simple changes.

For CE on top: Choose 3.3V instead of 5 as Rc limits LED current with a small switch Vce<0.1 and expected Vf of LED of 2.0V in this part only. (GaAs) leaving 1.2V/68=Ic

for CC aka emitter follower below it: Change 5V to 3.3 on collector, Remove Base resistor (0) as it makes load dependent on hFE (wide tolerance) rather than Vbe so Ve is well defined 3.3-0.7=2.6V=Ve then the Re emitter resistor limits the current  2.6V-2.0V= 600 mV/20 mA= 30 Ohms, I used nearest value of 27 Ohms.

Observe how to make a simple linear approximation with my equivalent circuits on the left for YOUR LEDs and CC,CE circuits.  Note that all these colours have the same voltage which is the old technology of 2V Gallium Arsenide and not the newer AlInGaAs or AlInGaP types that are Ultrabright. But being a very tiny dot it will be clearly visible but 35 mcd does not shed much light. >20,000 mcd 30 deg. sheds a LOT of light and is visible very far away and is blinding but that's what modern 5mm 3.1V white LED's can do now. I've got loads of 200pc/bag of these types.
Answer: The simple answer is that the NPN transistor's behavior depends on the voltage from base to emitter. In your two circuits, the base to emitter voltage is very different. This is the main reason why the same transistor exhibits two different behaviors in the two different circuits.
If you wire circuit 2 like this it should work the same as circuit 1, as far as current through the diode goes.
Comment: @TonyStewartEE75 the point of my circuit is to address the fundamental question asked by the OP: why is the load current different in circuit 1 vs circuit 2. So I modified circuit 2 in such a way that the load current should be the same as circuit 1. The purpose of this is to enlighten the OP about the difference between the two circuits. It is not my purpose to show the OP how to design a saturated switch properly because the OP is probably not ready for that.
Comment: @TonyStewartEE75 it is hard to predict what kind of answer will benefit a poster the most. Other people (including you) provided more complicated (and complete) answers already so I chose to focus on one very key, simple point. Hopefully the OP or some subsequent person searching on the internet will benefit from my answer.
Comment: It is very nonlinear truth when beginners need to learn the level 0 linear models. Nonlinear models come next.Year.
Comment: Thats OK, I wanted to illuminate a more linear approach where the LED current is controlled by a single R value knowing Vbe and Vf are constant even using a more efficient supply of 3.3 for both.
Comment: That is true , but does not explain how to control Vbe or make it work.
Comment: OK, @TonyStewartEE75, I added a picture for the OP.
Comment: OK if Vbe=0.6 and Vf=2.0V typ and Rin =hFE * (54+8) for hFE=?=100 what is Ve When Ie=(Ve-2.0V)/54 ... Answer? Not so simple or accurate with Rb =R2 included and unnecessary with CC .
Comment: @TonyStewartEE75 to which circuit does your question refer? In my circuit the base supply is referenced to Ve, so Ib is going to be around 2.6 mA, same as the low-side switch circuit. Should work just the same as the low-side switch case.
Comment: In your Circuit 2, adding the base resister makes the design dependent on hFE rather than Vbe which contradicts your initial truth.  So eliminating Rb= 1k (set to 0) and choosing Re to limit current is the "linear design approach." I recommend rather than the exponential Vbe method which has an extremely large tolerance to hFE.
Comment: A very powerful didactic technique to show the role of negative feedback (emitter degeneration)! Thus the emitter resistor becomes the same as the collector resistor... ie, its location no longer matters. I have applied this trick in the circuit of a simple [transistor curve tracer](https://photos.app.goo.gl/38UV5wYbeCDD4ErE6) where the emitter resistor does not act as an emitter resistor.
Answer: I want to further develop the philosophy inside some of the answers here making a few comparisons between the two circuits.
In fact, both circuits are voltage followers but they follow different voltages - the first circuit "follows" the supply voltage V1 and the second circuit follows the input voltage V2. And because the supply voltage is higher than the input voltage, the current through the LED in the latter case is lower.
If we continue with such simple comparisons, we can say that the transistor in the first circuit acts as a closed switch with zero resistance. No voltage is lost on it, so all the supply voltage is applied to the LED network. In the second circuit, the transistor acts as a variable resistor ("rheostat") on which, roughly speaking, the difference between the supply and input voltage is lost.
Both circuits are used here as switching (digital) circuits but, in fact, both they are analog circuits made act as digital circuits. For this purpose, the first is "overdriven" while the second follows the input voltage by the help of negative feedback.
Let us now see how, in principle (when the transistor is not "overdriven"), moving the load (LED circuit) from the collector (first circuit) to the emitter (second circuit) drastically changes the transistor behavior:

When the LED network is in the collector, the transistor keeps up a constant current through the LED (acts as a current "source"). For this purpose, it changes its collector-emitter "resistance" so that to keep the total resistance constant. This is its genuine behavior.

When the LED network is in the emitter, the transistor's behavior is changed by the mechanism of the negative feedback and now it keeps up a constant voltage (acts as a voltage source). For this purpose, it changes its collector-emitter "resistance" so that to keep a constant ratio between its "resistance" and the total resistance. This is its modified behavior.

So, by means of the negative feedback phenomenon, a current source (common-emitter stage) is converted to a voltage source (common- collector stage).
True, these are a few unusual considerations that resemble rather 99% Lindt dark chocolate than the sweet Milka chocolate:-) but they can make us think...


What band did walkie-talkies use in Europe before PMR446 was allocated?

Question: The PMR446 band, now used for walkie talkies in Europe, was only allocated after 1997. I'm sure walkie talkies existed before that. What radio bands did those use?
Answer: In the UK, we had CB walkie-talkies on the UK FM CB band (the so-called "CB 27/81" specification for 27MHz CB agreed in 1981), which had a bonkers set of frequencies - 40 channels of FM, separated by 10kHz each, from 27.60125MHz to 27.99125MHz. I believe that the main reason that they decided on that exact system was to render imported US AM CB radios useless in the UK. Also, FM produces less interference to electrical equipment than AM does.
As well as CB 27/81 there was CB 934/81, which was another FM UHF CB allocation. Equipment for this band was so expensive that hardly anyone used it. I don't know if there were any walkie talkies available for this band though.
Additionally there were baby monitors, and some walkie-talkies, on the 49MHz band - also FM.
Answer: I do vividly remember hearing CB radios talking, in the 80s and central EU.
So it was likely around the "27 MHz" band.


wrong date after power supply interuption ( Sun 28thDec 2014)

Question: The System rebooted after the power supply went off and now it has the wrong date and I cannot use the add ons . can someone walk me the through the solution as I am a dummy
Comment: I do not know what " I cannot use the add ons" means. If you wait a few (maybe 15 minutes at most) the time shoud be set by `ntp` (assuming you are connected to the internet. You could always try restarting `ntp` if you are in a hurry.  `systemctl status ntp` should give you status. `timedatectl` will show what time it thinks it is.
Answer: You need internet connection in order to have valid clock settings. If your clock is not set some time after a reboot, you might have ntpd disabled. In that case, you can simply fix the clock manually by running
ntpdate pool.ntp.org

This will request current time from the server of your choice and set your local clock accordingly.
As a last resort, you can always set the date&time manually using date
Answer: I would suggest you to have some script to check the time at the of reboot which is a part of cron, that would checks the ntp status and start it if needed. Also if you need to set right away the time set the time as well.
There is some good article as well on setting up your ntpd stuff here
Answer: This is a normal issue with RPi, as the clock is not supplied with a backup battery.
There's a solutions for that using an addon 'Real Time Clock' board. Read here:
https://thepihut.com/blogs/raspberry-pi-tutorials/17209332-adding-a-real-time-clock-to-your-raspberry-pi


Solidity Proxy: why using initialiser instead of a constructor?

Question: Why proxies can't read from the constructor?
Answer: This was a question which was bothering me for a long time too and I also couldn't find a proper explanation. Let me summarise how I understood it:

This is the difference between a Smart Contract and EOA account

2.Taking a closer look, it is good to see that each smart contract has code and storage.

Storage is the place where we store the changes from saved to the smart contract.
Code is the place where the smart contract code is stored as well as all the information included in the constructor
Now see that those are 2 different places.
This is why we can't use constructor. Because when we use the constructor we will save everything passed inside, to the code location and not to the storage.
Remember Proxies read from Storage location not from code location.
That is why we need to use initialisation, because whatever we save into the initialisation will be stored to the storage. The name initialisation is not fixed like storage, you can name it whatever you want. Important is that it is called only once and called from the person who deploys the contract, because if it is called from someone else and it changes some roles like admin, it will make the first caller the admin.
Remember proxies read from Storage not from code.

I hope you that it is more clear now, but in order to understand it it important to understand the difference between those 2 storage and code. I think this is missing in most of the explanations and lead to so many confusions.
Answer: Proxies need to run instructions that are stored in a different address (the implementation) but using their own storage. That's why they run delegatecall instead of call.
The constructor is a special function that is run only once when the contract is deployed. It can never be run again and it is run by the contract being deployed on its own storage.
Let's think of an example. Say your contract needs to have roles. You want to give a role "API" to some hard-coded address. If you were to implement it by adding this constructor to your implementation contract:
mapping(address => bytes32) _roles;

constructor() {
  _roles[0xwhatever] = keccak256("API");
}

function isAPI(address _addr) public view returns(bool) {
  return _roles[_addr] == keccak256("Super Admin");
}

Then these roles would be stored in the implementation contract's storage. So if you were to ask your proxy if 0xwhatever has the role, your proxy would run the isAPI piece of code present in the implementation contract but on the proxy's storage (because it uses delegatecall). According to the proxy's storage, that address has no role.
On the other hand, with an initialize() method:
function initialize() external onlyProxy {
  _roles[0xwhatever] = keccak256("API");
}

Then after you have deployed the implementation contract, your proxy would be able to call that method using delegatecall and the role would be saved to the proxy's storage


How can I list all packaged installed by me?

Question: I am trying to clean my installation up a bit, so I decided to clean up my packages a bit. However, I'm having trouble with that: My wish is to make apt-get list all packages installed by me. If I list every package, I also see the dependencies of my packages although I am not interested in those. For example, I want to see that I installed lightyears but I do not want to see the packages installed alongside, like python-numpy or python-pygame. Is there a way to do this?
Answer: I think there is no command that let you get that information directly, but you may get that information inspecting APT logs. APT stores a history of commands in /var/log/apt/history.log, with entries with the following format:
Start-Date: ** time when command was issued **
Commandline: ** command used **
Install | Upgrade | Remove: ** packages installed/upgraded/removed to satisfy the command **
End-Date: ** time when command have finished **

Commands typed by you should appear as you typed (so a sudo apt-get install numpy will appear as Commandline: apt-get install numpy). In my system the only other commands appearing in this log are from aptdaemon, that should be issued by Update Manager.
Please note that this log is rotated from time to time, so you may not have there all commands issued by you from the beginning, or you may need to extract a compressed part of it. Also if you have multiple users I think you will not be able to know which one installed what.
Comment: +1 for your answer! These logs are really awesome and yield more precise information than the accepted answer, howewer they only date back one week on my system, so it's not really usable for old systems (like mine).
Answer: It's a quick hack, but this gets me very close:
manifest='http://releases.ubuntu.com/raring/ubuntu-13.04-beta2-desktop-amd64.manifest'

comm -2 -3 \
  <(apt-mark showmanual | sort) \
  <(curl --silent "$manifest" | grep --perl-regexp --only-matching '^[\w-.+]+' | sort)

You'll have to look up the package manifest for your version of Ubuntu from the releases server.
This method still returns a few packages that were selected via the Language Support installation prompt and the install third-party software checkbox, but depending on your needs it might be good enough.
Answer: I'm trying this:

go get the "manifest" file for your version as mentioned by ændrük above
apt-mark showmanual
to get a list of all packages apt-mark considers manually installed
eliminate the dups between those lists, keeping the remainder of the output of apt-mark showmanual

I don't know if this really works, but it looks pretty likely to me. Any thoughts???


Can a torrent with zero seeders download?

Question: I've heard a claim that a torrent with zero seeders can actually be downloaded in a finite amount of time, because not all people subscribe to the same torrent file, but you can still find them using other techniques such as DHT. Is this true in practice?
Answer: DHT and Peer Exchange are not tracker related, but program related, so yes they can find people who are downloading the same file but are not connected to the tracker you are using.
Those people that are found might be either seeders or leechers.
Comment: Site (All of those that I'm aware of) only get their info form the tracker and will not list the users that you might get from DHT and PE.
However programs [which support these services] will show them and so if your client says there are no seeders then the chances that one will appear are very very small, as said in another answer, one can request people to re-seed on the site where the torrent file is hosted.
Comment: But aren't these people found by the DHT/Peer Exchange listed as seeders, either in your own torrent client and/or the website hosting the torrent? If a torrent file shows no seeders in your client, does it actually happen that seeders show up later?
Answer: From this BiTorrent FAQ:

When there are zero seeds for a given
  torrent (and not enough peers to have
  a distributed copy), then eventually
  all the peers will get stuck with an
  incomplete file, if no one in the
  swarm has the missing pieces.
When this happens, someone with a
  complete file (a seed) must connect to
  the swarm so that those missing pieces
  can be transferred. This is called
  reseeding. Usually a request for a
  reseed comes with an implicit promise
  that the requester will leave his or
  her client open for some time period
  after finishing (to add longevity to
  the torrent) in return for the kind
  soul reseeding the file.
Answer: Yes, it is true in practice - but not always. With no seeders, there's no guarantee that 100% of the download is available.
Answer: DHT clients do not need tracker to operate, so it can download without any seeders, as seeders are reported by tracker itself. Good explanation of DHT relating to torrenting can be found at : http://www.tamiltorrents.net/forums/showthread.php?t=8819
Answer: I've a file with 3GB size and still downloading at max speed with seeder below than 0  <0.9 seeders> as you can see HERE
Comment: This doesn't really answer the question other than showing its possible, and is just a link. A more in-depth explanation/answer would be appreciated.
Answer: Yes, this is actually possible. I've downloaded torrents that are literally dead: 0 seeders and 0 leechers shown. Right now I'm downloading a 1.7GB file at my normal speed.
However, I'm confused as to how this actually works.


Upload multiple images to woo commerce in php

Question: I have a site that uses php to upload product information to woo commerce. everything works fine; however i am now stuck trying to work out how to add multiple images. I have got it adding 1 image fine as seen below
$imageURL = "https://www.[website].co.uk/new/wp-content/uploads/products/";
    $imageURL =  $imageURL . $product->ITEMNO . ".JPG";

    if (!(false === file_get_contents($imageURL,0,null,0,1))) {
        $data['images'] = [[
            'name' => $product->DESC,
                'src' => $imageURL,
                'alt' => $product->DESC
        ]];
        echo "Image URL: " . $imageURL . "\n";
}

$woocommerce->put('products/'.$searched[0]->id, $data);

If i try adding in another image using $data['image'] = ... with different data; it just overwrites the image
Im assume EITHER theres a different input for adding it to the product gallery instead of just the main product image. but i couldnt see one at https://woocommerce.github.io/woocommerce-rest-api-docs/?php#product-images-properties
OR if its to do with different id's for the image. Of which i tried adding 'id' => 56565656, to the $data['images'] but it just crashed on me.
Any help would be appreciated.
Answer: From woo commerce docs, 'images' is an array type; so it was just figuring out how to write it to get the 2nd image in the second slot of the array; find below the answer
$data['images'] =
        [
            [
            'name' => $product->DESC,
            'src' => $imageURL,
            'alt' => $product->DESC
        ],
            [
            'name' => $product->DESC2,
            'src' => $imageURL2,
            'alt' => $product->DESC2
            ]
        ];


Continous Integration Server in Windows Azure

Question: I would like use a continuous integration system in my projects. However, I don't want to use a server sitting in my office, instead I'd like my continuous integration server to run on Windows Azure.  Has anyone set this up? Are there recipes to host Hudson or CruiseControl.Net (or any other CI system) within Azure?
Comment: If the CI server runs in Azure, how would it talk to your source control server?
Comment: It would be possible to use Azure Connect (currently in beta)
Comment: In my case, the source server is internet facing.
Comment: My students have precisely started to design a cloud integration server for Windows Azure, see http://code.google.com/p/cassis/ However the problem is still in very early stage.
Answer: We use the Build Manager in Team Foundation Server to push our automated builds to Azure. We set up our Azure hosted services to allow for Web Publish through remote desktop using this plugin - http://dunnry.com/blog/2010/12/20/UsingWebDeployWithWindowsAzure.aspx
You do not need to involve Team Foundation Server to use the plugin - you can set up your instances to publish to azure instantaneously through Visual Studio Web Publish without CI.
I think there are two parts to the Azure CI solution - automated builds from your source control and actually pushing the bits to azure. The plugin makes the publish to Azure much, much faster. So if you want real time access to changes on Azure, you will need to look into the plugin.
Comment: I want the CI to run within Azure. I could use this system for software projects that have nothing to do with Azure. In this question, I want to use Azure as a scalable host for my CI solution.
Answer: It sounds like you are trying to use Azure as an infrastructure provider, which runs a VM where your builds happen.
This is not a particularly good use-case for Azure.  Azure is a platform to run your custom-built applications.  While it does provide VM's similarly to Amazon or other IaaS cloud providers, those VM's are "stateless", can go up and down at will and meant to act as application servers where more than one can be up at any given time.
You can probably get this to work on an Azure VM but I am not sure if the pain would be worth it.
Azure's instances are application servers, not "windows servers".
HTH
Comment: Your point about Azure not being IaaS is well taken, but isn't CI a good application for PaaS? For example, aren't build slaves - http://wiki.hudson-ci.org/display/HUDSON/Distributed+builds a great use case for PaaS?
Comment: I think slaves running on Azure should work... I'm struggling with seeing how the master would run.
Comment: (This is a great conversation, and I think you are bringing up excellent points) As I understand it, a master is just a front end, which reads persisted state, and requests jobs to be executed.  This could be Web Role for front end +  Blob/Table for storage;  For availability I expect you'd need 2 web roles.
Answer: I have installed Jenkins on Windows Azure, it works very well for me.
http://blogs.msdn.com/b/gongcheng/archive/2013/02/27/jenkins-on-windows-azure-the-missing-manual.aspx


Does light have memory?

Question: my thought is light reflects off what ever it comes in contact with. it is the light you see not actually the object it self. so no matter how far the light travels the imprint of that item is in that beam of light as well as anything else that same beam of light reflected off of. sort of like those picture mosaics you see where they take a thousand pics of varying colors and shades of light and dark and make a larger pic of something. yet when you magnify it only then do you notice all of the other pics in it. Would that then make that light a time recorder?
Comment: In the light's frame of reference distances have contracted to zero.  As far as the light is concerned it's everywhere at the same time.  Not much need for a "memory".
Comment: What do you mean by "memory" or "time recorder"? You can certainly use a wavefront of light to 'look back in time' (think stars - the light coming from Alpha Centauri has been traveling a couple years to reach us), but the only 'memory' light has is that it maintains its polarisaton and frequency when propagating in vacuum.
Answer: No, light does not have memory.   All the processes of light propogation
are the same backward and forward, there is no 'arrow of time' in the
way light behaves.   The example of light changing color is an
interaction with matter, probably generating heat: the matter is
doing that, and it's irreversible.
The light alone cannot learn, and cannot turn to heat, because
both those processes are asymmetric to time reversal, and light is symmetric.
Answer: Actually, almost the exact opposite is true.  Color is a byproduct of what wavelengths the object in question is able to absorb.  A red table appears red because it reflects red light.  Similarly, the atmosphere scatters blue light (or light at a wavelength that we understand as "blue"), and therefore appears blue.
Comment: I will not downvote this answer John but I think you need to expand it a bit. Colour does not come simply from absorption or emission. Colour ultimately is derived from perception (chiefly through how our eyes pick up the wavelengths and how our brain ultimately interprets them). For example, there is no purple wavelength but we do have a purple colour.
Comment: I agree.  The perception of color is a byproduct of the biological systems that have evolved over time to better help us survive.
Answer:
Does light have memory?

Light, as a collection of zillions of photons of various frequencies can be considered to have memory. Holograms are a proof.
Holograms need coherent radiation, i.e the phases of the electromagnetic waves involved are fixed, not random, and that allows the recording in the light/electromagnetic  radiation the signal of the objects projected as images.
An even simpler "memory" for the small time interval between focus and screen are lense images, the light  carries information and reproduces it on the screen.

my thought is light reflects off what ever it comes in contact with. it is the light you see not actually the object it self. so no matter how far the light travels the imprint of that item is in that beam of light as well as anything else that same beam of light reflected off of.

Ordinary incoherent light , like the light ambient in a room, which has reflected from all surfaces has lost all phase information of the frequencies it is composed of, so the "memory" cannot be unscrambled. If you see a red reflection, you can guess it came from something red, some memory,  but the dimensions and angles that define objects will be lost due to incoherence of phases.
Light from astronomical objects does carry memory, as spectra of atoms and frequency of the radiation, an imprint of the whole history. Also cosmic microwave background radiation carries information in the intensity of the light arriving at our detectors, i.e. whether there is absorption on the way or not, as shadows do. In general not in the form you imagined.
Comment: Do you think there could maybe (someday) be a way to unscramble all that jumble of information that light carries or am I just thinking sci-fi?
Comment: @HitanshuSachania we are already unscrambling it, if you read the examples I give
Answer: Proof of 'Light having a memory' might be best proved by the path it takes through the Universe. Consider the line of sight of the light emitting . from a source, say sixty million light years away. Without obstruction, it is a direct observation. However, if that light encounters a black hole, say located thirty million light years away, that light is bent around the object and continues on to us for observation. I have often wondered the following. (A) the Black hole is an object that is so massive that all light is captured and it reflects none. (B) The path of light is refracted at one hundred and eighty degrees around the object, so it appears to have 'passed through' that black hole and continued on it's original path toward us to see. Without that memory, the gravitational effects of a black hole should randomly throw that light in every conceivable degree of the available three hundred sixty degrees of arc. Someone needs to explain why the beam of light travels on at the same path it even with the gravitational encounter.
Answer: Light can be one of the best ways to record something. Not only can we see things that happened billions of years ago but most likely after Earth and this solar system have died some distant world will be able to see us in the distant future when our light finally reaches them.
Answer: I concur with Apoorv Khurasia.
Ultimately it's all in the mind of perception.
In radiobiology physics the universe is described as an invisible field of electromagnetic vibrations oscillating at different frequencies, therefore light has no color until our eyes refract it as such, and our brains reflect it so.

Does light have memory?


What is the difference between object of an abstract class and list of objects of abstract class?

Question: We can't create objects of an abstract class, but we can create a List or an array of them.  What is the difference?
Comment: What is the difference between fruit and the box, where you could put some fruits? They are totally different. You can't grow fruit - you can grow apples or peaches, etc. But nothing prevents you from buying another box for storing fruits.
Comment: @Grantly why not make it an answer ;)
Comment: A list or array is simply a place holder for a set of pointers, and you have NOT created instances of anything yet.  When you say Create Object - you mean create an instance - which you cannot do with an abstract class.  But you can create Lists or Arrays that point to them (and are EMPTY) - then you can move the pointers to 'real' instances of derived classes/objects
Comment: You can also create a list of interfaces, while you cannot create an instance of an interface directly... ;)
Comment: Sorry I was a bit confused at the time :) Thanks I shall, but all others I think have it covered - and I'm sure it will get downvoted lol...Here it goes now ;)
Answer: A list or array is simply a place holder for a set of pointers, and you have NOT created instances of anything yet.
When you say Create Object - you mean create an instance - which you cannot do with an abstract class.
But you can create Lists or Arrays that point to them (and are EMPTY) - then you can move the pointers to 'real' instances of derived classes/objects
Comment: "and you have NOT created instances of anything yet." -- except the list or the array; that itself is an instance of list or array.
Comment: @TJamesBoone you are totally correct, but I didn't want to confuse or complicate the issue. My answer is not very comprehensive - and lacks details that others provide - but I was hoping for an answer to match the brevity of the question
Answer: Summary of Answer:
The List or the array itself is not an abstract class, even if the type it declares it will hold is an abstract class.
More Detailed Answer:
Even though you can't make an object of an abstract class (the word "of" is somewhat vague, but obviously you mean as a direct instantiation of that class), you can make an object that is an instance of an abstract class (because it's an instance of a concrete class that extends said abstract class).
Basically, given abstract class Abstraction, and concrete class Concrete that extends Abstraction, List<Abstraction> means you can but anything in it that is an instance of something that extends Abstraction, e.g. an instance of Concrete.  Although arrays are a bit different in some ways from Lists, the same goes for them as well.
Example:
Given this class:
public abstract class Abstraction {

}

And this class:
public class Concrete : Abstraction {

}

You can't do this:
Abstraction a = new Abstraction();

But you CAN do this:
Abstraction a = new Concrete();

And then you can do this:
IList<Abstraction> list = new List();
list.add(a);

Comment: You probably meant `public class Concrete : Abstraction`, Note the colon, `extends` is Java.
Comment: Oops, you're right.  It's been a while since I've been in C#, been doing a lot of Java the last few years.
Answer: It is possible to declare and initialise a list where the type of the members is an abstract class because to create this object you do not need to actually instantiate the abstract class.
Logically, the list is only a container for pointers.
For example, you can define a list of an abstract class, but this list can be at the beginning empty.
You can also initialise the list with an initial size, but at the beginning it will not contain references to actual objects: the initialisation will only preallocate space for the pointers.
The objects added to the list have to be instances of a concrete class that extends the abstract class.
Answer: You can't create an instance of an abstract class for obvious reasons but surely creating an instance of the List<T> class is allowed regardless that T is an abstract class.
Let the abstract class be called ClassAbstract.

When you try to do - new ClassAbstract(), you try to create an object of the ClassAbstract.
When you do - new List<ClassAbstract>(), you create an object of the List<T> class.
Answer: The List is empty !
That means no instance of the abstract class.
Create an empty list is allowed. You can (later) add to it a non abstract class which extends it.
Answer: I believe u are simply strongly typing what the objects inside the array will be
So when it comes time to put instantiated objects into the array.  It has to be an object that was extended from the abstract class
Answer: There are no pink magic unicorns.
But you can still build a stable for pink magic unicorns, you just won't ever be able to put any in there, because there aren't any.
More realistic analogy: you cannot go to the pet store and buy "a mammal". That's far too abstract a thing.
But, you can build a stable for mammals. And then you can buy horses, cows, dogs, cats, elephants, giraffes, wolves, leopards, and lions and put them in there. Maybe even pink magic unicorns, if you can find any.
(How to build a stable that can at the same time accommodate mice and hump whales is left as an exercise to the reader.)
Comment: When I read the first line of your answer, I thought that I clicked some other question and was reading answers for that. Then I checked if I was on the correct question. And then I understood your point. :D
Answer: No, you can't create an array "of them",  because you can't put the abstract types into the list. A list of an abstract type holds any derived instances of the abstract type.
Just means any derived type of the abstract type can be in the list
Comment: I think that the user meant a list that is declared as a list with members of the abstract class. This is definitely possible.
Comment: sure thats possible, but he put "of them"  and you can't put in abstract instances of the object


Identify Gold Country bush

Question: What is this fragrant bush growing in the gold country in California foothills about 2000ft altitude?
Comment: I'm sure it is not. Mock orange has a round pealed flower and the scent is distinctive. We had one where I used to live.
Comment: It does look like a garden escapee though. Certainly not a manzanita (*Arctostaphylos*).
Answer: Deutzia scabra, (cultivar might be 'Plena')is a deciduous shrub with somewhat cascading limbs covered in fragrant white (sometimes pink) star shaped flowers.  Tolerates almost any soil, but does best when it is moist & rich.  It is native to Japan and China, but has been a classic in western gardens for many years.
It is weird if you found this in the middle of a wild area, but in my opinion it looks more like Deutzia than Philadelphus.  Western Philadelphus does not have a star shaped flower like Deutzia.  It may be an introduced, escapee plant.  It has been introduced to most of the East Coast of the US, parts of the mid-west, & Utah, so it may also be introduced but not documented in California.
Missouri Botanical Garden Deutzia scabra
Royal Horticultural Society Deutzia 'Candidissima'

Answer: I think it is Philadelphus lewisii, Mock Orange

Identify Gold Country bush


Why did Daksha Prajapathi (father of Sati) hate Lord Shiva?

Question: Why did Daksha hate Shiva, though Shiva is his son-in-law and one of Trimurti?
Comment: Once after the birth of Goddess Sati,Lord Brahma had started to tell bad things about Vedas. Lord Shiva was very angry and he had cutted the fifth head of Lord Brahma. Prajapati Daksh the father of Sati was very angry on Shiva because he was the son of Lord Brahma. After that Daksh had started to hate Shiva.
Answer: According to Shiva Purana, Daksha disliked Shiva due to the latter failing to properly respect him during a yagna.
However, there's more background to this as well.
Daksha, in addition to being a son of Brahma, was also a King, with a royal lifestyle; and being a King he wanted to use his daughters' marriages to increase his influence and power through marriage alliances with influential folks.
However, Sati, his youngest daughter had always been interested only in marrying Shiva. Daksha strongly disapproved of this as Shiva was an ascetic, and his followers consisted of ghosts, demons, ghouls and goblins. At this point in the tale, Daksha does not seem to be aware of Shiva being a "Supreme God".
Despite Daksha's disapproval, when Sati's swayamvara (a ceremony in which a bride can choose her own husband) was held, she chose Shiva and Daksha was powerless to stop the wedding. Leading to Daksha's hatred of the ascetic Shiva growing even stronger because he was now his son-in-law.
Answer: As per Shrimad Bhagavatam, it is because Lord Shiva didn't show proper respect to Daksa Prjapati, at an occasion of Yajna.

Dakṣa was adequately welcomed by the president of the great assembly,
  Lord Brahmā. After offering Lord Brahmā respect, Dakṣa, by the order
  of Brahmā, properly took his seat.  [SB -  4.2.7]
Before taking his seat, however, Dakṣa was very much offended to see
  Lord Śiva sitting and not showing him any respect. At that time, Dakṣa
  became greatly angry, and, his eyes glowing, he began to speak very
  strongly against Lord Śiva. [ SB - 4.2.8 ]

Being the Prajapati, he was of course a respectable man. So when every one else showed proper respect and good mannerism but not his own son in law Siva, he got angry on Him and hated Him. Anyway, he probably never liked Shiva because He was a smashan dweller. So that occasion made him furious and he poured his heart out:

I had no desire to give my daughter to this person, who has broken all
  rules of civility. Because of not observing the required rules and
  regulations, he is impure, but I was obliged to hand over my daughter
  to him just as one teaches the messages of the Vedas to a śūdra. [ SB
  - 4.2.13 ]
He lives in filthy places like cremation ground, and his companions
  are the ghosts and demons. Naked like a madman, sometimes laughing and
  sometimes crying, he smears crematorium ashes all over his body. He
  does not bathe regularly, and he ornaments his body with a garland of
  skulls and bones. Therefore only in name is he śiva, or auspicious;
  actually, he is the most mad and inauspicious creature. Thus he is
  very dear to crazy beings in the gross mode of ignorance, and he is
  their leader. [ SB - 4.2.14, 15 ]

Referece:  Shrimad Bhagavatam, Canto 4, Chapter 2
Comment: Your explanation answers the question just partially. @Shisa has explained the main reason why Daksha began to hate Shiva.
Comment: @Dineshkumar yes, indeed it does. Actually the reason varies from *Puran* to *Puran* and I don't want to state something for which I don't have scriptural statements to back it up. In fact, I know another reason from Devi Bhagavata but did not mention it because I don't have the sanskrit text yet.


What is the correct use of "only"; "solo" or "sólo"?

Question: In Spanish, "sólo" means only. But I have read many texts with "sólo" (with accent) and many others with "solo" (without accent). Which version is correct in Neutral Spanish?
Comment: neutral Spanish? Never heard of that. Please look up questions in the RAE (rae.es) before asking them here. Thanks.
Answer: According to Fundéu, this has changed some time ago, and now it is always correct and recommended to write "solo" without accent. An accent is allowed if "solo" means "only" and there is a risk of ambiguity with the other meaning "alone":

Ha montado solo la mesa

which can mean "he has built only the table" or "he has built the table alone". In this case, it is possible to write "sólo" if the meaning is "only", but it is also correct to leave it without accent.
Comment: To get rid of ambiguity, we can say *solamente* to mean *only*.
Comment: Muchas gracias! Tiene sentido.
Comment: Thank you a lot! It makes sense.


way to open and load a file in memory

Question: Is there a way such that I can open and load a file directly in memory?
I have lot of legacy code that opens a file present on network, and then does
seeks and reads from this file. I want to avoid the reads and seeks over the network.
Hence, if I could load the file in memory, when I open it, I could have efficient seeks.
Any ideas?
I'm working wtih C on Linux.
Comment: mmpa would return a pointer to the memory location where the file is loaded. My legacy code works on the file pointer. I would then need to change lot of code for this.
Answer: You could use the mmap function, or plain open and read it all into a buffer you've allocated with malloc.
But please do benchmark. You might get very little (or none at all) improvement from this "manual buffering". The OS already does caching for you.
Comment: the mmap link is somewhat broken
Answer: As Mat said, have a look at the mmap function. (It's probably the easier way)
http://linux.die.net/man/2/mmap
If you prefer malloc, this link should help you:
http://www.anyexample.com/programming/c/how_to_load_file_into_memory_using_plain_ansi_c_language.xml

way to open and load a file in memory


What determines the price that is displayed by an exchange for a security?

Question: From my understanding, a security's prices are published by the exchange on which it is trading. How do the exchanges determine what price to publish? Is the displayed price simply the latest fill price, or is it calculated by some other method? (I assume it is not the latest fill price, because if it were, I would not expect a security's price chart to be continuous.)
Comment: Why shouldn't it be the latest fill price?  If you want to know what the price is **now** you look at the latest fill price **now**.
Comment: Ah, my reasoning (about continuity) in my question is faulty. I guess what I was getting at was something like the following: Suppose a stock's displayed price is $10.00. If, say, a bank came in and bought a bunch of shares at $10.10, then if the stock's displayed price was determined by the latest fill price, then the displayed price should change to $10.10. However, at this point I'd expect the order book to still be around $10.00, maybe a bit higher (bidders and askers cannot react instantaneously). So therefore I'd think in this scenario displaying a price of $10.10 would be "inaccurate".
Comment: There's always some lag between the the buy price and when it's reported, much less reported across the country.  Is that what you mean?
Comment: Not really. Now that I think about it more, I think the reasoning behind my original conclusion that it can't be the latest fill price is just incorrect. Thanks for your response!
Answer: A current quote from the stock exchange includes the following data points:
Bid Price

The highest posted price someone is willing to buy an asset

Bid Size

The number of shares or contracts that people are trying to buy at the bid price

Ask Price

The lowest posted price someone is willing to sell an asset. Also called the "offer price."

Ask Size

The number of shares  or contracts being sold at the ask price

Last Price

The price at which the last transaction occurred

Last Size

The number of shares or contracts involved in the last transaction

The market is an auction and there are additional orders at lower bid and higher ask prices on the order book.  As orders at current price are taken out, the next order on the order book becomes the new quote, depending on whether price is moving up or it is dropping.  An example of this is:
Comment: When I look up the price of a stock on Google, and Google returns a chart from an exchange, I get a single price. How is this single price determined? Is it the last price, or perhaps the midpoint between the highest bid and lowest ask? Also, do you happen to have a source for the various components of the quotes that stock exchanges publish?
Comment: Google is providing the last traded price.  During trading hours, some brokers will provide the midpoint as the quote but that is more the exception rather than the rule.  [Yahoo Finance](https://finance.yahoo.com/?u) provides the data points that I mentioned but I believe that it is delayed during trading hours.  If you google "real time stock quotes", you should find some other sources.


How to install FFMPEG on Ubuntu aarch64

Question: I need to install ffmpeg on Ubuntu aarch64 Architecture. I searched the web but all the guides are about how to install ffmpeg on other Ubuntu distros.
Comment: One possibility is to upgrade to Ubuntu 15.xx as @incBrain noted the most recent Ubuntu versions include ARM64 binaries as noted [here for 15.04](https://launchpad.net/ubuntu/+source/ffmpeg/7:2.5.4-1) and [here for 15.10](https://launchpad.net/ubuntu/+source/ffmpeg/7:2.7.6-0ubuntu0.15.10.1).
Answer: I think if you are using Ubuntu 15.XX you can simply run:
sudo apt-get install ffmpeg

if you are on the lower Ubuntu version you can just simply download static builds from here. Or type this in the terminal:
wget http://johnvansickle.com/ffmpeg/releases/ffmpeg-release-64bit-static.tar.xz
tar xf ffmpeg-release-64bit-static.tar.xz
cd ffmpeg-3.0-64bit-static/

Static build of ffmpeg ./ffmpeg will be inside this folder. You can also move it to /usr/local/bin to be able to run it from everywhere.
Comment: My distro is 14.04 but it is aarch64.   I tried your solution but i get this error   : bash: /usr/local/bin/ffmpeg: cannot execute binary file: Exec format error
Comment: @Medow ah, I'm sorry didn't read carefully enough, so it's kind of ARM thing? Did you also try to compile ffmpeg?
Comment: No problem , And yes i did tried to compile it from source, but no success.
Comment: @Medow I can not find static builds for ARM. But it should be possible to compile it. What was the problem while you was trying to compile it?

How to install FFMPEG on Ubuntu aarch64


How to get all records of a view with paging?

Question: I have a view with 20 records, displaying 10 records on each page. I have a field check-box with custom handler to check and uncheck each record. I am using the $this->view->results to loop through all the records of view to check or uncheck on different events. This logic is working fine.
Now, I have added a new button to select all the records of view i.e. 20 records of both pages. Is there a way I get all the records of view with paging. In my case I want to get/select all the 20 records which are displayed on two pages. If I print $this->view->results, it has only 10 records which are displayed on page 1. Is there any view array element which have all 20 records?
Answer: If you don't mind installing another module, try Views Bulk Operations.  Views Bulk Operations (often abbreviated VBO) allows you to add "select all on page/select all everywhere" checkboxes and also offers additional functions such as using batch API to process operations when there are too many to do at once (if you had 20,000 records instead of 20).
Node One has a tutorial on VBO.
Comment: Thanks Patrick for your suggestion. I will start using this module soon. Some of my friends also suggest me same. As of now I have fixed the issue by `$view = views_get_view('payment_schedule_students');
  $view->set_display('payment_schedule_students_select');
  $view->set_items_per_page(0);
  $view->execute();$view->result`


Whats the difference between logistic regression and fractional response model?

Question:
Can anyone tell me the theory behind fractional response model, how it really works?
I wonder if the logistic regression works only with binary variable {0,1}, why when conducting a GLM with quasibinomial family on fractional variable [0-1], it gave me same results in the estimates as the fractional response model?
Answer: I have not seen the term fractional response model before, but assuming it is models for fractions between zero and one as response, as it is used in this paper, it seems to be a term used by econometricians for logistic quasi-likelihood.
If you use R, these models are estimated simply by switching from the binomial family function to the quasibinomial family function.


What do you differ to make something sound in front vs behind?

Question: If a sound has two channels and you want to make it sound in front of someone in one instance and behind someone in another instance, what is the difference between the two sounds? Is it the stereo then you can change the panning to affect the left/right location, but what about front/back?
Answer: Volume, frequency range, and reverb/delay can be altered to give the illusion of depth. For volume, a louder sound will seem to be closer than a quieter sound so simply making the sound you want to place farther back quieter is the most obvious method. Sounds tend to have less higher frequencies when they are farther away. So filtering out some top end will add to the illusion. Finally, add more spacial effects such as reverb/delay to the sound you want to place farther back. The crucial principle when applying all three methods is that the illusion of depth comes from contrast - you need to place a sound farther away IN COMPARISON TO a different sound that is much closer. In other words, the farther sound should be quieter THAN a different sound, have less high frequencies THAN another sound, and have more reverb THAN another sound.
Hope this made sense.
Comment: While your answer is somewhat correct, stressing the volume attribute of the sound so much doesn't make that much sense. 2 sounds with the same amplitude can still be heard as back and front in contrast. front & back sound has to do with speed, high frequencies are fast, low frequencies are slow. Number one rule to push a sound further back is shave off some top end. I'd suggest stressing the high frequency more than volume, cause a high frequency sound can be a lot more in your face than a bassy sound even if the high frequency sound is substantially lower in amplitude.
Answer: It's all about the reverb.  For "behind", the "direct" sound has to go through the auricle (giving it frequency-specific phase changes and attenuation) with the first reflection from the front being more neutral.  For "frontal", the amplitude/phase relations are almost opposite.
This requires keeping tabs on several frequencies and their envelopes.  Something like a continuous sine wave is much harder to locate: basically you do that by "ear saccades", moving your head and tracing how the sound reacts to that.  Of course, that does not work with a stereo recording unless accompanied by visuals giving you a cue for the purported movement.
Without movement and without a somewhat reverbing environment, front/back location would not really work well.  You'd have to rely on wide-spectrum sound sources with known phase relations (motor noise, click trains) and even that would be iffy.
The point being that usually a number of different cues individually adapted to auricle form are employed and combined, and most of them work to some higher or lesser degree even in isolation.  But usually they are employed in a complex ensemble.


Why is the signal callback data pointer pointing to a junk value when the callback is fired?

Question: Ok, I'm writing a method that creates an entire panel and it's containing contents and adds it to the form. The panels are stored in an array.
Here's the basic idea.
void vscale1Event(GtkWidget *widget, int *vscale_id)
{
    int value = gtk_range_get_value(GTK_RANGE(vscale_struct[*vscale_id]->vscale1));
    do stuff with this value;
}

void add_vscale_panel(int vscale_id)
{
    vscale_struct[vscale_id]->vscale1 = ..... ;
    vscale_struct[vscale_id]->vscale2 = ..... ;
    add buttons to form;

    gtk_signal_connect(GTK_OBJECT(vscale_struct[button_id]), "value_changed", (GtkSignalFunc)vscale1Event, &vscale_id);
    gtk_signal_connect(GTK_OBJECT(vscale_struct[button_id]), "value_changed", (GtkSignalFunc)vscale2Event, &vscale_id);
}

int main()
{
    for (i = 0; i<n; i++)
    {
        add_vscale_panel(i);
    }
}

The problem I'm having, is that &vscale_id that I'm passing in, later becomes junk (it's value is a junk number around 32000) when I move the scale.
But - the gtk_signal_connect is only being called that once.
Ok, I get that it's probably something to do with the call stack, that bit of memory no longer being reserved.
But I did this same thing earlier for another panel, and it's working fine.
what I've changed  - is trying to make things a bit tidier.
The previous version I had all the panels and widgets each in seperate arrays.
eg
GtkWidget **outerPanel;
GtkWidget **innerPanel1;
GtkWidget **vscale1;

whereas this one I'm doing it:
typedef struct
{
    GtkWidget **vscale1;
    Gtkwidget **vscale2;
} V_Panel;

V_Panel **vscale_struct;

Not bothering putting the panels into arrays or structs - because I figure I don't need to access them later? ( I found that you can 'recycle' labels  so I figure panels (h and vboxes), are the same.
Also - an interesting clue - when I run valgrind - it works fine. Some how valgrind changes the way the program uses it's memory.
Any help here?
If you can perhaps explain what's happening when you call gtk_signal_connect. -
Here's my actual code: http://pastebin.com/MGfUihjM
relevant lines are
45, 145, 274, 308, 391
Answer: The problem is that your taking the address of a variable on the stack - in this case the parameter to the function. That address in memory is definitely not guaranteed to continue to hold the value you expect it to since it is just part of the stack frame
The correct way to pack your integer value_id into the callback userdata pointer is to use GINT_TO_POINTER and to reverse it using GPOINTER_TO_INT.
So your signal connection would be:
gtk_signal_connect(GTK_OBJECT(vscale_struct[button_id]),
                   "value_changed",
                   (GtkSignalFunc)vscale1Event,
                   GINT_TO_POINTER(value_id));

And in your signal handler would look like:
void vscale1Event(GtkWidget *widget, gpointer userdata)
{
    int vscale_id = GPOINTER_TO_INT (userdata);
    int value = gtk_range_get_value(GTK_RANGE(vscale_struct[vscale_id]->vscale1));
    do stuff with this value;
}


Install MVC 2 after Visual Studio 2010

Question: I have installed Visual Studio 2010 (final) and then Visual Studio 2008. Now I have to open a project with VS2008 that uses MVC2. Is there any problem to install MVC2 after VS2010?
Comment: Visual Studio 2010 comes with MVC2 as standard.
Comment: I know, but I have to use Visual Studio 2008
Answer: If you want to have the Visual Studio 2008 ASP.NET MVC Project Template, then yes you need to install it, otherwise the assemblies are already in the GAC. Also the project you are trying to open must have been created with VS2008.
Answer: Go ahead and Install MVC2 , It will install into VS2008 , and it will leave the install of mvc2 in vs2010 alone.  Also if you care, mvc3 works in vs2010 only, and it will install and live separately from mvc2 and allow you to choose from either, and as scottgu and others from microsoft mention, just install the mvc3 tooling update and it will automatically look to see if you have mvc3 install, and install everything if needed.  Once again MVC3 will not uninstall or touch mvc2 from vs2008 or vs2010.
I realize that you are asking about MVC2, so along with helping to answer that question, I thought I help assist with your MVC3 installation.

Install MVC 2 after Visual Studio 2010


Higher GRE Quantitative score?

Question: Lately, I have scored 165 in Quantitative Reasoning part of the GRE. The schools I consider applying requires scores that fall above the 90th percentile. with 165 Quant score, I am just at the 90th percentile. (just for a background, very good GPA (almost in %1 of my cohort), good academic references, a related job experience etc.)
There is no time to retake it, as the funding deadlines for graduate schools are approaching and I need to use this score to be evaluated for scholarships.
If I have another GRE test immediately, the results will only be helpful for being assessed without scholarships as the funding deadline will be already passed at that time.
However, I wonder what is the difference between a 165 Quant score or 167-68 band? The graduate schools need it from different nationalities than they are, especially to compare candidates. However, do you think higher GPA, good recommendation letters are as crucial as GRE?
I would be quite sad if I am not admitted to the schools I want just because of this low Quant score. Is it really to low?
Btw: department: Economics.
Answer: If you do a bit of a search you will learn that the GRE has little predictive value for success in graduate study. Given that, I doubt that a difference of five points has any significance at all.
But how a GRE is interpreted by a specific admissions system is completely up to them, so, again, no prediction can be made here.
Focus your application on other things. In general, a lot of things are likely to be considered. They will be looking for predictors of success. Give them that.

Search: predictive value of GRE

Higher GRE Quantitative score?


How to prove that this series is a metric: $d(x,y):=\sum_{i=0}^\infty \frac{|x_i -y_i|}{2^i (1+|x_i-y_i|)}$

Question: I have to prove that this is a metric: $$d(x,y):=\sum_{i=0}^\infty \frac{|x_i -y_i|}{2^i (1+|x_i-y_i|)}$$
The only thing that I can't prove is the triangle inequality, it's really hard. I know that $|x_i -y_i|\le |x_i -z_i|+|z_i -y_i|$, and I want to get: $$\frac{1}{2^i (1+|x_i-y_i|)} \le \frac{1}{2^i (1+|x_i-z_i|)}+\frac{1}{2^i (1+|z_i-y_i|)}$$ (I think...) The closest thing I've got is: $2^i (1+|x_i-y_i|)\le 2^i (1+|x_i-z_i|)+2^i (1+|z_i-y_i|)$ but... that's not quite what i want. I don't know how to get this...
Comment: It might help to fix your numerators. Your desired inequality should have $|x-y|$ and similar expressions in the numerators, not $1$.
Answer: Do you know that
$$d(a,b) = \frac{|a-b|}{1 + |a-b|}$$
is a metric on $\mathbb{C}$? First prove that this is a metric. The triangle inequality which you prove here will immediately imply what you want.
To prove triangle inequality in this case, you may use that the function $f(t) =  \frac{t}{1+t}$ is monotonic.

EDIT: As requested in the comments, I will complete the proof as follows:
$$ |a-b| + |b-c| \geq |a-c| \Rightarrow \frac{|a-b|+ |b-c|}{1 + |a-b| + |b-c|} \geq \frac{|a-c|}{1 + |a-c|} = d(a,c)$$
(using the fact that the function $f$ is increasing)
Now
$$d(a,b) + d(b,c) = \frac{|a-b|}{1 + |a-b|} + \frac{|b-c|}{1+|b-c|} \geq \frac{|a-b|+ |b-c|}{1 + |a-b| + |b-c|}$$
Combining above two, we get the triangle inequality.

Generalities: In fact there is nothing special about the metric on $|\cdot|$ on $\mathbb{C}$. If $(X,d)$ is any metric space, then $d_{1}$ is an equivalent metric on $X$ where
$$d_{1}(x,y) = \frac{d(x,y)}{1 + d(x,y)}$$
Note that $d_{1}(x,y) < 1 \;\forall x,y \in X$.
And then $d_{2}$ is a metric on $X^{\mathbb{N}}$ (the space of all $X-$ valued sequences) where $d_{2}$ is given as
$$ d_{2}\left((x_{i}),(y_{i})\right) = \sum\limits_{i=1}^{\infty}\frac{1}{2^{i}}d_{1}(x_{i},y_{i}) $$
Comment: You can use the triangle inequality for $|\cdot|$ and the fact that the function I gave is monotonic (infact increasing) to conclude the triangle inequality for $d$.
Comment: The inequality in your last display does not seem obvious to me. (My point is that simply noting the function is monotonic is not enough. You really do have to do some work.)
Comment: Thanks @Vishal, how ever i feel that the inequalitys are wrong, shouldn't they be facing the other way? Also, I don't understand whay the first implication is true, and when did you used f(t)? Thanks
Comment: @AnaGalois Which inequality are you referring to?
Comment: @Vishal. Maybe I'm just tired of this problem, but can you explain why you say this: |a-b|+|b-c|=<|a-c|? Isn't it |a-b|+|b-c|>=|a-c|? Thanks


Battery usage for keeping apps open

Question: How much of an effect does it have on the phones battery life to keep applications such as the contacts application open. I ask because that app sometimes takes long to open the first time depending on how many contacts you have I guess. I'm running android 4.1.2 on an galaxy s3 if that makes any difference. But I'm wondering whats the best practice from an user as well as developer perspective with regard to keeping apps open as a posed to the old school conservative thinking of closing everything when it's not needed.
Answer: In Linux/Android it is not recommended to close apps or use task killers.  Unlike a Windows computer/phone, Linux/Android can keep applications "running" in the background which doesn't use any CPU or networking (unless it's a media player).  It has actually been proven that closing apps causes more battery drain, because instead of Android being able to recall the app that was in memory it has to relaunch it, which requires more memory use as well as CPU.
You are better to leave apps running.
Sources:
How To Geek and
LifeHacker
Comment: Yes apps left "running" will consume memory, but the way that Android/Linux manage memory is way different than how Windows does.  Empty memory in Android is wasted memory.  Android is built to use as much memory as it needs, and if apps or activities are consuming that memory it will close them.  You should not interfere with the native memory management of Android because if you do, at some point the system will have to restart those apps that you or your task manager closed.
Comment: But does the closing of apps free up memory to make the phone run faster? I've heard it does, and it appears to after I kill some apps
Comment: Seems legit, tho still wondering about the memory as SSumner mentions

Battery usage for keeping apps open


What is the difference between a regular and adaptive low pass filter?

Question: I've noticed in Apple's accelerometer sample code they use both regular and adaptive low pass filters, what is the difference?
Answer: They are both IIR 1st order low pass filters (simple, and laggy in responsiveness when compared with other DSP techniques).  The adaptive filter switches to a higher frequency roll-off (and thus becomes even less smoothing but more responsive) for larger accelerations.
There are other higher quality (and more complicated) DSP filtering techniques for motion sensing often used by portable game developers.
Answer: In general, any adaptive filter will adjust itself based on the input signal.  I'm not sure if you'll notice much difference in practice.  Just try it out and see if one gives better response to what you're trying to do.
Answer: IIR Adaptive has a flatter response curve which means you have a higher fidelity output.  Or, in other words, what you put in is what you get out.


How to install keepass2 on CentOS 7?

Question: I am looking for instructions on how to install Keepass2 on CentOS 7 unfortunately no luck so far. Is there any rpm available anywhere? Any info will be much appreciated!
Comment: You could use dbootstrap to put a debian into a subdirectory, then use a chroot tool to run keepass2.  https://wiki.debian.org/Debootstrap
Comment: may http://keepass.info/help/v2/setup.html help you?
Comment: @Pandya some sane way without needing to compile. Something from some trusted repo. As it is the case with other major distros.
Comment: Try downloading the source code and required libraries, then rebuilding from scratch.
Answer: Since it's missing from RHEL/CentOS supplements like Fedora EPEL, get KeePass 2.26-10-fc19 from Koji, Fedora's Build System.  RHEL 7 was built atop Fedora 19, so this should work.

RHEL supplemental repositories
When you want a package missing from Red Hat Enterprise Linux (RHEL, which CentOS un-brands), start with Fedora EPEL (Extra Packages for Enterprise Linux).  Unfortunately, EPEL lacks the mono-based KeePass 2+ and I assume the Qt-based KeePassX (0.4.4) is insufficient for you.
RPMforge, now called RepoForge, is an EPEL-like repo that can be searched on Github, but it has no matches for KeePass.  Strike two.
Had either of these worked, you'd have been able to add the extra repository and install with yum.
Get Fedora's package
An older trick of mine (from back when I had to manage RPM systems) was to dig into the Fedora origins of that RHEL release and try the corresponding Fedora package.  RHEL 7 maps to Fedora 19.
Just to make sure, I recommend you manually map the dependent libraries.  This involves looking at DistroWatch for Redhat (or the identical CentOS) and compare with Fedora's libraries, which in this case would (probably?) be glibc (match RHEL 7's glibc 2.17 to Fedora, which would be Fedora 19) and mono ... oops, DistroWatch doesn't track that, so how about gtk+, for which RHEL 7 has 3.8.8, which Fedora doesn't match perfectly, but Fedora 19's 3.8.2 is in the right direction (you can generally assume backwards compatibility within a minor version, so something compiled for gtk+ 3.8.2 will work fine with gtk+ 3.8.8).  So, you can almost certainly use Fedora 19's RPM for KeePass.
We already searched for keepass on Fedora Packages when looking for an EPEL package above.  The next step is to find the Fedora 19 package, but that version is no longer supported.  Click the Koji Builds link on the left, which goes farther back in time.  Search for "fc19" and look for the latest successful build (with a green check box): KeePass 2.26-10-fc19.
Other RHEL-compatible builds
In the event there isn't an appropriate Fedora package:  My old standby was to try PBone RPM Search, which encompasses most RPM-based distros, including Fedora and the more directly RHEL-compatible: EPEL, RepoForge, CentOS, Scientific Linux, and more (it supplants the venerable RPMfind).  This is where I'd have gone if there wasn't even a Fedora package.  Sometimes there's a compatible third-party package, but you have to know what you're doing.  Identify the distribution and research whether it's actually compatible with RHEL.  Anything not purporting to be compatible with Fedora or RHEL will likely break since package names aren't consistent.  If you're lucky, you can match dependencies using Distrowatch as noted above and get a functional match.
When searching PBone, I recommend an advanced search that lists only compatible distribution releases.  Here's a PBone search for keepass2 compatible with CentOS 7.
Installing the RPM
You should be able to install that RPM (rpm -i file.rpm), though traversing the dependencies can be a bit hairy (since you're not using yum or even apt-rpm). welcome to how package management worked in the 90s!
In revising this update after finding answers about package indices for Fedora and CentOS, I see another answer here copied my PBone find and noted an easier way to resolve the dependencies:
yum localinstall keepass-2.26-10.fc19.x86_64.rpm

You may or may not need to install Fedora EPEL in order to satisfy some of the dependencies.  (If you do, please comment here and I'll add EPEL installation instructions.)
Comment: I'd like to add that I had the same issues with finding a good keepass gui for CentOS 6 a while back and was very pleased to find kpcli, a command line client that is gui agnostic. Unfortunately I dont see any packages for Centos 7 but there does appear to be one for FC19 -
Answer: EPEL method
KeePass 2.x is available in EPEL. I assume the top answer is either outdated or mistaken.

Enable the EPEL repository:
$ sudo yum install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install and run KeePass 2.x:
$ sudo yum install keepass
$ keepass

Official method
If you want to always run the latest KeePass release, follow the official KeePass documentation as summarized below. KeePass will notify you of new versions, and updating is performed by extracting the zip file provided on the KeePass website.

Install the Mono runtime by following the install instructions on the Mono website:
$ sudo rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
$ sudo yum-config-manager --add-repo http://download.mono-project.com/repo/centos7/
$ sudo yum install mono

Download KeePass Professional Edition Portable from the KeePass website.
Extract and run KeePass, either by using your available desktop environment tools, or adapting this command-line example:
$ unzip -d keepass Downloads/KeePass-2.36.zip
$ mono keepass/KeePass.exe

Answer: I successfully used the following simple procedure in CentOS 7:

Download the RPM from PBone
In a terminal window, cd to the
location of the RPM and run:
sudo yum -y localinstall <filename>.rpm

No need to compile anything, but you will need access to the epel repository. In my fresh installation of CentOS 7, this was already configured.
Answer: When the package is not available on EPEL you should attempt to build the packages from Fedora. In this case you should use keepassx which does not depend on mono:
Click at the newer version available from:

https://apps.fedoraproject.org/packages/keepassx

Install the source RPM using the link which is available from the package information. From the application RPMS download the SRC RPM:
Perform the following procedure WITHOUT root:
Install the SRC package:

# rpm -Uvh https://kojipkgs.fedoraproject.org//packages/keepassx/2.0.0/2.fc24/src/keepassx-2.0.0-2.fc24.src.rpm

Install the build dependencies

cd ~/rpmbuild/SPECS/ && sudo yum-builddep keepassx.spec

Build the package:

rpmbuild -ba keepassx.spec

Install it:

sudo yum localinstall ~/rpmbuild/RPMS/x86_64/keepassx-2.0.0-2.el7.x86_64.rpm
Comment: Why install from source when you can just install the EPEL release provided in your first link?  Install the EPEL repository and then `yum install keepassx`.  See [my answer](https://unix.stackexchange.com/a/188938/87770) above for more detail on EPEL and its guaranteed RHEL/CentOS compatibility.

How to install keepass2 on CentOS 7?


Garageband pan won't stay put

Question: I am trying to record and play back tracks on GarageBand and the pan feature on the tracks keep turning fully right or left without prompting. I re-set them and the same problem arises. So far this has been happening on midi tracks. How do you set the pan equally in the middle so it stays put?
Comment: If it always changes at the same point in the track, it's probably because either automation or actual MIDI Pan data is recorded in the track at that point. MIDI Pan is control 10 [cc10]. If Garage Band has a 'list' editor where you can see all the data, that's where to look. [Centre is value 64, but if you remove all hard data it will then follow the channel panner.]
Answer: Try this. Turn off the controller on the midi track. It will disable any controller for that track, but if that's OK, this might work
1. track editor (the scissor icon)
2. track edit tool (the line with dots on it
3. Push off the button right below the word "controller"
4. wish for luck

Garageband pan won't stay put


How long should refrigerator defrosting take?

Question: How long does it take for the tubing between the freezer and the refrigerator to thaw? My freezer works just fine, but my refrigerator isn't keeping items cold.  I unplugged it so it can thaw the tubing that blows the cold air from the freezer to the refrigerator.  Just need to know approximately how long it needs to be kept unplugged.
Answer: It should not take more than a couple of hours.  If it still doesn't work, you can remove the cover off the evaporator in the back of your freezer and check to be sure.  Your evaporator blower may also have stopped working, or the motor may be so weak it isn't moving air properly.
Answer: I recently had my 2017 Whirlpool bottom freezer refrigerator ice up and appears to have taken three hours with a hair dryer running to defrost it. The coils for this refrigerator are on the back wall of the freezer compartment. . Supposedly the newer refrigerators have a much tighter "air conditioner" evaporator coils which can hold onto the ice much more tightly than the older style of coiled evaporator with metal fringe. The repair technician said it would take 48 hours with the refrigerator off and the doors open to defrost. I'm not sure if that was worst case scenario or something else.
This fridge replaced a approximately 2000 year old refrigerator with the older style coils between the fridge and freezer sections which with disassembly I could defrost in under an hour.
Comment: I don't see this being worthy of a down vote. The answer gave an example of time and additional information on how they defrosted a fridge.
Comment: Question deleted


Compact sets in $\mathbb R$ are closed

Question: What is the best way to prove the statement? I know the version of using nested intervals, but is there another way to approach the problem?
Comment: This is also generally true in any metric (or more generally Hausdorff) space. You prove that for a compact set $C$, $\mathbb{R}\setminus C$ is open. You use the open covering definition of compactness to do so.
Comment: So you have three answers, and you selected as the best answer the only one that doesn't help you, (the other two focus on $\mathbb R$) makes sense..
Answer: Let $X \subseteq \mathbb{R}$ be compact, and let $y \in \mathbb{R} \setminus X$. It suffices to prove $\mathbb{R} \setminus X$ is open, i.e. that $\mathbb{R} \setminus X$ contains an open ball about $y$. Since $\mathbb{R}$ is Hausdorff, for each $x\in X$, there exists a neighborhood $U_{x}$ of $x$ and $U_{y}^{x}$ of $y$ such that $U_{x}$ and $U_{y}^{x}$ are disjoint. The set of all $U_{x}$'s for each $x \in X$ form an open cover for $X$, so by the compactness of $X$, there exist finitely many $U_{x_{1}}, \ldots, U_{x_{n}}$ which cover $X$. Can you wrap things up from here?
Comment: Sure. I'm not sure I have a much better answer for you, I'm afraid: what tools did you have in mind, exactly?
Comment: Thanks for the suggestion. What I'm looking for is how to view this problem under real analysis?
Answer: Yes. Let $A$ be a compact set and let $p\in\mathbb R\setminus A.$ For each $x\in A,$ Let $B_x$ be the open interval $\left(x-\dfrac{|p-x|}{2},x+\dfrac{|p-x|}{2}\right)$ and let $V_x$ be the open interval $\left(p-\dfrac{|p-x|}{2},p+\dfrac{|p-x|}{2}\right).$ Then by the compactness of $A,$ there are $x_1,x_2,\ldots,x_n\in A$ such that $A\subseteq B_{x_1}\cup\cdots\cup B_{x_n}$ and it follows that the set $V_{x_1}\cap\cdots\cap V_{x_n}$ does not intersect $A$ and hence $p$ is an interior point of $\mathbb R\setminus A,$ which implies that $A$ is closed.
Note that a similar argument can be used to prove that every compact subset of a metric space is closed.
Answer: If $A \subseteq \mathbb R$ is not closed, take $a \in \overline{A} \setminus A$, and for each $n > 0$ consider $$U_n = ( - \infty , a - \tfrac{1}{n} ) \cup ( a + \tfrac{1}{n} , + \infty ).$$ Then $\bigcup_n U_n  = \mathbb{R} \setminus \{ a \} \supseteq A$, however no finite subfamily of $\{ U_n : n > 0 \}$ can cover $A$ since $a$ is a limit point of $A$ (for each $n > 0$ there is an $x \in A$ such that $| x - a | < \frac{1}{n}$).
Therefore $A$ cannot be compact.
(To alter this for a a general metric space $(X,d)$, take $U_n = \{ x \in X : d(x,a) > \frac{1}{n} \}$.)

Compact sets in $\mathbb R$ are closed


DataGrid.LoadingRow event firing three times

Question: I have a HyperLinkButton in every row of a datagrid in my silverlight app.  I need to fire an event so I am adding a handler to the click event of the HyperLinkButton in the DataGrid.LoadingRow event.  The problem is the event is firing three times (more accurately, the handler is being added three times.  I tried removing the handler before adding it but that has no effect.  Any ideas?
Answer: I just set the .Tag on the Hyperlink button when I add the event handler and use that as a flag that the handler has been added.
Answer: To add to this issue, the problem occurs probably because the LoadingRow event may actually fire several times. The Datagrid will only instantiate the row when it is needed and will recycle it when it goes out of view. Like when you start scrolling the grid.
See the remarks sections for details:
DataGrid.LoadingRow event on msdn


What is the order of the Crisis on Earth X episodes in the Arrowverse?

Question: There seams to be some crossover and I'm unsure of the order of which the episodes are supposed to be watched.
Comment: the order they aired will always work; the titles of the crossover are also numbers part 1/2/3/4.
Comment: It should be noted, however, that the Crisis on Earth X crossover threw the normal episode airing order out of whack.  So if you've been following along since the beginning of the season, know that the episodes resume as normal the following week.  They are only out of whack for crisis on Earth X.
Answer: This is the order to watch those episodes . Crisis on Earth X .

Supergirl Season 3, Episode 8           (part 1)
Arrow Season 6, Episode 8                  (part 2)
The Flash  Season 4, Episode 8             (part 3)
Legends of Tomorrow  Season 3, Episode 8   (part 4)
Comment: It should be noted, however, that this is NOT the normal watching/airing order of these shows.  The Crisis on Earth X threw things out of whack but I heard that everything will go back to order the following week.


Get rid of "trash can" for custom post type

Question: I have a CPT "foo".
I want to totally disable the "trash can" feature, so that any time on the the CPTs is deleted, it is simply permanently removed. Not put in the trash can. How can I do this programatically?
Answer: If you wanted to do this for all post types, you'd simply do
define('EMPTY_TRASH_DAYS', 0);

see https://codex.wordpress.org/Trash_status#EMPTY_TRASH_DAYS_option.
But since you only want to do this for a custom post type, you will need to hook into 'trashed_post' like this:
add_action('trashed_post', function( $post_id ){
    [...]

then check your trashed posts' post type:
    if ( get_post_type($post_id) === 'foo') {

and use wp_delete_post() with the 'force delete' parameter set to true on posts that turn out to be of your targeted post type:
        wp_delete_post( $post_id, true );
    }
});

I'd guess WordPress will then probably still show the 'moved into trash bin' message, even though it'll appear to the user as if there was no trash bin and the post will indeed already be deleted entirely. So you might have to change the $labels that are passed to your register_post_type() call if that's the case.


Issues with Modified by and Created By Fields

Question: We are seeing strange issues in our SharePoint Lists Created by and Modified by fields .It shows as special characters as shown below .I had already checked the User Information list and verified that everything is working fine .This issue is happening on SharePoint 2016 and its patched to the latest version .
Answer: You can use the power shell command below to show it as display name:
Get-SPUser –Web http:// | Set-SPUser –SyncFromAD
If the problem persists, you can try to create a new user profile service application, then start profile synchronization, then select start full, after that, check the effect.
Comment: Thank you though that didn't work what helped is that we had to run a script to Fix the list Schema .May be when we created the list from template its was effected


SharePoint SPFx Graph API calls not working on Desktop Teams tab

Question: SharePoint SPFx Graph API calls not working on the Desktop Teams tab, It displays nothing on the Teams Tab. The same Teams Tab is working fine on the web browser. In the Teams tab, I just want to make a call to the Graph API calls to get the Mail messages and/or just read the User Profile from SharePoint.
I know this is a repeated question but I didn't get my solution on any of the existing blogs. I followed the different blocks, I followed this block but I didn't get success. I tried to debug the application, in the Desktop Teams Tab, I got the Access Denied error. The following is the URL generated and I got the Access Denied error.
<code>https://<tenant>.sharepoint.com/sites/<site>/_api/Microsoft.SharePoint.Internal.ClientSideComponent.Token.AcquireOBOToken?resource=%27https://graph.microsoft.com%27&clientId='<Client Id of default Sharepoint app>'
</code>
Please help to resolve this issue.
Answer: You must access the SPO portal at least once with that account (I checked because the same thing happened to me).
Ref: https://github.com/SharePoint/sp-dev-docs/issues/6136
Anoter option (I have not checked):
https://stackoverflow.com/questions/59860729/spfx-webpart-in-msteams-desktop-client-throws-an-unauthorizedaccessexception


How do you limit access to a site by geographical location?

Question: I need to come up with a way to limit users' access to a page to IP addresses within North Carolina. This has to do with usage rights for some MP3 audio. Are there companies that provide this service or is there a list of IP address ranges for a geographical location? This is on a Unix, JBoss/Seam environment. Thanks.
Answer: I doubt such a list is available. You can check the register information from the IP address you receive which resolves to the ISP of the user (not very accurate).
But there is always a way to bypass this using proxy services like proxy.org (or google proxy)
Answer: use geoip by http://www.maxmind.com/
they have both free and subscription-based services (more precise)
Answer: You can try ip2location, and from that list try extracting specific providers in North Carolina. When you check the IP, you can query that list to get the provider and check if that provider in that area or not.
Hope this helps.
Answer: Despite the fact that is not a good idea (users can use a proxy and bypass this restriction), you can find many services googling for it: http://www.google.com/search?client=ubuntu&channel=fs&q=ip+geolocation&ie=utf-8&oe=utf-8
As far as I know, http://www.maxmind.com is one of the best availableand is used in sites like Sourceforge.
You should implement this restrictions on your application not your server via .htaccess files.


Maximum concurrent connections Azure Django

Question: I have a Django server deployed on an Azure medium instance. I just wanted to know the maximum number of concurrent connections that can connect to my server at once. Consider these as REST connections rather than TCP connections because our server has a REST interface.
Answer: The number of concurrent connection is not artificially limited for Azure Virtual Machines, the actual number of the concurrent connections would depend upon the performance of your web service, the scalability of Django built-in web server and the reuse of TCP connection pool by your clients. You might want to test this using some web load tests.


What effect would a company delisting from the LSE to move to china have on shareholders?

Question: If a company trading on LSE:AIM decides to delist and move to a Chinese market, what happens to the PI's and general shareholders?
Answer: Source

Rule 41 of the AIM Rules sets out the procedure for delisting. In summary, a company that wishes to cancel the right of any of its trading securities must:

notify the market through a regulatory information service of the proposed cancellation date;
notify the London Stock Exchange (the "Exchange") of its intended cancellation and its reasons for cancellation including its preferred cancellation date; and
obtain shareholder approval.

The notification to the Exchange should be made by the company's nominated adviser  and should be given at least 20 business days prior to the intended cancellation date (the 20 business days' notice requirement is a minimum).
Any cancellation of a company's securities on AIM will be conditional upon seeking shareholder approval in general meeting of not less than 75% of votes cast by its shareholders present and voting (in person or by proxy) at the meeting.
The notification to shareholders should set out the preferred date of cancellation, the reasons for seeking the cancellation (for example annual fees to the Exchange, the cost of maintaining a nominated adviser and broker, professional costs, corporate governance compliance,  inability to access funds on the market), a description of how shareholders will be able to effect transactions in the AIM securities once they have been cancelled and any other matters relevant to shareholders reaching an informed decision upon the issue of the cancellation.
Cancellation will not take effect until at least 5 business days after the shareholder approval is obtained and a dealing notice has been issued by the Exchange.
It should be noted that there are circumstances where the Exchange may agree that shareholder consent is not required for the cancellation of admission of a company's shares, for example (i) where comparable dealing facilities on an EU regulated market or AIM designated market are put in place to enable shareholders to trade their AIM securities in the future or (ii) where, pursuant to a takeover which has become wholly unconditional, an offeror has received valid acceptances in excess of 75% of each class of AIM securities.  The company's Nominated Adviser will liaise with the Exchange to secure a dispensation if relevant.

So you should receive information from the company regarding the due process informing you about your options.
Answer: You would still be the legal owner of the shares, so you would almost certainly need to transfer them to a broker than supports the Hong Kong Stock Exchange (which allows you to trade on the Shanghai exchange).
In order to delist they would need to go through a process which would include enabling shareholders to continue to access their holdings.
Comment: And if I didn't want to set up an account (or deal with annual forms for the sake of a single holding) what would be my options? Keep the paper certificates or sell?
Comment: Probably. There would be a good chance of there being a purchase program.
Comment: Thanks for your help. One last question, as I've not personally had a stock delist before (that's AIM for you!) would the purchase program typically be at market value, under, or at premium?
Comment: I wouldn't know to be honest, there isn't much to go by. The only reason I think there is a good chance is because of the regulatory issues around listing in China for investors. There wouldn't be a buyback scheme when moving from NASDAQ to NYSE for example


Disable the new ubuntu 18.04 welcome screen

Question: We deploy Ubuntu desktops in our environment at scale and I want to kill the new welcome screen so it doesn't appear on all newly built machines at first log in.
Has anyone figured out how to do this yet?
Answer: I found the solution to this myself so I'm posting it here for all those who might want to know.
The welcome screen is part of the gnome-initial-setup package. The first time a user logs into a new machine the command /usr/lib/gnome-initial-setup/gnome-initial-setup --exisiting-user runs.
for us simply removing the gnome-initial-setup package during kickstart is a suitable fix as we don't require any of the gnome initial setup stuff anyway (we don't want to create local user accounts or set the system time etc).
if you do still want the pre-login welcome stuff then you'll need a different solution.
Comment: In this initial setup, user opt in or out sending reports to Ubuntu for example. Did you notice any side effects after removing the gnome-initial-setup package ? Did you removed the ubuntu-report package too ?
Answer: I am in the same boat as Dean and found this article + another ones.
Here Rui Matos recommends to append InitialSetupEnable=false in /etc/gdm/custom.conf (in Ubuntu /etc/gdm3/custom.conf).
So edit /etc/gdm3/custom.conf and add the following:
[daemon]
InitialSetupEnable=false

Hope this helps someone else to get rid of the Welcome Screen.
Comment: This seems reasonable, but to me it did not work at all. Ubuntu 18.04.2. sokunrotanak's solution worked tho.
Answer: As a side note, you can cleanly create the necessary files to cancel the action.
On my end, I'm installing packages on an embedded system and for that I create one user. I want to avoid the "initial setup wizard" and all I have to do is create one file in the user's .config directory:
touch /home/${NEW_USER}/.config/gnome-initial-setup-done

So I can place that command line in my package.postinst file and that user will never see the initial setup wizard.

How does that work?
If you know the names (which other users mentioned) of the startup files and you look into them, the files include a condition:
AutostartCondition=unless-exists gnome-initial-setup-done

So if you create that file, it won't start. There are several types of conditions, the tour one is the opposite:
AutostartCondition=if-exists run-welcome-tour

So you need to create that file for the welcome tour to kick in and once done with the tour, the file gets deleted. Maybe they save the step you're on in that file. So in our script we could add the following to make sure the welcome tour doesn't start:
rm -f /home/${NEW_USER}/.config/run-welcome-tour

This solution is much cleaner than any others (except for uninstalling the offending packages if that's an option for you).
Answer: If you don't want to uninstall the package, you can edit the file
sudo vi /etc/xdg/autostart/gnome-initial-setup-first-login.desktop

by adding a "#" (without quotes) to the beginning of the execute line like this:
#Exec=/usr/lib/gnome-initial-setup/gnome-initial-setup --existing-user

Comment: a oneliner command to do this is `sudo sed -ri 's/^(Exec=.*)$/#\1/' /etc/xdg/autostart/gnome-initial-setup-first-login.desktop
`
Comment: This did work for me on Ubuntu 18.04
Answer: I also achieved this by adding the file /etc/skel/.config/gnome-initial-setup-done
sudo touch /etc/skel/.config/gnome-initial-setup-done

Answer: Following @sokunrotanak-srey's route, I'd rather use dpkg-divert like so:
First, replace the Exec=... line with Exec=/bin/true in all the .desktop files to to make them dummy
Second, use dpkg-divert to keep local changes even if the package has a newer version of the .desktop files:
# dpkg-divert --local --add /etc/xdg/autostart/gnome-initial-setup-copy-worker.desktop
Adding 'local diversion of /etc/xdg/autostart/gnome-initial-setup-copy-worker.desktop to /etc/xdg/autostart/gnome-initial-setup-copy-worker.desktop.distrib'

# dpkg-divert --local --add /etc/xdg/autostart/gnome-initial-setup-first-login.desktop
Adding 'local diversion of /etc/xdg/autostart/gnome-initial-setup-first-login.desktop to /etc/xdg/autostart/gnome-initial-setup-first-login.desktop.distrib'

# dpkg-divert --local --add /etc/xdg/autostart/gnome-welcome-tour.desktop
Adding 'local diversion of /etc/xdg/autostart/gnome-welcome-tour.desktop to /etc/xdg/autostart/gnome-welcome-tour.desktop.distrib'