What is "enzymatic activity"?

Question: I should be grateful if anyone would send me a link to an article or an encyclopedia/handbook contaning an explanation of the concept of enzymatic activity. Surprisingly, I did not manage to find anything else but a brief definition.
Comment: Are you asking how enzymes work in general (which is a broad question, and covered in any basic biochem text), or are you wondering how to precisely define and measure "activity"?
Comment: I'm not sure why people have voted this off-topic. As far as I can see the poster is unclear about the term activity, which for someone coming from a more physical science (like chemistry) — as I did myself — can appear a little puzzling. My own answer takes a much broader look at the meaning of enzyme activity in a biological context than the quantitative definitions provided by some, and seems to me on-topic. Perhaps the poster could clarify his question.
Answer: An Introduction to Enzymes (pdf) can be found here.

Excerpted from a very popular Worthington publication which was
  originally published in 1972 as the Manual of Clinical Enzyme Measurements. While some of the presentation may seem somewhat dated, the basic concepts are still helpful for researchers who must use enzymes but who have little background in enzymology.

Source: Worthington Biochemical Corporation.
The quantity or concentration of an enzyme can be expressed in terms of activity in enzyme units. See Wikipedia:

Enzyme activity = moles of substrate converted per unit time = rate × reaction volume. Enzyme activity is a measure of the quantity of active enzyme present and is thus dependent on conditions, which should be specified. The SI unit is the katal, 1 katal = 1 mol s−1, but this is an excessively large unit. A more practical and commonly used value is enzyme unit (U) = 1 μmol min−1. 1 U corresponds to 16.67 nanokatals.

Here are some additional useful, simple videos explaining enzyme activity:

How Enzymes Work
Explain factors affecting enzyme activity
Answer: The entry for Enzymes in Wikipedia contains 28 instances of the word 'activity'. I can only assume, therefore, that it is the fact that this term is not explicitly defined that is the problem — one for which a novice to the field need make no apology. I shall answer it in elementary — but not self-evident — terms.
Enzymes are biological catalysts, so catalysis is their fundamental property or quality. In this context my definition is:

Enzyme activity is the manifestation of the catalytic ability of an enzyme

My use of the word 'manifestation' is deliberate and important: the essence of enzyme activity is the action or functioning of the enzyme, because this is the way that we are aware of its presence and, hence, how we draw quantitative or qualitative conclusions about its behaviour or function.
Detection of enzyme activity
Enzyme activity is detected by observing a reaction which it catalyses, i.e. by observing — and usually measuring — the conversion of  some chemical reactant (termed the substrate of the enzyme) to a product. This allows certain questions to be answered:
1. Is the enzyme present or not,  or, if present, is it able to manifest its potential?
The most basic question that measurement of enzyme activity is used to answer is whether or not there is enzyme present, e.g. in a tissue. In fact, the absence of enzyme activity can have other interpretations besides the absence of enzyme protein: the enzyme could be present but denatured or poisoned, or it could be present in a inactive form because of the absence of some secondary agent (cofactor, regulatory molecule) required for it to function.
2. How much enzyme is there?
In experimental work where one wishes to compare amounts of an enzyme in different tissues, monitor its purification from other proteins, or study the effects of agents and conditions upon its functioning, one needs not just to detect it (e.g. by observing that a coloured substance is formed) but to measure how much enzyme or functioning enzyme there is. To quantify enzyme activity we measure the amount of substrate converted to product in a given time under suitable conditions.
Explanation of the units used and the suitable conditions are available in standard texts and on the web. My own self-teaching material on this topic can be found  found here.
3. What is the nature of the reaction  catalysed or is there more than one enzyme there?
These are other questions that measurement of the activity of an enzyme or impure preparation can answer. What is important here is what precise reaction is being catalysed. If an enzyme can catalyse the phosphorylation of D-glucose to glucose 6-phosphate, can it also catalyse the phosphorylation of L-glucose — i.e. is it specific for one rotamer? If the preparation can also phosphorylate fructose (for example), are there actually two different enzymes present in the preparation? If it phosphorylates some other sugar 50 times better than glucose, perhaps its function within the cell is different from that previously assumed.
Activity as a general concept in science and biology
The measurement of activity rather than quantity is not restricted to enzymes. One is also concerned with the activity of hormones, drugs, neurotransmitters etc. (e.g. to determine what tissues they affect and what their effects are). And more generally in science, we deduce the existence of things by their ability to do something — gravity is an example from physics.
Comment: @tomd — I think this refers to another answer than mine which is totally non-quantative.
Comment: I have revised my answer considerably, because the questioner seems to me to be asking about the concept of enzyme activity — not how to assay enzymes and what their units are and definitely not what their kinetic constants are. (If he meant that he has not expressed himself very well.) So I have extended my answer to address the question of enzyme activity more generally than with respect to quantitation, and so that it gives a broader explanation of why measurement of enzyme activity is important. Coming from chemistry myself, I think this may help others.
Answer: Enzyme activity refers to the dynamic process of an enzyme catalyzing a reaction and is a measure of the quantity of catalytically competent enzyme present in a preparation.
We measure enzyme activity by making a trial of the enzyme reaction, that is we assay the enzyme. The trial, or assay, is done first and foremost under conditions where the enzyme works.  The pH, for example, may be critically important, as may the presence or absence of inhibitors or activators. In addition, the assay is conducted under conditions where the experimenter can directly or indirectly detect the catalytic transformation, perhaps by monitoring the production of a product or the consumption of a substrate.
For example, if I want to measure the activity of a dehydrogenase, I could measure the decrease in absorbance at 340nm, where NADH but not NAD(+) absorbs strongly. In a spectrophotometer, this may be done continuously with time and is an example of a continuous assay.
However, there may be no convenient change in absorbance but we might have a radioactive substrate. In this case we might conduct our trial under conditions where we would expect the enzyme to work for, say, 30 min, stop the reaction (by denaturing the enzyme with acid, for example) and isolate a radioactive product.  This would be an example of a discontinuous assay.
In both cases we are observing a change due to the enzyme catalyzing a specific reaction, that is we are measuring enzyme activity.
We now come to an important distinction.  An enzyme assay is a measure of catalytic activity, which may or may not be related to the total amount of enzyme protein present.  Consider a genetic disease that results in a particular enzyme activity being totally absent from an organ. We assay a liver sample for lactate dehydrogenase, for example, and find none present (to take a trivial example). This could mean that the  enzyme is not being produced: there is no enzyme there.  But is also could mean that the enzyme is present but is being produced in an inactive state.  Maybe the 'normal' enzyme has an essential tyrosine at the active site, but a genetic mutation has changed this to a phenylalanine in the case under study.
If we have an antibody directed against the enzyme under study, we could develop an enzyme-linked immunoassay (ELISA) which will (if it is any good) specifically measure the total amount of protein present whether active or not, even in a crude liver extract. (A Western blot, of course, might also detect the presence of inactive protein). That is, an enzyme assay gives an estimate of the amount of enzyme present based on enzyme activity, whereas an ELISA gives an estimate of the total amount of enzyme protein present.
Enzyme activity is usually reported in terms of amount of substrate or product transformed per minute or per second: in micromoles/min, for example.  It is also usual to measure the total amount of protein present and report the enzyme activity in terms of micromoles/min per milligram of (total) protein.  This is the specific activity and allows for ease of comparison. Almost invariably, the 'per milligram' part of a specific activity measurement refers to the total amount of protein present (measured with the Lowry protein assay or the like).
(If, for example, Lab A reports that 20 microlitres of their liver extract has a-dehydrogenase activity of 5 micromoles/min and Lab B reports that 20 microlitres of their liver extract has a-dehydrogenase activity of 50 micromoles/min, these measurements may well be identical when compared on a protein basis (micromol/min per mg) and that the only difference is that liver A was extracted in 100 volumes of buffer but that liver B was extracted in 10 volumes of buffer).
Units of enzyme activity invariably refer to specific assay conditions, and this may be a very important consideration when designing an experiment. In addition, enzyme are labile and the activity may decrease with time (on prolonged storage for example).  If, for example, a protocol requires you to add 10mg of of an enzyme preparation with a specific activity of 100 Units/mg (100 micromoles/min per mg), but freezing the enzyme preparation has resulted in denaturation, you are adding 10mg of enzyme protein but no enzyme activity. This may also be important.
Finally, a great reference:
Principles of enzyme assay and kinetic studies by K. F. Tipton in Enzyme Assays: A practical approach

What is "enzymatic activity"?


Logo position on an eshop

Question: Just a quick question; if the corporate logo is placed at the upper centre rather than on the left part of the eshop's home page, is it ok to have an info menu on the left (having the sign up, log in, search and cart on the right)
Comment: IMHO, don't overestimate user's ability to find something on your page. Stick to the basics or you'll end up with people spending more than 10 secs to find the menu and after that, just going to another eShop.
Comment: What was the reason behind moving the logo to the center?
Comment: Sure. Why not? Go for it.
Comment: Thank you so much guys!! Logo was placed at the centre mainly for brand awareness,look and feel reasons, as we are new in business.However, we are examining the possibility of having the logo on the left.Problem is we are a marketplace for handmade staff so we need to have a 'buy' and a 'sell' page giving further info.If logo is placed on the left and sign up, sign in, cart and search staff are on the right side, where should we put these two pages?Should we include them on the right as well or should we place them in the footer menu where we have all info pages on how to buy,sell andabout us?
Answer: I would keep the logo in the top left corner - people are used to it. I would not change the ecommerce UX too much - being creative is fine but remember that customers need to find what they are looking for fast. Keeping the eshop up with common standards also means that the eshop is not completely foreign to them, which makes them feel at home, which it turn may raise the conversion rate.
You can also make the top menu sticky - and add a miniature logo to it on the left side.
Try looking at some case studies from the Baymard Institute and the team behind visual website optimizer - it may help you decide.
Answer: I would suggest using some iconography such as a (?) to denote your info Menu.  An upper left location is not uncommon on mobile sites for a "hamburger" menu trigger.  I think one of the reasons is that it doesn't conflict with existing touch areas for the browser menu itself.  Also a mobile peek menu is better received from the left hand side.

Logo position on an eshop


Western philosophers that emphasize on the importance of meditation?

Question: Who are the main western philosophers who acknowledge the importance of meditation, self-discovery(know yourself) and the realization of your own mind-habits and emotional responses?
Comment: read some of the Christian mystics - "The Cloud of Unknowing", "Dark Night of the Soul", "The Interior Castle", "The Philokalia", "Prayer of the Heart: The Contemplative Tradition of the Christian East", "The Way of Perfection by Saint Teresa of Avila"
Comment: You can check this list here: https://en.wikipedia.org/wiki/Timeline_of_Western_philosophers#1900–2000_AD . Perhaps Thoreau indirectly gets a little close to the concept of mediation.
Comment: I wonder why the association between self-awareness and religious practice? I guess it is just because religion is so endemic. Coincidence is not causation.
Answer: You might usefully try :
John R. Sommerfeldt, 'Meditation as the Path to Humility in the Thought of Bernard of Clairvaux', Mystics Quarterly, Vol. 15, No. 4 (December 1989), pp. 177-183.
Richard Douglas Jordan, 'Thomas Traherne and the Art of Meditation', Journal of the History of Ideas, Vol. 46, No. 3 (Jul. - Sep., 1985), pp. 381-403.
John Malcolm Wallace, 'Thomas Traherne and the Structure of Meditation',  ELH, Vol. 25, No. 2 (Jun., 1958), pp. 79-89.
Finley, J.: 2000, The Contemplative Heart (Sorin Books,
Notre Dame, IN).
Kabat-Zinn, Jon. 2005. Coming to Our Senses: Healing Ourselves and the World Through Mindfulness . New York: Hyperion.
Michal Pagis, Embodied Self-Reflexivity, Social Psychology Quarterly
Vol. 72, No. 3 (Sep., 2009), pp. 265-283.
Brian Stock, 'Commentary: Reading and Healing: Reading, Healing, and the History of Western Meditation', New Literary History, Vol. 37, No. 3, Reading and Healing (Summer, 2006), pp. 643-654.
John D. Lyons, 'Meditation and the Inner Voice', New Literary History, Vol. 37, No. 3, Reading and Healing (Summer, 2006), pp. 525-538.
Answer: The Delphic maxim is truly ancient, but it's meaning and implications are very much open to dispute.
Stoics practiced meditations on various topics, and indeed that is why Marcus Aurelius' memoir was titled 'Meditations' (although, I guess Descartes used the same title, without the same practices..). Stoic practices are very much focused on active self-observation and reforming.
There is a tradition of meditational prayer in Christianity, especially in the practices of the anchorite https://en.m.wikipedia.org/wiki/Desert_Fathers and more broadly in the https://en.m.wikipedia.org/wiki/Hesychasm of the Eastern Church.
There is a lot of subtlety in differences between how different traditions approach meditation, and precise practices. The stoic practices are like vipassana meditation, and the Desert Fathers are a rare example of Western practices like samatha meditation. But I would say otherwise, meditation and guided self-reflection on the workings of the mind has been rare in the West, until modern times directly influenced by Eastern thought.
Comment: https://en.wikipedia.org/wiki/Christian_contemplation shows a connection with Greek philosophy by the term _theoria_ (θεωρία) -> Latin (Christian) _contemplatio_ (contemplation).  In Early Christianity, it seems that neoplatonic _theoria_ turned to studying scripture, and _contemplatio_ became a form of prayer which resembles meditation.
Comment: I'd say not rare in the West but rare among Western philosophers. Outside of philosophy and the exoteric Roman religion there are plenty of famous examples, as Swami's earlier comment indicates. After all, it was two millenia ago that the West's best known religious teacher told us 'Tthe Kingdom of Heavem is within'.
Comment: @CriglCragl - Yes. I was stuggling to think of a person who advocates meditation who would be classed as a 'Western philosopher'. I suspect these attributes are mutually exclusive.
Comment: @PeterJ The question was framed about philosophers
Comment: Maybe self-awareness is in opposition to Philosophizing? Or a compliment to it, orthogonal? Or, something "completely *different*"


I am on an island in CIV5 but it looks like my ships are stuck

Question: I am on an island and have optics about 200 turns in.  I have a lot of the navigation research and many different ships.  But there are different color tiles in the ocean that I can't travel across.  For example, the tile looks black and shows ocean but only the light blue ocean, I can travel through.  There is only one slim passage I can travel across.  Why is this?
Answer: In order to travel the "dark blue" ocean tiles, and escape the limits of the "light blue" coast, you'll need Astronomy.  Astronomy gives you the Caravel, a fast scouting naval unit that can cross ocean tiles, as well as allowing embarked units to travel on these tiles as well.
It's often the case that when you start on a remote island, it may be difficult or even impossible to find another landmass without Astronomy.
Comment: Yeah, he's probably got a trireme or a galleass. Depending on the difficulty and how hostile others get, I might beeline to Frigates and Privateers. AI doesn't seem to do naval invasions well ;)


selling apple stock limit order

Question: Last night around midnight I saw the Brexit voted leave so I went to sell my Apple shares. I put a limit at 96.00. It ended yesterday closing at 96.10. Will my limit order be executed? I am confused on how that works
Comment: You have a higher chance of getting a fill if you make your order valid during the extended trading session (a.k.a. before- and after-hours). Your broker will have a "time-in-force" field when placing an order that you can set to "GTC + extended hours", which will make the order remain forever until cancelled, and allow execution during extended hours trading.
Answer: Your order may or may not be executed.  The price of stock can open anywhere.  Often yesterday's close is a good indication of today's open, but with a big event overnight, the open may be somewhere quite different.  You'll have to wait and see like the rest of us.  Also, even if it doesn't execute at the open, the price could vary during the day and it might execute later.
Comment: okay thank you Brick! hopefully it executes. Already down 3% in pre market :/

selling apple stock limit order


What lens and camera settings are recomended for UAV (drone) aerial imagery capture?

Question: I have been toying with the idea of purchasing/bowrrowing a UAV and attempting to capture my own aerial imagery.  I have pretty good DSLR Canon gear and several lenses but I am wondering what lens, focal length and camera settings, including capture intervals, vehicle speed, etc. are recommended.
Comment: I personally don't know enough about this topic to provide an answer at all, but, to get the most applicable answer, you might consider editing the question and including anything you can about the type/class of UAV you're looking into &/or general altitude info you're looking at.  I've seen some really small UAV's that fly pretty low to ground that I would think would need a lot less zoom for detailed shots than a higher flying UAV.  Just a thought...
Answer: All of the specific answers I can come up with would have likely already occurred to you as a photographer. A low distortion lens with a shorter focal length (based on your prospective altitude). High shutter speed to minimize motion/vibration impacts.  Interval and speed are something of a function of your flight plan and altitude - I don't know if there are specific numbers to follow vs it being a equation to be solved for each flight since you want to ensure sufficient for in- and cross-track overlap. Generally speaking, from a camera settings standpoint you can just think of it as another type of panoramic stitching scenario.
Your best bet might be talking to DroneMapper. They are software as a service that aims to process images collected by UAVs, and as such offer recommendations on equipment and procedures - very generally in their FAQ, more specific on their Guidelines page, and several very specific PDF guides and informational papers under Documentation (all under Support on the nav menu). From various areas of that site:

For best results: Shutter Speed >= 1/1000th, Auto ISO, White Balance
  setting fixed to 'Sunlight', 'Day' or 'Cloudy' depending on sky
  conditions. We've also seen great results with a fixed ISO setting.
...a good rule of thumb to use is the camera shutter speed should be
  set at no lower than the time to move one half of a pixel...
We recommend > 60% in-track overlap (75% is a good target #). So for
  this example let's say you fly at a nominal 13 m/sec. 75% overlap
  in-track means that you move 52 m relative to the ground (75% of 209 m
  = 157 m; 209-157 m = 52m) and take a photo. At 13m/sec you need to take a photo every 4 sec. Depending on expected wind conditions and
  the actual UAV ground speed you may want to adjust your photo interval
  faster to maintain adequate overlap.

Other links: Two commercial companies developing in this field are SkySight Aerial Imaging and Falcon UAV; they might be willing to talk with you about some of your questions.  Two other websites that may have some good info are DIY Drones and a section of the Virtual Terrain Project on collecting your own imagery.
Comment: @Jakub I don't know you'll find tables, but a dimensional FoV calculator as on [this page](http://www.tawbaware.com/maxlyons/calc.htm) can help and you may be able to set up a spreadsheet to calc your own table. Focal length *and* your specific sensor size/resolution combined with altitude gives you your groundplane FoV. FoV combined with your flight speed and accounting for overlap as above sets your interval. [This paper](http://icaci.org/files/documents/ICC_proceedings/ICC2009/html/nonref/1_6.pdf) and [this page](http://www.angelfire.com/indie/aerostuff/PhotoGrammetry101-A.htm) may help.
Comment: Thanks for your input Chris. I don't think it's off topic. I am asking about setting up equipment for remote sensing. Data will be used in GIS.  I am in Canada and where I am no license is required to operate UVA up to 400 ft; license is needed for higher altitudes. In any case right not I am only interested in the camera-lens setup and how it can be used to collect the data.
Comment: @Jakub You're right, that was a poor answer. My opinion was just that, and why I didn't flag it off-topic. It should have been a comment if anything. Nor were the 'considerations' really relevant to what you asked. Hopefully my revision is more on track.
Comment: Thanks @Chris! That's good information.  I will poke around the sites you linked.  The info you provided makes sense.  I am curious about focal length now and its relationship to capture interval. Will try to find some tables for this. Software and post processing will not be a problem; seems there are options out there for photogrametry dem, stitching, etc.


VY Canis Majoris planetary system

Question: Since the Sun is the only star we know to have life in its planetary system, I came to wonder about if it was replaced by, say, VY Canis Majoris How far would we have to be so that we would still be functioning normally as if it was really the Sun? Could such a thing even be possible?
Comment: Are you asking about whether life could *form*, or whether it could survive, if placed there?
Answer: This is actually pretty simple. We just have to calculate the stellar flux, which is the luminosity of the star divided by the surface area of a shell with the radius of the planet's orbit. In other words:
$$F=\frac{L}{4\pi r^2}$$
Now, let's denote the Sun's luminosity as $L_{\odot}$, the current radius of Earth's orbit as $r_i$, the luminosity of VY Canis Majoris as $L_{\text{VY}}$, and the new radius of Earth's orbit as $r_f$. We need to set the fluxes equal, in order to keep conditions on Earth the same. Therefore,
$$F_{\odot}=F_{\text{VY}}\to\frac{L_{\odot}}{4\pi r_i^2}=\frac{L_{\text{VY}}}{4\pi r_f^2}$$
The $4\pi$s cancel, and, given that Wikipedia gives VY Canis Majoris's luminosity as about 270,000 times that of the Sun, we get
$$\frac{L_{\odot}}{r_i^2}=\frac{270,000}{r_f^2}\to r_f=\sqrt{270,000}r_i\simeq520r_i$$
Therefore, Earth would have to be 520 times as far away - 520 AU - for conditions to be such that we could "function normally", as you put it.
Answer: Without going into any mathematical details, I can tell you this: no, life on a planet around CM is not possible. The very existence of a planet around CM is highly unlikely. If a planet is found circling CM, a lot of astrophysicists will be staying up late, scratching their heads, wondering how to explain this scenario.
The first and foremost reason of no life around CM is that it is not a normal star but a red hypergiant. This means that the time when it had an active core (where fusion took place), its size would have been much smaller than what it is now. This also means that its luminosity and gravitational interaction with its planets would also have been different than what would be expected of now.
So that if there was any planet in the goldillock zone around it, that planet would have definitely roasted to cinders when CM turned hypergiant. Since the hypergiant phase of stars doesn't last long enough, there is zero chance that life could have formed and evolved on any possible planet around CM after it turned hypergiant.
Comment: Couldn't the star simple capture a rogue planet? Also, the habitable zone still exists; it's simply much further out.
Comment: Nope. According to wikipedia, CM has an average density of 5-10 **mg**/m$^3$ which is far far too less to capture a planet to make it orbit around itself. If anything, the planet would simply fall into CM, considering it's monstrous size and (probably) low escape velocity.
Comment: What does density have to do with it?
Comment: http://what-if.xkcd.com/68/
Comment: I'm sorry; I don't see the relevance there to the situation at hand.

VY Canis Majoris planetary system


In Unity, can I load a local (/Resources folder) website to safari on an ipad

Question: In Unity, can I load a local (/Resources folder) website to safari on an ipad?
This works fine on a Mac, opening up a wepage from my Resources folder.
string path = "file://"+(Application.dataPath)+"/Resources/testsite.html";
    void OnGUI(){
        if(GUI.Button(new Rect(20, 20, 100, 100), "site")){
           Application.OpenURL(path);
        }
    }

but when I try to load this on an iPhone or iPad, it doesn't seem to work.
Am I accessing the address incorrectly for iOS using "file://"?
If this is not possible, is there an alternative way I can load a locally stored website on an iOS device?
Answer: Yes you can, but you're using wrong folder. The Resources folder is not copied with your build; rather, it is compressed into a single file cotaining all assets from the folder.
To actually copy some files into your app, use StreamingAssets folder (http://docs.unity3d.com/Documentation/ScriptReference/Application-streamingAssetsPath.html). This folder is simply copied into resulting build, so you can use files in it like normal OS files, including, I suppose, opening them in Safari (I don't know, maybe some iOS quirks can still prevent you from doing that. It definitely works on desktop).
Answer: According TO Unity's Manual,
Any files placed in a folder called StreamingAssets in a Unity project will be copied verbatim to a particular folder on the target machine. You can retrieve the folder using the Application.streamingAssetsPath property. For reference, the location of this folder varies per platform:
On a desktop computer (Mac OS or Windows) the location of the files can be obtained with the following code:-
path = Application.dataPath + "/StreamingAssets";

On iOS, you should use:-
path = Application.dataPath + "/Raw";

...while on Android, you should use:-
path = "jar:file://" + Application.dataPath + "!/assets/";

It's always best to use http://docs.unity3d.com/Documentation/ScriptReference/Application-streamingAssetsPath.html to get the location of the StreamingAssets folder, it will always point to the correct location on the platform where the application is running.
For more information have a look into http://docs.unity3d.com/Documentation/Manual/StreamingAssets.html.
Answer: You [probably] aren't going to be able to do that.
But with some Objective-C work (and I'm sure there are some easy plugins on the asset store to do this, such as this one), it should be relatively straight forward to push a WebView from within the app itself with whatever html data you want.


How to sort blobs vertically with AForge.NET BlobCounter?

Question: I have zebra-striped images where each fringe is to be considered a blob for further processing, but which also contains blobs that should not be considered. I am using AForge.NET / C# / VisualStudio2010. A typical example would be this:

The plan is to do this:

Choose some X coordinate defining a vertical line;
Take each white blob which crosses this vertical line;
The output should be a list of blobs or blob indexes SORTED VERTICALLY (this is necessary), so that white fringes would be ordered from higher to lower.

I have this code, which successfully isolate only the fringes crossing the reference vertical line:
using AForge.Imaging;
using AForge.Imaging.Filters;

Bitmap threshold_binary = gimme_threshold_image();
var blob_counter = new BlobCounter();
blob_counter.ProcessImage(threshold_binary);
var blobs = blob_counter.GetObjects(threshold_binary, true);

int midline_x_coord = threshold_binary.Width/2;
int counter = 1;
foreach (var blob in blobs)
{
    // This saves an image for each blob (white fringe) which crosses the vertical reference line,
    // but the fringes are not sorted vertically!
    if (blob.Rectangle.X < midline_x_coord & (blob.Rectangle.X + blob.Rectangle.Width) > midline_x_coord) {
        blob_counter.ExtractBlobsImage(threshold_grayscale, blob, true);
        var blobimage = blob.Image.ToManagedImage();
        blobimage.Save(String.Format("{0}singlefringes/{1}_singlefringe.png", base_input_dir, counter));
        counter++;
    }
}

Since the block above doesn't return sorted fringes, another approach would be to scan the midline vertically, pixel by pixel, identifying the ordered blobs, but I'm having difficulty figuring out how to do it. A proposition would be something like this:
for (int y = 0; y < threshold_binary.Height; y++) {
    if (threshold_binary.GetPixel(midline_x_coord, y)) {
        // somehow create a List of blobs or blob indexes,
        // but only if I can find out which blob
        // this pixel is in (brute-force would be ugly, right?)
    }
}

Thanks for any suggestion!
Answer: you can sort by vertically  by chossing  how you want to get the blobs by area or size or x or y (you have to chose y) take it :
BlobCounter bc = new BlobCounter();
bc.ObjectsOrder = ObjectsOrder.YX;


SSH Authentication with Fido2 / Yubico Security Key

Question: I was wondering if it is possible to use FIDO2 to authenticate against an ssh server. There are many tutorials explaining how to use GPG and the newer Yubikeys for ssh auth, but i do not find any information on if it is possible or how it is possbile to use FIDO2 or U2F (especially Yubico Security Key NFC) to authenticate against an ssh server.
Answer: Good news!  OpenSSH 8.2 has added support for FIDO/U2F.  No more need for a patch.

FIDO/U2F Support
This release adds support for FIDO/U2F hardware authenticators to
  OpenSSH. U2F/FIDO are open standards for inexpensive two-factor
  authentication hardware that are widely used for website
  authentication.  In OpenSSH FIDO devices are supported by new public
  key types ecdsa-sk and ed25519-sk, along with corresponding
  certificate types.
ssh-keygen(1) may be used to generate a FIDO token-backed key, after
  which they may be used much like any other key type supported by
  OpenSSH, so long as the hardware token is attached when the keys are
  used. FIDO tokens also generally require the user explicitly authorise
  operations by touching or tapping them.
Generating a FIDO key requires the token be attached, and will usually
  require the user tap the token to confirm the operation:
  $ ssh-keygen -t ecdsa-sk -f ~/.ssh/id_ecdsa_sk
  Generating public/private ecdsa-sk key pair.
  You may need to touch your security key to authorize key generation.
  Enter file in which to save the key (/home/djm/.ssh/id_ecdsa_sk):
  Enter passphrase (empty for no passphrase):
  Enter same passphrase again:
  Your identification has been saved in /home/djm/.ssh/id_ecdsa_sk
  Your public key has been saved in /home/djm/.ssh/id_ecdsa_sk.pub

Answer: You can use pams provided by yubico.
libpam-yubico for otp authentication can be used. ref
libpam-u2f for u2f (can't be used with ssh since it uses libusb which reads only local ports.)
BTW: You dont need PPA it is already in repo (at least Debian).
Answer: This is possible by patching the OpenSSH server and client.
Since this patch is not integrated in the official OpenSSH code and looks pretty hacky, it could contain bugs and vulnerabilities.
Comment: could provide something about the "how" ?


Exit Velocity (sort of)

Question: Why can't a vehicle just fly into outer space at a constant velocity of, say, 50 mph instead of having to achieve "exit velocity"?
Comment: I'm voting to close this question as off-topic because it shows no research effort.
Comment: There is the space elevator, which is a rather exuberant idea for getting into space. A gondola rides this long column upwards to geosynchronous orbit. The velocity of the gondola is comparatively modest, say less than $1km/sec$ and it reaches geosynchronous orbit in a few days.
Comment: Is the vehicle a rocket/powered or a projectile/unpowered?
Comment: It took about 8 minutes for the Shuttle to get to lower earth orbit. Its top speed was on the order of 17,000 mph. _The external tank held 143,000 gallons of liquid oxygen (1,359,000 pounds) and 383,000 gallons of liquid hydrogen (226,000 pounds). The fuel weighed almost 20 times more than the Shuttle. At launch, the Shuttle, external tank, solid rocket boosters and all the fuel combined had a total weight of 4.4 million pounds. The fuel weighed almost 20 times more than the Shuttle_   http://coolcosmos.ipac.caltech.edu/ask/268-How-much-did-the-Space-Shuttle-weigh-    Go figure
Comment: If you throw a stone upwards, would gravity pull it back down again? Or will it *escape* gravity's pull? Naturally, some speed will be just enough. (And I believe you meant "escape velocity", not "exit velocity")
Comment: Here, in my question i have done some math and if you go through it thoroughly you'll come to know that how do we arrive at the exit velocity. Take a look at this -  http://physics.stackexchange.com/questions/296246/why-do-we-get-2-different-answers-for-escape-velocity-when-we-apply-different-l
Comment: Counto10, escape velocity is around 25,000 mph, you be confusing the orbital velocity of the shuttle which is around 17,0000 mph I believe.
Answer: The escape speed is computed by setting the kinetic energy $K$ and gravitational potential energy $U$,
\begin{align}
K &= \frac12 mv^2,
&
U &= - G\frac{Mm}{r},
\end{align}
so that the total mechanical energy $E=K+U$ of your system adds up to zero.
(We're assuming that the two masses are very different, $m\ll M$, which is true for planets.)
This means that if the separation $r$ between the masses became very large, the kinetic energy will be zero --- but the two masses will be very far away from each other, and so will have "escaped."
Note that it's properly an escape speed rather than an escape velocity.
The direction doesn't matter: if your little mass is moving faster than the escape speed, and there isn't some collision or drag or something to reduce its mechanical energy, it will eventually escape;
if your little mass is moving slower than the escape speed, and there isn't some chemical reaction or gravitational encounter with a third body that increases its speed, it will never escape.
You raise an interesting point that there's not any obvious law of physics requiring you to reach this escape velocity entirely upon launch.  If you could somehow maintain 50 km/h straight up, eventually you'd get to a high enough altitude $r$ that the escape speed is 50 km/h and you could shut off your car's engine and coast away into space from there.  It's pretty far, though:
\begin{align}
r_\text{drive away}
&=
\frac{2GM}{v^2}
% \\&=
% \frac{2 \cdot 7\times10^{-11}\rm\,J\,m\,kg^{-2} \cdot 6\times 10^{24}\,kg}
% {\left(50\rm\,km/h \right)^2}
% \times \left( \frac{
% 1\rm\,km\cdot3600\rm\,s
% }{1000\rm\,m\cdot
% 1\rm\,hour
% }\right)^2
% \times\left(\frac{1\rm\,AU}{150\times10^9\rm\,m}{}\right)
% \\&
=
30\rm\,AU
\end{align}
What would actually happen is that once you got out of Earth's Hill sphere you'd have to change the heading on your vehicle to worry about other gravitational sources, like the Sun.
But you wouldn't want to escape this way, even if it were possible with an ordinary chemical rocket, because of the effect of the rocket equation. There aren't any filling stations once you leave Earth's surface, so all the fuel you use must be carried with it.
In order to change a rocket's momentum you must also change the momentum of its fuel --- so
the more fuel you have, the more fuel you need, exponentially.
Your idea of traveling slow and steady makes the rocket problem worse
instead of better:
not only do you have to change the momentum of the unburnt fuel, but you have to waste energy lifting it out of Earth's gravitational well before you use it.
If instead you could use the fuel close to the ground, your rocket is more efficient, not less.
The most energy efficient launch would be an explosion on the ground that instantly imparts the final speed to the rocket, but we squishy meatbags couldn't handle the acceleration.
Gravity assists are even better.
Comment: That's a nice and not obvious answer to a simple and interesting question.
Comment: Thanks you for the responses. I deliberately did not specify a propulsion method. I understand the basics of exit velocity, but have always wondered whether the brains here that are far greater than mine might hypothesise rather than in, some cases, say I have made no effort to find out myself and vote to close the question. I wanted to keep it simple to give you the opportunity to invent not simply tel me how it's done now.
Comment: I didn't realise that comments are limited!! What I was wondering was whether it is impossible to leave the Earths pull other than by a rocket I suppose. I apologise if my questions are not technically correct, I'm not a physisist and rely on you folk knowing what I mean.

Exit Velocity (sort of)


Career Profile having bug in showing my Top 10%

Question: My All Top 10% are not showing in My Careers Profile.

Why php and mysql are not showing?
Comment: Did PHP and MySQL become your top-10 tags recently? I had a similar issue a while back that had to do with the data not being synced, but rather cached and updated once every couple of days.
Comment: Who the heck deleted my comment about php suxoring that was why.  Come on people sometimes humor that doesn't point blame at anyone is healthy on a site.  To delete it was wicked evil.
Comment: @Draco18s: I am having PHP and MySql in top 10 from many days. And if you are saying it should have appeared in top 20 % or top 30% at least :P
Comment: I figured, but thought I'd ask.
Answer: Thanks for the bug report!
This behaviour is by design; it's because you've put PHP and MySQL in your "Tech you dislike" section. Remove them from the "tech you dislike" list and they should reappear in your Stack Overflow percentiles.
Comment: Thanks. I don't remember when did I added Dislike section and mainly PHP and MySql in it. I removed it. Now it's working.


Black body radiation graph

Question: I got really confused about the graph of the relationship between wavelength and intensity of black body radiation. What does the peak stand for? And what does the graph tell us? How can we analyze it?
Comment: possible duplicate of [Thermal radiation spectrum of a blackbody](http://physics.stackexchange.com/q/3264/)
Answer: "What does the peak stand for?":
If you consider infinitesimally small ranges of wavelength values, the energy density (intensity) will be maximal at the peak.
"And what does the graph tell us?":
Considering a place of uniform temperature, with radiation in equilibrium with the surroundings, such as in a uniform temperature box, the graph tells us how infinitesimally small slices of wavelength values contribute to the radiation energy density (energy per volume).  The area under the curve is the total energy per unit volume.
"How can we analyze it?":
We can integrate a portion or all of the curve to determine the energy density in a certain wavelength range.
Comment: I don't know if I understand correctly that object in a constant temperature condition, radiates EMR of all wavelengths. The peak stands for the wavelength of EMR the object emits the most.

Black body radiation graph


Tenancies and the GDPR

Question: If Tim the tenant and Larry the landlord enter into a tenancy, then do either of them become a data controller of the others name and address? Does the landlord as the "provider" of the housing have greater burdens of propriety in handling tenants' personal data than vice versa? More broadly, do any two parties entering into mutual contract assume compliance burdens under the GDPR, and is the case especially so with respect to something so ubiquitous as tenancies?
Answer: Anyone who processes personal data using electronic means or with some filing system is a data controller, as long as

they fall within the GDPR's territorial scope,
they're not doing the processing on behalf of another data controller, and
they're not only doing the processing for purely personal or household purposes.

In todays world, it's almost certain that electronic means are involved. And establishing a rental contract generally involves some personal data. We can also assume that both parties are in the UK, and that both are acting on their own behalf.
So this leaves the household exception.

Larry the landlord will not be covered by the household exception since they're using the personal data for a business purpose. Larry is a data controller.
If Tim the tenant is renting a place to live in himself, he's probably acting for purely personal or household purposes and would not be a data controller.
If Tim the tenant is renting space for his office, for a church, or for a chessclub in which he is a member, he's no longer acting for purely personal or household means. Depending on context, Tim or Tim's organization may be a data controller.

The ICO's guidance on controllers and processors has a checklist "Are we a controller?" that lists common factors establishing controllership. On another page, they write:

Wherever personal data is used for purposes other than personal or household processing, the organisation behind it is a controller. Personal or household processing means the personal data you'd usually have in your home, such as family photo albums, friends' addresses and notes on the fridge, none of which would be covered by data protection laws unless there was another connection to a professional or commercial activity.
Comment: @JosephP. There is no distinction made between a landlord who's doing it to earn a bit of money on the side, and one who's living off the proceeds - nor indeed is there a difference in terms of responsibilities between a landlord who is a person vs one who is a company (though there are minor tax differences). Their responsibilities are the same regardless, and so it's a business regardless.
Comment: @JosephP. The question is if this is a "purely personal or household" activity. Precedent suggest that the word "purely" requires this exception to be interpreted narrowly. So I would expect neither of your examples to be covered by this exception. While the scope of the GDPR is often simplified as "it applies to businesses" that is not the criterion the GDPR itself uses.
Comment: What if Larry the landlord is either: a) renting out his own house while he lives abroad (would this be personal or business purposes?) or: b) letting out a room in his own current home?
Comment: What I mainly mean is if they aren't doing it as a professional business but rather letting out one investment property casually as an extra stream of income for the household does this exempt them from data controller status?

Tenancies and the GDPR


Objective C, How to make a active view to be appeared on the top notification menu

Question: If you open up the iPhone email application, a active view appears on the top of the notification menu next to the Wifi icon. How can I do this?
Comment: You mean the spinner next to the Wi-Fi icon?
Answer: [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];

Comment: `setNetworkActivityIndicatorVisible` is depracated
http://developer.apple.com/documentation/uikit/uiapplication/1623102-networkactivityindicatorvisible
Answer: And changed to
UIApplication.shared().isNetworkActivityIndicatorVisible = true / false

in swift 3. Xcode gently guides you from the former to new newer.
Comment: I'm using Xcode 9.1 and Swift 4 and `shared` is still a property not a method, therefore your answer is not up to date or it's just wrong.
Comment: @VSG24 There have benn many changes to the Swift language since it was release so it is quite impossible to keep all answers up to date with the latest version. Maybe it will stabilize with the current version four.
Answer: XCode 8 final, Swift 3:
UIApplication.shared.isNetworkActivityIndicatorVisible = true


debug unreal engine c++ - how to run in break mode

Question: I have a number of things not working properly with my FBX imports and I would like to understand how FBX imports work internally. Now, I am noob in software development, so how do I debug the internal C++ code of Unreal? I want to set a breakpoint in Visual Studio Code and explore variables / memory etc. I have found some sources, but for my level of knowledge, they explain nothing to me
To make it clearer: I need to debug internal code, for fbx imports, like not the code that I am writing for my game objects. Basically, I want the engine to stop at the break point once it starts importing fbx (I have found functions seemingly responsible for that)
Comment: You'll need to build the engine from source in the debug editor configuration. (You can get debug symbols off the epic launcher, but I don't really think they're particularly useful. Especially for drilling into the engine, as you would be running against optimised code.)
Comment: @George thanks for the answer. do I understand correctly that there are two options: either to get those 'symbols' or to build from source?
Comment: Yep, though I'd highly recommend building from source in your case :).
Answer: The binary distribution of the engine you get from the epic launcher is a Development build from the engine, so it will have the typical "release config" issues of debugging, with jumping around in execution and not having all local vars. Getting debug symbols from the launcher helps with call stacks and such but still won't let you go line by line
If you want to completely debug it you will have to download the source version from github and compile it in a debug configuration and run your project on that engine.


How to make field be BLOB not TINYBLOB?

Question: How to make field to be BLOB not TINYBLOB?
My mapping is follows:
private byte[] ImageBytes;

public BufferedImage getImage() {
    InputStream in = new ByteArrayInputStream(ImageBytes);
    try {
        return ImageIO.read(in);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}

public void setImage(BufferedImage image) {
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    try {
        ImageIO.write(image, "PNG" /* for instance */, out);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    ImageBytes = out.toByteArray();
}

it causes Hibernate to create TINYBLOB field in MySQL which does not fit an image.
How to make it use BLOB?
The following answer
@Lob(type = LobType.BLOB)

does not work since @Lob annotation has no parameters in my library.
Also I don't want to use ORM-specific or DBMS-specific annotations.
Answer: You can try like this;
@Lob
@Column(name="IMAGE", nullable=false, columnDefinition="blob")
private byte[] imageBytes;

And make sure your image data type is BLOB.

How to make field be BLOB not TINYBLOB?


Stream data between load cell or HX711 to RPI

Question: I built a scale with my RPI using a standard load cell and HX711, is there a way to stream the data from the load cell to the RPI either from the HX711 or from the load cell itself to the HX711? The purpose would be so I don't have any wires connecting the PI to the scale. I will have 4 scales connected simultaneously so will need separate frequencies I would imagine unless there is a different way. I am looking into a 433MHz RF Transmitter Receiver Pair but not sure if multiple can be used at the same time.
Answer: I would put an ESP32 or similar in between to Pi and HX711.
You could build some functions (e.g. tare) into the Arduino so it closer to the weigh scales than the Pi so you can check the device.  Note load cells can drift over time if constantly under load so you may need to introduce check and calibration processes.
The HX711 has an Arduino library that will collect the data from the ADC and then the sky is the limit.
I would add a simple MQTT server onto the Pi (using Mosqitto) to receive the data from the ESP and pull the data from the queue via Python on the Pi and archive / process it as needed.
Note the ESP can act as a WiFi AP for the Pi leaving the Ethernet port to be the connection to the LAN.
If you have never used MQTT a good starting place is here
Comment: Ok thanks a lot for the info, I will look into that. Ideally id like the least amount of components as possible to keep the foot print small. Currently I just have a PI, 4 HX711 connected to 22ga wire. Ideally just removing the wires would be best through some wireless module.
Comment: The HX711 is not smart.  It's designed to use the two wires as raw data so just adding an RF module would not give you timing or error correction even if just use the data output to drive a TX pin.
Comment: Thanks, I'm not looking for the HX711 to do anything further, I just want the data its getting from the load cell to stream to the PI. Error checking and timing are done in the py script.


Indoor GPS or autonomous control Solution

Question: Is there any budget solution to operate a drone indoors? I want to use it with Pixhawk 2.4.8.
As GPS does not work indoors, autonomous flight becomes impossible. So, is there any solution to provide a GPS signal indoors, so that the drone can get its positional data?
Thank you for your time.
Comment: my current thoughts would be that its probably easiest to use a small camera drone with SLAM for indoors operations (havent actually tried it out yet)
Answer: Solutions are starting to appear that use Ultra-wideband technology (same tech used by 'Smart Tags') for indoor/GNSS-denied locations. Some even output NMEA sentences to imitate a GNSS receiver, to easily integrate to existing autopilots.
I've not used this so can't recommend any examples (or how well/if it works), but a web search for 'UWB drone positioning' gives a number of results as a start point for further research.


postfix to send and receive mail from gmail

Question: Friends... I have Ubuntu server 12.04 on my computer and I have installed postfix to configure mail server.I want to send and receive mail from other domain like gmail and yahoo.I have already get a free domain.what should I do for this.should I have a public IP address for this.
Comment: Just note that even if you do all the setup correctly, your ISP may block ports 25, 143, 465, 587, 993 etc and you'll get those errors like "The recipient server did not accept our requests to connect".
Answer: Yes! If I do understand you right, would you be best of with a public static IP address for your domain.
Add a mx record and a spf record to the domain dns server.
A typical spf record could be v=spf1 mx -all.
To set up the server i suggest you to follow the instructions in the Ubuntu serverguide.
A good mail server stack could be to install:
Postfix, Dovecot and mail filtering.


What's the difference between Maximum a posteriori and Bayes' rule?

Question: What's the difference between Maximum a posteriori and Bayes' rule? They look similar, except that I do understand Bayes' rule and I don't understand MAP. The people I asked - who work in math and computer science - have never heard about Maximum a posteriori.
Answer: MAP estimator (or maximum a posteriori) is indeed Bayesian estimator. It minimizes Bayes risk for a "hit-or-miss" cost function. MAP is very close to MLE (indeed if the amount of samples goes to infinity then MAP and MLE equivalent). MAP is generally used because in some cases it allows to perform numerically efficient estimations, comparing to MLE or others. For more details you can turn to some textbooks (Kay S.M. "Fundamentals of statistical signal processing estimation theory", for example).
It is said there (Ch. 11.3), that minimization of the Bayes risk with quadratic error/"hit-or-miss" error (cost function) turns to MMSE/MAP.
Comment: I just came across this question and I was surprised to see that the first sentence of the only answer is wrong. MAP estimator is NOT a Bayesian estimator. Instead, it is a rough approximation of a Bayesian procedure. For anyone interested, read more [here](http://www.inf.ed.ac.uk/teaching/courses/mlpr/2017/notes/w8b_bayes_logistic_regression_laplace.html#fnref3).


wishy-washy caffè frappè

Question: I'm trying to do the Greek drink "Caffè Frappè". I'm using 2 tea spoon of spray dried coffee and 2 tea spoons of sugar. I've added a little of iced water and blended with an hand mixer until it's whipped. After that I add water until the glass is full, but the water/coffee is too much diluted. Am I making any mistake? Suggestions?
Answer: I would also recommend that you find dried coffee by Nescafe - specifically the Greek brand if you can find it.  Depending on where you live it can be hard to find but is totally worth it and for some reason foams better than regular Nescafe.  If you search the internetz you will find that there is a Nescafe with a label written in Greek.  This is the one you want!
Once you have strong enough dried coffee to start with then it is only a matter of ratios with water and the coffee.  Experiment, but two teaspoons sounds like not enough - I'd start with a tablespoon to 3 tablespoons water.  Pour over ice.  Add water after you have mixed it but be careful not to ruin the foam you just created.  Remember the ice will start to melt immediately also making your frappe taste wishy washy so make it stronger from the start.
Comment: The Nescafé they use in Greece is called "Nescafé Classic". In Switzerland where I live (and also where Nestlé have their HQ, hehe) I never found any Nescafé Classic, only "Gold", "Red" and whatever... I used to buy it when on holidays in Greece, but I have seen it in stores in France too. Are you sure the Nescafé Classic sold in Greece is different than in other countries? BTW: When you're in Greece,  try out a caffé freddo! It's a real Espresso with ice topped with foamed milk, I began to like it a lot more than frappé :)
Answer: Use less water or more dried coffee.
Answer: My error was that I poured the water along the edge of the glass, I had to pour it directly on the foam, in this way the water dissolves the coffee since it has a bigger surface in contact with the foam.

wishy-washy caffè frappè


Mining with a GTX 1080 and Radeon 570 on the same machine

Question: So currently I am able to mine with either one on their own by specifying the --opencl-platform, if I try to run them both then it crashes when it is "Grabbing DAG for ...".  I am using --no-precompute, and it makes no difference.
Answer: I reinstalled geth and ethereum in a separate location on my machine and used the --dag-dir option to select another location.  Now it is generating another DAG file.  I'll update this if it works.  This also could have had something to do with me not running as administrator before.
EDIT: It is working now, I think just having the separate DAG file is what did it.


How to capture a rectangle within the Quantum GIS software?

Question: I want to use "capture polygon" function in QGIS software to draw the indoor office cubical which is a rectangle shape. But the "capture polygon" function is not able to draw a perfect rectangle shape. How to draw a rectangle feature in Qgis software when you are creating a feature?
Answer: You can chose between CAD Tools plugin which is more complex and more powerful,
or Rectangles ovals digitizing plugin.

After installing the plugin you may have trouble to locate the plugin tool icon or buttons. Look for the plugin tool icons in the toolbars, they are probably in grey color.
Comment: I have installed the "Rectangles ovals digitizing" plugin but I am not able to see the nice tool bar on my QGIS software interface. All I get is some message says: "This plugin is working properly if your input point layer is projected in coordinate system with Northings and Eastings are measured in metres and your width and height value are set in metres". I don't quite understand it. I guess I have to setup some parameters when I add the "raster layser" in order to use this nice plugin?
Comment: It is saying you need to use a UTM projection. Set this in project properties/settings CRS. Also the same setting is accessible from the bottom right of the screen. To find a suitable projection for your territory, google EPSG. You want to find what zone you are in for the second part of the sequence
WGS / UTM Zone 43N
Comment: I have found the plugin tool bar after a thorough checking on my QGis software panel. (there are too many icons) So it's right to follow the above instructions to download/install the plugins. Even though there are warning message but you can just ignore it and proceed to use the plugin without problem at all. I have amended the answer to include this discovery.


Determining which pin triggered a PCINTn interrupt?

Question: Am I correct in thinking that if you have two pins causing the same AVR PCINT interrupt, (e.g. PCINT0 vector caused by either PCINT0 or PCINT1 pins -- I think the naming overlap of vectors and pins is confusing) the only way to determine which pin(s) caused the interrupt is to record their state after each interrupt and compare the previous and current values of all the pins which are enabled in PCMSKn?
Comment: It's been a while since I've used an AVR, but I'm sure there has to be a flag that get triggered for the right pin. This flag should clear after the interrupt occurs, so that you don't need to store the state. The fact that the flag is set should be enough
Comment: @gl3829 the flags are per group of pins if I am understanding correctly
Answer:
I think the naming overlap of vectors and pins is confusing

It is!
The reason there are 8 different external pins for an interrupt vector is to make it easier to layout the PCB or to use a different pin if there is a conflict with another pin function.

Am I correct in thinking ... the only way to determine which pin(s)
  caused the interrupt is to record their state after each interrupt and
  compare the previous and current values of all the pins which are
  enabled in PCMSKn?

Pretty much, lets say you only care about PB0 (PCINT0) and PB1 (PCINT1). So the pin change enable mask PCMSK0 would be set to 0x03.
// External Interrupt Setup
...

volatile u_int8 previousPins = 0;
volatile u_int8 pins = 0;

ISR(SIG_PIN_CHANGE0)
{
    previousPins = pins; // Save the previous state so you can tell what changed
    pins = (PINB & 0x03); // set pins to the value of PB0 and PB1
    ...
}

So if pins is 0x01 you know it was PB0... And if you need to know what changed you need to compare it to previousPins, pretty much exactly what you thought.
Keep in mind in some cases, pins may not be accurate if the pin has changes state since the interrupt but before pins = (PINB & 0x03).
Another option would be to use separate interrupt vectors with one pin from each vector so you know which one is changed. Again, this also has some issues, like interrupt priority and once the CPU enters the ISR, the global interrupt enable bit I-bit in SREG will be cleared so that all other interrupts are disabled, although you can set it inside the interrupt if you want, that would be a nested interrupt.
For more information, take a look at Atmel's app note Using External Interrupts for megaAVR Devices.
Update
Here is a complete code example I just found here.
#include <avr/io.h>
#include <stdint.h>            // has to be added to use uint8_t
#include <avr/interrupt.h>    // Needed to use interrupts
volatile uint8_t portbhistory = 0xFF;     // default is high because the pull-up

int main(void)
{
    DDRB &= ~((1 << DDB0) | (1 << DDB1) | (1 << DDB2)); // Clear the PB0, PB1, PB2 pin
    // PB0,PB1,PB2 (PCINT0, PCINT1, PCINT2 pin) are now inputs

    PORTB |= ((1 << PORTB0) | (1 << PORTB1) | (1 << PORTB2)); // turn On the Pull-up
    // PB0, PB1 and PB2 are now inputs with pull-up enabled

    PCICR |= (1 << PCIE0);     // set PCIE0 to enable PCMSK0 scan
    PCMSK0 |= (1 << PCINT0);   // set PCINT0 to trigger an interrupt on state change

    sei();                     // turn on interrupts

    while(1)
    {
    /*main program loop here */
    }
}

ISR (PCINT0_vect)
{
    uint8_t changedbits;

    changedbits = PINB ^ portbhistory;
    portbhistory = PINB;

    if(changedbits & (1 << PB0))
    {
    /* PCINT0 changed */
    }

    if(changedbits & (1 << PB1))
    {
    /* PCINT1 changed */
    }

    if(changedbits & (1 << PB2))
    {
    /* PCINT2 changed */
    }
}

Comment: The mega has three pin change interrupts, with vectors PCINT[0-2], but each of those is triggered by a set of pins. My question is about how to distinguish which of the pins in that set caused the interrupt.
Comment: @TomDavies you are correct, thanks, I changed my answer however it is exactly what you thought. And I read through the datasheet, there is no flag to indicate what pin changed.
Comment: @ Garret:
Did you recognize that in your original example one can easily determine whether it was the falling or the rising edge that triggered the interrupt? (well, unless both pins changed at the exact same moment ... but in this case only black magic helps) (previous_pins > pins): falling edge (previous pins < pins): rising edge Maybe this is worth being mentioned above.
Comment: @TomDavies PINB covers PCINT0-7, PINC covers PCINT8-15 etc
Answer: On the newer ATTINY series INTFLAGS register will tell you what port bit has caused the interrupt.
Here is excerpt from datasheet:

Bits 7:0 – INT[7:0]: Interrupt Pin Flag The INT Flag is set when a pin change/state matches the pin's input sense configuration. Writing
  a '1' to a flag's bit location will clear the flag.


In the chromebook era, should I fear keyloggers?

Question: Suppose we go to a cyber cafe that uses chromebooks. Since the OS is designed to make it difficult to install software keyloggers (by tampering the OS), and it is also difficult to install hardware keyloggers, should I fear that my keystrokes could be being logged?
Answer: Yes. Always assume that your activity -- including your keystrokes -- could be monitored/recorded any time you are using a computer that you do not physically control.
Sure, Chrome OS may make it nigh impossible to install a software keylogger, but "difficult" or even "extremely difficult" is not the same as "impossible". Further, you have no way of knowing that the OS at that cyber cafe is in fact Chrome OS, as opposed to something else that's been carefully designed to look like Chrome OS. Or, alternatively, it might be a completely legit Chrome OS, but running under a hypervisor of some kind that is itself logging your keystrokes.
As for hardware keyloggers: They aren't difficult to install at all. If the keyboard isn't physically built into the computer (i.e. not a laptop keyboard), it's as simple as plugging in a potentially very tiny device (apparently these things are now wi-fi enabled even!) between the keyboard's cord and the port on the computer. And you know those little round thingies you often see on e.g. monitor cords? In theory (though in practice I know of no such device) a keylogger could be designed to be attached to the keyboard cable in much the same way, reading the keyboard input via the magnetic field the electrical signals inherently generate without actually making physical contact with any wires. (I do know of "vampire" attachments for hardware network sniffers that function in this manner.) Further, keyboards can have built-in keyloggers, requiring someone to merely swap out a legit keyboard with an identical-looking on with a built-in keylogger.
Upping the complexity a little, a legit keyboard almost always has a single controller chip on it; this chip could relatively easily be replaced, or another chip added to the same connectors, to turn a legit keyboard into one with a built-in keylogger.
Laptop keyboards are much harder to get hardware keyloggers into, but, again, "much harder" is not the same thing as "impossible".
Comment: Just to fuel the paranoia a bit, [have a look](http://hackaday.com/2009/03/20/sniffing-keystrokes-via-laser-power-lines/).
Comment: @Eroen Yikes! I've known of TEMPEST for a long time, but this new one is far more plausible and actually achievable!
Answer: Currently a lot of Chrome OS is being used based on one person (hexxeh) compilation (Flow, Lime, Vanilla etc.), it doesn't seem to be anyone involved or co-operate with him. So as far as you know he could be putting a keylogger in his build and laughing all the way to the bank - how can you tell !? (Has anyone actually investigated/monitored his build !?)
Answer: If we're just talking about the ChromeOS you get when you purchase a new Chromebook then I'd say you have less to fear than with another flavor of computing device.
As @Kromey says, anything can be compromised and standard PCs have a lot of potential vulnerabilities.  A Chromebook has a built-in keyboard and display so the peripherals are more secure.  On top of that, the OS is built with a number of security features like process namespacing, storage block hashing, and a kernel signature to reduce the threat of tampering to the underlying OS (see https://www.youtube.com/watch?v=1u3mTNj3TJ0).
That leaves your Chrome web pages, extensions and web apps as the biggest risk.  If the keylogger is injected into a web page via the web server then there's not much you can do about it.  Both extensions and web apps require users to choose to install them; if you choose not to then you're safer.  The content of these extensions can be reviewed by any interested party, it's all open source if you know where to look.  And lastly, any extension or web app from the Chrome web store has to name the permissions it wants in it's manifest file so users have a chance to know what the thing can do to the web pages they're viewing.
Overall, I believe that Chromebooks run the most secure consumer OS out there.  In part due to the custom hardware it sits on and in part due to the reduced functionality (and attack surface) of the system.


Standard methods for documenting a RESTful API

Question: I'm writing a specification for a RESTful API for a new internal web service. It's not hugely long and fairly simple, but even so, it's my first time using strict REST (as opposed to cheating for practical reasons - avoiding PUT and DELETE because they're a pain in PHP, and so on). I was wondering if there were any standard methods or best practices for documenting a REST interface? I want the rest of the team to understand it at a glance, and for anyone that wants to write a client to be able to do so without understanding the underlying code.
Comment: Possible duplicate of [RESTful API Documentation](https://stackoverflow.com/questions/1966243/restful-api-documentation)
Comment: possible duplicate of [RESTful API Documentation](http://stackoverflow.com/questions/1966243/restful-api-documentation)
Answer: Sure, REST APIs should ideally use HATEOAS and be hypertext driven (with heavy use of media types), but also having simple human-friendly documentation for developers to work off of is helpful.
Some specific tools that are helpful for generating documentation like this:

Swagger

An open spec for describing REST APIs [ github ]
Tools for auto-generating

Documentation
Code for your API

Donated to the OpenAPI initiative and renamed OpenAPI in 2015

Mashery

An open source project [ github ]
Tools for generating

Documentation
An exploration interface for your API

Apiary and API Blueprint

Write the API description in a DSL within markdown
Tools for auto-generating

Documentation
Mock server

Seems to be focused on ruby+mac devs

RAML

A spec for describing REST APIs [ github ]

WADL

A spec for writing discoverable API docs with XML
Some discussion comparing WSDL and WADL

APIgee

A commercial product with some documentation features

3scale

A commercial product with some documentation features

miredot

Commercial REST API documentation generator
Java specific
Comment: you should also add miredot http://www.miredot.com to the list
Comment: @java_geek Sure, thanks for the rec. Feel free to edit if you find more.
Comment: Conversions between API-description formats are also worth noting, for example https://github.com/lucybot/api-spec-converter and http://studio.restlet.com/
Answer: I've been using http://apiary.io, which is pretty nice. You can also export the API documentation to github.
Comment: Isn't it documenting how to build URIs ? .. which sounds against HATEOAS ?
Answer: In Roy's post here he states

A REST API should spend almost all of
  its descriptive effort in defining the
  media type(s) used for representing
  resources and driving application
  state, or in defining extended
  relation names and/or
  hypertext-enabled mark-up for existing
  standard media types. Any effort spent
  describing what methods to use on what
  URIs of interest should be entirely
  defined within the scope of the
  processing rules for a media type
  (and, in most cases, already defined
  by existing media types).
Comment: I think that what you're saying is that the API should be self-documenting and logical enough not to need documentation. That's fair enough. However, somewhere along the line, I'm going to need to give people a list of allowed calls at the very least. I want to know if there's some sort of accepted structure for said list.
Comment: No.  Media-types definitely need documentation.  Here are a bunch of examples http://www.iana.org/assignments/media-types/application/
What your documentation should not include is a list of URLs.  That will just encourage client developers to hardcode those urls into their application.
Comment: Maybe I can make up a useful example.  Imagine going to a foreign country where you do not speak the language and going to a library to look for some information.  Imagine if you asked for help and the person explained to you the concept of a bookshelf, ISBN cataloging, that books contained pages and you read the book from front to back.  All valid information but you already know that.  You need someone to translate the content.  On the web we know about Urls and hyperlinks, we know how to use HTTP verbs.  We just need to understand the details of your content.
Comment: Gotcha. This was my gut feeling too: provide detailed explanations of what each call *does*, not what it *is*. I'm thinking there isn't a standard method for doing this, but hell, I guess winging it never hurt anybody (don't quote me on that). Thanks for your help.
Comment: @Mark So you would only be able to develop for each endpoint by actually querying the endpoint first and then writing your own documentation to describe the endpoint? That doesn't seem very user friendly.
Comment: So say someone wants to use your API and is unable to access the source code, how would they know what fields are required for POSTing a new "student" for example?
Comment: @NickCoad Your server could teach its clients how to construct a valid Student by returning a `template` property (which outlines the required/accepted fields), as part of its response to GET requests. The client could then parse this template to learn how to create a well-formed Student before POSTing back to the server.
Answer: A good ReST documentation would mean documenting your media type and only your media type.
In a typical scenario, you'd produce a document like so:
The Acme Corp XML formats
Link Discovery
Links to various resources are described in a document that can be found by issuing a GET or HEAD request to the server on a bookmark URI (typically the root of the server, http://www.acme.org), and looking for an HTTP Link header:
Link: <xxx>;rel="http://rel.acme.org/services";type=application/vnd.acme.services+xml

where the rel part is the link relationship, and the xxx is the URI for which the relationship has been established.
Link Relationships
This document defines the following relationship names:

http://rel.acme.org/services
The link relationship describes the list of links that can be navigated.
http://rel.acme.org/customers
The link for which this relationship is used is the list of customers.

Media Types
The application/vnd.acme.services+xml is a document with an xml serialization that describes a list of links an application may want to process.
<links>
 <link rel="http://rel.acme.org/customers" href="http://www.acme.org/services/customers" type="application/vnd.acme.customers+xml" />
</link>

The applcation/vnd.acme.customers+xml is a document with an xml serialization that describes customers.
Example documents:
<customers>
 <customer firstname="Darth" lastname="Vador" href="http://www.acme.org/services/customers/28" />
</customer>

etc...
The point is to give a way to the developer to follow the links you define. First find the link to the index so they can get the list of things they can navigate to.
Once they discover that document, they discover that they can see a list of customers at a certain Uri, and can do a GET against it.
If they find a customer of interest, they can follow the link defined in /customers/customer/@href and issue a GET to retrieve a representation of that customer.
From there, your media type could embed actions that are available to the user, using more links. You also have the additional option of issuing an OPTIONS request on the resource to know if you can allow deleting the resource, or a PUT if you can save the document back after modification.
So a good documentation doesn't ever:

give static links
give interaction such as "you can issue POST on Customer with this media type and that will mean the move operation". The client should issue a POST against Customer only because your XML document has specified it that way.

The point of all this is to achieve minimum coupling between clients and servers. The client can be very smart in displaying and discovering resources (showing forms and god knows what else), but is totally dumb as to what the actual workflow is: the server decides.
Comment: OK, so I should mainly be using link discovery to document the API. How exactly do I construct such an XML document? Got any links?
Comment: Yes, you would document how to discover links and actions in your media type.

As for how to do it, have a look at ATOM and HTML, that's pretty much all you need: a  and some way to convey an action that you want to display in your client.
Answer: At my company, we've been very happy using WADL, Web Application Description Language. Wikipedia describes it as: "an XML-based file format that provides a machine-readable description of HTTP-based web applications". I find raw WADL easy to write, read, and understand, and it maps directly to RESTful concepts. The official project provides a simple spec, XSD and RELAX NG schemata, and Java tools.
A number of tools and resources exist for working with WADL, including:

wadl_stylesheets, XSLT stylesheets to create HTML documentation from WADL files
Restlet, a Java framework for building RESTful servers and clients, includes a WADL extension

A tip: try including human-readable documentation, such as descriptions, concepts, getting started, usage tips, etc, in the WADL document's doc element by including HTML elements, using the XHTML namespace. It can make a big difference!
Comment: An ongoing discussion in Rest-discuss [1] shows that a number of REST advocates see little advantage to using WADL.

[1] http://tech.groups.yahoo.com/group/rest-discuss/message/12680
Comment: I've looked into WADL, but it seems that it's more oriented towards machine interpretation rather than documentation. I don't need to tell the computer how to deal with the API - that only needs to be written once. I do need to tell people how to write clients, and so people are my primary audience.
Comment: You can also generate client side stubs with WADL, for strongly typed languages.  E.g. see wadl2java
Answer: You might find rest-tool useful.
It follows a language agnostic approach to write specification, mock implementation and automated unit-testing for RESTful APIs. It also provides a cook-book however it is in a very early stage, but its content is continuously growing.
The services you just described can be immediately used, so it is also good for experimenting.
Answer: Initially, we went for static documentation of resources but just had to field too many questions. Eventually, we moved to using Live documentation pages using IO/Docs (actually a fork).
Been working great.
Answer: To create understanding/documentation, heavyweight solutions aren't always needed. Examples of (great) heavyweight tools are: IO/Docs / Apigee (although great tools).
For tiny projects that already have a docchain setup (doxygen/phpdoc/phpdoctor/custom/etc) I use the following shellscript to just include the page in the full generated documentation:
https://gist.github.com/4496972
A demo: http://pastie.org/5657190
It just use custom comment-tags in your sourcecode.
It can also be a nice starting point for documenting any sourcecode (language).
Comment: [It would be preferable](http://meta.stackexchange.com/q/8259) to include the essential parts of the answer here, and provide the link for reference.


NotSerializableException escaping Spring Controller and causing problems with Google App Engine Queue

Question: I have a Spring Controller that is being invoked via an HTTP POST from the GAE Queue Scheduler.
@Controller
@RequestMapping(value = RSSPoller.RSS_POLLER_URL)
public class RSSPoller implements Serializable {
  private static final long serialVersionUID = -4925178778477404709L;

  public static final String RSS_POLLER_URL = "/rsspoller";

  @RequestMapping(method = RequestMethod.POST)
  @ResponseStatus(HttpStatus.OK)
  public void pollAndProcessRssFeed() throws ServiceException  {
    try  {
      // do some stuff
    }
    catch(Exception e)  {
      throw new ServiceException("Can't process RSS feed because", e);
    }
  }
}

However when it gets invoked, the response code is 500 with a Critical log message of
Uncaught exception from servlet
java.lang.RuntimeException: java.io.NotSerializableException: <some spring class that changes all the time, but does not implement java.io.Serializable>

The same log message shows up in the logs with a Warning level as well.
I get similar warning messages (but not critical) in my logs when I invoke other Spring Controllers that either render a web page (GET), or returns some XML data (essentially RPC invokes which use HTTP POST).  When I do an HTTP GET/POST to those URLs, the response code is 200 and the output is correct (and I ignore the warning message in the logs).
That leads me to two questions:

Why do I get the Critical error message/HTTP 500 for the POST from the queue, but not the GET/POST to other Spring Controllers in my app?
How can I trap the exception and essentially discard it; as to my purposes the task is complete.

I can post the full exception log if it's of use; for brevity I've omitted it.
Answer: you should make your <some spring class that changes all the time, but does not implement java.io.Serializable> just Serializable (not only Controller). Me at least helped it.
Comment: I did attempt to do that, but the object graph drew too unwieldy.  One would have to make every class in Spring Serializable ;) I eventually gave up.


Bitbucket - Mandatory Pull request

Question: In bitbucket is it possible to make a pull request a mandatory step? So after a change someone can't merge with original branch? I would prefer that they have to create a pull request then it should go through review process.
Comment: I never used it myself, but I googled "bitbucket mandatory pull request" and that pointed me towards the documentation on [branch permissions](https://confluence.atlassian.com/bitbucketserver/using-branch-permissions-776639807.html) which has the winning *prevent changes without a pull request* checkbox.
Comment: You must create pre-commit hook. Refer https://stackoverflow.com/a/40465455/4068218
Answer: You didn't specify whether you were asking about Bitbucket Cloud (the one that Atlassian hosts, bitbucket.org) or Bitbucket Server (the one that you host yourself, with some other URL). Both can handle this in branch permissions, but the specific details will vary a little.
For Bitbucket Server, Gimby left a link in the comments which should address that. You may need to look for your specific BB Server version to get the most appropriate documentation, though.
For Bitbucket Cloud, https://confluence.atlassian.com/bitbucket/branch-permissions-385912271.html should cover it. You can give a small number of people the ability to write directly to the branch(es) in question, or you can skip that, but the important field is defining who can merge to that branch (or those branches) via pull request.

Bitbucket - Mandatory Pull request


2 CentOS boxes - one can't SSH to the other using publickey auth?

Question: I have 2 CentOS boxes with literally identical sshd configs and overall setups.
Box A can SSH to Box B just fine, but Box B can't SSH to Box A using publickey authentication (works fine with password auth). I've checked and re-checked the keys, setup, etc. literally 100 times and it just won't work.
When Box B offers the RSA public key to Box A, Box A literally just seems to ignore it. Normally it should return a packet of "type 60" but instead it again returns a type 51 and re-announces the authentications that can continue.
Here's the debug info. Does anyone have any idea what might cause this?
debug1: Offering RSA public key: /home/patrick/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
...

And here's the relevant part of my /etc/ssh/sshd_config:
Subsystem   sftp    /usr/libexec/openssh/sftp-server
GatewayPorts no
AllowTcpForwarding yes
KeepAlive yes
Protocol 1,2
Port 8855
IgnoreRhosts yes
IgnoreUserKnownHosts no
PrintMotd yes
StrictModes yes
PubkeyAuthentication yes
PermitEmptyPasswords no
RSAAuthentication yes

And this is using OpenSSH_7.4p1, OpenSSL 1.0.2k-fips on both boxes.
Answer: Crazy, it was an selinux issue. Just figured it out. I had to do:
restorecon -R -v /home/patrick/.ssh
Just putting this here for posterity ...


Block expands more than the height of content when using collapsiblock module?

Question: I have applied the collapsible property to one of the block using Collapsiblock in Drupal 7. everything working fine, but the issue is that, after clicking for slide, it slides more than the content height and then after again in back slides and then fits to the content. I want that it just slide till its content and stops on first instance. Please see attached Image.
Answer: This is a wild guess (no time to test this) but you could try some of the following and see if this will make a difference:

Try using a different version of jQuery (download and install jQuery Update and then go to Configuration>Development>jQuery update and test different versions. Don't forget to clear the cache every time before the test).
Try tinkering with your CSS classes for the block and its contents to include a max-height: 100% property. For example, try this for the ID of the block (e.g. #block-block-2) and/or for the .content class inside that block (#block-block-2 .content)
Comment: It's Perfect. First option worked perfectly, just installed module and cleared the cache and done. Very Thanks...


Register a prepaid sim card to a used iphone 4

Question: Is there a way to register my prepaid sim card to the iphone 4s without using iTunes?
Answer: if the phone is unlocked, this shouldn't be a problem. I have a 4s that I use in the US with an AT&T account, and in Europe, with a pre-paid SIM. My phone is unlocked as AT&T allow/enable this after a 2-year contract period. I don't know about other carriers.
Depending on your iPhone software version, it may be possible to unlock the phone with various software. The legality of this is questionable, as is the result. For example, you won't be able to update the iPhone software to iOS7 until another unlock (jailbreak too) is made available.
Hope this helps.


how to change the intensity of two lights at the same time?

Question: how to change the intensity of several lights at the same time keeping the aspect ratio in a static scene? for example: change the intensity of several area lights directly on the intensity button of any one of the lights and all the others in the group also undergo change keeping the proportion established previously?
Comment: Use drivers and encode ratio in drivers
Comment: Hover over source intensity. right click copy  as new driver. hover over dest. right click paste drive. right click edit driver. switch to script expression type x * var in expression. use what you want for c
Comment: @thelabcat is that ok?
Comment: do you have a tutorial? I already tried to configure the driver , but I can not get results ?
Comment: @MrBill that was a bit cryptic, but if you can simplify it I will upvote it as an answer. I might also add that you can use a single custom property to drive all the lights, which means that it will have as zero to one value that will be easy to multiply by and set things up.
Answer: To use one property to drive another you create a driver from the first property. then copy the driver to the second property. then edit the driver to do what you want.
You create a driver by hovering over the property input, right click, and select copy as driver
You copy it by hovering over the second property input, right click, and select paste driver.
You edit the driver by hovering over the second property, right click and select edit driver.
You want to do this with the lights intensity.
The new driver is set to average value but you want to multiply intensity. change ave value to scripted expression in driver editor. new input will show up. type x * var in field. but for x use number you want to multiply by.
You can copy the driver to each light and replace x by a different value to set different proportions.
If you want all lights using same intensity you can make a new custom property and make the driver from it.
Comment: I'm sorry for the confusion
but I can't set the aspect ratio.
is there a tutorial with images about this configuration?
Comment: another question: how do I configure the intensity to be changed from any light in the group while maintaining the proportion?
Comment: actually I wanted to adjust the intensity of several lights and then with a button change the intensity of all the lights keeping the proportion. it's possible ?
Comment: I think you are wrong.
according to the video the settings are different from the ones you mentioned. in any case thanks. follow video with tutorial: https://www.youtube.com/watch?v=p8ER1wOOg1Y


Structure of the torus of the Active Galactic Nucleus

Question: How much do we know about the structure of the torus surrounding the Active Galactic Nucleus (AGN)? Is the shape defined or still under speculations? And are there different structures for this torus possible i.e., does it vary from galaxy to galaxy?
Comment: stp30 you've been asking a lot of general questions about AGN recently; it may be best to wait until you have a more specific question in mind. For example, typing 'AGN Torus' in to google gives a number of recent papers and discussions about the range of shapes of torii observed and theorised in the past decade
Answer: This question was asked more roughly 8 years ago, and for 2 years there is a review article around which I found worth mentioning and summarizing. The manuscript is called Redefining the torus:  A unifying view of AGN in the infrared and sub mm and work of Sebastian Florian Hönig. Here an excerpt of the abstract:

The advent of high-angular resolution IR and sub-mm interferometry allows for spatially-resolvedobservations  of  the  parsec-scale  environment  of  active  galactic  nuclei  (AGN),  commonly  referred  toas the "torus."  While molecular lines show the presence of large, massive disks, the IR observationsappear to be dominated by a strong polar component that has been interpreted.

The main result seems to be the following schematic picture (Fig. 4 of the manuscript) of the AGN which is an overlay of various observations:

The purple ring are observations in the near-IR.
The yellow torus and the gray dashed lines are from ${\rm H}_2$ emission.
The main brownish cone is from mid-IR.
The redish wobbly plane with the red (solid) arrows and the purple (dashed) arrows are sub-mm obseravtions (${\rm CO/HCN/HCO^+}$)
Bright green dots on the $x$-axis are ${\rm H_2 O}$ maser emissions.


Strange window on desktop labeled IPNServiceForm

Question: Starting yesterday, I've had this little window pop-up on my desktop. It won't go away until I click on it and then just pops-up again. I looked at Task Manager, and I don't see any processes that might be associated with it. I've run a scan, and it's not malware, and searching Google returns no results (which I find incredible). Has anyone else seen this before and can shed some light on it? I am running Win7 x64.
Comment: Apparently, I didn't look at my Task Manager closely enough. It's part of RedGate software's suite of tools.
Answer: a quick search on google for me would suggest IPN is Instant Payment Notification from PayPal (https://www.paypal.com/ipn).
I would be concerned why anything would be using IPN without your knowledge - what have you run a scan with? I would suggest trying a full scan with avast (anti-virus) and spybot (anti-malware) as a matter of precaution.
In task manager look at the processes tab rather than the applications tab and tick show processes from all users, this will list everything that's currently running, if something looks suspicious, google it.


which version of linux should I use?

Question: I have an old computer that I want to install Linux on it and use it as file server (for backup). My old computer has 512MB ran and an old Pentium. Which Linux should I use?
Comment: try over at http://unix.stackexchange.com/
Answer: Since your building a file server, you may want to look at a distro like OpenFiler.
Answer: I use Debian on just such a rig. I used the text mode installer and didn't install X. It works quite nicely. I used the netinstall and started out with a pretty minimal system, which is all you'll need for a file server.

which version of linux should I use?


Python: Check image brightness

Question: I want to do a test for image brightness in the rendered image (bpy.data.images["Render Result"]). I would like to be able to see if the image is dark or light. An example output of the code could be The rendered image is: light
Comment: In relation to what?
Comment: maybe related: http://blender.stackexchange.com/questions/66503/how-to-measure-the-dynamic-range-of-an-hdri
Answer: You can access the pixel data directly through the Image.pixels property. It is a list of repeated RGBA values. To access a single pixel, use this:
img = bpy.data.images["Render Result"]
value = img.pixels[(y * img.width + x) * 4 + channel]

where channel is 0 for red, 1 for green, 2 for blue and 3 for transparency.
Now, image brightness is not a clearly defined thing. You can, for example, calculate the average pixel value over the whole image:
r, g, b = [sum(img.pixels[:][i::4]) / len(img.pixels) for i in range(3)]

That was "average" as in "arithmetic mean". Another possible interpretation of image brightness is a quantile, say, the 95th:
import numpy as np
r, g, b = [np.quantile(img.pixels[:][i::4], 0.95) for i in range(3)]

The specific choice probably depends on the kind of images you are processing.
Comment: The maximum value is often 1, and it means that at least one pixel of the whole is bright. If you want a more specific measure of brightness, be more specific in your question.
Comment: This just gives me 1.0 every time.
Comment: So how to I calculate image brightness from this?

Python: Check image brightness


How to find command TexMaker used

Question: As I'm still VERY new to Tex I have been using TexMaker (niavely) to generate my pdf's.  I have a doc I have been working on for some time that someone else wants to manually generate with my tex files on a remote computer.  They asked me what command I used to created the document.  How do I find the command that TexMaker would run if I was just to use command line options (and not TexMaker)?  I looked in the log file that is generated but nothing really jumped out at me.
Comment: You'll probably find the exact command-line options passed under [TeXMaker's Quick Build settings](http://www.xm1math.net/texmaker/pics/quickbuild.png), or... elsewhere.
Answer: You can find all the details of commands used in Options --> Configure Texmaker. For pdflatex, I have highlighted the command. Please note that %.tex refers to your file name that is currently open in texmaker.

These are the default settings. You may also have a look at the Quick Build window.
Comment: Exactly what command is used depends of course on which tool is chosen from the Tools menu (or which shortcut is pressed). If Quick Build (F1) is used, a combination of the tools listed in the above screenshot may be used, though I guess pdfLaTeX is default(?).
Comment: @TorbjørnT. Yes you are right. But without any knowledge of OP's settings we are blind. :)
Comment: Yeah, I sort of meant it as additional information to the OP.
Answer: If you are using LaTeX (and not TeX) you probable are using pdflatex to generate your PDF (latex will generate a DVI file), e.g.
$ pdflatex your_doc.tex

TexMaker probable use some flags as -interaction nonstopmode. For information about the this and others flags
$ man pdflatex

If the remote machine have PERL installed I suggest that you use latexmk since it will compile your document the number of times it need to properly generate the PDF (cross-reference need that the document be compiled at least two times). E.g.,
$ latexmk -pdf your_doc.tex

How to find command TexMaker used